From fbe2eba4729a1d7b00b76243e146b5324d65976b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20=C4=90or=C4=91evi=C4=87?= Date: Mon, 18 Feb 2019 03:16:21 +0100 Subject: [PATCH] Add GODSPEED_YELLOW color --- keyboards/melody96/keymaps/konstantin/keymap.c | 11 +++++++++-- users/konstantin/konstantin.c | 2 +- users/konstantin/rgb.c | 3 ++- users/konstantin/rgb.h | 1 + 4 files changed, 13 insertions(+), 4 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 @@ #include QMK_KEYBOARD_H #include "konstantin.h" +static const hsv_t *colors[] = { &GODSPEED_BLUE, &GODSPEED_YELLOW }; +static size_t cnum = sizeof colors / sizeof *colors; +static size_t cidx; + void eeconfig_init_keymap(void) { - rgblight_sethsv(GODSPEED_BLUE.h, GODSPEED_BLUE.s, GODSPEED_BLUE.v); + rgblight_sethsv(colors[cidx]->h, colors[cidx]->s, colors[cidx]->v); } enum keycodes_keymap { @@ -12,7 +16,10 @@ enum keycodes_keymap { bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { switch (keycode) { case RGB_SET: - rgblight_sethsv(GODSPEED_BLUE.h, GODSPEED_BLUE.s, GODSPEED_BLUE.v); + if (record->event.pressed) { + cidx = (cidx + 1) % cnum; + rgblight_sethsv(colors[cidx]->h, colors[cidx]->s, colors[cidx]->v); + } return false; default: diff --git a/users/konstantin/konstantin.c b/users/konstantin/konstantin.c index a8f2a5f2c..753742fa7 100644 --- a/users/konstantin/konstantin.c +++ b/users/konstantin/konstantin.c @@ -61,7 +61,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { return false; #ifdef LAYER_FN - static bool fn_lock; + static bool fn_lock; case FN_FNLK: if (record->event.pressed && record->tap.count == TAPPING_TOGGLE) { diff --git a/users/konstantin/rgb.c b/users/konstantin/rgb.c index b69123be0..37b1ab3d5 100644 --- a/users/konstantin/rgb.c +++ b/users/konstantin/rgb.c @@ -1,3 +1,4 @@ #include "rgb.h" -const hsv_t GODSPEED_BLUE = { .h = 300, .s = 68, .v = RGBLIGHT_LIMIT_VAL }; +const hsv_t GODSPEED_BLUE = { .h = 300, .s = 68, .v = RGBLIGHT_LIMIT_VAL }; +const hsv_t GODSPEED_YELLOW = { .h = 35, .s = 165, .v = RGBLIGHT_LIMIT_VAL }; diff --git a/users/konstantin/rgb.h b/users/konstantin/rgb.h index e296cf12e..53b5821b0 100644 --- a/users/konstantin/rgb.h +++ b/users/konstantin/rgb.h @@ -15,3 +15,4 @@ typedef struct { } rgb_t; extern const hsv_t GODSPEED_BLUE; +extern const hsv_t GODSPEED_YELLOW;