High Altitude Recovery Payload
HARP: High Altitude Recovery Payload
Information
Version 0.1: RC design

By connecting the second xbee to a computer using a terminal command and supplying the characters L, R, C, F the light patterns change on the mbed.
watchdog.cpp@0:043ed5bb10f2, 2012-07-23 (annotated)
- Committer:
- tylerjw
- Date:
- Mon Jul 23 19:20:55 2012 +0000
- Revision:
- 0:043ed5bb10f2
- Child:
- 1:21a6da67311c
0.1 LED change with serial xbee connection
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| tylerjw | 0:043ed5bb10f2 | 1 | #include "mbed.h" |
| tylerjw | 0:043ed5bb10f2 | 2 | #include "watchdog.h" |
| tylerjw | 0:043ed5bb10f2 | 3 | |
| tylerjw | 0:043ed5bb10f2 | 4 | // Simon's Watchdog code from |
| tylerjw | 0:043ed5bb10f2 | 5 | // http://mbed.org/forum/mbed/topic/508/ |
| tylerjw | 0:043ed5bb10f2 | 6 | |
| tylerjw | 0:043ed5bb10f2 | 7 | // Load timeout value in watchdog timer and enable |
| tylerjw | 0:043ed5bb10f2 | 8 | void Watchdog::kick(float s) { |
| tylerjw | 0:043ed5bb10f2 | 9 | LPC_WDT->WDCLKSEL = 0x1; // Set CLK src to PCLK |
| tylerjw | 0:043ed5bb10f2 | 10 | uint32_t clk = SystemCoreClock / 16; // WD has a fixed /4 prescaler, PCLK default is /4 |
| tylerjw | 0:043ed5bb10f2 | 11 | LPC_WDT->WDTC = s * (float)clk; |
| tylerjw | 0:043ed5bb10f2 | 12 | LPC_WDT->WDMOD = 0x3; // Enabled and Reset |
| tylerjw | 0:043ed5bb10f2 | 13 | kick(); |
| tylerjw | 0:043ed5bb10f2 | 14 | } |
| tylerjw | 0:043ed5bb10f2 | 15 | // "kick" or "feed" the dog - reset the watchdog timer |
| tylerjw | 0:043ed5bb10f2 | 16 | // by writing this required bit pattern |
| tylerjw | 0:043ed5bb10f2 | 17 | void Watchdog::kick() { |
| tylerjw | 0:043ed5bb10f2 | 18 | LPC_WDT->WDFEED = 0xAA; |
| tylerjw | 0:043ed5bb10f2 | 19 | LPC_WDT->WDFEED = 0x55; |
| tylerjw | 0:043ed5bb10f2 | 20 | } |

