https://os.mbed.com/cookbook/WatchDog-Timer This link has demonstrated a way to implement Watchdog Timer on Mbed. This library is the library version of that code.
Revision 2:1b576cfa3f49, committed 2018-02-09
- Comitter:
- mreda
- Date:
- Fri Feb 09 11:32:52 2018 +0000
- Parent:
- 1:7d0312e56c87
- Commit message:
- WatchdogTimer_LPC1768_version_1.02
Changed in this revision
WatchdogTimer.cpp | Show annotated file Show diff for this revision Revisions of this file |
WatchdogTimer.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/WatchdogTimer.cpp Fri Feb 09 11:29:05 2018 +0000 +++ b/WatchdogTimer.cpp Fri Feb 09 11:32:52 2018 +0000 @@ -9,10 +9,10 @@ LPC_WDT->WDFEED = 0x55; } // Load timeout value in watchdog timer and enable -void WatchdogTimer::kick(float s) { +void WatchdogTimer::kick(float timeInSecond) { LPC_WDT->WDCLKSEL = 0x1; // Set CLK src to PCLK uint32_t clk = SystemCoreClock / 16; // WD has a fixed /4 prescaler, PCLK default is /4 - LPC_WDT->WDTC = s * (float)clk; + LPC_WDT->WDTC = timeInSecond * (float)clk; LPC_WDT->WDMOD = 0x3; // Enabled and Reset kick(); }
--- a/WatchdogTimer.h Fri Feb 09 11:29:05 2018 +0000 +++ b/WatchdogTimer.h Fri Feb 09 11:32:52 2018 +0000 @@ -4,7 +4,7 @@ class WatchdogTimer { public: void kick(); - void kick(float s); + void kick(float timeInSecond); };