first cut at turnon scripts for EasyTimer v2
[fw/altos] / src / drivers / ao_mpu6000.c
index dd3da8dee3837f504a6df05d4633a0d5e03bf9cf..e5594a662c6dfcb62f6d11e0acd1a78565bd2ce1 100644 (file)
@@ -32,7 +32,7 @@ static uint8_t        ao_mpu6000_configured;
 
 #if AO_MPU6000_SPI
 
-#define AO_MPU6000_SPI_SPEED   ao_spi_speed(1000000)   /* 1Mhz for all register access */
+#define AO_MPU6000_SPI_SPEED   ao_spi_speed(AO_MPU6000_SPI_BUS, 1000000)       /* 1Mhz for all register access */
 
 #define ao_mpu6000_spi_get()   ao_spi_get(AO_MPU6000_SPI_BUS, AO_MPU6000_SPI_SPEED)
 #define ao_mpu6000_spi_put()   ao_spi_put(AO_MPU6000_SPI_BUS)
@@ -113,7 +113,7 @@ _ao_mpu6000_sample(struct ao_mpu6000_sample *sample)
        /* byte swap */
        while (i--) {
                uint16_t        t = *d;
-               *d++ = (t >> 8) | (t << 8);
+               *d++ = (uint16_t) ((t >> 8) | (t << 8));
        }
 #endif
 }
@@ -357,14 +357,23 @@ static struct ao_task ao_mpu6000_task;
 static void
 ao_mpu6000_show(void)
 {
-       printf ("Accel: %7d %7d %7d Gyro: %7d %7d %7d id %02x\n",
+#ifdef AO_LOG_NORMALIZED
+       printf ("MPU6000: %7d %7d %7d %7d %7d %7d\n",
+               ao_mpu6000_along(&ao_mpu6000_current),
+               ao_mpu6000_across(&ao_mpu6000_current),
+               ao_mpu6000_through(&ao_mpu6000_current),
+               ao_mpu6000_roll(&ao_mpu6000_current),
+               ao_mpu6000_pitch(&ao_mpu6000_current),
+               ao_mpu6000_yaw(&ao_mpu6000_current));
+#else
+       printf ("Accel: %7d %7d %7d Gyro: %7d %7d %7d\n",
                ao_mpu6000_current.accel_x,
                ao_mpu6000_current.accel_y,
                ao_mpu6000_current.accel_z,
                ao_mpu6000_current.gyro_x,
                ao_mpu6000_current.gyro_y,
-               ao_mpu6000_current.gyro_z,
-               mpu_id);
+               ao_mpu6000_current.gyro_z);
+#endif
 }
 
 static const struct ao_cmds ao_mpu6000_cmds[] = {