Paparazzi UAS v7.1_unstable
Paparazzi is a free software Unmanned Aircraft System.
Loading...
Searching...
No Matches
baro_bmp3.c
Go to the documentation of this file.
1/*
2 * Copyright (C) 2019 Gautier Hattenberger <gautier.hattenberger@enac.fr>
3 *
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
28
29
30#include "baro_bmp3.h"
31
32#include "modules/core/abi.h"
33#include "mcu_periph/sys_time.h"
34
36#ifndef BMP3_SLAVE_ADDR
37#define BMP3_SLAVE_ADDR BMP3_I2C_ADDR
38#endif
39
41
43{
44 bmp3_i2c_init(&baro_bmp3, &BMP3_I2C_DEV, BMP3_SLAVE_ADDR);
45}
46
51
53{
55
56 if (baro_bmp3.data_available) {
57 uint32_t now_ts = get_sys_time_usec();
58 // send ABI message
59 AbiSendMsgBARO_ABS_RAW(BARO_BMP3_SENDER_ID, now_ts, baro_bmp3.pressure);
60 AbiSendMsgTEMPERATURE_RAW(BARO_BMP3_SENDER_ID, now_ts, baro_bmp3.temperature, TEMPERATURE_TYPE_BARO);
61 baro_bmp3.data_available = false;
62 }
63}
64
Main include for ABI (AirBorneInterface).
#define TEMPERATURE_TYPE_BARO
barometer die
Definition abi_common.h:91
#define BARO_BMP3_SENDER_ID
void baro_bmp3_periodic(void)
Definition baro_bmp3.c:47
void baro_bmp3_init(void)
Definition baro_bmp3.c:42
#define BMP3_SLAVE_ADDR
default slave address
Definition baro_bmp3.c:37
void baro_bmp3_event(void)
Definition baro_bmp3.c:52
struct Bmp3_I2c baro_bmp3
Definition baro_bmp3.c:40
Bosch BMP3 I2C sensor interface.
void bmp3_i2c_event(struct Bmp3_I2c *bmp)
Definition bmp3_i2c.c:125
void bmp3_i2c_periodic(struct Bmp3_I2c *bmp)
Start new measurement if sensor ready.
Definition bmp3_i2c.c:78
void bmp3_i2c_init(struct Bmp3_I2c *bmp, struct i2c_periph *i2c_p, uint8_t addr)
init function
Definition bmp3_i2c.c:60
uint32_t get_sys_time_usec(void)
Get the time in microseconds since startup.
Architecture independent timing functions.
unsigned int uint32_t
Typedef defining 32 bit unsigned int type.