Paparazzi UAS
v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
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
// I2C addresses (8 bits)
37
#define BMP280_I2C_ADDR 0xEC
38
#define BMP280_I2C_ADDR_ALT 0xEE
39
41
#define BMP280_CHIP_ID 0x50
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
// BMP280 ID
81
#define BMP280_ID_NB 0x58
82
//BMP280 RESET COMMAND VALUE
83
#define BMP280_RESET_VAL 0xB6
84
85
#define BMP280_EOC_BIT (1<<3)
86
#define BMP280_NVRAM_COPY_BIT (1<<0)
87
88
// BMP280 CONTROL MEASUREMENT REGISTER BIT VALUES.
89
#define BMP280_NO_OVERSAMPLING_T (0x00<<5)
90
#define BMP280_OVERSAMPLING_1X_T (0x01<<5)
91
#define BMP280_OVERSAMPLING_2X_T (0x02<<5)
92
#define BMP280_OVERSAMPLING_4X_T (0x03<<5)
93
#define BMP280_OVERSAMPLING_8X_T (0x04<<5)
94
#define BMP280_OVERSAMPLING_16X_T (0x05<<5)
95
96
#define BMP280_NO_OVERSAMPLING_P (0x00<<2)
97
#define BMP280_OVERSAMPLING_1X_P (0x01<<2)
98
#define BMP280_OVERSAMPLING_2X_P (0x02<<2)
99
#define BMP280_OVERSAMPLING_4X_P (0x03<<2)
100
#define BMP280_OVERSAMPLING_8X_P (0x04<<2)
101
#define BMP280_OVERSAMPLING_16X_P (0x05<<2)
102
103
#define BMP280_POWER_SLEEP_MODE (0x00)
104
#define BMP280_POWER_FORCED_MODE (0x01) // OX02 IS EXACTLY THE SAME
105
#define BMP280_POWER_NORMAL_MODE (0x03)
106
107
// BMP280 CONFIG REGISTER BIT VALUES
108
#define BMP280_INACTIVITY_HALF_MS (0x00<<5)
109
#define BMP280_INACTIVITY_62_5_MS (0x01<<5)
110
#define BMP280_INACTIVITY_125_MS (0x02<<5)
111
#define BMP280_INACTIVITY_250_MS (0x03<<5)
112
#define BMP280_INACTIVITY_500_MS (0x04<<5)
113
#define BMP280_INACTIVITY_1000_MS (0x05<<5)
114
#define BMP280_INACTIVITY_2000_MS (0x06<<5)
115
#define BMP280_INACTIVITY_4000_MS (0x07<<5)
116
117
#define BMP280_IIR_FILTER_COEFF_1 (0x00<<2)
118
#define BMP280_IIR_FILTER_COEFF_2 (0x01<<2)
119
#define BMP280_IIR_FILTER_COEFF_4 (0x02<<2)
120
#define BMP280_IIR_FILTER_COEFF_8 (0x03<<2)
121
#define BMP280_IIR_FILTER_COEFF_16 (0x04<<2)
122
123
#define BMP280_DISABLE_SPI_IF (0x00) // DEFAULT
124
#define BMP280_ENABLE_SPI_IF (0x01)
125
126
128
#define BMP280_SLEEP_MODE 0x00
129
#define BMP280_FORCED_MODE 0x01
130
#define BMP280_NORMAL_MODE 0x03
131
132
134
#define BMP280_PRESS 0x01
135
#define BMP280_TEMP 0x02
136
#define BMP280_ALL 0x03
137
139
#define BMP280_CONCAT_BYTES(msb, lsb) (((uint16_t)msb << 8) | (uint16_t)lsb)
140
141
#ifndef BMP280_COMPENSATION
142
#define BMP280_COMPENSATION BMP280_DOUBLE_PRECISION_COMPENSATION
143
#endif
144
148
enum
Bmp280Status
{
149
BMP280_STATUS_UNINIT
,
150
BMP280_STATUS_GET_CALIB
,
151
BMP280_STATUS_CONFIGURE
,
152
BMP280_STATUS_READ_STATUS_REG
,
153
BMP280_STATUS_READ_DATA_REGS
154
};
155
156
// brief Register Trim Variables
157
struct
bmp280_reg_calib_data
{
158
uint16_t
dig_t1
;
159
int16_t
dig_t2
;
160
int16_t
dig_t3
;
161
uint16_t
dig_p1
;
162
int16_t
dig_p2
;
163
int16_t
dig_p3
;
164
int16_t
dig_p4
;
165
int16_t
dig_p5
;
166
int16_t
dig_p6
;
167
int16_t
dig_p7
;
168
int16_t
dig_p8
;
169
int16_t
dig_p9
;
170
int32_t
t_fine
;
171
};
172
173
174
#endif
/* BMP280_REGS_H */
BMP280_STATUS_READ_STATUS_REG
@ BMP280_STATUS_READ_STATUS_REG
Definition:
bmp280_regs.h:152
uint16_t
unsigned short uint16_t
Definition:
types.h:16
BMP280_STATUS_GET_CALIB
@ BMP280_STATUS_GET_CALIB
Definition:
bmp280_regs.h:150
bmp280_reg_calib_data::dig_p6
int16_t dig_p6
Definition:
bmp280_regs.h:166
BMP280_STATUS_READ_DATA_REGS
@ BMP280_STATUS_READ_DATA_REGS
Definition:
bmp280_regs.h:153
bmp280_reg_calib_data
Definition:
bmp280_regs.h:157
bmp280_reg_calib_data::dig_p8
int16_t dig_p8
Definition:
bmp280_regs.h:168
std.h
bmp280_reg_calib_data::dig_p1
uint16_t dig_p1
Definition:
bmp280_regs.h:161
BMP280_STATUS_UNINIT
@ BMP280_STATUS_UNINIT
Definition:
bmp280_regs.h:149
int16_t
signed short int16_t
Definition:
types.h:17
bmp280_reg_calib_data::dig_p4
int16_t dig_p4
Definition:
bmp280_regs.h:164
BMP280_STATUS_CONFIGURE
@ BMP280_STATUS_CONFIGURE
Definition:
bmp280_regs.h:151
bmp280_reg_calib_data::t_fine
int32_t t_fine
Definition:
bmp280_regs.h:170
bmp280_reg_calib_data::dig_t3
int16_t dig_t3
Definition:
bmp280_regs.h:160
bmp280_reg_calib_data::dig_p2
int16_t dig_p2
Definition:
bmp280_regs.h:162
bmp280_reg_calib_data::dig_t1
uint16_t dig_t1
Definition:
bmp280_regs.h:158
bmp280_reg_calib_data::dig_p3
int16_t dig_p3
Definition:
bmp280_regs.h:163
bmp280_reg_calib_data::dig_t2
int16_t dig_t2
Definition:
bmp280_regs.h:159
int32_t
signed long int32_t
Definition:
types.h:19
bmp280_reg_calib_data::dig_p7
int16_t dig_p7
Definition:
bmp280_regs.h:167
bmp280_reg_calib_data::dig_p5
int16_t dig_p5
Definition:
bmp280_regs.h:165
Bmp280Status
Bmp280Status
Status enum.
Definition:
bmp280_regs.h:148
bmp280_reg_calib_data::dig_p9
int16_t dig_p9
Definition:
bmp280_regs.h:169
sw
airborne
peripherals
bmp280_regs.h
Generated on Tue Feb 1 2022 13:51:17 for Paparazzi UAS by
1.8.17