#include #include "lights.h" void gpio_init() { DDRB |= _BV(PB2) | _BV(PB4); PORTB &=~ (_BV(PB2) | _BV(PB4)); gpio_set(GPIO_LED2, 1); } void gpio_set(unsigned char n, unsigned char on) { unsigned char bits = 0; switch(n) { case GPIO_LED1: bits = _BV(PB4); break; case GPIO_LED2: bits = _BV(PB2); break; } if (on) { PORTB |= bits; } else { PORTB &= ~bits; } }