voltando a versao de n aberturas e fechamentos de sockets
Dependencies: EthernetInterface NTPClient mbed-rtos_old mbed
Fork of header_main_public by
Diff: wdt.cpp
- Revision:
- 17:67a6b557eda5
diff -r b45b5b7363d7 -r 67a6b557eda5 wdt.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wdt.cpp Fri Sep 19 16:40:17 2014 +0000 @@ -0,0 +1,24 @@ +#include "mbed.h" +#include "wdt.h" + + /// Watchdog gets instantiated at the module level +Watchdog::Watchdog() { + wdreset = (LPC_WDT->MOD >> 2) & 1; // capture the cause of the previous reset +} + +/// Load timeout value in watchdog timer and enable +void Watchdog::Configure(float s) { + //LPC_WDT->CLKSEL = 0x1; // Set CLK src to PCLK + uint32_t clk = 500000 / 4; // WD has a fixed /4 prescaler, and a 500khz oscillator + LPC_WDT->TC = (uint32_t)(s * (float)clk); + LPC_WDT->MOD = 0x3; // Enabled and Reset + kick(); +} + +/// "Service", "kick" or "feed" the dog - reset the watchdog timer +/// by writing this required bit pattern +void Watchdog::kick() { + LPC_WDT->FEED = 0xAA; + LPC_WDT->FEED = 0x55; +} + \ No newline at end of file