X-Git-Url: https://git.friedersdorff.com/?a=blobdiff_plain;f=common%2Fsuspend.c;h=5b378892f30f5112ec6725f8c22b619e592ec3f6;hb=589d99b448e6085513799fbb183f6389d4df408d;hp=397e0729a60959a9d0754c8423d2819e1315dde6;hpb=2c0bb5e7e620b0472f110d2cbc5768bb6d97eec5;p=max%2Ftmk_keyboard.git diff --git a/common/suspend.c b/common/suspend.c index 397e0729..5b378892 100644 --- a/common/suspend.c +++ b/common/suspend.c @@ -1,10 +1,14 @@ #include "suspend.h" #include "matrix.h" #include "action.h" +#include "backlight.h" void suspend_power_down(void) { +#ifdef BACKLIGHT_ENABLE + backlight_set(0); +#endif #ifndef NO_SUSPEND_POWER_DOWN // Enable watchdog to wake from MCU sleep cli(); @@ -44,8 +48,29 @@ bool suspend_wakeup_condition(void) return false; } +// run immediately after wakeup void suspend_wakeup_init(void) { - matrix_init(); + // clear keyboard state clear_keyboard(); +#ifdef BACKLIGHT_ENABLE + backlight_init(); +#endif +} + +#ifndef NO_SUSPEND_POWER_DOWN +/* watchdog timeout */ +ISR(WDT_vect) +{ + /* wakeup from MCU sleep mode */ +/* + // blink LED + static uint8_t led_state = 0; + static uint8_t led_count = 0; + led_count++; + if ((led_count & 0x07) == 0) { + led_set((led_state ^= (1<