Paparazzi UAS  v5.10_stable-5-g83a0da5-dirty
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
adc_arch.c File Reference

Handling of ADC hardware for lpc21xx. More...

#include "mcu_periph/adc.h"
#include "LPC21xx.h"
#include "armVIC.h"
#include <BOARD_CONFIG>
+ Include dependency graph for adc_arch.c:

Go to the source code of this file.

Functions

void adcISR0 (void)
 
void adcISR1 (void)
 
void adc_buf_channel (uint8_t adc_channel, struct adc_buf *s, uint8_t av_nb_sample)
 Registers a buffer to be used to store the specified converted channel Usage: More...
 
void adc_init (void)
 Starts conversions. More...
 

Variables

static struct adc_bufbuffers [NB_ADC *2]
 First NB_ADC for bank 0, others for bank 2. More...
 
volatile uint16_t adc0_val [NB_ADC] = {1, 2, 3, 4, 5, 6, 7, 8}
 
volatile uint16_t adc1_val [NB_ADC] = {9, 10, 11, 12, 13, 14, 15, 16}
 
static const uint32_t ADC_PINSEL0_ONES = 0
 
static const uint32_t ADC_PINSEL1_ONES = 0
 
static const uint32_t ADC_AD0CR_SEL_HW_SCAN = 0
 
static const uint32_t ADC_AD1CR_SEL_HW_SCAN = 0
 

Detailed Description

Handling of ADC hardware for lpc21xx.

Definition in file adc_arch.c.

Function Documentation

void adc_buf_channel ( uint8_t  adc_channel,
struct adc_buf s,
uint8_t  av_nb_sample 
)

Registers a buffer to be used to store the specified converted channel Usage:

1 struct adc_buf channel_buf;
2 adc_buf_channel(1, &channel_buf, 12);

Registers channel_buf as buffer for ADC channel 1, with max index 12 (12 samples).

Registers a buffer to be used to store the specified converted channel Usage:

Todo:
: fx a more general ADC

Definition at line 59 of file adc_arch.c.

References adc_buf::av_nb_sample.

void adc_init ( void  )

Starts conversions.

Starts conversions.

Initialize ADC drivers, buffers and start conversion in the background

Starts conversions.

Definition at line 195 of file adc_arch.c.

References _VIC_ADDR, _VIC_CNTL, AD0CR, AD1CR, ADC_AD0CR_SEL_HW_SCAN, ADC_AD1CR_SEL_HW_SCAN, ADC_PINSEL0_ONES, ADC_PINSEL1_ONES, adcISR0(), adcISR1(), PINSEL0, PINSEL1, VIC_AD0, VIC_AD1, VIC_BIT, VIC_ENABLE, VICIntEnable, and VICIntSelect.

+ Here is the call graph for this function:

void adcISR0 ( void  )

Definition at line 235 of file adc_arch.c.

References AD0GDR, adc0_val, adc_buf::av_nb_sample, channel, adc_buf::head, ISR_ENTRY, ISR_EXIT, adc_buf::sum, adc_buf::values, and VICVectAddr.

Referenced by adc_init().

+ Here is the caller graph for this function:

void adcISR1 ( void  )

Definition at line 257 of file adc_arch.c.

References AD1GDR, adc1_val, adc_buf::av_nb_sample, channel, adc_buf::head, ISR_ENTRY, ISR_EXIT, NB_ADC, adc_buf::sum, adc_buf::values, and VICVectAddr.

Referenced by adc_init().

+ Here is the caller graph for this function:

Variable Documentation

volatile uint16_t adc0_val[NB_ADC] = {1, 2, 3, 4, 5, 6, 7, 8}

Definition at line 53 of file adc_arch.c.

Referenced by adcISR0().

volatile uint16_t adc1_val[NB_ADC] = {9, 10, 11, 12, 13, 14, 15, 16}

Definition at line 54 of file adc_arch.c.

Referenced by adcISR1().

const uint32_t ADC_AD0CR_SEL_HW_SCAN = 0
static

Definition at line 141 of file adc_arch.c.

Referenced by adc_init().

const uint32_t ADC_AD1CR_SEL_HW_SCAN = 0
static

Definition at line 168 of file adc_arch.c.

Referenced by adc_init().

const uint32_t ADC_PINSEL0_ONES = 0
static

Definition at line 87 of file adc_arch.c.

Referenced by adc_init().

const uint32_t ADC_PINSEL1_ONES = 0
static

Definition at line 114 of file adc_arch.c.

Referenced by adc_init().

struct adc_buf* buffers[NB_ADC *2]
static

First NB_ADC for bank 0, others for bank 2.

Definition at line 51 of file adc_arch.c.

Referenced by v4l2_init().