MCPcopy Create free account
hub / github.com/SmingHub/Sming / nbrequestFrom

Method nbrequestFrom

Sming/Libraries/I2Cdev/I2Cdev.cpp:1434–1453  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1432 }
1433
1434 void TwoWire::nbrequestFrom(uint8_t address, int quantity, void (*function)(int)) {
1435 // clamp to buffer length
1436 if (quantity > NBWIRE_BUFFER_LENGTH) {
1437 quantity = NBWIRE_BUFFER_LENGTH;
1438 }
1439
1440 // perform blocking read into buffer
1441 twi_cbreadFromDone = function;
1442 twi_readFrom(address, rxBuffer, quantity);
1443 //uint8_t read = twii_WaitForDone();
1444
1445 // set rx buffer iterator vars
1446 //rxBufferIndex = 0;
1447 //rxBufferLength = read;
1448
1449 rxBufferIndex = 0;
1450 rxBufferLength = quantity; // this is a hack
1451
1452 return; //read;
1453 }
1454
1455 uint8_t TwoWire::available(void) {
1456 return rxBufferLength - rxBufferIndex;

Callers

nothing calls this directly

Calls 1

twi_readFromFunction · 0.70

Tested by

no test coverage detected