/* Configures the TC to generate output events at the sample frequency. 
Configures the TC in Frequency Generation mode, with an event output once each time the audio sample frequency period expires. */
static void configure_tc(struct tc_module *tc_module)
/* Configures the TC to generate output events at the sample frequency. 
Configures the TC in Frequency Generation mode, with an event output once each time the audio sample frequency period expires. */
static void configure_tc(struct tc_module *tc_module)
{
	struct tc_config config;
	tc_get_config_defaults(&config);
	config.clock_source    = GCLK_GENERATOR_0;
	config.wave_generation = TC_WAVE_GENERATION_MATCH_FREQ;
	tc_init(tc_module, TC3, &config);
	struct tc_events events = { .generate_event_on_overflow = true };
	tc_enable_events(tc_module, &events);
	tc_set_top_value(tc_module,
			system_gclk_gen_get_hz(GCLK_GENERATOR_0) / sample_rate);
	tc_enable(tc_module);
}