| 1414 | } |
| 1415 | |
| 1416 | uint8_t TwoWire::requestFrom(uint8_t address, int quantity, uint16_t timeout) { |
| 1417 | // clamp to buffer length |
| 1418 | if (quantity > NBWIRE_BUFFER_LENGTH) { |
| 1419 | quantity = NBWIRE_BUFFER_LENGTH; |
| 1420 | } |
| 1421 | |
| 1422 | // perform blocking read into buffer |
| 1423 | twi_cbreadFromDone = NULL; |
| 1424 | twi_readFrom(address, rxBuffer, quantity); |
| 1425 | uint8_t read = twii_WaitForDone(timeout); |
| 1426 | |
| 1427 | // set rx buffer iterator vars |
| 1428 | rxBufferIndex = 0; |
| 1429 | rxBufferLength = read; |
| 1430 | |
| 1431 | return read; |
| 1432 | } |
| 1433 | |
| 1434 | void TwoWire::nbrequestFrom(uint8_t address, int quantity, void (*function)(int)) { |
| 1435 | // clamp to buffer length |