AllJoyn/Samples/BACnetAdapter/bacnet-stack-0.8.2/ports/xplained/timer1.c
bool timer_callback(
    timer_callback_function callback,
    uint32_t milliseconds)
{
    bool status = false;
    uint32_t now, i;

    tc_set_overflow_interrupt_level(&MY_TIMER, TC_INT_LVL_OFF);
    now = Millisecond_Counter;
    for (i = 0; i < TIMER_CALLBACK_MAX; i++) {
        if (Callback_Data[i].callback == NULL) {
            Callback_Data[i].interval = milliseconds;
            /* set the first expiration time */
            Callback_Data[i].milliseconds = now + milliseconds;
            Callback_Data[i].callback = callback;
            status = true;
            break;
        }
    }                    
    tc_set_overflow_interrupt_level(&MY_TIMER, TC_INT_LVL_LO);

    return status;
}
/**
 * Configures and enables a repeating callback function
 *
 * @param callback - pointer to a #timer_callback_function function
 * @param milliseconds - how often to call the function
 *
 * @return true if successfully added and enabled
 */
Configures and enables a repeating callback function
@param callback - pointer to a #timer_callback_function function
@param milliseconds - how often to call the function

@return true if successfully added and enabled
Configures and enables a repeating callback function @param callback - pointer to a #timer_callback_function function @param milliseconds - how often to call the function @return true if successfully added and enabled
bool timer_callback(
    timer_callback_function callback,
    uint32_t milliseconds)
{
    bool status = false;
    uint32_t now, i;
    tc_set_overflow_interrupt_level(&MY_TIMER, TC_INT_LVL_OFF);
    now = Millisecond_Counter;
    for (i = 0; i < TIMER_CALLBACK_MAX; i++) {
        if (Callback_Data[i].callback == NULL) {
            Callback_Data[i].interval = milliseconds;
            Callback_Data[i].milliseconds = now + milliseconds;
            Callback_Data[i].callback = callback;
            status = true;
            break;
        }
    }                    
    tc_set_overflow_interrupt_level(&MY_TIMER, TC_INT_LVL_LO);
    return status;
}
bool timer_callback ( timer_callback_function callback , uint32_t milliseconds ) { bool status = false ; uint32_t now , i ; tc_set_overflow_interrupt_level ( & MY_TIMER , TC_INT_LVL_OFF ) ; now = Millisecond_Counter ; for ( i = 0 ; i < TIMER_CALLBACK_MAX ; i ++ ) { if ( Callback_Data [ i ] . callback == NULL ) { Callback_Data [ i ] . interval = milliseconds ; Callback_Data [ i ] . milliseconds = now + milliseconds ; Callback_Data [ i ] . callback = callback ; status = true ; break ; } } tc_set_overflow_interrupt_level ( & MY_TIMER , TC_INT_LVL_LO ) ; return status ; }
Configures and enables a repeating callback function
 @param callback - pointer to a #timer_callback_function function
 @param milliseconds - how often to call the function
Configures and enables a repeating callback function @param callback - pointer to a #timer_callback_function function @param milliseconds - how often to call the function
/* set the first expiration time */