Paparazzi UAS v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
airspeed_adc.c
Go to the documentation of this file.
1/*
2 * Copyright (C) 2010 The Paparazzi Team
3 *
4 * This file is part of paparazzi.
5 *
6 * paparazzi is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2, or (at your option)
9 * any later version.
10 *
11 * paparazzi is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with paparazzi; see the file COPYING. If not, write to
18 * the Free Software Foundation, 59 Temple Place - Suite 330,
19 * Boston, MA 02111-1307, USA.
20 */
21
27#include "mcu_periph/adc.h"
28#include BOARD_CONFIG
29#include "generated/airframe.h"
30#include "state.h"
31#include "modules/core/abi.h"
32
33#ifndef USE_AIRSPEED_ADC
34#define USE_AIRSPEED_ADC TRUE
35#endif
37
38#if !defined AIRSPEED_ADC_QUADRATIC_SCALE && !defined AIRSPEED_ADC_SCALE
39#error "You need to define either AIRSPEED_ADC_QUADRATIC_SCALE or AIRSPEED_ADC_SCALE (linear)."
40#endif
41
43
44#ifndef SITL // Use ADC if not in simulation
45
46#ifndef ADC_CHANNEL_AIRSPEED
47#error "ADC_CHANNEL_AIRSPEED needs to be defined to use airspeed_adc module"
48#endif
49
50#ifndef ADC_CHANNEL_AIRSPEED_NB_SAMPLES
51#define ADC_CHANNEL_AIRSPEED_NB_SAMPLES DEFAULT_AV_NB_SAMPLE
52#endif
53
54static struct adc_buf buf_airspeed;
55
56#endif
57
72
74{
75#ifndef SITL
78#ifdef AIRSPEED_ADC_QUADRATIC_SCALE
80#else
82#endif
83
84#elif !defined USE_NPS
85 extern float sim_air_speed;
87#endif //SITL
88
90
91#if USE_AIRSPEED_ADC
93#endif
94}
Main include for ABI (AirBorneInterface).
#define AIRSPEED_ADC_ID
arch independent ADC (Analog to Digital Converter) API
uint32_t sum
Definition adc.h:54
uint8_t av_nb_sample
Definition adc.h:57
Generic interface for all ADC hardware drivers, independent from microcontroller architecture.
Definition adc.h:53
struct AirspeedAdc airspeed_adc
static struct adc_buf buf_airspeed
void airspeed_adc_update(void)
#define ADC_CHANNEL_AIRSPEED_NB_SAMPLES
void airspeed_adc_init(void)
#define USE_AIRSPEED_ADC
Read an airspeed or differential pressure sensor via onboard ADC.
uint16_t val
float scale
used as quadratic scale if AIRSPEED_ADC_QUADRATIC_SCALE, otherwise linear
uint16_t offset
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
static void stateSetAirspeed_f(uint16_t id, float airspeed)
Set airspeed (float).
Definition state.h:1486
uint16_t foo
Definition main_demo5.c:58
PRINT_CONFIG_VAR(ONELOOP_ANDI_FILT_CUTOFF)
API to get/set the generic vehicle states.