Skip to content

Commit

Permalink
[Spinal][IMU] workaround to use internal DLPF of ICM20948.
Browse files Browse the repository at this point in the history
  • Loading branch information
sugihara-16 committed May 15, 2024
1 parent 327d54f commit 013fa53
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ void ICM20948::gyroInit(void)
spiModeEnable(); // Use only SPI mode

/* 3.Gyro initialization (Do not change following order) */
setGyroLpf(0);
setGyroLpf(3);
setGyroSampleRate(0);
setGyroFullScale(_2000dps);
}
Expand All @@ -65,7 +65,7 @@ void ICM20948::accInit (void)
{
HAL_Delay(100);
/* 5.Acc initialization (Do not change following order) */
setAccelLpf(0);
setAccelLpf(6);
setAccelSampleRate(0);
setAccelFullScale(_8g);
}
Expand Down Expand Up @@ -313,14 +313,16 @@ void ICM20948::odrAlignEnable()

void ICM20948::setGyroLpf(uint8_t config)
{
uint8_t new_val = config << 3;
readSingleIcm20948(ub_2, B2_GYRO_CONFIG_1);
uint8_t new_val = single_adc_ | (config << 3);

writeSingleIcm20948(ub_2, B2_GYRO_CONFIG_1, new_val);
}

void ICM20948::setAccelLpf(uint8_t config)
{
uint8_t new_val = config << 3;
readSingleIcm20948(ub_2, B2_ACCEL_CONFIG);
uint8_t new_val = single_adc_ | (config << 3);

writeSingleIcm20948(ub_2, B2_ACCEL_CONFIG, new_val);
}
Expand Down

0 comments on commit 013fa53

Please sign in to comment.