Skip to content

Commit 49959e8

Browse files
committed
v1.2.11 - fix #109
1 parent 368aa6b commit 49959e8

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Diff for: library.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=SparkFun 9DoF IMU Breakout - ICM 20948 - Arduino Library
2-
version=1.2.10
2+
version=1.2.11
33
author=SparkFun Electronics <[email protected]>
44
maintainer=SparkFun Electronics <sparkfun.com>
55
sentence=Use the low-power high-resolution ICM 20948 9 DoF IMU from Invensense with I2C or SPI. Version 1.2 of the library includes support for the InvenSense Digital Motion Processor (DMP™).

Diff for: src/util/ICM_20948_C.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -792,7 +792,7 @@ ICM_20948_Status_e ICM_20948_set_sample_rate(ICM_20948_Device_t *pdev, ICM_20948
792792
if (sensors & ICM_20948_Internal_Acc)
793793
{
794794
retval |= ICM_20948_set_bank(pdev, 2); // Must be in the right bank
795-
uint8_t div1 = (smplrt.a << 8);
795+
uint8_t div1 = (smplrt.a >> 8); // Thank you @yanivamichy #109
796796
uint8_t div2 = (smplrt.a & 0xFF);
797797
retval |= ICM_20948_execute_w(pdev, AGB2_REG_ACCEL_SMPLRT_DIV_1, &div1, 1);
798798
retval |= ICM_20948_execute_w(pdev, AGB2_REG_ACCEL_SMPLRT_DIV_2, &div2, 1);
@@ -1977,7 +1977,7 @@ ICM_20948_Status_e inv_icm20948_read_dmp_data(ICM_20948_Device_t *pdev, icm_2094
19771977
return result;
19781978
for (int i = 0; i < icm_20948_DMP_Header_Bytes; i++)
19791979
{
1980-
aShort |= ((uint16_t)fifoBytes[i]) << (8 - (i * 8));
1980+
aShort |= ((uint16_t)fifoBytes[i]) << (8 - (i * 8)); // MSB first
19811981
}
19821982
data->header = aShort; // Store the header in data->header
19831983
fifo_count -= icm_20948_DMP_Header_Bytes; // Decrement the count
@@ -2248,7 +2248,7 @@ ICM_20948_Status_e inv_icm20948_read_dmp_data(ICM_20948_Device_t *pdev, icm_2094
22482248
uint32_t aWord = 0;
22492249
for (int i = 0; i < icm_20948_DMP_Step_Detector_Bytes; i++)
22502250
{
2251-
aWord |= ((uint32_t)fifoBytes[i]) << (24 - (i * 8));
2251+
aWord |= ((uint32_t)fifoBytes[i]) << (24 - (i * 8)); // MSB first
22522252
}
22532253
data->Pedometer_Timestamp = aWord;
22542254
fifo_count -= icm_20948_DMP_Step_Detector_Bytes; // Decrement the count

0 commit comments

Comments
 (0)