|
Paparazzi UAS v7.1_unstable
Paparazzi is a free software Unmanned Aircraft System.
|
Airspeed sensor module using the MS45xxDO digital pressure sensor via I2C. More...
#include "std.h"#include "mcu_periph/i2c.h"#include "modules/sensors/airspeed_ms45xx_i2c.h"#include "modules/core/abi.h"#include "mcu_periph/sys_time.h"#include "mcu_periph/uart.h"#include "pprzlink/messages.h"#include "modules/datalink/downlink.h"Go to the source code of this file.
Macros | |
| #define | MS45XX_I2C_DEV i2c2 |
| Default I2C device. | |
| #define | MS45XX_I2C_ADDR 0x50 |
| Sensor I2C slave address (existing defaults 0x50, 0x6C and 0x8C). | |
| #define | MS45XX_PRESSURE_OUTPUT_TYPE_InH2O 0 |
| MS45xx sensors pressure output type can be in PSI or InH2O, as defined in the datasheet if not defined to be MS45XX_PRESSURE_OUTPUT_TYPE_InH2O then PSI is used. | |
| #define | MS45XX_PRESSURE_RANGE 1 |
| MS45xx pressure range in PSI or InH2O The sensor is available in many ranges, the datasheet of your pressure sensor will tell which one and what this range represents. | |
| #define | MS45XX_PRESSURE_TYPE 0 |
| Pressure Type 0 = Differential, 1 = Gauge note there are theoretical more types than 2, e.g. | |
| #define | MS45XX_OUTPUT_TYPE 0 |
| MS45xx output Type. | |
| #define | InH2O_TO_PA 249.08891 |
| Conversion factor from InH2O to Pa. | |
| #define | PSI_TO_PA 6894.75729 |
| Conversion factor from psi to Pa. | |
| #define | OutputPressureToPa PSI_TO_PA |
| #define | MS45XX_PRESSURE_SCALE (2 * MS45XX_PRESSURE_RANGE / (0.8 * 16383) * OutputPressureToPa) |
| #define | MS45XX_PRESSURE_OFFSET (16383 / 2) |
| #define | MS45XX_RHO_DIV_2 1.6327 |
| Quadratic scale factor for indicated airspeed. | |
Functions | |
| void | ms45xx_i2c_init (void) |
| void | ms45xx_i2c_periodic (void) |
| void | ms45xx_i2c_event (void) |
Variables | |
| struct AirspeedMs45xx | ms45xx |
| static struct i2c_transaction | ms45xx_trans |
Airspeed sensor module using the MS45xxDO digital pressure sensor via I2C.
Needs to be one of the versions with 14bit pressure and 11bit temperature.
Definition in file airspeed_ms45xx_i2c.c.
| #define InH2O_TO_PA 249.08891 |
Conversion factor from InH2O to Pa.
Definition at line 81 of file airspeed_ms45xx_i2c.c.
| #define MS45XX_I2C_ADDR 0x50 |
Sensor I2C slave address (existing defaults 0x50, 0x6C and 0x8C).
Definition at line 48 of file airspeed_ms45xx_i2c.c.
Referenced by ms45xx_i2c_periodic().
| #define MS45XX_I2C_DEV i2c2 |
Default I2C device.
Definition at line 42 of file airspeed_ms45xx_i2c.c.
| #define MS45XX_OUTPUT_TYPE 0 |
MS45xx output Type.
0 = Output Type A with 10% to 90% 1 = Output Type B with 5% to 95%
Definition at line 77 of file airspeed_ms45xx_i2c.c.
| #define MS45XX_PRESSURE_OFFSET (16383 / 2) |
Definition at line 107 of file airspeed_ms45xx_i2c.c.
Referenced by ms45xx_i2c_init().
| #define MS45XX_PRESSURE_OUTPUT_TYPE_InH2O 0 |
MS45xx sensors pressure output type can be in PSI or InH2O, as defined in the datasheet if not defined to be MS45XX_PRESSURE_OUTPUT_TYPE_InH2O then PSI is used.
Definition at line 55 of file airspeed_ms45xx_i2c.c.
| #define MS45XX_PRESSURE_RANGE 1 |
MS45xx pressure range in PSI or InH2O The sensor is available in many ranges, the datasheet of your pressure sensor will tell which one and what this range represents.
Definition at line 63 of file airspeed_ms45xx_i2c.c.
| #define MS45XX_PRESSURE_SCALE (2 * MS45XX_PRESSURE_RANGE / (0.8 * 16383) * OutputPressureToPa) |
Definition at line 104 of file airspeed_ms45xx_i2c.c.
Referenced by ms45xx_i2c_init().
| #define MS45XX_PRESSURE_TYPE 0 |
Pressure Type 0 = Differential, 1 = Gauge note there are theoretical more types than 2, e.g.
Absolute not implemented
Definition at line 69 of file airspeed_ms45xx_i2c.c.
| #define MS45XX_RHO_DIV_2 1.6327 |
Quadratic scale factor for indicated airspeed.
airspeed = sqrt(2*p_diff/density) With p_diff in Pa and standard air density of 1.225 kg/m^3, default airspeed scale is 2/1.225
Definition at line 137 of file airspeed_ms45xx_i2c.c.
Referenced by ms45xx_i2c_event().
| #define OutputPressureToPa PSI_TO_PA |
Definition at line 89 of file airspeed_ms45xx_i2c.c.
| #define PSI_TO_PA 6894.75729 |
Conversion factor from psi to Pa.
Definition at line 84 of file airspeed_ms45xx_i2c.c.
| void ms45xx_i2c_event | ( | void | ) |
Definition at line 165 of file airspeed_ms45xx_i2c.c.
References get_sys_time_usec(), I2CTransDone, I2CTransFailed, I2CTransSuccess, ms45xx, MS45XX_RHO_DIV_2, MS45XX_SENDER_ID, ms45xx_trans, sign(), status, and TEMPERATURE_TYPE_DIFF.
| void ms45xx_i2c_init | ( | void | ) |
Definition at line 143 of file airspeed_ms45xx_i2c.c.
References I2CTransDone, ms45xx, MS45XX_PRESSURE_OFFSET, MS45XX_PRESSURE_SCALE, MS45XX_PRESSURE_TYPE, and ms45xx_trans.
| void ms45xx_i2c_periodic | ( | void | ) |
Definition at line 157 of file airspeed_ms45xx_i2c.c.
References i2c_receive(), I2CTransDone, MS45XX_I2C_ADDR, MS45XX_I2C_DEV, and ms45xx_trans.
| struct AirspeedMs45xx ms45xx |
Definition at line 140 of file airspeed_ms45xx_i2c.c.
Referenced by ms45xx_i2c_event(), and ms45xx_i2c_init().
|
static |
Definition at line 141 of file airspeed_ms45xx_i2c.c.
Referenced by ms45xx_i2c_event(), ms45xx_i2c_init(), and ms45xx_i2c_periodic().