altos: Use split SPI bus for MS5607 sensor
authorKeith Packard <keithp@keithp.com>
Sun, 19 Aug 2012 04:24:16 +0000 (21:24 -0700)
committerKeith Packard <keithp@keithp.com>
Sun, 19 Aug 2012 04:24:16 +0000 (21:24 -0700)
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>
src/drivers/ao_ms5607.c

index 17fe853bc1d336a76cb4f838e7c5289c0cfa6c3e..1b55b7fdeea61d4f99101425fb3f38aed1606a4c 100644 (file)
@@ -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;