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() {
|
void ArduinoLowPowerClass::sleep() {
|
||||||
USBDevice.standby();
|
bool restoreUSBDevice = false;
|
||||||
|
if (SerialUSB) {
|
||||||
|
USBDevice.standby();
|
||||||
|
} else {
|
||||||
|
USBDevice.detach();
|
||||||
|
restoreUSBDevice = true;
|
||||||
|
}
|
||||||
SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;
|
SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;
|
||||||
__DSB();
|
__DSB();
|
||||||
__WFI();
|
__WFI();
|
||||||
|
if (restoreUSBDevice) {
|
||||||
|
USBDevice.attach();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ArduinoLowPowerClass::sleep(uint32_t millis) {
|
void ArduinoLowPowerClass::sleep(uint32_t millis) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user