Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable ASFR function on ICM426xx driver #9409

Merged
merged 1 commit into from Oct 26, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/main/drivers/accgyro/accgyro_icm42605.c
Expand Up @@ -78,11 +78,13 @@
#define ICM42605_INT_TPULSE_DURATION_100 (0 << ICM42605_INT_TPULSE_DURATION_BIT)
#define ICM42605_INT_TPULSE_DURATION_8 (1 << ICM42605_INT_TPULSE_DURATION_BIT)


#define ICM42605_RA_INT_SOURCE0 0x65
#define ICM42605_UI_DRDY_INT1_EN_DISABLED (0 << 3)
#define ICM42605_UI_DRDY_INT1_EN_ENABLED (1 << 3)

#define ICM42605_INTF_CONFIG1 0x4D
#define ICM42605_INTF_CONFIG1_AFSR_MASK 0xC0
#define ICM42605_INTF_CONFIG1_AFSR_DISABLE 0x40

static void icm42605AccInit(accDev_t *acc)
{
Expand Down Expand Up @@ -190,6 +192,15 @@ static void icm42605AccAndGyroInit(gyroDev_t *gyro)
busWrite(dev, ICM42605_RA_INT_CONFIG1, intConfig1Value);
delay(15);

//Disable AFSR as in BF and Ardupilot
uint8_t intfConfig1Value;
busRead(dev, ICM42605_INTF_CONFIG1, &intfConfig1Value);
intfConfig1Value &= ~ICM42605_INTF_CONFIG1_AFSR_MASK;
intfConfig1Value |= ICM42605_INTF_CONFIG1_AFSR_DISABLE;
busWrite(dev, ICM42605_INTF_CONFIG1, intfConfig1Value);

delay(15);

busSetSpeed(dev, BUS_SPEED_FAST);
}

Expand Down