From 1f4349592277e6a61e643947665c8b026b7700ed Mon Sep 17 00:00:00 2001 From: Sebastian Kaim Date: Tue, 24 Oct 2017 23:17:47 +0200 Subject: Added a new keycode for cycling through RBG modes which reverses directions when shift is hold. This commit adds a new keycode `RGB_SMOD` which is the same as `RGB_MOD` (cycle through all modes), but when it is used in combination with shift it will reverse the direction. --- quantum/quantum.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'quantum/quantum.c') diff --git a/quantum/quantum.c b/quantum/quantum.c index a1a1a9d1c..23873852f 100644 --- a/quantum/quantum.c +++ b/quantum/quantum.c @@ -290,6 +290,18 @@ bool process_record_quantum(keyrecord_t *record) { rgblight_step(); } return false; + case RGB_SMOD: + // same as RBG_MOD, but if shift is pressed, it will use the reverese direction instead. + if (record->event.pressed) { + 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_HUI: if (record->event.pressed) { rgblight_increase_hue(); -- cgit v1.2.3-24-g4f1b