summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstanrc85 <47038504+stanrc85@users.noreply.github.com>2020-04-08 18:56:55 -0400
committerGitHub <noreply@github.com>2020-04-08 23:56:55 +0100
commitff213d5fe1a74f345dd2263c6fb4bc9280f74e0f (patch)
tree88f01d9acb43525274894e4c6b3874b26f67733c
parent3234118e52deba9e87ef20389f22485f24f76a71 (diff)
[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.h1
-rw-r--r--users/stanrc85/rgblight_layers.c47
-rw-r--r--users/stanrc85/rules.mk8
3 files changed, 51 insertions, 5 deletions
diff --git a/users/stanrc85/config.h b/users/stanrc85/config.h
index 42306727ce..fba488e1c3 100644
--- a/users/stanrc85/config.h
+++ b/users/stanrc85/config.h
@@ -4,6 +4,7 @@
#define RETRO_TAPPING
#ifdef RGBLIGHT_ENABLE
+ #define RGBLIGHT_LAYERS
#define RGBLIGHT_LIMIT_VAL 175
#define RGBLIGHT_SLEEP
#endif
diff --git a/users/stanrc85/rgblight_layers.c b/users/stanrc85/rgblight_layers.c
new file mode 100644
index 0000000000..0363e358b0
--- /dev/null
+++ b/users/stanrc85/rgblight_layers.c
@@ -0,0 +1,47 @@
+#include "stanrc85.h"
+
+const rgblight_segment_t PROGMEM my_capslock_layer[] = RGBLIGHT_LAYER_SEGMENTS(
+ {3, 2, HSV_RED},
+ {10, 2, HSV_RED}
+);
+
+const rgblight_segment_t PROGMEM my_layer1_layer[] = RGBLIGHT_LAYER_SEGMENTS(
+ {3, 1, HSV_GREEN},
+ {11, 1, HSV_GREEN}
+);
+
+const rgblight_segment_t PROGMEM my_layer2_layer[] = RGBLIGHT_LAYER_SEGMENTS(
+ {3, 1, HSV_BLUE},
+ {11, 1, HSV_BLUE}
+);
+
+const rgblight_segment_t PROGMEM my_layer3_layer[] = RGBLIGHT_LAYER_SEGMENTS(
+ {3, 1, HSV_WHITE},
+ {11, 1, HSV_WHITE}
+);
+
+// Now define the array of layers. Later layers take precedence
+const rgblight_segment_t* const PROGMEM my_rgb_layers[] = RGBLIGHT_LAYERS_LIST(
+ my_capslock_layer,
+ my_layer1_layer,
+ my_layer2_layer,
+ my_layer3_layer
+);
+
+void keyboard_post_init_user(void) {
+ // Enable the LED layers
+ rgblight_layers = my_rgb_layers;
+}
+
+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));
+ rgblight_set_layer_state(3, layer_state_cmp(state, 3));
+ return state;
+}
+
+bool led_update_user(led_t led_state) {
+ rgblight_set_layer_state(0, led_state.caps_lock);
+ return true;
+} \ No newline at end of file
diff --git a/users/stanrc85/rules.mk b/users/stanrc85/rules.mk
index 16391b555a..67e1b8854a 100644
--- a/users/stanrc85/rules.mk
+++ b/users/stanrc85/rules.mk
@@ -10,20 +10,18 @@ NKRO_ENABLE = no
SRC += stanrc85.c
-ifeq ($(strip $(RGBLIGHT_ENABLE)), yes)
- # Include my fancy rgb functions source here
- SRC += layer_rgb.c
-endif
-
ifeq ($(strip $(KEYBOARD)), 1upkeyboards/1up60hse)
+ SRC += layer_rgb.c
VIA_ENABLE = yes
LTO_ENABLE = yes
endif
ifeq ($(strip $(KEYBOARD)), dz60)
+ SRC += layer_rgb.c
VIA_ENABLE = yes
LTO_ENABLE = yes
endif
ifeq ($(strip $(KEYBOARD)), projectkb/alice)
+ SRC += rgblight_layers.c
VIA_ENABLE = yes
LTO_ENABLE = no
endif \ No newline at end of file