diff options
author | stanrc85 <47038504+stanrc85@users.noreply.github.com> | 2020-04-08 18:56:55 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-08 23:56:55 +0100 |
commit | ff213d5fe1a74f345dd2263c6fb4bc9280f74e0f (patch) | |
tree | 88f01d9acb43525274894e4c6b3874b26f67733c | |
parent | 3234118e52deba9e87ef20389f22485f24f76a71 (diff) | |
download | qmk_firmware-ff213d5fe1a74f345dd2263c6fb4bc9280f74e0f.tar.gz qmk_firmware-ff213d5fe1a74f345dd2263c6fb4bc9280f74e0f.zip |
[Keymap] Userspace update Rgb layers code (#8659)
* enable rgblight layers
* rgblight layers code
* switch to new rgblight layers
* testing led positions
* fix caps typo
* lights and colors working
* rules updated for different rgb use
* Extra spaces removed
-rw-r--r-- | users/stanrc85/config.h | 1 | ||||
-rw-r--r-- | users/stanrc85/rgblight_layers.c | 47 | ||||
-rw-r--r-- | users/stanrc85/rules.mk | 8 |
3 files changed, 51 insertions, 5 deletions
diff --git a/users/stanrc85/config.h b/users/stanrc85/config.h index 42306727c..fba488e1c 100644 --- a/users/stanrc85/config.h +++ b/users/stanrc85/config.h | |||
@@ -4,6 +4,7 @@ | |||
4 | #define RETRO_TAPPING | 4 | #define RETRO_TAPPING |
5 | 5 | ||
6 | #ifdef RGBLIGHT_ENABLE | 6 | #ifdef RGBLIGHT_ENABLE |
7 | #define RGBLIGHT_LAYERS | ||
7 | #define RGBLIGHT_LIMIT_VAL 175 | 8 | #define RGBLIGHT_LIMIT_VAL 175 |
8 | #define RGBLIGHT_SLEEP | 9 | #define RGBLIGHT_SLEEP |
9 | #endif | 10 | #endif |
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 | ||
diff --git a/users/stanrc85/rules.mk b/users/stanrc85/rules.mk index 16391b555..67e1b8854 100644 --- a/users/stanrc85/rules.mk +++ b/users/stanrc85/rules.mk | |||
@@ -10,20 +10,18 @@ NKRO_ENABLE = no | |||
10 | 10 | ||
11 | SRC += stanrc85.c | 11 | SRC += stanrc85.c |
12 | 12 | ||
13 | ifeq ($(strip $(RGBLIGHT_ENABLE)), yes) | ||
14 | # Include my fancy rgb functions source here | ||
15 | SRC += layer_rgb.c | ||
16 | endif | ||
17 | |||
18 | ifeq ($(strip $(KEYBOARD)), 1upkeyboards/1up60hse) | 13 | ifeq ($(strip $(KEYBOARD)), 1upkeyboards/1up60hse) |
14 | SRC += layer_rgb.c | ||
19 | VIA_ENABLE = yes | 15 | VIA_ENABLE = yes |
20 | LTO_ENABLE = yes | 16 | LTO_ENABLE = yes |
21 | endif | 17 | endif |
22 | ifeq ($(strip $(KEYBOARD)), dz60) | 18 | ifeq ($(strip $(KEYBOARD)), dz60) |
19 | SRC += layer_rgb.c | ||
23 | VIA_ENABLE = yes | 20 | VIA_ENABLE = yes |
24 | LTO_ENABLE = yes | 21 | LTO_ENABLE = yes |
25 | endif | 22 | endif |
26 | ifeq ($(strip $(KEYBOARD)), projectkb/alice) | 23 | ifeq ($(strip $(KEYBOARD)), projectkb/alice) |
24 | SRC += rgblight_layers.c | ||
27 | VIA_ENABLE = yes | 25 | VIA_ENABLE = yes |
28 | LTO_ENABLE = no | 26 | LTO_ENABLE = no |
29 | endif \ No newline at end of file | 27 | endif \ No newline at end of file |