From 53b043d4ef9da3c60236bc8ac012f59bea7bff20 Mon Sep 17 00:00:00 2001 From: "Colin T.A. Gray" Date: Mon, 4 Dec 2017 11:36:24 -0700 Subject: adds 'RGB_RMOD' to go through RGB modes in reverse --- quantum/quantum.c | 17 +++++++++++------ quantum/quantum_keycodes.h | 8 ++++++-- 2 files changed, 17 insertions(+), 8 deletions(-) (limited to 'quantum') diff --git a/quantum/quantum.c b/quantum/quantum.c index d08f15870c..9c498bf7e0 100644 --- a/quantum/quantum.c +++ b/quantum/quantum.c @@ -286,20 +286,25 @@ bool process_record_quantum(keyrecord_t *record) { rgblight_toggle(); } return false; - case RGB_MOD: + case RGB_MODE_FORWARD: if (record->event.pressed) { - rgblight_step(); + uint8_t shifted = get_mods() & (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT)); + if(shifted) { + rgblight_step_reverse(); + } + else { + rgblight_step(); + } } return false; - case RGB_SMOD: - // same as RBG_MOD, but if shift is pressed, it will use the reverese direction instead. + case RGB_MODE_REVERSE: if (record->event.pressed) { uint8_t shifted = get_mods() & (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT)); if(shifted) { - rgblight_step_reverse(); + rgblight_step(); } else { - rgblight_step(); + rgblight_step_reverse(); } } return false; diff --git a/quantum/quantum_keycodes.h b/quantum/quantum_keycodes.h index c3c5f16564..048da32673 100644 --- a/quantum/quantum_keycodes.h +++ b/quantum/quantum_keycodes.h @@ -399,8 +399,8 @@ enum quantum_keycodes { // RGB functionality RGB_TOG, - RGB_MOD, - RGB_SMOD, + RGB_MODE_FORWARD, + RGB_MODE_REVERSE, RGB_HUI, RGB_HUD, RGB_SAI, @@ -553,6 +553,10 @@ enum quantum_keycodes { #define KC_GESC GRAVE_ESC +#define RGB_MOD RGB_MODE_FORWARD +#define RGB_SMOD RGB_MODE_FORWARD +#define RGB_RMOD RGB_MODE_REVERSE + #define RGB_M_P RGB_MODE_PLAIN #define RGB_M_B RGB_MODE_BREATHE #define RGB_M_R RGB_MODE_RAINBOW -- cgit v1.2.3