Arianna autonomous DAQ firmware

Dependencies:   mbed SDFileSystemFilinfo AriSnProtocol NetServicesMin AriSnComm MODSERIAL PowerControlClkPatch DS1820OW

Committer:
uci1
Date:
Tue Oct 16 04:47:44 2012 +0000
Revision:
22:f957c4f840ad
Parent:
12:d472f9811262
Child:
40:1324da35afd4
USB comm only. Make firing of comm window independent of real time clock. Add heartbeat firing time to the data stream.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
uci1 0:664899e0b988 1 #ifndef MB_Watchdog
uci1 0:664899e0b988 2 #define MB_Watchdog
uci1 0:664899e0b988 3
uci1 22:f957c4f840ad 4 #define WDFAILSAFE (1200u)
uci1 22:f957c4f840ad 5
uci1 0:664899e0b988 6 // Simon's Watchdog code from
uci1 0:664899e0b988 7 // http://mbed.org/forum/mbed/topic/508/
uci1 0:664899e0b988 8 namespace Watchdog {
uci1 0:664899e0b988 9
uci1 0:664899e0b988 10 // "kick" or "feed" the dog - reset the watchdog timer
uci1 0:664899e0b988 11 // by writing this required bit pattern
uci1 12:d472f9811262 12 inline
uci1 0:664899e0b988 13 void kick() {
uci1 0:664899e0b988 14 LPC_WDT->WDFEED = 0xAA;
uci1 0:664899e0b988 15 LPC_WDT->WDFEED = 0x55;
uci1 0:664899e0b988 16 }
uci1 0:664899e0b988 17
uci1 0:664899e0b988 18 // Load timeout value in watchdog timer and enable
uci1 12:d472f9811262 19 inline
uci1 0:664899e0b988 20 void kick(const float s) {
uci1 0:664899e0b988 21 LPC_WDT->WDCLKSEL = 0x1; // Set CLK src to PCLK
uci1 0:664899e0b988 22 // WD has a fixed /4 prescaler, PCLK default is /4
uci1 0:664899e0b988 23 static const float clk = static_cast<float>(SystemCoreClock / 16);
uci1 0:664899e0b988 24 LPC_WDT->WDTC = s * clk;
uci1 0:664899e0b988 25 LPC_WDT->WDMOD = 0x3; // Enabled and Reset
uci1 0:664899e0b988 26 kick();
uci1 0:664899e0b988 27 }
uci1 22:f957c4f840ad 28
uci1 22:f957c4f840ad 29 struct SnKickStarter {
uci1 22:f957c4f840ad 30 SnKickStarter(const float s) {
uci1 22:f957c4f840ad 31 Watchdog::kick(s);
uci1 22:f957c4f840ad 32 }
uci1 22:f957c4f840ad 33 };
uci1 0:664899e0b988 34
uci1 0:664899e0b988 35 };
uci1 0:664899e0b988 36
uci1 0:664899e0b988 37
uci1 0:664899e0b988 38 #endif // MB_Watchdog