From 2f07627a5dd38ab1370804f4feb1972250928803 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20=C4=90or=C4=91evi=C4=87?= Date: Mon, 11 Feb 2019 22:41:51 +0100 Subject: Add RGB_SET keycode to Melody96 and RGB files to userspace --- keyboards/melody96/keymaps/konstantin/keymap.c | 23 +++++++++++++++++++---- users/konstantin/konstantin.h | 3 +++ users/konstantin/rgb.c | 3 +++ users/konstantin/rgb.h | 17 +++++++++++++++++ users/konstantin/rules.mk | 3 +++ 5 files changed, 45 insertions(+), 4 deletions(-) create mode 100644 users/konstantin/rgb.c create mode 100644 users/konstantin/rgb.h diff --git a/keyboards/melody96/keymaps/konstantin/keymap.c b/keyboards/melody96/keymaps/konstantin/keymap.c index 11b687b55e..4df856f8fb 100644 --- a/keyboards/melody96/keymaps/konstantin/keymap.c +++ b/keyboards/melody96/keymaps/konstantin/keymap.c @@ -1,6 +1,21 @@ #include QMK_KEYBOARD_H #include "konstantin.h" +enum keycodes_keymap { + RGB_SET = RANGE_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); + return false; + + default: + return true; + } +} + const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* Base layer * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┐ @@ -32,8 +47,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * ├───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┤ * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │RTg│ ÷ │ × │ − │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┼───┼───┼───┼───┤ - * │ M4 │M2 │M↑ │M1 │M3 │M5 │ │ │ │ │ │ │ │Clear│RH+│RS+│RV+│ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┼───┼───┼───┤ │ + * │ M4 │M2 │M↑ │M1 │M3 │M5 │ │UCM│ │ │ │ │ │Clear│RH+│RS+│RV+│ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┼───┼───┼───┤RSt│ * │ │M← │M↓ │M→ │MW↑│ │ │ │ │ │ │ │ │RH-│RS-│RV-│ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────┬───┼───┼───┼───┼───┤ * │ │ │MA0│MA2│MW←│MW→│ │ │ │Vo-│Vo+│Mut│ │PgU│RMB│RMK│RMG│ │ @@ -44,8 +59,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [L_FN] = LAYOUT( \ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_TOG, DIVIDE, TIMES, MINUS, - KC_BTN4, KC_BTN2, KC_MS_U, KC_BTN1, KC_BTN3, KC_BTN5, _______, _______, _______, _______, _______, _______, _______, CLEAR, RGB_HUI, RGB_SAI, RGB_VAI, XXXXXXX, - _______, KC_MS_L, KC_MS_D, KC_MS_R, KC_WH_U, _______, _______, _______, _______, _______, _______, _______, _______, RGB_HUD, RGB_SAD, RGB_VAD, _______, + KC_BTN4, KC_BTN2, KC_MS_U, KC_BTN1, KC_BTN3, KC_BTN5, _______, UC_MOD, _______, _______, _______, _______, _______, CLEAR, RGB_HUI, RGB_SAI, RGB_VAI, XXXXXXX, + _______, KC_MS_L, KC_MS_D, KC_MS_R, KC_WH_U, _______, _______, _______, _______, _______, _______, _______, _______, RGB_HUD, RGB_SAD, RGB_VAD, RGB_SET, _______, _______, KC_ACL0, KC_ACL2, KC_WH_L, KC_WH_R, _______, _______, _______, KC_VOLD, KC_VOLU, KC_MUTE, _______, KC_PGUP, RGB_M_B, RGB_M_K, RGB_M_G, XXXXXXX, _______, DST_P_R, DST_N_A, KC_WH_D, _______, XXXXXXX, KC_APP, KC_HOME, KC_PGDN, KC_END, RGB_RMOD,RGB_MOD, RGB_M_P ), diff --git a/users/konstantin/konstantin.h b/users/konstantin/konstantin.h index 989854c2e6..d8b00c4c89 100644 --- a/users/konstantin/konstantin.h +++ b/users/konstantin/konstantin.h @@ -1,6 +1,9 @@ #pragma once #include "quantum.h" +#if defined(RGBLIGHT_ENABLE) || defined(RGBMATRIX_ENABLE) + #include "rgb.h" +#endif #ifdef TAP_DANCE_ENABLE #include "tap_dance.h" #endif diff --git a/users/konstantin/rgb.c b/users/konstantin/rgb.c new file mode 100644 index 0000000000..a09057d282 --- /dev/null +++ b/users/konstantin/rgb.c @@ -0,0 +1,3 @@ +#include "rgb.h" + +const hsv_t GODSPEED_BLUE = { .h = 214, .s = 17, .v = 73 }; diff --git a/users/konstantin/rgb.h b/users/konstantin/rgb.h new file mode 100644 index 0000000000..2ea10c67a7 --- /dev/null +++ b/users/konstantin/rgb.h @@ -0,0 +1,17 @@ +#pragma once + +#include "quantum.h" + +typedef struct { + uint16_t h; + uint8_t s; + uint8_t v; +} hsv_t; + +typedef struct { + uint8_t r; + uint8_t g; + uint8_t b; +} rgb_t; + +extern const hsv_t GODSPEED_BLUE; diff --git a/users/konstantin/rules.mk b/users/konstantin/rules.mk index 4af256e1eb..8913e57558 100644 --- a/users/konstantin/rules.mk +++ b/users/konstantin/rules.mk @@ -1,4 +1,7 @@ SRC += konstantin.c +ifneq (,$(filter yes,$(RGBLIGHT_ENABLE) $(RGB_MATRIX_ENABLE))) # if either is yes + SRC += rgb.c +endif ifeq ($(strip $(TAP_DANCE_ENABLE)), yes) SRC += tap_dance.c endif -- cgit v1.2.3