diff --git a/library.properties b/library.properties index e1c5d82..a70d2c9 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=SparkFun 9DoF IMU Breakout - ICM 20948 - Arduino Library -version=1.2.10 +version=1.2.11 author=SparkFun Electronics maintainer=SparkFun Electronics 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 --git a/src/util/ICM_20948_C.c b/src/util/ICM_20948_C.c index 1e95c68..eaa7826 100644 --- a/src/util/ICM_20948_C.c +++ b/src/util/ICM_20948_C.c @@ -792,7 +792,7 @@ ICM_20948_Status_e ICM_20948_set_sample_rate(ICM_20948_Device_t *pdev, ICM_20948 if (sensors & ICM_20948_Internal_Acc) { retval |= ICM_20948_set_bank(pdev, 2); // Must be in the right bank - uint8_t div1 = (smplrt.a << 8); + uint8_t div1 = (smplrt.a >> 8); // Thank you @yanivamichy #109 uint8_t div2 = (smplrt.a & 0xFF); retval |= ICM_20948_execute_w(pdev, AGB2_REG_ACCEL_SMPLRT_DIV_1, &div1, 1); 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 return result; for (int i = 0; i < icm_20948_DMP_Header_Bytes; i++) { - aShort |= ((uint16_t)fifoBytes[i]) << (8 - (i * 8)); + aShort |= ((uint16_t)fifoBytes[i]) << (8 - (i * 8)); // MSB first } data->header = aShort; // Store the header in data->header 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 uint32_t aWord = 0; for (int i = 0; i < icm_20948_DMP_Step_Detector_Bytes; i++) { - aWord |= ((uint32_t)fifoBytes[i]) << (24 - (i * 8)); + aWord |= ((uint32_t)fifoBytes[i]) << (24 - (i * 8)); // MSB first } data->Pedometer_Timestamp = aWord; fifo_count -= icm_20948_DMP_Step_Detector_Bytes; // Decrement the count