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

Fix 'softReset()' using general reset call #29

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
16 changes: 9 additions & 7 deletions Adafruit_SGP30.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,16 @@ boolean Adafruit_SGP30::begin(TwoWire *theWire, boolean initSensor) {
* Call" mode. Take note that this is not sensor specific and all devices that
* support the General Call mode on the on the same I2C bus will perform this.
*
* @return True if command completed successfully, false if something went
* wrong!
* @param theWire
* Optional pointer to I2C interface, otherwise use Wire
*
* @return True if command completed successfully, false if something went
* wrong!
*/
boolean Adafruit_SGP30::softReset(void) {
uint8_t command[2];
command[0] = 0x00;
command[1] = 0x06;
return readWordFromCommand(command, 2, 10);
boolean Adafruit_SGP30::softReset(TwoWire* theWire) {
theWire->beginTransmission(0x00);
theWire->write(0x06);
return !(theWire->endTransmission());
}

/*!
Expand Down
2 changes: 1 addition & 1 deletion Adafruit_SGP30.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class Adafruit_SGP30 {
public:
Adafruit_SGP30();
boolean begin(TwoWire *theWire = &Wire, boolean initSensor = true);
boolean softReset();
boolean softReset(TwoWire *theWire = &Wire);
boolean IAQinit();
boolean IAQmeasure();
boolean IAQmeasureRaw();
Expand Down
Loading