4.7.1 ADC Associated Variables

The channel variable is needed for the ADC0_StartConversion() function.

adc_0_channel_t channel = ADC_MUXPOS_AIN1_gc;

In adc0.h, adc_0_channel_t is defined as type ADC_MUXPOS_t.

typedef ADC_MUXPOS_t adc_0_channel_t;

In the device-specific io.h file (in this case iom4809.h), ADC_MUXPOS_t is declared (ADC_MUXPOS_AIN2_gc through ADC_MUXPOS_AIN14_gc removed for brevity).

/* Analog Channel Selection Bits select */
typedef enum ADC_MUXPOS_enum
{
    ADC_MUXPOS_AIN0_gc = (0x00<<0),  /* ADC input pin 0 */
    ADC_MUXPOS_AIN1_gc = (0x01<<0),  /* ADC input pin 1 */
       :
    ADC_MUXPOS_AIN15_gc = (0x0F<<0),  /* ADC input pin 15 */
    ADC_MUXPOS_DACREF_gc = (0x1C<<0),  /* AC DAC Reference */
    ADC_MUXPOS_TEMPSENSE_gc = (0x1E<<0),  /* Temperature sensor */
    ADC_MUXPOS_GND_gc = (0x1F<<0),  /* 0V (GND) */
} ADC_MUXPOS_t;