From: Keith Packard Date: Sun, 19 Aug 2012 04:24:16 +0000 (-0700) Subject: altos: Use split SPI bus for MS5607 sensor X-Git-Tag: 1.1~67^2~31 X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=commitdiff_plain;h=f46d94ca5c969c88dd307d1b684d6fafa2157020 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 --- 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;