void receive_or_transmit_interrupt()
{
g_traffic = true;
/* other stuff. */
}
void timer_that_fires_every_100_milliseconds()
{
if ( led == ON)
{
led = OFF;
g_traffic = false;
}
else if ( g_traffic )
{
led = ON;
}
}
If you don't want the timer to always be firing even when there's not traffic, you could change the receive_or_transmit_interrupt
to enable the timer, and the timer could disable itself when it turns off the LED.