MCUXpresso SDK API Reference Manual
Rev. 0
NXP Semiconductors
|
The MCUXpresso SDK provides a Peripheral driver for the 12-bit SAR Analog-to-Digital Converter (ADC) module of MCUXpresso SDK devices.
Refer to the driver examples codes located at <SDK_ROOT>/boards/<BOARD>/driver_examples/fsl_adc
Refer to the driver examples codes located at <SDK_ROOT>/boards/<BOARD>/driver_examples/fsl_adc
Files | |
file | fsl_adc.h |
Data Structures | |
struct | adc_config_t |
Define structure for configuring the block. More... | |
struct | adc_conv_seq_config_t |
Define structure for configuring conversion sequence. More... | |
struct | adc_result_info_t |
Define structure of keeping conversion result information. More... | |
Driver version | |
#define | LPC_ADC_DRIVER_VERSION (MAKE_VERSION(2, 0, 0)) |
ADC driver version 2.0.0. More... | |
Initialization and Deinitialization | |
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... | |
bool | ADC_DoSelfCalibration (ADC_Type *base) |
Do the self hardware calibration. More... | |
static void | ADC_EnableTemperatureSensor (ADC_Type *base, bool enable) |
Enable the internal temperature sensor measurement. More... | |
Control conversion sequence A. | |
static void | ADC_EnableConvSeqA (ADC_Type *base, bool enable) |
Enable the conversion sequence A. More... | |
void | ADC_SetConvSeqAConfig (ADC_Type *base, const adc_conv_seq_config_t *config) |
Configure the conversion sequence A. More... | |
static void | ADC_DoSoftwareTriggerConvSeqA (ADC_Type *base) |
Do trigger the sequence's conversion by software. More... | |
static void | ADC_EnableConvSeqABurstMode (ADC_Type *base, bool enable) |
Enable the burst conversion of sequence A. More... | |
static void | ADC_SetConvSeqAHighPriority (ADC_Type *base) |
Set the high priority for conversion sequence A. More... | |
Control conversion sequence B. | |
static void | ADC_EnableConvSeqB (ADC_Type *base, bool enable) |
Enable the conversion sequence B. More... | |
void | ADC_SetConvSeqBConfig (ADC_Type *base, const adc_conv_seq_config_t *config) |
Configure the conversion sequence B. More... | |
static void | ADC_DoSoftwareTriggerConvSeqB (ADC_Type *base) |
Do trigger the sequence's conversion by software. More... | |
static void | ADC_EnableConvSeqBBurstMode (ADC_Type *base, bool enable) |
Enable the burst conversion of sequence B. More... | |
static void | ADC_SetConvSeqBHighPriority (ADC_Type *base) |
Set the high priority for conversion sequence B. More... | |
Data result. | |
bool | ADC_GetConvSeqAGlobalConversionResult (ADC_Type *base, adc_result_info_t *info) |
Get the global ADC conversion infomation of sequence A. More... | |
bool | ADC_GetConvSeqBGlobalConversionResult (ADC_Type *base, adc_result_info_t *info) |
Get the global ADC conversion infomation of sequence B. More... | |
bool | ADC_GetChannelConversionResult (ADC_Type *base, uint32_t channel, adc_result_info_t *info) |
Get the channel's ADC conversion completed under each conversion sequence. More... | |
Threshold function. | |
static void | ADC_SetThresholdPair0 (ADC_Type *base, uint32_t lowValue, uint32_t highValue) |
Set the threshhold pair 0 with low and high value. More... | |
static void | ADC_SetThresholdPair1 (ADC_Type *base, uint32_t lowValue, uint32_t highValue) |
Set the threshhold pair 1 with low and high value. More... | |
static void | ADC_SetChannelWithThresholdPair0 (ADC_Type *base, uint32_t channelMask) |
Set given channels to apply the threshold pare 0. More... | |
static void | ADC_SetChannelWithThresholdPair1 (ADC_Type *base, uint32_t channelMask) |
Set given channels to apply the threshold pare 1. 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 sequence. More... | |
static void | ADC_EnableShresholdCompareInterrupt (ADC_Type *base, uint32_t channel, adc_threshold_interrupt_mode_t mode) |
Enable the interrupt of shreshold compare event for each channel. 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... | |
struct adc_config_t |
Data Fields | |
adc_clock_mode_t | clockMode |
Select the clock mode for ADC converter. More... | |
uint32_t | clockDividerNumber |
This field is only available when using kADC_ClockSynchronousMode for "clockMode" field. More... | |
adc_resolution_t | resolution |
Select the conversion bits. More... | |
bool | enableBypassCalibration |
By default, a calibration cycle must be performed each time the chip is powered-up. More... | |
uint32_t | sampleTimeNumber |
By default, with value as "0U", the sample period would be 2.5 ADC clocks. More... | |
adc_clock_mode_t adc_config_t::clockMode |
uint32_t adc_config_t::clockDividerNumber |
The divider would be plused by 1 based on the value in this field. The available range is in 8 bits.
adc_resolution_t adc_config_t::resolution |
bool adc_config_t::enableBypassCalibration |
Re-calibration may be warranted periodically - especially if operating conditions have changed. To enable this option would avoid the need to calibrate if offset error is not a concern in the application.
uint32_t adc_config_t::sampleTimeNumber |
Then, to plus the "sampleTimeNumber" value here. The available value range is in 3 bits.
struct adc_conv_seq_config_t |
Data Fields | |
uint32_t | channelMask |
Selects which one or more of the ADC channels will be sampled and converted when this sequence is launched. More... | |
uint32_t | triggerMask |
Selects which one or more of the available hardware trigger sources will cause this conversion sequence to be initiated. More... | |
adc_trigger_polarity_t | triggerPolarity |
Select the trigger to lauch conversion sequence. More... | |
bool | enableSyncBypass |
To enable this feature allows the hardware trigger input to bypass synchronization flip-flop stages and therefore shorten the time between the trigger input signal and the start of a conversion. More... | |
bool | enableSingleStep |
When enabling this feature, a trigger will launch a single conversion on the next channel in the sequence instead of the default response of launching an entire sequence of conversions. More... | |
adc_seq_interrupt_mode_t | interruptMode |
Select the interrpt/DMA trigger mode. More... | |
uint32_t adc_conv_seq_config_t::channelMask |
The masked channels would be involved in current conversion sequence, beginning with the lowest-order. The available range is in 12-bit.
uint32_t adc_conv_seq_config_t::triggerMask |
The available range is 6-bit.
adc_trigger_polarity_t adc_conv_seq_config_t::triggerPolarity |
bool adc_conv_seq_config_t::enableSyncBypass |
bool adc_conv_seq_config_t::enableSingleStep |
adc_seq_interrupt_mode_t adc_conv_seq_config_t::interruptMode |
struct adc_result_info_t |
Data Fields | |
uint32_t | result |
Keey the conversion data value. More... | |
adc_threshold_compare_status_t | thresholdCompareStatus |
Keep the threshold compare status. More... | |
adc_threshold_crossing_status_t | thresholdCorssingStatus |
Keep the threshold crossing status. More... | |
uint32_t | channelNumber |
Keep the channel number for this conversion. More... | |
bool | overrunFlag |
Keep the status whether the conversion is overrun or not. More... | |
uint32_t adc_result_info_t::result |
adc_threshold_compare_status_t adc_result_info_t::thresholdCompareStatus |
adc_threshold_crossing_status_t adc_result_info_t::thresholdCorssingStatus |
uint32_t adc_result_info_t::channelNumber |
bool adc_result_info_t::overrunFlag |
#define LPC_ADC_DRIVER_VERSION (MAKE_VERSION(2, 0, 0)) |
enum _adc_status_flags |
enum adc_clock_mode_t |
enum adc_resolution_t |
enum adc_priority_t |
void ADC_Init | ( | ADC_Type * | base, |
const adc_config_t * | config | ||
) |
base | ADC peripheral base address. |
config | Pointer to configuration structure, see to adc_config_t. |
void ADC_Deinit | ( | ADC_Type * | base | ) |
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. |
bool ADC_DoSelfCalibration | ( | ADC_Type * | base | ) |
base | ADC peripheral base address. |
true | Calibration succeed. |
false | Calibration failed. |
|
inlinestatic |
When enabling the internal temperature sensor measurement, the channel 0 would be connected to internal sensor instead of external pin.
base | ADC peripheral base address. |
enable | Switcher to enable the feature or not. |
|
inlinestatic |
In order to avoid spuriously triggering the sequence, the trigger to conversion sequence should be ready before the sequence is ready. when the sequence is disabled, the trigger would be ignored. Also, it is suggested to disable the sequence during changing the sequence's setting.
base | ADC peripheral base address. |
enable | Switcher to enable the feature or not. |
void ADC_SetConvSeqAConfig | ( | ADC_Type * | base, |
const adc_conv_seq_config_t * | config | ||
) |
base | ADC peripheral base address. |
config | Pointer to configuration structure, see to adc_conv_seq_config_t. |
|
inlinestatic |
base | ADC peripheral base address. |
|
inlinestatic |
Enable the burst mode would cause the conversion sequence to be cntinuously cycled through. Other triggers would be ignored while this mode is enabled. Repeated conversions could be halted by disabling this mode. And the sequence currently in process will be completed before cnversions are terminated. Note that a new sequence could begin just before the burst mode is disabled.
base | ADC peripheral base address. |
enable | Switcher to enable this feature. |
|
inlinestatic |
base | ADC peripheral bass address. |
|
inlinestatic |
In order to avoid spuriously triggering the sequence, the trigger to conversion sequence should be ready before the sequence is ready. when the sequence is disabled, the trigger would be ignored. Also, it is suggested to disable the sequence during changing the sequence's setting.
base | ADC peripheral base address. |
enable | Switcher to enable the feature or not. |
void ADC_SetConvSeqBConfig | ( | ADC_Type * | base, |
const adc_conv_seq_config_t * | config | ||
) |
base | ADC peripheral base address. |
config | Pointer to configuration structure, see to adc_conv_seq_config_t. |
|
inlinestatic |
base | ADC peripheral base address. |
|
inlinestatic |
Enable the burst mode would cause the conversion sequence to be continuously cycled through. Other triggers would be ignored while this mode is enabled. Repeated conversions could be halted by disabling this mode. And the sequence currently in process will be completed before cnversions are terminated. Note that a new sequence could begin just before the burst mode is disabled.
base | ADC peripheral base address. |
enable | Switcher to enable this feature. |
|
inlinestatic |
base | ADC peripheral bass address. |
bool ADC_GetConvSeqAGlobalConversionResult | ( | ADC_Type * | base, |
adc_result_info_t * | info | ||
) |
base | ADC peripheral base address. |
info | Pointer to information structure, see to adc_result_info_t; |
true | The conversion result is ready. |
false | The conversion result is not ready yet. |
bool ADC_GetConvSeqBGlobalConversionResult | ( | ADC_Type * | base, |
adc_result_info_t * | info | ||
) |
base | ADC peripheral base address. |
info | Pointer to information structure, see to adc_result_info_t; |
true | The conversion result is ready. |
false | The conversion result is not ready yet. |
bool ADC_GetChannelConversionResult | ( | ADC_Type * | base, |
uint32_t | channel, | ||
adc_result_info_t * | info | ||
) |
base | ADC peripheral base address. |
channel | The indicated channel number. |
info | Pointer to information structure, see to adc_result_info_t; |
true | The conversion result is ready. |
false | The conversion result is not ready yet. |
|
inlinestatic |
base | ADC peripheral base address. |
lowValue | LOW threshold value. |
highValue | HIGH threshold value. |
|
inlinestatic |
base | ADC peripheral base address. |
lowValue | LOW threshold value. The available value is with 12-bit. |
highValue | HIGH threshold value. The available value is with 12-bit. |
|
inlinestatic |
base | ADC peripheral base address. |
channelMask | Indicated channels' mask. |
|
inlinestatic |
base | ADC peripheral base address. |
channelMask | Indicated channels' mask. |
|
inlinestatic |
base | ADC peripheral base address. |
mask | Mask of interrupt mask value for global block except each channal, see to _adc_interrupt_enable. |
|
inlinestatic |
base | ADC peripheral base address. |
mask | Mask of interrupt mask value for global block except each channel, see to _adc_interrupt_enable. |
|
inlinestatic |
base | ADC peripheral base address. |
channel | Channel number. |
mode | Interrupt mode for threshold compare event, see to adc_threshold_interrupt_mode_t. |
|
inlinestatic |
base | ADC peripheral base address. |
|
inlinestatic |
base | ADC peripheral base address. |
mask | Mask of status flags of module, see to _adc_status_flags. |