diff options
author | QMK Bot <hello@qmk.fm> | 2021-01-20 02:49:41 +0000 |
---|---|---|
committer | QMK Bot <hello@qmk.fm> | 2021-01-20 02:49:41 +0000 |
commit | cfde37eec131ab3f5d69037d5d1dc6d2f76e6c95 (patch) | |
tree | 8bac6ec7381bd31ed05b62e506b91db78a36e357 /docs | |
parent | 6328c25573d44883a3c76b48e0a9c8acd3e5510f (diff) | |
parent | c0728bd189d0d9e5056f493e763191d8ca3c61f6 (diff) |
Merge remote-tracking branch 'origin/master' into develop
Diffstat (limited to 'docs')
-rw-r--r-- | docs/feature_rgblight.md | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/docs/feature_rgblight.md b/docs/feature_rgblight.md index 24a13a1129..c49c308d1e 100644 --- a/docs/feature_rgblight.md +++ b/docs/feature_rgblight.md @@ -205,7 +205,7 @@ it easy to use your underglow LEDs as status indicators to show which keyboard l By default, 8 layers are possible. This can be expanded to as many as 32 by overriding the definition of `RGBLIGHT_MAX_LAYERS` in `config.h` (e.g. `#define RGBLIGHT_MAX_LAYERS 32`). Please note, if you use a split keyboard, you will need to flash both sides of the split after changing this. Also, increasing the maximum will increase the firmware size, and will slow sync on split keyboards. -To define a layer, we modify `keymap.c` to list out LED ranges and the colors we want to overlay on them using an array of `rgblight_segment_t` using the `RGBLIGHT_LAYER_SEGMENTS` macro. We can define multiple layers and enable/disable them independently: +To define a layer, we modify `keymap.c` to list the LED ranges and the colors we want to overlay on them using an array of `rgblight_segment_t` using the `RGBLIGHT_LAYER_SEGMENTS` macro. We can define multiple layers and enable/disable them independently: ```c // Light LEDs 6 to 9 and 12 to 15 red when caps lock is active. Hard to ignore! @@ -221,6 +221,10 @@ const rgblight_segment_t PROGMEM my_layer1_layer[] = RGBLIGHT_LAYER_SEGMENTS( const rgblight_segment_t PROGMEM my_layer2_layer[] = RGBLIGHT_LAYER_SEGMENTS( {11, 2, HSV_PURPLE} ); +// Light LEDs 13 & 14 in green when keyboard layer 3 is active +const rgblight_segment_t PROGMEM my_layer3_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {13, 2, HSV_GREEN} +); // etc.. ``` @@ -231,7 +235,8 @@ We combine these layers into an array using the `RGBLIGHT_LAYERS_LIST` macro, an const rgblight_segment_t* const PROGMEM my_rgb_layers[] = RGBLIGHT_LAYERS_LIST( my_capslock_layer, my_layer1_layer, // Overrides caps lock layer - my_layer2_layer // Overrides other layers + my_layer2_layer, // Overrides other layers + my_layer3_layer // Overrides other layers ); void keyboard_post_init_user(void) { @@ -247,17 +252,21 @@ Everything above just configured the definition of each lighting layer. We can now enable and disable the lighting layers whenever the state of the keyboard changes: ```c -layer_state_t layer_state_set_user(layer_state_t state) { - // Both layers will light up if both kb layers are active - rgblight_set_layer_state(1, layer_state_cmp(state, 1)); - rgblight_set_layer_state(2, layer_state_cmp(state, 2)); - return state; -} - bool led_update_user(led_t led_state) { rgblight_set_layer_state(0, led_state.caps_lock); return true; } + +layer_state_t default_layer_state_set_user(layer_state_t state) { + rgblight_set_layer_state(1, layer_state_cmp(state, _DVORAK)); + return state; +} + +layer_state_t layer_state_set_user(layer_state_t state) { + rgblight_set_layer_state(2, layer_state_cmp(state, _FN)); + rgblight_set_layer_state(3, layer_state_cmp(state, _ADJUST)); + return state; +} ``` ### Lighting layer blink :id=lighting-layer-blink |