]> git.donarmstrong.com Git - qmk_firmware.git/blobdiff - tmk_core/common/avr/suspend.c
resolves conflicts in rgblight.c
[qmk_firmware.git] / tmk_core / common / avr / suspend.c
index af99f52b5ee18336f4f332eddf5c37bd9ab5b108..4980680198e20775f1a51d8c6d6f0e0a85aaf52a 100644 (file)
@@ -8,10 +8,17 @@
 #include "suspend_avr.h"
 #include "suspend.h"
 #include "timer.h"
+#include "led.h"
+
 #ifdef PROTOCOL_LUFA
-#include "lufa.h"
+       #include "lufa.h"
 #endif
 
+#ifdef AUDIO_ENABLE
+    #include "audio.h"
+#endif /* AUDIO_ENABLE */
+
+
 
 #define wdt_intr_enable(value)   \
 __asm__ __volatile__ (  \
@@ -64,6 +71,18 @@ static void power_down(uint8_t wdto)
     // Watchdog Interrupt Mode
     wdt_intr_enable(wdto);
 
+#ifdef BACKLIGHT_ENABLE
+       backlight_set(0);
+#endif
+
+       // Turn off LED indicators
+       led_set(0);
+
+       #ifdef AUDIO_ENABLE
+        // This sometimes disables the start-up noise, so it's been disabled
+               // stop_all_notes();
+       #endif /* AUDIO_ENABLE */
+
     // TODO: more power saving
     // See PicoPower application note
     // - I/O port input with pullup
@@ -89,6 +108,9 @@ __attribute__ ((weak)) void matrix_power_up(void) {}
 __attribute__ ((weak)) void matrix_power_down(void) {}
 bool suspend_wakeup_condition(void)
 {
+#ifdef BACKLIGHT_ENABLE
+    backlight_set(0);
+#endif
     matrix_power_up();
     matrix_scan();
     matrix_power_down();
@@ -104,8 +126,10 @@ void suspend_wakeup_init(void)
     // clear keyboard state
     clear_keyboard();
 #ifdef BACKLIGHT_ENABLE
+    backlight_set(0);
     backlight_init();
 #endif
+led_set(host_keyboard_leds());
 }
 
 #ifndef NO_SUSPEND_POWER_DOWN
@@ -122,3 +146,4 @@ ISR(WDT_vect)
     }
 }
 #endif
+