Fork of the official mbed C/C SDK provides the software platform and libraries to build your applications for RenBED.

Dependents:   1-RenBuggyTimed RenBED_RGB RenBED_RGB_PWM RenBED_RGB

Fork of mbed by mbed official

Committer:
elijahorr
Date:
Thu Apr 14 07:28:54 2016 +0000
Revision:
121:672067c3ada4
Parent:
108:34e6b704fe68
.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Kojto 93:e188a91d3eaa 1 /**
Kojto 93:e188a91d3eaa 2 ******************************************************************************
Kojto 93:e188a91d3eaa 3 * @file stm32f0xx_hal_usart_ex.h
Kojto 93:e188a91d3eaa 4 * @author MCD Application Team
Kojto 108:34e6b704fe68 5 * @version V1.3.0
Kojto 108:34e6b704fe68 6 * @date 26-June-2015
Kojto 93:e188a91d3eaa 7 * @brief Header file of USART HAL Extension module.
Kojto 93:e188a91d3eaa 8 ******************************************************************************
Kojto 93:e188a91d3eaa 9 * @attention
Kojto 108:34e6b704fe68 10 *
Kojto 108:34e6b704fe68 11 * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
Kojto 93:e188a91d3eaa 12 *
Kojto 93:e188a91d3eaa 13 * Redistribution and use in source and binary forms, with or without modification,
Kojto 93:e188a91d3eaa 14 * are permitted provided that the following conditions are met:
Kojto 93:e188a91d3eaa 15 * 1. Redistributions of source code must retain the above copyright notice,
Kojto 93:e188a91d3eaa 16 * this list of conditions and the following disclaimer.
Kojto 93:e188a91d3eaa 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
Kojto 93:e188a91d3eaa 18 * this list of conditions and the following disclaimer in the documentation
Kojto 93:e188a91d3eaa 19 * and/or other materials provided with the distribution.
Kojto 93:e188a91d3eaa 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
Kojto 93:e188a91d3eaa 21 * may be used to endorse or promote products derived from this software
Kojto 93:e188a91d3eaa 22 * without specific prior written permission.
Kojto 93:e188a91d3eaa 23 *
Kojto 93:e188a91d3eaa 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
Kojto 93:e188a91d3eaa 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Kojto 93:e188a91d3eaa 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Kojto 93:e188a91d3eaa 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
Kojto 93:e188a91d3eaa 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Kojto 93:e188a91d3eaa 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
Kojto 93:e188a91d3eaa 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
Kojto 93:e188a91d3eaa 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
Kojto 93:e188a91d3eaa 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Kojto 93:e188a91d3eaa 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Kojto 93:e188a91d3eaa 34 *
Kojto 108:34e6b704fe68 35 ******************************************************************************
Kojto 93:e188a91d3eaa 36 */
Kojto 93:e188a91d3eaa 37
Kojto 93:e188a91d3eaa 38 /* Define to prevent recursive inclusion -------------------------------------*/
Kojto 93:e188a91d3eaa 39 #ifndef __STM32F0xx_HAL_USART_EX_H
Kojto 93:e188a91d3eaa 40 #define __STM32F0xx_HAL_USART_EX_H
Kojto 93:e188a91d3eaa 41
Kojto 93:e188a91d3eaa 42 #ifdef __cplusplus
Kojto 93:e188a91d3eaa 43 extern "C" {
Kojto 93:e188a91d3eaa 44 #endif
Kojto 93:e188a91d3eaa 45
Kojto 93:e188a91d3eaa 46 /* Includes ------------------------------------------------------------------*/
Kojto 93:e188a91d3eaa 47 #include "stm32f0xx_hal_def.h"
Kojto 93:e188a91d3eaa 48
Kojto 93:e188a91d3eaa 49 /** @addtogroup STM32F0xx_HAL_Driver
Kojto 93:e188a91d3eaa 50 * @{
Kojto 93:e188a91d3eaa 51 */
Kojto 93:e188a91d3eaa 52
Kojto 108:34e6b704fe68 53 /** @defgroup USARTEx USARTEx
Kojto 93:e188a91d3eaa 54 * @{
Kojto 93:e188a91d3eaa 55 */
Kojto 93:e188a91d3eaa 56
Kojto 93:e188a91d3eaa 57 /* Exported types ------------------------------------------------------------*/
Kojto 93:e188a91d3eaa 58 /* Exported constants --------------------------------------------------------*/
Kojto 93:e188a91d3eaa 59 /** @defgroup USARTEx_Exported_Constants USARTEx Exported Constants
Kojto 93:e188a91d3eaa 60 * @{
Kojto 93:e188a91d3eaa 61 */
Kojto 108:34e6b704fe68 62
Kojto 93:e188a91d3eaa 63 /** @defgroup USARTEx_Word_Length USARTEx Word Length
Kojto 93:e188a91d3eaa 64 * @{
Kojto 93:e188a91d3eaa 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 93:e188a91d3eaa 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 93:e188a91d3eaa 76 defined (STM32F071xB) || defined (STM32F072xB) || defined (STM32F078xx) || \
Kojto 93:e188a91d3eaa 77 defined (STM32F091xC) || defined (STM32F098xx) || defined (STM32F030xC) */
Kojto 93:e188a91d3eaa 78 /**
Kojto 93:e188a91d3eaa 79 * @}
Kojto 93:e188a91d3eaa 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 93:e188a91d3eaa 114 /**
Kojto 93:e188a91d3eaa 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 93:e188a91d3eaa 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 93:e188a91d3eaa 150 * @{
Kojto 93:e188a91d3eaa 151 */
Kojto 93:e188a91d3eaa 152
Kojto 93:e188a91d3eaa 153 /** @brief Reports the USART clock source.
Kojto 93:e188a91d3eaa 154 * @param __HANDLE__: specifies the USART Handle
Kojto 93:e188a91d3eaa 155 * @param __CLOCKSOURCE__ : output variable
Kojto 93:e188a91d3eaa 156 * @retval the USART clocking source, written in __CLOCKSOURCE__.
Kojto 93:e188a91d3eaa 157 */
Kojto 93:e188a91d3eaa 158 #if defined(STM32F030x6) || defined(STM32F031x6) || defined(STM32F038xx)
Kojto 108:34e6b704fe68 159 #define USART_GETCLOCKSOURCE(__HANDLE__,__CLOCKSOURCE__) \
Kojto 93:e188a91d3eaa 160 do { \
Kojto 93:e188a91d3eaa 161 switch(__HAL_RCC_GET_USART1_SOURCE()) \
Kojto 93:e188a91d3eaa 162 { \
Kojto 93:e188a91d3eaa 163 case RCC_USART1CLKSOURCE_PCLK1: \
Kojto 93:e188a91d3eaa 164 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_PCLK1; \
Kojto 93:e188a91d3eaa 165 break; \
Kojto 93:e188a91d3eaa 166 case RCC_USART1CLKSOURCE_HSI: \
Kojto 93:e188a91d3eaa 167 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_HSI; \
Kojto 93:e188a91d3eaa 168 break; \
Kojto 93:e188a91d3eaa 169 case RCC_USART1CLKSOURCE_SYSCLK: \
Kojto 93:e188a91d3eaa 170 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_SYSCLK; \
Kojto 93:e188a91d3eaa 171 break; \
Kojto 93:e188a91d3eaa 172 case RCC_USART1CLKSOURCE_LSE: \
Kojto 93:e188a91d3eaa 173 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_LSE; \
Kojto 93:e188a91d3eaa 174 break; \
Kojto 93:e188a91d3eaa 175 default: \
Kojto 93:e188a91d3eaa 176 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_UNDEFINED; \
Kojto 93:e188a91d3eaa 177 break; \
Kojto 93:e188a91d3eaa 178 } \
Kojto 93:e188a91d3eaa 179 } while(0)
Kojto 93:e188a91d3eaa 180 #elif defined (STM32F030x8) || defined (STM32F070x6) || \
Kojto 93:e188a91d3eaa 181 defined (STM32F042x6) || defined (STM32F048xx) || \
Kojto 93:e188a91d3eaa 182 defined (STM32F051x8) || defined (STM32F058xx)
Kojto 108:34e6b704fe68 183 #define USART_GETCLOCKSOURCE(__HANDLE__,__CLOCKSOURCE__) \
Kojto 93:e188a91d3eaa 184 do { \
Kojto 93:e188a91d3eaa 185 if((__HANDLE__)->Instance == USART1) \
Kojto 93:e188a91d3eaa 186 { \
Kojto 93:e188a91d3eaa 187 switch(__HAL_RCC_GET_USART1_SOURCE()) \
Kojto 93:e188a91d3eaa 188 { \
Kojto 93:e188a91d3eaa 189 case RCC_USART1CLKSOURCE_PCLK1: \
Kojto 93:e188a91d3eaa 190 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_PCLK1; \
Kojto 93:e188a91d3eaa 191 break; \
Kojto 93:e188a91d3eaa 192 case RCC_USART1CLKSOURCE_HSI: \
Kojto 93:e188a91d3eaa 193 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_HSI; \
Kojto 93:e188a91d3eaa 194 break; \
Kojto 93:e188a91d3eaa 195 case RCC_USART1CLKSOURCE_SYSCLK: \
Kojto 93:e188a91d3eaa 196 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_SYSCLK; \
Kojto 93:e188a91d3eaa 197 break; \
Kojto 93:e188a91d3eaa 198 case RCC_USART1CLKSOURCE_LSE: \
Kojto 93:e188a91d3eaa 199 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_LSE; \
Kojto 93:e188a91d3eaa 200 break; \
Kojto 93:e188a91d3eaa 201 default: \
Kojto 93:e188a91d3eaa 202 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_UNDEFINED; \
Kojto 93:e188a91d3eaa 203 break; \
Kojto 93:e188a91d3eaa 204 } \
Kojto 93:e188a91d3eaa 205 } \
Kojto 93:e188a91d3eaa 206 else if((__HANDLE__)->Instance == USART2) \
Kojto 93:e188a91d3eaa 207 { \
Kojto 93:e188a91d3eaa 208 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_PCLK1; \
Kojto 93:e188a91d3eaa 209 } \
Kojto 93:e188a91d3eaa 210 else \
Kojto 93:e188a91d3eaa 211 { \
Kojto 93:e188a91d3eaa 212 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_UNDEFINED; \
Kojto 93:e188a91d3eaa 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 93:e188a91d3eaa 256 #elif defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx)
Kojto 108:34e6b704fe68 257 #define USART_GETCLOCKSOURCE(__HANDLE__,__CLOCKSOURCE__) \
Kojto 93:e188a91d3eaa 258 do { \
Kojto 93:e188a91d3eaa 259 if((__HANDLE__)->Instance == USART1) \
Kojto 93:e188a91d3eaa 260 { \
Kojto 93:e188a91d3eaa 261 switch(__HAL_RCC_GET_USART1_SOURCE()) \
Kojto 93:e188a91d3eaa 262 { \
Kojto 93:e188a91d3eaa 263 case RCC_USART1CLKSOURCE_PCLK1: \
Kojto 93:e188a91d3eaa 264 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_PCLK1; \
Kojto 93:e188a91d3eaa 265 break; \
Kojto 93:e188a91d3eaa 266 case RCC_USART1CLKSOURCE_HSI: \
Kojto 93:e188a91d3eaa 267 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_HSI; \
Kojto 93:e188a91d3eaa 268 break; \
Kojto 93:e188a91d3eaa 269 case RCC_USART1CLKSOURCE_SYSCLK: \
Kojto 93:e188a91d3eaa 270 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_SYSCLK; \
Kojto 93:e188a91d3eaa 271 break; \
Kojto 93:e188a91d3eaa 272 case RCC_USART1CLKSOURCE_LSE: \
Kojto 93:e188a91d3eaa 273 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_LSE; \
Kojto 93:e188a91d3eaa 274 break; \
Kojto 93:e188a91d3eaa 275 default: \
Kojto 93:e188a91d3eaa 276 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_UNDEFINED; \
Kojto 93:e188a91d3eaa 277 break; \
Kojto 93:e188a91d3eaa 278 } \
Kojto 93:e188a91d3eaa 279 } \
Kojto 93:e188a91d3eaa 280 else if((__HANDLE__)->Instance == USART2) \
Kojto 93:e188a91d3eaa 281 { \
Kojto 93:e188a91d3eaa 282 switch(__HAL_RCC_GET_USART2_SOURCE()) \
Kojto 93:e188a91d3eaa 283 { \
Kojto 93:e188a91d3eaa 284 case RCC_USART2CLKSOURCE_PCLK1: \
Kojto 93:e188a91d3eaa 285 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_PCLK1; \
Kojto 93:e188a91d3eaa 286 break; \
Kojto 93:e188a91d3eaa 287 case RCC_USART2CLKSOURCE_HSI: \
Kojto 93:e188a91d3eaa 288 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_HSI; \
Kojto 93:e188a91d3eaa 289 break; \
Kojto 93:e188a91d3eaa 290 case RCC_USART2CLKSOURCE_SYSCLK: \
Kojto 93:e188a91d3eaa 291 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_SYSCLK; \
Kojto 93:e188a91d3eaa 292 break; \
Kojto 93:e188a91d3eaa 293 case RCC_USART2CLKSOURCE_LSE: \
Kojto 93:e188a91d3eaa 294 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_LSE; \
Kojto 93:e188a91d3eaa 295 break; \
Kojto 93:e188a91d3eaa 296 default: \
Kojto 93:e188a91d3eaa 297 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_UNDEFINED; \
Kojto 93:e188a91d3eaa 298 break; \
Kojto 93:e188a91d3eaa 299 } \
Kojto 93:e188a91d3eaa 300 } \
Kojto 93:e188a91d3eaa 301 else if((__HANDLE__)->Instance == USART3) \
Kojto 93:e188a91d3eaa 302 { \
Kojto 93:e188a91d3eaa 303 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_PCLK1; \
Kojto 93:e188a91d3eaa 304 } \
Kojto 93:e188a91d3eaa 305 else if((__HANDLE__)->Instance == USART4) \
Kojto 93:e188a91d3eaa 306 { \
Kojto 93:e188a91d3eaa 307 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_PCLK1; \
Kojto 93:e188a91d3eaa 308 } \
Kojto 93:e188a91d3eaa 309 else \
Kojto 93:e188a91d3eaa 310 { \
Kojto 93:e188a91d3eaa 311 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_UNDEFINED; \
Kojto 93:e188a91d3eaa 312 } \
Kojto 108:34e6b704fe68 313 } while(0)
Kojto 93:e188a91d3eaa 314 #elif defined(STM32F091xC) || defined (STM32F098xx)
Kojto 108:34e6b704fe68 315 #define USART_GETCLOCKSOURCE(__HANDLE__,__CLOCKSOURCE__) \
Kojto 93:e188a91d3eaa 316 do { \
Kojto 93:e188a91d3eaa 317 if((__HANDLE__)->Instance == USART1) \
Kojto 93:e188a91d3eaa 318 { \
Kojto 93:e188a91d3eaa 319 switch(__HAL_RCC_GET_USART1_SOURCE()) \
Kojto 93:e188a91d3eaa 320 { \
Kojto 93:e188a91d3eaa 321 case RCC_USART1CLKSOURCE_PCLK1: \
Kojto 93:e188a91d3eaa 322 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_PCLK1; \
Kojto 93:e188a91d3eaa 323 break; \
Kojto 93:e188a91d3eaa 324 case RCC_USART1CLKSOURCE_HSI: \
Kojto 93:e188a91d3eaa 325 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_HSI; \
Kojto 93:e188a91d3eaa 326 break; \
Kojto 93:e188a91d3eaa 327 case RCC_USART1CLKSOURCE_SYSCLK: \
Kojto 93:e188a91d3eaa 328 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_SYSCLK; \
Kojto 93:e188a91d3eaa 329 break; \
Kojto 93:e188a91d3eaa 330 case RCC_USART1CLKSOURCE_LSE: \
Kojto 93:e188a91d3eaa 331 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_LSE; \
Kojto 93:e188a91d3eaa 332 break; \
Kojto 93:e188a91d3eaa 333 default: \
Kojto 93:e188a91d3eaa 334 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_UNDEFINED; \
Kojto 93:e188a91d3eaa 335 break; \
Kojto 93:e188a91d3eaa 336 } \
Kojto 93:e188a91d3eaa 337 } \
Kojto 93:e188a91d3eaa 338 else if((__HANDLE__)->Instance == USART2) \
Kojto 93:e188a91d3eaa 339 { \
Kojto 93:e188a91d3eaa 340 switch(__HAL_RCC_GET_USART2_SOURCE()) \
Kojto 93:e188a91d3eaa 341 { \
Kojto 93:e188a91d3eaa 342 case RCC_USART2CLKSOURCE_PCLK1: \
Kojto 93:e188a91d3eaa 343 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_PCLK1; \
Kojto 93:e188a91d3eaa 344 break; \
Kojto 93:e188a91d3eaa 345 case RCC_USART2CLKSOURCE_HSI: \
Kojto 93:e188a91d3eaa 346 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_HSI; \
Kojto 93:e188a91d3eaa 347 break; \
Kojto 93:e188a91d3eaa 348 case RCC_USART2CLKSOURCE_SYSCLK: \
Kojto 93:e188a91d3eaa 349 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_SYSCLK; \
Kojto 93:e188a91d3eaa 350 break; \
Kojto 93:e188a91d3eaa 351 case RCC_USART2CLKSOURCE_LSE: \
Kojto 93:e188a91d3eaa 352 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_LSE; \
Kojto 93:e188a91d3eaa 353 break; \
Kojto 93:e188a91d3eaa 354 default: \
Kojto 93:e188a91d3eaa 355 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_UNDEFINED; \
Kojto 93:e188a91d3eaa 356 break; \
Kojto 93:e188a91d3eaa 357 } \
Kojto 93:e188a91d3eaa 358 } \
Kojto 93:e188a91d3eaa 359 else if((__HANDLE__)->Instance == USART3) \
Kojto 93:e188a91d3eaa 360 { \
Kojto 93:e188a91d3eaa 361 switch(__HAL_RCC_GET_USART3_SOURCE()) \
Kojto 93:e188a91d3eaa 362 { \
Kojto 93:e188a91d3eaa 363 case RCC_USART3CLKSOURCE_PCLK1: \
Kojto 93:e188a91d3eaa 364 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_PCLK1; \
Kojto 93:e188a91d3eaa 365 break; \
Kojto 93:e188a91d3eaa 366 case RCC_USART3CLKSOURCE_HSI: \
Kojto 93:e188a91d3eaa 367 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_HSI; \
Kojto 93:e188a91d3eaa 368 break; \
Kojto 93:e188a91d3eaa 369 case RCC_USART3CLKSOURCE_SYSCLK: \
Kojto 93:e188a91d3eaa 370 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_SYSCLK; \
Kojto 93:e188a91d3eaa 371 break; \
Kojto 93:e188a91d3eaa 372 case RCC_USART3CLKSOURCE_LSE: \
Kojto 93:e188a91d3eaa 373 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_LSE; \
Kojto 93:e188a91d3eaa 374 break; \
Kojto 93:e188a91d3eaa 375 default: \
Kojto 93:e188a91d3eaa 376 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_UNDEFINED; \
Kojto 93:e188a91d3eaa 377 break; \
Kojto 93:e188a91d3eaa 378 } \
Kojto 93:e188a91d3eaa 379 } \
Kojto 93:e188a91d3eaa 380 else if((__HANDLE__)->Instance == USART4) \
Kojto 93:e188a91d3eaa 381 { \
Kojto 93:e188a91d3eaa 382 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_PCLK1; \
Kojto 93:e188a91d3eaa 383 } \
Kojto 93:e188a91d3eaa 384 else if((__HANDLE__)->Instance == USART5) \
Kojto 93:e188a91d3eaa 385 { \
Kojto 93:e188a91d3eaa 386 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_PCLK1; \
Kojto 93:e188a91d3eaa 387 } \
Kojto 93:e188a91d3eaa 388 else if((__HANDLE__)->Instance == USART6) \
Kojto 93:e188a91d3eaa 389 { \
Kojto 93:e188a91d3eaa 390 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_PCLK1; \
Kojto 93:e188a91d3eaa 391 } \
Kojto 93:e188a91d3eaa 392 else if((__HANDLE__)->Instance == USART7) \
Kojto 93:e188a91d3eaa 393 { \
Kojto 93:e188a91d3eaa 394 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_PCLK1; \
Kojto 93:e188a91d3eaa 395 } \
Kojto 93:e188a91d3eaa 396 else if((__HANDLE__)->Instance == USART8) \
Kojto 93:e188a91d3eaa 397 { \
Kojto 93:e188a91d3eaa 398 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_PCLK1; \
Kojto 93:e188a91d3eaa 399 } \
Kojto 93:e188a91d3eaa 400 else \
Kojto 93:e188a91d3eaa 401 { \
Kojto 93:e188a91d3eaa 402 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_UNDEFINED; \
Kojto 93:e188a91d3eaa 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 93:e188a91d3eaa 454 #endif /* defined(STM32F030x6) || defined(STM32F031x6) || defined(STM32F038xx) */
Kojto 93:e188a91d3eaa 455
Kojto 108:34e6b704fe68 456
Kojto 108:34e6b704fe68 457 /** @brief Compute the USART mask to apply to retrieve the received data
Kojto 93:e188a91d3eaa 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 93:e188a91d3eaa 460 * by the reception API().
Kojto 93:e188a91d3eaa 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 93:e188a91d3eaa 470 do { \
Kojto 93:e188a91d3eaa 471 if ((__HANDLE__)->Init.WordLength == USART_WORDLENGTH_9B) \
Kojto 93:e188a91d3eaa 472 { \
Kojto 93:e188a91d3eaa 473 if ((__HANDLE__)->Init.Parity == USART_PARITY_NONE) \
Kojto 93:e188a91d3eaa 474 { \
Kojto 93:e188a91d3eaa 475 (__HANDLE__)->Mask = 0x01FF ; \
Kojto 93:e188a91d3eaa 476 } \
Kojto 93:e188a91d3eaa 477 else \
Kojto 93:e188a91d3eaa 478 { \
Kojto 93:e188a91d3eaa 479 (__HANDLE__)->Mask = 0x00FF ; \
Kojto 93:e188a91d3eaa 480 } \
Kojto 93:e188a91d3eaa 481 } \
Kojto 93:e188a91d3eaa 482 else if ((__HANDLE__)->Init.WordLength == USART_WORDLENGTH_8B) \
Kojto 93:e188a91d3eaa 483 { \
Kojto 93:e188a91d3eaa 484 if ((__HANDLE__)->Init.Parity == USART_PARITY_NONE) \
Kojto 93:e188a91d3eaa 485 { \
Kojto 93:e188a91d3eaa 486 (__HANDLE__)->Mask = 0x00FF ; \
Kojto 93:e188a91d3eaa 487 } \
Kojto 93:e188a91d3eaa 488 else \
Kojto 93:e188a91d3eaa 489 { \
Kojto 93:e188a91d3eaa 490 (__HANDLE__)->Mask = 0x007F ; \
Kojto 93:e188a91d3eaa 491 } \
Kojto 93:e188a91d3eaa 492 } \
Kojto 93:e188a91d3eaa 493 else if ((__HANDLE__)->Init.WordLength == USART_WORDLENGTH_7B) \
Kojto 93:e188a91d3eaa 494 { \
Kojto 93:e188a91d3eaa 495 if ((__HANDLE__)->Init.Parity == USART_PARITY_NONE) \
Kojto 93:e188a91d3eaa 496 { \
Kojto 93:e188a91d3eaa 497 (__HANDLE__)->Mask = 0x007F ; \
Kojto 93:e188a91d3eaa 498 } \
Kojto 93:e188a91d3eaa 499 else \
Kojto 93:e188a91d3eaa 500 { \
Kojto 93:e188a91d3eaa 501 (__HANDLE__)->Mask = 0x003F ; \
Kojto 93:e188a91d3eaa 502 } \
Kojto 93:e188a91d3eaa 503 } \
Kojto 108:34e6b704fe68 504 } while(0)
Kojto 93:e188a91d3eaa 505 #else
Kojto 108:34e6b704fe68 506 #define USART_MASK_COMPUTATION(__HANDLE__) \
Kojto 93:e188a91d3eaa 507 do { \
Kojto 93:e188a91d3eaa 508 if ((__HANDLE__)->Init.WordLength == USART_WORDLENGTH_9B) \
Kojto 93:e188a91d3eaa 509 { \
Kojto 93:e188a91d3eaa 510 if ((__HANDLE__)->Init.Parity == USART_PARITY_NONE) \
Kojto 93:e188a91d3eaa 511 { \
Kojto 93:e188a91d3eaa 512 (__HANDLE__)->Mask = 0x01FF ; \
Kojto 93:e188a91d3eaa 513 } \
Kojto 93:e188a91d3eaa 514 else \
Kojto 93:e188a91d3eaa 515 { \
Kojto 93:e188a91d3eaa 516 (__HANDLE__)->Mask = 0x00FF ; \
Kojto 93:e188a91d3eaa 517 } \
Kojto 93:e188a91d3eaa 518 } \
Kojto 93:e188a91d3eaa 519 else if ((__HANDLE__)->Init.WordLength == USART_WORDLENGTH_8B) \
Kojto 93:e188a91d3eaa 520 { \
Kojto 93:e188a91d3eaa 521 if ((__HANDLE__)->Init.Parity == USART_PARITY_NONE) \
Kojto 93:e188a91d3eaa 522 { \
Kojto 93:e188a91d3eaa 523 (__HANDLE__)->Mask = 0x00FF ; \
Kojto 93:e188a91d3eaa 524 } \
Kojto 93:e188a91d3eaa 525 else \
Kojto 93:e188a91d3eaa 526 { \
Kojto 93:e188a91d3eaa 527 (__HANDLE__)->Mask = 0x007F ; \
Kojto 93:e188a91d3eaa 528 } \
Kojto 93:e188a91d3eaa 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 93:e188a91d3eaa 566 /**
Kojto 93:e188a91d3eaa 567 * @}
Kojto 93:e188a91d3eaa 568 */
Kojto 93:e188a91d3eaa 569
Kojto 93:e188a91d3eaa 570 /* Exported functions --------------------------------------------------------*/
Kojto 93:e188a91d3eaa 571
Kojto 93:e188a91d3eaa 572 /**
Kojto 93:e188a91d3eaa 573 * @}
Kojto 108:34e6b704fe68 574 */
Kojto 93:e188a91d3eaa 575
Kojto 93:e188a91d3eaa 576 /**
Kojto 93:e188a91d3eaa 577 * @}
Kojto 108:34e6b704fe68 578 */
Kojto 108:34e6b704fe68 579
Kojto 93:e188a91d3eaa 580 #ifdef __cplusplus
Kojto 93:e188a91d3eaa 581 }
Kojto 93:e188a91d3eaa 582 #endif
Kojto 93:e188a91d3eaa 583
Kojto 93:e188a91d3eaa 584 #endif /* __STM32F0xx_HAL_USART_EX_H */
Kojto 93:e188a91d3eaa 585
Kojto 93:e188a91d3eaa 586 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
Kojto 93:e188a91d3eaa 587