14 if (i2cReadData(Device_ID) == 0x44) {
15 i2cWriteData(Device_CONFIG, 0x02);
17 i2cWriteData(Device_CONFIG, 0x01);
27 int data = (int16_t)(i2cReadData(ROLL_H) << 8 | i2cReadData(ROLL_L));
34 int data = (int16_t)(i2cReadData(PITCH_H) << 8 | i2cReadData(PITCH_L));
41 int data = (int16_t)(i2cReadData(YAW_H) << 8 | i2cReadData(YAW_L));
50 case x: data = (int16_t)(i2cReadData(GYRO_X_H) << 8 | i2cReadData(GYRO_X_L));
break;
51 case y: data = (int16_t)(i2cReadData(GYRO_Y_H) << 8 | i2cReadData(GYRO_Y_L));
break;
52 case z: data = (int16_t)(i2cReadData(GYRO_Z_H) << 8 | i2cReadData(GYRO_Z_L));
break;
63 case x: data = (int16_t)(i2cReadData(ACCEL_X_H) << 8 | i2cReadData(ACCEL_X_L));
break;
64 case y: data = (int16_t)(i2cReadData(ACCEL_Y_H) << 8 | i2cReadData(ACCEL_Y_L));
break;
65 case z: data = (int16_t)(i2cReadData(ACCEL_Z_H) << 8 | i2cReadData(ACCEL_Z_L));
break;
71void MatrixMotion::i2cMUXSelect()
76 _pWire->endTransmission(1);
77 delayMicroseconds(300);
80uint8_t MatrixMotion::i2cReadData(MotionRegType reg)
84 _pWire->endTransmission(1);
93void MatrixMotion::i2cWriteData(MotionRegType reg, uint8_t data)
101 _pWire->endTransmission(1);
Handling Matrix Motion Sensor functions.
#define MatrixMotion_ADDR
bool begin()
Initializes the MatrixMotion sensor.
int getAccel(AxisType axis)
Gets the accelerometer value for a specified axis.
int getGyro(AxisType axis)
Gets the gyro value for a specified axis.
int getRoll()
Gets the roll angle from the motion sensor.
int getYaw()
Gets the yaw angle from the motion sensor.
int getPitch()
Gets the pitch angle from the motion sensor.