mirror of
https://github.com/qmk/qmk_firmware.git
synced 2025-07-16 21:01:31 +00:00
Align sleep_led logic (#25395)
This commit is contained in:
parent
f39e08e2ba
commit
bc5c5e3251
@ -28,7 +28,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#include "action_layer.h"
|
||||
#include "action_util.h"
|
||||
#include "eeconfig.h"
|
||||
#include "sleep_led.h"
|
||||
#include "led.h"
|
||||
#include "command.h"
|
||||
#include "quantum.h"
|
||||
@ -39,6 +38,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
# include "backlight.h"
|
||||
#endif
|
||||
|
||||
#ifdef SLEEP_LED_ENABLE
|
||||
# include "sleep_led.h"
|
||||
#endif
|
||||
|
||||
#if defined(MOUSEKEY_ENABLE)
|
||||
# include "mousekey.h"
|
||||
#endif
|
||||
|
@ -17,6 +17,10 @@
|
||||
#include "quantum.h"
|
||||
#include "process_quantum.h"
|
||||
|
||||
#ifdef SLEEP_LED_ENABLE
|
||||
# include "sleep_led.h"
|
||||
#endif
|
||||
|
||||
#ifdef BACKLIGHT_ENABLE
|
||||
# include "process_backlight.h"
|
||||
#endif
|
||||
@ -487,6 +491,10 @@ void suspend_power_down_quantum(void) {
|
||||
backlight_level_noeeprom(0);
|
||||
# endif
|
||||
|
||||
# ifdef SLEEP_LED_ENABLE
|
||||
sleep_led_enable();
|
||||
# endif
|
||||
|
||||
# ifdef LED_MATRIX_ENABLE
|
||||
led_matrix_task();
|
||||
# endif
|
||||
@ -533,6 +541,10 @@ __attribute__((weak)) void suspend_wakeup_init_quantum(void) {
|
||||
backlight_init();
|
||||
#endif
|
||||
|
||||
#ifdef SLEEP_LED_ENABLE
|
||||
sleep_led_disable();
|
||||
#endif
|
||||
|
||||
// Restore LED indicators
|
||||
led_wakeup();
|
||||
|
||||
|
@ -40,9 +40,6 @@
|
||||
# define EARLY_INIT_PERFORM_BOOTLOADER_JUMP FALSE
|
||||
#endif
|
||||
|
||||
#ifdef SLEEP_LED_ENABLE
|
||||
# include "sleep_led.h"
|
||||
#endif
|
||||
#ifdef MIDI_ENABLE
|
||||
# include "qmk_midi.h"
|
||||
#endif
|
||||
|
@ -21,10 +21,6 @@
|
||||
#include "host.h"
|
||||
#include "suspend.h"
|
||||
#include "timer.h"
|
||||
#ifdef SLEEP_LED_ENABLE
|
||||
# include "sleep_led.h"
|
||||
# include "led.h"
|
||||
#endif
|
||||
#include "wait.h"
|
||||
#include "usb_endpoints.h"
|
||||
#include "usb_device_state.h"
|
||||
@ -131,19 +127,11 @@ static inline bool usb_event_queue_dequeue(usbevent_t *event) {
|
||||
|
||||
static inline void usb_event_suspend_handler(void) {
|
||||
usb_device_state_set_suspend(USB_DRIVER.configuration != 0, USB_DRIVER.configuration);
|
||||
#ifdef SLEEP_LED_ENABLE
|
||||
sleep_led_enable();
|
||||
#endif /* SLEEP_LED_ENABLE */
|
||||
}
|
||||
|
||||
static inline void usb_event_wakeup_handler(void) {
|
||||
suspend_wakeup_init();
|
||||
usb_device_state_set_resume(USB_DRIVER.configuration != 0, USB_DRIVER.configuration);
|
||||
#ifdef SLEEP_LED_ENABLE
|
||||
sleep_led_disable();
|
||||
// NOTE: converters may not accept this
|
||||
led_set(host_keyboard_leds());
|
||||
#endif /* SLEEP_LED_ENABLE */
|
||||
}
|
||||
|
||||
bool last_suspend_state = false;
|
||||
|
@ -44,9 +44,6 @@
|
||||
#include "led.h"
|
||||
#include "sendchar.h"
|
||||
#include "debug.h"
|
||||
#ifdef SLEEP_LED_ENABLE
|
||||
# include "sleep_led.h"
|
||||
#endif
|
||||
#include "suspend.h"
|
||||
#include "wait.h"
|
||||
|
||||
@ -278,10 +275,6 @@ void EVENT_USB_Device_Reset(void) {
|
||||
void EVENT_USB_Device_Suspend(void) {
|
||||
print("[S]");
|
||||
usb_device_state_set_suspend(USB_Device_ConfigurationNumber != 0, USB_Device_ConfigurationNumber);
|
||||
|
||||
#ifdef SLEEP_LED_ENABLE
|
||||
sleep_led_enable();
|
||||
#endif
|
||||
}
|
||||
|
||||
/** \brief Event USB Device Connect
|
||||
@ -295,12 +288,6 @@ void EVENT_USB_Device_WakeUp(void) {
|
||||
#endif
|
||||
|
||||
usb_device_state_set_resume(USB_DeviceState == DEVICE_STATE_Configured, USB_Device_ConfigurationNumber);
|
||||
|
||||
#ifdef SLEEP_LED_ENABLE
|
||||
sleep_led_disable();
|
||||
// NOTE: converters may not accept this
|
||||
led_set(host_keyboard_leds());
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef CONSOLE_ENABLE
|
||||
|
@ -27,10 +27,6 @@
|
||||
#include "wait.h"
|
||||
#include "sendchar.h"
|
||||
|
||||
#ifdef SLEEP_LED_ENABLE
|
||||
# include "sleep_led.h"
|
||||
#endif
|
||||
|
||||
/* This is from main.c of USBaspLoader */
|
||||
static void initForUsbConnectivity(void) {
|
||||
uint8_t i = 0;
|
||||
@ -64,22 +60,6 @@ static inline void vusb_send_remote_wakeup(void) {
|
||||
|
||||
bool vusb_suspended = false;
|
||||
|
||||
static inline void vusb_suspend(void) {
|
||||
#ifdef SLEEP_LED_ENABLE
|
||||
sleep_led_enable();
|
||||
#endif
|
||||
|
||||
suspend_power_down();
|
||||
}
|
||||
|
||||
static inline void vusb_wakeup(void) {
|
||||
suspend_wakeup_init();
|
||||
|
||||
#ifdef SLEEP_LED_ENABLE
|
||||
sleep_led_disable();
|
||||
#endif
|
||||
}
|
||||
|
||||
/** \brief Setup USB
|
||||
*
|
||||
* FIXME: Needs doc
|
||||
@ -133,7 +113,7 @@ void protocol_pre_task(void) {
|
||||
if (should_do_suspend()) {
|
||||
dprintln("suspending keyboard");
|
||||
while (should_do_suspend()) {
|
||||
vusb_suspend();
|
||||
suspend_power_down();
|
||||
if (suspend_wakeup_condition()) {
|
||||
vusb_send_remote_wakeup();
|
||||
|
||||
@ -148,7 +128,7 @@ void protocol_pre_task(void) {
|
||||
# endif
|
||||
}
|
||||
}
|
||||
vusb_wakeup();
|
||||
suspend_wakeup_init();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user