Browse Source

factor out led_tick()

master
Olaf Rempel 6 years ago
parent
commit
7bd831d169
  1. 46
      funkstuff.c

46
funkstuff.c

@ -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();
}

Loading…
Cancel
Save