STM32L4xx_HAL_Driver  1.14.0
stm32l4xx_hal_spi_ex.c
Go to the documentation of this file.
1 
24 /* Includes ------------------------------------------------------------------*/
25 #include "stm32l4xx_hal.h"
26 
35 #ifdef HAL_SPI_MODULE_ENABLED
36 
37 /* Private typedef -----------------------------------------------------------*/
38 /* Private defines -----------------------------------------------------------*/
42 #define SPI_FIFO_SIZE 4UL
43 
47 /* Private macros ------------------------------------------------------------*/
48 /* Private variables ---------------------------------------------------------*/
49 /* Private function prototypes -----------------------------------------------*/
50 /* Exported functions --------------------------------------------------------*/
51 
80 HAL_StatusTypeDef HAL_SPIEx_FlushRxFifo(SPI_HandleTypeDef *hspi)
81 {
82  __IO uint32_t tmpreg;
83  uint8_t count = 0U;
84  while ((hspi->Instance->SR & SPI_FLAG_FRLVL) != SPI_FRLVL_EMPTY)
85  {
86  count++;
87  tmpreg = hspi->Instance->DR;
88  UNUSED(tmpreg); /* To avoid GCC warning */
89  if (count == SPI_FIFO_SIZE)
90  {
91  return HAL_TIMEOUT;
92  }
93  }
94  return HAL_OK;
95 }
96 
105 #endif /* HAL_SPI_MODULE_ENABLED */
106 
115 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
HAL_StatusTypeDef HAL_SPIEx_FlushRxFifo(SPI_HandleTypeDef *hspi)
Flush the RX fifo.
This file contains all the functions prototypes for the HAL module driver.
return HAL_OK
SPI handle Structure definition.