Skip to content

Commit 2f13d74

Browse files
committed
init should not set I2C addr to 0
init takes sdaPin and clkPin but does not take an I2C address. Therefore the call to init should not set the I2C address to 0. It should leave it alone.
1 parent c48cb19 commit 2f13d74

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

cpp_utils/PCF8574.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -116,5 +116,6 @@ void PCF8574::setInvert(bool value) {
116116
* @param [in] clkPin The pin to use for the %I2C CLK functions.
117117
*/
118118
void PCF8574::init(gpio_num_t sdaPin, gpio_num_t clkPin) {
119-
i2c->init(0, sdaPin, clkPin);
119+
uint8_t addr = i2c->getAddress();
120+
i2c->init(addr, sdaPin, clkPin);
120121
} // init

0 commit comments

Comments
 (0)