own lightings per layer, first try

This commit is contained in:
Christoph Cullmann 2022-10-01 16:34:28 +02:00
parent b8ad2b8aac
commit d073997390
2 changed files with 63 additions and 0 deletions

View file

@ -52,3 +52,6 @@
#define RGBLIGHT_EFFECT_SNAKE #define RGBLIGHT_EFFECT_SNAKE
#define RGBLIGHT_EFFECT_STATIC_GRADIENT #define RGBLIGHT_EFFECT_STATIC_GRADIENT
#define RGBLIGHT_EFFECT_TWINKLE #define RGBLIGHT_EFFECT_TWINKLE
// we want to have different backlight per layers
#define RGBLIGHT_LAYERS

View file

@ -16,6 +16,7 @@
#include QMK_KEYBOARD_H #include QMK_KEYBOARD_H
// our layers, used as index in layers and rgb lights
enum planck_layers { enum planck_layers {
_QWERTY, _QWERTY,
_LOWER, _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;
}