Skip to content

Commit 4b312d6

Browse files
committed
Handle error of endTransmission
1 parent af337a7 commit 4b312d6

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/PF1550/PF1550_IO.cpp

+8-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,14 @@ void PF1550_IO::readRegister(Register const reg_addr, uint8_t * data)
5252
{
5353
_wire->beginTransmission(_i2c_addr);
5454
_wire->write(static_cast<uint8_t>(reg_addr));
55-
_wire->endTransmission(false); /* No Stop. */
55+
56+
/* No Stop. */
57+
if(_wire->endTransmission(false) != 0) {
58+
if (_debug) {
59+
_debug->println("PF1550_IO::readRegister: endTransmission failed");
60+
}
61+
return;
62+
}
5663

5764
_wire->requestFrom(_i2c_addr, 1, true);
5865
while (_wire->available() < 1) { }

0 commit comments

Comments
 (0)