Official reference client implementation for Cumulocity SmartREST on u-blox C027.
Dependencies: C027_Support C12832 LM75B MMA7660 MbedSmartRest mbed-rtos mbed
Fork of MbedSmartRestMain by
Diff: watchdog.h
- Revision:
- 76:b07effe83fb8
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/watchdog.h Wed Feb 25 10:06:11 2015 +0000 @@ -0,0 +1,22 @@ +#ifndef WATCHDOG_H +#define WATCHDOG_H +#include "mbed.h" + +class Watchdog { +public: +// Load timeout value in watchdog timer and enable + void 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(); + } +// "kick" or "feed" the dog - reset the watchdog timer +// by writing this required bit pattern + void kick() { + LPC_WDT->WDFEED = 0xAA; + LPC_WDT->WDFEED = 0x55; + } +}; +#endif /* WATCHDOG_H */ \ No newline at end of file