aboutsummaryrefslogtreecommitdiff
path: root/tmk_core/common/chibios/suspend.c
diff options
context:
space:
mode:
Diffstat (limited to 'tmk_core/common/chibios/suspend.c')
-rw-r--r--tmk_core/common/chibios/suspend.c46
1 files changed, 18 insertions, 28 deletions
diff --git a/tmk_core/common/chibios/suspend.c b/tmk_core/common/chibios/suspend.c
index 6027d69b7..ae1c6f53e 100644
--- a/tmk_core/common/chibios/suspend.c
+++ b/tmk_core/common/chibios/suspend.c
@@ -17,49 +17,44 @@
17 * FIXME: needs doc 17 * FIXME: needs doc
18 */ 18 */
19void suspend_idle(uint8_t time) { 19void suspend_idle(uint8_t time) {
20 // TODO: this is not used anywhere - what units is 'time' in? 20 // TODO: this is not used anywhere - what units is 'time' in?
21 wait_ms(time); 21 wait_ms(time);
22} 22}
23 23
24/** \brief Run keyboard level Power down 24/** \brief Run keyboard level Power down
25 * 25 *
26 * FIXME: needs doc 26 * FIXME: needs doc
27 */ 27 */
28__attribute__ ((weak)) 28__attribute__((weak)) void suspend_power_down_user(void) {}
29void suspend_power_down_user (void) { }
30/** \brief Run keyboard level Power down 29/** \brief Run keyboard level Power down
31 * 30 *
32 * FIXME: needs doc 31 * FIXME: needs doc
33 */ 32 */
34__attribute__ ((weak)) 33__attribute__((weak)) void suspend_power_down_kb(void) { suspend_power_down_user(); }
35void suspend_power_down_kb(void) {
36 suspend_power_down_user();
37}
38 34
39/** \brief suspend power down 35/** \brief suspend power down
40 * 36 *
41 * FIXME: needs doc 37 * FIXME: needs doc
42 */ 38 */
43void suspend_power_down(void) { 39void suspend_power_down(void) {
44 // TODO: figure out what to power down and how 40 // TODO: figure out what to power down and how
45 // shouldn't power down TPM/FTM if we want a breathing LED 41 // shouldn't power down TPM/FTM if we want a breathing LED
46 // also shouldn't power down USB 42 // also shouldn't power down USB
47 43
48 suspend_power_down_kb(); 44 suspend_power_down_kb();
49 // on AVR, this enables the watchdog for 15ms (max), and goes to 45 // on AVR, this enables the watchdog for 15ms (max), and goes to
50 // SLEEP_MODE_PWR_DOWN 46 // SLEEP_MODE_PWR_DOWN
51 47
52 wait_ms(17); 48 wait_ms(17);
53} 49}
54 50
55/** \brief suspend wakeup condition 51/** \brief suspend wakeup condition
56 * 52 *
57 * FIXME: needs doc 53 * FIXME: needs doc
58 */ 54 */
59__attribute__ ((weak)) void matrix_power_up(void) {} 55__attribute__((weak)) void matrix_power_up(void) {}
60__attribute__ ((weak)) void matrix_power_down(void) {} 56__attribute__((weak)) void matrix_power_down(void) {}
61bool suspend_wakeup_condition(void) 57bool suspend_wakeup_condition(void) {
62{
63 matrix_power_up(); 58 matrix_power_up();
64 matrix_scan(); 59 matrix_scan();
65 matrix_power_down(); 60 matrix_power_down();
@@ -73,25 +68,20 @@ bool suspend_wakeup_condition(void)
73 * 68 *
74 * FIXME: needs doc 69 * FIXME: needs doc
75 */ 70 */
76__attribute__ ((weak)) 71__attribute__((weak)) void suspend_wakeup_init_user(void) {}
77void suspend_wakeup_init_user(void) { }
78 72
79/** \brief run keyboard level code immediately after wakeup 73/** \brief run keyboard level code immediately after wakeup
80 * 74 *
81 * FIXME: needs doc 75 * FIXME: needs doc
82 */ 76 */
83__attribute__ ((weak)) 77__attribute__((weak)) void suspend_wakeup_init_kb(void) { suspend_wakeup_init_user(); }
84void suspend_wakeup_init_kb(void) {
85 suspend_wakeup_init_user();
86}
87 78
88/** \brief suspend wakeup condition 79/** \brief suspend wakeup condition
89 * 80 *
90 * run immediately after wakeup 81 * run immediately after wakeup
91 * FIXME: needs doc 82 * FIXME: needs doc
92 */ 83 */
93void suspend_wakeup_init(void) 84void suspend_wakeup_init(void) {
94{
95 // clear keyboard state 85 // clear keyboard state
96 // need to do it manually, because we're running from ISR 86 // need to do it manually, because we're running from ISR
97 // and clear_keyboard() calls print 87 // and clear_keyboard() calls print
@@ -111,5 +101,5 @@ void suspend_wakeup_init(void)
111#ifdef BACKLIGHT_ENABLE 101#ifdef BACKLIGHT_ENABLE
112 backlight_init(); 102 backlight_init();
113#endif /* BACKLIGHT_ENABLE */ 103#endif /* BACKLIGHT_ENABLE */
114 suspend_wakeup_init_kb(); 104 suspend_wakeup_init_kb();
115} 105}