From 53b76efbd2726e54e7c9099cef9c593aabb1a657 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 1 Mar 2018 08:48:18 +1100 Subject: [PATCH] AP_InerialSensor: setup INT_PIN_CFG correctly this restores the behavior lost with the 20789 driver change --- .../AP_InertialSensor/AP_InertialSensor_Invensense.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/libraries/AP_InertialSensor/AP_InertialSensor_Invensense.cpp b/libraries/AP_InertialSensor/AP_InertialSensor_Invensense.cpp index b956eaf1a5..47451bf241 100644 --- a/libraries/AP_InertialSensor/AP_InertialSensor_Invensense.cpp +++ b/libraries/AP_InertialSensor/AP_InertialSensor_Invensense.cpp @@ -298,6 +298,16 @@ 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. We don't do this for the 20789 as + // that sensor has already setup the appropriate config inside the + // baro driver. + if (_mpu_type != Invensense_ICM20789) { + uint8_t v = _register_read(MPUREG_INT_PIN_CFG) | BIT_INT_RD_CLEAR | BIT_LATCH_INT_EN; + 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);