From fe3a99d3f70a98373fe459e8f5e9ec50d464811a Mon Sep 17 00:00:00 2001 From: mapellil Date: Tue, 16 May 2017 11:37:46 +0200 Subject: [PATCH] STM32: SPI: Use LL in spi_slave_read this is more a cosmetic change, but since LL was introduced, we can now use it here as well. --- targets/TARGET_STM/stm_spi_api.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/targets/TARGET_STM/stm_spi_api.c b/targets/TARGET_STM/stm_spi_api.c index 86816a2d14..043701ff7f 100644 --- a/targets/TARGET_STM/stm_spi_api.c +++ b/targets/TARGET_STM/stm_spi_api.c @@ -438,17 +438,13 @@ int spi_slave_receive(spi_t *obj) int spi_slave_read(spi_t *obj) { - SPI_TypeDef *spi = SPI_INST(obj); struct spi_s *spiobj = SPI_S(obj); SPI_HandleTypeDef *handle = &(spiobj->handle); while (!ssp_readable(obj)); - if (handle->Init.DataSize == SPI_DATASIZE_8BIT) { - // Force 8-bit access to the data register - uint8_t *p_spi_dr = 0; - p_spi_dr = (uint8_t *) & (spi->DR); - return (int)(*p_spi_dr); + if (handle->Init.DataSize == SPI_DATASIZE_16BIT) { + return LL_SPI_ReceiveData16(SPI_INST(obj)); } else { - return (int)spi->DR; + return LL_SPI_ReceiveData8(SPI_INST(obj)); } }