From 46058eac93287f6ddfb71aa32c7abc27c189a5f6 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Thu, 20 Feb 2020 21:39:16 -0800 Subject: [PATCH] altos: Enable bmx160 acc/gyr before configuring Signed-off-by: Keith Packard --- src/drivers/ao_bmx160.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/drivers/ao_bmx160.c b/src/drivers/ao_bmx160.c index f206bfcf..0cb66384 100644 --- a/src/drivers/ao_bmx160.c +++ b/src/drivers/ao_bmx160.c @@ -195,6 +195,12 @@ _ao_bmx160_setup(void) /* Force SPI mode */ _ao_bmx160_reg_write(BMX160_NV_CONF, 1 << BMX160_NV_CONF_SPI_EN); + /* Enable acc and gyr + */ + + _ao_bmx160_cmd(BMX160_CMD_ACC_SET_PMU_MODE(BMX160_PMU_STATUS_ACC_PMU_STATUS_NORMAL)); + _ao_bmx160_cmd(BMX160_CMD_GYR_SET_PMU_MODE(BMX160_PMU_STATUS_GYR_PMU_STATUS_NORMAL)); + /* Configure accelerometer: * * undersampling disabled @@ -276,11 +282,6 @@ _ao_bmx160_setup(void) (0 << BMX160_MAG_IF_0_MAG_OFFSET) | (0 << BMX160_MAG_IF_0_MAG_RD_BURST)); - /* Enable acc and gyr - */ - - _ao_bmx160_cmd(BMX160_CMD_ACC_SET_PMU_MODE(BMX160_PMU_STATUS_ACC_PMU_STATUS_NORMAL)); - _ao_bmx160_cmd(BMX160_CMD_GYR_SET_PMU_MODE(BMX160_PMU_STATUS_GYR_PMU_STATUS_NORMAL)); ao_bmx160_configured = 1; } -- 2.30.2