aboutsummaryrefslogtreecommitdiff
path: root/tmk_core/common/avr
diff options
context:
space:
mode:
authorDrashna Jaelre <drashna@live.com>2018-06-03 14:57:35 -0700
committerJack Humbert <jack.humb@gmail.com>2018-06-03 17:57:35 -0400
commitcb91320d6d8836dd13db19bd2434abe2e7cadc20 (patch)
treebf0d08f1560a3928ef21ca80d4ac953d09dd71c7 /tmk_core/common/avr
parent692a77c2dd8a369f6ae6efa22270d1bdeb551f0b (diff)
downloadqmk_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/avr')
-rw-r--r--tmk_core/common/avr/suspend.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/tmk_core/common/avr/suspend.c b/tmk_core/common/avr/suspend.c
index 3aa3d1247..dfa1af273 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)
72 */ 72 */
73static uint8_t wdt_timeout = 0; 73static uint8_t wdt_timeout = 0;
74 74
75/** \brief Run keyboard level Power down
76 *
77 * FIXME: needs doc
78 */
79__attribute__ ((weak))
80void suspend_power_down_user (void) { }
81/** \brief Run keyboard level Power down
82 *
83 * FIXME: needs doc
84 */
85__attribute__ ((weak))
86void suspend_power_down_kb(void) {
87 suspend_power_down_user();
88}
89
75/** \brief Power down 90/** \brief Power down
76 * 91 *
77 * FIXME: needs doc 92 * FIXME: needs doc
@@ -103,6 +118,8 @@ static void power_down(uint8_t wdto)
103#endif 118#endif
104 rgblight_disable_noeeprom(); 119 rgblight_disable_noeeprom();
105#endif 120#endif
121 suspend_power_down_kb();
122
106 // TODO: more power saving 123 // TODO: more power saving
107 // See PicoPower application note 124 // See PicoPower application note
108 // - I/O port input with pullup 125 // - I/O port input with pullup
@@ -144,6 +161,21 @@ bool suspend_wakeup_condition(void)
144 return false; 161 return false;
145} 162}
146 163
164/** \brief run user level code immediately after wakeup
165 *
166 * FIXME: needs doc
167 */
168__attribute__ ((weak))
169void suspend_wakeup_init_user(void) { }
170
171/** \brief run keyboard level code immediately after wakeup
172 *
173 * FIXME: needs doc
174 */
175__attribute__ ((weak))
176void suspend_wakeup_init_kb(void) {
177 suspend_wakeup_init_user();
178}
147/** \brief run immediately after wakeup 179/** \brief run immediately after wakeup
148 * 180 *
149 * FIXME: needs doc 181 * FIXME: needs doc
@@ -162,6 +194,7 @@ void suspend_wakeup_init(void)
162 rgblight_timer_enable(); 194 rgblight_timer_enable();
163#endif 195#endif
164#endif 196#endif
197 suspend_wakeup_init_kb();
165} 198}
166 199
167#ifndef NO_SUSPEND_POWER_DOWN 200#ifndef NO_SUSPEND_POWER_DOWN