mirror of
https://github.com/arduino-libraries/ArduinoLowPower.git
synced 2025-04-19 11:42:14 +03:00
Fix SysTick timer lockup when waking from sleep (#17)
* fix SysTick timer lockup when waking from sleep
This commit is contained in:
parent
4caff779d9
commit
892594adbc
@ -23,9 +23,13 @@ void ArduinoLowPowerClass::sleep() {
|
|||||||
USBDevice.detach();
|
USBDevice.detach();
|
||||||
restoreUSBDevice = true;
|
restoreUSBDevice = true;
|
||||||
}
|
}
|
||||||
|
// Disable systick interrupt: See https://www.avrfreaks.net/forum/samd21-samd21e16b-sporadically-locks-and-does-not-wake-standby-sleep-mode
|
||||||
|
SysTick->CTRL &= ~SysTick_CTRL_TICKINT_Msk;
|
||||||
SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;
|
SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;
|
||||||
__DSB();
|
__DSB();
|
||||||
__WFI();
|
__WFI();
|
||||||
|
// Enable systick interrupt
|
||||||
|
SysTick->CTRL |= SysTick_CTRL_TICKINT_Msk;
|
||||||
if (restoreUSBDevice) {
|
if (restoreUSBDevice) {
|
||||||
USBDevice.attach();
|
USBDevice.attach();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user