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:
Drashna Jaelre 2018-06-03 14:57:35 -07:00 committed by Jack Humbert
parent 692a77c2dd
commit cb91320d6d
4 changed files with 104 additions and 2 deletions

View file

@ -21,6 +21,21 @@ void suspend_idle(uint8_t time) {
wait_ms(time);
}
/** \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 suspend power down
*
* FIXME: needs doc
@ -30,6 +45,7 @@ void suspend_power_down(void) {
// shouldn't power down TPM/FTM if we want a breathing LED
// also shouldn't power down USB
suspend_power_down_kb();
// on AVR, this enables the watchdog for 15ms (max), and goes to
// SLEEP_MODE_PWR_DOWN
@ -53,6 +69,22 @@ 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_power_down_user();
}
/** \brief suspend wakeup condition
*
* run immediately after wakeup
@ -79,4 +111,5 @@ void suspend_wakeup_init(void)
#ifdef BACKLIGHT_ENABLE
backlight_init();
#endif /* BACKLIGHT_ENABLE */
suspend_wakeup_init_kb();
}