Skip to content

Commit

Permalink
Address Tyeth feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
brentru committed Mar 3, 2025
1 parent 9f6a088 commit 02c09e6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/components/i2c/hardware.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ void I2cHardware::TogglePowerPin() {
void I2cHardware::InitBus(bool is_default, const char *sda, const char *scl) {
uint8_t pin_sda, pin_scl;
if (!is_default && (sda == nullptr || scl == nullptr)) {
_bus_status = wippersnapper_i2c_I2cBusStatus_I2C_BUS_STATUS_ERROR_WIRING;
_bus_status = wippersnapper_i2c_I2cBusStatus_I2C_BUS_STATUS_UNSPECIFIED;
return;
}
// Some development boards define a pin that controls power
Expand Down Expand Up @@ -111,7 +111,7 @@ void I2cHardware::InitBus(bool is_default, const char *sda, const char *scl) {
_bus = new TwoWire(0);
} else {
_bus = new TwoWire(1);
Wire1.setPins(pin_sda, pin_scl);
_bus->setPins(pin_sda, pin_scl);
}
if (!_bus->begin(pin_sda, pin_scl)) {
_bus_status = wippersnapper_i2c_I2cBusStatus_I2C_BUS_STATUS_ERROR_HANG;
Expand Down Expand Up @@ -159,8 +159,8 @@ TwoWire *I2cHardware::GetBus() { return _bus; }
bool I2cHardware::AddMuxToBus(uint32_t address_register, const char *name) {
if (strcmp(name, "pca9546") == 0) {
_mux_max_channels = 4; // PCA9546 supports 4 channels
} else if (strcmp(name, "pca9548") == 0) {
_mux_max_channels = 4; // PCA9548 supports 4 channels
} else if (strcmp(name, "pca9548") == 0 || strcmp(name, "tca9548a") == 0) {
_mux_max_channels = 8; // PCA9548 supports 8 channels
} else {
return false;
}
Expand Down

0 comments on commit 02c09e6

Please sign in to comment.