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.
Diff: WatchdogTimer.cpp
- Revision:
- 2:1b576cfa3f49
- Parent:
- 1:7d0312e56c87
--- 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(); }