Paparazzi UAS
v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
|
Driver for the EagleTree Systems Airspeed Sensor. More...
#include "sensors/airspeed_ets.h"
#include "state.h"
#include "mcu_periph/i2c.h"
#include "mcu_periph/uart.h"
#include "mcu_periph/sys_time.h"
#include "pprzlink/messages.h"
#include "modules/core/abi.h"
#include "modules/datalink/downlink.h"
#include <math.h>
#include "modules/datalink/telemetry.h"
Go to the source code of this file.
Macros | |
#define | AIRSPEED_ETS_ADDR 0xEA |
#define | AIRSPEED_ETS_SCALE 1.8 |
#define | AIRSPEED_ETS_OFFSET 0 |
#define | AIRSPEED_ETS_OFFSET_MAX 1750 |
#define | AIRSPEED_ETS_OFFSET_MIN 1450 |
#define | AIRSPEED_ETS_OFFSET_NBSAMPLES_INIT 40 |
#define | AIRSPEED_ETS_OFFSET_NBSAMPLES_AVRG 60 |
#define | AIRSPEED_ETS_NBSAMPLES_AVRG 10 |
#define | AIRSPEED_ETS_I2C_DEV i2c0 |
#define | AIRSPEED_ETS_START_DELAY 0.2 |
delay in seconds until sensor is read after startup More... | |
Functions | |
static void | airspeed_ets_downlink (struct transport_tx *trans, struct link_device *dev) |
void | airspeed_ets_init (void) |
void | airspeed_ets_read_periodic (void) |
void | airspeed_ets_read_event (void) |
Driver for the EagleTree Systems Airspeed Sensor.
Has only been tested with V3 of the sensor hardware.
Notes: Connect directly to TWOG/Tiny I2C port. Multiple sensors can be chained together. Sensor should be in the proprietary mode (default) and not in 3rd party mode. Define AIRSPEED_ETS_3RD_PARTY_MODE to run it in 3rd party mode.
Sensor module wire assignments: Red wire: 5V White wire: Ground Yellow wire: SDA Brown wire: SCL
Definition in file airspeed_ets.c.
#define AIRSPEED_ETS_ADDR 0xEA |
Definition at line 67 of file airspeed_ets.c.
#define AIRSPEED_ETS_I2C_DEV i2c0 |
Definition at line 81 of file airspeed_ets.c.
#define AIRSPEED_ETS_NBSAMPLES_AVRG 10 |
Definition at line 78 of file airspeed_ets.c.
#define AIRSPEED_ETS_OFFSET 0 |
Definition at line 72 of file airspeed_ets.c.
#define AIRSPEED_ETS_OFFSET_MAX 1750 |
Definition at line 74 of file airspeed_ets.c.
#define AIRSPEED_ETS_OFFSET_MIN 1450 |
Definition at line 75 of file airspeed_ets.c.
#define AIRSPEED_ETS_OFFSET_NBSAMPLES_AVRG 60 |
Definition at line 77 of file airspeed_ets.c.
#define AIRSPEED_ETS_OFFSET_NBSAMPLES_INIT 40 |
Definition at line 76 of file airspeed_ets.c.
#define AIRSPEED_ETS_SCALE 1.8 |
Definition at line 69 of file airspeed_ets.c.
#define AIRSPEED_ETS_START_DELAY 0.2 |
delay in seconds until sensor is read after startup
Definition at line 87 of file airspeed_ets.c.
|
static |
Definition at line 119 of file airspeed_ets.c.
References airspeed_ets, AIRSPEED_ETS_ID, airspeed_ets_offset, airspeed_ets_raw, dev, and offset.
Referenced by airspeed_ets_init().
void airspeed_ets_init | ( | void | ) |
Definition at line 134 of file airspeed_ets.c.
References airspeed_ets, airspeed_ets_buffer, airspeed_ets_buffer_idx, airspeed_ets_cnt, airspeed_ets_delay_done, airspeed_ets_delay_time, airspeed_ets_downlink(), airspeed_ets_i2c_done, airspeed_ets_i2c_trans, AIRSPEED_ETS_NBSAMPLES_AVRG, airspeed_ets_offset, airspeed_ets_offset_init, AIRSPEED_ETS_OFFSET_NBSAMPLES_AVRG, AIRSPEED_ETS_OFFSET_NBSAMPLES_INIT, airspeed_ets_offset_tmp, airspeed_ets_raw, airspeed_ets_valid, DefaultPeriodic, I2CTransDone, register_periodic_telemetry(), i2c_transaction::status, and SysTimeTimerStart.
void airspeed_ets_read_event | ( | void | ) |
Definition at line 184 of file airspeed_ets.c.
References airspeed_ets, airspeed_ets_buffer, airspeed_ets_buffer_idx, airspeed_ets_cnt, airspeed_ets_i2c_trans, AIRSPEED_ETS_ID, AIRSPEED_ETS_NBSAMPLES_AVRG, AIRSPEED_ETS_OFFSET, airspeed_ets_offset, airspeed_ets_offset_init, AIRSPEED_ETS_OFFSET_MAX, AIRSPEED_ETS_OFFSET_MIN, AIRSPEED_ETS_OFFSET_NBSAMPLES_AVRG, airspeed_ets_offset_tmp, airspeed_ets_raw, AIRSPEED_ETS_SCALE, airspeed_ets_valid, i2c_transaction::buf, GpsState::course, GpsState::fix, gps, GpsState::gspeed, GpsState::hmsl, I2CTransDone, LlaCoor_i::lat, GpsState::lla_pos, LlaCoor_i::lon, GpsState::ned_vel, pprzLogFile, stateSetAirspeed_f(), i2c_transaction::status, GpsState::tow, GpsState::week, and NedCoor_i::z.
Referenced by AirspeedEtsEvent().
void airspeed_ets_read_periodic | ( | void | ) |
Definition at line 168 of file airspeed_ets.c.
References AIRSPEED_ETS_ADDR, airspeed_ets_delay_done, airspeed_ets_delay_time, AIRSPEED_ETS_I2C_DEV, airspeed_ets_i2c_trans, AIRSPEED_ETS_START_DELAY, i2c_receive(), I2CTransDone, stateSetAirspeed_f(), i2c_transaction::status, SysTimeTimer, and USEC_OF_SEC.
float airspeed_ets |
Definition at line 105 of file airspeed_ets.c.
Referenced by airspeed_ets_downlink(), airspeed_ets_init(), and airspeed_ets_read_event().
float airspeed_ets_buffer[AIRSPEED_ETS_NBSAMPLES_AVRG] |
Definition at line 107 of file airspeed_ets.c.
Referenced by airspeed_ets_init(), and airspeed_ets_read_event().
int airspeed_ets_buffer_idx |
Definition at line 106 of file airspeed_ets.c.
Referenced by airspeed_ets_init(), and airspeed_ets_read_event().
uint16_t airspeed_ets_cnt |
Definition at line 115 of file airspeed_ets.c.
Referenced by airspeed_ets_init(), and airspeed_ets_read_event().
bool airspeed_ets_delay_done |
Definition at line 117 of file airspeed_ets.c.
Referenced by airspeed_ets_init(), and airspeed_ets_read_periodic().
uint32_t airspeed_ets_delay_time |
Definition at line 116 of file airspeed_ets.c.
Referenced by airspeed_ets_init(), and airspeed_ets_read_periodic().
volatile bool airspeed_ets_i2c_done |
Definition at line 112 of file airspeed_ets.c.
Referenced by airspeed_ets_init().
struct i2c_transaction airspeed_ets_i2c_trans |
Definition at line 107 of file airspeed_ets.c.
Referenced by airspeed_ets_init(), airspeed_ets_read_event(), airspeed_ets_read_periodic(), and AirspeedEtsEvent().
uint16_t airspeed_ets_offset |
Definition at line 103 of file airspeed_ets.c.
Referenced by airspeed_ets_downlink(), airspeed_ets_init(), and airspeed_ets_read_event().
bool airspeed_ets_offset_init |
Definition at line 113 of file airspeed_ets.c.
Referenced by airspeed_ets_init(), and airspeed_ets_read_event().
uint32_t airspeed_ets_offset_tmp |
Definition at line 114 of file airspeed_ets.c.
Referenced by airspeed_ets_init(), and airspeed_ets_read_event().
uint16_t airspeed_ets_raw |
Definition at line 102 of file airspeed_ets.c.
Referenced by airspeed_ets_downlink(), airspeed_ets_init(), and airspeed_ets_read_event().
bool airspeed_ets_valid |
Definition at line 104 of file airspeed_ets.c.
Referenced by airspeed_ets_init(), and airspeed_ets_read_event().