High Altitude Recovery Payload

HARP: High Altitude Recovery Payload

Version 0.1: RC design

/media/uploads/tylerjw/_scaled_2012-07-23_mbed_xbee_breadboard.jpg

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.

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?

UserRevisionLine numberNew 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 }