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
bmp280_regs.h
Go to the documentation of this file.
1/*
2 * Chris Efstathiou hendrixgr@gmail.com
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
31#ifndef BMP280_REGS_H
32#define BMP280_REGS_H
33
34#include "std.h"
35
36#define BMP280_READ_FLAG 0x80
37
38// I2C addresses (8 bits)
39#define BMP280_I2C_ADDR 0xEC
40#define BMP280_I2C_ADDR_ALT 0xEE
41
42
43// CALIBRATION REGISTER ADDRESSES
44#define BMP280_CALIB_LSB_DATA_ADDR 0x88
45#define BMP280_CALIB_DATA_LEN 24
46
47#define BMP280_DIG_T1_UINT 0x88
48#define BMP280_DIG_T2_INT 0x8A
49#define BMP280_DIG_T3_INT 0x8C
50#define BMP280_DIG_P1_UINT 0x8E
51#define BMP280_DIG_P2_INT 0x90
52#define BMP280_DIG_P3_INT 0x92
53#define BMP280_DIG_P4_INT 0x94
54#define BMP280_DIG_P5_INT 0x96
55#define BMP280_DIG_P6_INT 0x98
56#define BMP280_DIG_P7_INT 0x9A
57#define BMP280_DIG_P8_INT 0x9C
58#define BMP280_DIG_P9_INT 0x9E
59
60// CONTROL AND VALUES REGISTER ADDRESSES
61#define BMP280_CONFIG_ADDR 0xF4
62#define BMP280_CONFIG_LEN 0x02
63#define BMP280_DATA_START_REG_ADDR 0xF7
64#define BMP280_P_T_DATA_LEN 6
65#define BMP280_P_DATA_LEN 3
66#define BMP280_T_DATA_LEN 3
67
68#define BMP280_CHIP_ID_REG_ADDR 0xD0
69#define BMP280_RESET_REG_ADDR 0xF3
70#define BMP280_STATUS_REG_ADDR 0xF3
71#define BMP280_CTRL_MEAS_REG_ADDR 0xF4
72#define BMP280_CONFIG_REG_ADDR 0xF5
73#define BMP280_P_MSB_REG_ADDR 0xF7
74#define BMP280_P_LSB_REG_ADDR 0xF8
75#define BMP280_P_XLSB_REG_ADDR 0xF9
76#define BMP280_T_MSB_REG_ADDR 0xFA
77#define BMP280_T_LSB_REG_ADDR 0xFB
78#define BMP280_T_XLSB_REG_ADDR 0xFC
79
80
81// BMP280 ID
82#define BMP280_ID_NB 0x58
83//BMP280 RESET COMMAND VALUE
84#define BMP280_RESET_VAL 0xB6
85
86#define BMP280_EOC_BIT (1<<3)
87#define BMP280_NVRAM_COPY_BIT (1<<0)
88
89// BMP280 CONTROL MEASUREMENT REGISTER BIT VALUES.
90#define BMP280_NO_OVERSAMPLING_T (0x00<<5)
91#define BMP280_OVERSAMPLING_1X_T (0x01<<5)
92#define BMP280_OVERSAMPLING_2X_T (0x02<<5)
93#define BMP280_OVERSAMPLING_4X_T (0x03<<5)
94#define BMP280_OVERSAMPLING_8X_T (0x04<<5)
95#define BMP280_OVERSAMPLING_16X_T (0x05<<5)
96
97#define BMP280_NO_OVERSAMPLING_P (0x00<<2)
98#define BMP280_OVERSAMPLING_1X_P (0x01<<2)
99#define BMP280_OVERSAMPLING_2X_P (0x02<<2)
100#define BMP280_OVERSAMPLING_4X_P (0x03<<2)
101#define BMP280_OVERSAMPLING_8X_P (0x04<<2)
102#define BMP280_OVERSAMPLING_16X_P (0x05<<2)
103
104#define BMP280_POWER_SLEEP_MODE (0x00)
105#define BMP280_POWER_FORCED_MODE (0x01) // OX02 IS EXACTLY THE SAME
106#define BMP280_POWER_NORMAL_MODE (0x03)
107
108// BMP280 CONFIG REGISTER BIT VALUES
109#define BMP280_INACTIVITY_HALF_MS (0x00<<5)
110#define BMP280_INACTIVITY_62_5_MS (0x01<<5)
111#define BMP280_INACTIVITY_125_MS (0x02<<5)
112#define BMP280_INACTIVITY_250_MS (0x03<<5)
113#define BMP280_INACTIVITY_500_MS (0x04<<5)
114#define BMP280_INACTIVITY_1000_MS (0x05<<5)
115#define BMP280_INACTIVITY_2000_MS (0x06<<5)
116#define BMP280_INACTIVITY_4000_MS (0x07<<5)
117
118#define BMP280_IIR_FILTER_COEFF_1 (0x00<<2)
119#define BMP280_IIR_FILTER_COEFF_2 (0x01<<2)
120#define BMP280_IIR_FILTER_COEFF_4 (0x02<<2)
121#define BMP280_IIR_FILTER_COEFF_8 (0x03<<2)
122#define BMP280_IIR_FILTER_COEFF_16 (0x04<<2)
123
124#define BMP280_DISABLE_SPI_IF (0x00) // DEFAULT
125#define BMP280_ENABLE_SPI_IF (0x01)
126
127
129#define BMP280_SLEEP_MODE 0x00
130#define BMP280_FORCED_MODE 0x01
131#define BMP280_NORMAL_MODE 0x03
132
133
135#define BMP280_PRESS 0x01
136#define BMP280_TEMP 0x02
137#define BMP280_ALL 0x03
138
140#define BMP280_CONCAT_BYTES(msb, lsb) (((uint16_t)msb << 8) | (uint16_t)lsb)
141
142#ifndef BMP280_COMPENSATION
143#define BMP280_COMPENSATION BMP280_DOUBLE_PRECISION_COMPENSATION
144#endif
145
146
147
148#endif /* BMP280_REGS_H */