Paparazzi UAS
v5.12_stable-4-g9b43e9b
Paparazzi is a free software Unmanned Aircraft System.
|
Driver for the EagleTree Systems Altitude Sensor. More...
#include "sensors/baro_ets.h"
#include "mcu_periph/i2c.h"
#include "state.h"
#include "subsystems/abi.h"
#include <math.h>
#include "mcu_periph/sys_time.h"
#include "firmwares/fixedwing/nav.h"
Go to the source code of this file.
Macros | |
#define | BARO_ETS_ADDR 0xE8 |
#define | BARO_ETS_REG 0x07 |
#define | BARO_ETS_OFFSET_MAX 30000 |
#define | BARO_ETS_OFFSET_MIN 10 |
#define | BARO_ETS_OFFSET_NBSAMPLES_INIT 20 |
#define | BARO_ETS_OFFSET_NBSAMPLES_AVRG 40 |
#define | BARO_ETS_R 0.5 |
#define | BARO_ETS_SIGMA2 0.1 |
#define | BARO_ETS_SCALE 37.5 |
scale factor to convert raw ADC measurement to pressure in Pascal. More... | |
#define | BARO_ETS_ALT_SCALE 0.32 |
scale factor to convert raw ADC measurement to altitude change in meters More... | |
#define | BARO_ETS_PRESSURE_OFFSET 101325.0 |
Pressure offset in Pascal when converting raw adc to real pressure (. More... | |
#define | BARO_ETS_I2C_DEV i2c0 |
#define | BARO_ETS_START_DELAY 0.2 |
delay in seconds until sensor is read after startup More... | |
Functions | |
void | baro_ets_init (void) |
void | baro_ets_read_periodic (void) |
void | baro_ets_read_event (void) |
Variables | |
uint16_t | baro_ets_adc |
uint16_t | baro_ets_offset |
bool | baro_ets_valid |
float | baro_ets_altitude |
bool | baro_ets_enabled |
float | baro_ets_r |
float | baro_ets_sigma2 |
struct i2c_transaction | baro_ets_i2c_trans |
bool | baro_ets_offset_init |
uint32_t | baro_ets_offset_tmp |
uint16_t | baro_ets_cnt |
uint32_t | baro_ets_delay_time |
bool | baro_ets_delay_done |
Driver for the EagleTree Systems Altitude 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. Pitch gains may need to be updated.
Sensor module wire assignments: Red wire: 5V White wire: Ground Yellow wire: SDA Brown wire: SCL
Definition in file baro_ets.c.
#define BARO_ETS_ADDR 0xE8 |
Definition at line 58 of file baro_ets.c.
Referenced by baro_ets_read_periodic().
#define BARO_ETS_ALT_SCALE 0.32 |
scale factor to convert raw ADC measurement to altitude change in meters
Definition at line 80 of file baro_ets.c.
Referenced by baro_ets_read_event().
#define BARO_ETS_I2C_DEV i2c0 |
Definition at line 89 of file baro_ets.c.
Referenced by baro_ets_read_periodic().
#define BARO_ETS_OFFSET_MAX 30000 |
Definition at line 60 of file baro_ets.c.
Referenced by baro_ets_read_event().
#define BARO_ETS_OFFSET_MIN 10 |
Definition at line 61 of file baro_ets.c.
Referenced by baro_ets_read_event().
#define BARO_ETS_OFFSET_NBSAMPLES_AVRG 40 |
Definition at line 63 of file baro_ets.c.
Referenced by baro_ets_init(), and baro_ets_read_event().
#define BARO_ETS_OFFSET_NBSAMPLES_INIT 20 |
Definition at line 62 of file baro_ets.c.
Referenced by baro_ets_init().
#define BARO_ETS_PRESSURE_OFFSET 101325.0 |
Pressure offset in Pascal when converting raw adc to real pressure (.
Definition at line 85 of file baro_ets.c.
Referenced by baro_ets_read_event().
#define BARO_ETS_R 0.5 |
Definition at line 64 of file baro_ets.c.
Referenced by baro_ets_init().
#define BARO_ETS_REG 0x07 |
Definition at line 59 of file baro_ets.c.
#define BARO_ETS_SCALE 37.5 |
scale factor to convert raw ADC measurement to pressure in Pascal.
Definition at line 75 of file baro_ets.c.
Referenced by baro_ets_read_event().
#define BARO_ETS_SIGMA2 0.1 |
Definition at line 65 of file baro_ets.c.
Referenced by baro_ets_init().
#define BARO_ETS_START_DELAY 0.2 |
delay in seconds until sensor is read after startup
Definition at line 98 of file baro_ets.c.
Referenced by baro_ets_read_periodic().
void baro_ets_init | ( | void | ) |
Definition at line 120 of file baro_ets.c.
References BARO_ETS_OFFSET_NBSAMPLES_AVRG, BARO_ETS_OFFSET_NBSAMPLES_INIT, BARO_ETS_R, BARO_ETS_SIGMA2, I2CTransDone, i2c_transaction::status, and SysTimeTimerStart.
void baro_ets_read_event | ( | void | ) |
Definition at line 151 of file baro_ets.c.
References baro_ets_adc, BARO_ETS_ALT_SCALE, baro_ets_altitude, baro_ets_cnt, baro_ets_i2c_trans, baro_ets_offset, baro_ets_offset_init, BARO_ETS_OFFSET_MAX, BARO_ETS_OFFSET_MIN, BARO_ETS_OFFSET_NBSAMPLES_AVRG, baro_ets_offset_tmp, BARO_ETS_PRESSURE_OFFSET, BARO_ETS_SCALE, BARO_ETS_SENDER_ID, baro_ets_valid, i2c_transaction::buf, DefaultChannel, DefaultDevice, ground_alt, I2CTransDone, Bmp085::pressure, and i2c_transaction::status.
void baro_ets_read_periodic | ( | void | ) |
Definition at line 139 of file baro_ets.c.
References BARO_ETS_ADDR, baro_ets_delay_done, baro_ets_delay_time, BARO_ETS_I2C_DEV, baro_ets_i2c_trans, BARO_ETS_START_DELAY, i2c_receive(), I2CTransDone, i2c_transaction::status, SysTimeTimer, and USEC_OF_SEC.
uint16_t baro_ets_adc |
Definition at line 103 of file baro_ets.c.
Referenced by baro_ets_read_event().
float baro_ets_altitude |
Definition at line 106 of file baro_ets.c.
Referenced by alt_filter_periodic(), and baro_ets_read_event().
uint16_t baro_ets_cnt |
Definition at line 116 of file baro_ets.c.
Referenced by baro_ets_read_event().
bool baro_ets_delay_done |
Definition at line 118 of file baro_ets.c.
Referenced by baro_ets_read_periodic().
uint32_t baro_ets_delay_time |
Definition at line 117 of file baro_ets.c.
Referenced by baro_ets_read_periodic().
bool baro_ets_enabled |
Definition at line 107 of file baro_ets.c.
Referenced by alt_kalman().
struct i2c_transaction baro_ets_i2c_trans |
Definition at line 111 of file baro_ets.c.
Referenced by baro_ets_read_event(), and baro_ets_read_periodic().
uint16_t baro_ets_offset |
Definition at line 104 of file baro_ets.c.
Referenced by baro_ets_read_event().
bool baro_ets_offset_init |
Definition at line 114 of file baro_ets.c.
Referenced by baro_ets_read_event().
uint32_t baro_ets_offset_tmp |
Definition at line 115 of file baro_ets.c.
Referenced by baro_ets_read_event().
float baro_ets_r |
Definition at line 108 of file baro_ets.c.
Referenced by alt_kalman().
float baro_ets_sigma2 |
Definition at line 109 of file baro_ets.c.
Referenced by alt_kalman().
bool baro_ets_valid |
Definition at line 105 of file baro_ets.c.
Referenced by baro_ets_read_event().