Add GODSPEED_YELLOW color

master
Konstantin Đorđević 2019-02-18 03:16:21 +01:00
parent de2e03650b
commit fbe2eba472
4 changed files with 13 additions and 4 deletions

View File

@ -1,8 +1,12 @@
#include QMK_KEYBOARD_H #include QMK_KEYBOARD_H
#include "konstantin.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) { 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 { enum keycodes_keymap {
@ -12,7 +16,10 @@ enum keycodes_keymap {
bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
switch (keycode) { switch (keycode) {
case RGB_SET: 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; return false;
default: default:

View File

@ -61,7 +61,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
return false; return false;
#ifdef LAYER_FN #ifdef LAYER_FN
static bool fn_lock; static bool fn_lock;
case FN_FNLK: case FN_FNLK:
if (record->event.pressed && record->tap.count == TAPPING_TOGGLE) { if (record->event.pressed && record->tap.count == TAPPING_TOGGLE) {

View File

@ -1,3 +1,4 @@
#include "rgb.h" #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 };

View File

@ -15,3 +15,4 @@ typedef struct {
} rgb_t; } rgb_t;
extern const hsv_t GODSPEED_BLUE; extern const hsv_t GODSPEED_BLUE;
extern const hsv_t GODSPEED_YELLOW;