7#ifndef DRV_MCC_EXTENSION_ADC_H
8#define DRV_MCC_EXTENSION_ADC_H
58 ADFL0CONbits.FLEN = (uint16_t)enable;
61 ADFL1CONbits.FLEN = (uint16_t)enable;
64 ADFL2CONbits.FLEN = (uint16_t)enable;
67 ADFL3CONbits.FLEN = (uint16_t)enable;
89 ADFL0CONbits.MODE = (uint16_t)mode;
92 ADFL1CONbits.MODE = (uint16_t)mode;
95 ADFL2CONbits.MODE = (uint16_t)mode;
98 ADFL3CONbits.MODE = (uint16_t)mode;
120 ADFL0CONbits.OVRSAM = (uint16_t)averagingRatio;
123 ADFL1CONbits.OVRSAM = (uint16_t)averagingRatio;
126 ADFL2CONbits.OVRSAM = (uint16_t)averagingRatio;
129 ADFL3CONbits.OVRSAM = (uint16_t)averagingRatio;
147 if (channelIndex <= 25)
152 ADFL0CONbits.FLCHSEL = channelIndex;
155 ADFL1CONbits.FLCHSEL = channelIndex;
158 ADFL2CONbits.FLCHSEL = channelIndex;
161 ADFL3CONbits.FLCHSEL = channelIndex;
179 uint16_t filterResult = 0;
183 filterResult = ADFL0DAT;
186 filterResult = ADFL1DAT;
189 filterResult = ADFL2DAT;
192 filterResult = ADFL3DAT;
197 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