Tomonori Kuroki / MuWatchdog

Fork of Watchdog by David Smart

Files at this revision

API Documentation at this revision

Comitter:
mutech
Date:
Wed May 08 10:53:46 2019 +0000
Parent:
25:4eecd15f0c38
Child:
27:b16166a526a2
Commit message:
This provides a basic Watchdog service, and includes a startup detection to determine if the reset was caused by the WD.

Changed in this revision

Watchdog.cpp Show annotated file Show diff for this revision Revisions of this file
Watchdog.h Show annotated file Show diff for this revision Revisions of this file
--- a/Watchdog.cpp	Mon Oct 15 12:10:15 2018 +0000
+++ b/Watchdog.cpp	Wed May 08 10:53:46 2019 +0000
@@ -220,7 +220,7 @@
 #endif
 
 /// Load timeout value in watchdog timer and enable
-void Watchdog::Configure(float s)
+void Watchdog::begin(float s)
 {
     // http://www.st.com/web/en/resource/technical/document/reference_manual/CD00171190.pdf
 
@@ -247,7 +247,7 @@
     IWDG->KR  = 0xCCCC;         // Starts the WD
 }
 
-void Watchdog::Configure(int ms)
+void Watchdog::begin(int ms)
 {
     // http://www.st.com/web/en/resource/technical/document/reference_manual/CD00171190.pdf
 
@@ -275,6 +275,16 @@
     IWDG->KR  = 0xCCCC;         // Starts the WD
 }
 
+void Watchdog::Configure(float s)
+{
+    begin(s);
+}
+
+void Watchdog::Configure(int ms)
+{
+    begin(ms);
+}
+
 /// "Service", "kick" or "feed" the dog - reset the watchdog timer
 void Watchdog::Service()
 {
--- a/Watchdog.h	Mon Oct 15 12:10:15 2018 +0000
+++ b/Watchdog.h	Wed May 08 10:53:46 2019 +0000
@@ -84,11 +84,14 @@
     /// @param[in] timeout in seconds, as a floating point number
     /// @returns none
     ///
+    // deprecated
     void Configure(float timeout);
-
     void Configure(int timeout_ms);
+
+    void begin(float timeout);
+    void begin(int timeout_ms);
     
-    /// Service the Watchdog so it does not cause a system reset
+    /// Service the Watchdog so it does not cause a sbeginystem reset
     ///
     /// example:
     /// @code
@@ -108,7 +111,7 @@
     /// @returns true if the Watchdog was the cause of the reset
     bool WatchdogCausedReset();
 
-#if defined( TARGET_STM )
+#if defined(TARGET_STM)
     uint32_t reset_status() { return _rcc_csr; }
 #endif