2 ******************************************************************************
\r
3 * @file stm32l4xx_hal_spi_ex.c
\r
4 * @author MCD Application Team
\r
5 * @brief Extended SPI HAL module driver.
\r
6 * This file provides firmware functions to manage the following
\r
7 * SPI peripheral extended functionalities :
\r
8 * + IO operation functions
\r
10 ******************************************************************************
\r
13 * <h2><center>© Copyright (c) 2017 STMicroelectronics.
\r
14 * All rights reserved.</center></h2>
\r
16 * This software component is licensed by ST under BSD 3-Clause license,
\r
17 * the "License"; You may not use this file except in compliance with the
\r
18 * License. You may obtain a copy of the License at:
\r
19 * opensource.org/licenses/BSD-3-Clause
\r
21 ******************************************************************************
\r
24 /* Includes ------------------------------------------------------------------*/
\r
25 #include "stm32l4xx_hal.h"
\r
27 /** @addtogroup STM32L4xx_HAL_Driver
\r
31 /** @defgroup SPIEx SPIEx
\r
32 * @brief SPI Extended HAL module driver
\r
35 #ifdef HAL_SPI_MODULE_ENABLED
\r
37 /* Private typedef -----------------------------------------------------------*/
\r
38 /* Private defines -----------------------------------------------------------*/
\r
39 /** @defgroup SPIEx_Private_Constants SPIEx Private Constants
\r
42 #define SPI_FIFO_SIZE 4UL
\r
47 /* Private macros ------------------------------------------------------------*/
\r
48 /* Private variables ---------------------------------------------------------*/
\r
49 /* Private function prototypes -----------------------------------------------*/
\r
50 /* Exported functions --------------------------------------------------------*/
\r
52 /** @defgroup SPIEx_Exported_Functions SPIEx Exported Functions
\r
56 /** @defgroup SPIEx_Exported_Functions_Group1 IO operation functions
\r
57 * @brief Data transfers functions
\r
60 ==============================================================================
\r
61 ##### IO operation functions #####
\r
62 ===============================================================================
\r
64 This subsection provides a set of extended functions to manage the SPI
\r
67 (#) Rx data flush function:
\r
68 (++) HAL_SPIEx_FlushRxFifo()
\r
75 * @brief Flush the RX fifo.
\r
76 * @param hspi pointer to a SPI_HandleTypeDef structure that contains
\r
77 * the configuration information for the specified SPI module.
\r
78 * @retval HAL status
\r
80 HAL_StatusTypeDef HAL_SPIEx_FlushRxFifo(SPI_HandleTypeDef *hspi)
\r
82 __IO uint32_t tmpreg;
\r
84 while ((hspi->Instance->SR & SPI_FLAG_FRLVL) != SPI_FRLVL_EMPTY)
\r
87 tmpreg = hspi->Instance->DR;
\r
88 UNUSED(tmpreg); /* To avoid GCC warning */
\r
89 if (count == SPI_FIFO_SIZE)
\r
105 #endif /* HAL_SPI_MODULE_ENABLED */
\r
115 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
\r