aboutsummaryrefslogtreecommitdiff
path: root/tmk_core/common/avr/suspend.c
diff options
context:
space:
mode:
authorJack Humbert <jack.humb@gmail.com>2018-06-12 10:59:35 -0400
committerJack Humbert <jack.humb@gmail.com>2018-06-12 10:59:35 -0400
commit998ddbb122c9d3e2a77bd4e88c881b225ca0d569 (patch)
treeca91ff7ad3c4866555d1e623fe9ea05276397e1c /tmk_core/common/avr/suspend.c
parentc0095710a7c7e9bd94aa9f4dd814dc28d718c731 (diff)
parent06487daaddf923d635e8a528d1eb644b875a73f6 (diff)
Merge branch 'master' of github.com:qmk/qmk_firmware into hf/shinydox
Diffstat (limited to 'tmk_core/common/avr/suspend.c')
-rw-r--r--tmk_core/common/avr/suspend.c37
1 files changed, 35 insertions, 2 deletions
diff --git a/tmk_core/common/avr/suspend.c b/tmk_core/common/avr/suspend.c
index 81e4266410..dfa1af273c 100644
--- a/tmk_core/common/avr/suspend.c
+++ b/tmk_core/common/avr/suspend.c
@@ -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