diff options
| author | Sebastian Kaim <sebb@sebb767.de> | 2017-10-24 23:17:47 +0200 |
|---|---|---|
| committer | Jack Humbert <jack.humb@gmail.com> | 2017-10-24 17:02:20 -1000 |
| commit | 1f4349592277e6a61e643947665c8b026b7700ed (patch) | |
| tree | d4374e8deb6d268357bb5c22684b71c4445c75e2 | |
| parent | 21dfa29c28b8257116b2f1c0b4524c4062658598 (diff) | |
| download | qmk_firmware-1f4349592277e6a61e643947665c8b026b7700ed.tar.gz qmk_firmware-1f4349592277e6a61e643947665c8b026b7700ed.zip | |
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.
| -rw-r--r-- | docs/feature_rgblight.md | 1 | ||||
| -rw-r--r-- | quantum/quantum.c | 12 | ||||
| -rw-r--r-- | quantum/quantum_keycodes.h | 1 |
3 files changed, 14 insertions, 0 deletions
diff --git a/docs/feature_rgblight.md b/docs/feature_rgblight.md index 18f2c74e5..0a5e2a8b1 100644 --- a/docs/feature_rgblight.md +++ b/docs/feature_rgblight.md | |||
| @@ -88,6 +88,7 @@ These control the RGB Lighting functionality. | |||
| 88 | |-----------|------------|-------------| | 88 | |-----------|------------|-------------| |
| 89 | ||`RGB_TOG`|toggle on/off| | 89 | ||`RGB_TOG`|toggle on/off| |
| 90 | ||`RGB_MOD`|cycle through modes| | 90 | ||`RGB_MOD`|cycle through modes| |
| 91 | ||`RGB_SMOD`|cycle through modes, use reverse direction when shift is hold| | ||
| 91 | ||`RGB_HUI`|hue increase| | 92 | ||`RGB_HUI`|hue increase| |
| 92 | ||`RGB_HUD`|hue decrease| | 93 | ||`RGB_HUD`|hue decrease| |
| 93 | ||`RGB_SAI`|saturation increase| | 94 | ||`RGB_SAI`|saturation increase| |
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) { | |||
| 290 | rgblight_step(); | 290 | rgblight_step(); |
| 291 | } | 291 | } |
| 292 | return false; | 292 | return false; |
| 293 | case RGB_SMOD: | ||
| 294 | // same as RBG_MOD, but if shift is pressed, it will use the reverese direction instead. | ||
| 295 | if (record->event.pressed) { | ||
| 296 | uint8_t shifted = get_mods() & (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT)); | ||
| 297 | if(shifted) { | ||
| 298 | rgblight_step_reverse(); | ||
| 299 | } | ||
| 300 | else { | ||
| 301 | rgblight_step(); | ||
| 302 | } | ||
| 303 | } | ||
| 304 | return false; | ||
| 293 | case RGB_HUI: | 305 | case RGB_HUI: |
| 294 | if (record->event.pressed) { | 306 | if (record->event.pressed) { |
| 295 | rgblight_increase_hue(); | 307 | rgblight_increase_hue(); |
diff --git a/quantum/quantum_keycodes.h b/quantum/quantum_keycodes.h index 212fdc67d..c3c5f1656 100644 --- a/quantum/quantum_keycodes.h +++ b/quantum/quantum_keycodes.h | |||
| @@ -400,6 +400,7 @@ enum quantum_keycodes { | |||
| 400 | // RGB functionality | 400 | // RGB functionality |
| 401 | RGB_TOG, | 401 | RGB_TOG, |
| 402 | RGB_MOD, | 402 | RGB_MOD, |
| 403 | RGB_SMOD, | ||
| 403 | RGB_HUI, | 404 | RGB_HUI, |
| 404 | RGB_HUD, | 405 | RGB_HUD, |
| 405 | RGB_SAI, | 406 | RGB_SAI, |
