software/src/ASF/common2/boards/user_board/init.c
/**
 * Configure the adc module to read 12-bit analog values,
 * - 12-bit is default
 */
Configure the adc module to read 12-bit analog values,
- 12-bit is default
Configure the adc module to read 12 - bit analog values - 12 - bit is default
void configure_adc(void)
{
  struct adc_config config_adc;
  adc_get_config_defaults(&config_adc);
  config_adc.reference = ADC_REFERENCE_AREFA;
  config_adc.positive_input = ADC_POSITIVE_INPUT_PIN4;
  config_adc.negative_input = ADC_NEGATIVE_INPUT_IOGND;
  config_adc.freerunning = false; 
  config_adc.pin_scan.offset_start_scan = 0;
  config_adc.pin_scan.inputs_to_scan =    16;
  enum status_code status;
  while ((status = adc_init(&adc_instance, ADC, &config_adc)) != STATUS_OK)
  {
    if (status != STATUS_BUSY)
    {
      while (1)
        ; 
    }
  }
  adc_regular_ain_channel((uint32_t*)&pinArrary, NUM_OF_AIN);
   use adc_register_callback(...) instead
  adc_enable_interrupt(&adc_instance, ADC_INTERRUPT_RESULT_READY);
  adc_enable(&adc_instance);
}
void configure_adc ( void ) { struct adc_config config_adc ; adc_get_config_defaults ( & config_adc ) ; config_adc . reference = ADC_REFERENCE_AREFA ; config_adc . positive_input = ADC_POSITIVE_INPUT_PIN4 ; config_adc . negative_input = ADC_NEGATIVE_INPUT_IOGND ; config_adc . freerunning = false ; config_adc . pin_scan . offset_start_scan = 0 ; config_adc . pin_scan . inputs_to_scan = 16 ; enum status_code status ; while ( ( status = adc_init ( & adc_instance , ADC , & config_adc ) ) != STATUS_OK ) { if ( status != STATUS_BUSY ) { while ( 1 ) ; } } adc_enable ( & adc_instance ) ; }
Configure the adc module to read 12-bit analog values,
 - 12-bit is default
Configure the adc module to read 12 - bit analog values - 12 - bit is default
/* ADC clock source */ // configure_gclk_source(GCLK_ADC, GCLK_GENERATOR_0); // Done in adc_init() // Set true for continuous recording // Error, stop everything /* Don't need adc_init does this */ //uint32_t pinArrary[NUM_OF_AIN] = { //PHOTO1_AIN, PHOTO2_AIN, //PHOTO3_AIN, PHOTO4_AIN, //PHOTO5_AIN, PHOTO6_AIN, //PHOTO7_AIN, PHOTO8_AIN, //}; // //adc_regular_ain_channel((uint32_t*)&pinArrary, NUM_OF_AIN); // use adc_register_callback(...) instead //adc_enable_interrupt(&adc_instance, ADC_INTERRUPT_RESULT_READY);