30 #include "pprzlink/messages.h"
36 #define AIRSPEED_AMSYS_ADDR 0xE8
37 #ifndef AIRSPEED_AMSYS_SCALE
38 #define AIRSPEED_AMSYS_SCALE 1
40 #define AIRSPEED_AMSYS_OFFSET_MAX 29491
41 #define AIRSPEED_AMSYS_OFFSET_MIN 3277
42 #define AIRSPEED_AMSYS_OFFSET_NBSAMPLES_INIT 40
43 #define AIRSPEED_AMSYS_OFFSET_NBSAMPLES_AVRG 60
44 #define AIRSPEED_AMSYS_NBSAMPLES_AVRG 10
45 #ifndef AIRSPEED_AMSYS_MAXPRESURE
46 #define AIRSPEED_AMSYS_MAXPRESURE 2068
48 #ifndef AIRSPEED_AMSYS_FILTER
49 #define AIRSPEED_AMSYS_FILTER 0
51 #ifndef AIRSPEED_AMSYS_I2C_DEV
52 #define AIRSPEED_AMSYS_I2C_DEV i2c0
54 #ifdef MEASURE_AMSYS_TEMPERATURE
55 #define TEMPERATURE_AMSYS_OFFSET_MAX 29491
56 #define TEMPERATURE_AMSYS_OFFSET_MIN 3277
57 #define TEMPERATURE_AMSYS_MAX 85
58 #define TEMPERATURE_AMSYS_MIN -25
61 #ifndef USE_AIRSPEED_AMSYS
63 #define USE_AIRSPEED_AMSYS TRUE
113 #ifndef MEASURE_AMSYS_TEMPERATURE
120 #if USE_AIRSPEED_AMSYS
124 #elif !defined USE_NPS
125 extern float sim_air_speed;
130 #ifndef AIRSPEED_AMSYS_SYNC_SEND
149 #ifdef MEASURE_AMSYS_TEMPERATURE
151 const float temp_off_scale = (float)(TEMPERATURE_AMSYS_MAX - TEMPERATURE_AMSYS_MIN) /
152 (TEMPERATURE_AMSYS_OFFSET_MAX - TEMPERATURE_AMSYS_OFFSET_MIN);
155 TEMPERATURE_AMSYS_MIN;
213 #ifdef AIRSPEED_AMSYS_SYNC_SEND
void airspeed_amsys_init(void)
double airspeed_amsys_offset_tmp
#define AIRSPEED_AMSYS_OFFSET_MAX
struct i2c_transaction airspeed_amsys_i2c_trans
uint16_t tempAS_amsys_raw
#define AIRSPEED_AMSYS_SCALE
float airspeed_amsys_offset
#define AIRSPEED_AMSYS_OFFSET_MIN
void airspeed_amsys_read_event(void)
float airspeed_temperature
volatile bool airspeed_amsys_i2c_done
#define AIRSPEED_AMSYS_OFFSET_NBSAMPLES_AVRG
#define AIRSPEED_AMSYS_FILTER
uint16_t airspeed_amsys_raw
void airspeed_amsys_downlink(void)
bool airspeed_amsys_offset_init
void airspeed_amsys_read_periodic(void)
uint16_t airspeed_amsys_cnt
bool airspeed_amsys_valid
#define AIRSPEED_AMSYS_I2C_DEV
#define AIRSPEED_AMSYS_ADDR
#define AIRSPEED_AMSYS_OFFSET_NBSAMPLES_INIT
#define AIRSPEED_AMSYS_MAXPRESURE
Common code for AP and FBW telemetry.
volatile uint8_t buf[I2C_BUF_LEN]
Transaction buffer With I2C_BUF_LEN number of bytes.
enum I2CTransactionStatus status
Transaction status.
bool i2c_receive(struct i2c_periph *p, struct i2c_transaction *t, uint8_t s_addr, uint16_t len)
Submit a read only transaction.
@ I2CTransDone
transaction set to done by user level
I2C transaction structure.
static void stateSetAirspeed_f(uint16_t id, float airspeed)
Set airspeed (float).
Architecture independent I2C (Inter-Integrated Circuit Bus) API.
PRINT_CONFIG_MSG("USE_INS_NAV_INIT defaulting to TRUE")
API to get/set the generic vehicle states.
arch independent UART (Universal Asynchronous Receiver/Transmitter) API
unsigned short uint16_t
Typedef defining 16 bit unsigned short type.