Merge branch 'master' of github.com:adafruit/Adafruit_BME280_Library
This commit is contained in:
commit
09536bedf3
|
|
@ -66,6 +66,17 @@ bool Adafruit_BME280::begin(uint8_t addr)
|
|||
if (read8(BME280_REGISTER_CHIPID) != 0x60)
|
||||
return false;
|
||||
|
||||
// reset the device using soft-reset
|
||||
// this makes sure the IIR is off, etc.
|
||||
write8(BME280_REGISTER_SOFTRESET, 0xB6);
|
||||
|
||||
// wait for chip to wake up.
|
||||
delay(300);
|
||||
|
||||
// if chip is still reading calibration, delay
|
||||
while (isReadingCalibration())
|
||||
delay(100);
|
||||
|
||||
readCoefficients(); // read trimming parameters, see DS 4.2.2
|
||||
|
||||
setSampling(); // use defaults
|
||||
|
|
@ -303,7 +314,8 @@ void Adafruit_BME280::takeForcedMeasurement()
|
|||
write8(BME280_REGISTER_CONTROL, _measReg.get());
|
||||
// wait until measurement has been completed, otherwise we would read
|
||||
// the values from the last measurement
|
||||
while (read8(BME280_REGISTER_STATUS) & 0x08);
|
||||
while (read8(BME280_REGISTER_STATUS) & 0x08)
|
||||
delay(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -337,6 +349,18 @@ void Adafruit_BME280::readCoefficients(void)
|
|||
_bme280_calib.dig_H6 = (int8_t)read8(BME280_REGISTER_DIG_H6);
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@brief return true if chip is busy reading cal data
|
||||
*/
|
||||
/**************************************************************************/
|
||||
bool Adafruit_BME280::isReadingCalibration(void)
|
||||
{
|
||||
uint8_t const rStatus = read8(BME280_REGISTER_STATUS);
|
||||
|
||||
return (rStatus & (1 << 0)) != 0;
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
|
|
|
|||
|
|
@ -187,6 +187,7 @@ class Adafruit_BME280 {
|
|||
|
||||
private:
|
||||
void readCoefficients(void);
|
||||
bool isReadingCalibration(void);
|
||||
uint8_t spixfer(uint8_t x);
|
||||
|
||||
void write8(byte reg, byte value);
|
||||
|
|
|
|||
Loading…
Reference in New Issue