Skip to content

Commit

Permalink
Bump version for SAMD fix, appease clang-format
Browse files Browse the repository at this point in the history
  • Loading branch information
PaintYourDragon committed May 18, 2022
1 parent b95520f commit 020da8c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=Adafruit SleepyDog Library
version=1.6.0
version=1.6.1
author=Adafruit
maintainer=Adafruit <[email protected]>
sentence=Arduino library to use the watchdog timer for system reset and low power sleep.
Expand Down
11 changes: 6 additions & 5 deletions utility/WatchdogSAMD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,19 +209,20 @@ int WatchdogSAMD::sleep(int maxPeriodMS) {
; // Wait for it to take
#else
SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;
// Due to a hardware bug on the SAMD21, the SysTick interrupts become
// Due to a hardware bug on the SAMD21, the SysTick interrupts become
// active before the flash has powered up from sleep, causing a hard fault.
// To prevent this the SysTick interrupts are disabled before entering sleep mode.
SysTick->CTRL &= ~SysTick_CTRL_TICKINT_Msk; // Disable SysTick interrupts
// To prevent this the SysTick interrupts are disabled before entering sleep
// mode.
SysTick->CTRL &= ~SysTick_CTRL_TICKINT_Msk; // Disable SysTick interrupts
#endif

__DSB(); // Data sync to ensure outgoing memory accesses complete
__WFI(); // Wait for interrupt (places device in sleep mode)

#if (SAMD20_SERIES || SAMD21_SERIES)
SysTick->CTRL |= SysTick_CTRL_TICKINT_Msk; // Enable SysTick interrupts
SysTick->CTRL |= SysTick_CTRL_TICKINT_Msk; // Enable SysTick interrupts
#endif

// Code resumes here on wake (WDT early warning interrupt).
// Bug: the return value assumes the WDT has run its course;
// incorrect if the device woke due to an external interrupt.
Expand Down

0 comments on commit 020da8c

Please sign in to comment.