From: Keith Packard Date: Thu, 2 Feb 2023 01:59:28 +0000 (-0800) Subject: altos/drivers: Use spi duplex to fetch register values X-Git-Tag: 1.9.14~1^2~3 X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=commitdiff_plain;h=fe99a50a7c1b4834193bbb73fbfd1b0e49b7ff45 altos/drivers: Use spi duplex to fetch register values We read register values during regular operation, so let's improve performance a bit by making this faster. Signed-off-by: Keith Packard --- diff --git a/src/drivers/ao_cc1200.c b/src/drivers/ao_cc1200.c index 799f808f..b295d054 100644 --- a/src/drivers/ao_cc1200.c +++ b/src/drivers/ao_cc1200.c @@ -65,7 +65,7 @@ extern const uint32_t ao_radio_cal; static uint8_t ao_radio_reg_read(uint16_t addr) { - uint8_t data[2]; + uint8_t data[3]; uint8_t d; #if CC1200_TRACE @@ -84,13 +84,12 @@ ao_radio_reg_read(uint16_t addr) d = 1; } ao_radio_select(); - ao_radio_spi_send(data, d); - ao_radio_spi_recv(data, 1); + ao_radio_duplex(data, data, d + 1); ao_radio_deselect(); #if CC1200_TRACE - printf (" %02x\n", data[0]); + printf (" %02x\n", data[d]); #endif - return data[0]; + return data[d]; } static void