altos: Initialize MPU6000 CS pin for SPI mode
authorKeith Packard <keithp@keithp.com>
Tue, 14 May 2013 16:01:49 +0000 (09:01 -0700)
committerKeith Packard <keithp@keithp.com>
Thu, 16 May 2013 05:13:02 +0000 (22:13 -0700)
Without this, we can't talk to the chip very well

Signed-off-by: Keith Packard <keithp@keithp.com>
src/drivers/ao_mpu6000.c
src/telemega-v0.3/ao_pins.h

index c65aecbcc1d363f9db603ea439f7c27b756df47d..fc768cc9ae1cdc166f4add87866d4e505df101f9 100644 (file)
@@ -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
index 88b473cc9f2f495f30f2ccc7ad59164edba537cb..bace585336cca1235b3edeb3e05774cd1d9725d8 100644 (file)
@@ -308,7 +308,7 @@ struct ao_adc {
  * mpu6000
  */
 
-#define HAS_MPU6000            1       
+#define HAS_MPU6000            1
 #define AO_MPU6000_INT_PORT    (&stm_gpioe)
 #define AO_MPU6000_INT_PIN     0
 #define AO_MPU6000_SPI_BUS     AO_SPI_1_PE13_PE14_PE15