forked from mirrors/qmk_userspace
Add Suspend functions (#3112)
* Add suspend functions * Disable RGB code if it's disabled * Add suspend code to ChibiOS for future compatibility * Add keyboard_init functions * Change where references so it will compile * Wrong command chained in wake up kb function * Fix non-feature file changes * Add documentation * Re-add matrix init docs * add rgblight code to example * Remove keyboard init stuff for separate PR
This commit is contained in:
parent
692a77c2dd
commit
cb91320d6d
4 changed files with 104 additions and 2 deletions
|
@ -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
|
||||
|
@ -103,6 +118,8 @@ static void power_down(uint8_t wdto)
|
|||
#endif
|
||||
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
|
||||
|
@ -162,6 +194,7 @@ void suspend_wakeup_init(void)
|
|||
rgblight_timer_enable();
|
||||
#endif
|
||||
#endif
|
||||
suspend_wakeup_init_kb();
|
||||
}
|
||||
|
||||
#ifndef NO_SUSPEND_POWER_DOWN
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue