aboutsummaryrefslogtreecommitdiff
path: root/keyboards/melody96/keymaps/konstantin/keymap.c
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards/melody96/keymaps/konstantin/keymap.c')
-rw-r--r--keyboards/melody96/keymaps/konstantin/keymap.c11
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
4static const hsv_t *colors[] = { &GODSPEED_BLUE, &GODSPEED_YELLOW };
5static size_t cnum = sizeof colors / sizeof *colors;
6static size_t cidx;
7
4void eeconfig_init_keymap(void) { 8void 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
8enum keycodes_keymap { 12enum keycodes_keymap {
@@ -12,7 +16,10 @@ enum keycodes_keymap {
12bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { 16bool 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: