altosui: Add config and pyro tabs to graph widget
[fw/altos] / src / drivers / ao_mpu9250.c
index 09b65bfa749c8cd7de7b1e5f6ff712d5cc602c74..63d8d6d7fe31ffbc32dc8c786dc349df9bfee413 100644 (file)
@@ -35,7 +35,7 @@ static uint8_t        ao_mpu9250_configured;
 #if AO_MPU9250_SPI
 
 #ifndef AO_MPU9250_SPI_SPEED
-#define AO_MPU9250_SPI_SPEED   ao_spi_speed(1000000)   /* 1MHz max SCLK */
+#define AO_MPU9250_SPI_SPEED   ao_spi_speed(AO_MPU9250_SPI_BUS, 1000000)       /* 1MHz max SCLK */
 #endif
 
 #define ao_mpu9250_spi_get()   ao_spi_get(AO_MPU9250_SPI_BUS, AO_MPU9250_SPI_SPEED)
@@ -176,7 +176,7 @@ _ao_mpu9250_sample(struct ao_mpu9250_sample *sample)
        /* byte swap */
        while (i--) {
                uint16_t        t = *d;
-               *d++ = (t >> 8) | (t << 8);
+               *d++ = (uint16_t) ((uint16_t) (t >> 8) | (uint16_t) (t << 8));
        }
 #endif
 }