Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: EALib EthernetInterface_vz mbed-rtos mbed
Fork of header_main_colinas_V0-20-09-14 by
wdt.cpp
00001 #include "wdt.h" 00002 00003 /// Watchdog gets instantiated at the module level 00004 Watchdog::Watchdog() { 00005 wdreset = (LPC_WDT->MOD >> 2) & 1; // capture the cause of the previous reset 00006 } 00007 00008 /// Load timeout value in watchdog timer and enable 00009 void Watchdog::Configure(float s) { 00010 //LPC_WDT->CLKSEL = 0x1; // Set CLK src to PCLK 00011 uint32_t clk = 500000 / 4; // WD has a fixed /4 prescaler, and a 500khz oscillator 00012 LPC_WDT->TC = ( uint32_t )( s * ( float )clk ); 00013 LPC_WDT->MOD = 0x3; // Enabled and Reset 00014 kick(); 00015 } 00016 00017 /// "Service", "kick" or "feed" the dog - reset the watchdog timer 00018 /// by writing this required bit pattern 00019 void Watchdog::kick() { 00020 //x = NVIC_disable_IRQ(); 00021 /* 00022 antes de desabilitar as irqs, eu preciso salvar o status delas 00023 */ 00024 //IRQn irqn; 00025 //uint16_t ret = NVIC_GetActive( irqn ); 00026 //debug_msg( "NVIC_GetActive --%i--", ret ); 00027 //debug_msg("+"); 00028 //__disable_irq(); 00029 //Interrupt ID == 0 -- Exception Number 16 00030 LPC_WDT->FEED = 0xAA; 00031 LPC_WDT->FEED = 0x55; 00032 00033 //__enable_irq(); 00034 //debug_msg("."); 00035 } 00036 00037 bool Watchdog::WatchdogCausedReset(){ 00038 return( this->wdreset ); 00039 }
Generated on Tue Jul 12 2022 16:25:14 by
