diff options
author | Christoph Cullmann <cullmann@kde.org> | 2022-10-01 16:34:28 +0200 |
---|---|---|
committer | Christoph Cullmann <cullmann@kde.org> | 2022-10-01 16:34:28 +0200 |
commit | d07399739018b230c4f18e3bfb3b67d1db0ab8cf (patch) | |
tree | ccd8ea298b66bf4b865fa08a62df790eaf3fd6d9 | |
parent | b8ad2b8aac01054ecafebdad7d581ed2adac9e0d (diff) |
own lightings per layer, first try
-rw-r--r-- | config.h | 3 | ||||
-rw-r--r-- | keymap.c | 60 |
2 files changed, 63 insertions, 0 deletions
@@ -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 @@ -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; +} |