@@ -1186,25 +1186,31 @@ ICM_20948_Status_e ICM_20948_set_dmp_start_address(ICM_20948_Device_t *pdev, uns
1186
1186
if (pdev -> _dmp_firmware_available == false)
1187
1187
return ICM_20948_Stat_DMPNotSupported ;
1188
1188
1189
- unsigned char data_output_control_reg1 [2 ];
1189
+ unsigned char start_address [2 ];
1190
1190
1191
- data_output_control_reg1 [0 ] = (unsigned char )(address >> 8 );
1192
- data_output_control_reg1 [1 ] = (unsigned char )(address & 0xff );
1191
+ start_address [0 ] = (unsigned char )(address >> 8 );
1192
+ start_address [1 ] = (unsigned char )(address & 0xff );
1193
1193
1194
- result = ICM_20948_sleep (pdev , false); // Make sure chip is awake
1195
- if (result != ICM_20948_Stat_Ok )
1196
- {
1197
- return result ;
1198
- }
1194
+ // result = ICM_20948_sleep(pdev, false); // Make sure chip is awake
1195
+ // if (result != ICM_20948_Stat_Ok)
1196
+ // {
1197
+ // return result;
1198
+ // }
1199
+ //
1200
+ // result = ICM_20948_low_power(pdev, false); // Make sure chip is not in low power state
1201
+ // if (result != ICM_20948_Stat_Ok)
1202
+ // {
1203
+ // return result;
1204
+ // }
1199
1205
1200
- result = ICM_20948_low_power (pdev , false ); // Make sure chip is not in low power state
1206
+ result = ICM_20948_set_bank (pdev , 2 ); // Set bank 2
1201
1207
if (result != ICM_20948_Stat_Ok )
1202
1208
{
1203
1209
return result ;
1204
1210
}
1205
1211
1206
1212
// Write the sensor control bits into memory address AGB2_REG_PRGM_START_ADDRH
1207
- result = inv_icm20948_write_mems (pdev , AGB2_REG_PRGM_START_ADDRH , 2 , ( const unsigned char * ) & data_output_control_reg1 );
1213
+ result = ICM_20948_execute_w (pdev , AGB2_REG_PRGM_START_ADDRH , ( uint8_t * ) start_address , 2 );
1208
1214
1209
1215
return result ;
1210
1216
}
@@ -1380,57 +1386,57 @@ ICM_20948_Status_e inv_icm20948_set_dmp_sensor_period(ICM_20948_Device_t *pdev,
1380
1386
}
1381
1387
1382
1388
// Set the ODR registers and clear the ODR counters
1383
- if (delta & DMP_Data_Output_Control_1_Compass_Calibr > 0 )
1389
+ if (( delta & DMP_Data_Output_Control_1_Compass_Calibr ) > 0 )
1384
1390
{
1385
1391
result |= inv_icm20948_write_mems (pdev , ODR_CPASS_CALIBR , 2 , (const unsigned char * )& odr_reg_val );
1386
1392
result |= inv_icm20948_write_mems (pdev , ODR_CNTR_CPASS_CALIBR , 2 , (const unsigned char * )& odr_count_zero );
1387
1393
}
1388
- if (delta & DMP_Data_Output_Control_1_Gyro_Calibr > 0 )
1394
+ if (( delta & DMP_Data_Output_Control_1_Gyro_Calibr ) > 0 )
1389
1395
{
1390
1396
result |= inv_icm20948_write_mems (pdev , ODR_GYRO_CALIBR , 2 , (const unsigned char * )& odr_reg_val );
1391
1397
result |= inv_icm20948_write_mems (pdev , ODR_CNTR_GYRO_CALIBR , 2 , (const unsigned char * )& odr_count_zero );
1392
1398
}
1393
- if (delta & DMP_Data_Output_Control_1_Pressure > 0 )
1399
+ if (( delta & DMP_Data_Output_Control_1_Pressure ) > 0 )
1394
1400
{
1395
1401
result |= inv_icm20948_write_mems (pdev , ODR_PRESSURE , 2 , (const unsigned char * )& odr_reg_val );
1396
1402
result |= inv_icm20948_write_mems (pdev , ODR_CNTR_PRESSURE , 2 , (const unsigned char * )& odr_count_zero );
1397
1403
}
1398
- if (delta & DMP_Data_Output_Control_1_Geomag > 0 )
1404
+ if (( delta & DMP_Data_Output_Control_1_Geomag ) > 0 )
1399
1405
{
1400
1406
result |= inv_icm20948_write_mems (pdev , ODR_GEOMAG , 2 , (const unsigned char * )& odr_reg_val );
1401
1407
result |= inv_icm20948_write_mems (pdev , ODR_CNTR_GEOMAG , 2 , (const unsigned char * )& odr_count_zero );
1402
1408
}
1403
- if (delta & DMP_Data_Output_Control_1_PQuat6 > 0 )
1409
+ if (( delta & DMP_Data_Output_Control_1_PQuat6 ) > 0 )
1404
1410
{
1405
1411
result |= inv_icm20948_write_mems (pdev , ODR_PQUAT6 , 2 , (const unsigned char * )& odr_reg_val );
1406
1412
result |= inv_icm20948_write_mems (pdev , ODR_CNTR_PQUAT6 , 2 , (const unsigned char * )& odr_count_zero );
1407
1413
}
1408
- if (delta & DMP_Data_Output_Control_1_Quat9 > 0 )
1414
+ if (( delta & DMP_Data_Output_Control_1_Quat9 ) > 0 )
1409
1415
{
1410
1416
result |= inv_icm20948_write_mems (pdev , ODR_QUAT9 , 2 , (const unsigned char * )& odr_reg_val );
1411
1417
result |= inv_icm20948_write_mems (pdev , ODR_CNTR_QUAT9 , 2 , (const unsigned char * )& odr_count_zero );
1412
1418
}
1413
- if (delta & DMP_Data_Output_Control_1_Quat6 > 0 )
1419
+ if (( delta & DMP_Data_Output_Control_1_Quat6 ) > 0 )
1414
1420
{
1415
1421
result |= inv_icm20948_write_mems (pdev , ODR_QUAT6 , 2 , (const unsigned char * )& odr_reg_val );
1416
1422
result |= inv_icm20948_write_mems (pdev , ODR_CNTR_QUAT6 , 2 , (const unsigned char * )& odr_count_zero );
1417
1423
}
1418
- if (delta & DMP_Data_Output_Control_1_ALS > 0 )
1424
+ if (( delta & DMP_Data_Output_Control_1_ALS ) > 0 )
1419
1425
{
1420
1426
result |= inv_icm20948_write_mems (pdev , ODR_ALS , 2 , (const unsigned char * )& odr_reg_val );
1421
1427
result |= inv_icm20948_write_mems (pdev , ODR_CNTR_ALS , 2 , (const unsigned char * )& odr_count_zero );
1422
1428
}
1423
- if (delta & DMP_Data_Output_Control_1_Compass > 0 )
1429
+ if (( delta & DMP_Data_Output_Control_1_Compass ) > 0 )
1424
1430
{
1425
1431
result |= inv_icm20948_write_mems (pdev , ODR_CPASS , 2 , (const unsigned char * )& odr_reg_val );
1426
1432
result |= inv_icm20948_write_mems (pdev , ODR_CNTR_CPASS , 2 , (const unsigned char * )& odr_count_zero );
1427
1433
}
1428
- if (delta & DMP_Data_Output_Control_1_Gyro > 0 )
1434
+ if (( delta & DMP_Data_Output_Control_1_Gyro ) > 0 )
1429
1435
{
1430
1436
result |= inv_icm20948_write_mems (pdev , ODR_GYRO , 2 , (const unsigned char * )& odr_reg_val );
1431
1437
result |= inv_icm20948_write_mems (pdev , ODR_CNTR_GYRO , 2 , (const unsigned char * )& odr_count_zero );
1432
1438
}
1433
- if (delta & DMP_Data_Output_Control_1_Accel > 0 )
1439
+ if (( delta & DMP_Data_Output_Control_1_Accel ) > 0 )
1434
1440
{
1435
1441
result |= inv_icm20948_write_mems (pdev , ODR_ACCEL , 2 , (const unsigned char * )& odr_reg_val );
1436
1442
result |= inv_icm20948_write_mems (pdev , ODR_CNTR_ACCEL , 2 , (const unsigned char * )& odr_count_zero );
@@ -1502,10 +1508,10 @@ ICM_20948_Status_e inv_icm20948_enable_dmp_sensor_int(ICM_20948_Device_t *pdev,
1502
1508
if (delta == 0xFFFF )
1503
1509
return ICM_20948_Stat_SensorNotSupported ;
1504
1510
1505
- unsigned char data_output_control_reg1 [2 ];
1511
+ unsigned char data_intr_ctl [2 ];
1506
1512
1507
- data_output_control_reg1 [0 ] = (unsigned char )(delta >> 8 );
1508
- data_output_control_reg1 [1 ] = (unsigned char )(delta & 0xff );
1513
+ data_intr_ctl [0 ] = (unsigned char )(delta >> 8 );
1514
+ data_intr_ctl [1 ] = (unsigned char )(delta & 0xff );
1509
1515
1510
1516
result = ICM_20948_sleep (pdev , false); // Make sure chip is awake
1511
1517
if (result != ICM_20948_Stat_Ok )
@@ -1520,7 +1526,7 @@ ICM_20948_Status_e inv_icm20948_enable_dmp_sensor_int(ICM_20948_Device_t *pdev,
1520
1526
}
1521
1527
1522
1528
// Write the sensor control bits into memory address DATA_OUT_CTL1
1523
- result = inv_icm20948_write_mems (pdev , DATA_INTR_CTL , 2 , (const unsigned char * )& data_output_control_reg1 );
1529
+ result = inv_icm20948_write_mems (pdev , DATA_INTR_CTL , 2 , (const unsigned char * )& data_intr_ctl );
1524
1530
1525
1531
// result = ICM_20948_low_power(pdev, true); // Put chip into low power state
1526
1532
// if (result != ICM_20948_Stat_Ok)
0 commit comments