You've already forked ArduinoLowPower
mirror of
https://github.com/arduino-libraries/ArduinoLowPower.git
synced 2025-07-01 19:21:38 +03:00
[SAMD] Disable USB on standby()
This commit is contained in:
@ -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) {
|
||||
|
Reference in New Issue
Block a user