summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config.h3
-rw-r--r--keymap.c60
2 files changed, 63 insertions, 0 deletions
diff --git a/config.h b/config.h
index 511da62..63dd09d 100644
--- a/config.h
+++ b/config.h
@@ -52,3 +52,6 @@
#define RGBLIGHT_EFFECT_SNAKE
#define RGBLIGHT_EFFECT_STATIC_GRADIENT
#define RGBLIGHT_EFFECT_TWINKLE
+
+// we want to have different backlight per layers
+#define RGBLIGHT_LAYERS
diff --git a/keymap.c b/keymap.c
index c92868f..7f1faaf 100644
--- a/keymap.c
+++ b/keymap.c
@@ -16,6 +16,7 @@
#include QMK_KEYBOARD_H
+// our layers, used as index in layers and rgb lights
enum planck_layers {
_QWERTY,
_LOWER,
@@ -139,3 +140,62 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
)
};
+
+
+/* plwnck rev6 RGB layout:
+ * ----------------------------------
+ * | 6 5 4 3 |
+ * | 0 |
+ * | 7 8 1 2 |
+ * ----------------------------------
+ */
+
+const rgblight_segment_t PROGMEM game_layer[] = RGBLIGHT_LAYER_SEGMENTS(
+ {2, 2, HSV_RED},
+ {6, 2, HSV_RED}
+);
+
+const rgblight_segment_t PROGMEM raise_layer[] = RGBLIGHT_LAYER_SEGMENTS(
+ {3, 4, HSV_GREEN}
+);
+
+const rgblight_segment_t PROGMEM lower_layer[] = RGBLIGHT_LAYER_SEGMENTS(
+ {3, 4, HSV_BLUE}
+);
+
+const rgblight_segment_t PROGMEM adjust_layer[] = RGBLIGHT_LAYER_SEGMENTS(
+ {1, 8, HSV_BLUE}
+);
+
+const rgblight_segment_t PROGMEM capslock_layer[] = RGBLIGHT_LAYER_SEGMENTS(
+ {1, 1, HSV_WHITE},
+ {8, 1, HSV_WHITE}
+);
+
+const rgblight_segment_t PROGMEM numlock_layer[] = RGBLIGHT_LAYER_SEGMENTS(
+ {6, 2, HSV_PURPLE}
+);
+
+const rgblight_segment_t * const PROGMEM my_rgb_layers[] = RGBLIGHT_LAYERS_LIST(
+ [_QWERTY] = game_layer,
+ [_LOWER] = lower_layer,
+ [_RAISE] = raise_layer,
+ [_NAV] = adjust_layer,
+ [_CMD] = capslock_layer,
+ [_FN] = numlock_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)
+{
+ rgblight_set_layer_state(_LOWER, layer_state_cmp(state, _LOWER));
+ rgblight_set_layer_state(_RAISE, layer_state_cmp(state, _RAISE));
+ rgblight_set_layer_state(_NAV, layer_state_cmp(state, _NAV));
+ rgblight_set_layer_state(_CMD, layer_state_cmp(state, _CMD));
+ rgblight_set_layer_state(_FN, layer_state_cmp(state, _FN));
+ return state;
+}