mirror of
https://github.com/arduino/Arduino.git
synced 2025-01-29 18:52:13 +01:00
Merge pull request #1869 from kevin-pololu/due-wire-available
SAM Wire: fixed NACK/timeout behavior of requestFrom() and available()
This commit is contained in:
commit
98d0a72fdd
@ -143,8 +143,10 @@ uint8_t TwoWire::requestFrom(uint8_t address, uint8_t quantity, uint8_t sendStop
|
||||
if (readed + 1 == quantity)
|
||||
TWI_SendSTOPCondition( twi);
|
||||
|
||||
TWI_WaitByteReceived(twi, RECV_TIMEOUT);
|
||||
rxBuffer[readed++] = TWI_ReadByte(twi);
|
||||
if (TWI_WaitByteReceived(twi, RECV_TIMEOUT))
|
||||
rxBuffer[readed++] = TWI_ReadByte(twi);
|
||||
else
|
||||
break;
|
||||
} while (readed < quantity);
|
||||
TWI_WaitTransferComplete(twi, RECV_TIMEOUT);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user