22 #ifndef ADC_RESOLUTION
37 #define ADC_RESOLUTION ADC_RESSEL_10BIT_gc
40 #ifndef ADC_CAPACITANCE
54 #define ADC_CAPACITANCE 1
72 #define ADC_REFERENCE ADC_REFSEL_INTREF_gc
75 #if ADC_REFERENCE == ADC_REFSEL_INTREF_gc
93 #define VREF_REFSEL VREF_ADC0REFSEL_1V5_gc
119 #define ADC_PRESCALER ADC_PRESC_DIV256_gc
122 #ifndef ADC_INIT_DELAY
142 #define ADC_INIT_DELAY ADC_INITDLY_DLY0_gc
145 #ifndef ADC_SAMPLE_DELAY_VARIATION
160 #define ADC_SAMPLE_DELAY_VARIATION ADC_ASDV_ASVOFF_gc
163 #ifndef ADC_SAMPLE_DELAY
173 #define ADC_SAMPLE_DELAY 8
176 #ifndef ADC_SAMPLE_LENGTH
186 #define ADC_SAMPLE_LENGTH 8
ADC_Channel_t
Selects the ADC input channel.
Definition adc.h:254
@ ADC_CH0
Definition adc.h:255
@ ADC_GND
Definition adc.h:268
@ ADC_CH3
Definition adc.h:258
@ ADC_CH5
Definition adc.h:260
@ ADC_CH8
Definition adc.h:263
@ ADC_CH10
Definition adc.h:265
@ ADC_CH1
Definition adc.h:256
@ ADC_CH9
Definition adc.h:264
@ ADC_INTREF
Definition adc.h:267
@ ADC_CH11
Definition adc.h:266
@ ADC_CH2
Definition adc.h:257
@ ADC_CH7
Definition adc.h:262
@ ADC_CH4
Definition adc.h:259
@ ADC_CH6
Definition adc.h:261
void adc_init(void)
Initialize the ADC peripheral with pre-configured settings.
Definition adc.c:34
void adc_disable(void)
Disable the ADC module.
Definition adc.c:59
void adc_channel(ADC_Channel channel)
Select the ADC input channel.
Definition adc.c:74
unsigned int adc_average(unsigned char samples)
Perform multiple ADC conversions and return the average result (calculated in software).
Definition adc.c:130
enum ADC_Channel_t ADC_Channel
Alias for enum ADC_Channel_t representing ADC input channel selections.
Definition adc.h:275
ADC_Accumulation_t
Defines the number of ADC samples to be accumulated and averaged.
Definition adc.h:225
@ ADC_Sample_8
Definition adc.h:229
@ ADC_Sample_16
Definition adc.h:230
@ ADC_Sample_32
Definition adc.h:231
@ ADC_Sample_64
Definition adc.h:232
@ ADC_Sample_2
Definition adc.h:227
@ ADC_Sample_4
Definition adc.h:228
@ ADC_Sample_None
Definition adc.h:226
unsigned int adc_read(void)
Perform a single ADC conversion and return the result (polling mode).
Definition adc.c:106
enum ADC_Accumulation_t ADC_Accumulation
Alias for enum ADC_Accumulation_t representing ADC sample accumulation modes.
Definition adc.h:239
void adc_accumulation(ADC_Accumulation samples)
Set the ADC sample accumulation mode.
Definition adc.c:89