aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
Diffstat (limited to 'docs')
-rw-r--r--docs/_summary.md2
-rw-r--r--docs/compatible_microcontrollers.md1
-rw-r--r--docs/data_driven_config.md91
-rw-r--r--docs/feature_backlight.md24
-rw-r--r--docs/feature_macros.md113
-rw-r--r--docs/feature_mouse_keys.md31
-rw-r--r--docs/feature_pointing_device.md2
-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/compatible_microcontrollers.md1
-rw-r--r--docs/ja/feature_macros.md113
-rw-r--r--docs/ja/feature_mouse_keys.md3
-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
-rw-r--r--docs/spi_driver.md12
-rw-r--r--docs/uart_driver.md90
20 files changed, 434 insertions, 257 deletions
diff --git a/docs/_summary.md b/docs/_summary.md
index 5af0046ab..526caf926 100644
--- a/docs/_summary.md
+++ b/docs/_summary.md
@@ -138,6 +138,7 @@
138 * [WS2812 Driver](ws2812_driver.md) 138 * [WS2812 Driver](ws2812_driver.md)
139 * [EEPROM Driver](eeprom_driver.md) 139 * [EEPROM Driver](eeprom_driver.md)
140 * ['serial' Driver](serial_driver.md) 140 * ['serial' Driver](serial_driver.md)
141 * [UART Driver](uart_driver.md)
141 * [GPIO Controls](internals_gpio_control.md) 142 * [GPIO Controls](internals_gpio_control.md)
142 * [Keyboard Guidelines](hardware_keyboard_guidelines.md) 143 * [Keyboard Guidelines](hardware_keyboard_guidelines.md)
143 144
@@ -159,6 +160,7 @@
159 * [Contributing to QMK](contributing.md) 160 * [Contributing to QMK](contributing.md)
160 * [Translating the QMK Docs](translating.md) 161 * [Translating the QMK Docs](translating.md)
161 * [Config Options](config_options.md) 162 * [Config Options](config_options.md)
163 * [Data Driven Configuration](data_driven_config.md)
162 * [Make Documentation](getting_started_make_guide.md) 164 * [Make Documentation](getting_started_make_guide.md)
163 * [Documentation Best Practices](documentation_best_practices.md) 165 * [Documentation Best Practices](documentation_best_practices.md)
164 * [Documentation Templates](documentation_templates.md) 166 * [Documentation Templates](documentation_templates.md)
diff --git a/docs/compatible_microcontrollers.md b/docs/compatible_microcontrollers.md
index 1bf707224..c1287bc33 100644
--- a/docs/compatible_microcontrollers.md
+++ b/docs/compatible_microcontrollers.md
@@ -9,6 +9,7 @@ The following use [LUFA](https://www.fourwalledcubicle.com/LUFA.php) as the USB
9* [ATmega16U2](https://www.microchip.com/wwwproducts/en/ATmega16U2) / [ATmega32U2](https://www.microchip.com/wwwproducts/en/ATmega32U2) 9* [ATmega16U2](https://www.microchip.com/wwwproducts/en/ATmega16U2) / [ATmega32U2](https://www.microchip.com/wwwproducts/en/ATmega32U2)
10* [ATmega16U4](https://www.microchip.com/wwwproducts/en/ATmega16U4) / [ATmega32U4](https://www.microchip.com/wwwproducts/en/ATmega32U4) 10* [ATmega16U4](https://www.microchip.com/wwwproducts/en/ATmega16U4) / [ATmega32U4](https://www.microchip.com/wwwproducts/en/ATmega32U4)
11* [AT90USB64](https://www.microchip.com/wwwproducts/en/AT90USB646) / [AT90USB128](https://www.microchip.com/wwwproducts/en/AT90USB1286) 11* [AT90USB64](https://www.microchip.com/wwwproducts/en/AT90USB646) / [AT90USB128](https://www.microchip.com/wwwproducts/en/AT90USB1286)
12* [AT90USB162](https://www.microchip.com/wwwproducts/en/AT90USB162)
12 13
13Certain MCUs which do not have native USB will use [V-USB](https://www.obdev.at/products/vusb/index.html) instead: 14Certain MCUs which do not have native USB will use [V-USB](https://www.obdev.at/products/vusb/index.html) instead:
14 15
diff --git a/docs/data_driven_config.md b/docs/data_driven_config.md
new file mode 100644
index 000000000..c2ad4fed8
--- /dev/null
+++ b/docs/data_driven_config.md
@@ -0,0 +1,91 @@
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 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 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 a mapping in `data/maps`
251. (optional and discoraged) Add code to extract/generate it to:
26 * `lib/python/qmk/info.py`
27 * `lib/python/qmk/cli/generate/config_h.py`
28 * `lib/python/qmk/cli/generate/rules_mk.py`
29
30## Adding an option to info.json
31
32This section describes adding support for a `config.h`/`rules.mk` value to info.json.
33
34### Add it to the schema
35
36QMK maintains [jsonschema](https://json-schema.org/) 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.
37
38In 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.
39
40In 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.
41
42### Add a mapping
43
44In most cases you can add a simple mapping. These are maintained as JSON files in `data/mappings/info_config.json` and `data/mappings/info_rules.json`, and control mapping for `config.h` and `rules.mk`, respectively. Each mapping is keyed by the `config.h` or `rules.mk` variable, and the value is a hash with the following keys:
45
46* `info_key`: (required) The location within `info.json` for this value. See below.
47* `value_type`: (optional) Default `str`. The format for this variable's value. See below.
48* `to_json`: (optional) Default `true`. Set to `false` to exclude this mapping from info.json
49* `to_c`: (optional) Default `true`. Set to `false` to exclude this mapping from config.h
50* `warn_duplicate`: (optional) Default `true`. Set to `false` to turn off warning when a value exists in both places
51
52#### Info Key
53
54We use JSON dot notation to address variables within info.json. For example, to access `info_json["rgblight"]["split_count"]` I would specify `rgblight.split_count`. This allows you to address deeply nested keys with a simple string.
55
56Under the hood we use [Dotty Dict](https://dotty-dict.readthedocs.io/en/latest/), you can refer to that documentation for how these strings are converted to object access.
57
58#### Value Types
59
60By default we treat all values as simple strings. If your value is more complex you can use one of these types to intelligently parse the data:
61
62* `array`: A comma separated array of strings
63* `array.int`: A comma separated array of integers
64* `int`: An integer
65* `hex`: A number formatted as hex
66* `list`: A space separate array of strings
67* `mapping`: A hash of key/value pairs
68
69### Add code to extract it
70
71Most use cases can be solved by the mapping files described above. If yours can't you can instead write code to extract your config values.
72
73Whenever 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()`.
74
75If 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.
76
77### Add code to generate it
78
79The final piece of the puzzle is providing your new option to the build system. This is done by generating two files:
80
81* `.build/obj_<keyboard>/src/info_config.h`
82* `.build/obj_<keyboard>/src/rules.mk`
83
84These two files are generated by the code here:
85
86* `lib/python/qmk/cli/generate/config_h.py`
87* `lib/python/qmk/cli/generate/rules_mk.py`
88
89For `config.h` values you'll need to write a function for your rule(s) and call that function in `generate_config_h()`.
90
91If 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_backlight.md b/docs/feature_backlight.md
index a558af64e..2adb16e4a 100644
--- a/docs/feature_backlight.md
+++ b/docs/feature_backlight.md
@@ -93,18 +93,18 @@ BACKLIGHT_DRIVER = pwm
93 93
94On AVR boards, QMK automatically decides which driver to use according to the following table: 94On AVR boards, QMK automatically decides which driver to use according to the following table:
95 95
96|Backlight Pin|AT90USB64/128|ATmega16/32U4|ATmega16/32U2|ATmega32A|ATmega328/P| 96|Backlight Pin|AT90USB64/128|AT90USB162|ATmega16/32U4|ATmega16/32U2|ATmega32A|ATmega328/P|
97|-------------|-------------|-------------|-------------|---------|-----------| 97|-------------|-------------|----------|-------------|-------------|---------|-----------|
98|`B1` | | | | |Timer 1 | 98|`B1` | | | | | |Timer 1 |
99|`B2` | | | | |Timer 1 | 99|`B2` | | | | | |Timer 1 |
100|`B5` |Timer 1 |Timer 1 | | | | 100|`B5` |Timer 1 | |Timer 1 | | | |
101|`B6` |Timer 1 |Timer 1 | | | | 101|`B6` |Timer 1 | |Timer 1 | | | |
102|`B7` |Timer 1 |Timer 1 |Timer 1 | | | 102|`B7` |Timer 1 |Timer 1 |Timer 1 |Timer 1 | | |
103|`C4` |Timer 3 | | | | | 103|`C4` |Timer 3 | | | | | |
104|`C5` |Timer 3 | |Timer 1 | | | 104|`C5` |Timer 3 |Timer 1 | |Timer 1 | | |
105|`C6` |Timer 3 |Timer 3 |Timer 1 | | | 105|`C6` |Timer 3 |Timer 1 |Timer 3 |Timer 1 | | |
106|`D4` | | | |Timer 1 | | 106|`D4` | | | | |Timer 1 | |
107|`D5` | | | |Timer 1 | | 107|`D5` | | | | |Timer 1 | |
108 108
109All other pins will use timer-assisted software PWM: 109All other pins will use timer-assisted software PWM:
110 110
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..8e2a3a4cd 100644
--- a/docs/feature_mouse_keys.md
+++ b/docs/feature_mouse_keys.md
@@ -29,6 +29,9 @@ In your keymap you can use the following keycodes to map key presses to mouse ac
29|`KC_MS_BTN3` |`KC_BTN3`|Press button 3 | 29|`KC_MS_BTN3` |`KC_BTN3`|Press button 3 |
30|`KC_MS_BTN4` |`KC_BTN4`|Press button 4 | 30|`KC_MS_BTN4` |`KC_BTN4`|Press button 4 |
31|`KC_MS_BTN5` |`KC_BTN5`|Press button 5 | 31|`KC_MS_BTN5` |`KC_BTN5`|Press button 5 |
32|`KC_MS_BTN6` |`KC_BTN6`|Press button 6 |
33|`KC_MS_BTN7` |`KC_BTN7`|Press button 7 |
34|`KC_MS_BTN8` |`KC_BTN8`|Press button 8 |
32|`KC_MS_WH_UP` |`KC_WH_U`|Move wheel up | 35|`KC_MS_WH_UP` |`KC_WH_U`|Move wheel up |
33|`KC_MS_WH_DOWN` |`KC_WH_D`|Move wheel down | 36|`KC_MS_WH_DOWN` |`KC_WH_D`|Move wheel down |
34|`KC_MS_WH_LEFT` |`KC_WH_L`|Move wheel left | 37|`KC_MS_WH_LEFT` |`KC_WH_L`|Move wheel left |
@@ -42,6 +45,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: 45Mouse keys supports three different modes to move the cursor:
43 46
44* **Accelerated (default):** Holding movement keys accelerates the cursor until it reaches its maximum speed. 47* **Accelerated (default):** Holding movement keys accelerates the cursor until it reaches its maximum speed.
48* **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. 49* **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. 50* **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 51
@@ -56,7 +60,8 @@ This is the default mode. You can adjust the cursor and scrolling acceleration u
56|Define |Default|Description | 60|Define |Default|Description |
57|----------------------------|-------|---------------------------------------------------------| 61|----------------------------|-------|---------------------------------------------------------|
58|`MOUSEKEY_DELAY` |300 |Delay between pressing a movement key and cursor movement| 62|`MOUSEKEY_DELAY` |300 |Delay between pressing a movement key and cursor movement|
59|`MOUSEKEY_INTERVAL` |50 |Time between cursor movements | 63|`MOUSEKEY_INTERVAL` |50 |Time between cursor movements in milliseconds |
64|`MOUSEKEY_MOVE_DELTA` |5 |Step size |
60|`MOUSEKEY_MAX_SPEED` |10 |Maximum cursor speed at which acceleration stops | 65|`MOUSEKEY_MAX_SPEED` |10 |Maximum cursor speed at which acceleration stops |
61|`MOUSEKEY_TIME_TO_MAX` |20 |Time until maximum cursor speed is reached | 66|`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 | 67|`MOUSEKEY_WHEEL_DELAY` |300 |Delay between pressing a wheel key and wheel movement |
@@ -73,6 +78,30 @@ Tips:
73 78
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). 79Cursor 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 80
81### Kinetic Mode
82
83This 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:
84
85|Define |Default |Description |
86|--------------------------------------|---------|---------------------------------------------------------------|
87|`MK_KINETIC_SPEED` |undefined|Enable kinetic mode |
88|`MOUSEKEY_DELAY` |8 |Delay between pressing a movement key and cursor movement |
89|`MOUSEKEY_INTERVAL` |8 |Time between cursor movements in milliseconds |
90|`MOUSEKEY_MOVE_DELTA` |25 |Step size for accelerating from initial to base speed |
91|`MOUSEKEY_INITIAL_SPEED` |100 |Initial speed of the cursor in pixel per second |
92|`MOUSEKEY_BASE_SPEED` |1000 |Maximum cursor speed at which acceleration stops |
93|`MOUSEKEY_DECELERATED_SPEED` |400 |Decelerated cursor speed |
94|`MOUSEKEY_ACCELERATED_SPEED` |3000 |Accelerated cursor speed |
95|`MOUSEKEY_WHEEL_INITIAL_MOVEMENTS` |16 |Initial number of movements of the mouse wheel |
96|`MOUSEKEY_WHEEL_BASE_MOVEMENTS` |32 |Maximum number of movements at which acceleration stops |
97|`MOUSEKEY_WHEEL_ACCELERATED_MOVEMENTS`|48 |Accelerated wheel movements |
98|`MOUSEKEY_WHEEL_DECELERATED_MOVEMENTS`|8 |Decelerated wheel movements |
99
100Tips:
101
102* 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.
103* 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.
104
76### Constant mode 105### Constant mode
77 106
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. 107In 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_pointing_device.md b/docs/feature_pointing_device.md
index c9309d697..c6d3560f3 100644
--- a/docs/feature_pointing_device.md
+++ b/docs/feature_pointing_device.md
@@ -19,7 +19,7 @@ Keep in mind that a report_mouse_t (here "mouseReport") has the following proper
19* `mouseReport.y` - this is a signed int from -127 to 127 (not 128, this is defined in USB HID spec) representing movement (+ upward, - downward) on the y axis. 19* `mouseReport.y` - this is a signed int from -127 to 127 (not 128, this is defined in USB HID spec) representing movement (+ upward, - downward) on the y axis.
20* `mouseReport.v` - this is a signed int from -127 to 127 (not 128, this is defined in USB HID spec) representing vertical scrolling (+ upward, - downward). 20* `mouseReport.v` - this is a signed int from -127 to 127 (not 128, this is defined in USB HID spec) representing vertical scrolling (+ upward, - downward).
21* `mouseReport.h` - this is a signed int from -127 to 127 (not 128, this is defined in USB HID spec) representing horizontal scrolling (+ right, - left). 21* `mouseReport.h` - this is a signed int from -127 to 127 (not 128, this is defined in USB HID spec) representing horizontal scrolling (+ right, - left).
22* `mouseReport.buttons` - this is a uint8_t in which the last 5 bits are used. These bits represent the mouse button state - bit 3 is mouse button 5, and bit 7 is mouse button 1. 22* `mouseReport.buttons` - this is a uint8_t in which all 8 bits are used. These bits represent the mouse button state - bit 0 is mouse button 1, and bit 7 is mouse button 8.
23 23
24Once you have made the necessary changes to the mouse report, you need to send it: 24Once you have made the necessary changes to the mouse report, you need to send it:
25 25
diff --git a/docs/feature_rgb_matrix.md b/docs/feature_rgb_matrix.md
index f5abd327c..fd866bd57 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 755fd769e..b5a2b179d 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/compatible_microcontrollers.md b/docs/ja/compatible_microcontrollers.md
index 48b07aaec..31d362d09 100644
--- a/docs/ja/compatible_microcontrollers.md
+++ b/docs/ja/compatible_microcontrollers.md
@@ -14,6 +14,7 @@ QMK ã¯å分ãªå®¹é‡ã®ãƒ•ラッシュメモリを備ãˆãŸ USB 対応 AVR ã¾
14* [ATmega16U2](https://www.microchip.com/wwwproducts/en/ATmega16U2) / [ATmega32U2](https://www.microchip.com/wwwproducts/en/ATmega32U2) 14* [ATmega16U2](https://www.microchip.com/wwwproducts/en/ATmega16U2) / [ATmega32U2](https://www.microchip.com/wwwproducts/en/ATmega32U2)
15* [ATmega16U4](https://www.microchip.com/wwwproducts/en/ATmega16U4) / [ATmega32U4](https://www.microchip.com/wwwproducts/en/ATmega32U4) 15* [ATmega16U4](https://www.microchip.com/wwwproducts/en/ATmega16U4) / [ATmega32U4](https://www.microchip.com/wwwproducts/en/ATmega32U4)
16* [AT90USB64](https://www.microchip.com/wwwproducts/en/AT90USB646) / [AT90USB128](https://www.microchip.com/wwwproducts/en/AT90USB1286) 16* [AT90USB64](https://www.microchip.com/wwwproducts/en/AT90USB646) / [AT90USB128](https://www.microchip.com/wwwproducts/en/AT90USB1286)
17* [AT90USB162](https://www.microchip.com/wwwproducts/en/AT90USB162)
17 18
18組ã¿è¾¼ã¿ã® USB インターフェースをæŒãŸãªã„ã€ã„ãã¤ã‹ã® MCU ã¯ä»£ã‚り㫠[V-USB](https://www.obdev.at/products/vusb/index.html) を使ã„ã¾ã™: 19組ã¿è¾¼ã¿ã® USB インターフェースをæŒãŸãªã„ã€ã„ãã¤ã‹ã® MCU ã¯ä»£ã‚り㫠[V-USB](https://www.obdev.at/products/vusb/index.html) を使ã„ã¾ã™:
19 20
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/feature_mouse_keys.md b/docs/ja/feature_mouse_keys.md
index 74b09e939..e4fa9dfb4 100644
--- a/docs/ja/feature_mouse_keys.md
+++ b/docs/ja/feature_mouse_keys.md
@@ -34,6 +34,9 @@ MOUSEKEY_ENABLE = yes
34| `KC_MS_BTN3` | `KC_BTN3` | ボタン3を押㙠| 34| `KC_MS_BTN3` | `KC_BTN3` | ボタン3を押㙠|
35| `KC_MS_BTN4` | `KC_BTN4` | ボタン4を押㙠| 35| `KC_MS_BTN4` | `KC_BTN4` | ボタン4を押㙠|
36| `KC_MS_BTN5` | `KC_BTN5` | ボタン5を押㙠| 36| `KC_MS_BTN5` | `KC_BTN5` | ボタン5を押㙠|
37| `KC_MS_BTN6` | `KC_BTN6` | ボタン6を押㙠|
38| `KC_MS_BTN7` | `KC_BTN7` | ボタン7を押㙠|
39| `KC_MS_BTN8` | `KC_BTN8` | ボタン8を押㙠|
37| `KC_MS_WH_UP` | `KC_WH_U` | ホイールをå‘ã“ã†å´ã«å›žè»¢ | 40| `KC_MS_WH_UP` | `KC_WH_U` | ホイールをå‘ã“ã†å´ã«å›žè»¢ |
38| `KC_MS_WH_DOWN` | `KC_WH_D` | ホイールを手å‰å´ã«å›žè»¢ | 41| `KC_MS_WH_DOWN` | `KC_WH_D` | ホイールを手å‰å´ã«å›žè»¢ |
39| `KC_MS_WH_LEFT` | `KC_WH_L` | ホイールを左ã«å€’ã™ | 42| `KC_MS_WH_LEFT` | `KC_WH_L` | ホイールを左ã«å€’ã™ |
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 67c189d78..30d813e93 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:
diff --git a/docs/spi_driver.md b/docs/spi_driver.md
index 1d432432a..03c008da2 100644
--- a/docs/spi_driver.md
+++ b/docs/spi_driver.md
@@ -6,12 +6,12 @@ The SPI Master drivers used in QMK have a set of common functions to allow porta
6 6
7No special setup is required - just connect the `SS`, `SCK`, `MOSI` and `MISO` pins of your SPI devices to the matching pins on the MCU: 7No special setup is required - just connect the `SS`, `SCK`, `MOSI` and `MISO` pins of your SPI devices to the matching pins on the MCU:
8 8
9|MCU |`SS`|`SCK`|`MOSI`|`MISO`| 9|MCU |`SS`|`SCK`|`MOSI`|`MISO`|
10|---------------|----|-----|------|------| 10|-----------------|----|-----|------|------|
11|ATMega16/32U2/4|`B0`|`B1` |`B2` |`B3` | 11|ATMega16/32U2/4 |`B0`|`B1` |`B2` |`B3` |
12|AT90USB64/128 |`B0`|`B1` |`B2` |`B3` | 12|AT90USB64/128/162|`B0`|`B1` |`B2` |`B3` |
13|ATmega32A |`B4`|`B7` |`B5` |`B6` | 13|ATmega32A |`B4`|`B7` |`B5` |`B6` |
14|ATmega328/P |`B2`|`B5` |`B3` |`B4` | 14|ATmega328/P |`B2`|`B5` |`B3` |`B4` |
15 15
16You may use more than one slave select pin, not just the `SS` pin. This is useful when you have multiple devices connected and need to communicate with them individually. 16You may use more than one slave select pin, not just the `SS` pin. This is useful when you have multiple devices connected and need to communicate with them individually.
17`SPI_SS_PIN` can be passed to `spi_start()` to refer to `SS`. 17`SPI_SS_PIN` can be passed to `spi_start()` to refer to `SS`.
diff --git a/docs/uart_driver.md b/docs/uart_driver.md
new file mode 100644
index 000000000..4d1716975
--- /dev/null
+++ b/docs/uart_driver.md
@@ -0,0 +1,90 @@
1# UART Driver
2
3The UART drivers used in QMK have a set of common functions to allow portability between MCUs.
4
5Currently, this driver does not support enabling hardware flow control (the `RTS` and `CTS` pins) if available, but may do so in future.
6
7## AVR Configuration
8
9No special setup is required - just connect the `RX` and `TX` pins of your UART device to the opposite pins on the MCU:
10
11|MCU |`TX`|`RX`|`CTS`|`RTS`|
12|-------------|----|----|-----|-----|
13|ATmega16/32U2|`D3`|`D2`|`D7` |`D6` |
14|ATmega16/32U4|`D3`|`D2`|`D5` |`B7` |
15|AT90USB64/128|`D3`|`D2`|*n/a*|*n/a*|
16|ATmega32A |`D1`|`D0`|*n/a*|*n/a*|
17|ATmega328/P |`D1`|`D0`|*n/a*|*n/a*|
18
19## ChibiOS/ARM Configuration
20
21You'll need to determine which pins can be used for UART -- as an example, STM32 parts generally have multiple UART peripherals, labeled USART1, USART2, USART3 etc.
22
23To enable UART, modify your board's `halconf.h` to enable the serial driver:
24
25```c
26#define HAL_USE_SERIAL TRUE
27```
28
29Then, modify your board's `mcuconf.h` to enable the peripheral you've chosen, for example:
30
31```c
32#undef STM32_SERIAL_USE_USART2
33#define STM32_SERIAL_USE_USART2 TRUE
34```
35
36Configuration-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.
37
38|`config.h` override |Description |Default Value|
39|--------------------------|---------------------------------------------------------------|-------------|
40|`#define SERIAL_DRIVER` |USART peripheral to use - USART1 -> `SD1`, USART2 -> `SD2` etc.|`SD1` |
41|`#define SD1_TX_PIN` |The pin to use for TX |`A9` |
42|`#define SD1_TX_PAL_MODE` |The alternate function mode for TX |`7` |
43|`#define SD1_RX_PIN` |The pin to use for RX |`A10` |
44|`#define SD1_RX_PAL_MODE` |The alternate function mode for RX |`7` |
45|`#define SD1_CTS_PIN` |The pin to use for CTS |`A11` |
46|`#define SD1_CTS_PAL_MODE`|The alternate function mode for CTS |`7` |
47|`#define SD1_RTS_PIN` |The pin to use for RTS |`A12` |
48|`#define SD1_RTS_PAL_MODE`|The alternate function mode for RTS |`7` |
49
50## Functions
51
52### `void uart_init(uint32_t baud)`
53
54Initialize the UART driver. This function must be called only once, before any of the below functions can be called.
55
56#### Arguments
57
58 - `uint32_t baud`
59 The baud rate to transmit and receive at. This may depend on the device you are communicating with. Common values are 1200, 2400, 4800, 9600, 19200, 38400, 57600, and 115200.
60
61---
62
63### `void uart_putchar(uint8_t c)`
64
65Transmit a single byte.
66
67#### Arguments
68
69 - `uint8_t c`
70 The byte (character) to send, from 0 to 255.
71
72---
73
74### `uint8_t uart_getchar(void)`
75
76Receive a single byte.
77
78#### Return Value
79
80The byte read from the receive buffer.
81
82---
83
84### `bool uart_available(void)`
85
86Return whether the receive buffer contains data. Call this function to determine if `uart_getchar()` will return meaningful data.
87
88#### Return Value
89
90`true` if the receive buffer length is non-zero.