#include <avr/io.h>
#include <avr/interrupt.h>
#include "ledio.h"

int	debug_ledstate=0;

void debug_led_on(){
	DEBUGLED_DDR  |= 0x01;
	DEBUGLED_PORT &= 0xfe;
	debug_ledstate=1;
}

void debug_led_off(){
	DEBUGLED_DDR  |= 0x01;
	DEBUGLED_PORT |= 0x01;
	debug_ledstate=0;
}

void debug_led_inv(){
	if (debug_ledstate == 0){
		debug_led_on();
		debug_ledstate = 1;
	}else{
		debug_led_off();
		debug_ledstate = 0;
	}
}

void debug_led_blink(int times){
	int	n;
	
	times <<= 1;
	for (n=0 ; n<times ; n++){
		debug_led_inv();
//		_delay_ms(300);
	}
}
