
UM10800
All information provided in this document is subject to legal disclaimers.
© NXP Semiconductors N.V. 2016. All rights reserved.
User manual
Rev. 1.2 — 5 October 2016
437 of 487
NXP Semiconductors
UM10800
Chapter 30: LPC82x ROM API ADC drivers
//completion also used as DMA callback function when that ADC conversion/DMA
//transfer is finished.
uint32_t seqa_hwtrig; // H/W trigger for sequence A
uint32_t seqb_hwtrig; // H/W trigger for sequence B
ADC_CONFIG_T *adc_cfg;
uint32_t comp_flags;
uint32_t overrun_flags;
uint32_t thcmp_flags;
ADC_DMA_CFG_T *dma_cfg;
ADC_SEQ_CALLBK_T seqa_callback_pt; // SEQA callback function/the same callback
//on DMA completion if DMA is used for ADCx.
ADC_SEQ_CALLBK_T seqb_callback_pt; // SEQb callback function/the same callback
//on DMA completion if DMA is used for ADCx.
ADC_CALLBK_T overrun_callback_pt; // Overrun callback function
ADC_CALLBK_T thcmp_callback_pt; // THCMP callback function
ADC_DMA_SETUP_T dma_setup_func_pt; // ADC DMA channel setup function
} ADC_PARAM_T;
The following variables and pointers are used in this structure:
seqa_buffer
: ADC buffer for the result of the conversion. Two separate buffers are
allocated for both SEQA and SEQB. To support DMA mode, the ADC buffer size is set
to 32-bit. Once DMA is completed, only bits 4 to 15 of the buffer contain the result of the
ADC conversion. For non-DMA mode, the buffers contain the actual data from the
conversion.
seqb_buffer
: See description of
seqa_buffer.
driver_mode
: Configures the API function:
0x00: Polling mode, function is blocked until transfer is finished.
0x01: Interrupt mode. Function exits immediately and callback function is invoked
when ADC conversion is finished.
0x02: DMA mode. ADC data conversion is handled by DMA. The maximum DMA
buffer size is the total number ADC channels. The DMA API function is called for ADC
DMA channel setup.
seqa_hwtrig
: Select the hardware trigger for sequence A conversion. See
for potential triggers sources.
seqb_hwtrig
: Select the hardware trigger for sequence A conversion. See
for potential triggers sources.
comp_flags
: For each channel with a completed conversion, the corresponding bit is set.
thcmp_flags
: For each channel incurring an overrun or threshold compare interrupt, the
corresponding bit is set.
30.4.12.5 Callback functions
typedef void (*ADC_SEQ_CALLBK_T) (ADC_HANDLE_T handle);
handle:
The handle to the ADC instance.
The following callback function is invoked in the ADC sequence interrupt handler:
typedef void (*ADC_CALLBK_T) (ErrorCode_t error_code, uint32_t num_channel );