rfLPC
A low level library for using NXP's LPC17xx SoC. Config is given for MBED prototyping board

Analog-To-Digital Converter driver. More...

Functions

void rflpc_adc_init (rflpc_pin_t pin, rflpc_clock_divider_t clock_divider)
 Initializes the Analog/Digital Converter on given pin. More...
 
void rflpc_adc_burst_init (rflpc_clock_divider_t clock_divider, rflpc_irq_handler_t handler)
 Initializes the Analog/Digital converter for Burst Mode. More...
 
void rflpc_adc_burst_enable (rflpc_pin_t pin)
 Enable an ADC pin to be sampled in burst mode. More...
 
void rflpc_adc_burst_start ()
 Start ADC burst mode. More...
 
static void rflpc_adc_sample (rflpc_pin_t pin)
 Start an ADC conversion on specified pin. More...
 
uint16_t rflpc_adc_read (rflpc_pin_t pin)
 Read the last converted value of specified pin using dedicated data register. More...
 
uint16_t rflpc_adc_read_global ()
 Read the last converted value of any ADC pin, using global data register. More...
 

Detailed Description

Analog-To-Digital Converter driver.

Function Documentation

void rflpc_adc_burst_enable ( rflpc_pin_t  pin)

Enable an ADC pin to be sampled in burst mode.

Parameters
pinThe desired pin to sample.
void rflpc_adc_burst_init ( rflpc_clock_divider_t  clock_divider,
rflpc_irq_handler_t  handler 
)

Initializes the Analog/Digital converter for Burst Mode.

Parameters
clock_dividerThe divider applied to APB peripheral clock.
handlerInterruption handler
Note
This function DOES NOT actually starts the driver (see rflpc_adc_burst_start()).
void rflpc_adc_burst_start ( )

Start ADC burst mode.

Note
This function actually starts the driver with burst mode enabled. Please check you have previously enabled all the adc pins you want to be sampled.
void rflpc_adc_init ( rflpc_pin_t  pin,
rflpc_clock_divider_t  clock_divider 
)

Initializes the Analog/Digital Converter on given pin.

Parameters
pinThe desired pin to sample.
clock_dividerThe divider applied to APB peripheral clock.
Note
This function actually starts the driver.
APB peripheral clock is set by default at 13MHz, because the maximum sample clock is 13Mhz anyway.
uint16_t rflpc_adc_read ( rflpc_pin_t  pin)

Read the last converted value of specified pin using dedicated data register.

Parameters
pinThe ADC pin to read.
Returns
The value corresponding to specified pin's last conversion.
Note
Returned value is stored on 12 bits. Bit 15 stores the OVERRUN flag.
This function waits for a conversion to be done.
You should use ONLY ONE method to read converted values on ADC pins, as OVERRUN flag may be out of synchronization between registers.
uint16_t rflpc_adc_read_global ( )

Read the last converted value of any ADC pin, using global data register.

Returns
The last converted value by any pin.
Note
Returned value is stored on 12 bits. Bits 12 to 14 store the pin from which the value has been converted. Bit 15 stores the OVERRUN flag.
This function waits for a conversion to be done.
You should use ONLY ONE method to read converted values on ADC pins, as OVERRUN flag may be out of synchronization between registers.
static void rflpc_adc_sample ( rflpc_pin_t  pin)
inlinestatic

Start an ADC conversion on specified pin.

Parameters
pinthe pin to be sampled.
Note
This only starts sampling, it does not wait until conversion is done.

Definition at line 85 of file adc.h.

References RFLPC_SET_BITS_VAL.