MatrixMiniR4 1.1.4
Matrix Mini R4 Arduino Library API Documentation
Loading...
Searching...
No Matches
MiniR4MotionExt.h
Go to the documentation of this file.
1
6#ifndef _MiniR4MotionExt_H_
7#define _MiniR4MotionExt_H_
8
9#include <Arduino.h>
10#include <Wire.h>
11
12#ifndef ADDR_PCA954X
13#define ADDR_PCA954X 0x70
14#endif
15
16#define MatrixMotion_ADDR 0x23
17
18typedef enum __AxisType
19{
20 x = 0,
22 z
24
34{
35private:
36 typedef enum __MotionRegType
37 {
38 Device_ID = 1,
39 Device_CONFIG,
40 ROLL_L,
41 ROLL_H,
42 PITCH_L,
43 PITCH_H,
44 YAW_L,
45 YAW_H,
46 GYRO_X_L,
47 GYRO_X_H,
48 GYRO_Y_L,
49 GYRO_Y_H,
50 GYRO_Z_L,
51 GYRO_Z_H,
52 ACCEL_X_L,
53 ACCEL_X_H,
54 ACCEL_Y_L,
55 ACCEL_Y_H,
56 ACCEL_Z_L,
57 ACCEL_Z_H,
58 } MotionRegType;
59
60 uint8_t i2cReadData(MotionRegType reg);
61 void i2cMUXSelect();
62 void i2cWriteData(MotionRegType reg, uint8_t data);
63
64public:
65 int8_t _ch = 0;
66 TwoWire *_pWire;
67
73 bool begin();
74
80 int getRoll();
81
87 int getPitch();
88
94 int getYaw();
95
102 int getGyro(AxisType axis);
103
110 int getAccel(AxisType axis);
111};
112
113#endif
__AxisType
@ z
@ x
@ y
enum __AxisType AxisType
Class for motion sensing using a Matrix Motion sensor.
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.
TwoWire * _pWire