ref: fdc89f1a20889c0295534f58dc2e82ce8c55a18b
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 28 29 30 31 32 33 34 |
#pragma once #include <cstdint> 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; }; } } |