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:
parent
5456a1f698
commit
8cf4c737dd
@ -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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user