aboutsummaryrefslogtreecommitdiff
path: root/tmk_core
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 /tmk_core
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
Diffstat (limited to 'tmk_core')
-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 54d056a14..d3dc272ee 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)
62{ 62{
63 uint32_t irqflags; 63 uint32_t irqflags;
64 64
65 if (usb_state == USB_STATE_POWERDOWN)
66 {
67 udc_remotewakeup();
68 return;
69 }
70
65#ifdef NKRO_ENABLE 71#ifdef NKRO_ENABLE
66 if (!keymap_config.nkro) 72 if (!keymap_config.nkro)
67 { 73 {
@@ -156,25 +162,27 @@ void send_consumer(uint16_t data)
156} 162}
157 163
158uint8_t g_drvid; 164uint8_t g_drvid;
165uint8_t g_usb_sleeping = 0;
159 166
160void main_subtask_usb_state(void) 167void main_subtask_usb_state(void)
161{ 168{
162 if (usb_state == USB_STATE_POWERDOWN) 169 if (usb_state == USB_STATE_POWERDOWN)
163 { 170 {
164 uint32_t timer_led = timer_read32(); 171 if (!g_usb_sleeping)
165
166 led_on;
167 if (led_enabled)
168 { 172 {
169 for (g_drvid = 0; g_drvid < ISSI3733_DRIVER_COUNT; g_drvid++) 173 g_usb_sleeping = 1;
174 if (led_enabled)
170 { 175 {
171 I2C3733_Control_Set(0); 176 for (g_drvid = 0; g_drvid < ISSI3733_DRIVER_COUNT; g_drvid++)
177 {
178 I2C3733_Control_Set(0);
179 }
172 } 180 }
173 } 181 }
174 while (usb_state == USB_STATE_POWERDOWN) 182 }
175 { 183 else if (g_usb_sleeping)
176 if (timer_read32() - timer_led > 1000) led_off; //Good to indicate went to sleep, but only for a second 184 {
177 } 185 g_usb_sleeping = 0;
178 if (led_enabled) 186 if (led_enabled)
179 { 187 {
180 for (g_drvid = 0; g_drvid < ISSI3733_DRIVER_COUNT; g_drvid++) 188 for (g_drvid = 0; g_drvid < ISSI3733_DRIVER_COUNT; g_drvid++)
@@ -182,12 +190,12 @@ void main_subtask_usb_state(void)
182 I2C3733_Control_Set(1); 190 I2C3733_Control_Set(1);
183 } 191 }
184 } 192 }
185 led_off;
186 } 193 }
187} 194}
188 195
189void main_subtask_led(void) 196void main_subtask_led(void)
190{ 197{
198 if (g_usb_sleeping) return;
191 led_matrix_task(); 199 led_matrix_task();
192} 200}
193 201
diff --git a/tmk_core/protocol/arm_atsam/usb/udc.h b/tmk_core/protocol/arm_atsam/usb/udc.h
index c88a442cb..33335d186 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)
210/*! \brief The USB driver sends a resume signal called \e "Upstream Resume" 210/*! \brief The USB driver sends a resume signal called \e "Upstream Resume"
211 * This is authorized only when the remote wakeup feature is enabled by host. 211 * This is authorized only when the remote wakeup feature is enabled by host.
212 */ 212 */
213static inline void udc_remotewakeup(void) 213inline void udc_remotewakeup(void)
214{ 214{
215 udd_send_remotewakeup(); 215 udd_send_remotewakeup();
216} 216}