summary refs log tree commit diff
diff options
context:
space:
mode:
authorFred Sundvik <fsundvik@gmail.com>2018-02-03 12:55:56 +0200
committerJack Humbert <jack.humb@gmail.com>2018-02-07 17:16:01 -0500
commit30b90de7c9d4edbbaf55e11264d30bda1f82cfde (patch)
treebaae5054a2d693c910b19b027f8c7d4669597fe1
parent30e413f9855a1ace8ea80505df1476de07e8ce39 (diff)
Send usb wakeup through ChibiOS
-rw-r--r--tmk_core/protocol/chibios/main.c4
-rw-r--r--tmk_core/protocol/chibios/usb_main.c21
-rw-r--r--tmk_core/protocol/chibios/usb_main.h3
3 files changed, 2 insertions, 26 deletions
diff --git a/tmk_core/protocol/chibios/main.c b/tmk_core/protocol/chibios/main.c
index 7138b5535c..47a7eb09ab 100644
--- a/tmk_core/protocol/chibios/main.c
+++ b/tmk_core/protocol/chibios/main.c
@@ -165,8 +165,8 @@ int main(void) {
 #endif
         suspend_power_down(); // on AVR this deep sleeps for 15ms
         /* Remote wakeup */
-        if((USB_DRIVER.status & 2) && suspend_wakeup_condition()) {
-          send_remote_wakeup(&USB_DRIVER);
+        if(suspend_wakeup_condition()) {
+          usbWakeupHost(&USB_DRIVER);
         }
       }
       /* Woken up */
diff --git a/tmk_core/protocol/chibios/usb_main.c b/tmk_core/protocol/chibios/usb_main.c
index 6173d3ad1c..caa2770b5c 100644
--- a/tmk_core/protocol/chibios/usb_main.c
+++ b/tmk_core/protocol/chibios/usb_main.c
@@ -1036,27 +1036,6 @@ void init_usb_driver(USBDriver *usbp) {
 #endif
 }
 
-/*
- * Send remote wakeup packet
- * Note: should not be called from ISR
- */
-void send_remote_wakeup(USBDriver *usbp) {
-  (void)usbp;
-#if defined(K20x) || defined(KL2x)
-#if KINETIS_USB_USE_USB0
-  USB0->CTL |= USBx_CTL_RESUME;
-  wait_ms(15);
-  USB0->CTL &= ~USBx_CTL_RESUME;
-#endif /* KINETIS_USB_USE_USB0 */
-#elif defined(STM32F0XX) || defined(STM32F1XX) || defined(STM32F3XX) /* End K20x || KL2x */
-  STM32_USB->CNTR |= CNTR_RESUME;
-  wait_ms(15);
-  STM32_USB->CNTR &= ~CNTR_RESUME;
-#else /* End STM32F0XX || STM32F1XX || STM32F3XX */
-#warning Sending remote wakeup packet not implemented for your platform.
-#endif
-}
-
 /* ---------------------------------------------------------
  *                  Keyboard functions
  * ---------------------------------------------------------
diff --git a/tmk_core/protocol/chibios/usb_main.h b/tmk_core/protocol/chibios/usb_main.h
index 30d8fcaef7..b4f894f2f3 100644
--- a/tmk_core/protocol/chibios/usb_main.h
+++ b/tmk_core/protocol/chibios/usb_main.h
@@ -36,9 +36,6 @@
 /* Initialize the USB driver and bus */
 void init_usb_driver(USBDriver *usbp);
 
-/* Send remote wakeup packet */
-void send_remote_wakeup(USBDriver *usbp);
-
 /* ---------------
  * Keyboard header
  * ---------------