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

Add SHT20 using si7021 driver #409

Merged
merged 1 commit into from
Feb 13, 2023
Merged
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
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