diff options
Diffstat (limited to 'docs')
-rw-r--r-- | docs/ChangeLog/20210529/PR12172.md | 13 | ||||
-rw-r--r-- | docs/adc_driver.md | 154 | ||||
-rw-r--r-- | docs/cli_commands.md | 48 | ||||
-rw-r--r-- | docs/compatible_microcontrollers.md | 3 | ||||
-rw-r--r-- | docs/feature_auto_shift.md | 27 | ||||
-rw-r--r-- | docs/feature_backlight.md | 20 | ||||
-rw-r--r-- | docs/feature_encoders.md | 9 | ||||
-rw-r--r-- | docs/feature_leader_key.md | 13 | ||||
-rw-r--r-- | docs/feature_led_matrix.md | 337 | ||||
-rw-r--r-- | docs/feature_oled_driver.md | 2 | ||||
-rw-r--r-- | docs/feature_rgb_matrix.md | 105 | ||||
-rw-r--r-- | docs/feature_rgblight.md | 13 | ||||
-rw-r--r-- | docs/feature_swap_hands.md | 2 | ||||
-rw-r--r-- | docs/feature_unicode.md | 2 | ||||
-rw-r--r-- | docs/feature_wpm.md | 67 | ||||
-rw-r--r-- | docs/flashing.md | 26 | ||||
-rw-r--r-- | docs/ja/compatible_microcontrollers.md | 3 | ||||
-rw-r--r-- | docs/ja/feature_led_matrix.md | 2 | ||||
-rw-r--r-- | docs/ja/feature_swap_hands.md | 2 | ||||
-rw-r--r-- | docs/keycodes.md | 3 | ||||
-rw-r--r-- | docs/one_shot_keys.md | 3 | ||||
-rw-r--r-- | docs/serial_driver.md | 154 | ||||
-rw-r--r-- | docs/ws2812_driver.md | 22 |
23 files changed, 875 insertions, 155 deletions
diff --git a/docs/ChangeLog/20210529/PR12172.md b/docs/ChangeLog/20210529/PR12172.md new file mode 100644 index 0000000000..0c355c151e --- /dev/null +++ b/docs/ChangeLog/20210529/PR12172.md @@ -0,0 +1,13 @@ +## Bootmagic Deprecation and Refactor ([#12172](https://github.com/qmk/qmk_firmware/pull/12172)) + +QMK has decided to deprecate the full Bootmagic feature and leave Bootmagic Lite as the only remaining option. + +This pull request changes the behavior of `BOOTMAGIC_ENABLE` such that specifying `BOOTMAGIC_ENABLE = yes` enables Bootmagic Lite instead of full Bootmagic. + +### Tentative Deprecation Schedule + +This is the current planned roadmap for the behavior of `BOOTMAGIC_ENABLE`: + +- From 2021-05-29, setting `BOOTMAGIC_ENABLE = yes` will enable Bootmagic Lite instead of full Bootmagic. +- From 2021-08-28, `BOOTMAGIC_ENABLE` must be either `yes`, `lite`, or `no` – setting `BOOTMAGIC_ENABLE = full` will cause compilation to fail. +- From 2021-11-27, `BOOTMAGIC_ENABLE` must be either `yes` or `no` – setting `BOOTMAGIC_ENABLE = lite` will cause compilation to fail. diff --git a/docs/adc_driver.md b/docs/adc_driver.md index 6e3d513863..69fff4b3c2 100644 --- a/docs/adc_driver.md +++ b/docs/adc_driver.md @@ -47,73 +47,79 @@ Note that some of these pins are doubled-up on ADCs with the same channel. This Also note that the F0 and F3 use different numbering schemes. The F0 has a single ADC and the channels are 0-indexed, whereas the F3 has 4 ADCs and the channels are 1-indexed. This is because the F0 uses the `ADCv1` implementation of the ADC, whereas the F3 uses the `ADCv3` implementation. -|ADC|Channel|STM32F0xx|STM32F3xx| -|---|-------|---------|---------| -|1 |0 |`A0` | | -|1 |1 |`A1` |`A0` | -|1 |2 |`A2` |`A1` | -|1 |3 |`A3` |`A2` | -|1 |4 |`A4` |`A3` | -|1 |5 |`A5` |`F4` | -|1 |6 |`A6` |`C0` | -|1 |7 |`A7` |`C1` | -|1 |8 |`B0` |`C2` | -|1 |9 |`B1` |`C3` | -|1 |10 |`C0` |`F2` | -|1 |11 |`C1` | | -|1 |12 |`C2` | | -|1 |13 |`C3` | | -|1 |14 |`C4` | | -|1 |15 |`C5` | | -|1 |16 | | | -|2 |1 | |`A4` | -|2 |2 | |`A5` | -|2 |3 | |`A6` | -|2 |4 | |`A7` | -|2 |5 | |`C4` | -|2 |6 | |`C0` | -|2 |7 | |`C1` | -|2 |8 | |`C2` | -|2 |9 | |`C3` | -|2 |10 | |`F2` | -|2 |11 | |`C5` | -|2 |12 | |`B2` | -|2 |13 | | | -|2 |14 | | | -|2 |15 | | | -|2 |16 | | | -|3 |1 | |`B1` | -|3 |2 | |`E9` | -|3 |3 | |`E13` | -|3 |4 | | | -|3 |5 | | | -|3 |6 | |`E8` | -|3 |7 | |`D10` | -|3 |8 | |`D11` | -|3 |9 | |`D12` | -|3 |10 | |`D13` | -|3 |11 | |`D14` | -|3 |12 | |`B0` | -|3 |13 | |`E7` | -|3 |14 | |`E10` | -|3 |15 | |`E11` | -|3 |16 | |`E12` | -|4 |1 | |`E14` | -|4 |2 | |`B12` | -|4 |3 | |`B13` | -|4 |4 | |`B14` | -|4 |5 | |`B15` | -|4 |6 | |`E8` | -|4 |7 | |`D10` | -|4 |8 | |`D11` | -|4 |9 | |`D12` | -|4 |10 | |`D13` | -|4 |11 | |`D14` | -|4 |12 | |`D8` | -|4 |13 | |`D9` | -|4 |14 | | | -|4 |15 | | | -|4 |16 | | | +|ADC|Channel|STM32F0xx|STM32F1xx|STM32F3xx|STM32F4xx| +|---|-------|---------|---------|---------|---------| +|1 |0 |`A0` |`A0` | |`A0` | +|1 |1 |`A1` |`A1` |`A0` |`A1` | +|1 |2 |`A2` |`A2` |`A1` |`A2` | +|1 |3 |`A3` |`A3` |`A2` |`A3` | +|1 |4 |`A4` |`A4` |`A3` |`A4` | +|1 |5 |`A5` |`A5` |`F4` |`A5` | +|1 |6 |`A6` |`A6` |`C0` |`A6` | +|1 |7 |`A7` |`A7` |`C1` |`A7` | +|1 |8 |`B0` |`B0` |`C2` |`B0` | +|1 |9 |`B1` |`B1` |`C3` |`B1` | +|1 |10 |`C0` |`C0` |`F2` |`C0` | +|1 |11 |`C1` |`C1` | |`C1` | +|1 |12 |`C2` |`C2` | |`C2` | +|1 |13 |`C3` |`C3` | |`C3` | +|1 |14 |`C4` |`C4` | |`C4` | +|1 |15 |`C5` |`C5` | |`C5` | +|1 |16 | | | | | +|2 |0 | |`A0`¹ | |`A0`² | +|2 |1 | |`A1`¹ |`A4` |`A1`² | +|2 |2 | |`A2`¹ |`A5` |`A2`² | +|2 |3 | |`A3`¹ |`A6` |`A3`² | +|2 |4 | |`A4`¹ |`A7` |`A4`² | +|2 |5 | |`A5`¹ |`C4` |`A5`² | +|2 |6 | |`A6`¹ |`C0` |`A6`² | +|2 |7 | |`A7`¹ |`C1` |`A7`² | +|2 |8 | |`B0`¹ |`C2` |`B0`² | +|2 |9 | |`B1`¹ |`C3` |`B1`² | +|2 |10 | |`C0`¹ |`F2` |`C0`² | +|2 |11 | |`C1`¹ |`C5` |`C1`² | +|2 |12 | |`C2`¹ |`B2` |`C2`² | +|2 |13 | |`C3`¹ | |`C3`² | +|2 |14 | |`C4`¹ | |`C4`² | +|2 |15 | |`C5`¹ | |`C5`² | +|2 |16 | | | | | +|3 |0 | |`A0`¹ | |`A0`² | +|3 |1 | |`A1`¹ |`B1` |`A1`² | +|3 |2 | |`A2`¹ |`E9` |`A2`² | +|3 |3 | |`A3`¹ |`E13` |`A3`² | +|3 |4 | |`F6`¹ | |`F6`² | +|3 |5 | |`F7`¹ |`B13` |`F7`² | +|3 |6 | |`F8`¹ |`E8` |`F8`² | +|3 |7 | |`F9`¹ |`D10` |`F9`² | +|3 |8 | |`F10`¹ |`D11` |`F10`² | +|3 |9 | | |`D12` |`F3`² | +|3 |10 | |`C0`¹ |`D13` |`C0`² | +|3 |11 | |`C1`¹ |`D14` |`C1`² | +|3 |12 | |`C2`¹ |`B0` |`C2`² | +|3 |13 | |`C3`¹ |`E7` |`C3`² | +|3 |14 | | |`E10` |`F4`² | +|3 |15 | | |`E11` |`F5`² | +|3 |16 | | |`E12` | | +|4 |1 | | |`E14` | | +|4 |2 | | |`E15` | | +|4 |3 | | |`B12` | | +|4 |4 | | |`B14` | | +|4 |5 | | |`B15` | | +|4 |6 | | |`E8` | | +|4 |7 | | |`D10` | | +|4 |8 | | |`D11` | | +|4 |9 | | |`D12` | | +|4 |10 | | |`D13` | | +|4 |11 | | |`D14` | | +|4 |12 | | |`D8` | | +|4 |13 | | |`D9` | | +|4 |14 | | | | | +|4 |15 | | | | | +|4 |16 | | | | | + +<sup>¹ As of ChibiOS 20.3.4, the ADC driver for STM32F1xx devices supports only ADC1, therefore any configurations involving ADC2 or ADC3 cannot actually be used. In particular, pins `F6`…`F10`, which are present at least on some STM32F103x[C-G] devices, cannot be used as ADC inputs because of this driver limitation.</sup> + +<sup>² Not all STM32F4xx devices have ADC2 and/or ADC3, therefore some configurations shown in this table may be unavailable; in particular, pins `F4`…`F10` cannot be used as ADC inputs on devices which do not have ADC3. Check the device datasheet to confirm which pin functions are supported.</sup> ## Functions @@ -141,10 +147,10 @@ Also note that the F0 and F3 use different numbering schemes. The F0 has a singl The ARM implementation of the ADC has a few additional options that you can override in your own keyboards and keymaps to change how it operates. Please consult the corresponding `hal_adc_lld.h` in ChibiOS for your specific microcontroller for further documentation on your available options. -|`#define` |Type |Default |Description | -|---------------------|------|---------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -|`ADC_CIRCULAR_BUFFER`|`bool`|`false` |If `true`, then the implementation will use a circular buffer. | -|`ADC_NUM_CHANNELS` |`int` |`1` |Sets the number of channels that will be scanned as part of an ADC operation. The current implementation only supports `1`. | -|`ADC_BUFFER_DEPTH` |`int` |`2` |Sets the depth of each result. Since we are only getting a 12-bit result by default, we set this to 2 bytes so we can contain our one value. This could be set to 1 if you opt for an 8-bit or lower result.| -|`ADC_SAMPLING_RATE` |`int` |`ADC_SMPR_SMP_1P5` |Sets the sampling rate of the ADC. By default, it is set to the fastest setting. | -|`ADC_RESOLUTION` |`int` |`ADC_CFGR1_RES_12BIT`|The resolution of your result. We choose 12 bit by default, but you can opt for 12, 10, 8, or 6 bit. | +|`#define` |Type |Default |Description | +|---------------------|------|----------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +|`ADC_CIRCULAR_BUFFER`|`bool`|`false` |If `true`, then the implementation will use a circular buffer. | +|`ADC_NUM_CHANNELS` |`int` |`1` |Sets the number of channels that will be scanned as part of an ADC operation. The current implementation only supports `1`. | +|`ADC_BUFFER_DEPTH` |`int` |`2` |Sets the depth of each result. Since we are only getting a 10-bit result by default, we set this to 2 bytes so we can contain our one value. This could be set to 1 if you opt for an 8-bit or lower result.| +|`ADC_SAMPLING_RATE` |`int` |`ADC_SMPR_SMP_1P5` |Sets the sampling rate of the ADC. By default, it is set to the fastest setting. | +|`ADC_RESOLUTION` |`int` |`ADC_CFGR1_RES_10BIT` or `ADC_CFGR_RES_10BITS`|The resolution of your result. We choose 10 bit by default, but you can opt for 12, 10, 8, or 6 bit. Different MCUs use slightly different names for the resolution constants. | diff --git a/docs/cli_commands.md b/docs/cli_commands.md index 05e9306070..581342093a 100644 --- a/docs/cli_commands.md +++ b/docs/cli_commands.md @@ -107,6 +107,54 @@ This command lets you configure the behavior of QMK. For the full `qmk config` d qmk config [-ro] [config_token1] [config_token2] [...] [config_tokenN] ``` +## `qmk console` + +This command lets you connect to keyboard consoles to get debugging messages. It only works if your keyboard firmware has been compiled with `CONSOLE_ENABLED=yes`. + +**Usage**: + +``` +qmk console [-d <pid>:<vid>[:<index>]] [-l] [-n] [-t] [-w <seconds>] +``` + +**Examples**: + +Connect to all available keyboards and show their console messages: + +``` +qmk console +``` + +List all devices: + +``` +qmk console -l +``` + +Show only messages from clueboard/66/rev3 keyboards: + +``` +qmk console -d C1ED:2370 +``` + +Show only messages from the second clueboard/66/rev3: + +``` +qmk console -d C1ED:2370:2 +``` + +Show timestamps and VID:PID instead of names: + +``` +qmk console -n -t +``` + +Disable bootloader messages: + +``` +qmk console --no-bootloaders +``` + ## `qmk doctor` This command examines your environment and alerts you to potential build or flash problems. It can fix many of them if you want it to. diff --git a/docs/compatible_microcontrollers.md b/docs/compatible_microcontrollers.md index 47a4844e7f..0f5b140de0 100644 --- a/docs/compatible_microcontrollers.md +++ b/docs/compatible_microcontrollers.md @@ -28,8 +28,11 @@ You can also use any ARM chip with USB that [ChibiOS](https://www.chibios.org) s * [STM32F303](https://www.st.com/en/microcontrollers-microprocessors/stm32f303.html) * [STM32F401](https://www.st.com/en/microcontrollers-microprocessors/stm32f401.html) * [STM32F411](https://www.st.com/en/microcontrollers-microprocessors/stm32f411.html) + * [STM32F446](https://www.st.com/en/microcontrollers-microprocessors/stm32f446.html) * [STM32G431](https://www.st.com/en/microcontrollers-microprocessors/stm32g4x1.html) * [STM32G474](https://www.st.com/en/microcontrollers-microprocessors/stm32g4x4.html) + * [STM32L433](https://www.st.com/en/microcontrollers-microprocessors/stm32l4x3.html) + * [STM32L443](https://www.st.com/en/microcontrollers-microprocessors/stm32l4x3.html) ### NXP (Kinetis) diff --git a/docs/feature_auto_shift.md b/docs/feature_auto_shift.md index 8e04d9dd38..ec7eeaaa0c 100644 --- a/docs/feature_auto_shift.md +++ b/docs/feature_auto_shift.md @@ -109,6 +109,33 @@ Do not Auto Shift numeric keys, zero through nine. Do not Auto Shift alpha characters, which include A through Z. +### Auto Shift Per Key + +This is a function that allows you to determine which keys shold be autoshifted, much like the tap-hold keys. + +The default function looks like this: + +```c +bool get_auto_shifted_key(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { +# ifndef NO_AUTO_SHIFT_ALPHA + case KC_A ... KC_Z: +# endif +# ifndef NO_AUTO_SHIFT_NUMERIC + case KC_1 ... KC_0: +# endif +# ifndef NO_AUTO_SHIFT_SPECIAL + case KC_TAB: + case KC_MINUS ... KC_SLASH: + case KC_NONUS_BSLASH: +# endif + return true; + } + return false; +} +``` +This functionality is enabled by default, and does not need a define. + ### AUTO_SHIFT_REPEAT (simple define) Enables keyrepeat. diff --git a/docs/feature_backlight.md b/docs/feature_backlight.md index 74511dd43f..d47ecc6824 100644 --- a/docs/feature_backlight.md +++ b/docs/feature_backlight.md @@ -62,15 +62,17 @@ Valid driver values are `pwm`, `software`, `custom` or `no`. See below for help To configure the backlighting, `#define` these in your `config.h`: -| Define | Default | Description | -|------------------------|---------------|-------------------------------------------------------------------------------------------------------------------| -| `BACKLIGHT_PIN` | *Not defined* | The pin that controls the LED(s) | -| `BACKLIGHT_LEVELS` | `3` | The number of brightness levels (maximum 31 excluding off) | -| `BACKLIGHT_CAPS_LOCK` | *Not defined* | Enable Caps Lock indicator using backlight (for keyboards without dedicated LED) | -| `BACKLIGHT_BREATHING` | *Not defined* | Enable backlight breathing, if supported | -| `BREATHING_PERIOD` | `6` | The length of one backlight "breath" in seconds | -| `BACKLIGHT_ON_STATE` | `1` | The state of the backlight pin when the backlight is "on" - `1` for high, `0` for low | -| `BACKLIGHT_LIMIT_VAL ` | `255` | The maximum duty cycle of the backlight -- `255` allows for full brightness, any lower will decrease the maximum. | +|Define |Default |Description | +|-----------------------------|------------------|-----------------------------------------------------------------------------------------------------------------| +|`BACKLIGHT_PIN` |*Not defined* |The pin that controls the LED(s) | +|`BACKLIGHT_LEVELS` |`3` |The number of brightness levels (maximum 31 excluding off) | +|`BACKLIGHT_CAPS_LOCK` |*Not defined* |Enable Caps Lock indicator using backlight (for keyboards without dedicated LED) | +|`BACKLIGHT_BREATHING` |*Not defined* |Enable backlight breathing, if supported | +|`BREATHING_PERIOD` |`6` |The length of one backlight "breath" in seconds | +|`BACKLIGHT_ON_STATE` |`1` |The state of the backlight pin when the backlight is "on" - `1` for high, `0` for low | +|`BACKLIGHT_LIMIT_VAL` |`255` |The maximum duty cycle of the backlight -- `255` allows for full brightness, any lower will decrease the maximum.| +|`BACKLIGHT_DEFAULT_LEVEL` |`BACKLIGHT_LEVELS`|The default backlight level to use upon clearing the EEPROM | +|`BACKLIGHT_DEFAULT_BREATHING`|*Not defined* |Whether to enable backlight breathing upon clearing the EEPROM | Unless you are designing your own keyboard, you generally should not need to change the `BACKLIGHT_PIN` or `BACKLIGHT_ON_STATE`. diff --git a/docs/feature_encoders.md b/docs/feature_encoders.md index 4338c85e84..a56f093a39 100644 --- a/docs/feature_encoders.md +++ b/docs/feature_encoders.md @@ -53,15 +53,15 @@ If you are using different pinouts for the encoders on each half of a split keyb The callback functions can be inserted into your `<keyboard>.c`: ```c -void encoder_update_kb(uint8_t index, bool clockwise) { - encoder_update_user(index, clockwise); +bool encoder_update_kb(uint8_t index, bool clockwise) { + return encoder_update_user(index, clockwise); } ``` or `keymap.c`: ```c -void encoder_update_user(uint8_t index, bool clockwise) { +bool encoder_update_user(uint8_t index, bool clockwise) { if (index == 0) { /* First encoder */ if (clockwise) { tap_code(KC_PGDN); @@ -75,9 +75,12 @@ void encoder_update_user(uint8_t index, bool clockwise) { tap_code(KC_UP); } } + return true; } ``` +!> If you return `true`, this will allow the keyboard level code to run, as well. Returning `false` will override the keyboard level code. Depending on how the keyboard level function is set up. + ## Hardware The A an B lines of the encoders should be wired directly to the MCU, and the C/common lines should be wired to ground. diff --git a/docs/feature_leader_key.md b/docs/feature_leader_key.md index 41ff8f1a4e..f10bca7589 100644 --- a/docs/feature_leader_key.md +++ b/docs/feature_leader_key.md @@ -72,6 +72,19 @@ SEQ_THREE_KEYS(KC_C, KC_C, KC_C) { } ``` +## Infinite Leader key timeout + +Sometimes your leader key is not on a comfortable places as the rest of keys on your sequence. Imagine that your leader key is one of your outer top right keys, you may need to reposition your hand just to reach your leader key. +This can make typing the entire sequence on time hard even if you are able to type most of the sequence fast. For example, if your sequence is `Leader + asd` typing `asd` fast is very easy once you have your hands in your home row. However starting the sequence in time after moving your hand out of the home row to reach the leader key and back is not. +To remove the stress this situation produces to your hands you can enable an infinite timeout just for the leader key. This mean that, after you hit the leader key you will have an infinite amount of time to start the rest of the sequence, allowing you to proper position your hands on the best position to type the rest of the sequence comfortably. +This infinite timeout only affects the leader key, so in our previous example of `Leader + asd` you will have an infinite amount of time between `Leader` and `a`, but once you start the sequence the timeout you have configured (global or per key) will work normally. +This way you can configure a very short `LEADER_TIMEOUT` but still have plenty of time to position your hands. + +In order to enable this, place this in your `config.h`: +```c +#define LEADER_NO_TIMEOUT +``` + ## Strict Key Processing By default, the Leader Key feature will filter the keycode out of [`Mod-Tap`](mod_tap.md) and [`Layer Tap`](feature_layers.md#switching-and-toggling-layers) functions when checking for the Leader sequences. That means if you're using `LT(3, KC_A)`, it will pick this up as `KC_A` for the sequence, rather than `LT(3, KC_A)`, giving a more expected behavior for newer users. diff --git a/docs/feature_led_matrix.md b/docs/feature_led_matrix.md index f4a6616340..9c3e2c7f3d 100644 --- a/docs/feature_led_matrix.md +++ b/docs/feature_led_matrix.md @@ -1,14 +1,14 @@ -# LED Matrix Lighting +# LED Matrix Lighting :id=led-matrix-lighting This feature allows you to use LED matrices driven by external drivers. It hooks into the backlight system so you can use the same keycodes as backlighting to control it. If you want to use RGB LED's you should use the [RGB Matrix Subsystem](feature_rgb_matrix.md) instead. -## Driver configuration +## Driver configuration :id=driver-configuration +--- +### IS31FL3731 :id=is31fl3731 -### IS31FL3731 - -There is basic support for addressable LED matrix lighting with the I2C IS31FL3731 RGB controller. To enable it, add this to your `rules.mk`: +There is basic support for addressable LED matrix lighting with the I2C IS31FL3731 LED controller. To enable it, add this to your `rules.mk`: ```make LED_MATRIX_ENABLE = yes @@ -19,7 +19,7 @@ You can use between 1 and 4 IS31FL3731 IC's. Do not specify `LED_DRIVER_ADDR_<N> | Variable | Description | Default | |----------|-------------|---------| -| `ISSI_TIMEOUT` | (Optional) How long to wait for i2c messages | 100 | +| `ISSI_TIMEOUT` | (Optional) How long to wait for i2c messages, in milliseconds | 100 | | `ISSI_PERSISTENCE` | (Optional) Retry failed messages this many times | 0 | | `LED_DRIVER_COUNT` | (Required) How many LED driver IC's are present | | | `DRIVER_LED_TOTAL` | (Required) How many LED lights are present across all drivers | | @@ -42,59 +42,336 @@ Here is an example using 2 drivers. #define LED_DRIVER_ADDR_2 0b1110110 #define LED_DRIVER_COUNT 2 -#define LED_DRIVER_1_LED_COUNT 25 -#define LED_DRIVER_2_LED_COUNT 24 -#define DRIVER_LED_TOTAL LED_DRIVER_1_LED_TOTAL + LED_DRIVER_2_LED_TOTAL +#define LED_DRIVER_1_LED_TOTAL 25 +#define LED_DRIVER_2_LED_TOTAL 24 +#define DRIVER_LED_TOTAL (LED_DRIVER_1_LED_TOTAL + LED_DRIVER_2_LED_TOTAL) ``` -Currently only 2 drivers are supported, but it would be trivial to support all 4 combinations. +!> Note the parentheses, this is so when `LED_DRIVER_LED_TOTAL` is used in code and expanded, the values are added together before any additional math is applied to them. As an example, `rand() % (LED_DRIVER_1_LED_TOTAL + LED_DRIVER_2_LED_TOTAL)` will give very different results than `rand() % LED_DRIVER_1_LED_TOTAL + LED_DRIVER_2_LED_TOTAL`. Define these arrays listing all the LEDs in your `<keyboard>.c`: ```c - const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { - /* Refer to IS31 manual for these locations - * driver - * | LED address - * | | */ - { 0, C1_1 }, - { 0, C1_15 }, - // ... - } +const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { +/* Refer to IS31 manual for these locations + * driver + * | LED address + * | | */ + { 0, C1_1 }, + { 0, C1_15 }, + // ... +} ``` Where `Cx_y` is the location of the LED in the matrix defined by [the datasheet](https://www.issi.com/WW/pdf/31FL3731.pdf) and the header file `drivers/issi/is31fl3731-simple.h`. The `driver` is the index of the driver you defined in your `config.h` (`0`, `1`, `2`, or `3` ). -## Keycodes +--- + +From 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: + +```c +led_config_t g_led_config = { { + // Key Matrix to LED Index + { 5, NO_LED, NO_LED, 0 }, + { NO_LED, NO_LED, NO_LED, NO_LED }, + { 4, NO_LED, NO_LED, 1 }, + { 3, NO_LED, NO_LED, 2 } +}, { + // LED Index to Physical Position + { 188, 16 }, { 187, 48 }, { 149, 64 }, { 112, 64 }, { 37, 48 }, { 38, 16 } +}, { + // LED Index to Flag + 1, 4, 4, 4, 4, 1 +} }; +``` + +The first part, `// Key Matrix to LED Index`, tells the system what key this LED represents by using the key's electrical matrix row & col. The second part, `// LED Index to Physical Position` represents the LED's physical `{ x, y }` position on the keyboard. The default expected range of values for `{ x, y }` is the inclusive range `{ 0..224, 0..64 }`. This default expected range is due to effects that calculate the center of the keyboard for their animations. The easiest way to calculate these positions is imagine your keyboard is a grid, and the top left of the keyboard represents `{ x, y }` coordinate `{ 0, 0 }` and the bottom right of your keyboard represents `{ 224, 64 }`. Using this as a basis, you can use the following formula to calculate the physical position: + +```c +x = 224 / (NUMBER_OF_COLS - 1) * COL_POSITION +y = 64 / (NUMBER_OF_ROWS - 1) * ROW_POSITION +``` + +Where NUMBER_OF_COLS, NUMBER_OF_ROWS, COL_POSITION, & ROW_POSITION are all based on the physical layout of your keyboard, not the electrical layout. + +As mentioned earlier, the center of the keyboard by default is expected to be `{ 112, 32 }`, but this can be changed if you want to more accurately calculate the LED's physical `{ x, y }` positions. Keyboard designers can implement `#define LED_MATRIX_CENTER { 112, 32 }` in their config.h file with the new center point of the keyboard, or where they want it to be allowing more possibilities for the `{ x, y }` values. Do note that the maximum value for x or y is 255, and the recommended maximum is 224 as this gives animations runoff room before they reset. + +`// LED Index to Flag` is a bitmask, whether or not a certain LEDs is of a certain type. It is recommended that LEDs are set to only 1 type. + +## Flags :id=flags + +|Define |Value |Description | +|----------------------------|------|-------------------------------------------------| +|`HAS_FLAGS(bits, flags)` |*n/a* |Evaluates to `true` if `bits` has all `flags` set| +|`HAS_ANY_FLAGS(bits, flags)`|*n/a* |Evaluates to `true` if `bits` has any `flags` set| +|`LED_FLAG_NONE` |`0x00`|If this LED has no flags | +|`LED_FLAG_ALL` |`0xFF`|If this LED has all flags | +|`LED_FLAG_MODIFIER` |`0x01`|If the LED is on a modifier key | +|`LED_FLAG_KEYLIGHT` |`0x04`|If the LED is for key backlight | +|`LED_FLAG_INDICATOR` |`0x08`|If the LED is for keyboard state indication | + +## Keycodes :id=keycodes + +All LED matrix keycodes are currently shared with the [Backlight feature](feature_backlight.md). + +|Key |Description | +|---------|-----------------------------| +|`BL_TOGG`|Toggle LED Matrix on or off | +|`BL_STEP`|Cycle through modes | +|`BL_ON` |Turn on LED Matrix | +|`BL_OFF` |Turn off LED Matrix | +|`BL_INC` |Increase the brightness level| +|`BL_DEC` |Decrease the brightness level| + +## LED Matrix Effects :id=led-matrix-effects + +These are the effects that are currently available: + +```c +enum led_matrix_effects { + LED_MATRIX_NONE = 0, + LED_MATRIX_SOLID = 1, // Static single val, no speed support + LED_MATRIX_ALPHAS_MODS, // Static dual val, speed is val for LEDs marked as modifiers + LED_MATRIX_BREATHING, // Cycling brightness animation + LED_MATRIX_BAND, // Band fading brightness scrolling left to right + LED_MATRIX_BAND_PINWHEEL, // 3 blade spinning pinwheel fades brightness + LED_MATRIX_BAND_SPIRAL, // Spinning spiral fades brightness + LED_MATRIX_CYCLE_LEFT_RIGHT, // Full gradient scrolling left to right + LED_MATRIX_CYCLE_UP_DOWN, // Full gradient scrolling top to bottom + LED_MATRIX_CYCLE_OUT_IN, // Full gradient scrolling out to in + LED_MATRIX_DUAL_BEACON, // Full gradient spinning around center of keyboard +#if defined(LED_MATRIX_KEYPRESSES) || defined(LED_MATRIX_KEYRELEASES) + LED_MATRIX_SOLID_REACTIVE_SIMPLE, // Pulses keys hit then fades out + LED_MATRIX_SOLID_REACTIVE_WIDE // Value pulses near a single key hit then fades out + LED_MATRIX_SOLID_REACTIVE_MULTIWIDE // Value pulses near multiple key hits then fades out + LED_MATRIX_SOLID_REACTIVE_CROSS // Value pulses the same column and row of a single key hit then fades out + LED_MATRIX_SOLID_REACTIVE_MULTICROSS // Value pulses the same column and row of multiple key hits then fades out + LED_MATRIX_SOLID_REACTIVE_NEXUS // Value pulses away on the same column and row of a single key hit then fades out + LED_MATRIX_SOLID_REACTIVE_MULTINEXUS // Value pulses away on the same column and row of multiple key hits then fades out + LED_MATRIX_SOLID_SPLASH, // Value pulses away from a single key hit then fades out + LED_MATRIX_SOLID_MULTISPLASH, // Value pulses away from multiple key hits then fades out +#endif + LED_MATRIX_WAVE_LEFT_RIGHT // Sine wave scrolling from left to right + LED_MATRIX_WAVE_UP_DOWN // Sine wave scrolling from up to down + LED_MATRIX_EFFECT_MAX +}; +``` + +You can disable a single effect by defining `DISABLE_[EFFECT_NAME]` in your `config.h`: + + +|Define |Description | +|-------------------------------------------------------|-----------------------------------------------| +|`#define DISABLE_LED_MATRIX_ALPHAS_MODS` |Disables `LED_MATRIX_ALPHAS_MODS` | +|`#define DISABLE_LED_MATRIX_BREATHING` |Disables `LED_MATRIX_BREATHING` | +|`#define DISABLE_LED_MATRIX_BAND` |Disables `LED_MATRIX_BAND` | +|`#define DISABLE_LED_MATRIX_BAND_PINWHEEL` |Disables `LED_MATRIX_BAND_PINWHEEL` | +|`#define DISABLE_LED_MATRIX_BAND_SPIRAL` |Disables `LED_MATRIX_BAND_SPIRAL` | +|`#define DISABLE_LED_MATRIX_CYCLE_LEFT_RIGHT` |Disables `LED_MATRIX_CYCLE_LEFT_RIGHT` | +|`#define DISABLE_LED_MATRIX_CYCLE_UP_DOWN` |Disables `LED_MATRIX_CYCLE_UP_DOWN` | +|`#define DISABLE_LED_MATRIX_CYCLE_OUT_IN` |Disables `LED_MATRIX_CYCLE_OUT_IN` | +|`#define DISABLE_LED_MATRIX_DUAL_BEACON` |Disables `LED_MATRIX_DUAL_BEACON` | +|`#define DISABLE_LED_MATRIX_SOLID_REACTIVE_SIMPLE` |Disables `LED_MATRIX_SOLID_REACTIVE_SIMPLE` | +|`#define DISABLE_LED_MATRIX_SOLID_REACTIVE_WIDE` |Disables `LED_MATRIX_SOLID_REACTIVE_WIDE` | +|`#define DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTIWIDE` |Disables `LED_MATRIX_SOLID_REACTIVE_MULTIWIDE` | +|`#define DISABLE_LED_MATRIX_SOLID_REACTIVE_CROSS` |Disables `LED_MATRIX_SOLID_REACTIVE_CROSS` | +|`#define DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTICROSS` |Disables `LED_MATRIX_SOLID_REACTIVE_MULTICROSS`| +|`#define DISABLE_LED_MATRIX_SOLID_REACTIVE_NEXUS` |Disables `LED_MATRIX_SOLID_REACTIVE_NEXUS` | +|`#define DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTINEXUS` |Disables `LED_MATRIX_SOLID_REACTIVE_MULTINEXUS`| +|`#define DISABLE_LED_MATRIX_SOLID_SPLASH` |Disables `LED_MATRIX_SOLID_SPLASH` | +|`#define DISABLE_LED_MATRIX_SOLID_MULTISPLASH` |Disables `LED_MATRIX_SOLID_MULTISPLASH` | +|`#define DISABLE_LED_MATRIX_WAVE_LEFT_RIGHT` |Disables `LED_MATRIX_WAVE_LEFT_RIGHT` | +|`#define DISABLE_LED_MATRIX_WAVE_UP_DOWN` |Disables `LED_MATRIX_WAVE_UP_DOWN` | + +## Custom LED Matrix Effects :id=custom-led-matrix-effects + +By setting `LED_MATRIX_CUSTOM_USER` (and/or `LED_MATRIX_CUSTOM_KB`) in `rules.mk`, new effects can be defined directly from userspace, without having to edit any QMK core files. + +To declare new effects, create a new `led_matrix_user/kb.inc` that looks something like this: + +`led_matrix_user.inc` should go in the root of the keymap directory. +`led_matrix_kb.inc` should go in the root of the keyboard directory. + +To use custom effects in your code, simply prepend `LED_MATRIX_CUSTOM_` to the effect name specified in `LED_MATRIX_EFFECT()`. For example, an effect declared as `LED_MATRIX_EFFECT(my_cool_effect)` would be referenced with: + +```c +led_matrix_mode(led_MATRIX_CUSTOM_my_cool_effect); +``` + +```c +// !!! DO NOT AD |