A copy of the mbed USBDevice with USBSerial library
Dependents: STM32L0_LoRa Smartage STM32L0_LoRa Turtle_RadioShuttle
Diff: USBSerial/USBCDC.cpp
- Revision:
- 8:961423d1da74
- Parent:
- 2:195554780c9b
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;