/* Initialize the delay driver. 
This must be called during start up to initialize the delay routine with the current used main clock. It must run any time the main CPU clock is changed.  */
void delay_init(void)
/* Initialize the delay driver. 
This must be called during start up to initialize the delay routine with the current used main clock. It must run any time the main CPU clock is changed.  */
void delay_init(void)
{
	cycles_per_ms = system_gclk_gen_get_hz(0);
	cycles_per_ms /= 1000;
	cycles_per_us = cycles_per_ms / 1000;
	SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk | SysTick_CTRL_ENABLE_Msk;
}