diff options
Diffstat (limited to 'users/stanrc85/rgblight_layers.c')
| -rw-r--r-- | users/stanrc85/rgblight_layers.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/users/stanrc85/rgblight_layers.c b/users/stanrc85/rgblight_layers.c new file mode 100644 index 000000000..0363e358b --- /dev/null +++ b/users/stanrc85/rgblight_layers.c | |||
| @@ -0,0 +1,47 @@ | |||
| 1 | #include "stanrc85.h" | ||
| 2 | |||
| 3 | const rgblight_segment_t PROGMEM my_capslock_layer[] = RGBLIGHT_LAYER_SEGMENTS( | ||
| 4 | {3, 2, HSV_RED}, | ||
| 5 | {10, 2, HSV_RED} | ||
| 6 | ); | ||
| 7 | |||
| 8 | const rgblight_segment_t PROGMEM my_layer1_layer[] = RGBLIGHT_LAYER_SEGMENTS( | ||
| 9 | {3, 1, HSV_GREEN}, | ||
| 10 | {11, 1, HSV_GREEN} | ||
| 11 | ); | ||
| 12 | |||
| 13 | const rgblight_segment_t PROGMEM my_layer2_layer[] = RGBLIGHT_LAYER_SEGMENTS( | ||
| 14 | {3, 1, HSV_BLUE}, | ||
| 15 | {11, 1, HSV_BLUE} | ||
| 16 | ); | ||
| 17 | |||
| 18 | const rgblight_segment_t PROGMEM my_layer3_layer[] = RGBLIGHT_LAYER_SEGMENTS( | ||
| 19 | {3, 1, HSV_WHITE}, | ||
| 20 | {11, 1, HSV_WHITE} | ||
| 21 | ); | ||
| 22 | |||
| 23 | // Now define the array of layers. Later layers take precedence | ||
| 24 | const rgblight_segment_t* const PROGMEM my_rgb_layers[] = RGBLIGHT_LAYERS_LIST( | ||
| 25 | my_capslock_layer, | ||
| 26 | my_layer1_layer, | ||
| 27 | my_layer2_layer, | ||
| 28 | my_layer3_layer | ||
| 29 | ); | ||
| 30 | |||
| 31 | void keyboard_post_init_user(void) { | ||
| 32 | // Enable the LED layers | ||
| 33 | rgblight_layers = my_rgb_layers; | ||
| 34 | } | ||
| 35 | |||
| 36 | layer_state_t layer_state_set_user(layer_state_t state) { | ||
| 37 | // Both layers will light up if both kb layers are active | ||
| 38 | rgblight_set_layer_state(1, layer_state_cmp(state, 1)); | ||
| 39 | rgblight_set_layer_state(2, layer_state_cmp(state, 2)); | ||
| 40 | rgblight_set_layer_state(3, layer_state_cmp(state, 3)); | ||
| 41 | return state; | ||
| 42 | } | ||
| 43 | |||
| 44 | bool led_update_user(led_t led_state) { | ||
| 45 | rgblight_set_layer_state(0, led_state.caps_lock); | ||
| 46 | return true; | ||
| 47 | } \ No newline at end of file | ||
