@@ -138,11 +138,11 @@ class Adafruit_BME280_Unified : public Adafruit_Sensor
138
138
/* *************************************************************************/
139
139
class Adafruit_BME280 {
140
140
public:
141
- /* *************************************************************************/
142
- /* !
143
- @brief sampling rates
144
- */
145
- /* *************************************************************************/
141
+ /* *************************************************************************/
142
+ /* !
143
+ @brief sampling rates
144
+ */
145
+ /* *************************************************************************/
146
146
enum sensor_sampling {
147
147
SAMPLING_NONE = 0b000 ,
148
148
SAMPLING_X1 = 0b001 ,
@@ -220,9 +220,9 @@ class Adafruit_BME280 {
220
220
float seaLevelForAltitude (float altitude, float pressure);
221
221
222
222
223
- private :
224
- TwoWire *_wire;
225
- void readCoefficients (void );
223
+ protected :
224
+ TwoWire *_wire; // !< pointer to a TwoWire object
225
+ void readCoefficients (void );
226
226
bool isReadingCalibration (void );
227
227
uint8_t spixfer (uint8_t x);
228
228
@@ -234,15 +234,23 @@ class Adafruit_BME280 {
234
234
uint16_t read16_LE (byte reg); // little endian
235
235
int16_t readS16_LE (byte reg); // little endian
236
236
237
- uint8_t _i2caddr;
238
- int32_t _sensorID;
239
- int32_t t_fine;
237
+ uint8_t _i2caddr; // !< I2C addr for the TwoWire interface
238
+ int32_t _sensorID; // !< ID of the BME Sensor
239
+ int32_t t_fine; // !< temperature with high resolution, stored as an attribute as this is used for temperature compensation reading humidity and pressure
240
240
241
- int8_t _cs, _mosi, _miso, _sck;
241
+ int8_t _cs; // !< for the SPI interface
242
+ int8_t _mosi; // !< for the SPI interface
243
+ int8_t _miso; // !< for the SPI interface
244
+ int8_t _sck; // !< for the SPI interface
242
245
243
- bme280_calib_data _bme280_calib;
246
+ bme280_calib_data _bme280_calib; // !< here calibration data is stored
244
247
245
- // The config register
248
+
249
+ /* *************************************************************************/
250
+ /* !
251
+ @brief config register
252
+ */
253
+ /* *************************************************************************/
246
254
struct config {
247
255
// inactive duration (standby time) in normal mode
248
256
// 000 = 0.5 ms
@@ -253,28 +261,33 @@ class Adafruit_BME280 {
253
261
// 101 = 1000 ms
254
262
// 110 = 10 ms
255
263
// 111 = 20 ms
256
- unsigned int t_sb : 3 ;
264
+ unsigned int t_sb : 3 ; // /< inactive duration (standby time) in normal mode
257
265
258
266
// filter settings
259
267
// 000 = filter off
260
268
// 001 = 2x filter
261
269
// 010 = 4x filter
262
270
// 011 = 8x filter
263
271
// 100 and above = 16x filter
264
- unsigned int filter : 3 ;
272
+ unsigned int filter : 3 ; // /< filter settings
265
273
266
274
// unused - don't set
267
- unsigned int none : 1 ;
268
- unsigned int spi3w_en : 1 ;
275
+ unsigned int none : 1 ; // /< unused - don't set
276
+ unsigned int spi3w_en : 1 ; // /< unused - don't set
269
277
278
+ // / @return combined config register
270
279
unsigned int get () {
271
280
return (t_sb << 5 ) | (filter << 2 ) | spi3w_en;
272
281
}
273
282
};
274
- config _configReg;
283
+ config _configReg; // !< config register object
275
284
276
285
277
- // The ctrl_meas register
286
+ /* *************************************************************************/
287
+ /* !
288
+ @brief ctrl_meas register
289
+ */
290
+ /* *************************************************************************/
278
291
struct ctrl_meas {
279
292
// temperature oversampling
280
293
// 000 = skipped
@@ -283,7 +296,7 @@ class Adafruit_BME280 {
283
296
// 011 = x4
284
297
// 100 = x8
285
298
// 101 and above = x16
286
- unsigned int osrs_t : 3 ;
299
+ unsigned int osrs_t : 3 ; // /< temperature oversampling
287
300
288
301
// pressure oversampling
289
302
// 000 = skipped
@@ -292,24 +305,29 @@ class Adafruit_BME280 {
292
305
// 011 = x4
293
306
// 100 = x8
294
307
// 101 and above = x16
295
- unsigned int osrs_p : 3 ;
308
+ unsigned int osrs_p : 3 ; // /< pressure oversampling
296
309
297
310
// device mode
298
311
// 00 = sleep
299
312
// 01 or 10 = forced
300
313
// 11 = normal
301
- unsigned int mode : 2 ;
314
+ unsigned int mode : 2 ; // /< device mode
302
315
316
+ // / @return combined ctrl register
303
317
unsigned int get () {
304
318
return (osrs_t << 5 ) | (osrs_p << 2 ) | mode;
305
319
}
306
320
};
307
- ctrl_meas _measReg;
321
+ ctrl_meas _measReg; // !< measurement register object
308
322
309
323
310
- // The ctrl_hum register
324
+ /* *************************************************************************/
325
+ /* !
326
+ @brief ctrl_hum register
327
+ */
328
+ /* *************************************************************************/
311
329
struct ctrl_hum {
312
- // unused - don't set
330
+ // / unused - don't set
313
331
unsigned int none : 5 ;
314
332
315
333
// pressure oversampling
@@ -319,13 +337,14 @@ class Adafruit_BME280 {
319
337
// 011 = x4
320
338
// 100 = x8
321
339
// 101 and above = x16
322
- unsigned int osrs_h : 3 ;
340
+ unsigned int osrs_h : 3 ; // /< pressure oversampling
323
341
342
+ // / @return combined ctrl hum register
324
343
unsigned int get () {
325
344
return (osrs_h);
326
345
}
327
346
};
328
- ctrl_hum _humReg;
347
+ ctrl_hum _humReg; // !< hum register object
329
348
};
330
349
331
350
#endif
0 commit comments