Skip to content
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

Added reset() function #78

Merged
merged 3 commits into from
Feb 26, 2021
Merged
Show file tree
Hide file tree
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
8 changes: 8 additions & 0 deletions src/BME280.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,14 @@ bool BME280::begin
return success;
}

/****************************************************************/
bool BME280::reset()
{
WriteRegister(RESET_ADDR, RESET_VALUE);
delay(2); //max. startup time according to datasheet
return(begin());
}

/****************************************************************/
void BME280::CalculateRegisters
(
Expand Down
8 changes: 8 additions & 0 deletions src/BME280.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,10 @@ class BME280
/// Method used to initialize the class.
bool begin();

////////////////////////////////////////////////////////////////
/// Method to restart BME280. begin() needs to beed called afterwards
bool reset();

/*****************************************************************/
/* ENVIRONMENTAL FUNCTIONS */
/*****************************************************************/
Expand Down Expand Up @@ -245,6 +249,9 @@ class BME280
static const uint8_t HUM_DIG_ADDR1 = 0xA1;
static const uint8_t HUM_DIG_ADDR2 = 0xE1;
static const uint8_t ID_ADDR = 0xD0;
static const uint8_t RESET_ADDR = 0xE0;

static const uint8_t RESET_VALUE = 0xB6;

static const uint8_t TEMP_DIG_LENGTH = 6;
static const uint8_t PRESS_DIG_LENGTH = 18;
Expand Down Expand Up @@ -304,6 +311,7 @@ class BME280
/// successful and the id matches a known value.
bool ReadChipID();


/////////////////////////////////////////////////////////////////
/// Read the the trim data from the BME280, return true if
/// successful.
Expand Down