A copy of the mbed USBDevice with USBSerial library

Dependents:   STM32L0_LoRa Smartage STM32L0_LoRa Turtle_RadioShuttle

Files at this revision

API Documentation at this revision

Comitter:
Helmut Tschemernjak
Date:
Sun Feb 24 14:52:33 2019 +0100
Parent:
7:8a5cc0d9bfa2
Commit message:
Added sleep manager support to avoids sleeps while a USB CDC
connection is active

Changed in this revision

USBSerial/USBCDC.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 8a5cc0d9bfa2 -r 961423d1da74 USBSerial/USBCDC.cpp
--- a/USBSerial/USBCDC.cpp	Thu Jan 31 20:56:55 2019 +0100
+++ b/USBSerial/USBCDC.cpp	Sun Feb 24 14:52:33 2019 +0100
@@ -44,6 +44,8 @@
 }
 
 void USBCDC::USBCallback_busReset(void) {
+	if (terminal_connected)
+		sleep_manager_unlock_deep_sleep();
     terminal_connected = false;
 };
 
@@ -71,7 +73,10 @@
             case CDC_SET_CONTROL_LINE_STATE:
                 if (transfer->setup.wValue & CLS_DTR) {
                     terminal_connected = true;
+					sleep_manager_lock_deep_sleep();
                 } else {
+					if (terminal_connected)
+						sleep_manager_unlock_deep_sleep();
                     terminal_connected = false;
                 }
                 success = true;