MCPcopy Create free account
hub / github.com/RobTillaart/Arduino / readBytes

Method readBytes

libraries/SHT2x/SHT2x.cpp:566–586  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

564
565
566bool SHT2x::readBytes(uint8_t n, uint8_t *val, uint8_t maxDuration)
567{
568 _wire->requestFrom((uint8_t)SHT2x_ADDRESS, (uint8_t) n);
569 uint32_t start = millis();
570 while (_wire->available() < n)
571 {
572 if (millis() - start > maxDuration)
573 {
574 _error = SHT2x_ERR_READBYTES;
575 return false;
576 }
577 yield();
578 }
579
580 for (uint8_t i = 0; i < n; i++)
581 {
582 val[i] = _wire->read();
583 }
584 _error = SHT2x_OK;
585 return true;
586}
587
588
589////////////////////////////////////////////////////////

Callers

nothing calls this directly

Calls 2

availableMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected