Skip to content

Commit c76d321

Browse files
committed
added new startup model - set address after object creation - namely: added no arg constructor and method to set I2C address post object creation/contructor
1 parent e613fe1 commit c76d321

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

src/SparkFunCCS811.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ CCS811::CCS811(uint8_t inputArg) : CCS811Core(inputArg)
233233
CO2 = 0;
234234
}
235235

236+
CCS811::CCS811() : CCS811(0){}
236237
//****************************************************************************//
237238
//
238239
// Begin

src/SparkFunCCS811.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ class CCS811Core
7070
CCS811Core(uint8_t);
7171
~CCS811Core() = default;
7272

73+
void setI2CAddress(uint8_t address){
74+
I2CAddress = address;
75+
}
7376
CCS811_Status_e beginCore(TwoWire &wirePort);
7477

7578
//***Reading functions***//
@@ -103,6 +106,7 @@ class CCS811 : public CCS811Core
103106
{
104107
public:
105108
CCS811(uint8_t);
109+
CCS811();
106110

107111
//Call to check for errors, start app, and set default mode 1
108112
bool begin(TwoWire &wirePort = Wire); //Use the Wire hardware by default

0 commit comments

Comments
 (0)