File tree Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -66,8 +66,19 @@ bool Adafruit_BME280::begin(uint8_t addr)
66
66
if (read8 (BME280_REGISTER_CHIPID) != 0x60 )
67
67
return false ;
68
68
69
+ // reset the device using soft-reset
70
+ // this makes sure the IIR is off, etc.
71
+ write8 (BME280_REGISTER_SOFTRESET, 0xB6 );
72
+
73
+ // wait for chip to wake up.
74
+ delay (300 );
75
+
76
+ // if chip is still reading calibration, delay
77
+ while (isReadingCalibration ())
78
+ delay (100 );
79
+
69
80
readCoefficients (); // read trimming parameters, see DS 4.2.2
70
-
81
+
71
82
setSampling (); // use defaults
72
83
73
84
return true ;
@@ -338,6 +349,18 @@ void Adafruit_BME280::readCoefficients(void)
338
349
_bme280_calib.dig_H6 = (int8_t )read8 (BME280_REGISTER_DIG_H6);
339
350
}
340
351
352
+ /* *************************************************************************/
353
+ /* !
354
+ @brief return true if chip is busy reading cal data
355
+ */
356
+ /* *************************************************************************/
357
+ bool Adafruit_BME280::isReadingCalibration (void )
358
+ {
359
+ uint8_t const rStatus = read8 (BME280_REGISTER_STATUS);
360
+
361
+ return (rStatus & (1 << 0 )) != 0 ;
362
+ }
363
+
341
364
342
365
/* *************************************************************************/
343
366
/* !
Original file line number Diff line number Diff line change @@ -187,6 +187,7 @@ class Adafruit_BME280 {
187
187
188
188
private:
189
189
void readCoefficients (void );
190
+ bool isReadingCalibration (void );
190
191
uint8_t spixfer (uint8_t x);
191
192
192
193
void write8 (byte reg, byte value);
You can’t perform that action at this time.
0 commit comments