]> git.donarmstrong.com Git - qmk_firmware.git/commitdiff
Added a new keycode for cycling through RBG modes which reverses directions when...
authorSebastian Kaim <sebb@sebb767.de>
Tue, 24 Oct 2017 21:17:47 +0000 (23:17 +0200)
committerJack Humbert <jack.humb@gmail.com>
Wed, 25 Oct 2017 03:02:20 +0000 (17:02 -1000)
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.

docs/feature_rgblight.md
quantum/quantum.c
quantum/quantum_keycodes.h

index 18f2c74e5e7e3c0a44d3e207a0992ec7f164902b..0a5e2a8b15203eb555e232cbb957de9c3ffd3c5a 100644 (file)
@@ -88,6 +88,7 @@ These control the RGB Lighting functionality.
 |-----------|------------|-------------|
 ||`RGB_TOG`|toggle on/off|
 ||`RGB_MOD`|cycle through modes|
+||`RGB_SMOD`|cycle through modes, use reverse direction when shift is hold|
 ||`RGB_HUI`|hue increase|
 ||`RGB_HUD`|hue decrease|
 ||`RGB_SAI`|saturation increase|
index a1a1a9d1cb0b6cf610119d8a49d657be673ebd55..23873852f5b5efab601351f30fff08d60ad9ba41 100644 (file)
@@ -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();
index 212fdc67d6b441513034d6ff536cb46e3ea73475..c3c5f1656441594baeb1cca49ac04834fcb6c8be 100644 (file)
@@ -400,6 +400,7 @@ enum quantum_keycodes {
     // RGB functionality
     RGB_TOG,
     RGB_MOD,
+    RGB_SMOD,
     RGB_HUI,
     RGB_HUD,
     RGB_SAI,