summaryrefslogtreecommitdiff
path: root/src/drivers/ao_ms5607.c
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2013-08-26 18:43:20 -0700
committerKeith Packard <keithp@keithp.com>2013-08-26 18:47:27 -0700
commit7e941695aa27e5eaf453ca1128b8d835472410a4 (patch)
treeba7c86e1d160824330cb584e4809ac828309e052 /src/drivers/ao_ms5607.c
parent9b9acb88aa97e8565cdf9342fc59a5aee08e3d34 (diff)
altos: Check for MS5607 MISO low before sleeping
If the MISO line goes low before we manage to configure the interrupts, we'll miss it entirely unless we check the pin explicitly. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/drivers/ao_ms5607.c')
-rw-r--r--src/drivers/ao_ms5607.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/drivers/ao_ms5607.c b/src/drivers/ao_ms5607.c
index 8b2b6333..58ab9197 100644
--- a/src/drivers/ao_ms5607.c
+++ b/src/drivers/ao_ms5607.c
@@ -140,7 +140,8 @@ ao_ms5607_get_sample(uint8_t cmd) {
ao_spi_put(AO_MS5607_SPI_INDEX);
#endif
ao_arch_block_interrupts();
- while (!ao_ms5607_done)
+ while (!ao_gpio_get(AO_MS5607_MISO_PORT, AO_MS5607_MISO_PIN, AO_MS5607_MISO) &&
+ !ao_ms5607_done)
ao_sleep((void *) &ao_ms5607_done);
ao_arch_release_interrupts();
#if AO_MS5607_PRIVATE_PINS