#include <avr/io.h>
#include <util/delay.h>
#include <avr/interrupt.h>

#include "utils.h"
#include "bitmanip.h"


void rgb_d5_roll_colors() {
	MODE_OUTPUT(RGB5_RED);
	MODE_OUTPUT(RGB5_GEEN);
	MODE_OUTPUT(RGB5_BLUE);
	while(1) {
		// RED
		PORTD = (1<<D5R) | (0<<D5G) | (0<<D5B);
		_delay_ms(1000);
		// GREEN
		PORTD = (0<<D5R) | (1<<D5G) | (0<<D5B);
		_delay_ms(1000);
		// BLUE
		PORTD = (0<<D5R) | (0<<D5G) | (1<<D5B);
		_delay_ms(1000);
		// YELLOW
		PORTD = (1<<D5R) | (1<<D5G) | (0<<D5B);
		_delay_ms(1000);
		// CYAN
		PORTD = (0<<D5R) | (1<<D5G) | (1<<D5B);
		_delay_ms(1000);
		// MAGENTA
		PORTD = (1<<D5R) | (0<<D5G) | (1<<D5B);
		_delay_ms(1000);
		// WHITE
		PORTD = (1<<D5R) | (1<<D5G) | (1<<D5B);
		_delay_ms(1000);
	}
}

// led RGB D5 must turns on in a loop of colors: red, green, blue, yellow, cyan, magenta, white
int main() {

	while(1) {
		rgb_d5_roll_colors();
	}
}
