2.8.1.1.2 Code
Add to the main application source file, outside of any functions:
Copy-paste the following setup code to your user application:struct
adc_module adc_instance;
Add to user application initialization (typically the start of main()):void
configure_adc(
void
)
{
struct
adc_config config_adc;
adc_get_config_defaults(&config_adc);
#if (SAMC21)
adc_init(&adc_instance, ADC1, &config_adc);
#else
adc_init(&adc_instance, ADC, &config_adc);
#endif
adc_enable(&adc_instance);
}
configure_adc();