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

Method _readRegister

libraries/CHT8305/CHT8305.cpp:421–442  ·  view source on GitHub ↗

/////////////////////////////////////////// PRIVATE

Source from the content-addressed store, hash-verified

419// PRIVATE
420//
421int CHT8305::_readRegister(uint8_t reg, uint8_t * buf, uint8_t size)
422{
423 _wire->beginTransmission(_address);
424 _wire->write(reg);
425 int n = _wire->endTransmission();
426 if (n != 0) return CHT8305_ERROR_I2C;
427
428 if (reg == CHT8305_REG_TEMPERATURE) // wait for conversion...
429 {
430 delay(_conversionDelay); // 2x 6.5 ms @ 14 bit = 14 (10 works).
431 }
432
433 n = _wire->requestFrom(_address, size);
434 if (n == size)
435 {
436 for (uint8_t i = 0; i < size; i++)
437 {
438 buf[i] = _wire->read();
439 }
440 }
441 return CHT8305_OK;
442}
443
444
445int CHT8305::_writeRegister(uint8_t reg, uint8_t * buf, uint8_t size)

Callers

nothing calls this directly

Calls 2

writeMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected