RocketLogger
2.1.2
bme280.h
Go to the documentation of this file.
1
32
#ifndef SENSOR_BME280_H_
33
#define SENSOR_BME280_H_
34
35
#include <stdint.h>
36
37
#define BME280_I2C_ADDRESS_LEFT 0x76
38
39
#define BME280_I2C_ADDRESSES \
40
{ (BME280_I2C_ADDRESS_LEFT) }
41
42
#define BME280_CHANNEL_TEMPERATURE 0
43
#define BME280_CHANNEL_HUMIDITY 1
44
#define BME280_CHANNEL_PRESSURE 2
45
46
// register definitions
47
#define BME280_ID 0x60
48
49
#define BME280_REG_CALIBRATION_BLOCK1 0x88
50
#define BME280_REG_ID 0xD0
51
#define BME280_REG_RESET 0xE0
52
#define BME280_REG_CALIBRATION_BLOCK2 0xE1
53
#define BME280_REG_CONTROL_HUMIDITY 0xF2
54
#define BME280_REG_STATUS 0xF3
55
#define BME280_REG_CONTROL_MEASURE 0xF4
56
#define BME280_REG_CONFIG 0xF5
57
#define BME280_REG_PRESSURE_MSB 0xF7
58
#define BME280_REG_PRESSURE_LSB 0xF8
59
#define BME280_REG_PRESSURE_XLSB 0xF9
60
#define BME280_REG_TEMPERATURE_MSB 0xFA
61
#define BME280_REG_TEMPERATURE_LSB 0xFB
62
#define BME280_REG_TEMPERATURE_XLSB 0xFC
63
#define BME280_REG_HUMIDITY_MSB 0xFD
64
#define BME280_REG_HUMIDITY_LSB 0xFE
65
66
#define BME280_CALIBRATION_BLOCK1_SIZE 26
67
#define BME280_CALIBRATION_BLOCK2_SIZE 7
68
69
#define BME280_DATA_BLOCK_SIZE 8
70
71
#define BME280_RESET_VALUE 0xB6
72
73
#define BME280_OVERSAMPLE_HUMIDITY_OFF 0x00
74
#define BME280_OVERSAMPLE_HUMIDITY_1 0x01
75
#define BME280_OVERSAMPLE_HUMIDITY_2 0x02
76
#define BME280_OVERSAMPLE_HUMIDITY_4 0x03
77
#define BME280_OVERSAMPLE_HUMIDITY_8 0x04
78
#define BME280_OVERSAMPLE_HUMIDITY_16 0x0f
79
80
#define BME280_MEASURING 0x03
81
#define BME280_UPDATE 0x1
82
83
#define BME280_OVERSAMPLE_TEMPERATURE_OFF 0x00
84
#define BME280_OVERSAMPLE_TEMPERATURE_1 0x20
85
#define BME280_OVERSAMPLE_TEMPERATURE_2 0x40
86
#define BME280_OVERSAMPLE_TEMPERATURE_4 0x60
87
#define BME280_OVERSAMPLE_TEMPERATURE_8 0x80
88
#define BME280_OVERSAMPLE_TEMPERATURE_16 0xA0
89
#define BME280_OVERSAMPLE_PRESSURE_OFF 0x00
90
#define BME280_OVERSAMPLE_PRESSURE_1 0x04
91
#define BME280_OVERSAMPLE_PRESSURE_2 0x08
92
#define BME280_OVERSAMPLE_PRESSURE_4 0x0C
93
#define BME280_OVERSAMPLE_PRESSURE_8 0x10
94
#define BME280_OVERSAMPLE_PRESSURE_16 0x14
95
#define BME280_MODE_SLEEP 0x00
96
#define BME280_MODE_FORCE 0x01
97
#define BME280_MODE_NORMAL 0x03
98
99
#define BME280_STANDBY_DURATION_0_5 0x00
100
#define BME280_STANDBY_DURATION_62 0x20
101
#define BME280_STANDBY_DURATION_125 0x40
102
#define BME280_STANDBY_DURATION_250 0x60
103
#define BME280_STANDBY_DURATION_500 0x80
104
#define BME280_STANDBY_DURATION_1000 0xA0
105
#define BME280_STANDBY_DURATION_10 0xC0
106
#define BME280_STANDBY_DURATION_20 0xE0
107
#define BME280_FILTER_OFF 0x00
108
#define BME280_FILTER_2 0x04
109
#define BME280_FILTER_4 0x08
110
#define BME280_FILTER_8 0x0C
111
#define BME280_FILTER_16 0x10
112
#define BME280_SPI_EN 0x01
113
114
/*
115
* BME280 data structures
116
*/
117
struct
bme280_calibration
{
118
// temperature
119
uint16_t
T1
;
120
int16_t
T2
;
121
int16_t
T3
;
122
123
// pressure
124
uint16_t
P1
;
125
int16_t
P2
;
126
int16_t
P3
;
127
int16_t
P4
;
128
int16_t
P5
;
129
int16_t
P6
;
130
int16_t
P7
;
131
int16_t
P8
;
132
int16_t
P9
;
133
134
// humidity
135
uint8_t
H1
;
136
int16_t
H2
;
137
uint8_t
H3
;
138
int16_t
H4
;
139
int16_t
H5
;
140
int8_t
H6
;
141
};
142
143
/*
144
* Typedef for BME280 data structures
145
*/
146
typedef
struct
bme280_calibration
bme280_calibration_t
;
147
154
int
bme280_init
(
int
);
155
161
void
bme280_deinit
(
int
);
162
169
int
bme280_read
(
int
);
170
178
int32_t
bme280_get_value
(
int
,
int
);
179
180
#endif
/* SENSOR_BME280_H_ */
bme280_get_value
int32_t bme280_get_value(int, int)
Definition:
bme280.c:237
bme280_deinit
void bme280_deinit(int)
Definition:
bme280.c:189
bme280_init
int bme280_init(int)
Definition:
bme280.c:144
bme280_read
int bme280_read(int)
Definition:
bme280.c:193
bme280_calibration
Definition:
bme280.h:117
bme280_calibration::H3
uint8_t H3
Definition:
bme280.h:137
bme280_calibration::P9
int16_t P9
Definition:
bme280.h:132
bme280_calibration::P4
int16_t P4
Definition:
bme280.h:127
bme280_calibration::H6
int8_t H6
Definition:
bme280.h:140
bme280_calibration::H1
uint8_t H1
Definition:
bme280.h:135
bme280_calibration::T1
uint16_t T1
Definition:
bme280.h:119
bme280_calibration::H5
int16_t H5
Definition:
bme280.h:139
bme280_calibration::T3
int16_t T3
Definition:
bme280.h:121
bme280_calibration::P1
uint16_t P1
Definition:
bme280.h:124
bme280_calibration::P6
int16_t P6
Definition:
bme280.h:129
bme280_calibration::H4
int16_t H4
Definition:
bme280.h:138
bme280_calibration::T2
int16_t T2
Definition:
bme280.h:120
bme280_calibration::P8
int16_t P8
Definition:
bme280.h:131
bme280_calibration::H2
int16_t H2
Definition:
bme280.h:136
bme280_calibration::P5
int16_t P5
Definition:
bme280.h:128
bme280_calibration::P7
int16_t P7
Definition:
bme280.h:130
bme280_calibration::P2
int16_t P2
Definition:
bme280.h:125
bme280_calibration::P3
int16_t P3
Definition:
bme280.h:126
sensor
bme280.h
Generated by
1.9.5