![]() |
MCUXpresso SDK API Reference Manual
Rev. 0
NXP Semiconductors
|
The MCUXpresso SDK provides a peripheral driver for the 16-bit sigma-delta Analog-to-Digital Converter (ADC) module of MCUXpresso SDK devices.
Example use of ADC API.
Files | |
file | fsl_adc.h |
Data Structures | |
struct | adc_config_t |
Define structure for configuring the block. More... | |
struct | adc_sd_config_t |
Define structure for configuring Sigma Delta(SD) block. More... | |
struct | adc_window_compare_config_t |
ADC window comparison configuration. More... | |
Driver version | |
#define | FSL_ADC_DRIVER_VERSION (MAKE_VERSION(2, 0, 0)) |
QN ADC driver version 2.0.0. More... | |
Initialization | |
void | ADC_Init (ADC_Type *base, const adc_config_t *config) |
Initialize the ADC module. More... | |
void | ADC_Deinit (ADC_Type *base) |
Deinitialize the ADC module. More... | |
void | ADC_GetDefaultConfig (adc_config_t *config) |
Gets an available pre-defined settings for initial configuration. More... | |
void | ADC_SetSdConfig (ADC_Type *base, uint8_t idx, const adc_sd_config_t *config) |
Set the sigma delta configuration. More... | |
void | ADC_GetSdDefaultConfig (adc_sd_config_t *config) |
Gets an available pre-defined settings for SD configuration. More... | |
float | ADC_GetBandgapCalibrationResult (ADC_Type *base, uint8_t idx) |
Get Bandgap calibration result. More... | |
uint32_t | ADC_GetVinnCalibrationResult (ADC_Type *base, const adc_config_t *config) |
Get VINN calibration result. More... | |
uint32_t | ADC_GetOffsetCalibrationResult (ADC_Type *base, const adc_config_t *config) |
Get VINN calibration result. More... | |
static void | ADC_EnableTemperatureSensor (ADC_Type *base, bool enable) |
Enable the internal temperature sensor measurement. More... | |
static void | ADC_EnableBatteryMonitor (bool enable) |
Enable the internal battery monitor. More... | |
void | ADC_WindowCompareConfig (ADC_Type *base, const adc_window_compare_config_t *config) |
Configures the window compare mode. More... | |
static void | ADC_Enable (ADC_Type *base, bool enable) |
Enable/Disable the ADC. More... | |
static void | ADC_DoSoftwareTrigger (ADC_Type *base) |
Do trigger conversion by software. More... | |
Interrupts. | |
static void | ADC_EnableInterrupts (ADC_Type *base, uint32_t mask) |
Enable interrupts for conversion sequences. More... | |
static void | ADC_DisableInterrupts (ADC_Type *base, uint32_t mask) |
Disable interrupts for conversion sequences. More... | |
Status. | |
static uint32_t | ADC_GetStatusFlags (ADC_Type *base) |
Get status flags of ADC module. More... | |
static void | ADC_ClearStatusFlags (ADC_Type *base, uint32_t mask) |
Clear status flags of ADC module. More... | |
Data result. | |
static uint32_t | ADC_GetConversionResult (ADC_Type *base) |
Get the conversion value. More... | |
float | ADC_ConversionResult2Mv (ADC_Type *base, uint8_t ch, uint8_t idx, float vref, uint32_t vinn, uint32_t result) |
Conversion result to mv. More... | |
static void | ADC_EmptyChannelConversionBuffer (ADC_Type *base) |
Empty conversion buffer. More... | |
Advanced Features | |
static void | ADC_EnableInputSignalInvert (ADC_Type *base, bool enable) |
Enable/Disable the signal invert. More... | |
static void | ADC_PgaChopperEnable (ADC_Type *base, bool enable) |
Enable/Disable the PGA chopper. More... | |
struct adc_config_t |
Data Fields | |
uint32_t | channelEnable |
Channel enable, each bit represent one channel. | |
uint32_t | channelConfig |
Channel configure for Sigma Delta(SD) select, 0: indicate the channel use SD configure0 1: indicate the channel use SD configura1. More... | |
adc_trigger_select_t | triggerSource |
Triger source select, only one triger source can be selected. More... | |
adc_conv_mode_t | convMode |
Convert mode. More... | |
adc_clock_t | clock |
Select the ADC working clock. | |
adc_ref_source_t | refSource |
Select the reference voltage source. More... | |
adc_data_format_t | dataFormat |
Select the Data format. | |
uint32_t adc_config_t::channelConfig |
adc_trigger_select_t adc_config_t::triggerSource |
adc_conv_mode_t adc_config_t::convMode |
Single convert, only one conversion performed and the first channel from LSB with 1 set will be converted. Burst convert, stop until ADC enable bit cleared and the first channel from LSB with 1 set will be converted. Single Scan convert, scan all channels with 1 set , automatic stoped after all channels conversion complete. Burst Scan convert, scan all channels with 1 set , stop until ADC enable bit cleared
adc_ref_source_t adc_config_t::refSource |
struct adc_sd_config_t |
Data Fields | |
adc_gain_t | gain |
ADC gain. | |
adc_ref_gain_t | refGain |
ADC reference gain. | |
adc_pga_gain_t | pgaGain |
PGA gain. | |
adc_vinn_select_t | vinnSelect |
Vinn select, take effect when single-ended channel configured. | |
adc_down_sample_t | downSample |
Down sample rate. | |
adc_pga_adjust_direction_t | adjustDirection |
PGA adjust direction. | |
uint8_t | adjustValue |
PGA adjust value,Passing 0 to disable PGA adjust feature adjustment = (adjustValue[5] + 1)*(adjustValue[3:0] + 1)*40mv. | |
adc_vcm_voltage_t | vcmSelect |
ADC input Voltage of Common Mode(VCM) selection. | |
struct adc_window_compare_config_t |
#define FSL_ADC_DRIVER_VERSION (MAKE_VERSION(2, 0, 0)) |
enum adc_ref_source_t |
enum adc_down_sample_t |
enum adc_ref_gain_t |
enum adc_gain_t |
enum adc_vinn_select_t |
enum adc_pga_gain_t |
enum adc_conv_mode_t |
enum adc_vcm_voltage_t |
enum _adc_status_flags |
enum adc_trigger_select_t |
void ADC_Init | ( | ADC_Type * | base, |
const adc_config_t * | config | ||
) |
This function initializes the ADC module, including:
base | ADC peripheral base address. |
config | Pointer to configuration structure, see to adc_config_t. |
void ADC_Deinit | ( | ADC_Type * | base | ) |
This function de-nitializes the ADC module, including:
base | ADC peripheral base address. |
void ADC_GetDefaultConfig | ( | adc_config_t * | config | ) |
This function initializes the initial configuration structure with an available settings. The default values are:
config | Pointer to configuration structure. |
void ADC_SetSdConfig | ( | ADC_Type * | base, |
uint8_t | idx, | ||
const adc_sd_config_t * | config | ||
) |
This function set the sigma delta with user configuration. There are two SD configuration registers, and the idx parameter is used to choose the register.
base | ADC peripheral base address. |
idx | Configure register index, 0 for register CFG0 and 1 for register CFG1 |
config | Pointer to the "adc_sd_config_t" structure |
void ADC_GetSdDefaultConfig | ( | adc_sd_config_t * | config | ) |
This function initializes the initial configuration structure with an available settings. The default values are:
config | Pointer to configuration structure. |
float ADC_GetBandgapCalibrationResult | ( | ADC_Type * | base, |
uint8_t | idx | ||
) |
base | ADC peripheral base address. |
uint32_t ADC_GetVinnCalibrationResult | ( | ADC_Type * | base, |
const adc_config_t * | config | ||
) |
This function is use to measure the VINN value with channel 20.
base | ADC peripheral base address. |
idx | Configure register index, 0 for register CFG0 and 1 for register CFG1. |
uint32_t ADC_GetOffsetCalibrationResult | ( | ADC_Type * | base, |
const adc_config_t * | config | ||
) |
This function is use to measure the offset value with channel 15.
base | ADC peripheral base address. |
idx | Configure register index, 0 for register CFG0 and 1 for register CFG1. |
|
inlinestatic |
base | ADC peripheral base address. |
enable | Switcher to enable the feature or not. |
|
inlinestatic |
enable | Switcher to enable the feature or not. |
void ADC_WindowCompareConfig | ( | ADC_Type * | base, |
const adc_window_compare_config_t * | config | ||
) |
base | ADC peripheral base address. |
config | Pointer to the "adc_window_compare_config_t" structure. Passing "NULL" disables the feature. |
|
inlinestatic |
base | ADC peripheral base address. |
enable | true to enable the ADC, false to disable. |
|
inlinestatic |
base | ADC peripheral base address. |
|
inlinestatic |
base | ADC peripheral base address. |
mask | Mask value for the interrupts. See "_adc_interrupt_enable". |
|
inlinestatic |
base | ADC peripheral base address. |
mask | Mask value for the interrupts. See "_adc_interrupt_enable". |
|
inlinestatic |
base | ADC peripheral base address. |
|
inlinestatic |
base | ADC peripheral base address. |
mask | Mask of status flags of module, see to "_adc_status_flags". |
|
inlinestatic |
base | ADC peripheral base address. |
float ADC_ConversionResult2Mv | ( | ADC_Type * | base, |
uint8_t | ch, | ||
uint8_t | idx, | ||
float | vref, | ||
uint32_t | vinn, | ||
uint32_t | result | ||
) |
base | ADC peripheral base address. |
ch | ADC channel number. |
idx | Configure register index, 0 for register CFG0 and 1 for register CFG1 |
verf | ADC reference voltage in mv. |
vinn | ADC conversion result get from ADC_GetConversionResult function. |
result | ADC conversion result get from ADC_GetConversionResult() function. |
|
inlinestatic |
base | ADC peripheral base address. |
|
inlinestatic |
base | ADC peripheral base address. |
enable | true to enable the signal invert, false to disable. |
|
inlinestatic |
base | ADC peripheral base address. |
enable | true to enable the PGA chopper, false to disable. |