From 57e08eb8badc5db2fb44d2df684f32ea48cce411 Mon Sep 17 00:00:00 2001 From: Jack Humbert Date: Thu, 7 Jul 2016 11:33:32 -0400 Subject: updates rgblight implementation, makes non-timer stuff compatible with audio --- quantum/rgblight.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'quantum/rgblight.c') 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) { } eeconfig_debug_rgblight(); // display current eeprom values - rgblight_timer_init(); // setup the timer + #if !defined(AUDIO_ENABLE) && defined(RGBLIGHT_TIMER) + rgblight_timer_init(); // setup the timer + #endif if (rgblight_config.enable) { rgblight_mode(rgblight_config.mode); @@ -192,14 +194,19 @@ void rgblight_mode(uint8_t mode) { eeconfig_update_rgblight(rgblight_config.raw); xprintf("rgblight mode: %u\n", rgblight_config.mode); if (rgblight_config.mode == 1) { - rgblight_timer_disable(); + #if !defined(AUDIO_ENABLE) && defined(RGBLIGHT_TIMER) + rgblight_timer_disable(); + #endif } else if (rgblight_config.mode >=2 && rgblight_config.mode <=23) { // MODE 2-5, breathing // MODE 6-8, rainbow mood // MODE 9-14, rainbow swirl // MODE 15-20, snake // MODE 21-23, knight - rgblight_timer_enable(); + + #if !defined(AUDIO_ENABLE) && defined(RGBLIGHT_TIMER) + rgblight_timer_enable(); + #endif } rgblight_sethsv(rgblight_config.hue, rgblight_config.sat, rgblight_config.val); } @@ -211,7 +218,10 @@ void rgblight_toggle(void) { if (rgblight_config.enable) { rgblight_mode(rgblight_config.mode); } else { - rgblight_timer_disable(); + + #if !defined(AUDIO_ENABLE) && defined(RGBLIGHT_TIMER) + rgblight_timer_disable(); + #endif _delay_ms(50); rgblight_set(); } @@ -328,6 +338,9 @@ void rgblight_set(void) { } } + +#if !defined(AUDIO_ENABLE) && defined(RGBLIGHT_TIMER) + // Animation timer -- AVR Timer3 void rgblight_timer_init(void) { static uint8_t rgblight_timer_is_init = 0; @@ -503,3 +516,5 @@ void rgblight_effect_knight(uint8_t interval) { } } + +#endif \ No newline at end of file -- cgit v1.2.3-24-g4f1b