voltando a versao de n aberturas e fechamentos de sockets data 19/09
Dependencies: EthernetInterface NTPClient mbed-rtos mbed EALib
Fork of header_main_publish by
wdt.cpp
- Committer:
- klauss
- Date:
- 2014-09-20
- Revision:
- 19:ab2088e0dec6
- Parent:
- 17:67a6b557eda5
File content as of revision 19:ab2088e0dec6:
#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; }