diff --git a/src/drivers/Watchdog.cpp b/src/drivers/Watchdog.cpp index 850fd2f1..11da1211 100644 --- a/src/drivers/Watchdog.cpp +++ b/src/drivers/Watchdog.cpp @@ -32,17 +32,17 @@ void Watchdog::Kick() { } Watchdog::ResetReasons Watchdog::ActualResetReason() const { - uint32_t resetReason; -// sd_power_reset_reason_get(&resetReason); -// sd_power_reset_reason_clr(0xFFFFFFFF); -// if(resetReason & 0x01u) return ResetReasons::ResetPin; -// if((resetReason >> 1u) & 0x01u) return ResetReasons::Watchdog; -// if((resetReason >> 2u) & 0x01u) return ResetReasons::SoftReset; -// if((resetReason >> 3u) & 0x01u) return ResetReasons::CpuLockup; -// if((resetReason >> 16u) & 0x01u) return ResetReasons::SystemOff; -// if((resetReason >> 17u) & 0x01u) return ResetReasons::LpComp; -// if((resetReason >> 18u) & 0x01u) return ResetReasons::DebugInterface; -// if((resetReason >> 19u) & 0x01u) return ResetReasons::NFC; + uint32_t reason = NRF_POWER->RESETREAS; + NRF_POWER->RESETREAS = 0xffffffff; + + if(reason & 0x01u) return ResetReasons::ResetPin; + if((reason >> 1u) & 0x01u) return ResetReasons::Watchdog; + if((reason >> 2u) & 0x01u) return ResetReasons::SoftReset; + if((reason >> 3u) & 0x01u) return ResetReasons::CpuLockup; + if((reason >> 16u) & 0x01u) return ResetReasons::SystemOff; + if((reason >> 17u) & 0x01u) return ResetReasons::LpComp; + if((reason) & 0x01u) return ResetReasons::DebugInterface; + if((reason >> 19u) & 0x01u) return ResetReasons::NFC; return ResetReasons::HardReset; }