PX4 Firmware
PX4 Autopilot Software http://px4.io
|
Simple ADC support for PX4IO on STM32. More...
#include <px4_platform_common/px4_config.h>
#include <stdint.h>
#include <nuttx/arch.h>
#include <arch/stm32/chip.h>
#include <stm32.h>
#include <drivers/drv_hrt.h>
#include <perf/perf_counter.h>
#include "px4io.h"
Go to the source code of this file.
Macros | |
#define | DEBUG |
#define | REG(_reg) (*(volatile uint32_t *)(STM32_ADC1_BASE + _reg)) |
#define | rSR REG(STM32_ADC_SR_OFFSET) |
#define | rCR1 REG(STM32_ADC_CR1_OFFSET) |
#define | rCR2 REG(STM32_ADC_CR2_OFFSET) |
#define | rSMPR1 REG(STM32_ADC_SMPR1_OFFSET) |
#define | rSMPR2 REG(STM32_ADC_SMPR2_OFFSET) |
#define | rJOFR1 REG(STM32_ADC_JOFR1_OFFSET) |
#define | rJOFR2 REG(STM32_ADC_JOFR2_OFFSET) |
#define | rJOFR3 REG(STM32_ADC_JOFR3_OFFSET) |
#define | rJOFR4 REG(STM32_ADC_JOFR4_OFFSET) |
#define | rHTR REG(STM32_ADC_HTR_OFFSET) |
#define | rLTR REG(STM32_ADC_LTR_OFFSET) |
#define | rSQR1 REG(STM32_ADC_SQR1_OFFSET) |
#define | rSQR2 REG(STM32_ADC_SQR2_OFFSET) |
#define | rSQR3 REG(STM32_ADC_SQR3_OFFSET) |
#define | rJSQR REG(STM32_ADC_JSQR_OFFSET) |
#define | rJDR1 REG(STM32_ADC_JDR1_OFFSET) |
#define | rJDR2 REG(STM32_ADC_JDR2_OFFSET) |
#define | rJDR3 REG(STM32_ADC_JDR3_OFFSET) |
#define | rJDR4 REG(STM32_ADC_JDR4_OFFSET) |
#define | rDR REG(STM32_ADC_DR_OFFSET) |
Functions | |
int | adc_init (void) |
Sensors/misc inputs. More... | |
uint16_t | adc_measure (unsigned channel) |
Variables | |
perf_counter_t | adc_perf |
#define rCR2 REG(STM32_ADC_CR2_OFFSET) |
Definition at line 60 of file adc.c.
Referenced by adc_init(), and adc_measure().
#define rDR REG(STM32_ADC_DR_OFFSET) |
Definition at line 77 of file adc.c.
Referenced by adc_measure().
#define REG | ( | _reg | ) | (*(volatile uint32_t *)(STM32_ADC1_BASE + _reg)) |
#define rSMPR1 REG(STM32_ADC_SMPR1_OFFSET) |
Definition at line 61 of file adc.c.
Referenced by adc_init().
#define rSMPR2 REG(STM32_ADC_SMPR2_OFFSET) |
Definition at line 62 of file adc.c.
Referenced by adc_init().
#define rSQR1 REG(STM32_ADC_SQR1_OFFSET) |
Definition at line 69 of file adc.c.
Referenced by adc_init().
#define rSQR2 REG(STM32_ADC_SQR2_OFFSET) |
Definition at line 70 of file adc.c.
Referenced by adc_init().
#define rSQR3 REG(STM32_ADC_SQR3_OFFSET) |
Definition at line 71 of file adc.c.
Referenced by adc_init(), and adc_measure().
#define rSR REG(STM32_ADC_SR_OFFSET) |
Definition at line 58 of file adc.c.
Referenced by adc_measure().
int adc_init | ( | void | ) |
Sensors/misc inputs.
Definition at line 82 of file adc.c.
References PC_ELAPSED, perf_alloc, rCR2, rSMPR1, rSMPR2, rSQR1, rSQR2, and rSQR3.
Referenced by user_start().
uint16_t adc_measure | ( | unsigned | channel | ) |
Definition at line 137 of file adc.c.
References hrt_absolute_time(), hrt_abstime, hrt_elapsed_time(), perf_begin(), perf_end(), rCR2, rDR, rSQR3, and rSR.
Referenced by controls_tick(), and registers_get().
perf_counter_t adc_perf |