/* Configure ADC to sample the internal scaled VCC.  */
static void configure_adc(void)
/* Configure ADC to sample the internal scaled VCC.  */
static void configure_adc(void)
{
	struct adc_config config;
	adc_get_config_defaults(&config);
	config.clock_source = GCLK_GENERATOR_0;
	config.clock_prescaler = ADC_CLOCK_PRESCALER_DIV4;
	config.reference = ADC_REFERENCE_INTREF;
	config.event_action = ADC_EVENT_ACTION_START_CONV;
	config.run_in_standby = true;
	config.on_demand = true;
	config.resolution = ADC_RESOLUTION_12BIT;
	adc_init(&adc_instance, ADC, &config);
	adc_enable(&adc_instance);
}