Blackbox device type 'file' (SITL) considered working when file handler is available
[inav.git] / src / main / drivers / barometer / barometer_bmp280.h
blobee8ecd3d4fc055ada4ea050d9da66742c58a0287
1 /*
2 * This file is part of Cleanflight.
4 * Cleanflight is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * Cleanflight is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with Cleanflight. If not, see <http://www.gnu.org/licenses/>.
18 #pragma once
20 #define BMP280_DEFAULT_CHIP_ID (0x58)
21 #define BME280_DEFAULT_CHIP_ID (0x60)
23 #define BMP280_CHIP_ID_REG (0xD0) /* Chip ID Register */
24 #define BMP280_RST_REG (0xE0) /* Softreset Register */
25 #define BMP280_STAT_REG (0xF3) /* Status Register */
26 #define BMP280_CTRL_MEAS_REG (0xF4) /* Ctrl Measure Register */
27 #define BMP280_CONFIG_REG (0xF5) /* Configuration Register */
28 #define BMP280_PRESSURE_MSB_REG (0xF7) /* Pressure MSB Register */
29 #define BMP280_PRESSURE_LSB_REG (0xF8) /* Pressure LSB Register */
30 #define BMP280_PRESSURE_XLSB_REG (0xF9) /* Pressure XLSB Register */
31 #define BMP280_TEMPERATURE_MSB_REG (0xFA) /* Temperature MSB Reg */
32 #define BMP280_TEMPERATURE_LSB_REG (0xFB) /* Temperature LSB Reg */
33 #define BMP280_TEMPERATURE_XLSB_REG (0xFC) /* Temperature XLSB Reg */
34 #define BMP280_FORCED_MODE (0x01)
36 #define BMP280_TEMPERATURE_CALIB_DIG_T1_LSB_REG (0x88)
37 #define BMP280_PRESSURE_TEMPERATURE_CALIB_DATA_LENGTH (24)
38 #define BMP280_DATA_FRAME_SIZE (6)
40 #define BMP280_OVERSAMP_SKIPPED (0x00)
41 #define BMP280_OVERSAMP_1X (0x01)
42 #define BMP280_OVERSAMP_2X (0x02)
43 #define BMP280_OVERSAMP_4X (0x03)
44 #define BMP280_OVERSAMP_8X (0x04)
45 #define BMP280_OVERSAMP_16X (0x05)
47 #define BMP280_FILTER_COEFF_OFF (0x00)
48 #define BMP280_FILTER_COEFF_2 (0x01)
49 #define BMP280_FILTER_COEFF_4 (0x02)
50 #define BMP280_FILTER_COEFF_8 (0x03)
51 #define BMP280_FILTER_COEFF_16 (0x04)
54 // configure pressure and temperature oversampling, forced sampling mode
55 #define BMP280_PRESSURE_OSR (BMP280_OVERSAMP_8X)
56 #define BMP280_TEMPERATURE_OSR (BMP280_OVERSAMP_1X)
57 #define BMP280_MODE (BMP280_PRESSURE_OSR << 2 | BMP280_TEMPERATURE_OSR << 5 | BMP280_FORCED_MODE)
59 //configure IIR pressure filter
60 #define BMP280_FILTER (BMP280_FILTER_COEFF_8 << 2)
62 #define T_INIT_MAX (20)
63 // 20/16 = 1.25 ms
64 #define T_MEASURE_PER_OSRS_MAX (37)
65 // 37/16 = 2.3125 ms
66 #define T_SETUP_PRESSURE_MAX (10)
67 // 10/16 = 0.625 ms
69 bool bmp280Detect(baroDev_t *baro);