aboutsummaryrefslogtreecommitdiff
path: root/tmk_core/common/avr/suspend.c
diff options
context:
space:
mode:
Diffstat (limited to 'tmk_core/common/avr/suspend.c')
-rw-r--r--tmk_core/common/avr/suspend.c41
1 files changed, 25 insertions, 16 deletions
diff --git a/tmk_core/common/avr/suspend.c b/tmk_core/common/avr/suspend.c
index 3d4a48439..5bca64685 100644
--- a/tmk_core/common/avr/suspend.c
+++ b/tmk_core/common/avr/suspend.c
@@ -10,6 +10,7 @@
10#include "timer.h" 10#include "timer.h"
11#include "led.h" 11#include "led.h"
12#include "host.h" 12#include "host.h"
13#include "rgblight_reconfig.h"
13 14
14#ifdef PROTOCOL_LUFA 15#ifdef PROTOCOL_LUFA
15 #include "lufa.h" 16 #include "lufa.h"
@@ -55,6 +56,24 @@ void suspend_idle(uint8_t time)
55 sleep_disable(); 56 sleep_disable();
56} 57}
57 58
59
60// TODO: This needs some cleanup
61
62/** \brief Run keyboard level Power down
63 *
64 * FIXME: needs doc
65 */
66__attribute__ ((weak))
67void suspend_power_down_user (void) { }
68/** \brief Run keyboard level Power down
69 *
70 * FIXME: needs doc
71 */
72__attribute__ ((weak))
73void suspend_power_down_kb(void) {
74 suspend_power_down_user();
75}
76
58#ifndef NO_SUSPEND_POWER_DOWN 77#ifndef NO_SUSPEND_POWER_DOWN
59/** \brief Power down MCU with watchdog timer 78/** \brief Power down MCU with watchdog timer
60 * 79 *
@@ -72,21 +91,6 @@ void suspend_idle(uint8_t time)
72 */ 91 */
73static uint8_t wdt_timeout = 0; 92static uint8_t wdt_timeout = 0;
74 93
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
90/** \brief Power down 94/** \brief Power down
91 * 95 *
92 * FIXME: needs doc 96 * FIXME: needs doc
@@ -143,6 +147,8 @@ static void power_down(uint8_t wdto)
143 */ 147 */
144void suspend_power_down(void) 148void suspend_power_down(void)
145{ 149{
150 suspend_power_down_kb();
151
146#ifndef NO_SUSPEND_POWER_DOWN 152#ifndef NO_SUSPEND_POWER_DOWN
147 power_down(WDTO_15MS); 153 power_down(WDTO_15MS);
148#endif 154#endif
@@ -189,12 +195,15 @@ void suspend_wakeup_init(void)
189#endif 195#endif
190 led_set(host_keyboard_leds()); 196 led_set(host_keyboard_leds());
191#if defined(RGBLIGHT_SLEEP) && defined(RGBLIGHT_ENABLE) 197#if defined(RGBLIGHT_SLEEP) && defined(RGBLIGHT_ENABLE)
198#ifdef BOOTLOADER_TEENSY
199 wait_ms(10);
200#endif
192 rgblight_enable_noeeprom(); 201 rgblight_enable_noeeprom();
193#ifdef RGBLIGHT_ANIMATIONS 202#ifdef RGBLIGHT_ANIMATIONS
194 rgblight_timer_enable(); 203 rgblight_timer_enable();
195#endif 204#endif
196#endif 205#endif
197 suspend_wakeup_init_kb(); 206 suspend_wakeup_init_kb();
198} 207}
199 208
200#ifndef NO_SUSPEND_POWER_DOWN 209#ifndef NO_SUSPEND_POWER_DOWN