]> git.donarmstrong.com Git - qmk_firmware.git/commitdiff
adds 'RGB_RMOD' to go through RGB modes in reverse
authorColin T.A. Gray <colinta@gmail.com>
Mon, 4 Dec 2017 18:36:24 +0000 (11:36 -0700)
committerskullydazed <skullydazed@users.noreply.github.com>
Mon, 4 Dec 2017 19:12:52 +0000 (11:12 -0800)
docs/feature_rgblight.md
quantum/quantum.c
quantum/quantum_keycodes.h

index 0a5e2a8b15203eb555e232cbb957de9c3ffd3c5a..9d8f537dfb7ee1ef42c5426f8fc2dbe4c56723be 100644 (file)
@@ -87,8 +87,8 @@ These control the RGB Lighting functionality.
 | Long Name | Short Name | Description |
 |-----------|------------|-------------|
 ||`RGB_TOG`|toggle on/off|
-||`RGB_MOD`|cycle through modes|
-||`RGB_SMOD`|cycle through modes, use reverse direction when shift is hold|
+|`RGB_MODE_FORWARD`|`RGB_MOD`|cycle through modes, use reverse direction when shift is held|
+|`RGB_MODE_REVERSE`|`RGB_RMOD`|cycle through modes in reverse (also suppost shift to go forward)|
 ||`RGB_HUI`|hue increase|
 ||`RGB_HUD`|hue decrease|
 ||`RGB_SAI`|saturation increase|
@@ -104,6 +104,8 @@ These control the RGB Lighting functionality.
 |`RGB_MODE_XMAS`|`RGB_M_X`| Switch to the Christmas animation |
 |`RGB_MODE_GRADIENT`|`RGB_M_G`| Switch to the static gradient mode |
 
+note: for backwards compatibility, `RGB_SMOD` is an alias for `RGB_MOD`.
+
 ## Hardware Modification
 
 ![Planck with RGB Underglow](https://raw.githubusercontent.com/qmk/qmk_firmware/master/keyboards/planck/keymaps/yang/planck-with-rgb-underglow.jpg)
index d08f15870c497b3e7ef202f7c49d77b580a47d2e..9c498bf7e04939a70f1e9df04d887ea897eb99da 100644 (file)
@@ -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;
index c3c5f1656441594baeb1cca49ac04834fcb6c8be..048da326735690da48e995034601993ddfff1de6 100644 (file)
@@ -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