|
Paparazzi UAS v7.1_unstable
Paparazzi is a free software Unmanned Aircraft System.
|
Module glue for the Goertek SPA06-003 / SPL06-001 barometer. More...
#include "baro_spa06.h"#include "modules/core/abi.h"#include "math/pprz_isa.h"#include "modules/datalink/telemetry.h"
Include dependency graph for baro_spa06.c:Go to the source code of this file.
Macros | |
| #define | SPA06_USE_SPI FALSE |
| #define | SPA06_SLAVE_ADDR SPA06_I2C_ADDR |
| Default I2C slave address (SDO low); override with SPA06_I2C_ADDR_ALT for SDO high. | |
| #define | SPA06_SLAVE_IDX SPI_SLAVE0 |
| Default SPI slave select index, only used when SPA06_USE_SPI is TRUE. | |
Functions | |
| static void | send_baro_spa_data (struct transport_tx *trans, struct link_device *dev) |
| Periodic telemetry: report the latest barometer data. | |
| void | baro_spa06_init (void) |
| Bind the driver to the configured bus and register telemetry. | |
| void | baro_spa06_periodic (void) |
| Drive the sensor state machine (module periodic hook, 25Hz) | |
| void | baro_spa06_event (void) |
| Process finished bus transactions and publish new measurements. | |
Variables | |
| float | baro_spa06_alt = 0 |
| ISA pressure altitude of the last sample [m]. | |
| bool | baro_spa06_alt_valid = false |
| true once the first valid sample has been processed | |
| static float | baro_spa06_temp = 0 |
| last sensor temperature [deg Celcius] | |
| static float | baro_spa06_press = 0 |
| last compensated pressure [Pa] | |
| struct spa06_t | baro_spa06 |
| The barometer driver instance. | |
Module glue for the Goertek SPA06-003 / SPL06-001 barometer.
Wires the spa06 peripheral driver (see peripherals/spa06.c) into the module system: init/periodic/event hooks, and publishes each accepted measurement as ABI BARO_ABS + TEMPERATURE messages (BARO_SPA_SENDER_ID). Optionally reports over telemetry via the BMP_STATUS message, either periodically (default) or per sample (SPA06_SYNC_SEND, debugging only).
Definition in file baro_spa06.c.
| #define SPA06_SLAVE_ADDR SPA06_I2C_ADDR |
Default I2C slave address (SDO low); override with SPA06_I2C_ADDR_ALT for SDO high.
Definition at line 57 of file baro_spa06.c.
| #define SPA06_SLAVE_IDX SPI_SLAVE0 |
Default SPI slave select index, only used when SPA06_USE_SPI is TRUE.
Definition at line 62 of file baro_spa06.c.
Definition at line 50 of file baro_spa06.c.
Process finished bus transactions and publish new measurements.
Process finished bus transactions and publish new measurements (module event hook)
When the driver flags a valid sample: sends ABI BARO_ABS [Pa] and TEMPERATURE [deg Celcius], updates the baro_* globals (including the ISA pressure altitude) and clears data_available for the next sample.
Definition at line 127 of file baro_spa06.c.
References baro_spa06, baro_spa06_alt, baro_spa06_alt_valid, baro_spa06_press, baro_spa06_temp, BARO_SPA_SENDER_ID, spa06_t::data_available, DefaultChannel, DefaultDevice, foo, get_sys_time_usec(), p, pprz_isa_altitude_of_pressure(), spa06_t::pressure, spa06_t::raw_pressure, spa06_t::raw_temperature, spa06_event(), spa06_t::temperature, and up.
Here is the call graph for this function:Bind the driver to the configured bus and register telemetry.
Bind the driver to the configured bus and register telemetry (module init hook)
Bus selection is compile time: SPA06_USE_SPI picks SPI (SPA06_DEV + SPA06_SLAVE_IDX) or I2C (SPA06_DEV + SPA06_SLAVE_ADDR). The sensor itself is detected and configured asynchronously by the periodic/event pair.
Definition at line 97 of file baro_spa06.c.
References baro_spa06, spa06_t::bus, DefaultPeriodic, foo, register_periodic_telemetry(), send_baro_spa_data(), SPA06_I2C, spa06_init(), SPA06_SLAVE_ADDR, SPA06_SLAVE_IDX, and SPA06_SPI.
Here is the call graph for this function:Drive the sensor state machine (module periodic hook, 25Hz)
Drive the sensor state machine (module periodic hook)
Definition at line 115 of file baro_spa06.c.
References baro_spa06, and spa06_periodic().
Here is the call graph for this function:
|
static |
Periodic telemetry: report the latest barometer data.
Re-uses the BMP_STATUS message since it has fitting fields: raw pressure, raw temperature, pressure [Pa] and temperature [0.1 deg Celcius].
Definition at line 80 of file baro_spa06.c.
References baro_spa06, baro_spa06_press, baro_spa06_temp, dev, foo, spa06_t::raw_pressure, spa06_t::raw_temperature, and up.
Referenced by baro_spa06_init().
Here is the caller graph for this function:| struct spa06_t baro_spa06 |
The barometer driver instance.
The barometer driver instance, exposed for debugging/telemetry.
Definition at line 71 of file baro_spa06.c.
Referenced by baro_spa06_event(), baro_spa06_init(), baro_spa06_periodic(), and send_baro_spa_data().
| float baro_spa06_alt = 0 |
ISA pressure altitude of the last sample [m].
Definition at line 65 of file baro_spa06.c.
Referenced by baro_spa06_event().
true once the first valid sample has been processed
Definition at line 66 of file baro_spa06.c.
Referenced by baro_spa06_event().
|
static |
last compensated pressure [Pa]
Definition at line 68 of file baro_spa06.c.
Referenced by baro_spa06_event(), and send_baro_spa_data().
|
static |
last sensor temperature [deg Celcius]
Definition at line 67 of file baro_spa06.c.
Referenced by baro_spa06_event(), and send_baro_spa_data().