Paparazzi UAS v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
Loading...
Searching...
No Matches
adc.h File Reference

arch independent ADC (Analog to Digital Converter) API More...

#include <inttypes.h>
#include "mcu_periph/adc_arch.h"
+ Include dependency graph for adc.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  adc_buf
 Generic interface for all ADC hardware drivers, independent from microcontroller architecture. More...
 

Macros

#define MAX_AV_NB_SAMPLE   0x20
 
#define DEFAULT_AV_NB_SAMPLE   0x20
 

Functions

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.
 
void adc_init (void)
 Starts conversions.
 

Detailed Description

arch independent ADC (Analog to Digital Converter) API

Facility to store last values in a circular buffer for a specific channel:

Definition in file adc.h.


Data Structure Documentation

◆ adc_buf

struct adc_buf

Generic interface for all ADC hardware drivers, independent from microcontroller architecture.

Struct to collect samples from ADC and building an average over MAX_AV_NB_SAMPLE values. See adc_buf_channel.

Definition at line 53 of file adc.h.

Data Fields
uint8_t av_nb_sample
uint8_t head
uint32_t sum
uint16_t values[MAX_AV_NB_SAMPLE]

Macro Definition Documentation

◆ DEFAULT_AV_NB_SAMPLE

#define DEFAULT_AV_NB_SAMPLE   0x20

Definition at line 41 of file adc.h.

◆ MAX_AV_NB_SAMPLE

#define MAX_AV_NB_SAMPLE   0x20

Definition at line 40 of file adc.h.

Function Documentation

◆ adc_buf_channel()

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.

Registers a buffer to be used to store the specified converted channel
Usage:
Generic interface for all ADC hardware drivers, independent from microcontroller architecture.
Definition adc.h:53
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.
Definition adc_arch.c:312
uint16_t foo
Definition main_demo5.c:58

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

Todo:
: fx a more general ADC

Definition at line 312 of file adc_arch.c.

References ADC_NUM_CHANNELS, foo, MAX_AV_NB_SAMPLE, nb_adc1_channels, nb_adc2_channels, nb_adc3_channels, and s.

Referenced by adc_generic_init(), airspeed_adc_init(), aoa_adc_init(), electrical_init(), glide_wing_lock_init(), humid_hih_init(), light_solar_init(), light_temt_init(), mf_ptu_init(), sonar_adc_init(), temp_adc_init(), temp_tcouple_adc_init(), and wing_rotation_adc_init().

+ Here is the caller graph for this function:

◆ adc_init()

void adc_init ( void  )

Starts conversions.

Starts conversions.

Initialize ADC drivers, buffers and start conversion in the background

Starts conversions.

Definition at line 332 of file adc_arch.c.

References adc1callback(), ADC_BUF_DEPTH, adc_channel_map, adc_configure(), adc_dev_init(), adc_init_irq(), adc_init_rcc(), adc_init_single(), ADC_NUM_CHANNELS, ADC_SAMPLE_RATE, adcerrorcallback(), foo, gpio_setup_pin_analog(), nb_adc1_channels, nb_adc2_channels, nb_adc3_channels, and PRINT_CONFIG_MSG().

Referenced by mcu_init().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: