Tomonori Kuroki / MuWatchdog

Fork of Watchdog by David Smart

Revision:
29:d84c025e8c8e
Parent:
27:b16166a526a2
Child:
30:c02c2a15ce8f
diff -r d18b9e72aa88 -r d84c025e8c8e Watchdog.cpp
--- a/Watchdog.cpp	Sun May 26 20:01:39 2019 +0000
+++ b/Watchdog.cpp	Sun Jun 09 16:58:02 2019 +0000
@@ -31,21 +31,21 @@
     uint32_t clk = SystemCoreClock / 16;    // WD has a fixed /4 prescaler, PCLK default is /4
     LPC_WDT->WDTC = (uint32_t)(sec * (float)clk);
     LPC_WDT->WDMOD = 0x3;                   // Enabled and Reset
-    clear();
+    restart();
 }
 
-void Watchdog::begin(int ms)
+void Watchdog::begin(uint32_t ms)
 {
     LPC_WDT->WDCLKSEL = 0x1;                // Set CLK src to PCLK
     uint32_t clk = SystemCoreClock / 1000;  // 
     LPC_WDT->WDTC = (ms * clk) / 16;        // WD has a fixed /4 prescaler, PCLK default is /4
     LPC_WDT->WDMOD = 0x3;                   // Enabled and Reset
-    clear();
+    restart();
 }
 
 /// "Service", "kick" or "feed" the dog - reset the watchdog timer
 /// by writing this required bit pattern
-void Watchdog::clear()
+void Watchdog::restart()
 {
     LPC_WDT->WDFEED = 0xAA;
     LPC_WDT->WDFEED = 0x55;
@@ -73,21 +73,21 @@
     uint32_t clk = 500000 / 4;    // WD has a fixed /4 prescaler, and a 500khz oscillator
     LPC_WDT->TC = (uint32_t)(sec * (float)clk);
     LPC_WDT->MOD = 0x3;                   // Enabled and Reset
-    clear();
+    restart();
 }
 
-void Watchdog::begin(int ms)
+void Watchdog::begin(uint32_t ms)
 {
     //LPC_WDT->CLKSEL = 0x1;                // Set CLK src to PCLK
     uint32_t clk = 500000 / 4;    // WD has a fixed /4 prescaler, and a 500khz oscillator
     LPC_WDT->TC = (ms * clk) / 1000;
     LPC_WDT->MOD = 0x3;                   // Enabled and Reset
-    clear();
+    restart();
 }
 
 /// "Service", "kick" or "feed" the dog - reset the watchdog timer
 /// by writing this required bit pattern
-void Watchdog::clear()
+void Watchdog::restart()
 {
     LPC_WDT->FEED = 0xAA;
     LPC_WDT->FEED = 0x55;
@@ -117,7 +117,7 @@
 
 #define WDTOSCCTRL_Val(clk, div)    ((((uint32_t)(clk)) << 5) | (((div) >> 1) - 1))
 
-void Watchdog::begin(int ms)
+void Watchdog::begin(uint32_t ms)
 {
 #if 0
     uint32_t clk = get_wdtclock() / 4;    // WD has a fixed /4 prescaler, and a 500khz oscillator
@@ -130,7 +130,7 @@
     LPC_WWDT->TC = (ms * clk) / 1000;
 #endif
     LPC_WWDT->MOD = 0x3;                    // Enabled and Reset
-    clear();
+    restart();
 }
 
 uint32_t Watchdog::get_wdtclock()
@@ -187,7 +187,7 @@
 
 /// "Service", "kick" or "feed" the dog - reset the watchdog timer
 /// by writing this required bit pattern
-void Watchdog::clear()
+void Watchdog::restart()
 {
     LPC_WWDT->FEED = 0xAA;
     LPC_WWDT->FEED = 0x55;
@@ -263,7 +263,7 @@
     IWDG->KR  = 0xCCCC;         // Starts the WD
 }
 
-void Watchdog::begin(int ms)
+void Watchdog::begin(uint32_t ms)
 {
     // http://www.st.com/web/en/resource/technical/document/reference_manual/CD00171190.pdf
 
@@ -292,7 +292,7 @@
 }
 
 /// "Service", "kick" or "feed" the dog - reset the watchdog timer
-void Watchdog::clear()
+void Watchdog::restart()
 {
     IWDG->KR  = 0xAAAA;
 }