2 ******************************************************************************
3 * @addtogroup PIOS PIOS Core hardware abstraction layer
5 * @addtogroup PIOS_BMP280 BMP280 Functions
6 * @brief Hardware functions to deal with the altitude pressure sensor
10 * @author The LibrePilot Team, http://www.librepilot.org Copyright (C) 2017.
11 * @brief BMP280 functions header.
12 * @see The GNU Public License (GPL) Version 3
14 *****************************************************************************/
16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License as published by
18 * the Free Software Foundation; either version 3 of the License, or
19 * (at your option) any later version.
21 * This program is distributed in the hope that it will be useful, but
22 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
23 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
26 * You should have received a copy of the GNU General Public License along
27 * with this program; if not, write to the Free Software Foundation, Inc.,
28 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
33 #include <pios_sensors.h>
35 #define BMP280_OVERSAMP_SKIPPED (0x00)
36 #define BMP280_OVERSAMP_1X (0x01)
37 #define BMP280_OVERSAMP_2X (0x02)
38 #define BMP280_OVERSAMP_4X (0x03)
39 #define BMP280_OVERSAMP_8X (0x04)
40 #define BMP280_OVERSAMP_16X (0x05)
42 #define BMP280_PRESSURE_OSR(x) (x << 2)
43 #define BMP280_TEMPERATURE_OSR(x) (x << 5)
45 #define BMP280_STANDARD_RESOLUTION (BMP280_PRESSURE_OSR(BMP280_OVERSAMP_4X) | BMP280_TEMPERATURE_OSR(BMP280_OVERSAMP_1X))
46 #define BMP280_HIGH_RESOLUTION (BMP280_PRESSURE_OSR(BMP280_OVERSAMP_8X) | BMP280_TEMPERATURE_OSR(BMP280_OVERSAMP_1X))
47 #define BMP280_ULTRA_HIGH_RESOLUTION (BMP280_PRESSURE_OSR(BMP280_OVERSAMP_16X) | BMP280_TEMPERATURE_OSR(BMP280_OVERSAMP_2X))
49 struct pios_bmp280_cfg
{
53 /* Public Functions */
54 extern void PIOS_BMP280_Init(const struct pios_bmp280_cfg
*cfg
, uint32_t i2c_device
);
56 #endif /* PIOS_BMP280_H */