AllJoyn/Samples/BACnetAdapter/bacnet-stack-0.8.2/ports/xplained/timer1.c
void timer_init(void)
{
    unsigned long period;

    tc_enable(&MY_TIMER);
    tc_set_overflow_interrupt_callback(&MY_TIMER, my_callback);
    tc_set_wgm(&MY_TIMER, TC_WG_NORMAL);
    tc_write_count(&MY_TIMER, 1);
    period = sysclk_get_peripheral_bus_hz(&MY_TIMER);
    period /= 1000;
    tc_write_period(&MY_TIMER, period);
    tc_set_overflow_interrupt_level(&MY_TIMER, TC_INT_LVL_LO);
    tc_write_clock_source(&MY_TIMER, TC_CLKSEL_DIV1_gc);
}
/**
 * Timer setup for 1 millisecond timer
 */
Timer setup for 1 millisecond timer
Timer setup for 1 millisecond timer
void timer_init(void)
{
    unsigned long period;
    tc_enable(&MY_TIMER);
    tc_set_overflow_interrupt_callback(&MY_TIMER, my_callback);
    tc_set_wgm(&MY_TIMER, TC_WG_NORMAL);
    tc_write_count(&MY_TIMER, 1);
    period = sysclk_get_peripheral_bus_hz(&MY_TIMER);
    period /= 1000;
    tc_write_period(&MY_TIMER, period);
    tc_set_overflow_interrupt_level(&MY_TIMER, TC_INT_LVL_LO);
    tc_write_clock_source(&MY_TIMER, TC_CLKSEL_DIV1_gc);
}
void timer_init ( void ) { unsigned long period ; tc_enable ( & MY_TIMER ) ; tc_set_overflow_interrupt_callback ( & MY_TIMER , my_callback ) ; tc_set_wgm ( & MY_TIMER , TC_WG_NORMAL ) ; tc_write_count ( & MY_TIMER , 1 ) ; period = sysclk_get_peripheral_bus_hz ( & MY_TIMER ) ; period /= 1000 ; tc_write_period ( & MY_TIMER , period ) ; tc_set_overflow_interrupt_level ( & MY_TIMER , TC_INT_LVL_LO ) ; tc_write_clock_source ( & MY_TIMER , TC_CLKSEL_DIV1_gc ) ; }
Timer setup for 1 millisecond timer
Timer setup for 1 millisecond timer