trash over HTTP

Dependencies:   C027_Support HTTPClient TrashSensors mbed Crypto

Fork of SLOTrashHTTP by Corey Ford

Collects sensor readings and sends them to https://trash.coreyford.name/

Server code: https://github.com/coyotebush/trash-map

Committer:
coyotebush
Date:
Thu Jun 04 04:59:57 2015 +0000
Revision:
7:49f2a1277737
Add watchdog

Who changed what in which revision?

UserRevisionLine numberNew contents of line
coyotebush 7:49f2a1277737 1 #ifndef WATCHDOG_H
coyotebush 7:49f2a1277737 2 #define WATCHDOG_H
coyotebush 7:49f2a1277737 3
coyotebush 7:49f2a1277737 4 // https://developer.mbed.org/cookbook/WatchDog-Timer
coyotebush 7:49f2a1277737 5
coyotebush 7:49f2a1277737 6 class Watchdog {
coyotebush 7:49f2a1277737 7 public:
coyotebush 7:49f2a1277737 8 // Load timeout value in watchdog timer and enable
coyotebush 7:49f2a1277737 9 void kick(float s) {
coyotebush 7:49f2a1277737 10 LPC_WDT->WDCLKSEL = 0x1; // Set CLK src to PCLK
coyotebush 7:49f2a1277737 11 uint32_t clk = SystemCoreClock / 16; // WD has a fixed /4 prescaler, PCLK default is /4
coyotebush 7:49f2a1277737 12 LPC_WDT->WDTC = s * (float)clk;
coyotebush 7:49f2a1277737 13 LPC_WDT->WDMOD = 0x3; // Enabled and Reset
coyotebush 7:49f2a1277737 14 kick();
coyotebush 7:49f2a1277737 15 }
coyotebush 7:49f2a1277737 16 // "kick" or "feed" the dog - reset the watchdog timer
coyotebush 7:49f2a1277737 17 // by writing this required bit pattern
coyotebush 7:49f2a1277737 18 void kick() {
coyotebush 7:49f2a1277737 19 LPC_WDT->WDFEED = 0xAA;
coyotebush 7:49f2a1277737 20 LPC_WDT->WDFEED = 0x55;
coyotebush 7:49f2a1277737 21 }
coyotebush 7:49f2a1277737 22 };
coyotebush 7:49f2a1277737 23
coyotebush 7:49f2a1277737 24 #endif