Paparazzi UAS  v4.0.4_stable-3-gf39211a
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
adc_arch.c File Reference
#include "mcu_periph/adc.h"
#include <stm32/rcc.h>
#include <stm32/misc.h>
#include <stm32/adc.h>
#include <stm32/gpio.h>
#include <stm32/tim.h>
#include <string.h>
#include "std.h"
#include "led.h"
+ Include dependency graph for adc_arch.c:

Go to the source code of this file.

Functions

void adc1_2_irq_handler (void)
 This is the driver for the analog to digital converters on STM32. More...
 
static void adc_init_single (ADC_TypeDef *adc_t, uint8_t chan1, uint8_t chan2, uint8_t chan3, uint8_t chan4)
 
static void adc_push_sample (struct adc_buf *buf, uint16_t sample)
 
static void adc_init_rcc (void)
 
static void adc_init_irq (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

uint8_t adc_new_data_trigger
 
static uint8_t adc_injected_channels [4]
 
static uint8_t adc_channel_map [4]
 

Function Documentation

void adc1_2_irq_handler ( void  )

This is the driver for the analog to digital converters on STM32.

ADC1+2 interrupt hander.

Usage: Define flags for ADCs to use and their channels:

-DUSE_AD1 -DUSE_AD1_1 -DUSE_AD1_3

would enable ADC1 and it's channels 1 and 3.

Definition at line 463 of file adc_arch.c.

References ADC1, adc_injected_channels, adc_new_data_trigger, adc_push_sample(), channel, NB_ADC1_CHANNELS, and NB_ADC2_CHANNELS.

+ Here is the call graph for this function:

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).

Definition at line 205 of file adc_arch.c.

References adc_buf::av_nb_sample.

static void adc_init_irq ( void  )
inlinestatic

Definition at line 258 of file adc_arch.c.

Referenced by adc_init().

+ Here is the caller graph for this function:

static void adc_init_rcc ( void  )
inlinestatic

Definition at line 215 of file adc_arch.c.

Referenced by adc_init().

+ Here is the caller graph for this function:

static void adc_init_single ( ADC_TypeDef *  adc_t,
uint8_t  chan1,
uint8_t  chan2,
uint8_t  chan3,
uint8_t  chan4 
)
inlinestatic

Definition at line 276 of file adc_arch.c.

References ADC1, adc_channel_map, NB_ADC1_CHANNELS, and NB_ADC2_CHANNELS.

Referenced by adc_init().

+ Here is the caller graph for this function:

static void adc_push_sample ( struct adc_buf buf,
uint16_t  sample 
)
inlinestatic

Definition at line 450 of file adc_arch.c.

References adc_buf::av_nb_sample, adc_buf::head, adc_buf::sum, and adc_buf::values.

Referenced by adc1_2_irq_handler().

+ Here is the caller graph for this function:

Variable Documentation

uint8_t adc_channel_map[4]
static

Definition at line 199 of file adc_arch.c.

Referenced by adc_init(), and adc_init_single().

uint8_t adc_injected_channels[4]
static

Definition at line 189 of file adc_arch.c.

Referenced by adc1_2_irq_handler(), and adc_init().

uint8_t adc_new_data_trigger

Definition at line 100 of file adc_arch.c.

Referenced by adc1_2_irq_handler(), adc_init(), main_event_task(), and main_periodic().