Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: Example_WatchDog_Timer
Revision 2:72d1cb8fc13c, committed 2019-10-04
- Comitter:
- rlanders73
- Date:
- Fri Oct 04 14:50:29 2019 +0000
- Parent:
- 1:4e2e6a9dc079
- Child:
- 3:b7a9432fe880
- Commit message:
- removed WatchdogReset function as it was redundant to resetReason.
Changed in this revision
| ResetSupervisor.cpp | Show annotated file Show diff for this revision Revisions of this file |
| ResetSupervisor.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/ResetSupervisor.cpp Thu Oct 03 19:47:05 2019 +0000
+++ b/ResetSupervisor.cpp Fri Oct 04 14:50:29 2019 +0000
@@ -46,7 +46,7 @@
}
/// Load timeout value in watchdog timer and enable
-void Supervisor::Configure(float timeout) {
+void Supervisor::initWD(float timeout) {
#define LsiFreq (45000)
uint16_t PrescalerCode;
@@ -95,21 +95,16 @@
IWDG->KR = 0xAAAA; //Reload IWDG
IWDG->KR = 0xCCCC; //Start IWDG - See more at: http://embedded-lab.com/blog/?p=9662#sthash.6VNxVSn0.dpuf
- Update();
+ pingWD();
}
-/// "Update", "kick" or "feed" the dog - reset the watchdog timer
+/// "Ping", "kick" or "feed" the dog - reset the watchdog timer
/// by writing this required bit pattern
-void Supervisor::Update() {
+void Supervisor::pingWD() {
IWDG->KR = 0xAAAA; //Reload IWDG - See more at: http://embedded-lab.com/blog/?p=9662#sthash.6VNxVSn0.dpuf
}
-/// get the flag to indicate if the watchdog causes the reset
-bool Supervisor::WatchdogReset() {
- return rstRsn == RCC_FLAG_WWDGRST;
-}
-
-uint8_t Supervisor::ResetReason(){
+uint8_t Supervisor::resetReason(){
return rstRsn;
}
--- 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