File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
libraries/Wire/src/utility Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -273,7 +273,9 @@ uint8_t TWI_MasterWriteRead(uint8_t slave_address,
273273 master_bytesRead = 0 ;
274274 master_sendStop = send_stop ;
275275 master_slaveAddress = slave_address <<1 ;
276-
276+
277+ trigger_action :
278+
277279 /* If write command, send the START condition + Address +
278280 * 'R/_W = 0'
279281 */
@@ -301,6 +303,11 @@ uint8_t TWI_MasterWriteRead(uint8_t slave_address,
301303 /* Arduino requires blocking function */
302304 while (master_result == TWIM_RESULT_UNKNOWN ) {}
303305
306+ // in case of arbitration lost, retry sending
307+ if (master_result == TWIM_RESULT_ARBITRATION_LOST ) {
308+ goto trigger_action ;
309+ }
310+
304311 uint8_t ret = 0 ;
305312 if (master_bytesToRead > 0 ) {
306313 // return bytes really read
You can’t perform that action at this time.
0 commit comments