We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5456a1f commit 8cf4c73Copy full SHA for 8cf4c73
src/samd/ArduinoLowPower.cpp
@@ -16,10 +16,19 @@ void ArduinoLowPowerClass::idle(uint32_t millis) {
16
}
17
18
void ArduinoLowPowerClass::sleep() {
19
- USBDevice.standby();
+ bool restoreUSBDevice = false;
20
+ if (SerialUSB) {
21
+ USBDevice.standby();
22
+ } else {
23
+ USBDevice.detach();
24
+ restoreUSBDevice = true;
25
+ }
26
SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;
27
__DSB();
28
__WFI();
29
+ if (restoreUSBDevice) {
30
+ USBDevice.attach();
31
32
33
34
void ArduinoLowPowerClass::sleep(uint32_t millis) {
0 commit comments