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,
273
273
master_bytesRead = 0 ;
274
274
master_sendStop = send_stop ;
275
275
master_slaveAddress = slave_address <<1 ;
276
-
276
+
277
+ trigger_action :
278
+
277
279
/* If write command, send the START condition + Address +
278
280
* 'R/_W = 0'
279
281
*/
@@ -301,6 +303,11 @@ uint8_t TWI_MasterWriteRead(uint8_t slave_address,
301
303
/* Arduino requires blocking function */
302
304
while (master_result == TWIM_RESULT_UNKNOWN ) {}
303
305
306
+ // in case of arbitration lost, retry sending
307
+ if (master_result == TWIM_RESULT_ARBITRATION_LOST ) {
308
+ goto trigger_action ;
309
+ }
310
+
304
311
uint8_t ret = 0 ;
305
312
if (master_bytesToRead > 0 ) {
306
313
// return bytes really read
You can’t perform that action at this time.
0 commit comments