Changeset - d97bfe03aa80
[Not reviewed]
default
0 1 0
kripperger@CL-SEC241-09.cedarville.edu - 12 years ago 2013-03-19 15:08:12
kripperger@CL-SEC241-09.cedarville.edu
Added WDT alert LED
1 file changed with 6 insertions and 1 deletions:
0 comments (0 inline, 0 general)
slave/slave/slave.c
Show inline comments
 
@@ -14,6 +14,7 @@
 
#include "config.h"
 

	
 
#include <stdio.h>
 
#include <stdbool.h>
 
#include <inttypes.h>
 
#include <avr/io.h>
 
#include <compat/twi.h>
 
@@ -35,11 +36,13 @@
 
#include "lib/masterComm.h"
 
#include "lib/watchdog.h"
 

	
 
bool WDTreset = false;
 

	
 
void micro_setup()
 
{
 
	// Generic microcontroller config options
 
	sei();			// Enable interrupts
 
	WDTreset = ((MCUSR & 0b00001000) > 0);	// Set variable if WDT reset occured
 
	MCUSR = 0;		// Clear reset flags
 
	wdt_disable();	// Disable WDT
 
	_delay_ms(20);	// Power debounce
 
@@ -70,13 +73,15 @@ int main(void)
 

	
 
	uint32_t lastLoop = 0;
 
	
 
	if(WDTreset) led_on(1);	// Turn on LED if WDT reset has occured
 
	
 
	// Serial output //DEBUG
 
	char buff[128];						//Buffer for serial output //DEBUG
 
	serial1_sendString("Starting Slave\r\n");	//DEBUG
 
			
 
    while(1)
 
    {	
 
		wdt_reset();
 
		wdt_reset();	// Resets WDT (to prevent restart)
 
		
 
		// Master communication
 
		masterComm_checkParser();	//Checks parser for data requests from master
0 comments (0 inline, 0 general)