mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-06-01 04:46:51 +08:00
use I2CReceive makro for airspeed ets
This commit is contained in:
@@ -83,17 +83,12 @@ void airspeed_ets_init( void ) {
|
|||||||
airspeed_ets_buffer[n] = 0.0;
|
airspeed_ets_buffer[n] = 0.0;
|
||||||
|
|
||||||
airspeed_ets_i2c_trans.status = I2CTransDone;
|
airspeed_ets_i2c_trans.status = I2CTransDone;
|
||||||
airspeed_ets_i2c_trans.slave_addr = AIRSPEED_ETS_ADDR;
|
|
||||||
airspeed_ets_i2c_trans.stop_after_transmit = TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void airspeed_ets_read_periodic( void ) {
|
void airspeed_ets_read_periodic( void ) {
|
||||||
#ifndef SITL
|
#ifndef SITL
|
||||||
if (airspeed_ets_i2c_trans.status == I2CTransDone) {
|
if (airspeed_ets_i2c_trans.status == I2CTransDone)
|
||||||
airspeed_ets_i2c_trans.type = I2CTransRx;
|
I2CReceive(i2c0, airspeed_ets_i2c_trans, AIRSPEED_ETS_ADDR, 2);
|
||||||
airspeed_ets_i2c_trans.len_r = 2;
|
|
||||||
i2c_submit(&i2c0, &airspeed_ets_i2c_trans);
|
|
||||||
}
|
|
||||||
#else // SITL
|
#else // SITL
|
||||||
extern float sim_air_speed;
|
extern float sim_air_speed;
|
||||||
EstimatorSetAirspeed(sim_air_speed);
|
EstimatorSetAirspeed(sim_air_speed);
|
||||||
|
|||||||
Reference in New Issue
Block a user