Fix M261, i2c EEPROM, i2c Encoder for LPC (#17678)
Co-authored-by: Scott Lahteine <github@thinkyhead.com>
This commit is contained in:
@ -305,7 +305,7 @@ int32_t I2CPositionEncoder::get_raw_count() {
|
||||
|
||||
encoderCount.val = 0x00;
|
||||
|
||||
if (Wire.requestFrom((int)i2cAddress, 3) != 3) {
|
||||
if (Wire.requestFrom(I2C_ADDRESS(i2cAddress), 3) != 3) {
|
||||
//houston, we have a problem...
|
||||
H = I2CPE_MAG_SIG_NF;
|
||||
return 0;
|
||||
@ -744,7 +744,7 @@ void I2CPositionEncodersMgr::report_module_firmware(const uint8_t address) {
|
||||
Wire.endTransmission();
|
||||
|
||||
// Read value
|
||||
if (Wire.requestFrom((int)address, 32)) {
|
||||
if (Wire.requestFrom(I2C_ADDRESS(address), 32)) {
|
||||
char c;
|
||||
while (Wire.available() > 0 && (c = (char)Wire.read()) > 0)
|
||||
SERIAL_ECHO(c);
|
||||
|
@ -104,8 +104,8 @@ bool TWIBus::request(const uint8_t bytes) {
|
||||
debug(PSTR("request"), bytes);
|
||||
|
||||
// requestFrom() is a blocking function
|
||||
if (Wire.requestFrom(addr, bytes) == 0) {
|
||||
debug("request fail", addr);
|
||||
if (Wire.requestFrom(I2C_ADDRESS(addr), bytes) == 0) {
|
||||
debug("request fail", I2C_ADDRESS(addr));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user