diff options
Diffstat (limited to 'keyboards/melody96/keymaps/konstantin/keymap.c')
| -rw-r--r-- | keyboards/melody96/keymaps/konstantin/keymap.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/keyboards/melody96/keymaps/konstantin/keymap.c b/keyboards/melody96/keymaps/konstantin/keymap.c index 02d84d693..c8b6edb3d 100644 --- a/keyboards/melody96/keymaps/konstantin/keymap.c +++ b/keyboards/melody96/keymaps/konstantin/keymap.c | |||
| @@ -1,8 +1,12 @@ | |||
| 1 | #include QMK_KEYBOARD_H | 1 | #include QMK_KEYBOARD_H |
| 2 | #include "konstantin.h" | 2 | #include "konstantin.h" |
| 3 | 3 | ||
| 4 | static const hsv_t *colors[] = { &GODSPEED_BLUE, &GODSPEED_YELLOW }; | ||
| 5 | static size_t cnum = sizeof colors / sizeof *colors; | ||
| 6 | static size_t cidx; | ||
| 7 | |||
| 4 | void eeconfig_init_keymap(void) { | 8 | void eeconfig_init_keymap(void) { |
| 5 | rgblight_sethsv(GODSPEED_BLUE.h, GODSPEED_BLUE.s, GODSPEED_BLUE.v); | 9 | rgblight_sethsv(colors[cidx]->h, colors[cidx]->s, colors[cidx]->v); |
| 6 | } | 10 | } |
| 7 | 11 | ||
| 8 | enum keycodes_keymap { | 12 | enum keycodes_keymap { |
| @@ -12,7 +16,10 @@ enum keycodes_keymap { | |||
| 12 | bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { | 16 | bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { |
| 13 | switch (keycode) { | 17 | switch (keycode) { |
| 14 | case RGB_SET: | 18 | case RGB_SET: |
| 15 | rgblight_sethsv(GODSPEED_BLUE.h, GODSPEED_BLUE.s, GODSPEED_BLUE.v); | 19 | if (record->event.pressed) { |
| 20 | cidx = (cidx + 1) % cnum; | ||
| 21 | rgblight_sethsv(colors[cidx]->h, colors[cidx]->s, colors[cidx]->v); | ||
| 22 | } | ||
| 16 | return false; | 23 | return false; |
| 17 | 24 | ||
| 18 | default: | 25 | default: |
