Skip to content

Add compatibility with BMP280 #23

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 8, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions src/SparkFunBME280.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ uint8_t BME280::begin()

//Check communication with IC before anything else
uint8_t chipID = readRegister(BME280_CHIP_ID_REG); //Should return 0x60
if(chipID != 0x60) return(chipID); //Failed!
if(chipID != 0x58) // This is not BMP
if(chipID != 0x60) // This is not BME

//Reading all compensation data, range 0x88:A1, 0xE1:E7
calibration.dig_T1 = ((uint16_t)((readRegister(BME280_DIG_T1_MSB_REG) << 8) + readRegister(BME280_DIG_T1_LSB_REG)));
Expand Down Expand Up @@ -156,8 +157,9 @@ bool BME280::beginSPI(uint8_t csPin)
{
settings.chipSelectPin = csPin;
settings.commInterface = SPI_MODE;

if(begin() == 0x60) return(true); //Begin normal init with these settings. Should return chip ID of 0x60

if(begin() == 0x58) return(true); //Begin normal init with these settings. Should return chip ID of 0x58 for BMP
if(begin() == 0x60) return(true); //Begin normal init with these settings. Should return chip ID of 0x60 for BME
return(false);
}

Expand All @@ -168,9 +170,10 @@ bool BME280::beginI2C(TwoWire &wirePort)
_wireType = HARD_WIRE;

settings.commInterface = I2C_MODE;

//settings.I2CAddress = 0x77; //We assume user has set the I2C address using setI2CAddress()

if(begin() == 0x60) return(true); //Begin normal init with these settings. Should return chip ID of 0x60
if(begin() == 0x58) return(true); //Begin normal init with these settings. Should return chip ID of 0x58 for BMP
if(begin() == 0x60) return(true); //Begin normal init with these settings. Should return chip ID of 0x60 for BME
return(false);
}

Expand All @@ -184,7 +187,8 @@ bool BME280::beginI2C(SoftwareWire& wirePort)
settings.commInterface = I2C_MODE;
//settings.I2CAddress = 0x77; //We assume user has set the I2C address using setI2CAddress()

if(begin() == 0x60) return(true); //Begin normal init with these settings. Should return chip ID of 0x60
if(begin() == 0x58) return(true); //Begin normal init with these settings. Should return chip ID of 0x58 for BMP
if(begin() == 0x60) return(true); //Begin normal init with these settings. Should return chip ID of 0x60 for BME
return(false);
}
#endif
Expand Down
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