mirror of https://github.com/noisymime/Arduino.git
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…
Reference in New Issue