Skip to content

Commit 7ebd4c6

Browse files
authored
Add missing FIFO functions
Add missing FIFO functions
2 parents 97913d9 + fb73523 commit 7ebd4c6

File tree

2 files changed

+52
-0
lines changed

2 files changed

+52
-0
lines changed

src/IMU.cpp

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,3 +107,49 @@ void IMU::getAhrsData(float *pitch, float *roll, float *yaw) {
107107
MahonyAHRSupdateIMU(gyroX * DEG_TO_RAD, gyroY * DEG_TO_RAD,
108108
gyroZ * DEG_TO_RAD, accX, accY, accZ, pitch, roll, yaw);
109109
}
110+
111+
void IMU::setFIFOEnable(bool enable_flag) {
112+
if (imuType == IMU_SH200Q) {
113+
Serial.println("IMU_SH200Q: setFIFOEnable() not implemented");
114+
} else if (imuType == IMU_MPU6886) {
115+
M5.Mpu6886.setFIFOEnable(enable_flag);
116+
}
117+
}
118+
119+
uint8_t IMU::ReadFIFO() {
120+
uint8_t read_fifo = 0;
121+
122+
if (imuType == IMU_SH200Q) {
123+
Serial.println("IMU_SH200Q: ReadFIFO() not implemented");
124+
} else if (imuType == IMU_MPU6886) {
125+
read_fifo = M5.Mpu6886.ReadFIFO();
126+
}
127+
return read_fifo;
128+
}
129+
130+
void IMU::ReadFIFOBuff(uint8_t *data_buf, uint16_t length) {
131+
if (imuType == IMU_SH200Q) {
132+
Serial.println("IMU_SH200Q: ReadFIFOBuff() not implemented");
133+
} else if (imuType == IMU_MPU6886) {
134+
M5.Mpu6886.ReadFIFOBuff(data_buf, length);
135+
}
136+
}
137+
138+
uint16_t IMU::ReadFIFOCount() {
139+
uint16_t fifo_count = 0;
140+
141+
if (imuType == IMU_SH200Q) {
142+
Serial.println("IMU_SH200Q: ReadFIFOCount() not implemented");
143+
} else if (imuType == IMU_MPU6886) {
144+
fifo_count = M5.Mpu6886.ReadFIFOCount();
145+
}
146+
return fifo_count;
147+
}
148+
149+
void IMU::RestFIFO() {
150+
if (imuType == IMU_SH200Q) {
151+
Serial.println("IMU_SH200Q: RestFIFO() not implemented");
152+
} else if (imuType == IMU_MPU6886) {
153+
M5.Mpu6886.RestFIFO();
154+
}
155+
}

src/IMU.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ class IMU {
2727

2828
void getAhrsData(float *pitch, float *roll, float *yaw);
2929

30+
void setFIFOEnable(bool enable_flag);
31+
uint8_t ReadFIFO();
32+
void ReadFIFOBuff(uint8_t *data_buf, uint16_t length);
33+
uint16_t ReadFIFOCount();
34+
void RestFIFO();
35+
3036
ImuType imuType;
3137
float aRes, gRes;
3238
};

0 commit comments

Comments
 (0)