
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
436 of 487
NXP Semiconductors
UM10800
Chapter 30: LPC82x ROM API ADC drivers
thr1_low
: Low threshold 1 value.
thr1_high
: High threshold 1 value.
error_en
: 0 disables the overrun interrupt, 1 enables the overrun interrupt.
thcmp_en
: Value of bits 26:3 in the INTEN register. See
. Each pair of bits
controls the threshold comparison interrupt for one selected channel.
channel_num
: The highest channel number used in sequence A or sequence B. If this
number is lower than the total available number of ADC channels, only the first
channel_num channels can be used in either sequence A or sequence B.
30.4.12.2 ADC_HANDLE_T
This structure is the handle to one instance of the ADC driver. Each ADC has one handle.
This handle is created by the init API.
typedef void ADC_HANDLE_T ; // define TYPE for ADC handle pointer
30.4.12.3 ADC_DMA_CFG_T
This structure sets up the DMA channel used for DMA transfer. The transfer can use a
hardware trigger which is selected in the DMA_ITRIG_INMUX register for the selected
channel.
See
for the implemented hardware triggers and the trigger numbers.
The DMA transfer is configured using the DMA API. After setting up the DMA transfer, a
handle is returned and passed to the ADC in this structure.
typedef struct{
uint32_t dma_adc_num; // DMA channel used for ADC data peripheral to memory
// transfer
uint32_t dma_pinmux_num; // H/W trigger number.
uint32_t dma_handle; // DMA handle passed to ADC
ADC_CALLBK_T dma_done_callback_pt; // DMA completion callback function
} ADC_DMA_CFG_T;
30.4.12.4 ADC_PARAM_T
It’s important that some of the parameters in ADC_CONFIG_T such as sequence control
register setting and channel numbers needs to be set up before ADC_PARAM_T can be
passed to the SEQA and SEQB read routines.
typedef struct { // params passed to adc driver function
uint32_t *buffer;
// Considering supporting DMA and non-DMA mode, 32-bit buffer is needed for DMA
uint32_t driver_mode;
// 0x00: Polling mode, function is blocked until transfer is finished.
// 0x01: Interrupt mode, function exit immediately, callback function is invoked
// when transfer is finished.
// 0x02: DMA mode, in case DMA block is available, data transferred by ADC is
// processed by DMA,
// and max buffer size is the
//total number ADC channels, DMA req function is called for ADC DMA
// channel setup, then SEQx