summaryrefslogtreecommitdiff
path: root/src/drivers/ao_ms5607.c
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2012-08-18 21:24:16 -0700
committerKeith Packard <keithp@keithp.com>2012-08-18 21:24:16 -0700
commitf46d94ca5c969c88dd307d1b684d6fafa2157020 (patch)
treebf932163e77f8323fb8e5ee7ced467c8798973fe /src/drivers/ao_ms5607.c
parenta1a48aa9ee0bf7fa6720b34c0f544485caea7cac (diff)
altos: Use split SPI bus for MS5607 sensor
Leave CS low while releasing the SPI bus when waiting for conversion complete -- other SPI bus users will use another set of pins. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/drivers/ao_ms5607.c')
-rw-r--r--src/drivers/ao_ms5607.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/drivers/ao_ms5607.c b/src/drivers/ao_ms5607.c
index 17fe853b..1b55b7fd 100644
--- a/src/drivers/ao_ms5607.c
+++ b/src/drivers/ao_ms5607.c
@@ -134,11 +134,18 @@ ao_ms5607_get_sample(uint8_t cmd) {
ao_ms5607_start();
ao_spi_send(&cmd, 1, AO_MS5607_SPI_INDEX);
ao_exti_enable(AO_MS5607_MISO_GPIO, AO_MS5607_MISO);
+#if AO_MS5607_PRIVATE_PINS
+ ao_spi_put(AO_MS5607_SPI_INDEX);
+#endif
cli();
while (!ao_ms5607_done)
ao_sleep(&ao_ms5607_done);
sei();
+#if AO_MS5607_PRIVATE_PINS
+ stm_gpio_set(AO_MS5607_CS_GPIO, AO_MS5607_CS, 1);
+#else
ao_ms5607_stop();
+#endif
ao_ms5607_start();
read = AO_MS5607_ADC_READ;