diff --git a/.github/workflows/add_issue_to_project.yml b/.github/workflows/add_issue_to_project.yml new file mode 100644 index 0000000..6b60cc3 --- /dev/null +++ b/.github/workflows/add_issue_to_project.yml @@ -0,0 +1,18 @@ +name: Add new issue to our main project + +on: + issues: + types: + - opened + +jobs: + add-to-project: + name: Add issue to project + runs-on: ubuntu-latest + steps: + - uses: actions/add-to-project@main + with: + # You can target a project in a different organization + # to the issue + project-url: https://github.com/orgs/sparkfun/projects/19 + github-token: ${{ secrets.DEFECT_ADD_TO_PROJECT }} diff --git a/README.md b/README.md index abb6523..3f3fc4b 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,8 @@ Some examples include a circular buffer class for averaging. Thanks to: * calvin1564 for [fixing a name collision](https://github.com/sparkfun/SparkFun_BME280_Arduino_Library/pull/34) * LukaHitH for adding [BMP280 support](https://github.com/sparkfun/SparkFun_BME280_Arduino_Library/pull/23) +* cdonate for adding [burst read](https://github.com/sparkfun/SparkFun_BME280_Arduino_Library/pull/50) +* jdavid for integrating [math.h](https://github.com/sparkfun/SparkFun_BME280_Arduino_Library/pull/49) Repository Contents ------------------- @@ -36,12 +38,16 @@ Documentation -------------- * **[Installing an Arduino Library Guide](https://learn.sparkfun.com/tutorials/installing-an-arduino-library)** - Basic information on how to install an Arduino library. -* **[Product Repository](https://github.com/sparkfun/BME280-Breakout-Board)** - Main repository (including hardware files) for the SparkFun BME280 Breakout. +* **Product Repositories:** (including hardware files) + * [SparkFun BME280 Breakout](https://github.com/sparkfun/BME280-Breakout-Board) - Original product repository + * [SparkFun Environmental Combo Breakout - CCS811/BME280 (Qwiic)](https://www.sparkfun.com/products/14348) + * [SparkFun Atmospheric Sensor Breakout - BME280 (Qwiic)](https://github.com/sparkfun/Qwiic_Atmospheric_Sensor_Breakout_BME280) * **[Hookup Guide](https://learn.sparkfun.com/tutorials/sparkfun-bme280-breakout-hookup-guide)** - Basic hookup guide for the SparkFun BME280 Breakout. Products that use this Library --------------------------------- +* [*SEN-15440*](https://www.sparkfun.com/products/15440) * [*SEN-14348*](https://www.sparkfun.com/products/14348) * [*SEN-13676*](https://www.sparkfun.com/products/13676) diff --git a/examples/Example10_DewPoint/Example10_DewPoint.ino b/examples/Example10_DewPoint/Example10_DewPoint.ino index 6c1b4b6..fa0781b 100644 --- a/examples/Example10_DewPoint/Example10_DewPoint.ino +++ b/examples/Example10_DewPoint/Example10_DewPoint.ino @@ -25,7 +25,7 @@ BME280 mySensor; void setup() { - Serial.begin(9600); + Serial.begin(115200); Serial.println("Example showing dewpoint calculation"); mySensor.setI2CAddress(0x76); //Connect to a second sensor diff --git a/examples/Example11_BurstRead/Example11_BurstRead.ino b/examples/Example11_BurstRead/Example11_BurstRead.ino new file mode 100644 index 0000000..6e94e7f --- /dev/null +++ b/examples/Example11_BurstRead/Example11_BurstRead.ino @@ -0,0 +1,68 @@ +/* + Get environmental readings as a burst from the BME280 + By: Claudio Donaté + Date: December 30th, 2020 + License: This code is public domain but you buy me a beer if you use this and we meet someday (Beerware license). + + Feel like supporting our work? Buy a board from SparkFun! + https://www.sparkfun.com/products/14348 - Qwiic Combo Board + https://www.sparkfun.com/products/13676 - BME280 Breakout Board + + This example shows how to read humidity, pressure, and current temperature from the BME280 over I2C reading all registers at once. + Please check BME280 Datasheet, section 4, Data readout for detail explanations on why. + + Hardware connections: + BME280 -> Arduino + GND -> GND + 3.3 -> 3.3 + SDA -> A4 + SCL -> A5 +*/ + +#include + +#include "SparkFunBME280.h" + +#define CELSIUS_SCALE 0 //Default +#define FAHRENHEIT_SCALE 1 + +BME280 mySensor; +BME280_SensorMeasurements measurements; + +void setup() +{ + Serial.begin(115200); + Serial.println("Reading basic values from BME280 as a Burst"); + + Wire.begin(); + + if (mySensor.beginI2C() == false) //Begin communication over I2C + { + Serial.println("The sensor did not respond. Please check wiring."); + while(1); //Freeze + } +} + +void loop() +{ + while (mySensor.isMeasuring()) // Wait for sensor to finish measuring + { + Serial.print("."); + }; + + mySensor.readAllMeasurements(&measurements); // Return temperature in Celsius + // mySensor.readAllMeasurements(&measurements, FAHRENHEIT_SCALE); + + Serial.print("\nHumidity: "); + Serial.print(measurements.humidity, 0); + + Serial.print(" Pressure: "); + Serial.print(measurements.pressure, 0); + + Serial.print(" Temp: "); + Serial.print(measurements.temperature, 2); + + Serial.println(); + + delay(50); +} diff --git a/examples/Example1_BasicReadings/Example1_BasicReadings.ino b/examples/Example1_BasicReadings/Example1_BasicReadings.ino index a4078f8..3fe99c4 100644 --- a/examples/Example1_BasicReadings/Example1_BasicReadings.ino +++ b/examples/Example1_BasicReadings/Example1_BasicReadings.ino @@ -26,7 +26,7 @@ BME280 mySensor; void setup() { - Serial.begin(9600); + Serial.begin(115200); Serial.println("Reading basic values from BME280"); Wire.begin(); diff --git a/examples/Example2_I2CAddress/Example2_I2CAddress.ino b/examples/Example2_I2CAddress/Example2_I2CAddress.ino index d277347..7d97120 100644 --- a/examples/Example2_I2CAddress/Example2_I2CAddress.ino +++ b/examples/Example2_I2CAddress/Example2_I2CAddress.ino @@ -27,7 +27,7 @@ BME280 mySensorB; //Uses I2C address 0x76 (jumper closed) void setup() { - Serial.begin(9600); + Serial.begin(115200); Serial.println("Example showing alternate I2C addresses"); Wire.begin(); diff --git a/examples/Example3_CSVOutput/Example3_CSVOutput.ino b/examples/Example3_CSVOutput/Example3_CSVOutput.ino index 03e9d43..cb34eff 100644 --- a/examples/Example3_CSVOutput/Example3_CSVOutput.ino +++ b/examples/Example3_CSVOutput/Example3_CSVOutput.ino @@ -21,7 +21,7 @@ unsigned long sampleNumber = 0; void setup() { - Serial.begin(9600); + Serial.begin(115200); Wire.begin(); diff --git a/examples/Example4_Settings/Example4_Settings.ino b/examples/Example4_Settings/Example4_Settings.ino index b9e61f9..f51b795 100644 --- a/examples/Example4_Settings/Example4_Settings.ino +++ b/examples/Example4_Settings/Example4_Settings.ino @@ -17,7 +17,7 @@ BME280 mySensor; void setup() { - Serial.begin(9600); + Serial.begin(115200); Serial.println("Example showing alternate I2C addresses"); Wire.begin(); diff --git a/examples/Example5_ReadAllRegisters/Example5_ReadAllRegisters.ino b/examples/Example5_ReadAllRegisters/Example5_ReadAllRegisters.ino index f15eda4..85acc6a 100644 --- a/examples/Example5_ReadAllRegisters/Example5_ReadAllRegisters.ino +++ b/examples/Example5_ReadAllRegisters/Example5_ReadAllRegisters.ino @@ -23,7 +23,7 @@ BME280 mySensor; void setup() { - Serial.begin(9600); + Serial.begin(115200); while(!Serial); //Needed for printing correctly when using a Teensy Serial.println("Reading all registers from BME280"); diff --git a/examples/Example6_LowPower/Example6_LowPower.ino b/examples/Example6_LowPower/Example6_LowPower.ino index e2fd8a6..c42abe8 100644 --- a/examples/Example6_LowPower/Example6_LowPower.ino +++ b/examples/Example6_LowPower/Example6_LowPower.ino @@ -18,7 +18,7 @@ BME280 mySensor; void setup() { - Serial.begin(9600); + Serial.begin(115200); Serial.println("Example showing alternate I2C addresses"); Wire.begin(); diff --git a/examples/Example7_RelativeAltitudeChange/Example7_RelativeAltitudeChange.ino b/examples/Example7_RelativeAltitudeChange/Example7_RelativeAltitudeChange.ino index 7b3e136..586ed2d 100644 --- a/examples/Example7_RelativeAltitudeChange/Example7_RelativeAltitudeChange.ino +++ b/examples/Example7_RelativeAltitudeChange/Example7_RelativeAltitudeChange.ino @@ -41,7 +41,7 @@ float localAltitude = 0; void setup() { - Serial.begin(9600); + Serial.begin(115200); while(!Serial); //Wait for user to get terminal open Serial.println("Output a local changing altitude"); Serial.println("Press any key to zero local altitude"); diff --git a/examples/Example8_LocalPressure/Example8_LocalPressure.ino b/examples/Example8_LocalPressure/Example8_LocalPressure.ino index d1a4fcd..552be86 100644 --- a/examples/Example8_LocalPressure/Example8_LocalPressure.ino +++ b/examples/Example8_LocalPressure/Example8_LocalPressure.ino @@ -25,7 +25,7 @@ BME280 mySensor; void setup() { - Serial.begin(9600); + Serial.begin(115200); Serial.println("Example showing alternate I2C addresses"); Wire.begin(); diff --git a/examples/Example9_SoftwareI2C/Example9_SoftwareI2C.ino b/examples/Example9_SoftwareI2C/Example9_SoftwareI2C.ino index b5c3c6a..f47d0b1 100644 --- a/examples/Example9_SoftwareI2C/Example9_SoftwareI2C.ino +++ b/examples/Example9_SoftwareI2C/Example9_SoftwareI2C.ino @@ -31,7 +31,7 @@ BME280 mySensor; void setup() { - Serial.begin(9600); + Serial.begin(115200); Serial.println("Example showing alternate I2C addresses"); myWire.begin(); diff --git a/library.properties b/library.properties index a91aa42..4601130 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=SparkFun BME280 -version=2.0.6 +version=2.0.10 author=SparkFun Electronics maintainer=SparkFun Electronics sentence=A library to drive the Bosch BME280 Altimeter and Pressure sensor diff --git a/src/SparkFunBME280.cpp b/src/SparkFunBME280.cpp index 77272bc..dac7ab1 100644 --- a/src/SparkFunBME280.cpp +++ b/src/SparkFunBME280.cpp @@ -20,6 +20,7 @@ Distributed as-is; no warranty is given. ******************************************************************************/ //See SparkFunBME280.h for additional topology notes. +#include #include "SparkFunBME280.h" //****************************************************************************// @@ -47,7 +48,7 @@ BME280::BME280( void ) settings.tempOverSample = 1; settings.pressOverSample = 1; settings.humidOverSample = 1; - settings.tempCorrection = 0.0; // correction of temperature - added to the result + settings.tempCorrection = 0.f; // correction of temperature - added to the result } @@ -70,40 +71,23 @@ uint8_t BME280::begin() case I2C_MODE: - switch(_wireType) - { - case(HARD_WIRE): - _hardPort->begin(); //The caller can begin their port and set the speed. We just confirm it here otherwise it can be hard to debug. - break; - case(SOFT_WIRE): - #ifdef SoftwareWire_h - _softPort->begin(); //The caller can begin their port and set the speed. We just confirm it here otherwise it can be hard to debug. - #endif - break; - } + //Removing port begin from library. This should be done by user otherwise this library will overwrite Wire settings such as clock speed. + // switch(_wireType) + // { + // case(HARD_WIRE): + // _hardPort->begin(); //The caller can begin their port and set the speed. We just confirm it here otherwise it can be hard to debug. + // break; + // case(SOFT_WIRE): + // #ifdef SoftwareWire_h + // _softPort->begin(); //The caller can begin their port and set the speed. We just confirm it here otherwise it can be hard to debug. + // #endif + // break; + // } break; case SPI_MODE: // start the SPI library: SPI.begin(); - #ifdef ARDUINO_ARCH_ESP32 - SPI.setFrequency(1000000); - // Data is read and written MSb first. - SPI.setBitOrder(SPI_MSBFIRST); - // Like the standard arduino/teensy comment below, mode0 seems wrong according to standards - // but conforms to the timing diagrams when used for the ESP32 - SPI.setDataMode(SPI_MODE0); - #else - // Maximum SPI frequency is 10MHz, could divide by 2 here: - SPI.setClockDivider(SPI_CLOCK_DIV32); - // Data is read and written MSb first. - SPI.setBitOrder(MSBFIRST); - // Data is captured on rising edge of clock (CPHA = 0) - // Base value of the clock is HIGH (CPOL = 1) - // This was SPI_MODE3 for RedBoard, but I had to change to - // MODE0 for Teensy 3.1 operation - SPI.setDataMode(SPI_MODE3); - #endif // initialize the data ready and chip select pins: pinMode(settings.chipSelectPin, OUTPUT); digitalWrite(settings.chipSelectPin, HIGH); @@ -373,6 +357,29 @@ void BME280::reset( void ) } +//****************************************************************************// +// +// Burst Measurement Section +// +//****************************************************************************// + +//Read all sensor registers as a burst. See BME280 Datasheet section 4. Data readout +//tempScale = 0 for Celsius scale (default setting) +//tempScale = 1 for Fahrenheit scale +void BME280::readAllMeasurements(BME280_SensorMeasurements *measurements, uint8_t tempScale){ + + uint8_t dataBurst[8]; + readRegisterRegion(dataBurst, BME280_MEASUREMENTS_REG, 8); + + if(tempScale == 0){ + readTempCFromBurst(dataBurst, measurements); + }else{ + readTempFFromBurst(dataBurst, measurements); + } + readFloatPressureFromBurst(dataBurst, measurements); + readFloatHumidityFromBurst(dataBurst, measurements); +} + //****************************************************************************// // // Pressure Section @@ -408,7 +415,44 @@ float BME280::readFloatPressure( void ) } -//Sets the internal variable _referencePressure so the +void BME280::readFloatPressureFromBurst(uint8_t buffer[], BME280_SensorMeasurements *measurements) +{ + + // Set pressure in Pa as unsigned 32 bit integer in Q24.8 format (24 integer bits and 8 fractional bits). + // Output value of “24674867” represents 24674867/256 = 96386.2 Pa = 963.862 hPa + + int32_t adc_P = ((uint32_t)buffer[0] << 12) | ((uint32_t)buffer[1] << 4) | ((buffer[2] >> 4) & 0x0F); + + int64_t var1, var2, p_acc; + var1 = ((int64_t)t_fine) - 128000; + var2 = var1 * var1 * (int64_t)calibration.dig_P6; + var2 = var2 + ((var1 * (int64_t)calibration.dig_P5)<<17); + var2 = var2 + (((int64_t)calibration.dig_P4)<<35); + var1 = ((var1 * var1 * (int64_t)calibration.dig_P3)>>8) + ((var1 * (int64_t)calibration.dig_P2)<<12); + var1 = (((((int64_t)1)<<47)+var1))*((int64_t)calibration.dig_P1)>>33; + if (var1 == 0) + { + measurements->pressure = 0; // avoid exception caused by division by zero + } + else + { + p_acc = 1048576 - adc_P; + p_acc = (((p_acc<<31) - var2)*3125)/var1; + var1 = (((int64_t)calibration.dig_P9) * (p_acc>>13) * (p_acc>>13)) >> 25; + var2 = (((int64_t)calibration.dig_P8) * p_acc) >> 19; + p_acc = ((p_acc + var1 + var2) >> 8) + (((int64_t)calibration.dig_P7)<<4); + + measurements->pressure = (float)p_acc / 256.0; + } +} + +// Sets the internal variable _referencePressure so the altitude is calculated properly. +// This is also known as "sea level pressure" and is in Pascals. The value is probably +// within 10% of 101325. This varies based on the weather: +// https://en.wikipedia.org/wiki/Atmospheric_pressure#Mean_sea-level_pressure +// +// if you are concerned about accuracy or precision, make sure to pull the +// "sea level pressure"value from a trusted source like NOAA. void BME280::setReferencePressure(float refPressure) { _referencePressure = refPressure; @@ -424,7 +468,13 @@ float BME280::readFloatAltitudeMeters( void ) { float heightOutput = 0; - //heightOutput = ((float)-45846.2)*(pow(((float)readFloatPressure()/(float)_referencePressure), 0.190263) - (float)1); + // Getting height from a pressure reading is called the "international barometric height formula". + // The magic value of 44330.77 was adjusted in issue #30. + // There's also some discussion of it here: https://www.sparkfun.com/tutorials/253 + // This calculation is NOT designed to work on non-Earthlike planets such as Mars or Venus; + // see NRLMSISE-00. That's why it is the "international" formula, not "interplanetary". + // Sparkfun is not liable for incorrect altitude calculations from this + // code on those planets. Interplanetary selfies are welcome, however. heightOutput = ((float)-44330.77)*(pow(((float)readFloatPressure()/(float)_referencePressure), 0.190263) - (float)1); //Corrected, see issue 30 return heightOutput; @@ -465,12 +515,36 @@ float BME280::readFloatHumidity( void ) return (float)(var1>>12) / 1024.0; } +void BME280::readFloatHumidityFromBurst(uint8_t buffer[], BME280_SensorMeasurements *measurements) +{ + + // Set humidity in %RH as unsigned 32 bit integer in Q22. 10 format (22 integer and 10 fractional bits). + // Output value of “47445” represents 47445/1024 = 46. 333 %RH + int32_t adc_H = ((uint32_t)buffer[6] << 8) | ((uint32_t)buffer[7]); + + int32_t var1; + var1 = (t_fine - ((int32_t)76800)); + var1 = (((((adc_H << 14) - (((int32_t)calibration.dig_H4) << 20) - (((int32_t)calibration.dig_H5) * var1)) + + ((int32_t)16384)) >> 15) * (((((((var1 * ((int32_t)calibration.dig_H6)) >> 10) * (((var1 * ((int32_t)calibration.dig_H3)) >> 11) + ((int32_t)32768))) >> 10) + ((int32_t)2097152)) * + ((int32_t)calibration.dig_H2) + 8192) >> 14)); + var1 = (var1 - (((((var1 >> 15) * (var1 >> 15)) >> 7) * ((int32_t)calibration.dig_H1)) >> 4)); + var1 = (var1 < 0 ? 0 : var1); + var1 = (var1 > 419430400 ? 419430400 : var1); + + measurements->humidity = (float)(var1>>12) / 1024.0; +} + //****************************************************************************// // // Temperature Section // //****************************************************************************// +void BME280::setTemperatureCorrection(float corr) +{ + settings.tempCorrection = corr; +} + float BME280::readTempC( void ) { // Returns temperature in DegC, resolution is 0.01 DegC. Output value of “5123” equals 51.23 DegC. @@ -495,6 +569,29 @@ float BME280::readTempC( void ) return output; } +float BME280::readTempFromBurst(uint8_t buffer[]) +{ + int32_t adc_T = ((uint32_t)buffer[3] << 12) | ((uint32_t)buffer[4] << 4) | ((buffer[5] >> 4) & 0x0F); + + //By datasheet, calibrate + int64_t var1, var2; + + var1 = ((((adc_T>>3) - ((int32_t)calibration.dig_T1<<1))) * ((int32_t)calibration.dig_T2)) >> 11; + var2 = (((((adc_T>>4) - ((int32_t)calibration.dig_T1)) * ((adc_T>>4) - ((int32_t)calibration.dig_T1))) >> 12) * + ((int32_t)calibration.dig_T3)) >> 14; + t_fine = var1 + var2; + float output = (t_fine * 5 + 128) >> 8; + + output = output / 100 + settings.tempCorrection; + + return output; +} + +void BME280::readTempCFromBurst(uint8_t buffer[], BME280_SensorMeasurements *measurements) +{ + measurements->temperature = readTempFromBurst(buffer); +} + float BME280::readTempF( void ) { float output = readTempC(); @@ -503,6 +600,14 @@ float BME280::readTempF( void ) return output; } +void BME280::readTempFFromBurst(uint8_t buffer[], BME280_SensorMeasurements *measurements) +{ + float output = readTempFromBurst(buffer); + output = (output * 9) / 5 + 32; + + measurements->temperature = output; +} + //****************************************************************************// // // Dew point Section @@ -586,6 +691,7 @@ void BME280::readRegisterRegion(uint8_t *outputPointer , uint8_t offset, uint8_t break; case SPI_MODE: + SPI.beginTransaction(settings.spiSettings); // take the chip select low to select the device: digitalWrite(settings.chipSelectPin, LOW); // send the device the register you want to read: @@ -599,6 +705,7 @@ void BME280::readRegisterRegion(uint8_t *outputPointer , uint8_t offset, uint8_t } // take the chip select high to de-select: digitalWrite(settings.chipSelectPin, HIGH); + SPI.endTransaction(); break; default: @@ -647,14 +754,7 @@ uint8_t BME280::readRegister(uint8_t offset) break; case SPI_MODE: - // take the chip select low to select the device: - digitalWrite(settings.chipSelectPin, LOW); - // send the device the register you want to read: - SPI.transfer(offset | 0x80); //Ored with "read request" bit - // send a value of 0 to read the first byte returned: - result = SPI.transfer(0x00); - // take the chip select high to de-select: - digitalWrite(settings.chipSelectPin, HIGH); + readRegisterRegion(&result, offset, 1); break; default: @@ -699,6 +799,7 @@ void BME280::writeRegister(uint8_t offset, uint8_t dataToWrite) break; case SPI_MODE: + SPI.beginTransaction(settings.spiSettings); // take the chip select low to select the device: digitalWrite(settings.chipSelectPin, LOW); // send the device the register you want to read: @@ -708,6 +809,7 @@ void BME280::writeRegister(uint8_t offset, uint8_t dataToWrite) // decrement the number of bytes left to read: // take the chip select high to de-select: digitalWrite(settings.chipSelectPin, HIGH); + SPI.endTransaction(); break; default: diff --git a/src/SparkFunBME280.h b/src/SparkFunBME280.h index 7e3693e..f169b2b 100644 --- a/src/SparkFunBME280.h +++ b/src/SparkFunBME280.h @@ -46,6 +46,18 @@ Distributed as-is; no warranty is given. #define I2C_MODE 0 #define SPI_MODE 1 +#ifndef BME280_SPI_CLOCK +#ifdef ARDUINO_ARCH_ESP32 +#define BME280_SPI_CLOCK 1000000 +#else +#define BME280_SPI_CLOCK 500000 +#endif +#endif + +#ifndef BME280_SPI_MODE +#define BME280_SPI_MODE SPI_MODE0 +#endif + #define NO_WIRE 0 #define HARD_WIRE 1 #define SOFT_WIRE 2 @@ -93,6 +105,7 @@ Distributed as-is; no warranty is given. #define BME280_STAT_REG 0xF3 //Status Reg #define BME280_CTRL_MEAS_REG 0xF4 //Ctrl Measure Reg #define BME280_CONFIG_REG 0xF5 //Configuration Reg +#define BME280_MEASUREMENTS_REG 0xF7 //Measurements register start #define BME280_PRESSURE_MSB_REG 0xF7 //Pressure MSB #define BME280_PRESSURE_LSB_REG 0xF8 //Pressure LSB #define BME280_PRESSURE_XLSB_REG 0xF9 //Pressure XLSB @@ -120,7 +133,8 @@ struct BME280_SensorSettings uint8_t commInterface; uint8_t I2CAddress; uint8_t chipSelectPin; - + SPISettings spiSettings{BME280_SPI_CLOCK, MSBFIRST, BME280_SPI_MODE}; + //Deprecated settings uint8_t runMode; uint8_t tStandby; @@ -159,6 +173,14 @@ struct SensorCalibration }; +struct BME280_SensorMeasurements +{ + public: + float temperature; + float pressure; + float humidity; +}; + //This is the main operational class of the driver. class BME280 @@ -202,17 +224,22 @@ class BME280 //Software reset routine void reset( void ); + void readAllMeasurements(BME280_SensorMeasurements *measurements, uint8_t tempScale = 0); //Returns the values as floats. float readFloatPressure( void ); float readFloatAltitudeMeters( void ); float readFloatAltitudeFeet( void ); + void readFloatPressureFromBurst(uint8_t buffer[], BME280_SensorMeasurements *measurements); float readFloatHumidity( void ); + void readFloatHumidityFromBurst(uint8_t buffer[], BME280_SensorMeasurements *measurements); - //Temperature related methods + //Temperature related methods + void setTemperatureCorrection(float corr); float readTempC( void ); float readTempF( void ); + float readTempFromBurst(uint8_t buffer[]); //Dewpoint related methods //From Pavel-Sayekat: https://github.com/sparkfun/SparkFun_BME280_Breakout_Board/pull/6/files @@ -234,6 +261,8 @@ class BME280 private: uint8_t checkSampleValue(uint8_t userValue); //Checks for valid over sample values + void readTempCFromBurst(uint8_t buffer[], BME280_SensorMeasurements *measurements); + void readTempFFromBurst(uint8_t buffer[], BME280_SensorMeasurements *measurements); uint8_t _wireType = HARD_WIRE; //Default to Wire.h TwoWire *_hardPort = NO_WIRE; //The generic connection to user's chosen I2C hardware @@ -245,4 +274,4 @@ class BME280 float _referencePressure = 101325.0; //Default but is changeable }; -#endif // End of __BME280_H__ definition check \ No newline at end of file +#endif // End of __BME280_H__ definition check pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy