MCUXpresso SDK API Reference Manual  Rev. 0
NXP Semiconductors
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
ADC: 12-bit SAR Analog-to-Digital Converter Driver

Overview

The MCUXpresso SDK provides a Peripheral driver for the 12-bit SAR Analog-to-Digital Converter (ADC) module of MCUXpresso SDK devices.

Typical use case

Polling Configuration

void main(void)
{
adc_config_t adcConfigStruct;
adc_conv_seq_config_t adcConvSeqConfigStruct;
/* Enable the power and clock firstly. */
...
/* Calibration. */
if (ADC_DoSelfCalibration(DEMO_ADC_BASE))
{
PRINTF("ADC_DoSelfCalibration() Done.\r\n");
}
else
{
PRINTF("ADC_DoSelfCalibration() Failed.\r\n");
}
/* Configure the converter. */
adcConfigStruct.clockDividerNumber = 0;
adcConfigStruct.resolution = kADC_Resolution12bit;
adcConfigStruct.enableBypassCalibration = false;
adcConfigStruct.sampleTimeNumber = 0U;
ADC_Init(DEMO_ADC_BASE, &adcConfigStruct);
/* Use the temperature sensor input to channel 0. */
ADC_EnableTemperatureSensor(DEMO_ADC_BASE, true);
/* Enable channel 0's conversion in Sequence A. */
adcConvSeqConfigStruct.channelMask = (1U << 0); /* Includes channel 0. */
adcConvSeqConfigStruct.triggerMask = 0U;
adcConvSeqConfigStruct.enableSingleStep = false;
adcConvSeqConfigStruct.enableSyncBypass = false;
adcConvSeqConfigStruct.interruptMode = kADC_InterruptForEachSequence;
ADC_SetConvSeqAConfig(DEMO_ADC_BASE, &adcConvSeqConfigStruct);
ADC_EnableConvSeqA(DEMO_ADC_BASE, true); /* Enable the conversion sequence A. */
PRINTF("Configuration Done.\r\n");
while (1)
{
/* Get the input from terminal and trigger the converter by software. */
GETCHAR();
/* Wait for the converter to be done. */
while (!ADC_GetChannelConversionResult(DEMO_ADC_BASE, DEMO_ADC_SAMPLE_CHANNEL_NUMBER, &adcResultInfoStruct))
{
}
PRINTF("adcResultInfoStruct.result = %d\r\n", adcResultInfoStruct.result);
PRINTF("adcResultInfoStruct.channelNumber = %d\r\n", adcResultInfoStruct.channelNumber);
PRINTF("adcResultInfoStruct.overrunFlag = %d\r\n", adcResultInfoStruct.overrunFlag ? 1U : 0U);
PRINTF("\r\n");
}
}

Interrupt Configuration

/* Global variables. */
static adc_result_info_t gAdcResultInfoStruct;
adc_result_info_t *volatile gAdcResultInfoPtr = &gAdcResultInfoStruct;
volatile bool gAdcConvSeqAIntFlag;
void main(void)
{
adc_config_t adcConfigStruct;
adc_conv_seq_config_t adcConvSeqConfigStruct;
/* Enable the power and clock firstly. */
...
/* Calibration. */
if (ADC_DoSelfCalibration(DEMO_ADC_BASE))
{
PRINTF("ADC_DoSelfCalibration() Done.\r\n");
}
else
{
PRINTF("ADC_DoSelfCalibration() Failed.\r\n");
}
/* Configure the ADC as basic polling mode. */
/* Configure the converter. */
adcConfigStruct.clockDividerNumber = 0;
adcConfigStruct.resolution = kADC_Resolution12bit;
adcConfigStruct.enableBypassCalibration = false;
adcConfigStruct.sampleTimeNumber = 0U;
ADC_Init(DEMO_ADC_BASE, &adcConfigStruct);
/* Use the sensor input to channel 0. */
ADC_EnableTemperatureSensor(DEMO_ADC_BASE, true);
/* Enable channel 0's conversion in Sequence A. */
adcConvSeqConfigStruct.channelMask = (1U << 0); /* Includes channel 0. */
adcConvSeqConfigStruct.triggerMask = 0U;
adcConvSeqConfigStruct.enableSingleStep = false;
adcConvSeqConfigStruct.enableSyncBypass = false;
adcConvSeqConfigStruct.interruptMode = kADC_InterruptForEachSequence;
ADC_SetConvSeqAConfig(DEMO_ADC_BASE, &adcConvSeqConfigStruct);
ADC_EnableConvSeqA(DEMO_ADC_BASE, true); /* Enable the conversion sequence A. */
/* Enable the interrupt. */
ADC_EnableInterrupts(DEMO_ADC_BASE,
kADC_ConvSeqAInterruptEnable); /* Enable the interrupt the for sequence A done. */
NVIC_EnableIRQ(DEMO_ADC_IRQ_ID);
PRINTF("Configuration Done.\r\n");
while (1)
{
GETCHAR();
gAdcConvSeqAIntFlag = false;
while (!gAdcConvSeqAIntFlag)
{
}
PRINTF("gAdcResultInfoStruct.result = %d\r\n", gAdcResultInfoStruct.result);
PRINTF("gAdcResultInfoStruct.channelNumber = %d\r\n", gAdcResultInfoStruct.channelNumber);
PRINTF("gAdcResultInfoStruct.overrunFlag = %d\r\n", gAdcResultInfoStruct.overrunFlag ? 1U : 0U);
PRINTF("\r\n");
}
}
/*
* ISR for ADC conversion sequence A done.
*/
void DEMO_ADC_IRQ_HANDLER_FUNC(void)
{
{
ADC_GetChannelConversionResult(DEMO_ADC_BASE, DEMO_ADC_SAMPLE_CHANNEL_NUMBER, gAdcResultInfoPtr);
gAdcConvSeqAIntFlag = true;
}
}

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...
 

Enumerations

enum  _adc_status_flags {
  kADC_ThresholdCompareFlagOnChn0 = 1U << 0U,
  kADC_ThresholdCompareFlagOnChn1 = 1U << 1U,
  kADC_ThresholdCompareFlagOnChn2 = 1U << 2U,
  kADC_ThresholdCompareFlagOnChn3 = 1U << 3U,
  kADC_ThresholdCompareFlagOnChn4 = 1U << 4U,
  kADC_ThresholdCompareFlagOnChn5 = 1U << 5U,
  kADC_ThresholdCompareFlagOnChn6 = 1U << 6U,
  kADC_ThresholdCompareFlagOnChn7 = 1U << 7U,
  kADC_ThresholdCompareFlagOnChn8 = 1U << 8U,
  kADC_ThresholdCompareFlagOnChn9 = 1U << 9U,
  kADC_ThresholdCompareFlagOnChn10 = 1U << 10U,
  kADC_ThresholdCompareFlagOnChn11 = 1U << 11U,
  kADC_OverrunFlagForChn0,
  kADC_OverrunFlagForChn1,
  kADC_OverrunFlagForChn2,
  kADC_OverrunFlagForChn3,
  kADC_OverrunFlagForChn4,
  kADC_OverrunFlagForChn5,
  kADC_OverrunFlagForChn6,
  kADC_OverrunFlagForChn7,
  kADC_OverrunFlagForChn8,
  kADC_OverrunFlagForChn9,
  kADC_OverrunFlagForChn10,
  kADC_OverrunFlagForChn11,
  kADC_GlobalOverrunFlagForSeqA = 1U << 24U,
  kADC_GlobalOverrunFlagForSeqB = 1U << 25U,
  kADC_ConvSeqAInterruptFlag = 1U << 28U,
  kADC_ConvSeqBInterruptFlag = 1U << 29U,
  kADC_ThresholdCompareInterruptFlag = 1U << 30U,
  kADC_OverrunInterruptFlag = 1U << 31U
}
 Flags. More...
 
enum  _adc_interrupt_enable {
  kADC_ConvSeqAInterruptEnable = ADC_INTEN_SEQA_INTEN_MASK,
  kADC_ConvSeqBInterruptEnable = ADC_INTEN_SEQB_INTEN_MASK,
  kADC_OverrunInterruptEnable = ADC_INTEN_OVR_INTEN_MASK
}
 Interrupts. More...
 
enum  adc_clock_mode_t {
  kADC_ClockSynchronousMode,
  kADC_ClockAsynchronousMode = 1U
}
 Define selection of clock mode. More...
 
enum  adc_resolution_t {
  kADC_Resolution6bit = 0U,
  kADC_Resolution8bit = 1U,
  kADC_Resolution10bit = 2U,
  kADC_Resolution12bit = 3U
}
 Define selection of resolution. More...
 
enum  adc_trigger_polarity_t {
  kADC_TriggerPolarityNegativeEdge = 0U,
  kADC_TriggerPolarityPositiveEdge = 1U
}
 Define selection of polarity of selected input trigger for conversion sequence. More...
 
enum  adc_priority_t {
  kADC_PriorityLow = 0U,
  kADC_PriorityHigh = 1U
}
 Define selection of conversion sequence's priority. More...
 
enum  adc_seq_interrupt_mode_t {
  kADC_InterruptForEachConversion = 0U,
  kADC_InterruptForEachSequence = 1U
}
 Define selection of conversion sequence's interrupt. More...
 
enum  adc_threshold_compare_status_t {
  kADC_ThresholdCompareInRange = 0U,
  kADC_ThresholdCompareBelowRange = 1U,
  kADC_ThresholdCompareAboveRange = 2U
}
 Define status of threshold compare result. More...
 
enum  adc_threshold_crossing_status_t {
  kADC_ThresholdCrossingNoDetected = 0U,
  kADC_ThresholdCrossingDownward = 2U,
  kADC_ThresholdCrossingUpward = 3U
}
 Define status of threshold crossing detection result. More...
 
enum  adc_threshold_interrupt_mode_t {
  kADC_ThresholdInterruptDisabled = 0U,
  kADC_ThresholdInterruptOnOutside = 1U,
  kADC_ThresholdInterruptOnCrossing = 2U
}
 Define interrupt mode for threshold compare event. 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...
 

Data Structure Documentation

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...
 

Field Documentation

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...
 

Field Documentation

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...
 

Field Documentation

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

Macro Definition Documentation

#define LPC_ADC_DRIVER_VERSION   (MAKE_VERSION(2, 0, 0))

Enumeration Type Documentation

Enumerator
kADC_ThresholdCompareFlagOnChn0 

Threshold comparison event on Channel 0.

kADC_ThresholdCompareFlagOnChn1 

Threshold comparison event on Channel 1.

kADC_ThresholdCompareFlagOnChn2 

Threshold comparison event on Channel 2.

kADC_ThresholdCompareFlagOnChn3 

Threshold comparison event on Channel 3.

kADC_ThresholdCompareFlagOnChn4 

Threshold comparison event on Channel 4.

kADC_ThresholdCompareFlagOnChn5 

Threshold comparison event on Channel 5.

kADC_ThresholdCompareFlagOnChn6 

Threshold comparison event on Channel 6.

kADC_ThresholdCompareFlagOnChn7 

Threshold comparison event on Channel 7.

kADC_ThresholdCompareFlagOnChn8 

Threshold comparison event on Channel 8.

kADC_ThresholdCompareFlagOnChn9 

Threshold comparison event on Channel 9.

kADC_ThresholdCompareFlagOnChn10 

Threshold comparison event on Channel 10.

kADC_ThresholdCompareFlagOnChn11 

Threshold comparison event on Channel 11.

kADC_OverrunFlagForChn0 

Mirror the OVERRUN status flag from the result register for ADC channel 0.

kADC_OverrunFlagForChn1 

Mirror the OVERRUN status flag from the result register for ADC channel 1.

kADC_OverrunFlagForChn2 

Mirror the OVERRUN status flag from the result register for ADC channel 2.

kADC_OverrunFlagForChn3 

Mirror the OVERRUN status flag from the result register for ADC channel 3.

kADC_OverrunFlagForChn4 

Mirror the OVERRUN status flag from the result register for ADC channel 4.

kADC_OverrunFlagForChn5 

Mirror the OVERRUN status flag from the result register for ADC channel 5.

kADC_OverrunFlagForChn6 

Mirror the OVERRUN status flag from the result register for ADC channel 6.

kADC_OverrunFlagForChn7 

Mirror the OVERRUN status flag from the result register for ADC channel 7.

kADC_OverrunFlagForChn8 

Mirror the OVERRUN status flag from the result register for ADC channel 8.

kADC_OverrunFlagForChn9 

Mirror the OVERRUN status flag from the result register for ADC channel 9.

kADC_OverrunFlagForChn10 

Mirror the OVERRUN status flag from the result register for ADC channel 10.

kADC_OverrunFlagForChn11 

Mirror the OVERRUN status flag from the result register for ADC channel 11.

kADC_GlobalOverrunFlagForSeqA 

Mirror the glabal OVERRUN status flag for conversion sequence A.

kADC_GlobalOverrunFlagForSeqB 

Mirror the global OVERRUN status flag for conversion sequence B.

kADC_ConvSeqAInterruptFlag 

Sequence A interrupt/DMA trigger.

kADC_ConvSeqBInterruptFlag 

Sequence B interrupt/DMA trigger.

kADC_ThresholdCompareInterruptFlag 

Threshold comparision interrupt flag.

kADC_OverrunInterruptFlag 

Overrun interrupt flag.

Note
Not all the interrupt options are listed here
Enumerator
kADC_ConvSeqAInterruptEnable 

Enable interrupt upon completion of each individual conversion in sequence A, or entire sequence.

kADC_ConvSeqBInterruptEnable 

Enable interrupt upon completion of each individual conversion in sequence B, or entire sequence.

kADC_OverrunInterruptEnable 

Enable the detection of an overrun condition on any of the channel data registers will cause an overrun interrupt/DMA trigger.

Enumerator
kADC_ClockSynchronousMode 

The ADC clock would be derived from the system clock based on "clockDividerNumber".

kADC_ClockAsynchronousMode 

The ADC clock would be based on the SYSCON block's divider.

Enumerator
kADC_Resolution6bit 

6-bit resolution.

kADC_Resolution8bit 

8-bit resolution.

kADC_Resolution10bit 

10-bit resolution.

kADC_Resolution12bit 

12-bit resolution.

Enumerator
kADC_TriggerPolarityNegativeEdge 

A negative edge launches the conversion sequence on the trigger(s).

kADC_TriggerPolarityPositiveEdge 

A positive edge launches the conversion sequence on the trigger(s).

Enumerator
kADC_PriorityLow 

This sequence would be preempted when another sequence is started.

kADC_PriorityHigh 

This sequence would preempt other sequence even when is is started.

Enumerator
kADC_InterruptForEachConversion 

The sequence interrupt/DMA trigger will be set at the end of each individual ADC conversion inside this conversion sequence.

kADC_InterruptForEachSequence 

The sequence interrupt/DMA trigger will be set when the entire set of this sequence conversions completes.

Enumerator
kADC_ThresholdCompareInRange 

LOW threshold <= conversion value <= HIGH threshold.

kADC_ThresholdCompareBelowRange 

conversion value < LOW threshold.

kADC_ThresholdCompareAboveRange 

conversion value > HIGH threshold.

Enumerator
kADC_ThresholdCrossingNoDetected 

No threshold Crossing detected.

kADC_ThresholdCrossingDownward 

Downward Threshold Crossing detected.

kADC_ThresholdCrossingUpward 

Upward Threshold Crossing Detected.

Enumerator
kADC_ThresholdInterruptDisabled 

Threshold comparison interrupt is disabled.

kADC_ThresholdInterruptOnOutside 

Threshold comparison interrupt is enabled on outside threshold.

kADC_ThresholdInterruptOnCrossing 

Threshold comparison interrupt is enabled on crossing threshold.

Function Documentation

void ADC_Init ( ADC_Type *  base,
const adc_config_t config 
)
Parameters
baseADC peripheral base address.
configPointer to configuration structure, see to adc_config_t.
void ADC_Deinit ( ADC_Type *  base)
Parameters
baseADC 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->clockMode = kADC_ClockSynchronousMode;
* config->clockDividerNumber = 0U;
* config->resolution = kADC_Resolution12bit;
* config->enableBypassCalibration = false;
* config->sampleTimeNumber = 0U;
*
Parameters
configPointer to configuration structure.
bool ADC_DoSelfCalibration ( ADC_Type *  base)
Parameters
baseADC peripheral base address.
Return values
trueCalibration succeed.
falseCalibration failed.
static void ADC_EnableTemperatureSensor ( ADC_Type *  base,
bool  enable 
)
inlinestatic

When enabling the internal temperature sensor measurement, the channel 0 would be connected to internal sensor instead of external pin.

Parameters
baseADC peripheral base address.
enableSwitcher to enable the feature or not.
static void ADC_EnableConvSeqA ( ADC_Type *  base,
bool  enable 
)
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.

Parameters
baseADC peripheral base address.
enableSwitcher to enable the feature or not.
void ADC_SetConvSeqAConfig ( ADC_Type *  base,
const adc_conv_seq_config_t config 
)
Parameters
baseADC peripheral base address.
configPointer to configuration structure, see to adc_conv_seq_config_t.
static void ADC_DoSoftwareTriggerConvSeqA ( ADC_Type *  base)
inlinestatic
Parameters
baseADC peripheral base address.
static void ADC_EnableConvSeqABurstMode ( ADC_Type *  base,
bool  enable 
)
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.

Parameters
baseADC peripheral base address.
enableSwitcher to enable this feature.
static void ADC_SetConvSeqAHighPriority ( ADC_Type *  base)
inlinestatic
Parameters
baseADC peripheral bass address.
static void ADC_EnableConvSeqB ( ADC_Type *  base,
bool  enable 
)
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.

Parameters
baseADC peripheral base address.
enableSwitcher to enable the feature or not.
void ADC_SetConvSeqBConfig ( ADC_Type *  base,
const adc_conv_seq_config_t config 
)
Parameters
baseADC peripheral base address.
configPointer to configuration structure, see to adc_conv_seq_config_t.
static void ADC_DoSoftwareTriggerConvSeqB ( ADC_Type *  base)
inlinestatic
Parameters
baseADC peripheral base address.
static void ADC_EnableConvSeqBBurstMode ( ADC_Type *  base,
bool  enable 
)
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.

Parameters
baseADC peripheral base address.
enableSwitcher to enable this feature.
static void ADC_SetConvSeqBHighPriority ( ADC_Type *  base)
inlinestatic
Parameters
baseADC peripheral bass address.
bool ADC_GetConvSeqAGlobalConversionResult ( ADC_Type *  base,
adc_result_info_t info 
)
Parameters
baseADC peripheral base address.
infoPointer to information structure, see to adc_result_info_t;
Return values
trueThe conversion result is ready.
falseThe conversion result is not ready yet.
bool ADC_GetConvSeqBGlobalConversionResult ( ADC_Type *  base,
adc_result_info_t info 
)
Parameters
baseADC peripheral base address.
infoPointer to information structure, see to adc_result_info_t;
Return values
trueThe conversion result is ready.
falseThe conversion result is not ready yet.
bool ADC_GetChannelConversionResult ( ADC_Type *  base,
uint32_t  channel,
adc_result_info_t info 
)
Parameters
baseADC peripheral base address.
channelThe indicated channel number.
infoPointer to information structure, see to adc_result_info_t;
Return values
trueThe conversion result is ready.
falseThe conversion result is not ready yet.
static void ADC_SetThresholdPair0 ( ADC_Type *  base,
uint32_t  lowValue,
uint32_t  highValue 
)
inlinestatic
Parameters
baseADC peripheral base address.
lowValueLOW threshold value.
highValueHIGH threshold value.
static void ADC_SetThresholdPair1 ( ADC_Type *  base,
uint32_t  lowValue,
uint32_t  highValue 
)
inlinestatic
Parameters
baseADC peripheral base address.
lowValueLOW threshold value. The available value is with 12-bit.
highValueHIGH threshold value. The available value is with 12-bit.
static void ADC_SetChannelWithThresholdPair0 ( ADC_Type *  base,
uint32_t  channelMask 
)
inlinestatic
Parameters
baseADC peripheral base address.
channelMaskIndicated channels' mask.
static void ADC_SetChannelWithThresholdPair1 ( ADC_Type *  base,
uint32_t  channelMask 
)
inlinestatic
Parameters
baseADC peripheral base address.
channelMaskIndicated channels' mask.
static void ADC_EnableInterrupts ( ADC_Type *  base,
uint32_t  mask 
)
inlinestatic
Parameters
baseADC peripheral base address.
maskMask of interrupt mask value for global block except each channal, see to _adc_interrupt_enable.
static void ADC_DisableInterrupts ( ADC_Type *  base,
uint32_t  mask 
)
inlinestatic
Parameters
baseADC peripheral base address.
maskMask of interrupt mask value for global block except each channel, see to _adc_interrupt_enable.
static void ADC_EnableShresholdCompareInterrupt ( ADC_Type *  base,
uint32_t  channel,
adc_threshold_interrupt_mode_t  mode 
)
inlinestatic
Parameters
baseADC peripheral base address.
channelChannel number.
modeInterrupt mode for threshold compare event, see to adc_threshold_interrupt_mode_t.
static uint32_t ADC_GetStatusFlags ( ADC_Type *  base)
inlinestatic
Parameters
baseADC peripheral base address.
Returns
Mask of status flags of module, see to _adc_status_flags.
static void ADC_ClearStatusFlags ( ADC_Type *  base,
uint32_t  mask 
)
inlinestatic
Parameters
baseADC peripheral base address.
maskMask of status flags of module, see to _adc_status_flags.