Skip to content

Commit

Permalink
[modules] airspeed_ets: retry after failed transaction
Browse files Browse the repository at this point in the history
  • Loading branch information
flixr committed Oct 31, 2014
1 parent 95a1ccc commit dd386f1
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion sw/airborne/modules/sensors/airspeed_ets.h
Expand Up @@ -55,6 +55,15 @@ extern void airspeed_ets_init( void );
extern void airspeed_ets_read_periodic( void );
extern void airspeed_ets_read_event( void );

#define AirspeedEtsEvent() { if (airspeed_ets_i2c_trans.status == I2CTransSuccess) airspeed_ets_read_event(); }
static inline void AirspeedEtsEvent(void)
{
if (airspeed_ets_i2c_trans.status == I2CTransSuccess) {
airspeed_ets_read_event();
}
else if (airspeed_ets_i2c_trans.status == I2CTransFailed) {
// if transaction failed, mark as done so can be retried
airspeed_ets_i2c_trans.status = I2CTransDone;
}
}

#endif // AIRSPEED_ETS_H

0 comments on commit dd386f1

Please sign in to comment.