Skip to content

Commit

Permalink
fix direct use of Wire
Browse files Browse the repository at this point in the history
  • Loading branch information
SergioArrighi committed Jun 16, 2024
1 parent 7564ac9 commit d6e2716
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/ACS71020.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ ACS71020ERR ACS71020::readRegister(uint8_t address, uint32_t &data) {
if (toRead != 4)
return (ERR_I2C_ERROR);

data = Wire.read();
data |= Wire.read() << 8;
data |= Wire.read() << 16;
data |= Wire.read() << 24;
data = _i2cPort->read();
data |= _i2cPort->read() << 8;
data |= _i2cPort->read() << 16;
data |= _i2cPort->read() << 24;

return SUCCESS;
}
Expand All @@ -35,10 +35,10 @@ ACS71020ERR ACS71020::writeRegister(uint8_t address, uint32_t data) {
_i2cPort->beginTransmission(_i2cAddress);
_i2cPort->write(address);

Wire.write(data);
Wire.write(data >> 8);
Wire.write(data >> 16);
Wire.write(data >> 24);
_i2cPort->write(data);
_i2cPort->write(data >> 8);
_i2cPort->write(data >> 16);
_i2cPort->write(data >> 24);
uint8_t i2cResult = _i2cPort->endTransmission();

if (i2cResult != 0)
Expand Down

0 comments on commit d6e2716

Please sign in to comment.