Localization
Dependencies: BNO055_fusion mbed
Diff: WATCHDOG.cpp
- Revision:
- 6:0602a9e8118b
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/WATCHDOG.cpp Wed Mar 16 22:05:23 2016 +0000 @@ -0,0 +1,18 @@ +#include "WATCHDOG.h" + +// "kick" or "feed" the dog - reset the watchdog timer +// by writing this required bit pattern +void Watchdog::kick(void) +{ + LPC_WDT->WDFEED = 0xAA; + LPC_WDT->WDFEED = 0x55; +} + +void Watchdog::kick(float s) +{ + 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->WDMOD = 0x3; // Enabled and Reset + kick(); +} \ No newline at end of file