struct tc_module tc_instance;
structtc_config config_tc;
tc_get_config_defaults(&config_tc);
config_tc.counter_size = TC_COUNTER_SIZE_8BIT;config_tc.clock_source = GCLK_GENERATOR_1;config_tc.clock_prescaler = TC_CLOCK_PRESCALER_DIV1024;config_tc.counter_8_bit.period = 100;config_tc.counter_8_bit.compare_capture_channel[0] = 50;config_tc.counter_8_bit.compare_capture_channel[1] = 54;
tc_init(&tc_instance, CONF_TC_MODULE, &config_tc);
tc_enable(&tc_instance);
tc_register_callback(&tc_instance, tc_callback_to_toggle_led,TC_CALLBACK_OVERFLOW);tc_register_callback(&tc_instance, tc_callback_to_toggle_led,TC_CALLBACK_CC_CHANNEL0);tc_register_callback(&tc_instance, tc_callback_to_toggle_led,TC_CALLBACK_CC_CHANNEL1);
tc_enable_callback(&tc_instance, TC_CALLBACK_OVERFLOW);tc_enable_callback(&tc_instance, TC_CALLBACK_CC_CHANNEL0);tc_enable_callback(&tc_instance, TC_CALLBACK_CC_CHANNEL1);