From 8a542e304a49002dc9667f25041184e88e3b861f Mon Sep 17 00:00:00 2001 From: corruptbear Date: Fri, 7 Jun 2024 18:01:17 -0700 Subject: [PATCH] allow disable the data ready interrupts --- software/firmware/src/peripherals/src/imu.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/software/firmware/src/peripherals/src/imu.c b/software/firmware/src/peripherals/src/imu.c index a0526ca8..082dd319 100644 --- a/software/firmware/src/peripherals/src/imu.c +++ b/software/firmware/src/peripherals/src/imu.c @@ -163,11 +163,21 @@ static void enable_data_ready_interrupts(void) i2c_write8(BNO055_PAGE_ID_ADDR, 1); uint8_t int_msk = i2c_read8(INT_MSK)|(ACC_BSX_DRDY | MAG_DRDY | GYR_DRDY); uint8_t int_en = i2c_read8(INT_EN)|(ACC_BSX_DRDY | MAG_DRDY | GYR_DRDY); - i2c_write8(INT_MSK, int_msk); + i2c_write8(INT_MSK, int_msk); i2c_write8(INT_EN, int_en); i2c_write8(BNO055_PAGE_ID_ADDR, 0); } +static void disable_data_ready_interrupts(void) +{ + i2c_write8(BNO055_PAGE_ID_ADDR, 1); + uint8_t int_msk = i2c_read8(INT_MSK) && ~(ACC_BSX_DRDY | MAG_DRDY | GYR_DRDY); + uint8_t int_en = i2c_read8(INT_EN) && ~(ACC_BSX_DRDY | MAG_DRDY | GYR_DRDY); + i2c_write8(INT_MSK, int_msk); + i2c_write8(INT_EN, int_en); + i2c_write8(BNO055_PAGE_ID_ADDR, 0); +} + // Math helper functions ----------------------------------------------------------------------------------------------- void quaternion_to_euler(bno055_quaternion_t quaternion, bno055_euler_t *euler) {