6 volatile uint8_t *peripheral_register;
8 volatile uint8_t *port;
16 static LED LED_leds[4] =
17 { { &DDRC, DDC0, &PORTC, PC0,
false, state_OFF }
18 , { &DDRC, DDC1, &PORTC, PC1,
false, state_OFF }
19 , { &DDRC, DDC2, &PORTC, PC2,
false, state_OFF }
20 , { &DDRC, DDC3, &PORTC, PC3,
false, state_OFF }
22 #define NUMBER_OF_LEDS ( sizeof(LED_leds) / sizeof(LED) )
25 static void LED_init(
LED *led)
30 *led->peripheral_register |= _BV(led->peripheral);
35 if(led_num >= NUMBER_OF_LEDS)
38 LED_init(&LED_leds[led_num]);
40 *LED_leds[led_num].port |= _BV(LED_leds[led_num].pin);
42 LED_leds[led_num].state = state_ON;
47 if(led_num >= NUMBER_OF_LEDS)
50 LED_init(&LED_leds[led_num]);
52 *LED_leds[led_num].port &= ~(_BV(LED_leds[led_num].pin));
54 LED_leds[led_num].state = state_OFF;
59 if(led_num >= NUMBER_OF_LEDS)
void LED_set(uint8_t led_num, bool state)
void LED_off(uint8_t led_num)
void LED_on(uint8_t led_num)