summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpatrickmt <40182064+patrickmt@users.noreply.github.com>2018-10-30 12:23:57 -0400
committerDrashna Jaelre <drashna@live.com>2018-11-02 14:33:07 -0700
commit563fe23e53fb747f509b8558bb29bde0baf2d6a8 (patch)
tree9250fece66c0cca196a091b89bea1cf774068206
parentf1529e74c41aa511cd04009d9a614a525824418e (diff)
downloadqmk_firmware-563fe23e53fb747f509b8558bb29bde0baf2d6a8.tar.gz
qmk_firmware-563fe23e53fb747f509b8558bb29bde0baf2d6a8.zip
Fix CTRL/ALT keyboard does not wake computer from sleep
Fix for Massdrop CTRL and ALT keyboards not waking computer from sleep
-rw-r--r--tmk_core/protocol/arm_atsam/main_arm_atsam.c30
-rw-r--r--tmk_core/protocol/arm_atsam/usb/udc.h2
2 files changed, 20 insertions, 12 deletions
diff --git a/tmk_core/protocol/arm_atsam/main_arm_atsam.c b/tmk_core/protocol/arm_atsam/main_arm_atsam.c
index 54d056a14e..d3dc272ee0 100644
--- a/tmk_core/protocol/arm_atsam/main_arm_atsam.c
+++ b/tmk_core/protocol/arm_atsam/main_arm_atsam.c
@@ -62,6 +62,12 @@ void send_keyboard(report_keyboard_t *report)
{
uint32_t irqflags;
+ if (usb_state == USB_STATE_POWERDOWN)
+ {
+ udc_remotewakeup();
+ return;
+ }
+
#ifdef NKRO_ENABLE
if (!keymap_config.nkro)
{
@@ -156,25 +162,27 @@ void send_consumer(uint16_t data)
}
uint8_t g_drvid;
+uint8_t g_usb_sleeping = 0;
void main_subtask_usb_state(void)
{
if (usb_state == USB_STATE_POWERDOWN)
{
- uint32_t timer_led = timer_read32();
-
- led_on;
- if (led_enabled)
+ if (!g_usb_sleeping)
{
- for (g_drvid = 0; g_drvid < ISSI3733_DRIVER_COUNT; g_drvid++)
+ g_usb_sleeping = 1;
+ if (led_enabled)
{
- I2C3733_Control_Set(0);
+ for (g_drvid = 0; g_drvid < ISSI3733_DRIVER_COUNT; g_drvid++)
+ {
+ I2C3733_Control_Set(0);
+ }
}
}
- while (usb_state == USB_STATE_POWERDOWN)
- {
- if (timer_read32() - timer_led > 1000) led_off; //Good to indicate went to sleep, but only for a second
- }
+ }
+ else if (g_usb_sleeping)
+ {
+ g_usb_sleeping = 0;
if (led_enabled)
{
for (g_drvid = 0; g_drvid < ISSI3733_DRIVER_COUNT; g_drvid++)
@@ -182,12 +190,12 @@ void main_subtask_usb_state(void)
I2C3733_Control_Set(1);
}
}
- led_off;
}
}
void main_subtask_led(void)
{
+ if (g_usb_sleeping) return;
led_matrix_task();
}
diff --git a/tmk_core/protocol/arm_atsam/usb/udc.h b/tmk_core/protocol/arm_atsam/usb/udc.h
index c88a442cb6..33335d1869 100644
--- a/tmk_core/protocol/arm_atsam/usb/udc.h
+++ b/tmk_core/protocol/arm_atsam/usb/udc.h
@@ -210,7 +210,7 @@ static inline void udc_detach(void)
/*! \brief The USB driver sends a resume signal called \e "Upstream Resume"
* This is authorized only when the remote wakeup feature is enabled by host.
*/
-static inline void udc_remotewakeup(void)
+inline void udc_remotewakeup(void)
{
udd_send_remotewakeup();
}