summaryrefslogtreecommitdiffstats
path: root/quantum
diff options
context:
space:
mode:
authorTerryMathews <terry@terrymathews.net>2016-07-08 05:34:33 +0200
committerTerryMathews <terry@terrymathews.net>2016-07-08 05:34:33 +0200
commit50c686587ed49d8079ba1b11d45ceb6a55d6cd4b (patch)
tree73bddcd35f632004d615d69725f07ccfd7074007 /quantum
parente8719e10c4395102f8e252c8377e2f19a18ee74d (diff)
downloadqmk_firmware-50c686587ed49d8079ba1b11d45ceb6a55d6cd4b.tar.gz
qmk_firmware-50c686587ed49d8079ba1b11d45ceb6a55d6cd4b.tar.xz
Create keycodes for RGB control functions
Moves RGB controls out of the macro function and assigns them their own keycodes: RGB_TOG (toggle on/off) RGB_MOD (mode step) RGB_HUI (increase hue) RGB_HUD (decrease hue) RGB_SAI (increase saturation) RGB_SAD (decrease saturation) RGB_VAI (increase brightness) RGB_VAD (decrease brightness)
Diffstat (limited to 'quantum')
-rw-r--r--quantum/keymap.h10
-rw-r--r--quantum/quantum.c50
2 files changed, 60 insertions, 0 deletions
diff --git a/quantum/keymap.h b/quantum/keymap.h
index 73f99f821..a15865183 100644
--- a/quantum/keymap.h
+++ b/quantum/keymap.h
@@ -156,6 +156,16 @@ enum quantum_keycodes {
BL_INC,
BL_TOGG,
BL_STEP,
+
+ // RGB functionality
+ RGB_TOG,
+ RGB_MOD,
+ RGB_HUI,
+ RGB_HUD,
+ RGB_SAI,
+ RGB_SAD,
+ RGB_VAI,
+ RGB_VAD,
// Left shift, open paren
KC_LSPO,
diff --git a/quantum/quantum.c b/quantum/quantum.c
index d8e43a465..5c0b53e22 100644
--- a/quantum/quantum.c
+++ b/quantum/quantum.c
@@ -103,6 +103,56 @@ bool process_record_quantum(keyrecord_t *record) {
return false;
}
break;
+ #ifdef RGBLIGHT_ENABLE
+ case RGB_TOG:
+ if (record->event.pressed) {
+ rgblight_toggle();
+ return false;
+ }
+ break;
+ case RGB_MOD:
+ if (record->event.pressed) {
+ rgblight_step();
+ return false;
+ }
+ break;
+ case RGB_HUI:
+ if (record->event.pressed) {
+ rgblight_increase_hue();
+ return false;
+ }
+ break;
+ case RGB_HUD:
+ if (record->event.pressed) {
+ rgblight_decrease_hue();
+ return false;
+ }
+ break;
+ case RGB_SAI:
+ if (record->event.pressed) {
+ rgblight_increase_sat();
+ return false;
+ }
+ break;
+ case RGB_SAD:
+ if (record->event.pressed) {
+ rgblight_decrease_sat();
+ return false;
+ }
+ break;
+ case RGB_VAI:
+ if (record->event.pressed) {
+ rgblight_increase_val();
+ return false;
+ }
+ break;
+ case RGB_VAD:
+ if (record->event.pressed) {
+ rgblight_decrease_val();
+ return false;
+ }
+ break;
+ #endif
case MAGIC_SWAP_CONTROL_CAPSLOCK ... MAGIC_UNSWAP_ALT_GUI:
if (record->event.pressed) {
// MAGIC actions (BOOTMAGIC without the boot)