AllJoyn/Samples/BACnetAdapter/bacnet-stack-0.8.2/ports/xplained/ASF/xmega/services/timeout/timeout.c
static void tick_handler(uint32_t time)
{
	uint8_t i;

	/* Loop through all timeout channels */
	for (i = 0; i < TIMEOUT_COUNT; i++) {
		/* Skip processing on current channel if not active */
		if (!(timeout_active & (1 << i))) {
			continue;
		}

		/* Decrement current channel with one tick */
		timeout_array[i].count--;

		/* Skip further processing on current channel if not expired */
		if (timeout_array[i].count) {
			continue;
		} else {
			/* Update expired bit mask with current channel */
			timeout_expired |= 1 << i;

			/* If Periodic timer, reset timeout counter to period
			 * time */
			if (timeout_array[i].period) {
				timeout_array[i].count
					= timeout_array[i].period;
			}
			/* If not periodic timeout, set current channel to
			 * in-active */
			else {
				timeout_active &= ~(1 << i);
			}
		}
	}
	/* Reset RTC before next tick */
	rtc_set_time(0);
	rtc_set_alarm(TIMEOUT_COMP);
}
/**
 * \brief Callback function for RTC compare interrupt handler
 *
 * The function executes when the RTC compare interrupt occurs and loop
 * through all timeout channels. The timeout_array[channel_index] which
 * contains the remaining ticks before timeout is decremented and the timeout
 * active/expired masks are updated.
 */
\brief Callback function for RTC compare interrupt handler
The function executes when the RTC compare interrupt occurs and loop
through all timeout channels. The timeout_array[channel_index] which
contains the remaining ticks before timeout is decremented and the timeout
active/expired masks are updated.
\ brief Callback function for RTC compare interrupt handler The function executes when the RTC compare interrupt occurs and loop through all timeout channels . The timeout_array [ channel_index ] which contains the remaining ticks before timeout is decremented and the timeout active / expired masks are updated .
static void tick_handler(uint32_t time)
{
	uint8_t i;
	for (i = 0; i < TIMEOUT_COUNT; i++) {
		if (!(timeout_active & (1 << i))) {
			continue;
		}
		timeout_array[i].count--;
		if (timeout_array[i].count) {
			continue;
		} else {
			timeout_expired |= 1 << i;
			if (timeout_array[i].period) {
				timeout_array[i].count
					= timeout_array[i].period;
			}
			else {
				timeout_active &= ~(1 << i);
			}
		}
	}
	rtc_set_time(0);
	rtc_set_alarm(TIMEOUT_COMP);
}
static void tick_handler ( uint32_t time ) { uint8_t i ; for ( i = 0 ; i < TIMEOUT_COUNT ; i ++ ) { if ( ! ( timeout_active & ( 1 << i ) ) ) { continue ; } timeout_array [ i ] . count -- ; if ( timeout_array [ i ] . count ) { continue ; } else { timeout_expired |= 1 << i ; if ( timeout_array [ i ] . period ) { timeout_array [ i ] . count = timeout_array [ i ] . period ; } else { timeout_active &= ~ ( 1 << i ) ; } } } rtc_set_time ( 0 ) ; rtc_set_alarm ( TIMEOUT_COMP ) ; }
\brief Callback function for RTC compare interrupt handler
 The function executes when the RTC compare interrupt occurs and loop
 through all timeout channels.
\ brief Callback function for RTC compare interrupt handler The function executes when the RTC compare interrupt occurs and loop through all timeout channels .
/* Loop through all timeout channels */ /* Skip processing on current channel if not active */ /* Decrement current channel with one tick */ /* Skip further processing on current channel if not expired */ /* Update expired bit mask with current channel */ /* If Periodic timer, reset timeout counter to period
			 * time */ /* If not periodic timeout, set current channel to
			 * in-active */ /* Reset RTC before next tick */