Merge remote-tracking branch 'origin/master' into develop
This commit is contained in:
commit
cfde37eec1
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user