#include "config.h" #include "Port.h" #include #define SET_RED_LED() PORTB &= ~_BV(REDPIN) #define CLR_RED_LED() PORTB |= _BV(REDPIN) #define SET_GRN_LED() PORTB &= (~_BV(GRNPIN)) #define CLR_GRN_LED() PORTB |= _BV(GRNPIN) void inline io_init(void) { PORTB |= _BV(REDPIN)|_BV(GRNPIN); //HIGH DDRB |= _BV(REDPIN)|_BV(GRNPIN); //OUTPUT } void inline acmp_init(void) { ACSR = _BV(ACIE); //enable interrupt } void inline blinky(void) { if (ACSR&(_BV(ACO))) { SET_RED_LED(); CLR_GRN_LED(); } else { CLR_RED_LED(); SET_GRN_LED(); } } SIGNAL(SIG_COMPARATOR) { blinky(); } int main(void) { io_init(); acmp_init(); blinky(); while (1) { } return 0; }