mirror of https://github.com/ARMmbed/mbed-os.git
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.pull/5083/head
parent
64bd60d449
commit
fe3a99d3f7
|
@ -438,17 +438,13 @@ int spi_slave_receive(spi_t *obj)
|
||||||
|
|
||||||
int spi_slave_read(spi_t *obj)
|
int spi_slave_read(spi_t *obj)
|
||||||
{
|
{
|
||||||
SPI_TypeDef *spi = SPI_INST(obj);
|
|
||||||
struct spi_s *spiobj = SPI_S(obj);
|
struct spi_s *spiobj = SPI_S(obj);
|
||||||
SPI_HandleTypeDef *handle = &(spiobj->handle);
|
SPI_HandleTypeDef *handle = &(spiobj->handle);
|
||||||
while (!ssp_readable(obj));
|
while (!ssp_readable(obj));
|
||||||
if (handle->Init.DataSize == SPI_DATASIZE_8BIT) {
|
if (handle->Init.DataSize == SPI_DATASIZE_16BIT) {
|
||||||
// Force 8-bit access to the data register
|
return LL_SPI_ReceiveData16(SPI_INST(obj));
|
||||||
uint8_t *p_spi_dr = 0;
|
|
||||||
p_spi_dr = (uint8_t *) & (spi->DR);
|
|
||||||
return (int)(*p_spi_dr);
|
|
||||||
} else {
|
} else {
|
||||||
return (int)spi->DR;
|
return LL_SPI_ReceiveData8(SPI_INST(obj));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue