projects
/
fw
/
altos
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
altos: Add timeout in MS5607 get_sample code
[fw/altos]
/
src
/
drivers
/
ao_mpu9250.c
diff --git
a/src/drivers/ao_mpu9250.c
b/src/drivers/ao_mpu9250.c
index 1b31edf4611754fe1b8c8d8fe52562b161e8579e..a77abf98dfe7bcfa2d6ce3b8267b1571dd7d642b 100644
(file)
--- a/
src/drivers/ao_mpu9250.c
+++ b/
src/drivers/ao_mpu9250.c
@@
-34,7
+34,11
@@
static uint8_t ao_mpu9250_configured;
#if AO_MPU9250_SPI
#if AO_MPU9250_SPI
-#define ao_mpu9250_spi_get() ao_spi_get(AO_MPU9250_SPI_BUS, AO_SPI_SPEED_1MHz)
+#ifndef AO_MPU9250_SPI_SPEED
+#define AO_MPU9250_SPI_SPEED ao_spi_speed(1000000) /* 1MHz max SCLK */
+#endif
+
+#define ao_mpu9250_spi_get() ao_spi_get(AO_MPU9250_SPI_BUS, AO_MPU9250_SPI_SPEED)
#define ao_mpu9250_spi_put() ao_spi_put(AO_MPU9250_SPI_BUS)
#define ao_mpu9250_spi_start() ao_spi_set_cs(AO_MPU9250_SPI_CS_PORT, \
#define ao_mpu9250_spi_put() ao_spi_put(AO_MPU9250_SPI_BUS)
#define ao_mpu9250_spi_start() ao_spi_set_cs(AO_MPU9250_SPI_CS_PORT, \
@@
-172,7
+176,7
@@
_ao_mpu9250_sample(struct ao_mpu9250_sample *sample)
/* byte swap */
while (i--) {
uint16_t t = *d;
/* 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
}
}
#endif
}
@@
-559,7
+563,7
@@
ao_mpu9250_init(void)
*/
ao_cur_task = &ao_mpu9250_task;
*/
ao_cur_task = &ao_mpu9250_task;
- ao_
spi_get(AO_MPU9250_SPI_BUS, AO_SPI_SPEED_1MHz
);
+ ao_
mpu9250_spi_get(
);
ao_cur_task = NULL;
#endif
ao_cmd_register(&ao_mpu9250_cmds[0]);
ao_cur_task = NULL;
#endif
ao_cmd_register(&ao_mpu9250_cmds[0]);