# HG changeset patch # User ethanzonca@CL-SEC241-08.cedarville.edu # Date 2012-11-19 20:10:19 # Node ID dc66341db8147ea0129c64081b7d0e3c1e7209a9 # Parent ebc4074e751f75f247634cf5f83baae5066b1ead Added watchdog timer library, additional logger testing diff --git a/master/master/lib/afsk.c b/master/master/lib/afsk.c --- a/master/master/lib/afsk.c +++ b/master/master/lib/afsk.c @@ -221,13 +221,6 @@ void afsk_setup() { // todo: init radio, maybe in main sei(); -} - - -void afsk_test() { - uint8_t flap[26] = {"abcdefghijklmnopqrstuvwxyz"}; - afsk_send(flap, sizeof(flap)*8); - afsk_start(); + while(afsk_busy()); - _delay_ms(500); -} +} \ No newline at end of file diff --git a/master/master/lib/led.c b/master/master/lib/led.c --- a/master/master/lib/led.c +++ b/master/master/lib/led.c @@ -15,12 +15,12 @@ void led_setup() { void led_on(uint8_t led) { // Turn the specified LED on - PORTA |= led; + PORTA |= (1< +#include +#include + +//initialize watchdog +void watchdog_setup(void) +{ + + cli(); + wdt_reset(); + // Set change enable bit, enable the WDT + WDTCSR = (1< #include +#include #include "lib/serial.h" #include "lib/aprs.h" #include "lib/afsk.h" #include "lib/led.h" #include "lib/logger.h" - +#include "lib/watchdog.h" #include "lib/sd/sd_raw_config.h" void micro_setup() { // Generic microcontroller config options - } int main(void) { - // Initialize + // Initialize. If this takes more than 4 seconds, be sure to reset the WDT micro_setup(); + watchdog_setup(); led_setup(); - - //serial_setup(); // Config serial ports + serial_setup(); // Config serial ports + logger_setup(); // this takes a few ms + afsk_setup(); // can take a few ms + + led_on(POWER); - logger_setup(); // this takes a few ms - - afsk_setup(); - while(afsk_busy()); - - led_on(4); + uint16_t ctr1 = 0; + uint16_t ctr2 = 255; + + char logbuf[32]; while(1) { - led_on(2); - logger_log("123,43,1,2,4,3\n"); - led_off(2); + led_on(STAT); + sprintf(logbuf, "%d,%d,%d,%d,%d,%d\n", ctr1,5*ctr1,ctr2, 12*ctr2,43*ctr1,5*ctr2); + logger_log(logbuf); + led_off(STAT); // Wait for transmission to complete before starting another. // Hopefully this will never delay because it should issue on a timed schedule. Software timers! while(afsk_busy()); - aprs_send(); - - //serial_SendCommand('0','A',0,0); + aprs_send(); // non-blocking + ctr1++; + ctr2-=6; + wdt_reset(); } } \ No newline at end of file diff --git a/master/master/master.cproj b/master/master/master.cproj --- a/master/master/master.cproj +++ b/master/master/master.cproj @@ -201,6 +201,12 @@ compile + + compile + + + compile + compile