forked from mirrors/qmk_firmware
Merge remote-tracking branch 'origin/master' into develop
This commit is contained in:
commit
6f9db2b48e
4 changed files with 50 additions and 29 deletions
|
@ -98,6 +98,11 @@ rgblight_config_t rgblight_config;
|
||||||
rgblight_status_t rgblight_status = {.timer_enabled = false};
|
rgblight_status_t rgblight_status = {.timer_enabled = false};
|
||||||
bool is_rgblight_initialized = false;
|
bool is_rgblight_initialized = false;
|
||||||
|
|
||||||
|
#ifdef RGBLIGHT_SLEEP
|
||||||
|
static bool is_suspended;
|
||||||
|
static bool pre_suspend_enabled;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef RGBLIGHT_USE_TIMER
|
#ifdef RGBLIGHT_USE_TIMER
|
||||||
animation_status_t animation_status = {};
|
animation_status_t animation_status = {};
|
||||||
#endif
|
#endif
|
||||||
|
@ -709,6 +714,42 @@ void rgblight_unblink_layers(void) {
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef RGBLIGHT_SLEEP
|
||||||
|
|
||||||
|
void rgblight_suspend(void) {
|
||||||
|
rgblight_timer_disable();
|
||||||
|
if (!is_suspended) {
|
||||||
|
is_suspended = true;
|
||||||
|
pre_suspend_enabled = rgblight_config.enable;
|
||||||
|
|
||||||
|
# ifdef RGBLIGHT_LAYER_BLINK
|
||||||
|
// make sure any layer blinks don't come back after suspend
|
||||||
|
rgblight_status.enabled_layer_mask &= ~_blinked_layer_mask;
|
||||||
|
_blinked_layer_mask = 0;
|
||||||
|
# endif
|
||||||
|
|
||||||
|
rgblight_disable_noeeprom();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void rgblight_wakeup(void) {
|
||||||
|
is_suspended = false;
|
||||||
|
|
||||||
|
if (pre_suspend_enabled) {
|
||||||
|
rgblight_enable_noeeprom();
|
||||||
|
}
|
||||||
|
# ifdef RGBLIGHT_LAYERS_OVERRIDE_RGB_OFF
|
||||||
|
// Need this or else the LEDs won't be set
|
||||||
|
else if (rgblight_status.enabled_layer_mask != 0) {
|
||||||
|
rgblight_set();
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
|
||||||
|
rgblight_timer_enable();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
__attribute__((weak)) void rgblight_call_driver(LED_TYPE *start_led, uint8_t num_leds) { ws2812_setleds(start_led, num_leds); }
|
__attribute__((weak)) void rgblight_call_driver(LED_TYPE *start_led, uint8_t num_leds) { ws2812_setleds(start_led, num_leds); }
|
||||||
|
|
||||||
#ifndef RGBLIGHT_CUSTOM_DRIVER
|
#ifndef RGBLIGHT_CUSTOM_DRIVER
|
||||||
|
@ -730,8 +771,10 @@ void rgblight_set(void) {
|
||||||
|
|
||||||
# ifdef RGBLIGHT_LAYERS
|
# ifdef RGBLIGHT_LAYERS
|
||||||
if (rgblight_layers != NULL
|
if (rgblight_layers != NULL
|
||||||
# ifndef RGBLIGHT_LAYERS_OVERRIDE_RGB_OFF
|
# if !defined(RGBLIGHT_LAYERS_OVERRIDE_RGB_OFF)
|
||||||
&& rgblight_config.enable
|
&& rgblight_config.enable
|
||||||
|
# elif defined(RGBLIGHT_SLEEP)
|
||||||
|
&& !is_suspended
|
||||||
# endif
|
# endif
|
||||||
) {
|
) {
|
||||||
rgblight_layers_write();
|
rgblight_layers_write();
|
||||||
|
|
|
@ -357,6 +357,8 @@ HSV rgblight_get_hsv(void);
|
||||||
|
|
||||||
/* === qmk_firmware (core)internal Functions === */
|
/* === qmk_firmware (core)internal Functions === */
|
||||||
void rgblight_init(void);
|
void rgblight_init(void);
|
||||||
|
void rgblight_suspend(void);
|
||||||
|
void rgblight_wakeup(void);
|
||||||
uint32_t rgblight_read_dword(void);
|
uint32_t rgblight_read_dword(void);
|
||||||
void rgblight_update_dword(uint32_t dword);
|
void rgblight_update_dword(uint32_t dword);
|
||||||
uint32_t eeconfig_read_rgblight(void);
|
uint32_t eeconfig_read_rgblight(void);
|
||||||
|
|
|
@ -24,9 +24,6 @@
|
||||||
|
|
||||||
#if defined(RGBLIGHT_SLEEP) && defined(RGBLIGHT_ENABLE)
|
#if defined(RGBLIGHT_SLEEP) && defined(RGBLIGHT_ENABLE)
|
||||||
# include "rgblight.h"
|
# include "rgblight.h"
|
||||||
extern rgblight_config_t rgblight_config;
|
|
||||||
static bool rgblight_enabled;
|
|
||||||
static bool is_suspended;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/** \brief Suspend idle
|
/** \brief Suspend idle
|
||||||
|
@ -104,12 +101,7 @@ static void power_down(uint8_t wdto) {
|
||||||
// stop_all_notes();
|
// stop_all_notes();
|
||||||
# endif /* AUDIO_ENABLE */
|
# endif /* AUDIO_ENABLE */
|
||||||
# if defined(RGBLIGHT_SLEEP) && defined(RGBLIGHT_ENABLE)
|
# if defined(RGBLIGHT_SLEEP) && defined(RGBLIGHT_ENABLE)
|
||||||
rgblight_timer_disable();
|
rgblight_suspend();
|
||||||
if (!is_suspended) {
|
|
||||||
is_suspended = true;
|
|
||||||
rgblight_enabled = rgblight_config.enable;
|
|
||||||
rgblight_disable_noeeprom();
|
|
||||||
}
|
|
||||||
# endif
|
# endif
|
||||||
suspend_power_down_kb();
|
suspend_power_down_kb();
|
||||||
|
|
||||||
|
@ -177,11 +169,7 @@ void suspend_wakeup_init(void) {
|
||||||
#endif
|
#endif
|
||||||
led_set(host_keyboard_leds());
|
led_set(host_keyboard_leds());
|
||||||
#if defined(RGBLIGHT_SLEEP) && defined(RGBLIGHT_ENABLE)
|
#if defined(RGBLIGHT_SLEEP) && defined(RGBLIGHT_ENABLE)
|
||||||
is_suspended = false;
|
rgblight_wakeup();
|
||||||
if (rgblight_enabled) {
|
|
||||||
rgblight_enable_noeeprom();
|
|
||||||
}
|
|
||||||
rgblight_timer_enable();
|
|
||||||
#endif
|
#endif
|
||||||
suspend_wakeup_init_kb();
|
suspend_wakeup_init_kb();
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,9 +18,6 @@
|
||||||
|
|
||||||
#if defined(RGBLIGHT_SLEEP) && defined(RGBLIGHT_ENABLE)
|
#if defined(RGBLIGHT_SLEEP) && defined(RGBLIGHT_ENABLE)
|
||||||
# include "rgblight.h"
|
# include "rgblight.h"
|
||||||
extern rgblight_config_t rgblight_config;
|
|
||||||
static bool rgblight_enabled;
|
|
||||||
static bool is_suspended;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/** \brief suspend idle
|
/** \brief suspend idle
|
||||||
|
@ -66,12 +63,7 @@ void suspend_power_down(void) {
|
||||||
// shouldn't power down TPM/FTM if we want a breathing LED
|
// shouldn't power down TPM/FTM if we want a breathing LED
|
||||||
// also shouldn't power down USB
|
// also shouldn't power down USB
|
||||||
#if defined(RGBLIGHT_SLEEP) && defined(RGBLIGHT_ENABLE)
|
#if defined(RGBLIGHT_SLEEP) && defined(RGBLIGHT_ENABLE)
|
||||||
rgblight_timer_disable();
|
rgblight_suspend();
|
||||||
if (!is_suspended) {
|
|
||||||
is_suspended = true;
|
|
||||||
rgblight_enabled = rgblight_config.enable;
|
|
||||||
rgblight_disable_noeeprom();
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
suspend_power_down_kb();
|
suspend_power_down_kb();
|
||||||
|
@ -136,11 +128,7 @@ void suspend_wakeup_init(void) {
|
||||||
#endif /* BACKLIGHT_ENABLE */
|
#endif /* BACKLIGHT_ENABLE */
|
||||||
led_set(host_keyboard_leds());
|
led_set(host_keyboard_leds());
|
||||||
#if defined(RGBLIGHT_SLEEP) && defined(RGBLIGHT_ENABLE)
|
#if defined(RGBLIGHT_SLEEP) && defined(RGBLIGHT_ENABLE)
|
||||||
is_suspended = false;
|
rgblight_wakeup();
|
||||||
if (rgblight_enabled) {
|
|
||||||
rgblight_enable_noeeprom();
|
|
||||||
}
|
|
||||||
rgblight_timer_enable();
|
|
||||||
#endif
|
#endif
|
||||||
suspend_wakeup_init_kb();
|
suspend_wakeup_init_kb();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue