Paparazzi UAS
v5.15_devel-230-gc96ce27
Paparazzi is a free software Unmanned Aircraft System.
|
ADC driver. More...
#include "mcu_periph/adc.h"
#include "mcu_periph/gpio.h"
#include "hal.h"
#include "std.h"
#include "mcu_periph/ram_arch.h"
Go to the source code of this file.
Macros | |
#define | USE_AD1 1 |
#define | ADC_BUF_DEPTH (MAX_AV_NB_SAMPLE/2) |
Functions | |
static | IN_DMA_SECTION (adcsample_t adc_samples[ADC_NUM_CHANNELS *ADC_BUF_DEPTH]) |
static void | adc_regular_sequence (uint32_t *sqr1, uint32_t *sqr2, uint32_t *sqr3, uint8_t length, const uint8_t channel[]) |
static void | adc_sample_time_on_all_channels (uint32_t *smpr1, uint32_t *smpr2, uint8_t time) |
void | adc1callback (ADCDriver *adcp, adcsample_t *buffer, size_t n) |
Adc1 callback. More... | |
static void | adcerrorcallback (ADCDriver *adcp, adcerror_t err) |
Adc error callback. More... | |
void | adc_buf_channel (uint8_t adc_channel, struct adc_buf *s, uint8_t av_nb_sample) |
Link between ChibiOS ADC drivers and Paparazzi adc_buffers. More... | |
void | adc_init (void) |
Adc init. More... | |
Variables | |
static const uint8_t | adc_channel_map [ADC_NUM_CHANNELS] |
#endif More... | |
uint8_t | adc_error_flag = 0 |
ADCDriver * | adcp_err = NULL |
static struct adc_buf * | adc1_buffers [ADC_NUM_CHANNELS] |
static uint32_t | adc1_sum_tmp [ADC_NUM_CHANNELS] |
static uint8_t | adc1_samples_tmp [ADC_NUM_CHANNELS] |
static ADCConversionGroup | adcgrpcfg |
Configuration structure must be global. More... | |
ADC driver.
ADC defines for Lia board (STM32F105) 5 Channels: 1 - ADC1, Channel 13 2 - ADC2, Channel 10 3 - ADC3, Channel 11 4 - ADC4, Channel 14 5 - Temperature sensor, Channel 16
Default buffer depth is equal to MAX_AV_NB_SAMPLE This allows us to always have more or equal samples than the user requires
For 5 actual channels we have to define (DUMMY stants for 1 dummy channel): CH1 + DUMMY + CH2 + DUMMY + CH3 + DUMMY + CH4 + DUMMY + CH_TEMP = 9 channels Then only every second channel is really read. Might be fixed in next version of ChibiOS
V_ref is 3.3V, ADC has 12bit resolution.
Definition in file adc_arch.c.
#define ADC_BUF_DEPTH (MAX_AV_NB_SAMPLE/2) |
Definition at line 144 of file adc_arch.c.
Referenced by adc_init().
#define USE_AD1 1 |
Definition at line 64 of file adc_arch.c.
void adc1callback | ( | ADCDriver * | adcp, |
adcsample_t * | buffer, | ||
size_t | n | ||
) |
Adc1 callback.
Callback, fired after half of the buffer is filled (i.e. half of the samples is collected). Since we are assuming continuous ADC conversion, the ADC state is never equal to ADC_COMPLETE.
[in] | adcp | pointer to a ADCDriver object |
[in] | buffer | pointer to a buffer with samples |
[in] | n | number of samples |
Definition at line 224 of file adc_arch.c.
References adc1_samples_tmp, adc1_sum_tmp, ADC_NUM_CHANNELS, adc_buf::av_nb_sample, channel, and adc_buf::sum.
Referenced by adc_init().
Link between ChibiOS ADC drivers and Paparazzi adc_buffers.
Registers a buffer to be used to store the specified converted channel Usage:
Definition at line 281 of file adc_arch.c.
Referenced by adc_generic_init(), airspeed_adc_init(), aoa_adc_init(), baro_init(), electrical_init(), glide_wing_lock_init(), humid_hih_init(), imu_analog_init(), infrared_adc_init(), light_solar_init(), light_temt_init(), mf_ptu_init(), sonar_adc_init(), temp_adc_init(), temp_tcouple_adc_init(), and vms_ecu_demo_init().
void adc_init | ( | void | ) |
Adc init.
Starts conversions.
Initialize ADC drivers, buffers and start conversion in the background
Definition at line 304 of file adc_arch.c.
Referenced by mcu_init().
|
static |
Definition at line 171 of file adc_arch.c.
Referenced by adc_init().
|
static |
Definition at line 195 of file adc_arch.c.
Referenced by adc_init().
|
static |
Adc error callback.
Fired if DMA error happens or ADC overflows
Definition at line 270 of file adc_arch.c.
References adc_error_flag, and adcp_err.
Referenced by adc_init().
|
static |
|
static |
Definition at line 149 of file adc_arch.c.
|
static |
Definition at line 151 of file adc_arch.c.
Referenced by adc1callback().
|
static |
Definition at line 150 of file adc_arch.c.
Referenced by adc1callback().
|
static |
uint8_t adc_error_flag = 0 |
Definition at line 138 of file adc_arch.c.
Referenced by adcerrorcallback().
|
static |
Configuration structure must be global.
Definition at line 297 of file adc_arch.c.
Referenced by adc_init().
ADCDriver* adcp_err = NULL |
Definition at line 139 of file adc_arch.c.
Referenced by adcerrorcallback().