Skip to content

Commit

Permalink
Merge pull request #78 from yanbec/master
Browse files Browse the repository at this point in the history
Added reset() function
  • Loading branch information
finitespace committed Feb 26, 2021
2 parents 2759e78 + afac105 commit 18de58e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
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 @@ -162,6 +162,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 @@ -246,6 +250,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 @@ -305,6 +312,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

0 comments on commit 18de58e

Please sign in to comment.