1
0

Improve behavior of suspend

- Add suspend action for user defined suspend behavior
- Disable softpwm led when suspending
This commit is contained in:
Kai Ryu 2015-01-05 10:43:32 +09:00
parent 9794deaada
commit 74397b510e
2 changed files with 29 additions and 1 deletions

View File

@ -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

View File

@ -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