Skip to content

Commit ef64ab0

Browse files
committed
Adding Data Ready Status
1 parent 64f2de9 commit ef64ab0

File tree

4 files changed

+15
-2
lines changed

4 files changed

+15
-2
lines changed

examples/Arduino/Example6_DMP_Quat9_Orientation/Example6_DMP_Quat9_Orientation.ino

+6-1
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,11 @@ void setup() {
241241
// Set the DMP Output Data Rate for Quat9 to 12Hz.
242242
success &= (myICM.setDMPODRrate(DMP_ODR_Reg_Quat9, 12) == ICM_20948_Stat_Ok);
243243

244+
// Set the DMP Data Ready Status register
245+
const uint16_t dsrBits = DMP_Data_ready_Gyro | DMP_Data_ready_Accel | DMP_Data_ready_Secondary_Compass;
246+
const unsigned char drsReg[2] = {(const unsigned char)(dsrBits >> 8), (const unsigned char)(dsrBits & 0xFF)};
247+
success &= (myICM.writeDMPmems(DATA_RDY_STATUS, 2, &drsReg[0]) == ICM_20948_Stat_Ok);
248+
244249
// Enable the FIFO
245250
success &= (myICM.enableFIFO() == ICM_20948_Stat_Ok);
246251

@@ -295,7 +300,7 @@ void loop()
295300
float q2 = ((float)data.Quat9.Data.Q2) / 1073741824.0; // Convert to float. Divide by 2^30
296301
float q3 = ((float)data.Quat9.Data.Q3) / 1073741824.0; // Convert to float. Divide by 2^30
297302

298-
SERIAL_PORT.printf("Q1:%.3f Q2:%.3f Q3:%.3f\r\n", q1, q2, q3);
303+
SERIAL_PORT.printf("Q1:%.3f Q2:%.3f Q3:%.3f Accuracy:%d\r\n", q1, q2, q3, data.Quat9.Data.Accuracy);
299304
}
300305
}
301306

examples/Arduino/Example7_DMP_Quat6_EulerAngles/Example7_DMP_Quat6_EulerAngles.ino

+5
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,11 @@ void setup() {
241241
// Set the DMP Output Data Rate for Quat6 to 12Hz.
242242
//success &= (myICM.setDMPODRrate(DMP_ODR_Reg_Quat6, 12) == ICM_20948_Stat_Ok);
243243

244+
// Set the DMP Data Ready Status register
245+
const uint16_t dsrBits = DMP_Data_ready_Gyro | DMP_Data_ready_Accel;
246+
const unsigned char drsReg[2] = {(const unsigned char)(dsrBits >> 8), (const unsigned char)(dsrBits & 0xFF)};
247+
success &= (myICM.writeDMPmems(DATA_RDY_STATUS, 2, &drsReg[0]) == ICM_20948_Stat_Ok);
248+
244249
// Enable the FIFO
245250
success &= (myICM.enableFIFO() == ICM_20948_Stat_Ok);
246251

keywords.txt

+3
Original file line numberDiff line numberDiff line change
@@ -184,3 +184,6 @@ DMP_header2_bitmap_Fsync LITERAL1
184184
DMP_header2_bitmap_Compass_Accuracy LITERAL1
185185
DMP_header2_bitmap_Gyro_Accuracy LITERAL1
186186
DMP_header2_bitmap_Accel_Accuracy LITERAL1
187+
DMP_Data_ready_Gyro LITERAL1
188+
DMP_Data_ready_Accel LITERAL1
189+
DMP_Data_ready_Secondary_Compass LITERAL1

src/util/ICM_20948_DMP.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ enum DMP_Data_Ready_Status_Register_Bits
392392
{
393393
DMP_Data_ready_Gyro = 0x0001, // Gyro samples available
394394
DMP_Data_ready_Accel = 0x0002, // Accel samples available
395-
DMP_Data_ready_Secondary = 0x0008 // Secondary samples available
395+
DMP_Data_ready_Secondary_Compass = 0x0008 // Secondary compass samples available
396396
};
397397

398398
enum DMP_Data_Output_Control_1_Register_Bits

0 commit comments

Comments
 (0)