1
0
mirror of https://github.com/arduino-libraries/ArduinoLowPower.git synced 2025-04-19 11:42:14 +03:00

[SAMD] Disable USB on standby()

This commit is contained in:
Martino Facchin 2017-07-13 17:01:03 +02:00
parent 5456a1f698
commit 8cf4c737dd

View File

@ -16,10 +16,19 @@ void ArduinoLowPowerClass::idle(uint32_t millis) {
}
void ArduinoLowPowerClass::sleep() {
bool restoreUSBDevice = false;
if (SerialUSB) {
USBDevice.standby();
} else {
USBDevice.detach();
restoreUSBDevice = true;
}
SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;
__DSB();
__WFI();
if (restoreUSBDevice) {
USBDevice.attach();
}
}
void ArduinoLowPowerClass::sleep(uint32_t millis) {