diff --git a/fw/sweep.c b/fw/sweep.c index 1f98f77..4bc3e15 100644 --- a/fw/sweep.c +++ b/fw/sweep.c @@ -70,9 +70,7 @@ ISR(TIMER1_OVF_vect) /* output the next line */ - PORTB = (PORTB & 0x3f) | (curr_line->cb & 0xc0); - PORTC = curr_line->cb; - PORTD = curr_line->d; + set_line(*curr_line); /* move to the next line */ diff --git a/fw/sweep.h b/fw/sweep.h index d9bdcb5..329316c 100644 --- a/fw/sweep.h +++ b/fw/sweep.h @@ -17,6 +17,10 @@ #include #include +#include + +#include "image.h" + struct sweep { uint32_t start_ticks; /* absolute start time */ @@ -29,6 +33,15 @@ struct sweep { extern volatile bool sweeping; + +static inline void set_line(struct line line) +{ + PORTB = (PORTB & 0x3f) | (line.cb & 0xc0); + PORTC = line.cb; + PORTD = line.d; +} + + uint32_t uptime_irq(void); uint32_t uptime(void);