The MCUXpresso SDK provides a driver for the Analog Digital converter (ADC) module of MCUXpresso SDK devices.
Function Groups
The ADC driver can be divided into 7 function groups.
ADC Basic Control Interfaces
The functions in this group can be used to configure the whole ADC module. To initialize the ADC module, the ADC_Init() is provided. Before invoking ADC_Init() function, user can use ADC_GetDefaultConfig() function to get default configurations.
ADC Calibration Control Interfaces
The ADC module supports both automatic calibration and user defined calibration. To do auto calibration, the function ADC_DoAutoCalibration() is provided, to do user defined calibration, the function ADC_DoUserCalibration() is provided.
ADC Temperature Sensor Control Interfaces
The functions in this group can be used to control temperature sensor, including enableing temperature sensor and setting temperature sensor mode.
ADC Audio Control Interfaces
This function group contains 3 functions to control audio. ADC_EnableAudio() can be used to enable/disable audio PGA and decimation rate select. ADC_SetAudioPGAVoltageGain() can be used to set audio PGA voltage gain. ADC_ConfigAudioVoiceLevel() can be used to configure audio voice level.
ADC Conversion Related Interfaces
Conversion related function are placed in this function group. If the trigger mode is set as software trigger, invoking ADC_DoSoftwareTrigger() to trigger the scan. ADC_SetScanChannel() function can be used to set each channel's mux source. After conversion completed, ADC_GetConversionResult() can be used to get 32-bit width packed ADC conversion result.
ADC Interrupt Control Interfaces
The functions in this group can be used to enable/disable interrupts.
ADC Status Control Interfaces
The ACOMP_GetStatusFlags() function in this group can return all status flags. The ACOMP_ClearStatusFlags() can be used to clear status flags, but please note that no all status flags can be cleared by software.
|
struct | adc_config_t |
| The structure of adc options, including clock divider, power mode, and so on. More...
|
|
|
enum | _adc_interrupt_enable {
kADC_DataReadyInterruptEnable = ADC_ADC_REG_IMR_RDY_MASK_MASK,
kADC_GainSaturationInterruptEnable = ADC_ADC_REG_IMR_GAINSAT_MASK_MASK,
kADC_OffsetSaturationInterruptEnable = ADC_ADC_REG_IMR_OFFSAT_MASK_MASK,
kADC_NegativeSaturationInterruptEnable = ADC_ADC_REG_IMR_DATASAT_NEG_MASK_MASK,
kADC_PositiveSaturationInterruptEnable = ADC_ADC_REG_IMR_DATASAT_POS_MASK_MASK,
kADC_FifoOverrunInterruptEnable = ADC_ADC_REG_IMR_FIFO_OVERRUN_MASK_MASK,
kADC_FifoUnderrunInterruptEnable = ADC_ADC_REG_IMR_FIFO_UNDERRUN_MASK_MASK
} |
| The enumeration of interrupts, this enumeration can be used to enable/disable interrupts. More...
|
|
enum | _adc_status_flags {
kADC_DataReadyInterruptFlag = 1UL << 0UL,
kADC_GainSaturationInterruptFlag = 1UL << 1UL,
kADC_OffsetSaturationInterruptFlag = 1UL << 2UL,
kADC_NegativeSaturationInterruptFlag = 1UL << 3UL,
kADC_PositiveSaturationInterruptFlag = 1UL << 4UL,
kADC_FifoOverrunInterruptFlag = 1UL << 5UL,
kADC_FifoUnderrunInterruptFlag = 1UL << 6UL,
kADC_DataReadyRawFlag = 1UL << 7UL,
kADC_GainSaturationRawFlag = 1UL << 8UL,
kADC_OffsetSaturationRawFlag = 1UL << 9UL,
kADC_NegativeSaturationRawFlag = 1UL << 10UL,
kADC_PositiveSaturationRawFlag = 1UL << 11UL,
kADC_FifoOverrunRawFlag = 1UL << 12UL,
kADC_FifoUnderrunRawFlag = 1UL << 13UL,
kADC_ActiveStatusFlag = 1UL << 14UL,
kADC_FIFONotEmptyStatusFlag = 1UL << 15UL,
kADC_FifoFullStatusFlag = 1UL << 16UL
} |
| The enumeration of adc status flags, including interrupt flags, raw flags, and so on. More...
|
|
enum | adc_clock_divider_t {
kADC_ClockDivider1 = 0U,
kADC_ClockDivider2 = 1U,
kADC_ClockDivider3 = 2U,
kADC_ClockDivider4 = 3U,
kADC_ClockDivider5 = 4U,
kADC_ClockDivider6 = 5U,
kADC_ClockDivider7 = 6U,
kADC_ClockDivider8 = 7U,
kADC_ClockDivider9 = 8U,
kADC_ClockDivider10 = 9U,
kADC_ClockDivider11 = 10U,
kADC_ClockDivider12 = 11U,
kADC_ClockDivider13 = 12U,
kADC_ClockDivider14 = 13U,
kADC_ClockDivider15 = 14U,
kADC_ClockDivider16 = 15U,
kADC_ClockDivider17 = 16U,
kADC_ClockDivider18 = 17U,
kADC_ClockDivider19 = 18U,
kADC_ClockDivider20 = 19U,
kADC_ClockDivider21 = 20U,
kADC_ClockDivider22 = 21U,
kADC_ClockDivider23 = 22U,
kADC_ClockDivider24 = 23U,
kADC_ClockDivider25 = 24U,
kADC_ClockDivider26 = 25U,
kADC_ClockDivider27 = 26U,
kADC_ClockDivider28 = 27U,
kADC_ClockDivider29 = 28U,
kADC_ClockDivider30 = 29U,
kADC_ClockDivider31 = 30U,
kADC_ClockDivider32 = 31U
} |
| ADC clock divider ratio type. More...
|
|
enum | adc_analog_portion_power_mode_t {
kADC_PowerModeFullBiasingCurrent = 0U,
kADC_PowerModeHalfBiasingCurrent
} |
| ADC analog portion low-power mode selection. More...
|
|
enum | adc_resolution_t {
kADC_Resolution12Bit = 0U,
kADC_Resolution14Bit = 1U,
kADC_Resolution16Bit = 2U,
kADC_Resolution16BitAudio = 3U
} |
| ADC resolution type. More...
|
|
enum | adc_warm_up_time_t {
kADC_WarmUpTime1us = 0U,
kADC_WarmUpTime2us,
kADC_WarmUpTime3us,
kADC_WarmUpTime4us,
kADC_WarmUpTime5us,
kADC_WarmUpTime6us,
kADC_WarmUpTime7us,
kADC_WarmUpTime8us,
kADC_WarmUpTime9us,
kADC_WarmUpTime10us,
kADC_WarmUpTime11us,
kADC_WarmUpTime12us,
kADC_WarmUpTime13us,
kADC_WarmUpTime14us,
kADC_WarmUpTime15us,
kADC_WarmUpTime16us,
kADC_WarmUpTime17us,
kADC_WarmUpTime18us,
kADC_WarmUpTime19us,
kADC_WarmUpTime20us,
kADC_WarmUpTime21us,
kADC_WarmUpTime22us,
kADC_WarmUpTime23us,
kADC_WarmUpTime24us,
kADC_WarmUpTime25us,
kADC_WarmUpTime26us,
kADC_WarmUpTime27us,
kADC_WarmUpTime28us,
kADC_WarmUpTime29us,
kADC_WarmUpTime30us,
kADC_WarmUpTime31us,
kADC_WarmUpTime32us,
kADC_WarmUpStateBypass = 0x20U
} |
| The enumeration of adc warm up time, the ADC warm-up state can also bypassed. More...
|
|
enum | adc_vref_source_t {
kADC_Vref1P8V = 0U,
kADC_Vref1P2V = 1U,
kADC_VrefExternal = 2U,
kADC_VrefInternal1P2V = 3U
} |
| ADC voltage reference source type. More...
|
|
enum | adc_input_mode_t {
kADC_InputSingleEnded = 0U,
kADC_InputDifferential = 1U
} |
| ADC input mode type. More...
|
|
enum | adc_conversion_mode_t {
kADC_ConversionOneShot = 0U,
kADC_ConversionContinuous = 1U
} |
| ADC conversion mode type. More...
|
|
enum | adc_scan_length_t {
kADC_ScanLength_1 = 0U,
kADC_ScanLength_2 = 1U,
kADC_ScanLength_3 = 2U,
kADC_ScanLength_4 = 3U,
kADC_ScanLength_5 = 4U,
kADC_ScanLength_6 = 5U,
kADC_ScanLength_7 = 6U,
kADC_ScanLength_8 = 7U,
kADC_ScanLength_9 = 8U,
kADC_ScanLength_10 = 9U,
kADC_ScanLength_11 = 10U,
kADC_ScanLength_12 = 11U,
kADC_ScanLength_13 = 12U,
kADC_ScanLength_14 = 13U,
kADC_ScanLength_15 = 14U,
kADC_ScanLength_16 = 15U
} |
| ADC scan length type. More...
|
|
enum | adc_average_length_t {
kADC_AverageNone = 0U,
kADC_Average2 = 1U,
kADC_Average4 = 2U,
kADC_Average8 = 3U,
kADC_Average16 = 4U
} |
| ADC average length type. More...
|
|
enum | adc_input_gain_t {
kADC_InputGain0P5 = 0U,
kADC_InputGain1 = 1U,
kADC_InputGain2 = 2U
} |
| ADC input buffer gain type. More...
|
|
enum | adc_result_width_t {
kADC_ResultWidth16 = 0U,
kADC_ResultWidth32 = 1U
} |
| ADC result width type. More...
|
|
enum | adc_fifo_threshold_t {
kADC_FifoThresholdData1 = 0U,
kADC_FifoThresholdData4,
kADC_FifoThresholdData8,
kADC_FifoThresholdData16
} |
| The threshold of FIFO. More...
|
|
enum | adc_calibration_ref_t {
kADC_CalibrationVrefInternal = 0,
kADC_CalibrationVrefExternal = 1
} |
| ADC calibration voltage reference type. More...
|
|
enum | adc_scan_channel_t {
kADC_ScanChannel0 = 0U,
kADC_ScanChannel1 = 1U,
kADC_ScanChannel2 = 2U,
kADC_ScanChannel3 = 3U,
kADC_ScanChannel4 = 4U,
kADC_ScanChannel5 = 5U,
kADC_ScanChannel6 = 6U,
kADC_ScanChannel7 = 7U,
kADC_ScanChannel8 = 8U,
kADC_ScanChannel9 = 9U,
kADC_ScanChannel10 = 10U,
kADC_ScanChannel11 = 11U,
kADC_ScanChannel12 = 12U,
kADC_ScanChannel13 = 13U,
kADC_ScanChannel14 = 14U,
kADC_ScanChannel15 = 15U
} |
| ADC scan channel type. More...
|
|
enum | adc_channel_source_t {
kADC_CH0 = 0U,
kADC_CH1 = 1U,
kADC_CH2 = 2U,
kADC_CH3 = 3U,
kADC_CH4 = 4U,
kADC_CH5 = 5U,
kADC_CH6 = 6U,
kADC_CH7 = 7U,
kADC_VBATS = 8U,
kADC_VREF = 9U,
kADC_DACA = 10U,
kADC_DACB = 11U,
kADC_VSSA = 12U,
kADC_CH0_CH1 = 0U,
kADC_CH2_CH3 = 1U,
kADC_CH4_CH5 = 2U,
kADC_CH6_CH7 = 3U,
kADC_DACA_DACB = 4U
} |
| ADC channel source type. More...
|
|
enum | adc_temperature_sensor_mode_t { kADC_TSensorExternal
} |
| Temperature sensor mode, including internal diode mode and external diode mode. More...
|
|
enum | adc_audio_pga_voltage_gain_t {
kADC_AudioGain4 = 0U,
kADC_AudioGain8 = 1U,
kADC_AudioGain16 = 2U,
kADC_AudioGain32 = 3U
} |
| ADC audio pga gain type. More...
|
|
enum | adc_audio_voice_level_t {
kADC_VoiceLevel0 = 0U,
kADC_VoiceLevel1 = 1U,
kADC_VoiceLevel2 = 2U,
kADC_VoiceLevel3 = 3U
} |
| ADC audio voice level selection. More...
|
|
|
static void | ADC_EnableInterrupts (ADC_Type *base, uint32_t interruptMask) |
| Enable interrupts, such as conversion data ready interrupt, gain correction saturation interrupt, FIFO under run interrupt, and so on. More...
|
|
static void | ADC_DisableInterrupts (ADC_Type *base, uint32_t interruptMask) |
| Disable interrupts, such as conversion data ready interrupt, gain correction saturation interrupt, FIFO under run interrupt, and so on. More...
|
|
Data Fields |
adc_clock_divider_t | clockDivider: 5U |
| Analog 64M clock division ratio, please refer to adc_clock_divider_t. More...
|
|
adc_resolution_t | resolution: 2U |
| Configure ADC resolution, please refer to adc_resolution_t. More...
|
|
adc_warm_up_time_t | warmupTime: 6U |
| Configure warm-up time. More...
|
|
adc_vref_source_t | vrefSource: 2U |
| Configure voltage reference source, please refer to adc_vref_source_t. More...
|
|
adc_input_mode_t | inputMode: 1U |
| Configure input mode, such as kADC_InputSingleEnded or kADC_InputDifferential. More...
|
|
adc_conversion_mode_t | conversionMode: 1U |
| Configure convrsion mode, such as kADC_ConversionOneShot or kADC_ConversionContinuous. More...
|
|
adc_scan_length_t | scanLength: 4U |
| Configure the length of scan, please refer to adc_scan_length_t. More...
|
|
adc_average_length_t | averageLength: 3U |
| Configure hardware average number, please refer to adc_average_length_t.
|
|
adc_trigger_source_t | triggerSource: 3U |
| Configure trigger source, the trigger source can be divided into hardware trigger and software trigger, please refer to adc_trigger_source_t for details. More...
|
|
adc_input_gain_t | inputGain: 2U |
| Configure ADC input buffer gain, please refer to adc_input_gain_t. More...
|
|
bool | enableInputGainBuffer: 1U |
| Enable/Disable input gain buffer. More...
|
|
bool | enableInputBufferChop: 1U |
| Enable/Disable input buffer chopper: More...
|
|
bool | enableChop: 1U |
| Enable/Disable the ADC chopper: More...
|
|
adc_result_width_t | resultWidth: 1U |
| Select result FIFO data packed format, please refer to adc_result_width_t. More...
|
|
adc_fifo_threshold_t | fifoThreshold: 2U |
| Configure FIFO threshold, please refer to adc_fifo_threshold_t. More...
|
|
bool | enableDMA: 1U |
| Enable/Disable DMA reqeust. More...
|
|
bool | enableADC: 1U |
| Enable/Disable ADC module. More...
|
|
adc_trigger_source_t adc_config_t::triggerSource |
bool adc_config_t::enableInputGainBuffer |
- true Enable input gain buffer.
- false Disable input gain buffer.
bool adc_config_t::enableInputBufferChop |
- true Enable input buffer chopper;
- false Disable input buffer chopper.
bool adc_config_t::enableChop |
- true Enable the chopper;
- false Disable the chopper.
bool adc_config_t::enableDMA |
- true Enable DMA request.
- false Disable DMA request.
bool adc_config_t::enableADC |
- true Enable ADC module.
- false Disable ADC module.
Enumerator |
---|
kADC_DataReadyInterruptEnable |
Conversion data ready interrupt.
|
kADC_GainSaturationInterruptEnable |
Gain correction saturation interrupt.
|
kADC_OffsetSaturationInterruptEnable |
Offset correction saturation interupt enable.
|
kADC_NegativeSaturationInterruptEnable |
ADC data negative side saturation interrupt enable.
|
kADC_PositiveSaturationInterruptEnable |
ADC data positive side saturation interrupt enable.
|
kADC_FifoOverrunInterruptEnable |
FIFO overrun interrupt enable.
|
kADC_FifoUnderrunInterruptEnable |
FIFO underrun interrupt enable.
|
- Note
- The raw flags will be captured regardless the interrupt mask. Both interrupt flags and raw flags can be cleared.
Enumerator |
---|
kADC_DataReadyInterruptFlag |
Conversion Data Ready interrupt flag.
|
kADC_GainSaturationInterruptFlag |
Gain correction saturation interrupt flag.
|
kADC_OffsetSaturationInterruptFlag |
Offset correction saturation interupt flag.
|
kADC_NegativeSaturationInterruptFlag |
ADC data negative side saturation interrupt flag.
|
kADC_PositiveSaturationInterruptFlag |
ADC data positive side saturation interrupt flag.
|
kADC_FifoOverrunInterruptFlag |
FIFO overrun interrupt flag.
|
kADC_FifoUnderrunInterruptFlag |
FIFO underrun interrupt flag.
|
kADC_DataReadyRawFlag |
Conversion data ready raw flag, this flag will be captured regardless the interrupt mask.
|
kADC_GainSaturationRawFlag |
Gain correction saturation raw flag, this flag will be captured regardless the interrupt mask.
|
kADC_OffsetSaturationRawFlag |
Offset correction saturation raw flag, this flag will be captured regardless the interrupt mask.
|
kADC_NegativeSaturationRawFlag |
ADC data negative side saturation raw flag, this flag will be captured regardless the interrupt mask.
|
kADC_PositiveSaturationRawFlag |
ADC data positive side saturation raw flag, this flag will be captured regardless the interrupt mask.
|
kADC_FifoOverrunRawFlag |
FIFO overrun raw flag, this flag will be captured regardless the interrupt mask.
|
kADC_FifoUnderrunRawFlag |
FIFO underrun interrupt mask, this flag will be captured regardless the interrupt mask.
|
kADC_ActiveStatusFlag |
ADC conversion active status flag.
|
kADC_FIFONotEmptyStatusFlag |
FIFO not empty status flag.
|
kADC_FifoFullStatusFlag |
FIFO full status flag.
|
Enumerator |
---|
kADC_ClockDivider1 |
Clock divider ratio is 1.
|
kADC_ClockDivider2 |
Clock divider ratio is 2.
|
kADC_ClockDivider3 |
Clock divider ratio is 3.
|
kADC_ClockDivider4 |
Clock divider ratio is 4.
|
kADC_ClockDivider5 |
Clock divider ratio is 5.
|
kADC_ClockDivider6 |
Clock divider ratio is 6.
|
kADC_ClockDivider7 |
Clock divider ratio is 7.
|
kADC_ClockDivider8 |
Clock divider ratio is 8.
|
kADC_ClockDivider9 |
Clock divider ratio is 9.
|
kADC_ClockDivider10 |
Clock divider ratio is 10.
|
kADC_ClockDivider11 |
Clock divider ratio is 11.
|
kADC_ClockDivider12 |
Clock divider ratio is 12.
|
kADC_ClockDivider13 |
Clock divider ratio is 13.
|
kADC_ClockDivider14 |
Clock divider ratio is 14.
|
kADC_ClockDivider15 |
Clock divider ratio is 15.
|
kADC_ClockDivider16 |
Clock divider ratio is 16.
|
kADC_ClockDivider17 |
Clock divider ratio is 17.
|
kADC_ClockDivider18 |
Clock divider ratio is 18.
|
kADC_ClockDivider19 |
Clock divider ratio is 19.
|
kADC_ClockDivider20 |
Clock divider ratio is 20.
|
kADC_ClockDivider21 |
Clock divider ratio is 21.
|
kADC_ClockDivider22 |
Clock divider ratio is 22.
|
kADC_ClockDivider23 |
Clock divider ratio is 23.
|
kADC_ClockDivider24 |
Clock divider ratio is 24.
|
kADC_ClockDivider25 |
Clock divider ratio is 25.
|
kADC_ClockDivider26 |
Clock divider ratio is 26.
|
kADC_ClockDivider27 |
Clock divider ratio is 27.
|
kADC_ClockDivider28 |
Clock divider ratio is 28.
|
kADC_ClockDivider29 |
Clock divider ratio is 29.
|
kADC_ClockDivider30 |
Clock divider ratio is 30.
|
kADC_ClockDivider31 |
Clock divider ratio is 31.
|
kADC_ClockDivider32 |
Clock divider ratio is 32.
|
Enumerator |
---|
kADC_PowerModeFullBiasingCurrent |
Full biasing current.
|
kADC_PowerModeHalfBiasingCurrent |
Half biasing current.
|
Enumerator |
---|
kADC_Resolution12Bit |
12-bit resolution
|
kADC_Resolution14Bit |
14-bit resolution
|
kADC_Resolution16Bit |
16-bit resolution
|
kADC_Resolution16BitAudio |
16-bit resolution for audio application
|
Enumerator |
---|
kADC_WarmUpTime1us |
ADC warm-up time is 1 us.
|
kADC_WarmUpTime2us |
ADC warm-up time is 2 us.
|
kADC_WarmUpTime3us |
ADC warm-up time is 3 us.
|
kADC_WarmUpTime4us |
ADC warm-up time is 4 us.
|
kADC_WarmUpTime5us |
ADC warm-up time is 5 us.
|
kADC_WarmUpTime6us |
ADC warm-up time is 6 us.
|
kADC_WarmUpTime7us |
ADC warm-up time is 7 us.
|
kADC_WarmUpTime8us |
ADC warm-up time is 8 us.
|
kADC_WarmUpTime9us |
ADC warm-up time is 9 us.
|
kADC_WarmUpTime10us |
ADC warm-up time is 10 us.
|
kADC_WarmUpTime11us |
ADC warm-up time is 11 us.
|
kADC_WarmUpTime12us |
ADC warm-up time is 12 us.
|
kADC_WarmUpTime13us |
ADC warm-up time is 13 us.
|
kADC_WarmUpTime14us |
ADC warm-up time is 14 us.
|
kADC_WarmUpTime15us |
ADC warm-up time is 15 us.
|
kADC_WarmUpTime16us |
ADC warm-up time is 16 us.
|
kADC_WarmUpTime17us |
ADC warm-up time is 17 us.
|
kADC_WarmUpTime18us |
ADC warm-up time is 18 us.
|
kADC_WarmUpTime19us |
ADC warm-up time is 19 us.
|
kADC_WarmUpTime20us |
ADC warm-up time is 20 us.
|
kADC_WarmUpTime21us |
ADC warm-up time is 21 us.
|
kADC_WarmUpTime22us |
ADC warm-up time is 22 us.
|
kADC_WarmUpTime23us |
ADC warm-up time is 23 us.
|
kADC_WarmUpTime24us |
ADC warm-up time is 24 us.
|
kADC_WarmUpTime25us |
ADC warm-up time is 25 us.
|
kADC_WarmUpTime26us |
ADC warm-up time is 26 us.
|
kADC_WarmUpTime27us |
ADC warm-up time is 27 us.
|
kADC_WarmUpTime28us |
ADC warm-up time is 28 us.
|
kADC_WarmUpTime29us |
ADC warm-up time is 29 us.
|
kADC_WarmUpTime30us |
ADC warm-up time is 30 us.
|
kADC_WarmUpTime31us |
ADC warm-up time is 31 us.
|
kADC_WarmUpTime32us |
ADC warm-up time is 32 us.
|
kADC_WarmUpStateBypass |
ADC warm-up state bypassed.
|
Enumerator |
---|
kADC_Vref1P8V |
Internal 1.8V reference.
|
kADC_Vref1P2V |
Internal 1.2V reference.
|
kADC_VrefExternal |
External single-ended reference though ADC_CH3.
|
kADC_VrefInternal1P2V |
Internal 1.2V reference with cap filter though ADC_CH3.
|
Enumerator |
---|
kADC_InputSingleEnded |
Single-ended mode.
|
kADC_InputDifferential |
Differential mode.
|
Enumerator |
---|
kADC_ConversionOneShot |
One shot mode.
|
kADC_ConversionContinuous |
Continuous mode.
|
Enumerator |
---|
kADC_ScanLength_1 |
Scan length is 1.
|
kADC_ScanLength_2 |
Scan length is 2.
|
kADC_ScanLength_3 |
Scan length is 3.
|
kADC_ScanLength_4 |
Scan length is 4.
|
kADC_ScanLength_5 |
Scan length is 5.
|
kADC_ScanLength_6 |
Scan length is 6.
|
kADC_ScanLength_7 |
Scan length is 7.
|
kADC_ScanLength_8 |
Scan length is 8.
|
kADC_ScanLength_9 |
Scan length is 9.
|
kADC_ScanLength_10 |
Scan length is 10.
|
kADC_ScanLength_11 |
Scan length is 11.
|
kADC_ScanLength_12 |
Scan length is 12.
|
kADC_ScanLength_13 |
Scan length is 13.
|
kADC_ScanLength_14 |
Scan length is 14.
|
kADC_ScanLength_15 |
Scan length is 15.
|
kADC_ScanLength_16 |
Scan length is 16.
|
Enumerator |
---|
kADC_AverageNone |
Average length: no average.
|
kADC_Average2 |
Average length: 2.
|
kADC_Average4 |
Average length: 4.
|
kADC_Average8 |
Average length: 8.
|
kADC_Average16 |
Average length: 16.
|
Enumerator |
---|
kADC_InputGain0P5 |
Input buffer gain is 0.5.
|
kADC_InputGain1 |
Input buffer gain is 1.
|
kADC_InputGain2 |
Input buffer gain is 2.
|
Enumerator |
---|
kADC_ResultWidth16 |
16-bit final result buffer width
|
kADC_ResultWidth32 |
32-bit final result buffer width
|
Enumerator |
---|
kADC_FifoThresholdData1 |
FIFO Threshold is 1 data.
|
kADC_FifoThresholdData4 |
FIFO Threshold is 4 data.
|
kADC_FifoThresholdData8 |
FIFO Threshold is 8 data.
|
kADC_FifoThresholdData16 |
FIFO Threshold is 16 data.
|
Enumerator |
---|
kADC_CalibrationVrefInternal |
Internal vref as input for calibration.
|
kADC_CalibrationVrefExternal |
External vref as input for calibration.
|
Enumerator |
---|
kADC_ScanChannel0 |
Scan channel 0.
|
kADC_ScanChannel1 |
Scan channel 1.
|
kADC_ScanChannel2 |
Scan channel 2.
|
kADC_ScanChannel3 |
Scan channel 3.
|
kADC_ScanChannel4 |
Scan channel 4.
|
kADC_ScanChannel5 |
Scan channel 5.
|
kADC_ScanChannel6 |
Scan channel 6.
|
kADC_ScanChannel7 |
Scan channel 7.
|
kADC_ScanChannel8 |
Scan channel 8.
|
kADC_ScanChannel9 |
Scan channel 9.
|
kADC_ScanChannel10 |
Scan channel 10.
|
kADC_ScanChannel11 |
Scan channel 11.
|
kADC_ScanChannel12 |
Scan channel 12.
|
kADC_ScanChannel13 |
Scan channel 13.
|
kADC_ScanChannel14 |
Scan channel 14.
|
kADC_ScanChannel15 |
Scan channel 15.
|
Enumerator |
---|
kADC_CH0 |
Single-ended mode, channel[0] and vssa.
|
kADC_CH1 |
Single-ended mode, channel[1] and vssa.
|
kADC_CH2 |
Single-ended mode, channel[2] and vssa.
|
kADC_CH3 |
Single-ended mode, channel[3] and vssa.
|
kADC_CH4 |
Single-ended mode, channel[4] and vssa.
|
kADC_CH5 |
Single-ended mode, channel[5] and vssa.
|
kADC_CH6 |
Single-ended mode, channel[6] and vssa.
|
kADC_CH7 |
Single-ended mode, channel[7] and vssa.
|
kADC_VBATS |
Single-ended mode, vbat_s and vssa.
|
kADC_VREF |
Single-ended mode, vref_12 and vssa.
|
kADC_DACA |
Single-ended mode, daca and vssa.
|
kADC_DACB |
Single-ended mode, dacb and vssa.
|
kADC_VSSA |
Single-ended mode, vssa and vssa.
|
kADC_CH0_CH1 |
Differential mode, channel[0] and channel[1].
|
kADC_CH2_CH3 |
Differential mode, channel[2] and channel[3].
|
kADC_CH4_CH5 |
Differential mode, channel[4] and channel[5].
|
kADC_CH6_CH7 |
Differential mode, channel[6] and channel[7].
|
kADC_DACA_DACB |
Differential mode, daca and dacb.
|
Enumerator |
---|
kADC_TSensorExternal |
External diode mode.
|
Enumerator |
---|
kADC_AudioGain4 |
Audio pga gain is 4.
|
kADC_AudioGain8 |
Audio pga gain is 8.
|
kADC_AudioGain16 |
Audio pga gain is 16.
|
kADC_AudioGain32 |
Audio pga gain is 32.
|
Enumerator |
---|
kADC_VoiceLevel0 |
Input voice level >+255LSB or <-256LSB.
|
kADC_VoiceLevel1 |
Input voice level >+511LSB or <-512LSB.
|
kADC_VoiceLevel2 |
Input voice level >+1023LSB or <-1024LSB.
|
kADC_VoiceLevel3 |
Input voice level >+2047LSB or <-2048LSB.
|
void ADC_Init |
( |
ADC_Type * |
base, |
|
|
const adc_config_t * |
config |
|
) |
| |
- Parameters
-
base | ADC peripheral base address. |
config | The pointer to the structure adc_config_t. |
* config->triggerSource = kADC_TriggerSourceSoftware;
* config->enableInputGainBuffer = false;
* config->enableDMA = false;
* config->enableADC = false;
*
- Parameters
-
void ADC_Deinit |
( |
ADC_Type * |
base | ) |
|
- Parameters
-
base | ADC peripheral base address. |
static void ADC_DoSoftwareReset |
( |
ADC_Type * |
base | ) |
|
|
inlinestatic |
- Parameters
-
base | ADC peripheral base address. |
- Note
- After auto calibrate successful, user can invoke ADC_GetAutoCalibrationData() to get self offset calibration value and self gain calibration value.
- Parameters
-
base | ADC peripheral base address. |
calVref | The inpul reference channel for gain calibration, please refer to adc_calibration_ref_t for details. |
- Return values
-
static void ADC_GetAutoCalibrationData |
( |
ADC_Type * |
base, |
|
|
uint16_t * |
offsetCal, |
|
|
uint16_t * |
gainCal |
|
) |
| |
|
inlinestatic |
- Parameters
-
base | ADC peripheral base address. |
offsetCal | Self offset calibration data pointer, evaluate NULL if not requried. |
gainCal | Self gain calibration data pointer, evaluate NULL if not requried. |
static void ADC_ResetAutoCalibrationData |
( |
ADC_Type * |
base | ) |
|
|
inlinestatic |
- Parameters
-
base | ADC peripheral base address. |
static void ADC_DoUserCalibration |
( |
ADC_Type * |
base, |
|
|
uint16_t |
offsetCal, |
|
|
uint16_t |
gainCal |
|
) |
| |
|
inlinestatic |
- Parameters
-
base | ADC peripheral base address. |
offsetCal | User defined offset calibration data. |
gainCal | User defined gain calibration date. |
static void ADC_EnableTemperatureSensor |
( |
ADC_Type * |
base, |
|
|
bool |
enable |
|
) |
| |
|
inlinestatic |
- Note
- This function is useful only when the channel source is temperature sensor.
- Parameters
-
base | ADC peripheral base address. |
enable | Used to enable/disable temperature sensor.
- true Enable temperature sensor.
- false Disable temperature sensor.
|
static void ADC_EnableAudio |
( |
ADC_Type * |
base, |
|
|
bool |
enable |
|
) |
| |
|
inlinestatic |
- Parameters
-
base | ADC peripheral base address. |
enable | Used to enable/disable audio PGA and decimation rate select.
- true Enable audio PGA and decimation rate select.
- false Disable audio PGA and decimation rate select.
|
- Parameters
-
base | ADC peripheral base address. |
enableDetect | Used to enable/disable voice level detection.
- true Enable voice level detection.
- false Disable voice level detection.
|
voiceLevel | Selected voice level, please refer to adc_audio_voice_level_t. |
- Parameters
-
base | ADC peripheral base address. |
scanChannel | The selected channel, please refer to adc_scan_channel_t for details. |
channelSource | The mux source to be set to the selected channel, please refer to adc_channel_source_t for details. |
static void ADC_DoSoftwareTrigger |
( |
ADC_Type * |
base | ) |
|
|
inlinestatic |
- Note
- This API will also clear the FIFO.
- Parameters
-
base | ADC peripheral base address. |
static void ADC_StopConversion |
( |
ADC_Type * |
base | ) |
|
|
inlinestatic |
- Parameters
-
base | ADC peripheral base address. |
static uint32_t ADC_GetConversionResult |
( |
ADC_Type * |
base | ) |
|
|
inlinestatic |
- Parameters
-
base | ADC peripheral base address. |
- Returns
- 32-bit width packed ADC conversion result.
static uint8_t ADC_GetFifoDataCount |
( |
ADC_Type * |
base | ) |
|
|
inlinestatic |
- Parameters
-
base | ADC peripheral base address. |
- Returns
- ADC FIFO data count.
static void ADC_EnableInterrupts |
( |
ADC_Type * |
base, |
|
|
uint32_t |
interruptMask |
|
) |
| |
|
inlinestatic |
- Parameters
-
base | ADC peripheral base address. |
interruptMask | The interrupts to be enabled, should be the OR'ed value of _adc_interrupt_enable. |
static void ADC_DisableInterrupts |
( |
ADC_Type * |
base, |
|
|
uint32_t |
interruptMask |
|
) |
| |
|
inlinestatic |
- Parameters
-
base | ADC peripheral base address. |
interruptMask | The interrupts to be disabled, should be the OR'ed value of _adc_interrupt_enable. |
uint32_t ADC_GetStatusFlags |
( |
ADC_Type * |
base | ) |
|
- Parameters
-
base | ADC peripheral base address. |
- Returns
- The OR'ed value of ADC status flags, please refer to _adc_status_flags for details.
static void ADC_ClearStatusFlags |
( |
ADC_Type * |
base, |
|
|
uint32_t |
statusFlagsMask |
|
) |
| |
|
inlinestatic |
- Note
- Only interrupt flags and raw flags can be cleared.
- Parameters
-
base | ADC peripheral base address. |
statusFlagsMask | The OR'ed value of status flags to be cleared, please refer to _adc_status_flags for details. |