diff options
| author | Drashna Jaelre <drashna@live.com> | 2018-06-03 14:57:35 -0700 |
|---|---|---|
| committer | Jack Humbert <jack.humb@gmail.com> | 2018-06-03 17:57:35 -0400 |
| commit | cb91320d6d8836dd13db19bd2434abe2e7cadc20 (patch) | |
| tree | bf0d08f1560a3928ef21ca80d4ac953d09dd71c7 /tmk_core/common/chibios | |
| parent | 692a77c2dd8a369f6ae6efa22270d1bdeb551f0b (diff) | |
| download | qmk_firmware-cb91320d6d8836dd13db19bd2434abe2e7cadc20.tar.gz qmk_firmware-cb91320d6d8836dd13db19bd2434abe2e7cadc20.zip | |
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
Diffstat (limited to 'tmk_core/common/chibios')
| -rw-r--r-- | tmk_core/common/chibios/suspend.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tmk_core/common/chibios/suspend.c b/tmk_core/common/chibios/suspend.c index 32ef773e2..4a119ccef 100644 --- a/tmk_core/common/chibios/suspend.c +++ b/tmk_core/common/chibios/suspend.c | |||
| @@ -21,6 +21,21 @@ void suspend_idle(uint8_t time) { | |||
| 21 | wait_ms(time); | 21 | wait_ms(time); |
| 22 | } | 22 | } |
| 23 | 23 | ||
| 24 | /** \brief Run keyboard level Power down | ||
| 25 | * | ||
| 26 | * FIXME: needs doc | ||
| 27 | */ | ||
| 28 | __attribute__ ((weak)) | ||
| 29 | void suspend_power_down_user (void) { } | ||
| 30 | /** \brief Run keyboard level Power down | ||
| 31 | * | ||
| 32 | * FIXME: needs doc | ||
| 33 | */ | ||
| 34 | __attribute__ ((weak)) | ||
| 35 | void suspend_power_down_kb(void) { | ||
| 36 | suspend_power_down_user(); | ||
| 37 | } | ||
| 38 | |||
| 24 | /** \brief suspend power down | 39 | /** \brief suspend power down |
| 25 | * | 40 | * |
| 26 | * FIXME: needs doc | 41 | * FIXME: needs doc |
| @@ -30,6 +45,7 @@ void suspend_power_down(void) { | |||
| 30 | // shouldn't power down TPM/FTM if we want a breathing LED | 45 | // shouldn't power down TPM/FTM if we want a breathing LED |
| 31 | // also shouldn't power down USB | 46 | // also shouldn't power down USB |
| 32 | 47 | ||
| 48 | suspend_power_down_kb(); | ||
| 33 | // on AVR, this enables the watchdog for 15ms (max), and goes to | 49 | // on AVR, this enables the watchdog for 15ms (max), and goes to |
| 34 | // SLEEP_MODE_PWR_DOWN | 50 | // SLEEP_MODE_PWR_DOWN |
| 35 | 51 | ||
| @@ -53,6 +69,22 @@ bool suspend_wakeup_condition(void) | |||
| 53 | return false; | 69 | return false; |
| 54 | } | 70 | } |
| 55 | 71 | ||
| 72 | /** \brief run user level code immediately after wakeup | ||
| 73 | * | ||
| 74 | * FIXME: needs doc | ||
| 75 | */ | ||
| 76 | __attribute__ ((weak)) | ||
| 77 | void suspend_wakeup_init_user(void) { } | ||
| 78 | |||
| 79 | /** \brief run keyboard level code immediately after wakeup | ||
| 80 | * | ||
| 81 | * FIXME: needs doc | ||
| 82 | */ | ||
| 83 | __attribute__ ((weak)) | ||
| 84 | void suspend_wakeup_init_kb(void) { | ||
| 85 | suspend_power_down_user(); | ||
| 86 | } | ||
| 87 | |||
| 56 | /** \brief suspend wakeup condition | 88 | /** \brief suspend wakeup condition |
| 57 | * | 89 | * |
| 58 | * run immediately after wakeup | 90 | * run immediately after wakeup |
| @@ -79,4 +111,5 @@ void suspend_wakeup_init(void) | |||
| 79 | #ifdef BACKLIGHT_ENABLE | 111 | #ifdef BACKLIGHT_ENABLE |
| 80 | backlight_init(); | 112 | backlight_init(); |
| 81 | #endif /* BACKLIGHT_ENABLE */ | 113 | #endif /* BACKLIGHT_ENABLE */ |
| 114 | suspend_wakeup_init_kb(); | ||
| 82 | } | 115 | } |
