aboutsummaryrefslogtreecommitdiff
path: root/users/drashna/rgb_stuff.c
diff options
context:
space:
mode:
Diffstat (limited to 'users/drashna/rgb_stuff.c')
-rw-r--r--users/drashna/rgb_stuff.c74
1 files changed, 42 insertions, 32 deletions
diff --git a/users/drashna/rgb_stuff.c b/users/drashna/rgb_stuff.c
index defee9ac1..d98f7cc2f 100644
--- a/users/drashna/rgb_stuff.c
+++ b/users/drashna/rgb_stuff.c
@@ -1,3 +1,19 @@
1/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
1#include "drashna.h" 17#include "drashna.h"
2#include "rgb_stuff.h" 18#include "rgb_stuff.h"
3#include "eeprom.h" 19#include "eeprom.h"
@@ -152,14 +168,15 @@ void matrix_scan_rgb_light(void) {
152 168
153void rgblight_set_hsv_and_mode(uint8_t hue, uint8_t sat, uint8_t val, uint8_t mode) { 169void rgblight_set_hsv_and_mode(uint8_t hue, uint8_t sat, uint8_t val, uint8_t mode) {
154 rgblight_sethsv_noeeprom(hue, sat, val); 170 rgblight_sethsv_noeeprom(hue, sat, val);
155 wait_us(175); // Add a slight delay between color and mode to ensure it's processed correctly 171 // wait_us(175); // Add a slight delay between color and mode to ensure it's processed correctly
156 rgblight_mode_noeeprom(mode); 172 rgblight_mode_noeeprom(mode);
157} 173}
158 174
159layer_state_t layer_state_set_rgb_light(layer_state_t state) { 175layer_state_t layer_state_set_rgb_light(layer_state_t state) {
160#ifdef RGBLIGHT_ENABLE 176#ifdef RGBLIGHT_ENABLE
161 if (userspace_config.rgb_layer_change) { 177 if (userspace_config.rgb_layer_change) {
162 switch (get_highest_layer(state)) { 178 uint8_t mode = layer_state_cmp(state,_MODS) ? RGBLIGHT_MODE_BREATHING : RGBLIGHT_MODE_STATIC_LIGHT;
179 switch (get_highest_layer(state|default_layer_state)) {
163 case _MACROS: 180 case _MACROS:
164 rgblight_set_hsv_and_mode(HSV_ORANGE, userspace_config.is_overwatch ? RGBLIGHT_MODE_SNAKE + 2 : RGBLIGHT_MODE_SNAKE + 3); 181 rgblight_set_hsv_and_mode(HSV_ORANGE, userspace_config.is_overwatch ? RGBLIGHT_MODE_SNAKE + 2 : RGBLIGHT_MODE_SNAKE + 3);
165 break; 182 break;
@@ -181,37 +198,30 @@ layer_state_t layer_state_set_rgb_light(layer_state_t state) {
181 case _ADJUST: 198 case _ADJUST:
182 rgblight_set_hsv_and_mode(HSV_RED, RGBLIGHT_MODE_KNIGHT + 2); 199 rgblight_set_hsv_and_mode(HSV_RED, RGBLIGHT_MODE_KNIGHT + 2);
183 break; 200 break;
184 default: // for any other layers, or the default layer 201 case _COLEMAK:
185 { 202 rgblight_set_hsv_and_mode(HSV_MAGENTA, mode);
186 uint8_t mode = get_highest_layer(state) == _MODS ? RGBLIGHT_MODE_BREATHING : RGBLIGHT_MODE_STATIC_LIGHT; 203 break;
187 switch (get_highest_layer(default_layer_state)) { 204 case _DVORAK:
188 case _COLEMAK: 205 rgblight_set_hsv_and_mode(HSV_SPRINGGREEN, mode);
189 rgblight_set_hsv_and_mode(HSV_MAGENTA, mode); 206 break;
190 break; 207 case _WORKMAN:
191 case _DVORAK: 208 rgblight_set_hsv_and_mode(HSV_GOLDENROD, mode);
192 rgblight_set_hsv_and_mode(HSV_SPRINGGREEN, mode); 209 break;
193 break; 210 case _NORMAN:
194 case _WORKMAN: 211 rgblight_set_hsv_and_mode(HSV_CORAL, mode);
195 rgblight_set_hsv_and_mode(HSV_GOLDENROD, mode); 212 break;
196 break; 213 case _MALTRON:
197 case _NORMAN: 214 rgblight_set_hsv_and_mode(HSV_YELLOW, mode);
198 rgblight_set_hsv_and_mode(HSV_CORAL, mode); 215 break;
199 break; 216 case _EUCALYN:
200 case _MALTRON: 217 rgblight_set_hsv_and_mode(HSV_PINK, mode);
201 rgblight_set_hsv_and_mode(HSV_YELLOW, mode); 218 break;
202 break; 219 case _CARPLAX:
203 case _EUCALYN: 220 rgblight_set_hsv_and_mode(HSV_BLUE, mode);
204 rgblight_set_hsv_and_mode(HSV_PINK, mode); 221 break;
205 break; 222 default:
206 case _CARPLAX: 223 rgblight_set_hsv_and_mode(HSV_CYAN, mode);
207 rgblight_set_hsv_and_mode(HSV_BLUE, mode);
208 break;
209 default:
210 rgblight_set_hsv_and_mode(HSV_CYAN, mode);
211 break;
212 }
213 break; 224 break;
214 }
215 } 225 }
216 } 226 }
217#endif // RGBLIGHT_ENABLE 227#endif // RGBLIGHT_ENABLE