/* ADC Window Monitor mode. 
This function configures the ADC as window monitor mode and predefine the voltage level for monitoring. If the ADC input exceeds the voltage level the LED0 will be in ON state in SAMD21 Xplained Pro.  */
void adc_window_monitor(void)
/* ADC Window Monitor mode. 
This function configures the ADC as window monitor mode and predefine the voltage level for monitoring. If the ADC input exceeds the voltage level the LED0 will be in ON state in SAMD21 Xplained Pro.  */
void adc_window_monitor(void)
{
	configure_adc_window_monitor();
	adc_start_conversion(&adc_instance);
	while((adc_get_status(&adc_instance) & ADC_STATUS_RESULT_READY) != 1);
	status = adc_get_status(&adc_instance);
	adc_read(&adc_instance, &raw_result);
	if (status & ADC_STATUS_WINDOW){
		port_pin_set_output_level(LED0_PIN, LOW);
		printf("\nLED0 is ON");
	}
	else{
		port_pin_set_output_level(LED0_PIN, HIGH);
		printf("\nLED0 is OFF");
	}
}