Paparazzi UAS v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
baro_bmp280.c
Go to the documentation of this file.
1/*
2 * Chris Efstathiou hendrixgr@gmail.com
3 * Florian Sansou florian.sansou@enac.fr
4 * This file is part of paparazzi.
5 *
6 * paparazzi is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2, or (at your option)
9 * any later version.
10 *
11 * paparazzi is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with paparazzi; see the file COPYING. If not, see
18 * <http://www.gnu.org/licenses/>.
19 *
20 */
21
30#include "baro_bmp280.h"
31
32#include "modules/core/abi.h"
33#include "mcu_periph/uart.h"
34#include "pprzlink/messages.h"
36#include "math/pprz_isa.h"
37
38#if DOWNLINK && !defined(BMP280_SYNC_SEND)
40#endif
42
43#ifndef BMP280_USE_SPI
44#define BMP280_USE_SPI FALSE
45#endif
50#ifndef BMP280_SLAVE_ADDR
51#define BMP280_SLAVE_ADDR BMP280_I2C_ADDR
52#endif
53
54#ifndef BMP280_SLAVE_IDX
55#define BMP280_SLAVE_IDX SPI_SLAVE0
56#endif
57
58
59float baro_alt = 0;
60float baro_temp = 0;
61float baro_press = 0;
63
64
66
67#if DOWNLINK && !defined(BMP280_SYNC_SEND)
78#endif
79
80
82{
83 #if BMP280_USE_SPI
85 baro_bmp280.spi.p = &BMP280_DEV;
86 baro_bmp280.spi.slave_idx = BMP280_SLAVE_IDX;
87 #else
89 baro_bmp280.i2c.p = &BMP280_DEV;
90 baro_bmp280.i2c.slave_addr = BMP280_SLAVE_ADDR;
91 #endif
93#if DOWNLINK && !defined(BMP280_SYNC_SEND)
95#endif
96}
97
102
Main include for ABI (AirBorneInterface).
#define BARO_BMP_SENDER_ID
#define BMP280_SLAVE_ADDR
default slave address
Definition baro_bmp280.c:51
#define BMP280_USE_SPI
Definition baro_bmp280.c:44
float baro_press
Definition baro_bmp280.c:61
void baro_bmp280_periodic(void)
Definition baro_bmp280.c:98
bool baro_alt_valid
Definition baro_bmp280.c:62
void baro_bmp280_init(void)
Definition baro_bmp280.c:81
float baro_alt
Definition baro_bmp280.c:59
static void send_baro_bmp_data(struct transport_tx *trans, struct link_device *dev)
Definition baro_bmp280.c:68
float baro_temp
Definition baro_bmp280.c:60
#define BMP280_SLAVE_IDX
Definition baro_bmp280.c:55
void baro_bmp280_event(void)
struct bmp280_t baro_bmp280
Definition baro_bmp280.c:65
Bosch BMP280 sensor interface.
void bmp280_periodic(struct bmp280_t *bmp)
Should be called periodically to request sensor readings.
Definition bmp280.c:101
void bmp280_init(struct bmp280_t *bmp)
Initialize the bmp280 sensor instance.
Definition bmp280.c:48
void bmp280_event(struct bmp280_t *bmp)
Should be called in the event thread.
Definition bmp280.c:157
volatile bool data_available
data ready flag
Definition bmp280.h:94
float temperature
temperature in deg Celcius
Definition bmp280.h:99
uint32_t raw_temperature
uncompensated temperature
Definition bmp280.h:97
@ BMP280_I2C
Definition bmp280.h:54
@ BMP280_SPI
Definition bmp280.h:53
enum bmp280_bus_t bus
The communication bus used to connect the device SPI/I2C.
Definition bmp280.h:100
float pressure
pressure in Pascal
Definition bmp280.h:98
uint32_t raw_pressure
uncompensated pressure
Definition bmp280.h:96
uint32_t get_sys_time_usec(void)
Get the time in microseconds since startup.
static float pprz_isa_altitude_of_pressure(float pressure)
Get absolute altitude from pressure (using simplified equation).
Definition pprz_isa.h:82
static float p[2][2]
uint16_t up[LIGHT_NB]
Definition light_solar.c:48
uint16_t foo
Definition main_demo5.c:58
PRINT_CONFIG_VAR(ONELOOP_ANDI_FILT_CUTOFF)
Paparazzi atmospheric pressure conversion utilities.
static const struct usb_device_descriptor dev
Definition usb_ser_hw.c:74
int8_t register_periodic_telemetry(struct periodic_telemetry *_pt, uint8_t _id, telemetry_cb _cb)
Register a telemetry callback function.
Definition telemetry.c:51
Periodic telemetry system header (includes downlink utility and generated code).
#define DefaultPeriodic
Set default periodic telemetry.
Definition telemetry.h:66
arch independent UART (Universal Asynchronous Receiver/Transmitter) API
int int32_t
Typedef defining 32 bit int type.
unsigned int uint32_t
Typedef defining 32 bit unsigned int type.