Skip to content

Commit

Permalink
Merge pull request #409 from tyeth/add-sht20-as-si7021
Browse files Browse the repository at this point in the history
Add SHT20 using si7021 driver
  • Loading branch information
brentru authored Feb 13, 2023
2 parents 480a034 + 35be9e5 commit 9b70ddd
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/components/i2c/WipperSnapper_I2C.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -270,17 +270,18 @@ bool WipperSnapper_Component_I2C::initI2CDevice(
_scd30->configureDriver(msgDeviceInitReq);
drivers.push_back(_scd30);
WS_DEBUG_PRINTLN("SCD30 Initialized Successfully!");
} else if (strcmp("si7021", msgDeviceInitReq->i2c_device_name) == 0) {
} else if ((strcmp("sht20", msgDeviceInitReq->i2c_device_name) == 0) ||
(strcmp("si7021", msgDeviceInitReq->i2c_device_name) == 0)) {
_si7021 = new WipperSnapper_I2C_Driver_SI7021(this->_i2c, i2cAddress);
if (!_si7021->begin()) {
WS_DEBUG_PRINTLN("ERROR: Failed to initialize SI7021!");
WS_DEBUG_PRINTLN("ERROR: Failed to initialize SI7021/SHT20!");
_busStatusResponse =
wippersnapper_i2c_v1_BusResponse_BUS_RESPONSE_DEVICE_INIT_FAIL;
return false;
}
_si7021->configureDriver(msgDeviceInitReq);
drivers.push_back(_si7021);
WS_DEBUG_PRINTLN("SI7021 Initialized Successfully!");
WS_DEBUG_PRINTLN("SI7021/SHT20 Initialized Successfully!");
} else if (strcmp("mcp9808", msgDeviceInitReq->i2c_device_name) == 0) {
_mcp9808 = new WipperSnapper_I2C_Driver_MCP9808(this->_i2c, i2cAddress);
if (!_mcp9808->begin()) {
Expand Down

0 comments on commit 9b70ddd

Please sign in to comment.