8#ifndef DRV_MCC_EXTENSION_ADC_H
9#define DRV_MCC_EXTENSION_ADC_H
59 ADFL0CONbits.FLEN = (uint16_t)enable;
62 ADFL1CONbits.FLEN = (uint16_t)enable;
65 ADFL2CONbits.FLEN = (uint16_t)enable;
68 ADFL3CONbits.FLEN = (uint16_t)enable;
90 ADFL0CONbits.MODE = (uint16_t)mode;
93 ADFL1CONbits.MODE = (uint16_t)mode;
96 ADFL2CONbits.MODE = (uint16_t)mode;
99 ADFL3CONbits.MODE = (uint16_t)mode;
121 ADFL0CONbits.OVRSAM = (uint16_t)averagingRatio;
124 ADFL1CONbits.OVRSAM = (uint16_t)averagingRatio;
127 ADFL2CONbits.OVRSAM = (uint16_t)averagingRatio;
130 ADFL3CONbits.OVRSAM = (uint16_t)averagingRatio;
148 if (channelIndex <= 25)
153 ADFL0CONbits.FLCHSEL = channelIndex;
156 ADFL1CONbits.FLCHSEL = channelIndex;
159 ADFL2CONbits.FLCHSEL = channelIndex;
162 ADFL3CONbits.FLCHSEL = channelIndex;
180 uint16_t filterResult = 0;
184 filterResult = ADFL0DAT;
187 filterResult = ADFL1DAT;
190 filterResult = ADFL2DAT;
193 filterResult = ADFL3DAT;
198 return (filterResult);
enum ADC_FILTER_MODE_e ADC_FILTER_MODE_t
enum ADC_FILTER_OVRSAM_AVG_e ADC_FILTER_OVRSAM_AVG_t
static void ADC_Filter_Input(uint16_t filterIndex, uint16_t channelIndex)
Sets the ADC instance to be filtered.
static void ADC_Filter_Mode(uint16_t filterIndex, ADC_FILTER_MODE_t mode)
Sets the ADC instance filter mode.
static void ADC_Filter_Enable(uint16_t filterIndex, bool enable)
Enables the ADC filter feature of the ADC.
static void ADC_Filter_Averaging(uint16_t filterIndex, ADC_FILTER_OVRSAM_AVG_t averagingRatio)
Sets the ADC instance number of samples to average.
ADC_FILTER_MODE_e
ADC Filter Modes of operation.
ADC_FILTER_OVRSAM_AVG_e
ADC Filter Oversampling Ratio when in averaging mode.
static uint16_t ADC_Filter_GetResult(uint16_t filterIndex)
Gets the ADC filter result.
@ ADC_FILTER_MODE_AVERAGING
@ ADC_FILTER_MODE_OVERSAMPLING
@ ADC_FILTER_OVRSAM_AVG_8x
@ ADC_FILTER_OVRSAM_AVG_4x
@ ADC_FILTER_OVRSAM_AVG_64x
@ ADC_FILTER_OVRSAM_AVG_16x
@ ADC_FILTER_OVRSAM_AVG_32x
@ ADC_FILTER_OVRSAM_AVG_256x
@ ADC_FILTER_OVRSAM_AVG_2x
@ ADC_FILTER_OVRSAM_AVG_128x