✨ M3426 to read i2c MCP3426 ADC (#23184)
This commit is contained in:
committed by
Scott Lahteine
parent
e6bbdd89b4
commit
363a17ac46
@@ -34,13 +34,18 @@ TWIBus i2c;
|
||||
|
||||
TWIBus::TWIBus() {
|
||||
#if I2C_SLAVE_ADDRESS == 0
|
||||
Wire.begin( // No address joins the BUS as the master
|
||||
#if PINS_EXIST(I2C_SCL, I2C_SDA) && DISABLED(SOFT_I2C_EEPROM)
|
||||
pin_t(I2C_SDA_PIN), pin_t(I2C_SCL_PIN)
|
||||
#endif
|
||||
);
|
||||
|
||||
#if PINS_EXIST(I2C_SCL, I2C_SDA) && DISABLED(SOFT_I2C_EEPROM)
|
||||
Wire.setSDA(pin_t(I2C_SDA_PIN));
|
||||
Wire.setSCL(pin_t(I2C_SCL_PIN));
|
||||
#endif
|
||||
|
||||
Wire.begin(); // No address joins the BUS as the master
|
||||
|
||||
#else
|
||||
|
||||
Wire.begin(I2C_SLAVE_ADDRESS); // Join the bus as a slave
|
||||
|
||||
#endif
|
||||
reset();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user