/* Retrieves the clock frequency of a Generic Clock channel. 
Determines the clock frequency (in Hz) of a specified Generic Clock channel, used as a source to a device peripheral module. */
uint32_t system_gclk_chan_get_hz(const uint8_t channel)
/* Retrieves the clock frequency of a Generic Clock channel. 
Determines the clock frequency (in Hz) of a specified Generic Clock channel, used as a source to a device peripheral module. */
uint32_t system_gclk_chan_get_hz(const uint8_t channel)
{
	uint8_t gen_id;
	system_interrupt_enter_critical_section();
	*((uint8_t*)&GCLK->CLKCTRL.reg) = channel;
	gen_id = GCLK->CLKCTRL.bit.GEN;
	system_interrupt_leave_critical_section();
	return system_gclk_gen_get_hz(gen_id);
}