In the file "src/TCA95x5.cpp" there is a "and" in a if-statement instead of a "&&".
You test the Wire.available() for each byte. It is possible to do that once. I prefer to check if all the bytes are received by the Wire.requestFrom() function and only then read all the bytes. You have no check if the Wire.requestFrom() failed.
The code below is not better, only to show an alternative way. To check for I2C bus errors does not capture all bus problems, it is therefor trivial to check for all bus errors.
Wire.requestFrom(_device_address, uint8_t(length));
if (Wire.available() != length) {
success = false;
} else {
for (size_t i = 0; i < length; i++) {
output[i] = (uint8_t) Wire.read();
}
}
In the file "src/TCA95x5.cpp" there is a "and" in a if-statement instead of a "&&".
You test the
Wire.available()for each byte. It is possible to do that once. I prefer to check if all the bytes are received by theWire.requestFrom()function and only then read all the bytes. You have no check if theWire.requestFrom()failed.The code below is not better, only to show an alternative way. To check for I2C bus errors does not capture all bus problems, it is therefor trivial to check for all bus errors.