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

Add support for ICM20789 #7477

Closed
wants to merge 14 commits into from
Closed
Changes from 1 commit
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
16 changes: 3 additions & 13 deletions libraries/AP_InertialSensor/AP_InertialSensor_Invensense.cpp
Expand Up @@ -486,14 +486,6 @@ void AP_InertialSensor_Invensense::start()
_register_write(MPUREG_INT_ENABLE, BIT_RAW_RDY_EN);
hal.scheduler->delay(1);

// clear interrupt on any read, and hold the data ready pin high
// until we clear the interrupt
uint8_t v = _register_read(MPUREG_INT_PIN_CFG) | BIT_INT_RD_CLEAR | BIT_LATCH_INT_EN;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are removing more than you should here. Look at the initial commit on these lines, only the BIT_BYPASS_EN should be removed here (basically revert what was done there).

if (_mpu_type == Invensense_ICM20789) {
v &= BIT_BYPASS_EN;
}
_register_write(MPUREG_INT_PIN_CFG, v);

// now that we have initialised, we set the bus speed to high
_dev->set_speed(AP_HAL::Device::SPEED_HIGH);

Expand Down Expand Up @@ -937,11 +929,9 @@ bool AP_InertialSensor_Invensense::_hardware_init(void)
}

/* bus-dependent initialization */
if ((_dev->bus_type() == AP_HAL::Device::BUS_TYPE_I2C) && (_mpu_type == Invensense_MPU9250)) {
/* Enable I2C bypass to access internal AK8963 */
if (_mpu_type != Invensense_ICM20789) {
_register_write(MPUREG_INT_PIN_CFG, BIT_BYPASS_EN);
}
if ((_dev->bus_type() == AP_HAL::Device::BUS_TYPE_I2C) && (_mpu_type == Invensense_MPU9250 || _mpu_type == Invensense_ICM20789)) {
/* Enable I2C bypass to access internal device */
_register_write(MPUREG_INT_PIN_CFG, BIT_BYPASS_EN);
}


Expand Down