Testground/Test/led.c

23 lines
424 B
C
Raw Permalink Normal View History

2013-10-06 18:10:06 +02:00
/*
* led.c
*
* Created: 06.10.2013 16:32:15
* Author: netz
*/
#include <avr/io.h>
void ledg(int mask) {
int rgb = 0;
rgb |= (mask & (1<<0)) ? (1<<0) : (0<<0);
rgb |= (mask & (1<<1)) ? (1<<1) : (0<<1);
rgb |= (mask & (1<<2)) ? (1<<2) : (0<<2);
PORTB &= ~((1<<PINB5) | (1<<PINB6) | (1<<PINB7));
PORTB |= (rgb<<PINB5);
}
void init_led()
{
DDRB |= (1<<PINB7) | (1<<PINB6) | (1<<PINB5);
}