Improve behavior of suspend
- Add suspend action for user defined suspend behavior - Disable softpwm led when suspending
This commit is contained in:
parent
9794deaada
commit
74397b510e
@ -5,6 +5,7 @@
|
||||
#include "matrix.h"
|
||||
#include "action.h"
|
||||
#include "backlight.h"
|
||||
#include "softpwm_led.h"
|
||||
#include "suspend_avr.h"
|
||||
#include "suspend.h"
|
||||
#ifdef PROTOCOL_LUFA
|
||||
@ -28,7 +29,6 @@ __asm__ __volatile__ ( \
|
||||
: "r0" \
|
||||
)
|
||||
|
||||
|
||||
void suspend_idle(uint8_t time)
|
||||
{
|
||||
cli();
|
||||
@ -68,6 +68,14 @@ void suspend_power_down(uint8_t wdto)
|
||||
// - BOD disable
|
||||
// - Power Reduction Register PRR
|
||||
|
||||
#ifdef SUSPEND_ACTION
|
||||
suspend_power_down_action();
|
||||
#endif
|
||||
|
||||
#ifdef SOFTPWM_LED_ENABLE
|
||||
softpwm_led_disable();
|
||||
#endif
|
||||
|
||||
set_sleep_mode(SLEEP_MODE_PWR_DOWN);
|
||||
sleep_enable();
|
||||
sei();
|
||||
@ -94,6 +102,9 @@ void suspend_wakeup_init(void)
|
||||
{
|
||||
// clear keyboard state
|
||||
clear_keyboard();
|
||||
#ifdef SUSPEND_ACTION
|
||||
suspend_wakeup_init_action();
|
||||
#endif
|
||||
#ifdef BACKLIGHT_ENABLE
|
||||
backlight_init();
|
||||
#endif
|
||||
@ -115,3 +126,15 @@ ISR(WDT_vect)
|
||||
*/
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef SUSPEND_ACTION
|
||||
__attribute__ ((weak))
|
||||
void suspend_power_down_action(void)
|
||||
{
|
||||
}
|
||||
|
||||
__attribute__ ((weak))
|
||||
void suspend_wakeup_init_action(void)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
@ -10,4 +10,9 @@ void suspend_power_down(uint8_t timeout);
|
||||
bool suspend_wakeup_condition(void);
|
||||
void suspend_wakeup_init(void);
|
||||
|
||||
#ifdef SUSPEND_ACTION
|
||||
void suspend_power_down_action(void);
|
||||
void suspend_wakeup_init_action(void);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user