diff options
| author | TerryMathews <terry@terrymathews.net> | 2016-07-07 23:34:33 -0400 |
|---|---|---|
| committer | TerryMathews <terry@terrymathews.net> | 2016-07-07 23:34:33 -0400 |
| commit | 50c686587ed49d8079ba1b11d45ceb6a55d6cd4b (patch) | |
| tree | 73bddcd35f632004d615d69725f07ccfd7074007 /quantum | |
| parent | e8719e10c4395102f8e252c8377e2f19a18ee74d (diff) | |
| download | qmk_firmware-50c686587ed49d8079ba1b11d45ceb6a55d6cd4b.tar.gz qmk_firmware-50c686587ed49d8079ba1b11d45ceb6a55d6cd4b.zip | |
Create keycodes for RGB control functions
Moves RGB controls out of the macro function and assigns them their own
keycodes:
RGB_TOG (toggle on/off)
RGB_MOD (mode step)
RGB_HUI (increase hue)
RGB_HUD (decrease hue)
RGB_SAI (increase saturation)
RGB_SAD (decrease saturation)
RGB_VAI (increase brightness)
RGB_VAD (decrease brightness)
Diffstat (limited to 'quantum')
| -rw-r--r-- | quantum/keymap.h | 10 | ||||
| -rw-r--r-- | quantum/quantum.c | 50 |
2 files changed, 60 insertions, 0 deletions
diff --git a/quantum/keymap.h b/quantum/keymap.h index 73f99f821..a15865183 100644 --- a/quantum/keymap.h +++ b/quantum/keymap.h | |||
| @@ -156,6 +156,16 @@ enum quantum_keycodes { | |||
| 156 | BL_INC, | 156 | BL_INC, |
| 157 | BL_TOGG, | 157 | BL_TOGG, |
| 158 | BL_STEP, | 158 | BL_STEP, |
| 159 | |||
| 160 | // RGB functionality | ||
| 161 | RGB_TOG, | ||
| 162 | RGB_MOD, | ||
| 163 | RGB_HUI, | ||
| 164 | RGB_HUD, | ||
| 165 | RGB_SAI, | ||
| 166 | RGB_SAD, | ||
| 167 | RGB_VAI, | ||
| 168 | RGB_VAD, | ||
| 159 | 169 | ||
| 160 | // Left shift, open paren | 170 | // Left shift, open paren |
| 161 | KC_LSPO, | 171 | KC_LSPO, |
diff --git a/quantum/quantum.c b/quantum/quantum.c index d8e43a465..5c0b53e22 100644 --- a/quantum/quantum.c +++ b/quantum/quantum.c | |||
| @@ -103,6 +103,56 @@ bool process_record_quantum(keyrecord_t *record) { | |||
| 103 | return false; | 103 | return false; |
| 104 | } | 104 | } |
| 105 | break; | 105 | break; |
| 106 | #ifdef RGBLIGHT_ENABLE | ||
| 107 | case RGB_TOG: | ||
| 108 | if (record->event.pressed) { | ||
| 109 | rgblight_toggle(); | ||
| 110 | return false; | ||
| 111 | } | ||
| 112 | break; | ||
| 113 | case RGB_MOD: | ||
| 114 | if (record->event.pressed) { | ||
| 115 | rgblight_step(); | ||
| 116 | return false; | ||
| 117 | } | ||
| 118 | break; | ||
| 119 | case RGB_HUI: | ||
| 120 | if (record->event.pressed) { | ||
| 121 | rgblight_increase_hue(); | ||
| 122 | return false; | ||
| 123 | } | ||
| 124 | break; | ||
| 125 | case RGB_HUD: | ||
| 126 | if (record->event.pressed) { | ||
| 127 | rgblight_decrease_hue(); | ||
| 128 | return false; | ||
| 129 | } | ||
| 130 | break; | ||
| 131 | case RGB_SAI: | ||
| 132 | if (record->event.pressed) { | ||
| 133 | rgblight_increase_sat(); | ||
| 134 | return false; | ||
| 135 | } | ||
| 136 | break; | ||
| 137 | case RGB_SAD: | ||
| 138 | if (record->event.pressed) { | ||
| 139 | rgblight_decrease_sat(); | ||
| 140 | return false; | ||
| 141 | } | ||
| 142 | break; | ||
| 143 | case RGB_VAI: | ||
| 144 | if (record->event.pressed) { | ||
| 145 | rgblight_increase_val(); | ||
| 146 | return false; | ||
| 147 | } | ||
| 148 | break; | ||
| 149 | case RGB_VAD: | ||
| 150 | if (record->event.pressed) { | ||
| 151 | rgblight_decrease_val(); | ||
| 152 | return false; | ||
| 153 | } | ||
| 154 | break; | ||
| 155 | #endif | ||
| 106 | case MAGIC_SWAP_CONTROL_CAPSLOCK ... MAGIC_UNSWAP_ALT_GUI: | 156 | case MAGIC_SWAP_CONTROL_CAPSLOCK ... MAGIC_UNSWAP_ALT_GUI: |
| 107 | if (record->event.pressed) { | 157 | if (record->event.pressed) { |
| 108 | // MAGIC actions (BOOTMAGIC without the boot) | 158 | // MAGIC actions (BOOTMAGIC without the boot) |
