Class to add reset supervision with a watchdog timer functionality
Dependents: Example_WatchDog_Timer
Diff: ResetSupervisor.h
- Revision:
- 2:72d1cb8fc13c
- Parent:
- 1:4e2e6a9dc079
- Child:
- 3:b7a9432fe880
--- a/ResetSupervisor.h Thu Oct 03 19:47:05 2019 +0000 +++ b/ResetSupervisor.h Fri Oct 04 14:50:29 2019 +0000 @@ -57,60 +57,49 @@ // example: // @code // ... - // wd.Configure(1.4); // configure for a 1.4 second timeout + // wd.initWD(1.4); // configure for a 1.4 second timeout // ... // @endcode // // @param[in] timeout in seconds, as a floating point number // @returns none // - void Configure(float timeout); + void initWD(float timeout); // Service the Supervisor so it does not cause a system reset // // example: // @code - // wd.Update(); + // wd.pingWD(); // @endcode // @returns none - void Update(); - - // SupervisorCausedReset identifies if the cause of the system - // reset was the Supervisor - // - // example: - // @code - // if (wd.WatchdogCausedReset())) { - // @endcode - // - // @returns true if the Supervisor was the cause of the reset - bool WatchdogReset(); - + void pingWD(); + /* ResetReasons explains what exactly caused the system reset - // - // example: - // @code - switch(wd.ResetReason()){ - case RCC_FLAG_BORRST: - . - . - break, - } + * + * example: + * @code + * switch(wd.ResetReason()){ + * case RCC_FLAG_BORRST: + * . + * . + * break, + * } + * Returns: + * RCC_FLAG_BORRST BOR reset + * RCC_FLAG_OBLRST OBLRST reset + * RCC_FLAG_PINRST Pin reset + * RCC_FLAG_FWRST FIREWALL reset + * RCC_FLAG_SFTRST Software reset + * RCC_FLAG_IWDGRST Independent Supervisor reset + * RCC_FLAG_WWDGRST Window Supervisor reset + * RCC_FLAG_LPWRRST Low Power reset */ - uint8_t ResetReason(); + uint8_t resetReason(); private: uint8_t rstRsn; - /* - * @arg @ref RCC_FLAG_BORRST BOR reset - * @arg @ref RCC_FLAG_OBLRST OBLRST reset - * @arg @ref RCC_FLAG_PINRST Pin reset - * @arg @ref RCC_FLAG_FWRST FIREWALL reset - * @arg @ref RCC_FLAG_SFTRST Software reset - * @arg @ref RCC_FLAG_IWDGRST Independent Supervisor reset - * @arg @ref RCC_FLAG_WWDGRST Window Supervisor reset - * @arg @ref RCC_FLAG_LPWRRST Low Power reset - */ + }; #endif // WATCHDOG_H \ No newline at end of file