51 #ifndef USE_AIRSPEED_ETS
53 #define USE_AIRSPEED_ETS TRUE
58 #if !USE_AIRSPEED_ETS && !AIRSPEED_ETS_SYNC_SEND
59 #warning either set USE_AIRSPEED_ETS or AIRSPEED_ETS_SYNC_SEND to use airspeed_ets
62 #define AIRSPEED_ETS_ADDR 0xEA
63 #ifndef AIRSPEED_ETS_SCALE
64 #define AIRSPEED_ETS_SCALE 1.8
66 #ifndef AIRSPEED_ETS_OFFSET
67 #define AIRSPEED_ETS_OFFSET 0
69 #define AIRSPEED_ETS_OFFSET_MAX 1750
70 #define AIRSPEED_ETS_OFFSET_MIN 1450
71 #define AIRSPEED_ETS_OFFSET_NBSAMPLES_INIT 40
72 #define AIRSPEED_ETS_OFFSET_NBSAMPLES_AVRG 60
73 #define AIRSPEED_ETS_NBSAMPLES_AVRG 10
75 #ifndef AIRSPEED_ETS_I2C_DEV
76 #define AIRSPEED_ETS_I2C_DEV i2c0
81 #ifndef AIRSPEED_ETS_START_DELAY
82 #define AIRSPEED_ETS_START_DELAY 0.2
108 airspeed_ets_raw = 0;
110 airspeed_ets_offset = 0;
111 airspeed_ets_offset_tmp = 0;
112 airspeed_ets_i2c_done =
TRUE;
113 airspeed_ets_valid =
FALSE;
114 airspeed_ets_offset_init =
FALSE;
117 airspeed_ets_buffer_idx = 0;
124 airspeed_ets_delay_done =
FALSE;
138 #elif !defined USE_NPS
147 float airspeed_tmp = 0.0;
160 #if !AIRSPEED_ETS_3RD_PARTY_MODE
183 #ifdef AIRSPEED_ETS_REVERSE
198 #endif //AIRSPEED_ETS_3RD_PARTY_MODE
201 if (airspeed_tmp < 0.0) {
217 #if AIRSPEED_ETS_SYNC_SEND
#define AIRSPEED_ETS_OFFSET_NBSAMPLES_INIT
arch independent UART (Universal Asynchronous Receiver/Transmitter) API
volatile uint8_t buf[I2C_BUF_LEN]
Transaction buffer With I2C_BUF_LEN number of bytes.
#define AIRSPEED_ETS_NBSAMPLES_AVRG
void airspeed_ets_init(void)
#define AIRSPEED_ETS_SCALE
#define AIRSPEED_ETS_OFFSET_MIN
uint16_t airspeed_ets_cnt
void airspeed_ets_read_periodic(void)
#define AIRSPEED_ETS_OFFSET_NBSAMPLES_AVRG
transaction set to done by user level
Driver for the EagleTree Systems Airspeed Sensor.
Architecture independent timing functions.
#define AIRSPEED_ETS_I2C_DEV
volatile bool_t airspeed_ets_i2c_done
#define AIRSPEED_ETS_ADDR
PRINT_CONFIG_MSG("USE_INS_NAV_INIT defaulting to TRUE")
#define AIRSPEED_ETS_START_DELAY
delay in seconds until sensor is read after startup
#define AIRSPEED_ETS_OFFSET
int airspeed_ets_buffer_idx
I2C transaction structure.
enum I2CTransactionStatus status
Transaction status.
bool_t airspeed_ets_delay_done
#define DefaultChannel
SITL.
API to get/set the generic vehicle states.
static void stateSetAirspeed_f(float airspeed)
Set airspeed (float).
struct i2c_transaction airspeed_ets_i2c_trans
Common code for AP and FBW telemetry.
uint16_t airspeed_ets_offset
bool_t airspeed_ets_valid
void airspeed_ets_read_event(void)
float airspeed_ets_buffer[AIRSPEED_ETS_NBSAMPLES_AVRG]
#define SysTimeTimerStart(_t)
#define AIRSPEED_ETS_OFFSET_MAX
uint32_t airspeed_ets_delay_time
bool_t airspeed_ets_offset_init
uint16_t airspeed_ets_raw
uint32_t airspeed_ets_offset_tmp
bool_t i2c_receive(struct i2c_periph *p, struct i2c_transaction *t, uint8_t s_addr, uint16_t len)
Submit a read only transaction.
Architecture independent I2C (Inter-Integrated Circuit Bus) API.