From: Keith Packard Date: Sun, 13 Nov 2022 07:35:40 +0000 (-0800) Subject: altos/ms5607: Fixup ms5607 changes for other chips X-Git-Tag: 1.9.13~1^2~26^2~4 X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=commitdiff_plain;h=b4960336c0ae960bee40fdd337e58fcc8846ac87 altos/ms5607: Fixup ms5607 changes for other chips A couple of chips don't bother providing duplex, so allow for that. Signed-off-by: Keith Packard --- diff --git a/src/drivers/ao_ms5607.c b/src/drivers/ao_ms5607.c index 1e4cd159..1cddcaf5 100644 --- a/src/drivers/ao_ms5607.c +++ b/src/drivers/ao_ms5607.c @@ -178,9 +178,13 @@ ao_ms5607_get_sample(uint8_t cmd) { #endif ao_ms5607_start(); - memset(reply, 0, sizeof(reply)); reply[0] = AO_MS5607_ADC_READ; - ao_spi_duplex(&reply, &reply, 6, AO_MS5607_SPI_INDEX); +#if defined(AO_SPI_DUPLEX) && AO_SPI_DUPLEX == 0 + ao_spi_send(reply, 1, AO_MS5607_SPI_INDEX); + ao_spi_recv(reply+1, 3, AO_MS5607_SPI_INDEX); +#else + ao_spi_duplex(&reply, &reply, 4, AO_MS5607_SPI_INDEX); +#endif ao_ms5607_stop(); return ((uint32_t) reply[1] << 16) | ((uint32_t) reply[2] << 8) | (uint32_t) reply[3];