factor out led_tick()

This commit is contained in:
Olaf Rempel 2015-05-02 11:23:35 +02:00
parent dd00a86a85
commit 7bd831d169

View File

@ -50,7 +50,30 @@ ISR(TIMER0_OVF_vect)
} /* TIMER0_OVF_vect */
void uart_event_handler(struct event_entry *event)
static void led_tick(void)
{
if (led[LED_RX] > 0)
{
led[LED_RX]--;
LED_GN_ON();
}
else
{
LED_GN_OFF();
}
if (led[LED_TX] > 0)
{
led[LED_TX]--;
LED_RT_ON();
}
else
{
LED_RT_OFF();
}
} /* led_tick */
static void uart_event_handler(struct event_entry *event)
{
/* output all events on UART */
uart_putstr_p(PSTR("evt: "));
@ -102,29 +125,10 @@ int main(void)
{
clock_tick = 0;
if (led[LED_RX] > 0)
{
led[LED_RX]--;
LED_GN_ON();
}
else
{
LED_GN_OFF();
}
if (led[LED_TX] > 0)
{
led[LED_TX]--;
LED_RT_ON();
}
else
{
LED_RT_OFF();
}
/* do periodic work (wait for 5 ticks silence before start TX) */
rfm12_tick(5);
led_tick();
input_tick();
timer_tick();
}