]> git.donarmstrong.com Git - qmk_firmware.git/commitdiff
Backlight fix from reddit
authorPeter Eichinger <peter.eichinger@gmail.com>
Fri, 22 Jan 2016 16:37:22 +0000 (17:37 +0100)
committerPeter Eichinger <peter.eichinger@gmail.com>
Fri, 22 Jan 2016 16:37:22 +0000 (17:37 +0100)
https://www.reddit.com/r/olkb/comments/41ur41/crazy_flashing_when_my_computer_sleeps/

tmk_core/common/avr/suspend.c

index af99f52b5ee18336f4f332eddf5c37bd9ab5b108..22c402b0257653217ea5daf9e2a669eeb6c759db 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,12 @@ static void power_down(uint8_t wdto)
     // Watchdog Interrupt Mode
     wdt_intr_enable(wdto);
 
+#ifdef BACKLIGHT_ENABLE
+backlight_set(0);
+#endif
+
+    led_off();
+
     // TODO: more power saving
     // See PicoPower application note
     // - I/O port input with pullup
@@ -89,6 +96,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 +114,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 +134,4 @@ ISR(WDT_vect)
     }
 }
 #endif
+