aboutsummaryrefslogtreecommitdiff
path: root/quantum/rgblight.c
diff options
context:
space:
mode:
authorJack Humbert <jack.humb@gmail.com>2016-07-07 11:33:32 -0400
committerJack Humbert <jack.humb@gmail.com>2016-07-07 11:33:34 -0400
commit57e08eb8badc5db2fb44d2df684f32ea48cce411 (patch)
tree51eede58af359c5c98a080ae359b545a23dd5ad8 /quantum/rgblight.c
parentad43d450ca1b988d196da80e2a745f45f24068f6 (diff)
downloadqmk_firmware-57e08eb8badc5db2fb44d2df684f32ea48cce411.tar.gz
qmk_firmware-57e08eb8badc5db2fb44d2df684f32ea48cce411.zip
updates rgblight implementation, makes non-timer stuff compatible with audio
Diffstat (limited to 'quantum/rgblight.c')
-rw-r--r--quantum/rgblight.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/quantum/rgblight.c b/quantum/rgblight.c
index c29ffedc3..b1b0f035d 100644
--- a/quantum/rgblight.c
+++ b/quantum/rgblight.c
@@ -146,7 +146,9 @@ void rgblight_init(void) {
146 } 146 }
147 eeconfig_debug_rgblight(); // display current eeprom values 147 eeconfig_debug_rgblight(); // display current eeprom values
148 148
149 rgblight_timer_init(); // setup the timer 149 #if !defined(AUDIO_ENABLE) && defined(RGBLIGHT_TIMER)
150 rgblight_timer_init(); // setup the timer
151 #endif
150 152
151 if (rgblight_config.enable) { 153 if (rgblight_config.enable) {
152 rgblight_mode(rgblight_config.mode); 154 rgblight_mode(rgblight_config.mode);
@@ -192,14 +194,19 @@ void rgblight_mode(uint8_t mode) {
192 eeconfig_update_rgblight(rgblight_config.raw); 194 eeconfig_update_rgblight(rgblight_config.raw);
193 xprintf("rgblight mode: %u\n", rgblight_config.mode); 195 xprintf("rgblight mode: %u\n", rgblight_config.mode);
194 if (rgblight_config.mode == 1) { 196 if (rgblight_config.mode == 1) {
195 rgblight_timer_disable(); 197 #if !defined(AUDIO_ENABLE) && defined(RGBLIGHT_TIMER)
198 rgblight_timer_disable();
199 #endif
196 } else if (rgblight_config.mode >=2 && rgblight_config.mode <=23) { 200 } else if (rgblight_config.mode >=2 && rgblight_config.mode <=23) {
197 // MODE 2-5, breathing 201 // MODE 2-5, breathing
198 // MODE 6-8, rainbow mood 202 // MODE 6-8, rainbow mood
199 // MODE 9-14, rainbow swirl 203 // MODE 9-14, rainbow swirl
200 // MODE 15-20, snake 204 // MODE 15-20, snake
201 // MODE 21-23, knight 205 // MODE 21-23, knight
202 rgblight_timer_enable(); 206
207 #if !defined(AUDIO_ENABLE) && defined(RGBLIGHT_TIMER)
208 rgblight_timer_enable();
209 #endif
203 } 210 }
204 rgblight_sethsv(rgblight_config.hue, rgblight_config.sat, rgblight_config.val); 211 rgblight_sethsv(rgblight_config.hue, rgblight_config.sat, rgblight_config.val);
205} 212}
@@ -211,7 +218,10 @@ void rgblight_toggle(void) {
211 if (rgblight_config.enable) { 218 if (rgblight_config.enable) {
212 rgblight_mode(rgblight_config.mode); 219 rgblight_mode(rgblight_config.mode);
213 } else { 220 } else {
214 rgblight_timer_disable(); 221
222 #if !defined(AUDIO_ENABLE) && defined(RGBLIGHT_TIMER)
223 rgblight_timer_disable();
224 #endif
215 _delay_ms(50); 225 _delay_ms(50);
216 rgblight_set(); 226 rgblight_set();
217 } 227 }
@@ -328,6 +338,9 @@ void rgblight_set(void) {
328 } 338 }
329} 339}
330 340
341
342#if !defined(AUDIO_ENABLE) && defined(RGBLIGHT_TIMER)
343
331// Animation timer -- AVR Timer3 344// Animation timer -- AVR Timer3
332void rgblight_timer_init(void) { 345void rgblight_timer_init(void) {
333 static uint8_t rgblight_timer_is_init = 0; 346 static uint8_t rgblight_timer_is_init = 0;
@@ -503,3 +516,5 @@ void rgblight_effect_knight(uint8_t interval) {
503 } 516 }
504 517
505} 518}
519
520#endif \ No newline at end of file