22 Wire.beginTransmission(addr);
25 lastError = Wire.endTransmission();
30 Wire.beginTransmission(addr);
32 lastError = Wire.endTransmission();
33 if (lastError) {
return 0; }
35 uint8_t byteCount = Wire.requestFrom(addr, (uint8_t)1);
44 int16_t IMU::testReg(uint8_t addr, uint8_t reg)
46 Wire.beginTransmission(addr);
48 if (Wire.endTransmission() != 0)
53 uint8_t byteCount = Wire.requestFrom(addr, (uint8_t)1);
61 void IMU::readAxes16Bit(uint8_t addr, uint8_t firstReg, vector<int16_t> & v)
63 Wire.beginTransmission(addr);
65 lastError = Wire.endTransmission();
66 if (lastError) {
return; }
68 uint8_t byteCount = (Wire.requestFrom(addr, (uint8_t)6));
74 uint8_t xl = Wire.read();
75 uint8_t xh = Wire.read();
76 uint8_t yl = Wire.read();
77 uint8_t yh = Wire.read();
78 uint8_t zl = Wire.read();
79 uint8_t zh = Wire.read();
82 v.x = (int16_t)(xh << 8 | xl);
83 v.y = (int16_t)(yh << 8 | yl);
84 v.z = (int16_t)(zh << 8 | zl);
void writeReg(uint8_t addr, uint8_t reg, uint8_t value)
Writes an 8-bit sensor register.
uint8_t readReg(uint8_t addr, uint8_t reg)
Reads an 8-bit sensor register.
Top-level namespace for the Pololu3piPlus32U4 library.