From a4eeb4396308e1b0d089d9d4c821e2308924001f Mon Sep 17 00:00:00 2001 From: Werner Almesberger Date: Sun, 1 Jul 2012 10:24:18 -0300 Subject: [PATCH] fw/sweep.c (set_line): export line setting (output on LEDs) function --- fw/sweep.c | 4 +--- fw/sweep.h | 13 +++++++++++++ 2 files changed, 14 insertions(+), 3 deletions(-) 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);