X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=tmk_core%2Fcommon%2Favr%2Fsuspend.c;h=dfa1af273c0b238aea6e7fe7933a248b6c67a2f4;hb=998ddbb122c9d3e2a77bd4e88c881b225ca0d569;hp=4cdd6a420e788e0fe9f392ef14764d1af5214596;hpb=7c9d5ace143d3cc6d767a354acde814926d566fd;p=qmk_firmware.git diff --git a/tmk_core/common/avr/suspend.c b/tmk_core/common/avr/suspend.c index 4cdd6a420..dfa1af273 100644 --- a/tmk_core/common/avr/suspend.c +++ b/tmk_core/common/avr/suspend.c @@ -19,7 +19,7 @@ #include "audio.h" #endif /* AUDIO_ENABLE */ -#ifdef RGBLIGHT_ANIMATIONS +#ifdef RGBLIGHT_SLEEP #include "rgblight.h" #endif @@ -72,6 +72,21 @@ void suspend_idle(uint8_t time) */ static uint8_t wdt_timeout = 0; +/** \brief Run keyboard level Power down + * + * FIXME: needs doc + */ +__attribute__ ((weak)) +void suspend_power_down_user (void) { } +/** \brief Run keyboard level Power down + * + * FIXME: needs doc + */ +__attribute__ ((weak)) +void suspend_power_down_kb(void) { + suspend_power_down_user(); +} + /** \brief Power down * * FIXME: needs doc @@ -101,8 +116,10 @@ static void power_down(uint8_t wdto) #ifdef RGBLIGHT_ANIMATIONS rgblight_timer_disable(); #endif - rgblight_disable(); + rgblight_disable_noeeprom(); #endif + suspend_power_down_kb(); + // TODO: more power saving // See PicoPower application note // - I/O port input with pullup @@ -144,6 +161,21 @@ bool suspend_wakeup_condition(void) return false; } +/** \brief run user level code immediately after wakeup + * + * FIXME: needs doc + */ +__attribute__ ((weak)) +void suspend_wakeup_init_user(void) { } + +/** \brief run keyboard level code immediately after wakeup + * + * FIXME: needs doc + */ +__attribute__ ((weak)) +void suspend_wakeup_init_kb(void) { + suspend_wakeup_init_user(); +} /** \brief run immediately after wakeup * * FIXME: needs doc @@ -157,11 +189,12 @@ void suspend_wakeup_init(void) #endif led_set(host_keyboard_leds()); #ifdef RGBLIGHT_SLEEP - rgblight_enable(); + rgblight_enable_noeeprom(); #ifdef RGBLIGHT_ANIMATIONS rgblight_timer_enable(); #endif #endif + suspend_wakeup_init_kb(); } #ifndef NO_SUSPEND_POWER_DOWN