29 #include "generated/airframe.h"
32 #ifndef USE_AIRSPEED_ADC
33 #define USE_AIRSPEED_ADC TRUE
37 #if !defined AIRSPEED_ADC_QUADRATIC_SCALE && !defined AIRSPEED_ADC_SCALE
38 #error "You need to define either AIRSPEED_ADC_QUADRATIC_SCALE or AIRSPEED_ADC_SCALE (linear)."
43 #ifndef SITL // Use ADC if not in simulation
45 #ifndef ADC_CHANNEL_AIRSPEED
46 #error "ADC_CHANNEL_AIRSPEED needs to be defined to use airspeed_adc module"
49 #ifndef ADC_CHANNEL_AIRSPEED_NB_SAMPLES
50 #define ADC_CHANNEL_AIRSPEED_NB_SAMPLES DEFAULT_AV_NB_SAMPLE
61 #ifdef AIRSPEED_ADC_QUADRATIC_SCALE
77 #ifdef AIRSPEED_ADC_QUADRATIC_SCALE
83 #elif !defined USE_NPS
Read an airspeed or differential pressure sensor via onboard ADC.
void airspeed_adc_update(void)
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.
arch independent ADC (Analog to Digital Converter) API
void airspeed_adc_init(void)
#define ADC_CHANNEL_AIRSPEED_NB_SAMPLES
Generic interface for all ADC hardware drivers, independent from microcontroller architecture.
static struct adc_buf buf_airspeed
struct AirspeedAdc airspeed_adc
float scale
used as quadratic scale if AIRSPEED_ADC_QUADRATIC_SCALE, otherwise linear
API to get/set the generic vehicle states.
static void stateSetAirspeed_f(float airspeed)
Set airspeed (float).