We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 522beff commit 6c9fc4fCopy full SHA for 6c9fc4f
libraries/Wire/src/utility/twi.c
@@ -273,7 +273,9 @@ uint8_t TWI_MasterWriteRead(uint8_t slave_address,
273
master_bytesRead = 0;
274
master_sendStop = send_stop;
275
master_slaveAddress = slave_address<<1;
276
-
+
277
+trigger_action:
278
279
/* If write command, send the START condition + Address +
280
* 'R/_W = 0'
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) {}
305
306
+ // in case of arbitration lost, retry sending
307
+ if (master_result == TWIM_RESULT_ARBITRATION_LOST) {
308
+ goto trigger_action;
309
+ }
310
311
uint8_t ret = 0;
312
if (master_bytesToRead > 0) {
313
// return bytes really read
0 commit comments