summary refs log tree commit diff
path: root/tmk_core/common
diff options
context:
space:
mode:
authorDrashna Jaelre <drashna@live.com>2018-03-19 20:59:58 -0700
committerJack Humbert <jack.humb@gmail.com>2018-03-19 23:59:58 -0400
commitff728a8a01c1aa81e86f38dfd1753bd49ce39e88 (patch)
treebb901542cc04283323efb63d574391304f85b091 /tmk_core/common
parent37cc08848615c2efa8c291b561f8c33048360fb5 (diff)
[Proposal?] Allow RGB Underglow to turn off when host is idle/asleep (#2104)
* Add RGB Underglow Sleeping

* Add RGBLIGHT_SLEEP to toggle/control RGB light behavior

* Update rgb docs

* Update for RGB disable command
Diffstat (limited to 'tmk_core/common')
-rw-r--r--tmk_core/common/avr/suspend.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/tmk_core/common/avr/suspend.c b/tmk_core/common/avr/suspend.c
index 1c7618ff51..213f03f6fa 100644
--- a/tmk_core/common/avr/suspend.c
+++ b/tmk_core/common/avr/suspend.c
@@ -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