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 57371ea commit 6dfafc7Copy full SHA for 6dfafc7
targets/TARGET_STM/stm_spi_api.c
@@ -445,17 +445,13 @@ int spi_slave_receive(spi_t *obj)
445
446
int spi_slave_read(spi_t *obj)
447
{
448
- SPI_TypeDef *spi = SPI_INST(obj);
449
struct spi_s *spiobj = SPI_S(obj);
450
SPI_HandleTypeDef *handle = &(spiobj->handle);
451
while (!ssp_readable(obj));
452
- if (handle->Init.DataSize == SPI_DATASIZE_8BIT) {
453
- // Force 8-bit access to the data register
454
- uint8_t *p_spi_dr = 0;
455
- p_spi_dr = (uint8_t *) & (spi->DR);
456
- return (int)(*p_spi_dr);
+ if (handle->Init.DataSize == SPI_DATASIZE_16BIT) {
+ return LL_SPI_ReceiveData16(SPI_INST(obj));
457
} else {
458
- return (int)spi->DR;
+ return LL_SPI_ReceiveData8(SPI_INST(obj));
459
}
460
461
0 commit comments