aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
Diffstat (limited to 'docs')
-rw-r--r--docs/_summary.md1
-rw-r--r--docs/data_driven_config.md59
-rw-r--r--docs/feature_macros.md113
-rw-r--r--docs/feature_mouse_keys.md28
-rw-r--r--docs/feature_rgb_matrix.md22
-rw-r--r--docs/feature_rgblight.md13
-rw-r--r--docs/feature_split_keyboard.md10
-rw-r--r--docs/ja/feature_macros.md113
-rw-r--r--docs/ja/proton_c_conversion.md1
-rw-r--r--docs/proton_c_conversion.md1
-rw-r--r--docs/reference_info_json.md158
-rw-r--r--docs/reference_keymap_extras.md2
-rw-r--r--docs/serial_driver.md1
13 files changed, 284 insertions, 238 deletions
diff --git a/docs/_summary.md b/docs/_summary.md
index 5af0046ab..9bc0b193a 100644
--- a/docs/_summary.md
+++ b/docs/_summary.md
@@ -159,6 +159,7 @@
159 * [Contributing to QMK](contributing.md) 159 * [Contributing to QMK](contributing.md)
160 * [Translating the QMK Docs](translating.md) 160 * [Translating the QMK Docs](translating.md)
161 * [Config Options](config_options.md) 161 * [Config Options](config_options.md)
162 * [Data Driven Configuration](data_driven_config.md)
162 * [Make Documentation](getting_started_make_guide.md) 163 * [Make Documentation](getting_started_make_guide.md)
163 * [Documentation Best Practices](documentation_best_practices.md) 164 * [Documentation Best Practices](documentation_best_practices.md)
164 * [Documentation Templates](documentation_templates.md) 165 * [Documentation Templates](documentation_templates.md)
diff --git a/docs/data_driven_config.md b/docs/data_driven_config.md
new file mode 100644
index 000000000..7e4f23284
--- /dev/null
+++ b/docs/data_driven_config.md
@@ -0,0 +1,59 @@
1# Data Driven Configuration
2
3This page describes how QMK's data driven JSON configuration system works. It is aimed at developers who want to work on QMK itself.
4
5## History
6
7Historically QMK has been configured through a combination of two mechanisms- `rules.mk` and `config.h`. While this worked well when QMK was only a handful of keyboards we've grown to encompass nearly 1500 supported keyboards. That extrapolates out to 6000 configuration files under `keyboards/` alone! The freeform nature of these files and the unique patterns people have used to avoid duplication have made ongoing maintenance a challenge, and a large number of our keyboards follow patterns that are outdated and sometimes harder to understand.
8
9We have also been working on bringing the power of QMK to people who aren't comformable with a CLI, and other projects such as VIA are working to make using QMK as easy as installing a program. These tools need information about how a keyboard is laid out or what pins and features are available so that users can take full advantage of QMK. We introduced `info.json` as a first step towards this. The QMK API is an effort to combine these 3 sources of information- `config.h`, `rules.mk`, and `info.json`- into a single source of truth that end-user tools can use.
10
11Now we have support for generating `rules.mk` and `config.h` values from `info.json`, allowing us to have a single source of truth. This will allow us to use automated tooling to maintain keyboards saving a lot of time and maintenance work.
12
13## Overview
14
15On the C side of things nothing really changes. When you need to create a new rule or define you follow the same process:
16
171. Add it to `docs/config_options.md`
181. Set a default in the appropriate core file
191. Add your `ifdef` and/or `#ifdef` statements as needed
20
21You will then need to add support for your new configuration to `info.json`. The basic process is:
22
231. Add it to the schema in `data/schemas/keyboards.jsonschema`
241. Add code to extract it from `config.h`/`rules.mk` to `lib/python/qmk/info.py`
251. Add code to generate it to one of:
26 * `lib/python/qmk/cli/generate/config_h.py`
27 * `lib/python/qmk/cli/generate/rules_mk.py`
28
29## Adding an option to info.json
30
31This section describes adding support for a `config.h`/`rules.mk` value to info.json.
32
33### Add it to the schema
34
35QMK maintains schema files in `data/schemas`. The values that go into keyboard-specific `info.json` files are kept in `keyboard.jsonschema`. Any value you want to make available to end users to edit must go in here.
36
37In some cases you can simply add a new top-level key. Some examples to follow are `keyboard_name`, `maintainer`, `processor`, and `url`. This is appropriate when your option is self-contained and not directly related to other options. In other cases you should group like options together in an `object`. This is particularly true when adding support for a feature. Some examples to follow for this are `indicators`, `matrix_pins`, and `rgblight`. If you are not sure how to integrate your new option(s) [open an issue](https://github.com/qmk/qmk_firmware/issues/new?assignees=&labels=cli%2C+python&template=other_issues.md&title=) or [join #cli on Discord](https://discord.gg/heQPAgy) and start a conversation there.
38
39### Add code to extract it
40
41Whenever QMK generates a complete `info.json` it extracts information from `config.h` and `rules.mk`. You will need to add code for your new config value to `lib/python/qmk/info.py`. Typically this means adding a new `_extract_<feature>()` function and then calling your function in either `_extract_config_h()` or `_extract_rules_mk()`.
42
43If you are not sure how to edit this file or are not comfortable with Python [open an issue](https://github.com/qmk/qmk_firmware/issues/new?assignees=&labels=cli%2C+python&template=other_issues.md&title=) or [join #cli on Discord](https://discord.gg/heQPAgy) and someone can help you with this part.
44
45### Add code to generate it
46
47The final piece of the puzzle is providing your new option to the build system. This is done by generating two files:
48
49* `.build/obj_<keyboard>/src/info_config.h`
50* `.build/obj_<keyboard>/src/rules.mk`
51
52These two files are generated by the code here:
53
54* `lib/python/qmk/cli/generate/config_h.py`
55* `lib/python/qmk/cli/generate/rules_mk.py`
56
57For `config.h` values you'll need to write a function for your rule(s) and call that function in `generate_config_h()`.
58
59If you have a new top-level `info.json` key for `rules.mk` you can simply add your keys to `info_to_rules` at the top of `lib/python/qmk/cli/generate/rules_mk.py`. Otherwise you'll need to create a new if block for your feature in `generate_rules_mk()`.
diff --git a/docs/feature_macros.md b/docs/feature_macros.md
index 36fa761d2..aa1ebc337 100644
--- a/docs/feature_macros.md
+++ b/docs/feature_macros.md
@@ -4,7 +4,7 @@ Macros allow you to send multiple keystrokes when pressing just one key. QMK has
4 4
5!> **Security Note**: While it is possible to use macros to send passwords, credit card numbers, and other sensitive information it is a supremely bad idea to do so. Anyone who gets a hold of your keyboard will be able to access that information by opening a text editor. 5!> **Security Note**: While it is possible to use macros to send passwords, credit card numbers, and other sensitive information it is a supremely bad idea to do so. Anyone who gets a hold of your keyboard will be able to access that information by opening a text editor.
6 6
7## The New Way: `SEND_STRING()` & `process_record_user` 7## `SEND_STRING()` & `process_record_user`
8 8
9Sometimes you want a key to type out words or phrases. For the most common situations, we've provided `SEND_STRING()`, which will type out a string (i.e. a sequence of characters) for you. All ASCII characters that are easily translatable to a keycode are supported (e.g. `qmk 123\n\t`). 9Sometimes you want a key to type out words or phrases. For the most common situations, we've provided `SEND_STRING()`, which will type out a string (i.e. a sequence of characters) for you. All ASCII characters that are easily translatable to a keycode are supported (e.g. `qmk 123\n\t`).
10 10
@@ -262,15 +262,15 @@ This will clear all keys besides the mods currently pressed.
262This macro will register `KC_LALT` and tap `KC_TAB`, then wait for 1000ms. If the key is tapped again, it will send another `KC_TAB`; if there is no tap, `KC_LALT` will be unregistered, thus allowing you to cycle through windows. 262This macro will register `KC_LALT` and tap `KC_TAB`, then wait for 1000ms. If the key is tapped again, it will send another `KC_TAB`; if there is no tap, `KC_LALT` will be unregistered, thus allowing you to cycle through windows.
263 263
264```c 264```c
265bool is_alt_tab_active = false; # ADD this near the begining of keymap.c 265bool is_alt_tab_active = false; // ADD this near the begining of keymap.c
266uint16_t alt_tab_timer = 0; # we will be using them soon. 266uint16_t alt_tab_timer = 0; // we will be using them soon.
267 267
268enum custom_keycodes { # Make sure have the awesome keycode ready 268enum custom_keycodes { // Make sure have the awesome keycode ready
269 ALT_TAB = SAFE_RANGE, 269 ALT_TAB = SAFE_RANGE,
270}; 270};
271 271
272bool process_record_user(uint16_t keycode, keyrecord_t *record) { 272bool process_record_user(uint16_t keycode, keyrecord_t *record) {
273 switch (keycode) { # This will do most of the grunt work with the keycodes. 273 switch (keycode) { // This will do most of the grunt work with the keycodes.
274 case ALT_TAB: 274 case ALT_TAB:
275 if (record->event.pressed) { 275 if (record->event.pressed) {
276 if (!is_alt_tab_active) { 276 if (!is_alt_tab_active) {
@@ -287,7 +287,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
287 return true; 287 return true;
288} 288}
289 289
290void matrix_scan_user(void) { # The very important timer. 290void matrix_scan_user(void) { // The very important timer.
291 if (is_alt_tab_active) { 291 if (is_alt_tab_active) {
292 if (timer_elapsed(alt_tab_timer) > 1000) { 292 if (timer_elapsed(alt_tab_timer) > 1000) {
293 unregister_code(KC_LALT); 293 unregister_code(KC_LALT);
@@ -296,104 +296,3 @@ void matrix_scan_user(void) { # The very important timer.
296 } 296 }
297} 297}
298``` 298```
299
300---
301
302## **(DEPRECATED)** The Old Way: `MACRO()` & `action_get_macro`
303
304!> This is inherited from TMK, and hasn't been updated - it's recommended that you use `SEND_STRING` and `process_record_user` instead.
305
306By default QMK assumes you don't have any macros. To define your macros you create an `action_get_macro()` function. For example:
307
308```c
309const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) {
310 if (record->event.pressed) {
311 switch(id) {
312 case 0:
313 return MACRO(D(LSFT), T(H), U(LSFT), T(I), D(LSFT), T(1), U(LSFT), END);
314 case 1:
315 return MACRO(D(LSFT), T(B), U(LSFT), T(Y), T(E), D(LSFT), T(1), U(LSFT), END);
316 }
317 }
318 return MACRO_NONE;
319};
320```
321
322This defines two macros which will be run when the key they are assigned to is pressed. If instead you'd like them to run when the key is released you can change the if statement:
323
324 if (!record->event.pressed) {
325
326### Macro Commands
327
328A macro can include the following commands:
329
330* I() change interval of stroke in milliseconds.
331* D() press key.
332* U() release key.
333* T() type key(press and release).
334* W() wait (milliseconds).
335* END end mark.
336
337### Mapping a Macro to a Key
338
339Use the `M()` function within your keymap to call a macro. For example, here is the keymap for a 2-key keyboard:
340
341```c
342const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
343 [0] = LAYOUT(
344 M(0), M(1)
345 ),
346};
347
348const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) {
349 if (record->event.pressed) {
350 switch(id) {
351 case 0:
352 return MACRO(D(LSFT), T(H), U(LSFT), T(I), D(LSFT), T(1), U(LSFT), END);
353 case 1:
354 return MACRO(D(LSFT), T(B), U(LSFT), T(Y), T(E), D(LSFT), T(1), U(LSFT), END);
355 }
356 }
357 return MACRO_NONE;
358};
359```
360
361When you press the key on the left it will type "Hi!" and when you press the key on the right it will type "Bye!".
362
363### Naming Your Macros
364
365If you have a bunch of macros you want to refer to from your keymap while keeping the keymap easily readable you can name them using `#define` at the top of your file.
366
367```c
368#define M_HI M(0)
369#define M_BYE M(1)
370
371const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
372 [0] = LAYOUT(
373 M_HI, M_BYE
374 ),
375};
376```
377
378
379## Advanced Example:
380
381### Single-Key Copy/Paste
382
383This example defines a macro which sends `Ctrl-C` when pressed down, and `Ctrl-V` when released.
384
385```c
386const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) {
387 switch(id) {
388 case 0: {
389 if (record->event.pressed) {
390 return MACRO( D(LCTL), T(C), U(LCTL), END );
391 } else {
392 return MACRO( D(LCTL), T(V), U(LCTL), END );
393 }
394 break;
395 }
396 }
397 return MACRO_NONE;
398};
399```
diff --git a/docs/feature_mouse_keys.md b/docs/feature_mouse_keys.md
index ffde13389..a0d02416f 100644
--- a/docs/feature_mouse_keys.md
+++ b/docs/feature_mouse_keys.md
@@ -42,6 +42,7 @@ In your keymap you can use the following keycodes to map key presses to mouse ac
42Mouse keys supports three different modes to move the cursor: 42Mouse keys supports three different modes to move the cursor:
43 43
44* **Accelerated (default):** Holding movement keys accelerates the cursor until it reaches its maximum speed. 44* **Accelerated (default):** Holding movement keys accelerates the cursor until it reaches its maximum speed.
45* **Kinetic:** Holding movement keys accelerates the cursor with its speed following a quadratic curve until it reaches its maximum speed.
45* **Constant:** Holding movement keys moves the cursor at constant speeds. 46* **Constant:** Holding movement keys moves the cursor at constant speeds.
46* **Combined:** Holding movement keys accelerates the cursor until it reaches its maximum speed, but holding acceleration and movement keys simultaneously moves the cursor at constant speeds. 47* **Combined:** Holding movement keys accelerates the cursor until it reaches its maximum speed, but holding acceleration and movement keys simultaneously moves the cursor at constant speeds.
47 48
@@ -56,7 +57,8 @@ This is the default mode. You can adjust the cursor and scrolling acceleration u
56|Define |Default|Description | 57|Define |Default|Description |
57|----------------------------|-------|---------------------------------------------------------| 58|----------------------------|-------|---------------------------------------------------------|
58|`MOUSEKEY_DELAY` |300 |Delay between pressing a movement key and cursor movement| 59|`MOUSEKEY_DELAY` |300 |Delay between pressing a movement key and cursor movement|
59|`MOUSEKEY_INTERVAL` |50 |Time between cursor movements | 60|`MOUSEKEY_INTERVAL` |50 |Time between cursor movements in milliseconds |
61|`MOUSEKEY_MOVE_DELTA` |5 |Step size |
60|`MOUSEKEY_MAX_SPEED` |10 |Maximum cursor speed at which acceleration stops | 62|`MOUSEKEY_MAX_SPEED` |10 |Maximum cursor speed at which acceleration stops |
61|`MOUSEKEY_TIME_TO_MAX` |20 |Time until maximum cursor speed is reached | 63|`MOUSEKEY_TIME_TO_MAX` |20 |Time until maximum cursor speed is reached |
62|`MOUSEKEY_WHEEL_DELAY` |300 |Delay between pressing a wheel key and wheel movement | 64|`MOUSEKEY_WHEEL_DELAY` |300 |Delay between pressing a wheel key and wheel movement |
@@ -73,6 +75,30 @@ Tips:
73 75
74Cursor acceleration uses the same algorithm as the X Window System MouseKeysAccel feature. You can read more about it [on Wikipedia](https://en.wikipedia.org/wiki/Mouse_keys). 76Cursor acceleration uses the same algorithm as the X Window System MouseKeysAccel feature. You can read more about it [on Wikipedia](https://en.wikipedia.org/wiki/Mouse_keys).
75 77
78### Kinetic Mode
79
80This is an extension of the accelerated mode. The kinetic mode uses a quadratic curve on the cursor speed which allows precise movements at the beginning and allows to cover large distances by increasing cursor speed quickly thereafter. You can adjust the cursor and scrolling acceleration using the following settings in your keymap’s `config.h` file:
81
82|Define |Default |Description |
83|--------------------------------------|---------|---------------------------------------------------------------|
84|`MK_KINETIC_SPEED` |undefined|Enable kinetic mode |
85|`MOUSEKEY_DELAY` |8 |Delay between pressing a movement key and cursor movement |
86|`MOUSEKEY_INTERVAL` |8 |Time between cursor movements in milliseconds |
87|`MOUSEKEY_MOVE_DELTA` |25 |Step size for accelerating from initial to base speed |
88|`MOUSEKEY_INITIAL_SPEED` |100 |Initial speed of the cursor in pixel per second |
89|`MOUSEKEY_BASE_SPEED` |1000 |Maximum cursor speed at which acceleration stops |
90|`MOUSEKEY_DECELERATED_SPEED` |400 |Decelerated cursor speed |
91|`MOUSEKEY_ACCELERATED_SPEED` |3000 |Accelerated cursor speed |
92|`MOUSEKEY_WHEEL_INITIAL_MOVEMENTS` |16 |Initial number of movements of the mouse wheel |
93|`MOUSEKEY_WHEEL_BASE_MOVEMENTS` |32 |Maximum number of movements at which acceleration stops |
94|`MOUSEKEY_WHEEL_ACCELERATED_MOVEMENTS`|48 |Accelerated wheel movements |
95|`MOUSEKEY_WHEEL_DECELERATED_MOVEMENTS`|8 |Decelerated wheel movements |
96
97Tips:
98
99* The smoothness of the cursor movement depends on the `MOUSEKEY_INTERVAL` setting. The shorter the interval is set the smoother the movement will be. Setting the value too low makes the cursor unresponsive. Lower settings are possible if the micro processor is fast enough. For example: At an interval of `8` milliseconds, `125` movements per second will be initiated. With a base speed of `1000` each movement will move the cursor by `8` pixels.
100* Mouse wheel movements are implemented differently from cursor movements. While it's okay for the cursor to move multiple pixels at once for the mouse wheel this would lead to jerky movements. Instead, the mouse wheel operates at step size `1`. Setting mouse wheel speed is done by adjusting the number of wheel movements per second.
101
76### Constant mode 102### Constant mode
77 103
78In this mode you can define multiple different speeds for both the cursor and the mouse wheel. There is no acceleration. `KC_ACL0`, `KC_ACL1` and `KC_ACL2` change the cursor and scroll speed to their respective setting. 104In this mode you can define multiple different speeds for both the cursor and the mouse wheel. There is no acceleration. `KC_ACL0`, `KC_ACL1` and `KC_ACL2` change the cursor and scroll speed to their respective setting.
diff --git a/docs/feature_rgb_matrix.md b/docs/feature_rgb_matrix.md
index 7b597143c..e7ede4839 100644
--- a/docs/feature_rgb_matrix.md
+++ b/docs/feature_rgb_matrix.md
@@ -129,6 +129,28 @@ Configure the hardware via your `config.h`:
129 129
130--- 130---
131 131
132### APA102 :id=apa102
133
134There is basic support for APA102 based addressable LED strands. To enable it, add this to your `rules.mk`:
135
136```makefile
137RGB_MATRIX_ENABLE = yes
138RGB_MATRIX_DRIVER = APA102
139```
140
141Configure the hardware via your `config.h`:
142
143```c
144// The pin connected to the data pin of the LEDs
145#define RGB_DI_PIN D7
146// The pin connected to the clock pin of the LEDs
147#define RGB_CI_PIN D6
148// The number of LEDs connected
149#define DRIVER_LED_TOTAL 70
150```
151
152---
153
132From this point forward the configuration is the same for all the drivers. The `led_config_t` struct provides a key electrical matrix to led index lookup table, what the physical position of each LED is on the board, and what type of key or usage the LED if the LED represents. Here is a brief example: 154From this point forward the configuration is the same for all the drivers. The `led_config_t` struct provides a key electrical matrix to led index lookup table, what the physical position of each LED is on the board, and what type of key or usage the LED if the LED represents. Here is a brief example:
133 155
134```c 156```c
diff --git a/docs/feature_rgblight.md b/docs/feature_rgblight.md
index 0d3e66670..c49c308d1 100644
--- a/docs/feature_rgblight.md
+++ b/docs/feature_rgblight.md
@@ -10,6 +10,7 @@ Currently QMK supports the following addressable LEDs (however, the white LED in
10 10
11 * WS2811, WS2812, WS2812B, WS2812C, etc. 11 * WS2811, WS2812, WS2812B, WS2812C, etc.
12 * SK6812, SK6812MINI, SK6805 12 * SK6812, SK6812MINI, SK6805
13 * APA102
13 14
14These LEDs are called "addressable" because instead of using a wire per color, each LED contains a small microchip that understands a special protocol sent over a single wire. The chip passes on the remaining data to the next LED, allowing them to be chained together. In this way, you can easily control the color of the individual LEDs. 15These LEDs are called "addressable" because instead of using a wire per color, each LED contains a small microchip that understands a special protocol sent over a single wire. The chip passes on the remaining data to the next LED, allowing them to be chained together. In this way, you can easily control the color of the individual LEDs.
15 16
@@ -21,11 +22,19 @@ On keyboards with onboard RGB LEDs, it is usually enabled by default. If it is n
21RGBLIGHT_ENABLE = yes 22RGBLIGHT_ENABLE = yes
22``` 23```
23 24
24At minimum you must define the data pin your LED strip is connected to, and the number of LEDs in the strip, in your `config.h`. If your keyboard has onboard RGB LEDs, and you are simply creating a keymap, you usually won't need to modify these. 25For APA102 LEDs, add the following to your `rules.mk`:
26
27```make
28RGBLIGHT_ENABLE = yes
29RGBLIGHT_DRIVER = APA102
30```
31
32At minimum you must define the data pin your LED strip is connected to, and the number of LEDs in the strip, in your `config.h`. For APA102 LEDs, you must also define the clock pin. If your keyboard has onboard RGB LEDs, and you are simply creating a keymap, you usually won't need to modify these.
25 33
26|Define |Description | 34|Define |Description |
27|---------------|---------------------------------------------------------------------------------------------------------| 35|---------------|---------------------------------------------------------------------------------------------------------|
28|`RGB_DI_PIN` |The pin connected to the data pin of the LEDs | 36|`RGB_DI_PIN` |The pin connected to the data pin of the LEDs |
37|`RGB_CI_PIN` |The pin connected to the clock pin of the LEDs (APA102 only) |
29|`RGBLED_NUM` |The number of LEDs connected | 38|`RGBLED_NUM` |The number of LEDs connected |
30|`RGBLED_SPLIT` |(Optional) For split keyboards, the number of LEDs connected on each half directly wired to `RGB_DI_PIN` | 39|`RGBLED_SPLIT` |(Optional) For split keyboards, the number of LEDs connected on each half directly wired to `RGB_DI_PIN` |
31 40
@@ -139,7 +148,7 @@ The following options are used to tweak the various animations:
139|`RGBLIGHT_EFFECT_KNIGHT_OFFSET` |`0` |The number of LEDs to start the "Knight" animation from the start of the strip by | 148|`RGBLIGHT_EFFECT_KNIGHT_OFFSET` |`0` |The number of LEDs to start the "Knight" animation from the start of the strip by |
140|`RGBLIGHT_RAINBOW_SWIRL_RANGE` |`255` |Range adjustment for the rainbow swirl effect to get different swirls | 149|`RGBLIGHT_RAINBOW_SWIRL_RANGE` |`255` |Range adjustment for the rainbow swirl effect to get different swirls |
141|`RGBLIGHT_EFFECT_SNAKE_LENGTH` |`4` |The number of LEDs to light up for the "Snake" animation | 150|`RGBLIGHT_EFFECT_SNAKE_LENGTH` |`4` |The number of LEDs to light up for the "Snake" animation |
142|`RGBLIGHT_EFFECT_TWINKLE_LIFE` |`75` |Adjusts how quickly each LED brightens and dims when twinkling (in animation steps) | 151|`RGBLIGHT_EFFECT_TWINKLE_LIFE` |`200` |Adjusts how quickly each LED brightens and dims when twinkling (in animation steps) |
143|`RGBLIGHT_EFFECT_TWINKLE_PROBABILITY`|`1/127` |Adjusts how likely each LED is to twinkle (on each animation step) | 152|`RGBLIGHT_EFFECT_TWINKLE_PROBABILITY`|`1/127` |Adjusts how likely each LED is to twinkle (on each animation step) |
144 153
145### Example Usage to Reduce Memory Footprint 154### Example Usage to Reduce Memory Footprint
diff --git a/docs/feature_split_keyboard.md b/docs/feature_split_keyboard.md
index b23411420..c285e353d 100644
--- a/docs/feature_split_keyboard.md
+++ b/docs/feature_split_keyboard.md
@@ -181,6 +181,16 @@ If you're having issues with serial communication, you can change this value, as
181* **`4`**: about 26kbps 181* **`4`**: about 26kbps
182* **`5`**: about 20kbps 182* **`5`**: about 20kbps
183 183
184```c
185#define SPLIT_MODS_ENABLE
186```
187
188This enables transmitting modifier state (normal, weak and oneshot) to the non
189primary side of the split keyboard. This adds a few bytes of data to the split
190communication protocol and may impact the matrix scan speed when enabled.
191The purpose of this feature is to support cosmetic use of modifer state (e.g.
192displaying status on an OLED screen).
193
184### Hardware Configuration Options 194### Hardware Configuration Options
185 195
186There are some settings that you may need to configure, based on how the hardware is set up. 196There are some settings that you may need to configure, based on how the hardware is set up.
diff --git a/docs/ja/feature_macros.md b/docs/ja/feature_macros.md
index 14a58ad24..c42a61b5f 100644
--- a/docs/ja/feature_macros.md
+++ b/docs/ja/feature_macros.md
@@ -9,7 +9,7 @@
9 9
10!> **セキュリティの注意**: マクロを使って、パスワード、クレジットカード番号、その他の機密情報のいずれも送信することが可能ですが、それは非常に悪い考えです。あなたのキーボードを手に入れた人は誰でもテキストエディタを開いてその情報にアクセスすることができます。 10!> **セキュリティの注意**: マクロを使って、パスワード、クレジットカード番号、その他の機密情報のいずれも送信することが可能ですが、それは非常に悪い考えです。あなたのキーボードを手に入れた人は誰でもテキストエディタを開いてその情報にアクセスすることができます。
11 11
12## 新しい方法: `SEND_STRING()` と `process_record_user` 12## `SEND_STRING()` と `process_record_user`
13 13
14単語またはフレーズを入力するキーが欲しい時があります。最も一般的な状況のために `SEND_STRING()` を提供しています。これは文字列(つまり、文字のシーケンス)を入力します。簡単にキーコードに変換することができる全ての ASCII 文字がサポートされています (例えば、`qmk 123\n\t`)。 14単語またはフレーズを入力するキーが欲しい時があります。最も一般的な状況のために `SEND_STRING()` を提供しています。これは文字列(つまり、文字のシーケンス)を入力します。簡単にキーコードに変換することができる全ての ASCII 文字がサポートされています (例えば、`qmk 123\n\t`)。
15 15
@@ -267,15 +267,15 @@ SEND_STRING(".."SS_TAP(X_END));
267このマクロは `KC_LALT` を登録し、`KC_TAB` をタップして、1000ms 待ちます。キーが再度タップされると、別の `KC_TAB` が送信されます; タップが無い場合、`KC_LALT` が登録解除され、ウィンドウを切り替えることができます。 267このマクロは `KC_LALT` を登録し、`KC_TAB` をタップして、1000ms 待ちます。キーが再度タップされると、別の `KC_TAB` が送信されます; タップが無い場合、`KC_LALT` が登録解除され、ウィンドウを切り替えることができます。
268 268
269```c 269```c
270bool is_alt_tab_active = false; # keymap.c の先頭付近にこれを追加します 270bool is_alt_tab_active = false; // keymap.c の先頭付近にこれを追加します
271uint16_t alt_tab_timer = 0; # すぐにそれらを使います 271uint16_t alt_tab_timer = 0; // すぐにそれらを使います
272 272
273enum custom_keycodes { # 素晴らしいキーコードを用意してください 273enum custom_keycodes { // 素晴らしいキーコードを用意してください
274 ALT_TAB = SAFE_RANGE, 274 ALT_TAB = SAFE_RANGE,
275}; 275};
276 276
277bool process_record_user(uint16_t keycode, keyrecord_t *record) { 277bool process_record_user(uint16_t keycode, keyrecord_t *record) {
278 switch (keycode) { # これはキーコードを利用したつまらない作業のほとんどを行います。 278 switch (keycode) { // これはキーコードを利用したつまらない作業のほとんどを行います。
279 case ALT_TAB: 279 case ALT_TAB:
280 if (record->event.pressed) { 280 if (record->event.pressed) {
281 if (!is_alt_tab_active) { 281 if (!is_alt_tab_active) {
@@ -292,7 +292,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
292 return true; 292 return true;
293} 293}
294 294
295void matrix_scan_user(void) { # とても重要なタイマー 295void matrix_scan_user(void) { // とても重要なタイマー
296 if (is_alt_tab_active) { 296 if (is_alt_tab_active) {
297 if (timer_elapsed(alt_tab_timer) > 1000) { 297 if (timer_elapsed(alt_tab_timer) > 1000) {
298 unregister_code(KC_LALT); 298 unregister_code(KC_LALT);
@@ -301,104 +301,3 @@ void matrix_scan_user(void) { # とても重要なタイマー
301 } 301 }
302} 302}
303``` 303```
304
305---
306
307## **(非推奨)** 古い方法: `MACRO()` と `action_get_macro`
308
309!> これは TMK から継承されており、更新されていません - 代わりに `SEND_STRING` と `process_record_user` を使うことをお勧めします。
310
311デフォルトでは、QMK はマクロが無いことを前提としています。マクロを定義するには、`action_get_macro()` 関数を作成します。例えば:
312
313```c
314const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) {
315 if (record->event.pressed) {
316 switch(id) {
317 case 0:
318 return MACRO(D(LSFT), T(H), U(LSFT), T(I), D(LSFT), T(1), U(LSFT), END);
319 case 1:
320 return MACRO(D(LSFT), T(B), U(LSFT), T(Y), T(E), D(LSFT), T(1), U(LSFT), END);
321 }
322 }
323 return MACRO_NONE;
324};
325```
326
327これは割り当てられているキーが押された時に実行される2つのマクロを定義します。キーが放された時にそれらを実行したい場合は、if 文を変更することができます。
328
329 if (!record->event.pressed) {
330
331### マクロコマンド
332
333マクロは以下のコマンドを含めることができます:
334
335* I() はストロークの間隔をミリ秒単位で変更します。
336* D() はキーを押します。
337* U() はキーを放します。
338* T() はキーをタイプ(押して放す)します。
339* W() は待ちます (ミリ秒)。
340* END 終了マーク。
341
342### マクロをキーにマッピングする
343
344マクロを呼び出すにはキーマップ内で `M()` 関数を使います。例えば、2キーのキーボードのキーマップは以下の通りです:
345
346```c
347const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
348 [0] = LAYOUT(
349 M(0), M(1)
350 ),
351};
352
353const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) {
354 if (record->event.pressed) {
355 switch(id) {
356 case 0:
357 return MACRO(D(LSFT), T(H), U(LSFT), T(I), D(LSFT), T(1), U(LSFT), END);
358 case 1:
359 return MACRO(D(LSFT), T(B), U(LSFT), T(Y), T(E), D(LSFT), T(1), U(LSFT), END);
360 }
361 }
362 return MACRO_NONE;
363};
364```
365
366左側のキーを押すと、"Hi!" を入力し、右側のキーを押すと "Bye!" を入力します。
367
368### マクロに名前を付ける
369
370キーマップを読みやすくしながらキーマップから参照したいマクロがたくさんある場合は、ファイルの先頭で `#define` を使って名前を付けることができます。
371
372```c
373#define M_HI M(0)
374#define M_BYE M(1)
375
376const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
377 [0] = LAYOUT(
378 M_HI, M_BYE
379 ),
380};
381```
382
383
384## 高度な例:
385
386### 単一キーのコピーと貼り付け
387
388この例は、押された時に `Ctrl-C` を送信し、放される時に `Ctrl-V` を送信するマクロを定義します。
389
390```c
391const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) {
392 switch(id) {
393 case 0: {
394 if (record->event.pressed) {
395 return MACRO( D(LCTL), T(C), U(LCTL), END );
396 } else {
397 return MACRO( D(LCTL), T(V), U(LCTL), END );
398 }
399 break;
400 }
401 }
402 return MACRO_NONE;
403};
404```
diff --git a/docs/ja/proton_c_conversion.md b/docs/ja/proton_c_conversion.md
index 6e4f7dcb6..e7c07413c 100644
--- a/docs/ja/proton_c_conversion.md
+++ b/docs/ja/proton_c_conversion.md
@@ -51,6 +51,7 @@ Proton C には1つのオンボード LED(C13)しかなく、デフォルトで
51 51
52``` 52```
53MCU = STM32F303 53MCU = STM32F303
54BOARD = QMK_PROTON_C
54``` 55```
55 56
56次の変数が存在する場合は削除します。 57次の変数が存在する場合は削除します。
diff --git a/docs/proton_c_conversion.md b/docs/proton_c_conversion.md
index 1b5e496e7..47511e1b1 100644
--- a/docs/proton_c_conversion.md
+++ b/docs/proton_c_conversion.md
@@ -44,6 +44,7 @@ To use the Proton C natively, without having to specify `CTPC=yes`, you need to
44 44
45``` 45```
46MCU = STM32F303 46MCU = STM32F303
47BOARD = QMK_PROTON_C
47``` 48```
48 49
49Remove these variables if they exist: 50Remove these variables if they exist:
diff --git a/docs/reference_info_json.md b/docs/reference_info_json.md
index 3ca62c719..c9864ea2d 100644
--- a/docs/reference_info_json.md
+++ b/docs/reference_info_json.md
@@ -19,8 +19,20 @@ The `info.json` file is a JSON formatted dictionary with the following keys avai
19 * Width of the board in Key Units 19 * Width of the board in Key Units
20* `height` 20* `height`
21 * Height of the board in Key Units 21 * Height of the board in Key Units
22* `debounce`
23 * How many milliseconds (ms) to wait for debounce to happen. (Default: 5)
24* `diode_direction`
25 * The direction diodes face. See [`DIRECT_PINS` in the hardware configuration](https://docs.qmk.fm/#/config_options?id=hardware-options) for more details.
26* `layout_aliases`
27 * A dictionary containing layout aliases. The key is the alias and the value is a layout in `layouts` it maps to.
22* `layouts` 28* `layouts`
23 * Physical Layout representations. See the next section for more detail. 29 * Physical Layout representations. See the [Layout Format](#layout_format) section for more detail.
30* `matrix_pins`
31 * Configure the pins corresponding to columns and rows, or direct pins. See [Matrix Pins](#matrix_pins) for more detail.
32* `rgblight`
33 * Configure the [RGB Lighting feature](feature_rgblight.md). See the [RGB Lighting](#rgb_lighting) section for more detail.
34* `usb`
35 * Configure USB VID, PID, and other parameters. See [USB](#USB) for more detail.
24 36
25### Layout Format 37### Layout Format
26 38
@@ -49,25 +61,129 @@ All key positions and rotations are specified in relation to the top-left corner
49 * The width of the key, in Key Units. Ignored if `ks` is provided. Default: `1` 61 * The width of the key, in Key Units. Ignored if `ks` is provided. Default: `1`
50* `h` 62* `h`
51 * The height of the key, in Key Units. Ignored if `ks` is provided. Default: `1` 63 * The height of the key, in Key Units. Ignored if `ks` is provided. Default: `1`
52* `r`
53 * How many degrees clockwise to rotate the key.
54* `rx`
55 * The absolute position of the point to rotate the key around in the horizontal axis. Default: `x`
56* `ry`
57 * The absolute position of the point to rotate the key around in the vertical axis. Default: `y`
58* `ks`
59 * Key Shape: define a polygon by providing a list of points, in Key Units.
60 * **Important**: These are relative to the top-left of the key, not absolute.
61 * Example ISO Enter: `[ [0,0], [1.5,0], [1.5,2], [0.25,2], [0.25,1], [0,1], [0,0] ]`
62* `label` 64* `label`
63 * What to name this position in the matrix. 65 * What to name this position in the matrix.
64 * This should usually be the same name as what is silkscreened on the PCB at this location. 66 * This should usually correspond to the keycode for the first layer of the default keymap.
65 67* `matrix`
66## How is the Metadata Exposed? 68 * A 2 item list describing the row and column location for this key.
67 69
68This metadata is primarily used in two ways: 70### Matrix Pins
69 71
70* To allow web-based configurators to dynamically generate UI 72Currently QMK supports connecting switches either directly to GPIO pins or via a switch matrix. At this time you can not combine these, they are mutually exclusive.
71* To support the new `make keyboard:keymap:qmk` target, which bundles this metadata up with the firmware to allow QMK Toolbox to be smarter. 73
72 74#### Switch Matrix
73Configurator authors can see the [QMK Compiler](https://docs.api.qmk.fm/using-the-api) docs for more information on using the JSON API. 75
76Most keyboards use a switch matrix to connect keyswitches to the MCU. You can define your pin columns and rows to configure your switch matrix. When defining switch matrices you should also define your `diode_direction`.
77
78Example:
79
80```json
81{
82 "diode_direction": "COL2ROW",
83 "matrix_pins": {
84 "cols": ["F4", "E6", "B1", "D2"],
85 "rows": ["B0", "D3", "D5", "D4", "D6"]
86 }
87}
88```
89
90#### Direct Pins
91
92Direct pins are when you connect one side of the switch to GND and the other side to a GPIO pin on your MCU. No diode is required, but there is a 1:1 mapping between switches and pins.
93
94When specifying direct pins you need to arrange them in nested arrays. The outer array consists of rows, while the inner array is a text string corresponding to a pin. You can use `null` to indicate an empty spot in the matrix.
95
96Example:
97
98```json
99{
100 "matrix_pins": {
101 "direct": [
102 ["A10", "A9"],
103 ["A0", "B8"],
104 [null, "B11"],
105 ["B9", "A8"],
106 ["A7", "B1"],
107 [null, "B2"]
108 ]
109 }
110}
111```
112
113### RGB Lighting
114
115This section controls the legacy WS2812 support in QMK. This should not be confused with the RGB Matrix feature, which can be used to control both WS2812 and ISSI RGB LEDs.
116
117The following items can be set. Not every value is required.
118
119* `led_count`
120 * The number of LEDs in your strip
121* `pin`
122 * The GPIO pin that your LED strip is connected to
123* `animations`
124 * A dictionary that lists enabled and disabled animations. See [RGB Light Animations](#rgb_light_animations) below.
125* `sleep`
126 * Set to `true` to enable lighting during host sleep
127* `split`
128 * Set to `true` to enable synchronization functionality between split halves
129* `split_count`
130 * For split keyboards, the number of LEDs on each side
131* `max_brightness`
132 * (0-255) What the maxmimum brightness (value) level is
133* `hue_steps`
134 * How many steps of adjustment to have for hue
135* `saturation_steps`
136 * How many steps of adjustment to have for saturation
137* `brightness_steps`
138 * How many steps of adjustment to have for brightness (value)
139
140Example:
141
142```json
143{
144 "rgblight": {
145 "led_count": 4,
146 "pin": "F6",
147 "hue_steps": 10,
148 "saturation_steps": 17,
149 "brightness_steps": 17,
150 "animations": {
151 "all": true
152 }
153 }
154}
155```
156
157#### RGB Light Animations
158
159The following animations can be enabled:
160
161| Key | Description |
162|-----|-------------|
163| `all` | Enable all additional animation modes. |
164| `alternating` | Enable alternating animation mode. |
165| `breathing` | Enable breathing animation mode. |
166| `christmas` | Enable christmas animation mode. |
167| `knight` | Enable knight animation mode. |
168| `rainbow_mood` | Enable rainbow mood animation mode. |
169| `rainbow_swirl` | Enable rainbow swirl animation mode. |
170| `rgb_test` | Enable RGB test animation mode. |
171| `snake` | Enable snake animation mode. |
172| `static_gradient` | Enable static gradient mode. |
173| `twinkle` | Enable twinkle animation mode. |
174
175### USB
176
177Every USB keyboard needs to have its USB parmaters defined. At a minimum you need to set vid, pid, and device version.
178
179Example:
180
181```json
182{
183 "usb": {
184 "vid": "0xC1ED",
185 "pid": "0x23B0",
186 "device_ver": "0x0001"
187 }
188}
189```
diff --git a/docs/reference_keymap_extras.md b/docs/reference_keymap_extras.md
index f2abb4e59..40a195684 100644
--- a/docs/reference_keymap_extras.md
+++ b/docs/reference_keymap_extras.md
@@ -18,7 +18,9 @@ To use these, simply `#include` the corresponding [header file](https://github.c
18|Dutch (Belgium) |`keymap_belgian.h` | 18|Dutch (Belgium) |`keymap_belgian.h` |
19|English (Ireland) |`keymap_irish.h` | 19|English (Ireland) |`keymap_irish.h` |
20|English (UK) |`keymap_uk.h` | 20|English (UK) |`keymap_uk.h` |
21|English (US Extended) |`keymap_us_extended.h` |
21|English (US International) |`keymap_us_international.h` | 22|English (US International) |`keymap_us_international.h` |
23|English (US International, Linux)|`keymap_us_international_linux.h`|
22|Estonian |`keymap_estonian.h` | 24|Estonian |`keymap_estonian.h` |
23|Finnish |`keymap_finnish.h` | 25|Finnish |`keymap_finnish.h` |
24|French |`keymap_french.h` | 26|French |`keymap_french.h` |
diff --git a/docs/serial_driver.md b/docs/serial_driver.md
index bc376b6dd..c98f4c117 100644
--- a/docs/serial_driver.md
+++ b/docs/serial_driver.md
@@ -60,6 +60,7 @@ Configure the hardware via your config.h:
60 // 5: about 19200 baud 60 // 5: about 19200 baud
61#define SERIAL_USART_DRIVER SD1 // USART driver of TX pin. default: SD1 61#define SERIAL_USART_DRIVER SD1 // USART driver of TX pin. default: SD1
62#define SERIAL_USART_TX_PAL_MODE 7 // Pin "alternate function", see the respective datasheet for the appropriate values for your MCU. default: 7 62#define SERIAL_USART_TX_PAL_MODE 7 // Pin "alternate function", see the respective datasheet for the appropriate values for your MCU. default: 7
63#define SERIAL_USART_TIMEOUT 100 // USART driver timeout. default 100
63``` 64```
64 65
65You must also enable the ChibiOS `SERIAL` feature: 66You must also enable the ChibiOS `SERIAL` feature: