We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 64bd60d commit fe3a99dCopy full SHA for fe3a99d
targets/TARGET_STM/stm_spi_api.c
@@ -438,17 +438,13 @@ int spi_slave_receive(spi_t *obj)
438
439
int spi_slave_read(spi_t *obj)
440
{
441
- SPI_TypeDef *spi = SPI_INST(obj);
442
struct spi_s *spiobj = SPI_S(obj);
443
SPI_HandleTypeDef *handle = &(spiobj->handle);
444
while (!ssp_readable(obj));
445
- if (handle->Init.DataSize == SPI_DATASIZE_8BIT) {
446
- // Force 8-bit access to the data register
447
- uint8_t *p_spi_dr = 0;
448
- p_spi_dr = (uint8_t *) & (spi->DR);
449
- return (int)(*p_spi_dr);
+ if (handle->Init.DataSize == SPI_DATASIZE_16BIT) {
+ return LL_SPI_ReceiveData16(SPI_INST(obj));
450
} else {
451
- return (int)spi->DR;
+ return LL_SPI_ReceiveData8(SPI_INST(obj));
452
}
453
454
0 commit comments