MCPcopy Create free account
hub / github.com/crosspoint-reader/crosspoint-reader / readI2CReg16LE

Function readI2CReg16LE

lib/hal/HalGPIO.cpp:36–52  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34}
35
36bool readI2CReg16LE(uint8_t addr, uint8_t reg, uint16_t* outValue) {
37 Wire.beginTransmission(addr);
38 Wire.write(reg);
39 if (Wire.endTransmission(false) != 0) {
40 return false;
41 }
42 if (Wire.requestFrom(addr, static_cast<uint8_t>(2), static_cast<uint8_t>(true)) < 2) {
43 while (Wire.available()) {
44 Wire.read();
45 }
46 return false;
47 }
48 const uint8_t lo = Wire.read();
49 const uint8_t hi = Wire.read();
50 *outValue = (static_cast<uint16_t>(hi) << 8) | lo;
51 return true;
52}
53
54bool readBQ27220CurrentMA(int16_t* outCurrent) {
55 uint16_t raw = 0;

Callers 2

readBQ27220CurrentMAFunction · 0.85
probeBQ27220SignatureFunction · 0.85

Calls 3

writeMethod · 0.45
availableMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected