diff options
| -rw-r--r-- | quantum/command.c | 5 | ||||
| -rw-r--r-- | quantum/quantum.c | 12 | ||||
| -rw-r--r-- | tmk_core/protocol/chibios/chibios.c | 3 | ||||
| -rw-r--r-- | tmk_core/protocol/chibios/usb_main.c | 12 | ||||
| -rw-r--r-- | tmk_core/protocol/lufa/lufa.c | 13 | ||||
| -rw-r--r-- | tmk_core/protocol/vusb/protocol.c | 24 |
6 files changed, 18 insertions, 51 deletions
diff --git a/quantum/command.c b/quantum/command.c index 998d9b9aa1..ea2fd68e2b 100644 --- a/quantum/command.c +++ b/quantum/command.c | |||
| @@ -28,7 +28,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 28 | #include "action_layer.h" | 28 | #include "action_layer.h" |
| 29 | #include "action_util.h" | 29 | #include "action_util.h" |
| 30 | #include "eeconfig.h" | 30 | #include "eeconfig.h" |
| 31 | #include "sleep_led.h" | ||
| 32 | #include "led.h" | 31 | #include "led.h" |
| 33 | #include "command.h" | 32 | #include "command.h" |
| 34 | #include "quantum.h" | 33 | #include "quantum.h" |
| @@ -39,6 +38,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 39 | # include "backlight.h" | 38 | # include "backlight.h" |
| 40 | #endif | 39 | #endif |
| 41 | 40 | ||
| 41 | #ifdef SLEEP_LED_ENABLE | ||
| 42 | # include "sleep_led.h" | ||
| 43 | #endif | ||
| 44 | |||
| 42 | #if defined(MOUSEKEY_ENABLE) | 45 | #if defined(MOUSEKEY_ENABLE) |
| 43 | # include "mousekey.h" | 46 | # include "mousekey.h" |
| 44 | #endif | 47 | #endif |
diff --git a/quantum/quantum.c b/quantum/quantum.c index cc20c7db2b..09e5fe1dac 100644 --- a/quantum/quantum.c +++ b/quantum/quantum.c | |||
| @@ -17,6 +17,10 @@ | |||
| 17 | #include "quantum.h" | 17 | #include "quantum.h" |
| 18 | #include "process_quantum.h" | 18 | #include "process_quantum.h" |
| 19 | 19 | ||
| 20 | #ifdef SLEEP_LED_ENABLE | ||
| 21 | # include "sleep_led.h" | ||
| 22 | #endif | ||
| 23 | |||
| 20 | #ifdef BACKLIGHT_ENABLE | 24 | #ifdef BACKLIGHT_ENABLE |
| 21 | # include "process_backlight.h" | 25 | # include "process_backlight.h" |
| 22 | #endif | 26 | #endif |
| @@ -487,6 +491,10 @@ void suspend_power_down_quantum(void) { | |||
| 487 | backlight_level_noeeprom(0); | 491 | backlight_level_noeeprom(0); |
| 488 | # endif | 492 | # endif |
| 489 | 493 | ||
| 494 | # ifdef SLEEP_LED_ENABLE | ||
| 495 | sleep_led_enable(); | ||
| 496 | # endif | ||
| 497 | |||
| 490 | # ifdef LED_MATRIX_ENABLE | 498 | # ifdef LED_MATRIX_ENABLE |
| 491 | led_matrix_task(); | 499 | led_matrix_task(); |
| 492 | # endif | 500 | # endif |
| @@ -533,6 +541,10 @@ __attribute__((weak)) void suspend_wakeup_init_quantum(void) { | |||
| 533 | backlight_init(); | 541 | backlight_init(); |
| 534 | #endif | 542 | #endif |
| 535 | 543 | ||
| 544 | #ifdef SLEEP_LED_ENABLE | ||
| 545 | sleep_led_disable(); | ||
| 546 | #endif | ||
| 547 | |||
| 536 | // Restore LED indicators | 548 | // Restore LED indicators |
| 537 | led_wakeup(); | 549 | led_wakeup(); |
| 538 | 550 | ||
diff --git a/tmk_core/protocol/chibios/chibios.c b/tmk_core/protocol/chibios/chibios.c index 19d8121e34..5720bc3c4c 100644 --- a/tmk_core/protocol/chibios/chibios.c +++ b/tmk_core/protocol/chibios/chibios.c | |||
| @@ -40,9 +40,6 @@ | |||
| 40 | # define EARLY_INIT_PERFORM_BOOTLOADER_JUMP FALSE | 40 | # define EARLY_INIT_PERFORM_BOOTLOADER_JUMP FALSE |
| 41 | #endif | 41 | #endif |
| 42 | 42 | ||
| 43 | #ifdef SLEEP_LED_ENABLE | ||
| 44 | # include "sleep_led.h" | ||
| 45 | #endif | ||
| 46 | #ifdef MIDI_ENABLE | 43 | #ifdef MIDI_ENABLE |
| 47 | # include "qmk_midi.h" | 44 | # include "qmk_midi.h" |
| 48 | #endif | 45 | #endif |
diff --git a/tmk_core/protocol/chibios/usb_main.c b/tmk_core/protocol/chibios/usb_main.c index f9d7f5c4d6..b798a8d1cb 100644 --- a/tmk_core/protocol/chibios/usb_main.c +++ b/tmk_core/protocol/chibios/usb_main.c | |||
| @@ -21,10 +21,6 @@ | |||
| 21 | #include "host.h" | 21 | #include "host.h" |
| 22 | #include "suspend.h" | 22 | #include "suspend.h" |
| 23 | #include "timer.h" | 23 | #include "timer.h" |
| 24 | #ifdef SLEEP_LED_ENABLE | ||
| 25 | # include "sleep_led.h" | ||
| 26 | # include "led.h" | ||
| 27 | #endif | ||
| 28 | #include "wait.h" | 24 | #include "wait.h" |
| 29 | #include "usb_endpoints.h" | 25 | #include "usb_endpoints.h" |
| 30 | #include "usb_device_state.h" | 26 | #include "usb_device_state.h" |
| @@ -131,19 +127,11 @@ static inline bool usb_event_queue_dequeue(usbevent_t *event) { | |||
| 131 | 127 | ||
| 132 | static inline void usb_event_suspend_handler(void) { | 128 | static inline void usb_event_suspend_handler(void) { |
| 133 | usb_device_state_set_suspend(USB_DRIVER.configuration != 0, USB_DRIVER.configuration); | 129 | usb_device_state_set_suspend(USB_DRIVER.configuration != 0, USB_DRIVER.configuration); |
| 134 | #ifdef SLEEP_LED_ENABLE | ||
| 135 | sleep_led_enable(); | ||
| 136 | #endif /* SLEEP_LED_ENABLE */ | ||
| 137 | } | 130 | } |
| 138 | 131 | ||
| 139 | static inline void usb_event_wakeup_handler(void) { | 132 | static inline void usb_event_wakeup_handler(void) { |
| 140 | suspend_wakeup_init(); | 133 | suspend_wakeup_init(); |
| 141 | usb_device_state_set_resume(USB_DRIVER.configuration != 0, USB_DRIVER.configuration); | 134 | usb_device_state_set_resume(USB_DRIVER.configuration != 0, USB_DRIVER.configuration); |
| 142 | #ifdef SLEEP_LED_ENABLE | ||
| 143 | sleep_led_disable(); | ||
| 144 | // NOTE: converters may not accept this | ||
| 145 | led_set(host_keyboard_leds()); | ||
| 146 | #endif /* SLEEP_LED_ENABLE */ | ||
| 147 | } | 135 | } |
| 148 | 136 | ||
| 149 | bool last_suspend_state = false; | 137 | bool last_suspend_state = false; |
diff --git a/tmk_core/protocol/lufa/lufa.c b/tmk_core/protocol/lufa/lufa.c index d59468133c..e13f4b548e 100644 --- a/tmk_core/protocol/lufa/lufa.c +++ b/tmk_core/protocol/lufa/lufa.c | |||
| @@ -44,9 +44,6 @@ | |||
| 44 | #include "led.h" | 44 | #include "led.h" |
| 45 | #include "sendchar.h" | 45 | #include "sendchar.h" |
| 46 | #include "debug.h" | 46 | #include "debug.h" |
| 47 | #ifdef SLEEP_LED_ENABLE | ||
| 48 | # include "sleep_led.h" | ||
| 49 | #endif | ||
| 50 | #include "suspend.h" | 47 | #include "suspend.h" |
| 51 | #include "wait.h" | 48 | #include "wait.h" |
| 52 | 49 | ||
| @@ -278,10 +275,6 @@ void EVENT_USB_Device_Reset(void) { | |||
| 278 | void EVENT_USB_Device_Suspend(void) { | 275 | void EVENT_USB_Device_Suspend(void) { |
| 279 | print("[S]"); | 276 | print("[S]"); |
| 280 | usb_device_state_set_suspend(USB_Device_ConfigurationNumber != 0, USB_Device_ConfigurationNumber); | 277 | usb_device_state_set_suspend(USB_Device_ConfigurationNumber != 0, USB_Device_ConfigurationNumber); |
| 281 | |||
| 282 | #ifdef SLEEP_LED_ENABLE | ||
| 283 | sleep_led_enable(); | ||
| 284 | #endif | ||
| 285 | } | 278 | } |
| 286 | 279 | ||
| 287 | /** \brief Event USB Device Connect | 280 | /** \brief Event USB Device Connect |
| @@ -295,12 +288,6 @@ void EVENT_USB_Device_WakeUp(void) { | |||
| 295 | #endif | 288 | #endif |
| 296 | 289 | ||
| 297 | usb_device_state_set_resume(USB_DeviceState == DEVICE_STATE_Configured, USB_Device_ConfigurationNumber); | 290 | usb_device_state_set_resume(USB_DeviceState == DEVICE_STATE_Configured, USB_Device_ConfigurationNumber); |
| 298 | |||
| 299 | #ifdef SLEEP_LED_ENABLE | ||
| 300 | sleep_led_disable(); | ||
| 301 | // NOTE: converters may not accept this | ||
| 302 | led_set(host_keyboard_leds()); | ||
| 303 | #endif | ||
| 304 | } | 291 | } |
| 305 | 292 | ||
| 306 | #ifdef CONSOLE_ENABLE | 293 | #ifdef CONSOLE_ENABLE |
diff --git a/tmk_core/protocol/vusb/protocol.c b/tmk_core/protocol/vusb/protocol.c index 41ccf451fd..e2d0c4112e 100644 --- a/tmk_core/protocol/vusb/protocol.c +++ b/tmk_core/protocol/vusb/protocol.c | |||
| @@ -27,10 +27,6 @@ | |||
| 27 | #include "wait.h" | 27 | #include "wait.h" |
| 28 | #include "sendchar.h" | 28 | #include "sendchar.h" |
| 29 | 29 | ||
| 30 | #ifdef SLEEP_LED_ENABLE | ||
| 31 | # include "sleep_led.h" | ||
| 32 | #endif | ||
| 33 | |||
| 34 | /* This is from main.c of USBaspLoader */ | 30 | /* This is from main.c of USBaspLoader */ |
| 35 | static void initForUsbConnectivity(void) { | 31 | static void initForUsbConnectivity(void) { |
| 36 | uint8_t i = 0; | 32 | uint8_t i = 0; |
| @@ -64,22 +60,6 @@ static inline void vusb_send_remote_wakeup(void) { | |||
| 64 | 60 | ||
| 65 | bool vusb_suspended = false; | 61 | bool vusb_suspended = false; |
| 66 | 62 | ||
| 67 | static inline void vusb_suspend(void) { | ||
| 68 | #ifdef SLEEP_LED_ENABLE | ||
| 69 | sleep_led_enable(); | ||
| 70 | #endif | ||
| 71 | |||
| 72 | suspend_power_down(); | ||
| 73 | } | ||
| 74 | |||
| 75 | static inline void vusb_wakeup(void) { | ||
| 76 | suspend_wakeup_init(); | ||
| 77 | |||
| 78 | #ifdef SLEEP_LED_ENABLE | ||
| 79 | sleep_led_disable(); | ||
| 80 | #endif | ||
| 81 | } | ||
| 82 | |||
| 83 | /** \brief Setup USB | 63 | /** \brief Setup USB |
| 84 | * | 64 | * |
| 85 | * FIXME: Needs doc | 65 | * FIXME: Needs doc |
| @@ -133,7 +113,7 @@ void protocol_pre_task(void) { | |||
| 133 | if (should_do_suspend()) { | 113 | if (should_do_suspend()) { |
| 134 | dprintln("suspending keyboard"); | 114 | dprintln("suspending keyboard"); |
| 135 | while (should_do_suspend()) { | 115 | while (should_do_suspend()) { |
| 136 | vusb_suspend(); | 116 | suspend_power_down(); |
| 137 | if (suspend_wakeup_condition()) { | 117 | if (suspend_wakeup_condition()) { |
| 138 | vusb_send_remote_wakeup(); | 118 | vusb_send_remote_wakeup(); |
| 139 | 119 | ||
| @@ -148,7 +128,7 @@ void protocol_pre_task(void) { | |||
| 148 | # endif | 128 | # endif |
| 149 | } | 129 | } |
| 150 | } | 130 | } |
| 151 | vusb_wakeup(); | 131 | suspend_wakeup_init(); |
| 152 | } | 132 | } |
| 153 | #endif | 133 | #endif |
| 154 | } | 134 | } |
