]> git.donarmstrong.com Git - qmk_firmware.git/blobdiff - tmk_core/common/avr/suspend.c
Merge pull request #257 from VoodaGod/bone2planck
[qmk_firmware.git] / tmk_core / common / avr / suspend.c
index 80243f02bc7448d8a6880afad9718bdff11af4fd..c07c2801d5ef75e277ab1b460f0fcac826b13568 100644 (file)
@@ -8,6 +8,7 @@
 #include "suspend_avr.h"
 #include "suspend.h"
 #include "timer.h"
+#include "led.h"
 #ifdef PROTOCOL_LUFA
 #include "lufa.h"
 #endif
@@ -64,6 +65,13 @@ 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);
+
     // TODO: more power saving
     // See PicoPower application note
     // - I/O port input with pullup
@@ -85,8 +93,13 @@ void suspend_power_down(void)
     power_down(WDTO_15MS);
 }
 
+__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();
@@ -102,8 +115,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
@@ -120,3 +135,4 @@ ISR(WDT_vect)
     }
 }
 #endif
+