Modularizando o src

Dependencies:   EALib EthernetInterface_vz mbed-rtos mbed

Fork of header_main_colinas_V0-20-09-14 by VZTECH

Committer:
Cola
Date:
Sat Sep 20 20:28:24 2014 +0000
Revision:
21:0bd688722e81
Parent:
17:67a6b557eda5
Child:
33:735fd60e96d8
20-09-14

Who changed what in which revision?

UserRevisionLine numberNew contents of line
klauss 17:67a6b557eda5 1 #include "mbed.h"
klauss 17:67a6b557eda5 2 #include "wdt.h"
klauss 17:67a6b557eda5 3
klauss 17:67a6b557eda5 4 /// Watchdog gets instantiated at the module level
klauss 17:67a6b557eda5 5 Watchdog::Watchdog() {
klauss 17:67a6b557eda5 6 wdreset = (LPC_WDT->MOD >> 2) & 1; // capture the cause of the previous reset
klauss 17:67a6b557eda5 7 }
klauss 17:67a6b557eda5 8
klauss 17:67a6b557eda5 9 /// Load timeout value in watchdog timer and enable
klauss 17:67a6b557eda5 10 void Watchdog::Configure(float s) {
klauss 17:67a6b557eda5 11 //LPC_WDT->CLKSEL = 0x1; // Set CLK src to PCLK
klauss 17:67a6b557eda5 12 uint32_t clk = 500000 / 4; // WD has a fixed /4 prescaler, and a 500khz oscillator
klauss 17:67a6b557eda5 13 LPC_WDT->TC = (uint32_t)(s * (float)clk);
klauss 17:67a6b557eda5 14 LPC_WDT->MOD = 0x3; // Enabled and Reset
klauss 17:67a6b557eda5 15 kick();
klauss 17:67a6b557eda5 16 }
klauss 17:67a6b557eda5 17
klauss 17:67a6b557eda5 18 /// "Service", "kick" or "feed" the dog - reset the watchdog timer
klauss 17:67a6b557eda5 19 /// by writing this required bit pattern
klauss 17:67a6b557eda5 20 void Watchdog::kick() {
Cola 21:0bd688722e81 21 //x = NVIC_disable_IRQ();
klauss 17:67a6b557eda5 22 LPC_WDT->FEED = 0xAA;
klauss 17:67a6b557eda5 23 LPC_WDT->FEED = 0x55;
Cola 21:0bd688722e81 24 //if (x) enable_IRQ() ;
klauss 17:67a6b557eda5 25 }
klauss 17:67a6b557eda5 26