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

Method getRegister

libraries/GY521/GY521.cpp:439–456  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

437
438
439uint8_t GY521::getRegister(uint8_t reg)
440{
441 _wire->beginTransmission(_address);
442 _wire->write(reg);
443 if (_wire->endTransmission() != 0)
444 {
445 _error = GY521_ERROR_WRITE;
446 return _error;
447 }
448 uint8_t n = _wire->requestFrom(_address, (uint8_t) 1);
449 if (n != 1)
450 {
451 _error = GY521_ERROR_READ;
452 return _error;
453 }
454 uint8_t val = _wire->read();
455 return val;
456}
457
458
459// to read register of 2 bytes.

Callers

nothing calls this directly

Calls 2

writeMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected