Files @ 6060ac6db4a5
Branch filter:

Location: seniordesign-firmware/master/master/lib/led.c

ethanzonca@CL-SEC241-08.cedarville.edu
Added error code functionality for error LED, added SD card errors.
/*
 * led.c
 *
 * Created: 10/25/2012 3:34:03 PM
 *  Author: ethanzonca
 */ 
#include "../config.h"
#include <avr/io.h>
#include <util/delay.h>
#include "led.h"

void led_setup() 
{
	// Configure ports/pins for LEDs
	DDRA = 0xff;
	//PORTA = 0x00;
}

void led_on(uint8_t led) 
{
	// Turn the specified LED on
	PORTA |= (1<<led);
}

void led_off(uint8_t led) 
{
	// Turn the specified LED off
	PORTA &= ~(1<<led);
}

void led_toggle(uint8_t led) 
{
	// Toggle the specified LED 
}

// Flashes error LED a set amount of times, then leaves it on
void led_errorcode(uint8_t code) 
{
	_delay_ms(400);
	for(int i=0; i<code; i++) 
	{
		led_on(ERROR);
		_delay_ms(150);
		led_off(ERROR);
		_delay_ms(150);
	}
	_delay_ms(400);
	led_on(ERROR);
}