Skip to content

Commit 3202ca3

Browse files
committed
core: Add suspend mode options
1 parent 4cda3aa commit 3202ca3

File tree

1 file changed

+30
-10
lines changed

1 file changed

+30
-10
lines changed

common/avr/suspend.c

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,6 @@ __asm__ __volatile__ ( \
3030
)
3131

3232

33-
void suspend_idle(uint8_t time)
34-
{
35-
cli();
36-
set_sleep_mode(SLEEP_MODE_IDLE);
37-
sleep_enable();
38-
sei();
39-
sleep_cpu();
40-
sleep_disable();
41-
}
42-
4333
/* Power down MCU with watchdog timer
4434
* wdto: watchdog timer timeout defined in <avr/wdt.h>
4535
* WDTO_15MS
@@ -80,9 +70,39 @@ static void power_down(uint8_t wdto)
8070
wdt_disable();
8171
}
8272

73+
static void standby(void)
74+
{
75+
set_sleep_mode(SLEEP_MODE_STANDBY);
76+
sleep_enable();
77+
sei();
78+
sleep_cpu();
79+
sleep_disable();
80+
}
81+
82+
static void idle(void)
83+
{
84+
set_sleep_mode(SLEEP_MODE_IDLE);
85+
sleep_enable();
86+
sei();
87+
sleep_cpu();
88+
sleep_disable();
89+
}
90+
91+
92+
void suspend_idle(uint8_t time)
93+
{
94+
idle();
95+
}
96+
8397
void suspend_power_down(void)
8498
{
99+
#ifdef SUSPEND_MODE_STANDBY
100+
standby();
101+
#elif defined(SUSPEND_MODE_IDLE)
102+
idle();
103+
#else
85104
power_down(WDTO_15MS);
105+
#endif
86106
}
87107

88108
__attribute__ ((weak)) void matrix_power_up(void) {}

0 commit comments

Comments
 (0)