core: Fix sleep_led
This commit is contained in:
parent
e7b8da47ce
commit
5969d6267f
@ -45,10 +45,17 @@ void sleep_led_disable(void)
|
|||||||
TIMSK1 &= ~_BV(OCIE1A);
|
TIMSK1 &= ~_BV(OCIE1A);
|
||||||
}
|
}
|
||||||
|
|
||||||
void sleep_led_toggle(void)
|
|
||||||
|
__attribute__ ((weak))
|
||||||
|
void sleep_led_on(void)
|
||||||
{
|
{
|
||||||
/* Disable Compare Match Interrupt */
|
led_set(1<<USB_LED_CAPS_LOCK);
|
||||||
TIMSK1 ^= _BV(OCIE1A);
|
}
|
||||||
|
|
||||||
|
__attribute__ ((weak))
|
||||||
|
void sleep_led_off(void)
|
||||||
|
{
|
||||||
|
led_set(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -86,10 +93,10 @@ ISR(TIMER1_COMPA_vect)
|
|||||||
|
|
||||||
// LED on
|
// LED on
|
||||||
if (timer.pwm.count == 0) {
|
if (timer.pwm.count == 0) {
|
||||||
led_set(1<<USB_LED_CAPS_LOCK);
|
sleep_led_on();
|
||||||
}
|
}
|
||||||
// LED off
|
// LED off
|
||||||
if (timer.pwm.count == pgm_read_byte(&breathing_table[timer.pwm.index])) {
|
if (timer.pwm.count == pgm_read_byte(&breathing_table[timer.pwm.index])) {
|
||||||
led_set(0);
|
sleep_led_off();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -96,7 +96,11 @@ void suspend_idle(uint8_t time)
|
|||||||
|
|
||||||
void suspend_power_down(void)
|
void suspend_power_down(void)
|
||||||
{
|
{
|
||||||
#ifdef SUSPEND_MODE_STANDBY
|
#ifdef NO_SUSPEND_POWER_DOWN
|
||||||
|
;
|
||||||
|
#elif defined(SUSPEND_MODE_NOPOWERSAVE)
|
||||||
|
;
|
||||||
|
#elif defined(SUSPEND_MODE_STANDBY)
|
||||||
standby();
|
standby();
|
||||||
#elif defined(SUSPEND_MODE_IDLE)
|
#elif defined(SUSPEND_MODE_IDLE)
|
||||||
idle();
|
idle();
|
||||||
|
@ -182,14 +182,22 @@ static bool command_common(uint8_t code)
|
|||||||
{
|
{
|
||||||
#ifdef KEYBOARD_LOCK_ENABLE
|
#ifdef KEYBOARD_LOCK_ENABLE
|
||||||
static host_driver_t *host_driver = 0;
|
static host_driver_t *host_driver = 0;
|
||||||
|
#endif
|
||||||
|
#ifdef SLEEP_LED_ENABLE
|
||||||
|
static bool sleep_led_test = false;
|
||||||
#endif
|
#endif
|
||||||
switch (code) {
|
switch (code) {
|
||||||
#ifdef SLEEP_LED_ENABLE
|
#ifdef SLEEP_LED_ENABLE
|
||||||
case KC_Z:
|
case KC_Z:
|
||||||
// test breathing sleep LED
|
// test breathing sleep LED
|
||||||
print("Sleep LED test\n");
|
print("Sleep LED test\n");
|
||||||
sleep_led_toggle();
|
if (sleep_led_test) {
|
||||||
|
sleep_led_disable();
|
||||||
led_set(host_keyboard_leds());
|
led_set(host_keyboard_leds());
|
||||||
|
} else {
|
||||||
|
sleep_led_enable();
|
||||||
|
}
|
||||||
|
sleep_led_test = !sleep_led_test;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#ifdef BOOTMAGIC_ENABLE
|
#ifdef BOOTMAGIC_ENABLE
|
||||||
|
@ -2,20 +2,10 @@
|
|||||||
#define SLEEP_LED_H
|
#define SLEEP_LED_H
|
||||||
|
|
||||||
|
|
||||||
#ifdef SLEEP_LED_ENABLE
|
|
||||||
|
|
||||||
void sleep_led_init(void);
|
void sleep_led_init(void);
|
||||||
void sleep_led_enable(void);
|
void sleep_led_enable(void);
|
||||||
void sleep_led_disable(void);
|
void sleep_led_disable(void);
|
||||||
void sleep_led_toggle(void);
|
void sleep_led_on(void);
|
||||||
|
void sleep_led_off(void);
|
||||||
#else
|
|
||||||
|
|
||||||
#define sleep_led_init()
|
|
||||||
#define sleep_led_enable()
|
|
||||||
#define sleep_led_disable()
|
|
||||||
#define sleep_led_toggle()
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user