Skip to content

Commit

Permalink
ICM426XX - Disable AFSR - use spiReadRegMsk
Browse files Browse the repository at this point in the history
  • Loading branch information
nerdCopter committed Oct 24, 2023
1 parent 3b99d9f commit 9860276
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/drivers/accgyro/accgyro_spi_icm426xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ void icm426xxGyroInit(gyroDev_t *gyro)

spiBusWriteRegister(&gyro->bus, ICM426XX_RA_INT_SOURCE0, ICM426XX_UI_DRDY_INT1_EN_ENABLED);

uint8_t intConfig1Value = spiBusReadRegister(&gyro->bus, ICM426XX_RA_INT_CONFIG1);
uint8_t intConfig1Value = spiReadRegMsk(&gyro->bus, ICM426XX_RA_INT_CONFIG1);
// Datasheet says: "User should change setting to 0 from default setting of 1, for proper INT1 and INT2 pin operation"
intConfig1Value &= ~(1 << ICM426XX_INT_ASYNC_RESET_BIT);
intConfig1Value |= (ICM426XX_INT_TPULSE_DURATION_8 | ICM426XX_INT_TDEASSERT_DISABLED);
Expand All @@ -298,7 +298,7 @@ void icm426xxGyroInit(gyroDev_t *gyro)

// Disable AFSR to prevent stalls in gyro output
// ICM426XX_INTF_CONFIG1 location in user bank 0
uint8_t intfConfig1Value = spiBusReadRegister(&gyro->bus, ICM426XX_INTF_CONFIG1);
uint8_t intfConfig1Value = spiReadRegMsk(&gyro->bus, ICM426XX_INTF_CONFIG1);
intfConfig1Value &= ~ICM426XX_INTF_CONFIG1_AFSR_MASK;
intfConfig1Value |= ICM426XX_INTF_CONFIG1_AFSR_DISABLE;
spiBusWriteRegister(&gyro->bus, ICM426XX_INTF_CONFIG1, intfConfig1Value);
Expand Down

0 comments on commit 9860276

Please sign in to comment.