#include #include #include "led.h" #include "breathing_led.h" #include "debug.h" #define BREATHING_LED_TIMER_TOP F_CPU/256 static uint8_t breathing_led_duration = 0; void breathing_led_init(void) { #ifdef BREATHING_LED_TIMER1 /* Timer1 setup */ /* CTC mode */ TCCR1B |= (1<>8)&0xff; OCR1AL = BREATHING_LED_TIMER_TOP&0xff; #else /* Timer3 setup */ /* CTC mode */ TCCR3B |= (1<>8)&0xff; OCR3AL = BREATHING_LED_TIMER_TOP&0xff; #endif SREG = sreg; } void breathing_led_enable(void) { /* Enable Compare Match Interrupt */ #ifdef BREATHING_LED_TIMER1 TIMSK1 |= (1< breathing_led_duration) { step = 0; breathing_led_set_raw(pgm_read_byte(&breathing_table[index])); index++; } }