Skip to content

Commit 1da5171

Browse files
committed
Wire: abort() transaction after timeout
1 parent c38a7bc commit 1da5171

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Diff for: libraries/Wire/Wire.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,10 @@ uint8_t TwoWire::read_from(uint8_t address, uint8_t* data, uint8_t length, unsig
486486
if(bus_status == WIRE_STATUS_RX_COMPLETED) {
487487
return length;
488488
}
489+
490+
if(bus_status == WIRE_STATUS_UNSET) {
491+
m_abort(&m_i2c_ctrl);
492+
}
489493

490494
return 0; /* ???????? return value ??????? */
491495
}
@@ -518,6 +522,7 @@ uint8_t TwoWire::write_to(uint8_t address, uint8_t* data, uint8_t length, unsign
518522
}
519523
else if(bus_status == WIRE_STATUS_UNSET) {
520524
rv = END_TX_TIMEOUT;
525+
m_abort(&m_i2c_ctrl);
521526
}
522527
/* as far as I know is impossible to distinguish between NACK on ADDRESS and
523528
NACK on DATA */

0 commit comments

Comments
 (0)