summaryrefslogtreecommitdiff
path: root/src/drivers/ao_mpu6000.c
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2013-05-14 09:01:49 -0700
committerKeith Packard <keithp@keithp.com>2013-05-15 22:13:02 -0700
commit9beacd77b3e8106e036e50a67312dfee414fbc51 (patch)
tree386eb0bcaa6a911ee187ef2dc08195551356a508 /src/drivers/ao_mpu6000.c
parent6d553230903ddd0ec522c07be0df975b38ef23d3 (diff)
altos: Initialize MPU6000 CS pin for SPI mode
Without this, we can't talk to the chip very well Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/drivers/ao_mpu6000.c')
-rw-r--r--src/drivers/ao_mpu6000.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/drivers/ao_mpu6000.c b/src/drivers/ao_mpu6000.c
index c65aecbc..fc768cc9 100644
--- a/src/drivers/ao_mpu6000.c
+++ b/src/drivers/ao_mpu6000.c
@@ -19,6 +19,8 @@
#include <ao_mpu6000.h>
#include <ao_exti.h>
+#if HAS_MPU6000
+
static uint8_t ao_mpu6000_wake;
static uint8_t ao_mpu6000_configured;
@@ -326,5 +328,9 @@ ao_mpu6000_init(void)
ao_mpu6000_configured = 0;
ao_add_task(&ao_mpu6000_task, ao_mpu6000, "mpu6000");
+#ifndef AO_MPU6000_I2C_INDEX
+ ao_spi_init_cs(AO_MPU6000_SPI_CS_PORT, (1 << AO_MPU6000_SPI_CS_PIN));
+#endif
ao_cmd_register(&ao_mpu6000_cmds[0]);
}
+#endif