Modularizando o src
Dependencies: EALib EthernetInterface_vz mbed-rtos mbed
Fork of header_main_colinas_V0-20-09-14 by
wdt.cpp
- Committer:
- klauss
- Date:
- 2014-09-30
- Revision:
- 33:735fd60e96d8
- Parent:
- 21:0bd688722e81
- Child:
- 81:3656f00ab3db
File content as of revision 33:735fd60e96d8:
#include "mbed.h" #include "wdt.h" #include "debug.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(); // debug_msg(""); } /// "Service", "kick" or "feed" the dog - reset the watchdog timer /// by writing this required bit pattern void Watchdog::kick() { //x = NVIC_disable_IRQ(); /* antes de desabilitar as irqs, eu preciso salvar o status delas */ //IRQn irqn; //uint16_t ret = NVIC_GetActive( irqn ); //debug_msg( "NVIC_GetActive --%i--", ret ); //debug_msg("+"); //__disable_irq(); //Interrupt ID == 0 -- Exception Number 16 LPC_WDT->FEED = 0xAA; LPC_WDT->FEED = 0x55; //__enable_irq(); //debug_msg("."); }