meh

Fork of mbed by mbed official

Committer:
Kojto
Date:
Fri Oct 02 07:35:07 2015 +0200
Revision:
108:34e6b704fe68
Parent:
93:e188a91d3eaa
Release 108  of the mbed library

Changes:
- new platforms - ELMO_F411RE, WIZNET_7500P, ARM_MPS2_BEID
- EFM32 - bugfixes in rtc, serial
- Cortex A cmsis - update files
- STML4 - RAM fixes

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Kojto 90:cb3d968589d8 1 /**
Kojto 90:cb3d968589d8 2 ******************************************************************************
Kojto 90:cb3d968589d8 3 * @file stm32f0xx_hal_usart_ex.h
Kojto 90:cb3d968589d8 4 * @author MCD Application Team
Kojto 108:34e6b704fe68 5 * @version V1.3.0
Kojto 108:34e6b704fe68 6 * @date 26-June-2015
Kojto 90:cb3d968589d8 7 * @brief Header file of USART HAL Extension module.
Kojto 90:cb3d968589d8 8 ******************************************************************************
Kojto 90:cb3d968589d8 9 * @attention
Kojto 108:34e6b704fe68 10 *
Kojto 108:34e6b704fe68 11 * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
Kojto 90:cb3d968589d8 12 *
Kojto 90:cb3d968589d8 13 * Redistribution and use in source and binary forms, with or without modification,
Kojto 90:cb3d968589d8 14 * are permitted provided that the following conditions are met:
Kojto 90:cb3d968589d8 15 * 1. Redistributions of source code must retain the above copyright notice,
Kojto 90:cb3d968589d8 16 * this list of conditions and the following disclaimer.
Kojto 90:cb3d968589d8 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
Kojto 90:cb3d968589d8 18 * this list of conditions and the following disclaimer in the documentation
Kojto 90:cb3d968589d8 19 * and/or other materials provided with the distribution.
Kojto 90:cb3d968589d8 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
Kojto 90:cb3d968589d8 21 * may be used to endorse or promote products derived from this software
Kojto 90:cb3d968589d8 22 * without specific prior written permission.
Kojto 90:cb3d968589d8 23 *
Kojto 90:cb3d968589d8 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
Kojto 90:cb3d968589d8 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Kojto 90:cb3d968589d8 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Kojto 90:cb3d968589d8 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
Kojto 90:cb3d968589d8 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Kojto 90:cb3d968589d8 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
Kojto 90:cb3d968589d8 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
Kojto 90:cb3d968589d8 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
Kojto 90:cb3d968589d8 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Kojto 90:cb3d968589d8 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Kojto 90:cb3d968589d8 34 *
Kojto 108:34e6b704fe68 35 ******************************************************************************
Kojto 90:cb3d968589d8 36 */
Kojto 90:cb3d968589d8 37
Kojto 90:cb3d968589d8 38 /* Define to prevent recursive inclusion -------------------------------------*/
Kojto 90:cb3d968589d8 39 #ifndef __STM32F0xx_HAL_USART_EX_H
Kojto 90:cb3d968589d8 40 #define __STM32F0xx_HAL_USART_EX_H
Kojto 90:cb3d968589d8 41
Kojto 90:cb3d968589d8 42 #ifdef __cplusplus
Kojto 90:cb3d968589d8 43 extern "C" {
Kojto 90:cb3d968589d8 44 #endif
Kojto 90:cb3d968589d8 45
Kojto 90:cb3d968589d8 46 /* Includes ------------------------------------------------------------------*/
Kojto 90:cb3d968589d8 47 #include "stm32f0xx_hal_def.h"
Kojto 90:cb3d968589d8 48
Kojto 90:cb3d968589d8 49 /** @addtogroup STM32F0xx_HAL_Driver
Kojto 90:cb3d968589d8 50 * @{
Kojto 90:cb3d968589d8 51 */
Kojto 90:cb3d968589d8 52
Kojto 108:34e6b704fe68 53 /** @defgroup USARTEx USARTEx
Kojto 90:cb3d968589d8 54 * @{
Kojto 90:cb3d968589d8 55 */
Kojto 90:cb3d968589d8 56
Kojto 90:cb3d968589d8 57 /* Exported types ------------------------------------------------------------*/
Kojto 90:cb3d968589d8 58 /* Exported constants --------------------------------------------------------*/
Kojto 90:cb3d968589d8 59 /** @defgroup USARTEx_Exported_Constants USARTEx Exported Constants
Kojto 90:cb3d968589d8 60 * @{
Kojto 90:cb3d968589d8 61 */
Kojto 108:34e6b704fe68 62
Kojto 90:cb3d968589d8 63 /** @defgroup USARTEx_Word_Length USARTEx Word Length
Kojto 90:cb3d968589d8 64 * @{
Kojto 90:cb3d968589d8 65 */
Kojto 93:e188a91d3eaa 66 #if defined (STM32F042x6) || defined (STM32F048xx) || defined (STM32F070x6) || \
Kojto 93:e188a91d3eaa 67 defined (STM32F071xB) || defined (STM32F072xB) || defined (STM32F078xx) || defined (STM32F070xB) || \
Kojto 93:e188a91d3eaa 68 defined (STM32F091xC) || defined (STM32F098xx) || defined (STM32F030xC)
Kojto 108:34e6b704fe68 69 #define USART_WORDLENGTH_7B ((uint32_t)USART_CR1_M1) /*!< 7-bit long USART frame */
Kojto 108:34e6b704fe68 70 #define USART_WORDLENGTH_8B ((uint32_t)0x00000000) /*!< 8-bit long USART frame */
Kojto 108:34e6b704fe68 71 #define USART_WORDLENGTH_9B ((uint32_t)USART_CR1_M0) /*!< 9-bit long USART frame */
Kojto 90:cb3d968589d8 72 #else
Kojto 108:34e6b704fe68 73 #define USART_WORDLENGTH_8B ((uint32_t)0x00000000) /*!< 8-bit long USART frame */
Kojto 108:34e6b704fe68 74 #define USART_WORDLENGTH_9B ((uint32_t)USART_CR1_M) /*!< 9-bit long USART frame */
Kojto 93:e188a91d3eaa 75 #endif /* defined (STM32F042x6) || defined (STM32F048xx) || defined (STM32F070x6) || defined (STM32F070xB) || \
Kojto 90:cb3d968589d8 76 defined (STM32F071xB) || defined (STM32F072xB) || defined (STM32F078xx) || \
Kojto 93:e188a91d3eaa 77 defined (STM32F091xC) || defined (STM32F098xx) || defined (STM32F030xC) */
Kojto 90:cb3d968589d8 78 /**
Kojto 90:cb3d968589d8 79 * @}
Kojto 90:cb3d968589d8 80 */
Kojto 108:34e6b704fe68 81
Kojto 108:34e6b704fe68 82 /** @defgroup USART_Request_Parameters USARTEx Request Parameters
Kojto 108:34e6b704fe68 83 * @{
Kojto 108:34e6b704fe68 84 */
Kojto 108:34e6b704fe68 85 #define USART_RXDATA_FLUSH_REQUEST ((uint32_t)USART_RQR_RXFRQ) /*!< Receive Data flush Request */
Kojto 108:34e6b704fe68 86 #if !defined(STM32F030x6) && !defined(STM32F030x8) && !defined(STM32F070x6) && !defined(STM32F070xB) && !defined(STM32F030xC)
Kojto 108:34e6b704fe68 87 #define USART_TXDATA_FLUSH_REQUEST ((uint32_t)USART_RQR_TXFRQ) /*!< Transmit data flush Request */
Kojto 108:34e6b704fe68 88 #else
Kojto 108:34e6b704fe68 89 #endif /* !defined(STM32F030x6) && !defined(STM32F030x8) && !defined(STM32F070x6) && !defined(STM32F070xB) && !defined(STM32F030xC) */
Kojto 108:34e6b704fe68 90 /**
Kojto 108:34e6b704fe68 91 * @}
Kojto 108:34e6b704fe68 92 */
Kojto 108:34e6b704fe68 93
Kojto 108:34e6b704fe68 94 /** @defgroup USART_Flags USART Flags
Kojto 108:34e6b704fe68 95 * Elements values convention: 0xXXXX
Kojto 108:34e6b704fe68 96 * - 0xXXXX : Flag mask in the ISR register
Kojto 108:34e6b704fe68 97 * @{
Kojto 108:34e6b704fe68 98 */
Kojto 108:34e6b704fe68 99 #if !defined(STM32F030x6) && !defined(STM32F030x8) && !defined(STM32F070x6) && !defined(STM32F070xB) && !defined(STM32F030xC)
Kojto 108:34e6b704fe68 100 #define USART_FLAG_REACK ((uint32_t)0x00400000) /*!< USART receive enable acknowledge flag */
Kojto 108:34e6b704fe68 101 #endif /* !defined(STM32F030x6) && !defined(STM32F030x8) && !defined(STM32F070x6) && !defined(STM32F070xB) && !defined(STM32F030xC) */
Kojto 108:34e6b704fe68 102 #define USART_FLAG_TEACK ((uint32_t)0x00200000) /*!< USART transmit enable acknowledge flag */
Kojto 108:34e6b704fe68 103 #define USART_FLAG_BUSY ((uint32_t)0x00010000) /*!< USART busy flag */
Kojto 108:34e6b704fe68 104 #define USART_FLAG_CTS ((uint32_t)0x00000400) /*!< USART clear to send flag */
Kojto 108:34e6b704fe68 105 #define USART_FLAG_CTSIF ((uint32_t)0x00000200) /*!< USART clear to send interrupt flag */
Kojto 108:34e6b704fe68 106 #define USART_FLAG_TXE ((uint32_t)0x00000080) /*!< USART transmit data register empty */
Kojto 108:34e6b704fe68 107 #define USART_FLAG_TC ((uint32_t)0x00000040) /*!< USART transmission complete */
Kojto 108:34e6b704fe68 108 #define USART_FLAG_RXNE ((uint32_t)0x00000020) /*!< USART read data register not empty */
Kojto 108:34e6b704fe68 109 #define USART_FLAG_IDLE ((uint32_t)0x00000010) /*!< USART idle flag */
Kojto 108:34e6b704fe68 110 #define USART_FLAG_ORE ((uint32_t)0x00000008) /*!< USART overrun error */
Kojto 108:34e6b704fe68 111 #define USART_FLAG_NE ((uint32_t)0x00000004) /*!< USART noise error */
Kojto 108:34e6b704fe68 112 #define USART_FLAG_FE ((uint32_t)0x00000002) /*!< USART frame error */
Kojto 108:34e6b704fe68 113 #define USART_FLAG_PE ((uint32_t)0x00000001) /*!< USART parity error */
Kojto 90:cb3d968589d8 114 /**
Kojto 90:cb3d968589d8 115 * @}
Kojto 108:34e6b704fe68 116 */
Kojto 108:34e6b704fe68 117
Kojto 108:34e6b704fe68 118 /**
Kojto 108:34e6b704fe68 119 * @}
Kojto 108:34e6b704fe68 120 */
Kojto 108:34e6b704fe68 121
Kojto 108:34e6b704fe68 122 /* Exported macros ------------------------------------------------------------*/
Kojto 108:34e6b704fe68 123 /** @defgroup USARTEx_Exported_Macros USARTEx Exported Macros
Kojto 108:34e6b704fe68 124 * @{
Kojto 108:34e6b704fe68 125 */
Kojto 90:cb3d968589d8 126
Kojto 108:34e6b704fe68 127 /** @brief Flush the USART Data registers.
Kojto 108:34e6b704fe68 128 * @param __HANDLE__: specifies the USART Handle.
Kojto 108:34e6b704fe68 129 * @retval None
Kojto 108:34e6b704fe68 130 */
Kojto 108:34e6b704fe68 131 #if !defined(STM32F030x6) && !defined(STM32F030x8) && !defined(STM32F070x6) && !defined(STM32F070xB) && !defined(STM32F030xC)
Kojto 108:34e6b704fe68 132 #define __HAL_USART_FLUSH_DRREGISTER(__HANDLE__) \
Kojto 108:34e6b704fe68 133 do{ \
Kojto 108:34e6b704fe68 134 SET_BIT((__HANDLE__)->Instance->RQR, USART_RXDATA_FLUSH_REQUEST); \
Kojto 108:34e6b704fe68 135 SET_BIT((__HANDLE__)->Instance->RQR, USART_TXDATA_FLUSH_REQUEST); \
Kojto 108:34e6b704fe68 136 } while(0)
Kojto 108:34e6b704fe68 137 #else
Kojto 108:34e6b704fe68 138 #define __HAL_USART_FLUSH_DRREGISTER(__HANDLE__) \
Kojto 108:34e6b704fe68 139 do{ \
Kojto 108:34e6b704fe68 140 SET_BIT((__HANDLE__)->Instance->RQR, USART_RXDATA_FLUSH_REQUEST); \
Kojto 108:34e6b704fe68 141 } while(0)
Kojto 108:34e6b704fe68 142 #endif /* !defined(STM32F030x6) && !defined(STM32F030x8) && !defined(STM32F070x6) && !defined(STM32F070xB) && !defined(STM32F030xC) */
Kojto 108:34e6b704fe68 143
Kojto 108:34e6b704fe68 144 /**
Kojto 108:34e6b704fe68 145 * @}
Kojto 108:34e6b704fe68 146 */
Kojto 108:34e6b704fe68 147
Kojto 108:34e6b704fe68 148 /* Private macros ------------------------------------------------------------*/
Kojto 108:34e6b704fe68 149 /** @defgroup USARTEx_Private_Macros USARTEx Private Macros
Kojto 90:cb3d968589d8 150 * @{
Kojto 90:cb3d968589d8 151 */
Kojto 90:cb3d968589d8 152
Kojto 90:cb3d968589d8 153 /** @brief Reports the USART clock source.
Kojto 90:cb3d968589d8 154 * @param __HANDLE__: specifies the USART Handle
Kojto 90:cb3d968589d8 155 * @param __CLOCKSOURCE__ : output variable
Kojto 90:cb3d968589d8 156 * @retval the USART clocking source, written in __CLOCKSOURCE__.
Kojto 90:cb3d968589d8 157 */
Kojto 90:cb3d968589d8 158 #if defined(STM32F030x6) || defined(STM32F031x6) || defined(STM32F038xx)
Kojto 108:34e6b704fe68 159 #define USART_GETCLOCKSOURCE(__HANDLE__,__CLOCKSOURCE__) \
Kojto 90:cb3d968589d8 160 do { \
Kojto 90:cb3d968589d8 161 switch(__HAL_RCC_GET_USART1_SOURCE()) \
Kojto 90:cb3d968589d8 162 { \
Kojto 90:cb3d968589d8 163 case RCC_USART1CLKSOURCE_PCLK1: \
Kojto 90:cb3d968589d8 164 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_PCLK1; \
Kojto 90:cb3d968589d8 165 break; \
Kojto 90:cb3d968589d8 166 case RCC_USART1CLKSOURCE_HSI: \
Kojto 90:cb3d968589d8 167 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_HSI; \
Kojto 90:cb3d968589d8 168 break; \
Kojto 90:cb3d968589d8 169 case RCC_USART1CLKSOURCE_SYSCLK: \
Kojto 90:cb3d968589d8 170 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_SYSCLK; \
Kojto 90:cb3d968589d8 171 break; \
Kojto 90:cb3d968589d8 172 case RCC_USART1CLKSOURCE_LSE: \
Kojto 90:cb3d968589d8 173 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_LSE; \
Kojto 90:cb3d968589d8 174 break; \
Kojto 90:cb3d968589d8 175 default: \
Kojto 90:cb3d968589d8 176 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_UNDEFINED; \
Kojto 90:cb3d968589d8 177 break; \
Kojto 90:cb3d968589d8 178 } \
Kojto 90:cb3d968589d8 179 } while(0)
Kojto 93:e188a91d3eaa 180 #elif defined (STM32F030x8) || defined (STM32F070x6) || \
Kojto 90:cb3d968589d8 181 defined (STM32F042x6) || defined (STM32F048xx) || \
Kojto 90:cb3d968589d8 182 defined (STM32F051x8) || defined (STM32F058xx)
Kojto 108:34e6b704fe68 183 #define USART_GETCLOCKSOURCE(__HANDLE__,__CLOCKSOURCE__) \
Kojto 90:cb3d968589d8 184 do { \
Kojto 90:cb3d968589d8 185 if((__HANDLE__)->Instance == USART1) \
Kojto 90:cb3d968589d8 186 { \
Kojto 90:cb3d968589d8 187 switch(__HAL_RCC_GET_USART1_SOURCE()) \
Kojto 90:cb3d968589d8 188 { \
Kojto 90:cb3d968589d8 189 case RCC_USART1CLKSOURCE_PCLK1: \
Kojto 90:cb3d968589d8 190 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_PCLK1; \
Kojto 90:cb3d968589d8 191 break; \
Kojto 90:cb3d968589d8 192 case RCC_USART1CLKSOURCE_HSI: \
Kojto 90:cb3d968589d8 193 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_HSI; \
Kojto 90:cb3d968589d8 194 break; \
Kojto 90:cb3d968589d8 195 case RCC_USART1CLKSOURCE_SYSCLK: \
Kojto 90:cb3d968589d8 196 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_SYSCLK; \
Kojto 90:cb3d968589d8 197 break; \
Kojto 90:cb3d968589d8 198 case RCC_USART1CLKSOURCE_LSE: \
Kojto 90:cb3d968589d8 199 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_LSE; \
Kojto 90:cb3d968589d8 200 break; \
Kojto 90:cb3d968589d8 201 default: \
Kojto 90:cb3d968589d8 202 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_UNDEFINED; \
Kojto 90:cb3d968589d8 203 break; \
Kojto 90:cb3d968589d8 204 } \
Kojto 90:cb3d968589d8 205 } \
Kojto 90:cb3d968589d8 206 else if((__HANDLE__)->Instance == USART2) \
Kojto 90:cb3d968589d8 207 { \
Kojto 90:cb3d968589d8 208 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_PCLK1; \
Kojto 90:cb3d968589d8 209 } \
Kojto 90:cb3d968589d8 210 else \
Kojto 90:cb3d968589d8 211 { \
Kojto 90:cb3d968589d8 212 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_UNDEFINED; \
Kojto 90:cb3d968589d8 213 } \
Kojto 108:34e6b704fe68 214 } while(0)
Kojto 93:e188a91d3eaa 215 #elif defined (STM32F070xB)
Kojto 108:34e6b704fe68 216 #define USART_GETCLOCKSOURCE(__HANDLE__,__CLOCKSOURCE__) \
Kojto 93:e188a91d3eaa 217 do { \
Kojto 93:e188a91d3eaa 218 if((__HANDLE__)->Instance == USART1) \
Kojto 93:e188a91d3eaa 219 { \
Kojto 93:e188a91d3eaa 220 switch(__HAL_RCC_GET_USART1_SOURCE()) \
Kojto 93:e188a91d3eaa 221 { \
Kojto 93:e188a91d3eaa 222 case RCC_USART1CLKSOURCE_PCLK1: \
Kojto 93:e188a91d3eaa 223 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_PCLK1; \
Kojto 93:e188a91d3eaa 224 break; \
Kojto 93:e188a91d3eaa 225 case RCC_USART1CLKSOURCE_HSI: \
Kojto 93:e188a91d3eaa 226 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_HSI; \
Kojto 93:e188a91d3eaa 227 break; \
Kojto 93:e188a91d3eaa 228 case RCC_USART1CLKSOURCE_SYSCLK: \
Kojto 93:e188a91d3eaa 229 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_SYSCLK; \
Kojto 93:e188a91d3eaa 230 break; \
Kojto 93:e188a91d3eaa 231 case RCC_USART1CLKSOURCE_LSE: \
Kojto 93:e188a91d3eaa 232 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_LSE; \
Kojto 93:e188a91d3eaa 233 break; \
Kojto 93:e188a91d3eaa 234 default: \
Kojto 93:e188a91d3eaa 235 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_UNDEFINED; \
Kojto 93:e188a91d3eaa 236 break; \
Kojto 93:e188a91d3eaa 237 } \
Kojto 93:e188a91d3eaa 238 } \
Kojto 93:e188a91d3eaa 239 else if((__HANDLE__)->Instance == USART2) \
Kojto 93:e188a91d3eaa 240 { \
Kojto 93:e188a91d3eaa 241 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_PCLK1; \
Kojto 93:e188a91d3eaa 242 } \
Kojto 93:e188a91d3eaa 243 else if((__HANDLE__)->Instance == USART3) \
Kojto 93:e188a91d3eaa 244 { \
Kojto 93:e188a91d3eaa 245 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_PCLK1; \
Kojto 93:e188a91d3eaa 246 } \
Kojto 93:e188a91d3eaa 247 else if((__HANDLE__)->Instance == USART4) \
Kojto 93:e188a91d3eaa 248 { \
Kojto 93:e188a91d3eaa 249 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_PCLK1; \
Kojto 93:e188a91d3eaa 250 } \
Kojto 93:e188a91d3eaa 251 else \
Kojto 93:e188a91d3eaa 252 { \
Kojto 93:e188a91d3eaa 253 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_UNDEFINED; \
Kojto 93:e188a91d3eaa 254 } \
Kojto 108:34e6b704fe68 255 } while(0)
Kojto 90:cb3d968589d8 256 #elif defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx)
Kojto 108:34e6b704fe68 257 #define USART_GETCLOCKSOURCE(__HANDLE__,__CLOCKSOURCE__) \
Kojto 90:cb3d968589d8 258 do { \
Kojto 90:cb3d968589d8 259 if((__HANDLE__)->Instance == USART1) \
Kojto 90:cb3d968589d8 260 { \
Kojto 90:cb3d968589d8 261 switch(__HAL_RCC_GET_USART1_SOURCE()) \
Kojto 90:cb3d968589d8 262 { \
Kojto 90:cb3d968589d8 263 case RCC_USART1CLKSOURCE_PCLK1: \
Kojto 90:cb3d968589d8 264 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_PCLK1; \
Kojto 90:cb3d968589d8 265 break; \
Kojto 90:cb3d968589d8 266 case RCC_USART1CLKSOURCE_HSI: \
Kojto 90:cb3d968589d8 267 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_HSI; \
Kojto 90:cb3d968589d8 268 break; \
Kojto 90:cb3d968589d8 269 case RCC_USART1CLKSOURCE_SYSCLK: \
Kojto 90:cb3d968589d8 270 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_SYSCLK; \
Kojto 90:cb3d968589d8 271 break; \
Kojto 90:cb3d968589d8 272 case RCC_USART1CLKSOURCE_LSE: \
Kojto 90:cb3d968589d8 273 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_LSE; \
Kojto 90:cb3d968589d8 274 break; \
Kojto 90:cb3d968589d8 275 default: \
Kojto 90:cb3d968589d8 276 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_UNDEFINED; \
Kojto 90:cb3d968589d8 277 break; \
Kojto 90:cb3d968589d8 278 } \
Kojto 90:cb3d968589d8 279 } \
Kojto 90:cb3d968589d8 280 else if((__HANDLE__)->Instance == USART2) \
Kojto 90:cb3d968589d8 281 { \
Kojto 90:cb3d968589d8 282 switch(__HAL_RCC_GET_USART2_SOURCE()) \
Kojto 90:cb3d968589d8 283 { \
Kojto 90:cb3d968589d8 284 case RCC_USART2CLKSOURCE_PCLK1: \
Kojto 90:cb3d968589d8 285 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_PCLK1; \
Kojto 90:cb3d968589d8 286 break; \
Kojto 90:cb3d968589d8 287 case RCC_USART2CLKSOURCE_HSI: \
Kojto 90:cb3d968589d8 288 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_HSI; \
Kojto 90:cb3d968589d8 289 break; \
Kojto 90:cb3d968589d8 290 case RCC_USART2CLKSOURCE_SYSCLK: \
Kojto 90:cb3d968589d8 291 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_SYSCLK; \
Kojto 90:cb3d968589d8 292 break; \
Kojto 90:cb3d968589d8 293 case RCC_USART2CLKSOURCE_LSE: \
Kojto 90:cb3d968589d8 294 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_LSE; \
Kojto 90:cb3d968589d8 295 break; \
Kojto 90:cb3d968589d8 296 default: \
Kojto 90:cb3d968589d8 297 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_UNDEFINED; \
Kojto 90:cb3d968589d8 298 break; \
Kojto 90:cb3d968589d8 299 } \
Kojto 90:cb3d968589d8 300 } \
Kojto 90:cb3d968589d8 301 else if((__HANDLE__)->Instance == USART3) \
Kojto 90:cb3d968589d8 302 { \
Kojto 90:cb3d968589d8 303 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_PCLK1; \
Kojto 90:cb3d968589d8 304 } \
Kojto 90:cb3d968589d8 305 else if((__HANDLE__)->Instance == USART4) \
Kojto 90:cb3d968589d8 306 { \
Kojto 90:cb3d968589d8 307 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_PCLK1; \
Kojto 90:cb3d968589d8 308 } \
Kojto 90:cb3d968589d8 309 else \
Kojto 90:cb3d968589d8 310 { \
Kojto 90:cb3d968589d8 311 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_UNDEFINED; \
Kojto 90:cb3d968589d8 312 } \
Kojto 108:34e6b704fe68 313 } while(0)
Kojto 90:cb3d968589d8 314 #elif defined(STM32F091xC) || defined (STM32F098xx)
Kojto 108:34e6b704fe68 315 #define USART_GETCLOCKSOURCE(__HANDLE__,__CLOCKSOURCE__) \
Kojto 90:cb3d968589d8 316 do { \
Kojto 90:cb3d968589d8 317 if((__HANDLE__)->Instance == USART1) \
Kojto 90:cb3d968589d8 318 { \
Kojto 90:cb3d968589d8 319 switch(__HAL_RCC_GET_USART1_SOURCE()) \
Kojto 90:cb3d968589d8 320 { \
Kojto 90:cb3d968589d8 321 case RCC_USART1CLKSOURCE_PCLK1: \
Kojto 90:cb3d968589d8 322 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_PCLK1; \
Kojto 90:cb3d968589d8 323 break; \
Kojto 90:cb3d968589d8 324 case RCC_USART1CLKSOURCE_HSI: \
Kojto 90:cb3d968589d8 325 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_HSI; \
Kojto 90:cb3d968589d8 326 break; \
Kojto 90:cb3d968589d8 327 case RCC_USART1CLKSOURCE_SYSCLK: \
Kojto 90:cb3d968589d8 328 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_SYSCLK; \
Kojto 90:cb3d968589d8 329 break; \
Kojto 90:cb3d968589d8 330 case RCC_USART1CLKSOURCE_LSE: \
Kojto 90:cb3d968589d8 331 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_LSE; \
Kojto 90:cb3d968589d8 332 break; \
Kojto 90:cb3d968589d8 333 default: \
Kojto 90:cb3d968589d8 334 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_UNDEFINED; \
Kojto 90:cb3d968589d8 335 break; \
Kojto 90:cb3d968589d8 336 } \
Kojto 90:cb3d968589d8 337 } \
Kojto 90:cb3d968589d8 338 else if((__HANDLE__)->Instance == USART2) \
Kojto 90:cb3d968589d8 339 { \
Kojto 90:cb3d968589d8 340 switch(__HAL_RCC_GET_USART2_SOURCE()) \
Kojto 90:cb3d968589d8 341 { \
Kojto 90:cb3d968589d8 342 case RCC_USART2CLKSOURCE_PCLK1: \
Kojto 90:cb3d968589d8 343 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_PCLK1; \
Kojto 90:cb3d968589d8 344 break; \
Kojto 90:cb3d968589d8 345 case RCC_USART2CLKSOURCE_HSI: \
Kojto 90:cb3d968589d8 346 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_HSI; \
Kojto 90:cb3d968589d8 347 break; \
Kojto 90:cb3d968589d8 348 case RCC_USART2CLKSOURCE_SYSCLK: \
Kojto 90:cb3d968589d8 349 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_SYSCLK; \
Kojto 90:cb3d968589d8 350 break; \
Kojto 90:cb3d968589d8 351 case RCC_USART2CLKSOURCE_LSE: \
Kojto 90:cb3d968589d8 352 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_LSE; \
Kojto 90:cb3d968589d8 353 break; \
Kojto 90:cb3d968589d8 354 default: \
Kojto 90:cb3d968589d8 355 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_UNDEFINED; \
Kojto 90:cb3d968589d8 356 break; \
Kojto 90:cb3d968589d8 357 } \
Kojto 90:cb3d968589d8 358 } \
Kojto 90:cb3d968589d8 359 else if((__HANDLE__)->Instance == USART3) \
Kojto 90:cb3d968589d8 360 { \
Kojto 90:cb3d968589d8 361 switch(__HAL_RCC_GET_USART3_SOURCE()) \
Kojto 90:cb3d968589d8 362 { \
Kojto 90:cb3d968589d8 363 case RCC_USART3CLKSOURCE_PCLK1: \
Kojto 90:cb3d968589d8 364 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_PCLK1; \
Kojto 90:cb3d968589d8 365 break; \
Kojto 90:cb3d968589d8 366 case RCC_USART3CLKSOURCE_HSI: \
Kojto 90:cb3d968589d8 367 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_HSI; \
Kojto 90:cb3d968589d8 368 break; \
Kojto 90:cb3d968589d8 369 case RCC_USART3CLKSOURCE_SYSCLK: \
Kojto 90:cb3d968589d8 370 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_SYSCLK; \
Kojto 90:cb3d968589d8 371 break; \
Kojto 90:cb3d968589d8 372 case RCC_USART3CLKSOURCE_LSE: \
Kojto 90:cb3d968589d8 373 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_LSE; \
Kojto 90:cb3d968589d8 374 break; \
Kojto 90:cb3d968589d8 375 default: \
Kojto 90:cb3d968589d8 376 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_UNDEFINED; \
Kojto 90:cb3d968589d8 377 break; \
Kojto 90:cb3d968589d8 378 } \
Kojto 90:cb3d968589d8 379 } \
Kojto 90:cb3d968589d8 380 else if((__HANDLE__)->Instance == USART4) \
Kojto 90:cb3d968589d8 381 { \
Kojto 90:cb3d968589d8 382 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_PCLK1; \
Kojto 90:cb3d968589d8 383 } \
Kojto 90:cb3d968589d8 384 else if((__HANDLE__)->Instance == USART5) \
Kojto 90:cb3d968589d8 385 { \
Kojto 90:cb3d968589d8 386 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_PCLK1; \
Kojto 90:cb3d968589d8 387 } \
Kojto 90:cb3d968589d8 388 else if((__HANDLE__)->Instance == USART6) \
Kojto 90:cb3d968589d8 389 { \
Kojto 90:cb3d968589d8 390 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_PCLK1; \
Kojto 90:cb3d968589d8 391 } \
Kojto 90:cb3d968589d8 392 else if((__HANDLE__)->Instance == USART7) \
Kojto 90:cb3d968589d8 393 { \
Kojto 90:cb3d968589d8 394 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_PCLK1; \
Kojto 90:cb3d968589d8 395 } \
Kojto 90:cb3d968589d8 396 else if((__HANDLE__)->Instance == USART8) \
Kojto 90:cb3d968589d8 397 { \
Kojto 90:cb3d968589d8 398 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_PCLK1; \
Kojto 90:cb3d968589d8 399 } \
Kojto 90:cb3d968589d8 400 else \
Kojto 90:cb3d968589d8 401 { \
Kojto 90:cb3d968589d8 402 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_UNDEFINED; \
Kojto 90:cb3d968589d8 403 } \
Kojto 93:e188a91d3eaa 404 } while(0)
Kojto 93:e188a91d3eaa 405 #elif defined(STM32F030xC)
Kojto 108:34e6b704fe68 406 #define USART_GETCLOCKSOURCE(__HANDLE__,__CLOCKSOURCE__) \
Kojto 93:e188a91d3eaa 407 do { \
Kojto 93:e188a91d3eaa 408 if((__HANDLE__)->Instance == USART1) \
Kojto 93:e188a91d3eaa 409 { \
Kojto 93:e188a91d3eaa 410 switch(__HAL_RCC_GET_USART1_SOURCE()) \
Kojto 93:e188a91d3eaa 411 { \
Kojto 93:e188a91d3eaa 412 case RCC_USART1CLKSOURCE_PCLK1: \
Kojto 93:e188a91d3eaa 413 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_PCLK1; \
Kojto 93:e188a91d3eaa 414 break; \
Kojto 93:e188a91d3eaa 415 case RCC_USART1CLKSOURCE_HSI: \
Kojto 93:e188a91d3eaa 416 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_HSI; \
Kojto 93:e188a91d3eaa 417 break; \
Kojto 93:e188a91d3eaa 418 case RCC_USART1CLKSOURCE_SYSCLK: \
Kojto 93:e188a91d3eaa 419 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_SYSCLK; \
Kojto 93:e188a91d3eaa 420 break; \
Kojto 93:e188a91d3eaa 421 case RCC_USART1CLKSOURCE_LSE: \
Kojto 93:e188a91d3eaa 422 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_LSE; \
Kojto 93:e188a91d3eaa 423 break; \
Kojto 93:e188a91d3eaa 424 default: \
Kojto 93:e188a91d3eaa 425 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_UNDEFINED; \
Kojto 93:e188a91d3eaa 426 break; \
Kojto 93:e188a91d3eaa 427 } \
Kojto 93:e188a91d3eaa 428 } \
Kojto 93:e188a91d3eaa 429 else if((__HANDLE__)->Instance == USART2) \
Kojto 93:e188a91d3eaa 430 { \
Kojto 93:e188a91d3eaa 431 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_PCLK1; \
Kojto 93:e188a91d3eaa 432 } \
Kojto 93:e188a91d3eaa 433 else if((__HANDLE__)->Instance == USART3) \
Kojto 93:e188a91d3eaa 434 { \
Kojto 93:e188a91d3eaa 435 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_PCLK1; \
Kojto 93:e188a91d3eaa 436 } \
Kojto 93:e188a91d3eaa 437 else if((__HANDLE__)->Instance == USART4) \
Kojto 93:e188a91d3eaa 438 { \
Kojto 93:e188a91d3eaa 439 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_PCLK1; \
Kojto 93:e188a91d3eaa 440 } \
Kojto 93:e188a91d3eaa 441 else if((__HANDLE__)->Instance == USART5) \
Kojto 93:e188a91d3eaa 442 { \
Kojto 93:e188a91d3eaa 443 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_PCLK1; \
Kojto 93:e188a91d3eaa 444 } \
Kojto 93:e188a91d3eaa 445 else if((__HANDLE__)->Instance == USART6) \
Kojto 93:e188a91d3eaa 446 { \
Kojto 93:e188a91d3eaa 447 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_PCLK1; \
Kojto 93:e188a91d3eaa 448 } \
Kojto 93:e188a91d3eaa 449 else \
Kojto 93:e188a91d3eaa 450 { \
Kojto 93:e188a91d3eaa 451 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_UNDEFINED; \
Kojto 93:e188a91d3eaa 452 } \
Kojto 108:34e6b704fe68 453 } while(0)
Kojto 90:cb3d968589d8 454 #endif /* defined(STM32F030x6) || defined(STM32F031x6) || defined(STM32F038xx) */
Kojto 90:cb3d968589d8 455
Kojto 108:34e6b704fe68 456
Kojto 108:34e6b704fe68 457 /** @brief Compute the USART mask to apply to retrieve the received data
Kojto 90:cb3d968589d8 458 * according to the word length and to the parity bits activation.
Kojto 108:34e6b704fe68 459 * @note If PCE = 1, the parity bit is not included in the data extracted
Kojto 90:cb3d968589d8 460 * by the reception API().
Kojto 90:cb3d968589d8 461 * This masking operation is not carried out in the case of
Kojto 108:34e6b704fe68 462 * DMA transfers.
Kojto 108:34e6b704fe68 463 * @param __HANDLE__: specifies the USART Handle.
Kojto 108:34e6b704fe68 464 * @retval None, the mask to apply to USART RDR register is stored in (__HANDLE__)->Mask field.
Kojto 108:34e6b704fe68 465 */
Kojto 93:e188a91d3eaa 466 #if defined (STM32F042x6) || defined (STM32F048xx) || defined (STM32F070x6) || \
Kojto 93:e188a91d3eaa 467 defined (STM32F071xB) || defined (STM32F072xB) || defined (STM32F078xx) || defined (STM32F070xB) || \
Kojto 93:e188a91d3eaa 468 defined (STM32F091xC) || defined (STM32F098xx) || defined (STM32F030xC)
Kojto 108:34e6b704fe68 469 #define USART_MASK_COMPUTATION(__HANDLE__) \
Kojto 90:cb3d968589d8 470 do { \
Kojto 90:cb3d968589d8 471 if ((__HANDLE__)->Init.WordLength == USART_WORDLENGTH_9B) \
Kojto 90:cb3d968589d8 472 { \
Kojto 90:cb3d968589d8 473 if ((__HANDLE__)->Init.Parity == USART_PARITY_NONE) \
Kojto 90:cb3d968589d8 474 { \
Kojto 90:cb3d968589d8 475 (__HANDLE__)->Mask = 0x01FF ; \
Kojto 90:cb3d968589d8 476 } \
Kojto 90:cb3d968589d8 477 else \
Kojto 90:cb3d968589d8 478 { \
Kojto 90:cb3d968589d8 479 (__HANDLE__)->Mask = 0x00FF ; \
Kojto 90:cb3d968589d8 480 } \
Kojto 90:cb3d968589d8 481 } \
Kojto 90:cb3d968589d8 482 else if ((__HANDLE__)->Init.WordLength == USART_WORDLENGTH_8B) \
Kojto 90:cb3d968589d8 483 { \
Kojto 90:cb3d968589d8 484 if ((__HANDLE__)->Init.Parity == USART_PARITY_NONE) \
Kojto 90:cb3d968589d8 485 { \
Kojto 90:cb3d968589d8 486 (__HANDLE__)->Mask = 0x00FF ; \
Kojto 90:cb3d968589d8 487 } \
Kojto 90:cb3d968589d8 488 else \
Kojto 90:cb3d968589d8 489 { \
Kojto 90:cb3d968589d8 490 (__HANDLE__)->Mask = 0x007F ; \
Kojto 90:cb3d968589d8 491 } \
Kojto 90:cb3d968589d8 492 } \
Kojto 90:cb3d968589d8 493 else if ((__HANDLE__)->Init.WordLength == USART_WORDLENGTH_7B) \
Kojto 90:cb3d968589d8 494 { \
Kojto 90:cb3d968589d8 495 if ((__HANDLE__)->Init.Parity == USART_PARITY_NONE) \
Kojto 90:cb3d968589d8 496 { \
Kojto 90:cb3d968589d8 497 (__HANDLE__)->Mask = 0x007F ; \
Kojto 90:cb3d968589d8 498 } \
Kojto 90:cb3d968589d8 499 else \
Kojto 90:cb3d968589d8 500 { \
Kojto 90:cb3d968589d8 501 (__HANDLE__)->Mask = 0x003F ; \
Kojto 90:cb3d968589d8 502 } \
Kojto 90:cb3d968589d8 503 } \
Kojto 108:34e6b704fe68 504 } while(0)
Kojto 90:cb3d968589d8 505 #else
Kojto 108:34e6b704fe68 506 #define USART_MASK_COMPUTATION(__HANDLE__) \
Kojto 90:cb3d968589d8 507 do { \
Kojto 90:cb3d968589d8 508 if ((__HANDLE__)->Init.WordLength == USART_WORDLENGTH_9B) \
Kojto 90:cb3d968589d8 509 { \
Kojto 90:cb3d968589d8 510 if ((__HANDLE__)->Init.Parity == USART_PARITY_NONE) \
Kojto 90:cb3d968589d8 511 { \
Kojto 90:cb3d968589d8 512 (__HANDLE__)->Mask = 0x01FF ; \
Kojto 90:cb3d968589d8 513 } \
Kojto 90:cb3d968589d8 514 else \
Kojto 90:cb3d968589d8 515 { \
Kojto 90:cb3d968589d8 516 (__HANDLE__)->Mask = 0x00FF ; \
Kojto 90:cb3d968589d8 517 } \
Kojto 90:cb3d968589d8 518 } \
Kojto 90:cb3d968589d8 519 else if ((__HANDLE__)->Init.WordLength == USART_WORDLENGTH_8B) \
Kojto 90:cb3d968589d8 520 { \
Kojto 90:cb3d968589d8 521 if ((__HANDLE__)->Init.Parity == USART_PARITY_NONE) \
Kojto 90:cb3d968589d8 522 { \
Kojto 90:cb3d968589d8 523 (__HANDLE__)->Mask = 0x00FF ; \
Kojto 90:cb3d968589d8 524 } \
Kojto 90:cb3d968589d8 525 else \
Kojto 90:cb3d968589d8 526 { \
Kojto 90:cb3d968589d8 527 (__HANDLE__)->Mask = 0x007F ; \
Kojto 90:cb3d968589d8 528 } \
Kojto 90:cb3d968589d8 529 } \
Kojto 108:34e6b704fe68 530 } while(0)
Kojto 93:e188a91d3eaa 531 #endif /* defined (STM32F042x6) || defined (STM32F048xx) || defined (STM32F070x6) || \
Kojto 93:e188a91d3eaa 532 defined (STM32F071xB) || defined (STM32F072xB) || defined (STM32F078xx) || defined (STM32F070xB) || \
Kojto 93:e188a91d3eaa 533 defined (STM32F091xC) || defined (STM32F098xx) || defined (STM32F030xC) */
Kojto 108:34e6b704fe68 534
Kojto 108:34e6b704fe68 535
Kojto 108:34e6b704fe68 536 /**
Kojto 108:34e6b704fe68 537 * @brief Ensure that USART frame length is valid.
Kojto 108:34e6b704fe68 538 * @param __LENGTH__: USART frame length.
Kojto 108:34e6b704fe68 539 * @retval SET (__LENGTH__ is valid) or RESET (__LENGTH__ is invalid)
Kojto 108:34e6b704fe68 540 */
Kojto 108:34e6b704fe68 541 #if defined (STM32F042x6) || defined (STM32F048xx) || defined (STM32F070x6) || \
Kojto 108:34e6b704fe68 542 defined (STM32F071xB) || defined (STM32F072xB) || defined (STM32F078xx) || defined (STM32F070xB) || \
Kojto 108:34e6b704fe68 543 defined (STM32F091xC) || defined (STM32F098xx) || defined (STM32F030xC)
Kojto 108:34e6b704fe68 544 #define IS_USART_WORD_LENGTH(__LENGTH__) (((__LENGTH__) == USART_WORDLENGTH_7B) || \
Kojto 108:34e6b704fe68 545 ((__LENGTH__) == USART_WORDLENGTH_8B) || \
Kojto 108:34e6b704fe68 546 ((__LENGTH__) == USART_WORDLENGTH_9B))
Kojto 108:34e6b704fe68 547 #else
Kojto 108:34e6b704fe68 548 #define IS_USART_WORD_LENGTH(__LENGTH__) (((__LENGTH__) == USART_WORDLENGTH_8B) || \
Kojto 108:34e6b704fe68 549 ((__LENGTH__) == USART_WORDLENGTH_9B))
Kojto 108:34e6b704fe68 550 #endif /* defined (STM32F042x6) || defined (STM32F048xx) || defined (STM32F070x6) || defined (STM32F070xB) || \
Kojto 108:34e6b704fe68 551 defined (STM32F071xB) || defined (STM32F072xB) || defined (STM32F078xx) || \
Kojto 108:34e6b704fe68 552 defined (STM32F091xC) || defined (STM32F098xx) || defined (STM32F030xC) */
Kojto 108:34e6b704fe68 553
Kojto 108:34e6b704fe68 554 /**
Kojto 108:34e6b704fe68 555 * @brief Ensure that USART request parameter is valid.
Kojto 108:34e6b704fe68 556 * @param __PARAM__: USART request parameter.
Kojto 108:34e6b704fe68 557 * @retval SET (__PARAM__ is valid) or RESET (__PARAM__ is invalid)
Kojto 108:34e6b704fe68 558 */
Kojto 108:34e6b704fe68 559 #if !defined(STM32F030x6) && !defined(STM32F030x8) && !defined(STM32F070x6) && !defined(STM32F070xB) && !defined(STM32F030xC)
Kojto 108:34e6b704fe68 560 #define IS_USART_REQUEST_PARAMETER(__PARAM__) (((__PARAM__) == USART_RXDATA_FLUSH_REQUEST) || \
Kojto 108:34e6b704fe68 561 ((__PARAM__) == USART_TXDATA_FLUSH_REQUEST))
Kojto 108:34e6b704fe68 562 #else
Kojto 108:34e6b704fe68 563 #define IS_USART_REQUEST_PARAMETER(__PARAM__) ((__PARAM__) == USART_RXDATA_FLUSH_REQUEST)
Kojto 108:34e6b704fe68 564 #endif /* !defined(STM32F030x6) && !defined(STM32F030x8) && !defined(STM32F070x6) && !defined(STM32F070xB) && !defined(STM32F030xC) */
Kojto 108:34e6b704fe68 565
Kojto 90:cb3d968589d8 566 /**
Kojto 90:cb3d968589d8 567 * @}
Kojto 90:cb3d968589d8 568 */
Kojto 90:cb3d968589d8 569
Kojto 90:cb3d968589d8 570 /* Exported functions --------------------------------------------------------*/
Kojto 90:cb3d968589d8 571
Kojto 90:cb3d968589d8 572 /**
Kojto 90:cb3d968589d8 573 * @}
Kojto 108:34e6b704fe68 574 */
Kojto 90:cb3d968589d8 575
Kojto 90:cb3d968589d8 576 /**
Kojto 90:cb3d968589d8 577 * @}
Kojto 108:34e6b704fe68 578 */
Kojto 108:34e6b704fe68 579
Kojto 90:cb3d968589d8 580 #ifdef __cplusplus
Kojto 90:cb3d968589d8 581 }
Kojto 90:cb3d968589d8 582 #endif
Kojto 90:cb3d968589d8 583
Kojto 90:cb3d968589d8 584 #endif /* __STM32F0xx_HAL_USART_EX_H */
Kojto 90:cb3d968589d8 585
Kojto 90:cb3d968589d8 586 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
Kojto 90:cb3d968589d8 587