trash over HTTP
Dependencies: C027_Support HTTPClient TrashSensors mbed Crypto
Fork of SLOTrashHTTP by
Collects sensor readings and sends them to https://trash.coreyford.name/
Server code: https://github.com/coyotebush/trash-map
Diff: Watchdog.h
- Revision:
- 7:49f2a1277737
diff -r 43ac8ef67a03 -r 49f2a1277737 Watchdog.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Watchdog.h Thu Jun 04 04:59:57 2015 +0000 @@ -0,0 +1,24 @@ +#ifndef WATCHDOG_H +#define WATCHDOG_H + +// https://developer.mbed.org/cookbook/WatchDog-Timer + +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 \ No newline at end of file