Fix reset reason (it returns the actual reset reason instead of hard coded 'hard reset' value).
This commit is contained in:
parent
421af9625b
commit
9115c49bba
|
@ -32,17 +32,17 @@ void Watchdog::Kick() {
|
||||||
}
|
}
|
||||||
|
|
||||||
Watchdog::ResetReasons Watchdog::ActualResetReason() const {
|
Watchdog::ResetReasons Watchdog::ActualResetReason() const {
|
||||||
uint32_t resetReason;
|
uint32_t reason = NRF_POWER->RESETREAS;
|
||||||
// sd_power_reset_reason_get(&resetReason);
|
NRF_POWER->RESETREAS = 0xffffffff;
|
||||||
// sd_power_reset_reason_clr(0xFFFFFFFF);
|
|
||||||
// if(resetReason & 0x01u) return ResetReasons::ResetPin;
|
if(reason & 0x01u) return ResetReasons::ResetPin;
|
||||||
// if((resetReason >> 1u) & 0x01u) return ResetReasons::Watchdog;
|
if((reason >> 1u) & 0x01u) return ResetReasons::Watchdog;
|
||||||
// if((resetReason >> 2u) & 0x01u) return ResetReasons::SoftReset;
|
if((reason >> 2u) & 0x01u) return ResetReasons::SoftReset;
|
||||||
// if((resetReason >> 3u) & 0x01u) return ResetReasons::CpuLockup;
|
if((reason >> 3u) & 0x01u) return ResetReasons::CpuLockup;
|
||||||
// if((resetReason >> 16u) & 0x01u) return ResetReasons::SystemOff;
|
if((reason >> 16u) & 0x01u) return ResetReasons::SystemOff;
|
||||||
// if((resetReason >> 17u) & 0x01u) return ResetReasons::LpComp;
|
if((reason >> 17u) & 0x01u) return ResetReasons::LpComp;
|
||||||
// if((resetReason >> 18u) & 0x01u) return ResetReasons::DebugInterface;
|
if((reason) & 0x01u) return ResetReasons::DebugInterface;
|
||||||
// if((resetReason >> 19u) & 0x01u) return ResetReasons::NFC;
|
if((reason >> 19u) & 0x01u) return ResetReasons::NFC;
|
||||||
return ResetReasons::HardReset;
|
return ResetReasons::HardReset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue