]> git.donarmstrong.com Git - qmk_firmware.git/blobdiff - tmk_core/common/avr/suspend.c
[Proposal?] Allow RGB Underglow to turn off when host is idle/asleep (#2104)
[qmk_firmware.git] / tmk_core / common / avr / suspend.c
index 1c7618ff51dd9ea0b8a5a5c24bb3352b51169eff..213f03f6fa5c4dd8eec6ba0b28f456fee2d19596 100644 (file)
@@ -19,6 +19,9 @@
     #include "audio.h"
 #endif /* AUDIO_ENABLE */
 
+#ifdef RGBLIGHT_ANIMATIONS
+  #include "rgblight.h"
+#endif
 
 
 #define wdt_intr_enable(value)   \
@@ -85,7 +88,12 @@ static void power_down(uint8_t wdto)
         // This sometimes disables the start-up noise, so it's been disabled
                // stop_all_notes();
        #endif /* AUDIO_ENABLE */
-
+#ifdef RGBLIGHT_SLEEP
+#ifdef RGBLIGHT_ANIMATIONS
+  rgblight_timer_disable();
+#endif
+  rgblight_disable();
+#endif
     // TODO: more power saving
     // See PicoPower application note
     // - I/O port input with pullup
@@ -132,6 +140,12 @@ void suspend_wakeup_init(void)
     backlight_init();
 #endif
        led_set(host_keyboard_leds());
+#ifdef RGBLIGHT_SLEEP
+  rgblight_enable();
+#ifdef RGBLIGHT_ANIMATIONS
+  rgblight_timer_enable();
+#endif
+#endif
 }
 
 #ifndef NO_SUSPEND_POWER_DOWN