#include #include "lights.h" void gpio_init() { DDRB |= _BV(PB0) | _BV(PB2); // LED4, LED5 PORTB &=~ (_BV(PB0) | _BV(PB2)); DDRA |= _BV(PA3) | _BV(PA4); // LED6, LED7 PORTB &=~ (_BV(PA3) | _BV(PA4)); gpio_set(1, 1); } void gpio_set(unsigned char n, unsigned char on) { if (on) { switch(n) { case 0: PORTB |= _BV(PB0); break; case 1: PORTB |= _BV(PB2); break; case 2: PORTA |= _BV(PA3); break; case 3: PORTA |= _BV(PA4); break; } } else { switch(n) { case 0: PORTB &= ~_BV(PB0); break; case 1: PORTB &= ~_BV(PB2); break; case 2: PORTA &= ~_BV(PA3); break; case 3: PORTA &= ~_BV(PA4); break; } } }