ref: 0195ece317d15bcba7dfbd74b58bb8dbcd3bca0a
src/drivers/Watchdog.h
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
#pragma once namespace Pinetime { namespace Drivers { class Watchdog { public: enum class ResetReasons { ResetPin, Watchdog, SoftReset, CpuLockup, SystemOff, LpComp, DebugInterface, NFC, HardReset }; void Setup(uint8_t timeoutSeconds); void Start(); void Kick(); ResetReasons ResetReason() const { return resetReason; } static const char* ResetReasonToString(ResetReasons reason); private: ResetReasons resetReason; ResetReasons ActualResetReason() const; }; class WatchdogView { public: WatchdogView(const Watchdog& watchdog) : watchdog{watchdog} { } Watchdog::ResetReasons ResetReason() const { return watchdog.ResetReason();} private: const Watchdog& watchdog; }; } } |