diff options
Diffstat (limited to 'docs')
-rw-r--r-- | docs/_summary.md | 1 | ||||
-rw-r--r-- | docs/cli.md | 4 | ||||
-rw-r--r-- | docs/cli_development.md | 6 | ||||
-rw-r--r-- | docs/coding_conventions_python.md | 4 | ||||
-rw-r--r-- | docs/feature_encoders.md | 2 | ||||
-rw-r--r-- | docs/ja/feature_command.md | 56 | ||||
-rw-r--r-- | docs/ja/feature_dynamic_macros.md | 71 | ||||
-rw-r--r-- | docs/ja/feature_encoders.md | 81 | ||||
-rw-r--r-- | docs/ja/feature_grave_esc.md | 37 | ||||
-rw-r--r-- | docs/ja/feature_hd44780.md | 62 | ||||
-rw-r--r-- | docs/newbs_getting_started.md | 17 | ||||
-rw-r--r-- | docs/proton_c_conversion.md | 69 | ||||
-rw-r--r-- | docs/spi_driver.md | 19 | ||||
-rw-r--r-- | docs/syllabus.md | 70 | ||||
-rw-r--r-- | docs/tap_hold.md | 4 | ||||
-rw-r--r-- | docs/unit_testing.md | 2 |
16 files changed, 484 insertions, 21 deletions
diff --git a/docs/_summary.md b/docs/_summary.md index d47b252c0..842422665 100644 --- a/docs/_summary.md +++ b/docs/_summary.md @@ -6,6 +6,7 @@ * [Testing and Debugging](newbs_testing_debugging.md) * [Getting Help/Support](support.md) * [Other Resources](newbs_learn_more_resources.md) + * [Syllabus](syllabus.md) * FAQs * [General FAQ](faq_general.md) diff --git a/docs/cli.md b/docs/cli.md index 760fe1cdb..01641bd8b 100644 --- a/docs/cli.md +++ b/docs/cli.md @@ -6,7 +6,7 @@ The QMK CLI makes building and working with QMK keyboards easier. We have provid ### Requirements :id=requirements -The CLI requires Python 3.5 or greater. We try to keep the number of requirements small but you will also need to install the packages listed in [`requirements.txt`](https://github.com/qmk/qmk_firmware/blob/master/requirements.txt). These are installed automatically when you install the QMK CLI. +QMK requires Python 3.6 or greater. We try to keep the number of requirements small but you will also need to install the packages listed in [`requirements.txt`](https://github.com/qmk/qmk_firmware/blob/master/requirements.txt). These are installed automatically when you install the QMK CLI. ### Install Using Homebrew (macOS, some Linux) :id=install-using-homebrew @@ -21,7 +21,7 @@ qmk setup # This will clone `qmk/qmk_firmware` and optionally set up your build ### Install Using easy_install or pip :id=install-using-easy_install-or-pip -If your system is not listed above you can install QMK manually. First ensure that you have python 3.5 (or later) installed and have installed pip. Then install QMK with this command: +If your system is not listed above you can install QMK manually. First ensure that you have python 3.6 (or later) installed and have installed pip. Then install QMK with this command: ``` pip3 install qmk diff --git a/docs/cli_development.md b/docs/cli_development.md index 2a967de4a..af86686c0 100644 --- a/docs/cli_development.md +++ b/docs/cli_development.md @@ -44,7 +44,7 @@ def hello(cli): First we import the `cli` object from `milc`. This is how we interact with the user and control the script's behavior. We use `@cli.argument()` to define a command line flag, `--name`. This also creates a configuration variable named `hello.name` (and the corresponding `user.name`) which the user can set so they don't have to specify the argument. The `cli.subcommand()` decorator designates this function as a subcommand. The name of the subcommand will be taken from the name of the function. -Once inside our function we find a typical "Hello, World!" program. We use `cli.log` to access the underlying [Logger Object](https://docs.python.org/3.5/library/logging.html#logger-objects), whose behavior is user controllable. We also access the value for name supplied by the user as `cli.config.hello.name`. The value for `cli.config.hello.name` will be determined by looking at the `--name` argument supplied by the user, if not provided it will use the value in the `qmk.ini` config file, and if neither of those is provided it will fall back to the default supplied in the `cli.argument()` decorator. +Once inside our function we find a typical "Hello, World!" program. We use `cli.log` to access the underlying [Logger Object](https://docs.python.org/3.6/library/logging.html#logger-objects), whose behavior is user controllable. We also access the value for name supplied by the user as `cli.config.hello.name`. The value for `cli.config.hello.name` will be determined by looking at the `--name` argument supplied by the user, if not provided it will use the value in the `qmk.ini` config file, and if neither of those is provided it will fall back to the default supplied in the `cli.argument()` decorator. # User Interaction @@ -56,13 +56,13 @@ There are two main methods for outputting text in a subcommand- `cli.log` and `c You can use special tokens to colorize your text, to make it easier to understand the output of your program. See [Colorizing Text](#colorizing-text) below. -Both of these methods support built-in string formatting using python's [printf style string format operations](https://docs.python.org/3.5/library/stdtypes.html#old-string-formatting). You can use tokens such as `%s` and `%d` within your text strings then pass the values as arguments. See our Hello, World program above for an example. +Both of these methods support built-in string formatting using python's [printf style string format operations](https://docs.python.org/3.6/library/stdtypes.html#old-string-formatting). You can use tokens such as `%s` and `%d` within your text strings then pass the values as arguments. See our Hello, World program above for an example. You should never use the format operator (`%`) directly, always pass values as arguments. ### Logging (`cli.log`) -The `cli.log` object gives you access to a [Logger Object](https://docs.python.org/3.5/library/logging.html#logger-objects). We have configured our log output to show the user a nice emoji for each log level (or the log level name if their terminal does not support unicode.) This way the user can tell at a glance which messages are most important when something goes wrong. +The `cli.log` object gives you access to a [Logger Object](https://docs.python.org/3.6/library/logging.html#logger-objects). We have configured our log output to show the user a nice emoji for each log level (or the log level name if their terminal does not support unicode.) This way the user can tell at a glance which messages are most important when something goes wrong. The default log level is `INFO`. If the user runs `qmk -v <subcommand>` the default log level will be set to `DEBUG`. diff --git a/docs/coding_conventions_python.md b/docs/coding_conventions_python.md index 1aefc044e..47dff7f8e 100644 --- a/docs/coding_conventions_python.md +++ b/docs/coding_conventions_python.md @@ -2,7 +2,7 @@ Most of our style follows PEP8 with some local modifications to make things less nit-picky. -* We target Python 3.5 for compatability with all supported platforms. +* We target Python 3.6 for compatability with all supported platforms. * We indent using four (4) spaces (soft tabs) * We encourage liberal use of comments * Think of them as a story describing the feature @@ -317,7 +317,7 @@ At the time of this writing our tests are not very comprehensive. Looking at the ## Integration Tests -Integration tests can be found in `lib/python/qmk/tests/test_cli_commands.py`. This is where CLI commands are actually run and their overall behavior is verified. We use [`subprocess`](https://docs.python.org/3.5/library/subprocess.html#module-subprocess) to launch each CLI command and a combination of checking output and returncode to determine if the right thing happened. +Integration tests can be found in `lib/python/qmk/tests/test_cli_commands.py`. This is where CLI commands are actually run and their overall behavior is verified. We use [`subprocess`](https://docs.python.org/3.6/library/subprocess.html#module-subprocess) to launch each CLI command and a combination of checking output and returncode to determine if the right thing happened. ## Unit Tests diff --git a/docs/feature_encoders.md b/docs/feature_encoders.md index 4a0ae60c3..7799b78d6 100644 --- a/docs/feature_encoders.md +++ b/docs/feature_encoders.md @@ -61,7 +61,7 @@ void encoder_update_user(uint8_t index, bool clockwise) { } else { tap_code(KC_PGUP); } - } else if (index == 1) { /* Second encoder */ + } else if (index == 1) { /* Second encoder */ if (clockwise) { tap_code(KC_DOWN); } else { diff --git a/docs/ja/feature_command.md b/docs/ja/feature_command.md new file mode 100644 index 000000000..f8b7e8929 --- /dev/null +++ b/docs/ja/feature_command.md @@ -0,0 +1,56 @@ +# コマンド + +<!--- + original document: 0.8.94:docs/feature_command.md + git diff 0.8.94 HEAD -- docs/feature_command.md | cat +--> + +コマンド(旧称:マジック)は、ファームウェアを書き込んだり、[ブートマジック](ja/feature_bootmagic.md)を使うためにプラグを抜いたりすることなくキーボードの挙動を変更する方法です。この機能と[ブートマジックキーコード](feature_bootmagic.md#keycodes)には多くの重複があります。可能な限り、コマンドでは無くブートマジックキーコードの機能を使うことをお勧めします。 + +一部のキーボードではコマンドがデフォルトで無効になっています。その場合、`rules.mk` 内で明示的に有効にする必要があります: + +```make +COMMAND_ENABLE = yes +``` + +## 使用法 + +コマンドを使うには、`IS_COMMAND()` マクロで定義されたキーの組み合わせを押し続けます。デフォルトでは、これは「左Shift + 右Shift」です。次に、目的のコマンドに対応するキーを押します。例えば、現在の QMK バージョンを QMK Toolbox コンソールに出力するには、「左Shift + 右Shift + `V`」を押します。 + +## 設定 + +コマンドのためのキーの割り当てを変更したい場合は、キーボードあるいはキーマップレベルのどちらかで、`config.h` にこれらを `#define` します。ここで割り当てる全てのキーコードは `KC_` 接頭辞を省略する必要があります。 + +| 定義 | デフォルト | 説明 | +|------------------------------------|--------------------------------|------------------------------------------------| +| `IS_COMMAND()` | `(get_mods() == MOD_MASK_SHIFT)` | コマンドをアクティブにするキーの組み合わせ | +| `MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS` | `true` | ファンクション行を使ってデフォルトレイヤーを設定 | +| `MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS` | `true` | 数字キーでデフォルトレイヤーを設定 | +| `MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM` | `false` | `MAGIC_KEY_LAYER0..9` を使ってデフォルトレイヤーを設定 | +| `MAGIC_KEY_DEBUG` | `D` | シリアルを介するデバッグの切り替え | +| `MAGIC_KEY_DEBUG_MATRIX` | `X` | キーマトリックスのデバッグの切り替え | +| `MAGIC_KEY_DEBUG_KBD` | `K` | キーボードのデバッグの切り替え | +| `MAGIC_KEY_DEBUG_MOUSE` | `M` | マウスのデバッグの切り替え | +| `MAGIC_KEY_CONSOLE` | `C` | コマンドコンソールを有効にする | +| `MAGIC_KEY_VERSION` | `V` | コンソールに実行中の QMK バージョンを出力 | +| `MAGIC_KEY_STATUS` | `S` | コンソールに現在のキーボードの状態を出力 | +| `MAGIC_KEY_HELP` | `H` | コンソールにコマンドのヘルプを出力 | +| `MAGIC_KEY_HELP_ALT` | `SLASH` | コンソールにコマンドのヘルプを出力 (代替) | +| `MAGIC_KEY_LAYER0` | `0` | レイヤー 0 をデフォルトレイヤーにする | +| `MAGIC_KEY_LAYER0_ALT` | `GRAVE` | レイヤー 0 をデフォルトレイヤーにする (代替) | +| `MAGIC_KEY_LAYER1` | `1` | レイヤー 1 をデフォルトレイヤーにする | +| `MAGIC_KEY_LAYER2` | `2` | レイヤー 2 をデフォルトレイヤーにする | +| `MAGIC_KEY_LAYER3` | `3` | レイヤー 3 をデフォルトレイヤーにする | +| `MAGIC_KEY_LAYER4` | `4` | レイヤー 4 をデフォルトレイヤーにする | +| `MAGIC_KEY_LAYER5` | `5` | レイヤー 5 をデフォルトレイヤーにする | +| `MAGIC_KEY_LAYER6` | `6` | レイヤー 6 をデフォルトレイヤーにする | +| `MAGIC_KEY_LAYER7` | `7` | レイヤー 7 をデフォルトレイヤーにする | +| `MAGIC_KEY_LAYER8` | `8` | レイヤー 8 をデフォルトレイヤーにする | +| `MAGIC_KEY_LAYER9` | `9` | レイヤー 9 をデフォルトレイヤーにする | +| `MAGIC_KEY_BOOTLOADER` | `B` | ブートローダにジャンプする | +| `MAGIC_KEY_BOOTLOADER_ALT` | `ESC` | ブートローダにジャンプする (代替) | +| `MAGIC_KEY_LOCK` | `CAPS` | 何も入力できないようにキーボードをロック | +| `MAGIC_KEY_EEPROM` | `E` | 保存された EEPROM 設定をコンソールに出力 | +| `MAGIC_KEY_EEPROM_CLEAR` | `BSPACE` | EEPROM をクリア | +| `MAGIC_KEY_NKRO` | `N` | N キーロールオーバー (NKRO) の有効・無効を切り替え | +| `MAGIC_KEY_SLEEP_LED` | `Z` | コンピュータがスリープの時に LED を切り替え | diff --git a/docs/ja/feature_dynamic_macros.md b/docs/ja/feature_dynamic_macros.md new file mode 100644 index 000000000..ab8ec3713 --- /dev/null +++ b/docs/ja/feature_dynamic_macros.md @@ -0,0 +1,71 @@ +# 動的マクロ: ランタイムでのマクロの記録および再生 + +<!--- + original document: 0.8.123:docs/feature_dynamic_macros.md + git diff 0.8.123 HEAD -- docs/feature_dynamic_macros.md | cat +--> + +QMK はその場で作られた一時的なマクロをサポートします。これらを動的マクロと呼びます。それらはユーザがキーボードから定義し、キーボードのプラグを抜くか再起動すると失われます。 + +1つまたは2つのマクロに合計128のキー押下を保存できます。RAM をより多く使用してサイズを増やすことができます。 + +有効にするには、最初に `rules.mk` に `DYNAMIC_MACRO_ENABLE = yes` を記述します。そして、以下のキーをキーマップに追加します: + +| キー | Alias | 説明 | +|------------------|----------|---------------------------------------------------| +| `DYN_REC_START1` | `DM_REC1` | マクロ 1 の記録を開始します | +| `DYN_REC_START2` | `DM_REC2` | マクロ 2 の記録を開始します | +| `DYN_MACRO_PLAY1` | `DM_PLY1` | マクロ 1 を再生します | +| `DYN_MACRO_PLAY2` | `DM_PLY2` | マクロ 2 を再生します | +| `DYN_REC_STOP` | `DM_RSTP` | 現在記録中のマクロの記録を終了します。 | + +これが必要な全てです。 + +マクロの記録を開始するには、`DYN_REC_START1` または `DYN_REC_START2` のどちらかを押します。 + +記録を終了するには、`DYN_REC_STOP` レイヤーボタンを押します。 + +マクロを再生するには、`DYN_MACRO_PLAY1` あるいは `DYN_MACRO_PLAY2` のどちらかを押します。 + +マクロの一部としてマクロを再生することができます。マクロ 1 を記録中にマクロ 2 を再生、またはその逆も問題ありません。ただし、再帰的なマクロ、つまりマクロ 1 を再生するマクロ 1 は作成しないでください。もしそうしてキーボードが反応しなくなった場合は、キーボードを取り外し再び接続します。これを完全に無効にするには、`config.h` ファイルで `DYNAMIC_MACRO_NO_NESTING` を定義します。 + +?> 動的マクロの内部の詳細については、`process_dynamic_macro.h` および `process_dynamic_macro.c` ファイルのコメントを読んでください。 + +## カスタマイズ + +ある程度のカスタマイズを可能にするオプションがいくつか追加されています。 + +| 定義 | デフォルト | 説明 | +|----------------------------|----------------|-----------------------------------------------------------------------------------------------------------------| +| `DYNAMIC_MACRO_SIZE` | 128 | 動的マクロが使用できるメモリ量を設定します。これは限られたリソースであり、コントローラに依存します。 | +| `DYNAMIC_MACRO_USER_CALL` | *定義なし* | これを定義すると、ユーザの `keymap.c` ファイルを使ってマクロが起動されます。 | +| `DYNAMIC_MACRO_NO_NESTING` | *定義なし* | これを定義すると、別のマクロからマクロを呼び出す(入れ子になったマクロ)機能を無効にします。 | + + +記録中にキーを押すたびに LED が点滅し始めた場合は、マクロバッファにマクロを入れるスペースがもう無いことを意味します。マクロを入れるには、他のマクロ(それらは同じバッファを共有します)を短くするか、`config.h` に `DYNAMIC_MACRO_SIZE` 定義を追加することでバッファを増やします(デフォルト値: 128; ヘッダ内のコメントを読んでください)。 + + +### DYNAMIC_MACRO_USER_CALL + +以前のバージョンの動的マクロをお使いの方へ: 専用の `DYN_REC_STOP` キーを使わずに動的マクロキーへのアクセスに使われるレイヤーモディファイアのみを使って、マクロの記録を終了することもまだ可能です。この動作に戻したい場合は、`#define DYNAMIC_MACRO_USER_CALL` を `config.h` に追加し、以下のスニペットを `process_record_user()` 関数の先頭に記述します: + +```c + uint16_t macro_kc = (keycode == MO(_DYN) ? DYN_REC_STOP : keycode); + + if (!process_record_dynamic_macro(macro_kc, record)) { + return false; + } +``` + +### ユーザフック + +カスタム機能とフィードバックオプションを動的マクロ機能に追加するために使うことができるフックが幾つかあります。これによりある程度のカスタマイズが可能になります。 + +direction がどのマクロであるかを示すことに注意してください。`1` がマクロ 1、`-1` がマクロ 2、0 がマクロ無しです。 + +* `dynamic_macro_record_start_user(void)` - マクロの記録を開始する時に起動されます。 +* `dynamic_macro_play_user(int8_t direction)` - マクロを再生する時に起動されます。 +* `dynamic_macro_record_key_user(int8_t direction, keyrecord_t *record)` - マクロの記録中に各キー押下で起動されます。 +* `dynamic_macro_record_end_user(int8_t direction)` - マクロの記録を停止した時に起動されます。 + +さらに、動的マクロ機能が有効な場合にバックライトを点滅させるために `dynamic_macro_led_blink()` を呼び出すことができます。 diff --git a/docs/ja/feature_encoders.md b/docs/ja/feature_encoders.md new file mode 100644 index 000000000..7f8922652 --- /dev/null +++ b/docs/ja/feature_encoders.md @@ -0,0 +1,81 @@ +# エンコーダ + +<!--- + original document: 0.8.123:docs/feature_encoders.md + git diff 0.8.123 HEAD -- docs/feature_encoders.md | cat +--> + +以下を `rules.mk` に追加することで基本的なエンコーダがサポートされます: + +```make +ENCODER_ENABLE = yes +``` + +さらに、以下を `config.h` に追加します: + +```c +#define ENCODERS_PAD_A { B12 } +#define ENCODERS_PAD_B { B13 } +``` + +各 PAD_A/B 変数は配列を定義するため、複数のエンコーダを定義することができます。例えば: + +```c +#define ENCODERS_PAD_A { encoder1a, encoder2a } +#define ENCODERS_PAD_B { encoder1b, encoder2b } +``` + +エンコーダの時計回りの方向が間違っている場合は、A と B のパッド定義を交換することができます。define を使って逆にすることもできます: + +```c +#define ENCODER_DIRECTION_FLIP +``` + +さらに、解像度を同じファイルで指定することができます (デフォルトかつお勧めは4): + +```c +#define ENCODER_RESOLUTION 4 +``` + +## 分割キーボード + +分割キーボードのそれぞれの側のエンコーダに異なるピン配列を使っている場合、右側のピン配列を以下のように定義することができます: + +```c +#define ENCODERS_PAD_A_RIGHT { encoder1a, encoder2a } +#define ENCODERS_PAD_B_RIGHT { encoder1b, encoder2b } +``` + +## コールバック + +コールバック関数を `<keyboard>.c` に記述することができます: + +```c +void encoder_update_kb(uint8_t index, bool clockwise) { + encoder_update_user(index, clockwise); +} +``` + +あるいは `keymap.c` に記述することもできます: + +```c +void encoder_update_user(uint8_t index, bool clockwise) { + if (index == 0) { /* First encoder */ + if (clockwise) { + tap_code(KC_PGDN); + } else { + tap_code(KC_PGUP); + } + } else if (index == 1) { /* Second encoder */ + if (clockwise) { + tap_code(KC_DOWN); + } else { + tap_code(KC_UP); + } + } +} +``` + +## ハードウェア + +エンコーダの A と B の線は MCU に直接配線し、C/common 線はグランドに配線する必要があります。 diff --git a/docs/ja/feature_grave_esc.md b/docs/ja/feature_grave_esc.md new file mode 100644 index 000000000..8c6680d74 --- /dev/null +++ b/docs/ja/feature_grave_esc.md @@ -0,0 +1,37 @@ +# グレイブエスケープ + +<!--- + original document: 0.8.123:docs/feature_grave_esc.md + git diff 0.8.123 HEAD -- docs/feature_grave_esc.md | cat +--> + +60% キーボード、またはファンクションキー行の無い他のレイアウトを使っている場合、専用の Escape キーが無いことに気付くでしょう。グレイブエスケープは grave キー (<code>`</code> および `~`) を Escape と共有することができる機能です。 + +## 使用法 + +キーマップ内の `KC_GRAVE` キー (通常は`1` キーの左)を `KC_GESC` に置き換えます。ほとんどの場合、このキーは押された時に `KC_ESC` を出力します。ただし、Shift あるいは GUI を押したままにすると、代わりに `KC_GRV` を出力します。 + +## OS に見えるもの + +メアリーがキーボードで GESC を押すと、OS には KC_ESC 文字が見えます。メアリーが Shift を押しながら GESC を押すと、`~` または Shift された時はバッククォートを出力します。彼女が GUI/CMD/WIN を押したままにすると、1つの <code>`</code> 文字を出力します。 + +## キーコード + +| キー | エイリアス | 説明 | +|---------|-----------|------------------------------------------------------------------| +| `KC_GESC` | `GRAVE_ESC` | 押された場合に Escape。Shift あるいは GUI が押されたままの場合は <code>`</code> | + +### 注意事項 + +macOS では、Command+<code>`</code> はデフォルトで "次のウィンドウを操作対象にする" にマップされます。つまりバッククォートを出力しません。さらに、ショートカットがキーボード環境設定で変更された場合でも、ターミナルは常にこのショートカットを認識してウィンドウを切り替えます。 + +## 設定 + +グレイブエスケープが壊す可能性のあるキーの組み合わせが幾つかあります。その中には、Windows では Control+Shift+Escape、macOSでは Command+Option+Escape があります。これを回避するには、`config.h` で以下のオプションを `#define` することができます: + +| 定義 | 説明 | +|--------------------------|-----------------------------------------| +| `GRAVE_ESC_ALT_OVERRIDE` | Alt が押された場合、常に Escape を送信する | +| `GRAVE_ESC_CTRL_OVERRIDE` | Control が押された場合、常に Escape を送信する | +| `GRAVE_ESC_GUI_OVERRIDE` | GUI が押された場合、常に Escape を送信する | +| `GRAVE_ESC_SHIFT_OVERRIDE` | Shift が押された場合、常に Escape を送信する | diff --git a/docs/ja/feature_hd44780.md b/docs/ja/feature_hd44780.md new file mode 100644 index 000000000..525863253 --- /dev/null +++ b/docs/ja/feature_hd44780.md @@ -0,0 +1,62 @@ +# HD44780 LCD ディスプレイ + +<!--- + original document: 0.8.123:docs/feature_hd44780.md + git diff 0.8.123 HEAD -- docs/feature_hd44780.md | cat +--> + +これは Peter Fleury の LCD ライブラリの統合です。このページは基本について説明します。[詳細なドキュメントについてはこのページをご覧ください](http://homepage.hispeed.ch/peterfleury/doxygen/avr-gcc-libraries/group__pfleury__lcd.html) (訳注)原文のリンク先のページは、サービスの終了に伴って削除されています。移行先は (http://www.peterfleury.epizy.com/doxygen/avr-gcc-libraries/group__pfleury__lcd.html) と思われます。 + +HD44780 ディスプレイのサポートを有効にするには、キーボードの `rules.mk` の `HD44780_ENABLE` フラグを yes に設定します。 + +## 設定 + +ディスプレイで使用されるピンとディスプレイの行と列の数を、キーボードの `config.h` に設定する必要があります。 + + +HD44780 のラベルが付いたセクションのコメントを外し、必要に応じてパラメータを変更します。 +```` +/* + * HD44780 LCD ディスプレイ設定 + */ + +#define LCD_LINES 2 //< ディスプレイの表示行数 +#define LCD_DISP_LENGTH 16 //< ディスプレイの行ごとの表示文字数 +#define LCD_IO_MODE 1 //< 0: メモリマップモード 1: IO ポートモード +#if LCD_IO_MODE +#define LCD_PORT PORTB //< LCD 行のためのポート +#define LCD_DATA0_PORT LCD_PORT //< 4ビットデータビット 0 のポート +#define LCD_DATA1_PORT LCD_PORT //< 4ビットデータビット 1 のポート +#define LCD_DATA2_PORT LCD_PORT //< 4ビットデータビット 2 のポート +#define LCD_DATA3_PORT LCD_PORT //< 4ビットデータビット 3 のポート +#define LCD_DATA0_PIN 4 //< 4ビットデータビット 0 のピン +#define LCD_DATA1_PIN 5 //< 4ビットデータビット 1 のピン +#define LCD_DATA2_PIN 6 //< 4ビットデータビット 2 のピン +#define LCD_DATA3_PIN 7 //< 4ビットデータビット 3 のピン +#define LCD_RS_PORT LCD_PORT //< RS 線のためのポート +#define LCD_RS_PIN 3 //< RS 線のためのピン +#define LCD_RW_PORT LCD_PORT //< RW 線のためのポート +#define LCD_RW_PIN 2 //< RW 線のためのピン +#define LCD_E_PORT LCD_PORT //< Enable 線のためのポート +#define LCD_E_PIN 1 //< Enable 線のためのピン +#endif +```` + +他のプロパティを設定する必要がある場合は、それらを `quantum/hd44780.h` からコピーし、`config.h` に設定することができます。(訳注)`quantum/hd44780.h` は `drivers/avr/hd44780.h` の間違いではないかと思われます。 + +## 使用法 + +ディスプレイを初期化するには、以下のパラメータのうちの1つを使って `lcd_init()` を呼び出します: +```` +LCD_DISP_OFF : ディスプレイオフ +LCD_DISP_ON : ディスプレイオン、カーソルオフ +LCD_DISP_ON_CURSOR : ディスプレイオン、カーソルオン +LCD_DISP_ON_CURSOR_BLINK : ディスプレイオン、点滅カーソル +```` +これはキーボードの `matrix_init_kb` またはキーマップの `matrix_init_user` で行うのが最適です。 +使用前にディスプレイをクリアすることをお勧めします。 +そのためには、`lcd_clrsrc()` を呼びます。 + +ディスプレイに何かを表示するには、最初に `lcd_gotoxy(column, line)` を呼びます。最初の行の先頭に移動するには、`lcd_gotoxy(0, 0)` を呼び出し、その後 `lcd_puts("example string")` を使って文字列を出力します。 + +ディスプレイを制御することができる、より多くのメソッドがあります。[詳細なドキュメントについてはリンクされたページをご覧ください](http://homepage.hispeed.ch/peterfleury/doxygen/avr-gcc-libraries/group__pfleury__lcd.html) (訳注)原文のリンク先のページは、サービスの終了に伴って削除されています。移行先は (http://www.peterfleury.epizy.com/doxygen/avr-gcc-libraries/group__pfleury__lcd.html) と思われます。 diff --git a/docs/newbs_getting_started.md b/docs/newbs_getting_started.md index c8916b0e2..a3022f15e 100644 --- a/docs/newbs_getting_started.md +++ b/docs/newbs_getting_started.md @@ -66,9 +66,14 @@ After Homebrew is installed run these commands: You will need to install Git and Python. It's very likely that you already have both, but if not, one of the following commands should install them: -* Debian / Ubuntu / Devuan: `apt-get install git python3 && python3 -m pip install qmk` -* Fedora / Red Hat / CentOS: `yum install git python3 && python3 -m pip install qmk` -* Arch: `yay -S qmk` (or use any other AUR Helper) +* Debian / Ubuntu / Devuan: `sudo apt install git python3 python3-pip` +* Fedora / Red Hat / CentOS: `sudo yum install git python3 python3-pip` +* Arch / Manjaro: `sudo pacman -S git python python-pip python-setuptools libffi` + + +Install the global CLI to bootstrap your system: + + `python3 -m pip install --user qmk` (on Arch-based distros you can also try the `qmk` package from AUR (**note**: it's maintained by a community member): `yay -S qmk`) ## 3. Run QMK Setup :id=set-up-qmk @@ -78,6 +83,12 @@ After installing QMK you can set it up with this command: In most situations you will want to answer Yes to all of the prompts. +?>**Note on Debian, Ubuntu and their derivatives**: +It's possible, that you will get an error saying something like: `bash: qmk: command not found`. +This is due to a [bug](https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=839155) Debian introduced with their Bash 4.4 release, which removed `$HOME/.local/bin` from the PATH. This bug was later fixed on Debian and Ubuntu. +Sadly, Ubuntu reitroduced this bug and is [yet to fix it](https://bugs.launchpad.net/ubuntu/+source/bash/+bug/1588562). +Luckily, the fix is easy. Run this as your user: `echo "PATH=$HOME/.local/bin:$PATH" >> $HOME/.bashrc && source $HOME/.bashrc` + ?> If you already know [how to use GitHub](getting_started_github.md), we recommend that you create your own fork and use `qmk setup <github_username>/qmk_firmware` to clone your personal fork. If you don't know what that means you can safely ignore this message. ## 4. Test Your Build Environment diff --git a/docs/proton_c_conversion.md b/docs/proton_c_conversion.md index dc0a3f484..98f1508a9 100644 --- a/docs/proton_c_conversion.md +++ b/docs/proton_c_conversion.md @@ -1,5 +1,9 @@ # Converting a board to use the Proton C +Since the Proton C is a drop-in replacement for a Pro Micro we've made it easy to use. This page documents a handy automated process for converting keyboards, as well as documenting the manual process if you'd like to make use of Proton C features that aren't available on Pro Micros. + +## Automatic Conversion + If a board currently supported in QMK uses a Pro Micro (or compatible board) and you want to use the Proton C, you can generate the firmware by appending `CONVERT_TO_PROTON_C=yes` (or `CTPC=yes`) to your make argument, like this: make 40percentclub/mf68:default CTPC=yes @@ -8,13 +12,15 @@ You can add the same argument to your keymap's `rules.mk`, which will accomplish This exposes the `CONVERT_TO_PROTON_C` flag that you can use in your code with `#ifdef`s, like this: - #ifdef CONVERT_TO_PROTON_C - // Proton C code - #else - // Pro Micro code - #endif +```c +#ifdef CONVERT_TO_PROTON_C + // Proton C code +#else + // Pro Micro code +#endif +``` -Before being able to compile, you may get some errors about `PORTB/DDRB`, etc not being defined, so you'll need to convert the keyboard's code to use the [GPIO Controls](internals_gpio_control.md) that will work for both ARM and AVR. This shouldn't affect the AVR builds at all. +If you get errors about `PORTB/DDRB`, etc not being defined, so you'll need to convert the keyboard's code to use the [GPIO Controls](internals_gpio_control.md) that will work for both ARM and AVR. This shouldn't affect the AVR builds at all. The Proton C only has one on-board LED (C13), and by default, the TXLED (D5) is mapped to it. If you want the RXLED (B0) mapped to it instead, add this like to your `config.h`: @@ -31,3 +37,54 @@ These are defaults based on what has been implemented for ARM boards. | [Backlight](feature_backlight.md) | Forces [task driven PWM](feature_backlight.md#software-pwm-driver) until ARM can provide automatic configuration | | USB Host (e.g. USB-USB converter) | Not supported (USB host code is AVR specific and is not currently supported on ARM) | | [Split keyboards](feature_split_keyboard.md) | Not supported yet | + +## Manual Conversion + +To use the Proton C natively, without having to specify `CTPC=yes`, you need to change the `MCU` line in `rules.mk`: + +``` +MCU = STM32F303 +``` + +Remove these variables if they exist: + +* `BOOTLOADER` +* `EXTRA_FLAGS` + +Finally convert all pin assignments in `config.h` to the stm32 equivalents. + +| Pro Micro Left | Proton C Left | | Proton C Right | Pro Micro Right | +|-----------|----------|-|----------|-----------| +| `D3` | `A9` | | 5v | RAW (5v) | +| `D2` | `A10` | | GND | GND | +| GND | GND | | FLASH | RESET | +| GND | GND | | 3.3v | VCC <sup>1</sup> | +| `D1` | `B7` | | `A2` | `F4` | +| `D0` | `B6` | | `A1` | `F5` | +| `D4` | `B5` | | `A0` | `F6` | +| `C6` | `B4` | | `B8` | `F7` | +| `D7` | `B3` | | `B13` | `B1` | +| `E6` | `B2` | | `B14` | `B3` | +| `B4` | `B1` | | `B15` | `B2` | +| `B5` | `B0` | | `B9` | `B6` | +| `B0` (RX LED) | `C13` <sup>2</sup> | | `C13` <sup>2</sup> | `D5` (TX LED) | + +You can also make use of several new pins on the extended portion of the Proton C: + +| Left | | Right | +|------|-|-------| +| `A4`<sup>3</sup> | | `B10` | +| `A5`<sup>4</sup> | | `B11` | +| `A6` | | `B12` | +| `A7` | | `A14`<sup>5</sup> (SWCLK) | +| `A8` | | `A13`<sup>5</sup> (SWDIO) | +| `A15` | | RESET<sup>6</sup> | + +Notes: + +1. On a Pro Micro VCC can be 3.3v or 5v. +2. A Proton C only has one onboard LED, not two like a Pro Micro. The Pro Micro has an RX LED on `D5` and a TX LED on `B0`. +3. `A4` is shared with the speaker. +4. `A5` is shared with the speaker. +5. `A13` and `A14` are used for hardware debugging (SWD). You can also use them for GPIO, but should use them last. +6. Short RESET to 3.3v (pull high) to reboot the MCU. This does not enter bootloader mode like a Pro Micro, it only resets the MCU. diff --git a/docs/spi_driver.md b/docs/spi_driver.md index e2b5b140b..c170bf1df 100644 --- a/docs/spi_driver.md +++ b/docs/spi_driver.md @@ -18,7 +18,24 @@ You may use more than one slave select pin, not just the `SS` pin. This is usefu ## ChibiOS/ARM Configuration -ARM support for this driver is not ready yet. Check back later! +You'll need to determine which pins can be used for SPI -- as an example, STM32 parts generally have multiple SPI peripherals, labeled SPI1, SPI2, SPI3 etc. + +To enable SPI, modify your board's `halconf.h` to enable SPI - both `HAL_USE_SPI` and `SPI_USE_WAIT` should be `TRUE`, and `SPI_SELECT_MODE` should be `SPI_SELECT_MODE_PAD`. +Then, modify your board's `mcuconf.h` to enable the SPI peripheral you've chosen -- in the case of using SPI2, modify `STM32_SPI_USE_SPI2` to be `TRUE`. + +As per the AVR configuration, you may select any other standard GPIO as a slave select pin, and can be supplied to `spi_start()`. + +Configuration-wise, you'll need to set up the peripheral as per your MCU's datasheet -- the defaults match the pins for a Proton-C, i.e. STM32F303. + +`config.h` override | Description | Default Value +----------------------------|---------------------------------------------------------------|-------------- +`#define SPI_DRIVER` | SPI peripheral to use - SPI1 => `SPID1`, SPI2 => `SPID2` etc. | `SPID2` +`#define SPI_SCK_PIN` | The pin to use for the SCK | `B13` +`#define SPI_SCK_PAL_MODE` | The alternate function mode for the SCK pin | `5` +`#define SPI_MOSI_PIN` | The pin to use for the MOSI | `B15` +`#define SPI_MOSI_PAL_MODE` | The alternate function mode for the MOSI pin | `5` +`#define SPI_MISO_PIN` | The pin to use for the MISO | `B14` +`#define SPI_MISO_PAL_MODE` | The alternate function mode for the MISO pin | `5` ## Functions diff --git a/docs/syllabus.md b/docs/syllabus.md new file mode 100644 index 000000000..ec7f66ba7 --- /dev/null +++ b/docs/syllabus.md @@ -0,0 +1,70 @@ +# QMK Syllabus + +This page helps you build up your QMK knowledge by introducing the basics first and guiding you to understanding all the concepts you need to know to be proficient with QMK. + +# Beginning Topics + +If you read nothing else you should read the documents in this section. After reading the [Tutorial](newbs.md) you should be able to create a basic keymap, compile it, and flash it to your keyboard. The remaining documents will flesh out your knowledge of these basics. + +* **Learn How To Use QMK Tools** + * [Tutorial](newbs.md) + * [CLI](cli.md) + * [GIT](newbs_git_best_practices.md) +* **Learn About Keymaps** + * [Layers](feature_layers.md) + * [Keycodes](keycodes.md) + * The full list of keycodes you can use. Note that some may require knowledge found in the Intermediate or Advanced Topics. +* **Configuring IDEs** - Optional + * [Eclipse](other_eclipse.md) + * [VS Code](other_vscode.md) + +# Intermediate Topics + +These topics start to dig into some of the features that QMK supports. You don't have to read all of these documents, but some of the documents in the Advanced Topics section won't make sense if you skip over some of these. + +* **Learn How To Configure Features** + <!-- * Configuration Overview FIXME(skullydazed/anyone): write this document --> + * [Audio](feature_audio.md) + * Lighting + * [Backlight](feature_backlight.md) + * [LED Matrix](feature_led_matrix.md) + * [RGB Lighting](feature_rgblight.md) + * [RGB Matrix](feature_rgb_matrix.md) + * [Tap-Hold Configuration](tap_hold.md) +* **Learn More About Keymaps** + * [Keymaps](keymap.md) + * [Custom Functions and Keycodes](custom_quantum_functions.md) + * Macros + * [Dynamic Macros](feature_dynamic_macros.md) + * [Compiled Macros](feature_macros.md) + * [Tap Dance](feature_tap_dance.md) + * [Combos](feature_combo.md) + * [Userspace](feature_userspace.md) + +# Advanced Topics + +Everything below here requires a lot of foundational knowledge. Besides being able to create keymaps using advanced features you should be familiar with using both `config.h` and `rules.mk` to configure options for your keyboard. + +* **Maintaining Keyboards Within QMK** + * [Handwiring a Keyboard](hand_wire.md) + * [Keyboard Guidelines](hardware_keyboard_guidelines.md) + * [info.json Reference](reference_info_json.md) + * [Debounce API](feature_debounce_type.md) +* **Advanced Features** + * [Unicode](feature_unicode.md) + * [API](api_overview.md) + * [Bootmagic](feature_bootmagic.md) +* **Hardware** + * [How Keyboards Work](how_keyboards_work.md) + * [How A Keyboard Matrix Works](how_a_matrix_works.md) + * [Split Keyboards](feature_split_keyboard.md) + * [Stenography](feature_stenography.md) + * [Pointing Devices](feature_pointing_device.md) +* **Core Development** + * [Coding Conventions](coding_conventions_c.md) + * [Compatible Microcontrollers](compatible_microcontrollers.md) + * [Custom Matrix](custom_matrix.md) + * [Understanding QMK](understanding_qmk.md) +* **CLI Development** + * [Coding Conventions](coding_conventions_python.md) + * [CLI Development Overview](cli_development.md) diff --git a/docs/tap_hold.md b/docs/tap_hold.md index 1719c0bbe..a0b648694 100644 --- a/docs/tap_hold.md +++ b/docs/tap_hold.md @@ -12,7 +12,7 @@ As of [PR#1359](https://github.com/qmk/qmk_firmware/pull/1359/), there is a new #define PERMISSIVE_HOLD ``` -This makes tap and hold keys (like Mod Tap) work better for fast typist, or for high `TAPPING_TERM` settings. +This makes tap and hold keys (like Mod Tap) work better for fast typists, or for high `TAPPING_TERM` settings. If you press a Mod Tap key, tap another key (press and release) and then release the Mod Tap key, all within the tapping term, it will output the "tapping" function for both keys. @@ -35,7 +35,7 @@ To enable this setting, add this to your `config.h`: #define IGNORE_MOD_TAP_INTERRUPT ``` -Similar to Permissive Hold, this alters how the firmware processes input for fast typist. If you press a Mod Tap key, press another key, release the Mod Tap key, and then release the normal key, it would normally output the "tapping" function for both keys. This may not be desirable for rolling combo keys. +Similar to Permissive Hold, this alters how the firmware processes inputs for fast typists. If you press a Mod Tap key, press another key, release the Mod Tap key, and then release the normal key, it would normally output the "tapping" function for both keys. This may not be desirable for rolling combo keys. Setting `Ignore Mod Tap Interrupt` requires holding both keys for the `TAPPING_TERM` to trigger the hold function (the mod). diff --git a/docs/unit_testing.md b/docs/unit_testing.md index 4de5c217e..a63ffff5d 100644 --- a/docs/unit_testing.md +++ b/docs/unit_testing.md @@ -50,7 +50,7 @@ In that model you would emulate the input, and expect a certain output from the # Tracing Variables :id=tracing-variables -Sometimes you might wonder why a variable gets changed and where, and this can be quite tricky to track down without having a debugger. It's of course possible to manually add print statements to track it, but you can also enable the variable trace feature. This works for both for variables that are changed by the code, and when the variable is changed by some memory corruption. +Sometimes you might wonder why a variable gets changed and where, and this can be quite tricky to track down without having a debugger. It's of course possible to manually add print statements to track it, but you can also enable the variable trace feature. This works for both variables that are changed by the code, and when the variable is changed by some memory corruption. To take the feature into use add `VARIABLE_TRACE=x` to the end of you make command. `x` represents the number of variables you want to trace, which is usually 1. |