mirror of
https://github.com/qmk/qmk_firmware.git
synced 2026-09-07 10:53:17 +02:00
Merge remote-tracking branch 'origin/develop' into xap
This commit is contained in:
+221
-4
@@ -27,16 +27,64 @@ RGB Matrix is an abstraction layer on top of an underlying LED driver API. The l
|
||||
|[SNLED27351](../drivers/snled27351) |64 |
|
||||
|[WS2812](../drivers/ws2812) |? |
|
||||
|
||||
To assign the RGB Matrix driver, add the following to your `rules.mk`, for example:
|
||||
To assign the RGB Matrix driver, add the following to your keyboard config, for example:
|
||||
|
||||
:::::tabs
|
||||
|
||||
==== `JSON`
|
||||
|
||||
```json
|
||||
"rgb_matrix": {
|
||||
"driver": "is31fl3218"
|
||||
}
|
||||
```
|
||||
|
||||
==== `rules.mk`
|
||||
|
||||
```make
|
||||
RGB_MATRIX_DRIVER = is31fl3218
|
||||
```
|
||||
|
||||
:::::
|
||||
|
||||
## Common Configuration {#common-configuration}
|
||||
|
||||
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:
|
||||
|
||||
:::::tabs
|
||||
|
||||
==== `JSON`
|
||||
|
||||
```json
|
||||
"rgb_matrix": {
|
||||
"layout": [
|
||||
{"matrix": [0, 3], "x": 188, "y": 16, "flags": 1},
|
||||
{"matrix": [1, 3], "x": 187, "y": 48, "flags": 4},
|
||||
{"matrix": [2, 3], "x": 147, "y": 64, "flags": 4},
|
||||
{"matrix": [2, 0], "x": 112, "y": 64, "flags": 4},
|
||||
{"matrix": [1, 0], "x": 37, "y": 48, "flags": 4},
|
||||
{"matrix": [0, 0], "x": 38, "y": 16, "flags": 1}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
The first part, `matrix`, tells the system what key this LED represents using the key's electrical matrix row & col. This part is optional, if the LED doesn't correspond to a switch (such as underglow leds).
|
||||
|
||||
The second and third parts represents the LED's physical `x, y` position on the keyboard. The default expected range of values for `x` is `0-224`, and the default expected range of values for `y` is `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 `rgb_matrix.center_point = [ 112, 32 ]` in their json 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.
|
||||
|
||||
The last value `flags` 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.
|
||||
|
||||
==== `<keyboard>.c`
|
||||
|
||||
```c
|
||||
led_config_t g_led_config = { {
|
||||
// Key Matrix to LED Index
|
||||
@@ -62,10 +110,12 @@ 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 RGB_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.
|
||||
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 `rgb_matrix.center_point = [ 112, 32]` in their json (or `#define RGB_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 {#flags}
|
||||
|
||||
|Define |Value |Description |
|
||||
@@ -160,8 +210,113 @@ enum rgb_matrix_effects {
|
||||
};
|
||||
```
|
||||
|
||||
You can enable a single effect by defining `ENABLE_[EFFECT_NAME]` in your `config.h`:
|
||||
:::::tabs
|
||||
|
||||
==== `JSON`
|
||||
|
||||
You can enable a single effect by setting it true in the `rgb_matrix.animations` section in your json:
|
||||
|
||||
```json
|
||||
"rgb_matrix": {
|
||||
"animations": {
|
||||
"alphas_mods": true,
|
||||
"gradient_up_down": true,
|
||||
"gradient_left_right": true,
|
||||
"breathing": true,
|
||||
"band_sat": true,
|
||||
"band_val": true,
|
||||
"band_pinwheel_sat": true,
|
||||
"band_pinwheel_val": true,
|
||||
"band_spiral_sat": true,
|
||||
"band_spiral_val": true,
|
||||
"cycle_all": true,
|
||||
"cycle_left_right": true,
|
||||
"cycle_up_down": true,
|
||||
"rainbow_moving_chevron": true,
|
||||
"cycle_out_in": true,
|
||||
"cycle_out_in_dual": true,
|
||||
"cycle_pinwheel": true,
|
||||
"cycle_spiral": true,
|
||||
"dual_beacon": true,
|
||||
"rainbow_beacon": true,
|
||||
"rainbow_pinwheels": true,
|
||||
"raindrops": true,
|
||||
"jellybean_raindrops": true,
|
||||
"hue_breathing": true,
|
||||
"hue_pendulum": true,
|
||||
"hue_wave": true,
|
||||
"pixel_rain": true,
|
||||
"pixel_flow": true,
|
||||
"pixel_fractal": true,
|
||||
"typing_heatmap": true,
|
||||
"digital_rain": true,
|
||||
"solid_reactive_simple": true,
|
||||
"solid_reactive": true,
|
||||
"solid_reactive_wide": true,
|
||||
"solid_reactive_multiwide": true,
|
||||
"solid_reactive_cross": true,
|
||||
"solid_reactive_multicross": true,
|
||||
"solid_reactive_nexus": true,
|
||||
"solid_reactive_multinexus": true,
|
||||
"splash": true,
|
||||
"multispash": true,
|
||||
"solid_splash": true,
|
||||
"solid_multisplash": true,
|
||||
"starlight": true,
|
||||
"starlight_smooth": true,
|
||||
"starlight_dual_hue": true,
|
||||
"starlight_dual_sat": true,
|
||||
"riverflow": true
|
||||
|
||||
}
|
||||
},
|
||||
```
|
||||
|
||||
**Framebuffer effects**
|
||||
|
||||
```json
|
||||
"rgb_matrix": {
|
||||
"animations": {
|
||||
"typing_heatmap": true,
|
||||
"digital_rain": true,
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
::: tip
|
||||
These modes introduce additional logic that can increase firmware size.
|
||||
:::
|
||||
|
||||
**Reactive effects**
|
||||
|
||||
```json
|
||||
"rgb_matrix": {
|
||||
"animations": {
|
||||
"solid_reactive_simple": true,
|
||||
"solid_reactive": true,
|
||||
"solid_reactive_wide": true,
|
||||
"solid_reactive_multiwide": true,
|
||||
"solid_reactive_cross": true,
|
||||
"solid_reactive_multicross": true,
|
||||
"solid_reactive_nexus": true,
|
||||
"solid_reactive_multinexus": true,
|
||||
"splash": true,
|
||||
"multisplash": true,
|
||||
"solid_splash": true,
|
||||
"solid_multisplash": true
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
::: tip
|
||||
These modes introduce additional logic that can increase firmware size.
|
||||
:::
|
||||
|
||||
|
||||
==== `config.h`
|
||||
|
||||
You can enable a single effect by defining `ENABLE_[EFFECT_NAME]` in your `config.h`:
|
||||
|
||||
|Define |Description |
|
||||
|------------------------------------------------------|----------------------------------------------|
|
||||
@@ -229,6 +384,7 @@ These modes introduce additional logic that can increase firmware size.
|
||||
These modes introduce additional logic that can increase firmware size.
|
||||
:::
|
||||
|
||||
:::::
|
||||
|
||||
### RGB Matrix Effect Typing Heatmap {#rgb-matrix-effect-typing-heatmap}
|
||||
|
||||
@@ -387,10 +543,69 @@ const char* effect_name = rgb_matrix_get_mode_name(rgb_matrix_get_mode());
|
||||
:::
|
||||
|
||||
|
||||
## Additional `config.h` Options {#additional-configh-options}
|
||||
## Additional Configuration Options {#additional-configh-options}
|
||||
|
||||
```c
|
||||
#define RGB_MATRIX_MODE_NAME_ENABLE // enables rgb_matrix_get_mode_name()
|
||||
```
|
||||
|
||||
:::::tabs
|
||||
|
||||
==== `JSON`
|
||||
|
||||
```json
|
||||
"rgb_matrix": {
|
||||
"default": {
|
||||
// Sets the default enabled state, if none has been set
|
||||
"on": true,
|
||||
// Sets the default mode, if none has been set
|
||||
"animation": "cycle_left_right",
|
||||
// Sets the default hue value, if none has been set
|
||||
"hue": 0,
|
||||
// Sets the default saturation value, if none has been set
|
||||
"sat": 255,
|
||||
// Sets the default brightness value, if none has been set
|
||||
"val": 127,
|
||||
// Sets the default speed, if none has been set
|
||||
"speed": 127,
|
||||
// Sets the default flag, if none has been set
|
||||
"flags": 255
|
||||
},
|
||||
// Sets the flags which can be cycled through
|
||||
"flag_steps": [
|
||||
// LED_FLAG_ALL, LED_FLAG_KEYLIGHT | LED_FLAG_MODIFIER, LED_FLAG_UNDERGLOW, LED_FLAG_NONE
|
||||
255, 5, 2, 0
|
||||
],
|
||||
// limits max brightness of leds
|
||||
"max_brightness": 255,
|
||||
// number of milliseconds to wait until rgb automatically turns off
|
||||
"timeout": 0,
|
||||
// The value by which to increment the hue per adjustment action
|
||||
"hue_steps": 8,
|
||||
// The value by which to increment the saturation per adjustment action
|
||||
"sat_steps": 16,
|
||||
// The value by which to increment the brightness per adjustment action
|
||||
"val_steps": 16,
|
||||
// The value by which to increment the animation speed per adjustment action
|
||||
"speed_steps": 16,
|
||||
// limits in milliseconds how frequently an animation will update the LEDs.
|
||||
// 16 (16ms) is equivalent to limiting to 60fps (increases keyboard responsiveness)
|
||||
"led_flush_limit": 16,
|
||||
// limits the number of LEDs to process in an animation per task run (increases keyboard responsiveness)
|
||||
"led_process_limit": 15,
|
||||
// reactive effects respond to keyreleases (instead of keypresses)
|
||||
"react_on_keyup": true,
|
||||
// turn off effects when suspended
|
||||
"sleep": true,
|
||||
// (Optional) For split keyboards, the number of LEDs connected on each half. X = left, Y = Right.
|
||||
// If reactive effects are enabled, you also will want to enable split.transport.sync.matrix_state
|
||||
"split_count": [X, Y],
|
||||
}
|
||||
```
|
||||
|
||||
==== `config.h`
|
||||
|
||||
```c
|
||||
#define RGB_MATRIX_KEYRELEASES // reactive effects respond to keyreleases (instead of keypresses)
|
||||
#define RGB_MATRIX_TIMEOUT 0 // number of milliseconds to wait until rgb automatically turns off
|
||||
#define RGB_MATRIX_SLEEP // turn off effects when suspended
|
||||
@@ -414,6 +629,8 @@ const char* effect_name = rgb_matrix_get_mode_name(rgb_matrix_get_mode());
|
||||
#define RGB_MATRIX_FLAG_STEPS { LED_FLAG_ALL, LED_FLAG_KEYLIGHT | LED_FLAG_MODIFIER, LED_FLAG_UNDERGLOW, LED_FLAG_NONE } // Sets the flags which can be cycled through.
|
||||
```
|
||||
|
||||
:::::
|
||||
|
||||
## EEPROM storage {#eeprom-storage}
|
||||
|
||||
The EEPROM for it is currently shared with the LED Matrix system (it's generally assumed only one feature would be used at a time).
|
||||
|
||||
Reference in New Issue
Block a user