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
bogdanm 85:024bf7f99721 1 /**
bogdanm 85:024bf7f99721 2 ******************************************************************************
bogdanm 85:024bf7f99721 3 * @file stm32f0xx_hal_uart_ex.h
bogdanm 85:024bf7f99721 4 * @author MCD Application Team
Kojto 108:34e6b704fe68 5 * @version V1.3.0
Kojto 108:34e6b704fe68 6 * @date 26-June-2015
bogdanm 85:024bf7f99721 7 * @brief Header file of UART HAL Extension module.
bogdanm 85:024bf7f99721 8 ******************************************************************************
bogdanm 85:024bf7f99721 9 * @attention
bogdanm 85:024bf7f99721 10 *
Kojto 108:34e6b704fe68 11 * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
bogdanm 85:024bf7f99721 12 *
bogdanm 85:024bf7f99721 13 * Redistribution and use in source and binary forms, with or without modification,
bogdanm 85:024bf7f99721 14 * are permitted provided that the following conditions are met:
bogdanm 85:024bf7f99721 15 * 1. Redistributions of source code must retain the above copyright notice,
bogdanm 85:024bf7f99721 16 * this list of conditions and the following disclaimer.
bogdanm 85:024bf7f99721 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
bogdanm 85:024bf7f99721 18 * this list of conditions and the following disclaimer in the documentation
bogdanm 85:024bf7f99721 19 * and/or other materials provided with the distribution.
bogdanm 85:024bf7f99721 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
bogdanm 85:024bf7f99721 21 * may be used to endorse or promote products derived from this software
bogdanm 85:024bf7f99721 22 * without specific prior written permission.
bogdanm 85:024bf7f99721 23 *
bogdanm 85:024bf7f99721 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
bogdanm 85:024bf7f99721 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
bogdanm 85:024bf7f99721 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
bogdanm 85:024bf7f99721 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
bogdanm 85:024bf7f99721 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
bogdanm 85:024bf7f99721 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
bogdanm 85:024bf7f99721 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
bogdanm 85:024bf7f99721 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
bogdanm 85:024bf7f99721 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
bogdanm 85:024bf7f99721 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
bogdanm 85:024bf7f99721 34 *
Kojto 108:34e6b704fe68 35 ******************************************************************************
bogdanm 85:024bf7f99721 36 */
bogdanm 85:024bf7f99721 37
bogdanm 85:024bf7f99721 38 /* Define to prevent recursive inclusion -------------------------------------*/
bogdanm 85:024bf7f99721 39 #ifndef __STM32F0xx_HAL_UART_EX_H
bogdanm 85:024bf7f99721 40 #define __STM32F0xx_HAL_UART_EX_H
bogdanm 85:024bf7f99721 41
bogdanm 85:024bf7f99721 42 #ifdef __cplusplus
bogdanm 85:024bf7f99721 43 extern "C" {
bogdanm 85:024bf7f99721 44 #endif
bogdanm 85:024bf7f99721 45
bogdanm 85:024bf7f99721 46 /* Includes ------------------------------------------------------------------*/
bogdanm 85:024bf7f99721 47 #include "stm32f0xx_hal_def.h"
bogdanm 85:024bf7f99721 48
bogdanm 85:024bf7f99721 49 /** @addtogroup STM32F0xx_HAL_Driver
bogdanm 85:024bf7f99721 50 * @{
bogdanm 85:024bf7f99721 51 */
bogdanm 85:024bf7f99721 52
bogdanm 85:024bf7f99721 53 /** @addtogroup UARTEx
bogdanm 85:024bf7f99721 54 * @{
Kojto 108:34e6b704fe68 55 */
bogdanm 85:024bf7f99721 56
bogdanm 85:024bf7f99721 57 /* Exported types ------------------------------------------------------------*/
Kojto 93:e188a91d3eaa 58 #if !defined(STM32F030x6) && !defined(STM32F030x8) && !defined(STM32F070x6) && !defined(STM32F070xB) && !defined(STM32F030xC)
Kojto 93:e188a91d3eaa 59 /** @defgroup UARTEx_Exported_Types UARTEx Exported Types
Kojto 93:e188a91d3eaa 60 * @{
Kojto 93:e188a91d3eaa 61 */
Kojto 108:34e6b704fe68 62
Kojto 108:34e6b704fe68 63 /**
Kojto 108:34e6b704fe68 64 * @brief UART wake up from stop mode parameters
Kojto 108:34e6b704fe68 65 */
Kojto 108:34e6b704fe68 66 typedef struct
Kojto 93:e188a91d3eaa 67 {
Kojto 93:e188a91d3eaa 68 uint32_t WakeUpEvent; /*!< Specifies which event will activat the Wakeup from Stop mode flag (WUF).
Kojto 93:e188a91d3eaa 69 This parameter can be a value of @ref UART_WakeUp_from_Stop_Selection.
Kojto 93:e188a91d3eaa 70 If set to UART_WAKEUP_ON_ADDRESS, the two other fields below must
Kojto 93:e188a91d3eaa 71 be filled up. */
Kojto 108:34e6b704fe68 72
Kojto 93:e188a91d3eaa 73 uint16_t AddressLength; /*!< Specifies whether the address is 4 or 7-bit long.
Kojto 93:e188a91d3eaa 74 This parameter can be a value of @ref UART_WakeUp_Address_Length */
Kojto 108:34e6b704fe68 75
Kojto 93:e188a91d3eaa 76 uint8_t Address; /*!< UART/USART node address (7-bit long max) */
Kojto 93:e188a91d3eaa 77 } UART_WakeUpTypeDef;
Kojto 108:34e6b704fe68 78
Kojto 93:e188a91d3eaa 79 /**
Kojto 93:e188a91d3eaa 80 * @}
Kojto 93:e188a91d3eaa 81 */
Kojto 93:e188a91d3eaa 82 #endif /* !defined(STM32F030x6) && !defined(STM32F030x8) && !defined(STM32F070x6) && !defined(STM32F070xB) && !defined(STM32F030xC) */
Kojto 93:e188a91d3eaa 83
bogdanm 85:024bf7f99721 84 /* Exported constants --------------------------------------------------------*/
bogdanm 92:4fc01daae5a5 85 /** @defgroup UARTEx_Exported_Constants UARTEx Exported Constants
bogdanm 85:024bf7f99721 86 * @{
bogdanm 85:024bf7f99721 87 */
Kojto 108:34e6b704fe68 88
bogdanm 92:4fc01daae5a5 89 /** @defgroup UARTEx_Word_Length UARTEx Word Length
bogdanm 85:024bf7f99721 90 * @{
bogdanm 85:024bf7f99721 91 */
Kojto 93:e188a91d3eaa 92 #if defined (STM32F042x6) || defined (STM32F048xx) || defined (STM32F070x6) || \
Kojto 93:e188a91d3eaa 93 defined (STM32F071xB) || defined (STM32F072xB) || defined (STM32F078xx) || defined (STM32F070xB) || \
Kojto 93:e188a91d3eaa 94 defined (STM32F091xC) || defined (STM32F098xx) || defined (STM32F030xC)
bogdanm 85:024bf7f99721 95 #define UART_WORDLENGTH_7B ((uint32_t)USART_CR1_M1)
bogdanm 85:024bf7f99721 96 #define UART_WORDLENGTH_8B ((uint32_t)0x00000000)
bogdanm 85:024bf7f99721 97 #define UART_WORDLENGTH_9B ((uint32_t)USART_CR1_M0)
bogdanm 85:024bf7f99721 98 #else
bogdanm 85:024bf7f99721 99 #define UART_WORDLENGTH_8B ((uint32_t)0x00000000)
bogdanm 85:024bf7f99721 100 #define UART_WORDLENGTH_9B ((uint32_t)USART_CR1_M)
Kojto 93:e188a91d3eaa 101 #endif /* defined (STM32F042x6) || defined (STM32F048xx) || defined (STM32F070x6) || \
Kojto 93:e188a91d3eaa 102 defined (STM32F071xB) || defined (STM32F072xB) || defined (STM32F078xx) || defined (STM32F070xB) || \
Kojto 93:e188a91d3eaa 103 defined (STM32F091xC) || defined (STM32F098xx) || defined (STM32F030xC) */
bogdanm 85:024bf7f99721 104 /**
bogdanm 85:024bf7f99721 105 * @}
bogdanm 85:024bf7f99721 106 */
bogdanm 85:024bf7f99721 107
bogdanm 92:4fc01daae5a5 108 /** @defgroup UARTEx_AutoBaud_Rate_Mode UARTEx Advanced Feature AutoBaud Rate Mode
bogdanm 85:024bf7f99721 109 * @{
bogdanm 85:024bf7f99721 110 */
Kojto 93:e188a91d3eaa 111 #if defined (STM32F042x6) || defined (STM32F048xx) || defined (STM32F070x6) || \
Kojto 93:e188a91d3eaa 112 defined (STM32F071xB) || defined (STM32F072xB) || defined (STM32F078xx) || defined (STM32F070xB) || \
Kojto 93:e188a91d3eaa 113 defined (STM32F091xC) || defined (STM32F098xx) || defined (STM32F030xC)
Kojto 108:34e6b704fe68 114 #define UART_ADVFEATURE_AUTOBAUDRATE_ONSTARTBIT ((uint32_t)0x00000000) /*!< Auto Baud rate detection on start bit */
Kojto 108:34e6b704fe68 115 #define UART_ADVFEATURE_AUTOBAUDRATE_ONFALLINGEDGE ((uint32_t)USART_CR2_ABRMODE_0) /*!< Auto Baud rate detection on falling edge */
Kojto 108:34e6b704fe68 116 #define UART_ADVFEATURE_AUTOBAUDRATE_ON0X7FFRAME ((uint32_t)USART_CR2_ABRMODE_1) /*!< Auto Baud rate detection on 0x7F frame detection */
Kojto 108:34e6b704fe68 117 #define UART_ADVFEATURE_AUTOBAUDRATE_ON0X55FRAME ((uint32_t)USART_CR2_ABRMODE) /*!< Auto Baud rate detection on 0x55 frame detection */
bogdanm 85:024bf7f99721 118 #else
Kojto 108:34e6b704fe68 119 #define UART_ADVFEATURE_AUTOBAUDRATE_ONSTARTBIT ((uint32_t)0x00000000) /*!< Auto Baud rate detection on start bit */
Kojto 108:34e6b704fe68 120 #define UART_ADVFEATURE_AUTOBAUDRATE_ONFALLINGEDGE ((uint32_t)USART_CR2_ABRMODE_0) /*!< Auto Baud rate detection on falling edge */
Kojto 93:e188a91d3eaa 121 #endif /* defined (STM32F042x6) || defined (STM32F048xx) || defined (STM32F070x6) || \
Kojto 93:e188a91d3eaa 122 defined (STM32F071xB) || defined (STM32F072xB) || defined (STM32F078xx) || defined (STM32F070xB) || \
Kojto 93:e188a91d3eaa 123 defined (STM32F091xC) || defined (STM32F098xx) || defined (STM32F030xC) */
bogdanm 85:024bf7f99721 124 /**
bogdanm 85:024bf7f99721 125 * @}
bogdanm 85:024bf7f99721 126 */
bogdanm 85:024bf7f99721 127
Kojto 93:e188a91d3eaa 128 #if !defined(STM32F030x6) && !defined(STM32F030x8) && !defined(STM32F070x6) && !defined(STM32F070xB) && !defined(STM32F030xC)
bogdanm 92:4fc01daae5a5 129 /** @defgroup UARTEx_LIN UARTEx Local Interconnection Network mode
bogdanm 85:024bf7f99721 130 * @{
bogdanm 85:024bf7f99721 131 */
Kojto 108:34e6b704fe68 132 #define UART_LIN_DISABLE ((uint32_t)0x00000000) /*!< Local Interconnect Network disable */
Kojto 108:34e6b704fe68 133 #define UART_LIN_ENABLE ((uint32_t)USART_CR2_LINEN) /*!< Local Interconnect Network enable */
bogdanm 85:024bf7f99721 134 /**
bogdanm 85:024bf7f99721 135 * @}
bogdanm 85:024bf7f99721 136 */
bogdanm 85:024bf7f99721 137
bogdanm 92:4fc01daae5a5 138 /** @defgroup UARTEx_LIN_Break_Detection UARTEx LIN Break Detection
bogdanm 85:024bf7f99721 139 * @{
bogdanm 85:024bf7f99721 140 */
Kojto 108:34e6b704fe68 141 #define UART_LINBREAKDETECTLENGTH_10B ((uint32_t)0x00000000) /*!< LIN 10-bit break detection length */
Kojto 108:34e6b704fe68 142 #define UART_LINBREAKDETECTLENGTH_11B ((uint32_t)USART_CR2_LBDL) /*!< LIN 11-bit break detection length */
bogdanm 85:024bf7f99721 143 /**
bogdanm 85:024bf7f99721 144 * @}
bogdanm 85:024bf7f99721 145 */
Kojto 93:e188a91d3eaa 146 #endif /* !defined(STM32F030x6) && !defined(STM32F030x8) && !defined(STM32F070x6) && !defined(STM32F070xB) && !defined(STM32F030xC) */
bogdanm 85:024bf7f99721 147
bogdanm 92:4fc01daae5a5 148 /** @defgroup UART_Flags UARTEx Status Flags
bogdanm 85:024bf7f99721 149 * Elements values convention: 0xXXXX
bogdanm 85:024bf7f99721 150 * - 0xXXXX : Flag mask in the ISR register
bogdanm 85:024bf7f99721 151 * @{
bogdanm 85:024bf7f99721 152 */
Kojto 108:34e6b704fe68 153 #if !defined(STM32F030x6) && !defined(STM32F030x8) && !defined(STM32F070x6) && !defined(STM32F070xB) && !defined(STM32F030xC)
bogdanm 85:024bf7f99721 154 #define UART_FLAG_REACK ((uint32_t)0x00400000)
Kojto 108:34e6b704fe68 155 #endif /* !defined(STM32F030x6) && !defined(STM32F030x8) && !defined(STM32F070x6) && !defined(STM32F070xB) && !defined(STM32F030xC) */
bogdanm 85:024bf7f99721 156 #define UART_FLAG_TEACK ((uint32_t)0x00200000)
Kojto 93:e188a91d3eaa 157 #if !defined(STM32F030x6) && !defined(STM32F030x8) && !defined(STM32F070x6) && !defined(STM32F070xB) && !defined(STM32F030xC)
bogdanm 85:024bf7f99721 158 #define UART_FLAG_WUF ((uint32_t)0x00100000)
Kojto 93:e188a91d3eaa 159 #endif /* !defined(STM32F030x6) && !defined(STM32F030x8) && !defined(STM32F070x6) && !defined(STM32F070xB) && !defined(STM32F030xC) */
bogdanm 85:024bf7f99721 160 #define UART_FLAG_RWU ((uint32_t)0x00080000)
bogdanm 85:024bf7f99721 161 #define UART_FLAG_SBKF ((uint32_t)0x00040000
bogdanm 85:024bf7f99721 162 #define UART_FLAG_CMF ((uint32_t)0x00020000)
bogdanm 85:024bf7f99721 163 #define UART_FLAG_BUSY ((uint32_t)0x00010000)
bogdanm 85:024bf7f99721 164 #define UART_FLAG_ABRF ((uint32_t)0x00008000)
bogdanm 85:024bf7f99721 165 #define UART_FLAG_ABRE ((uint32_t)0x00004000)
Kojto 108:34e6b704fe68 166 #if !defined(STM32F030x6) && !defined(STM32F030x8) && !defined(STM32F070x6) && !defined(STM32F070xB) && !defined(STM32F030xC)
bogdanm 85:024bf7f99721 167 #define UART_FLAG_EOBF ((uint32_t)0x00001000)
Kojto 108:34e6b704fe68 168 #endif /* !defined(STM32F030x6) && !defined(STM32F030x8) && !defined(STM32F070x6) && !defined(STM32F070xB) && !defined(STM32F030xC) */
bogdanm 85:024bf7f99721 169 #define UART_FLAG_RTOF ((uint32_t)0x00000800)
bogdanm 85:024bf7f99721 170 #define UART_FLAG_CTS ((uint32_t)0x00000400)
bogdanm 85:024bf7f99721 171 #define UART_FLAG_CTSIF ((uint32_t)0x00000200)
Kojto 93:e188a91d3eaa 172 #if !defined(STM32F030x6) && !defined(STM32F030x8) && !defined(STM32F070x6) && !defined(STM32F070xB) && !defined(STM32F030xC)
bogdanm 85:024bf7f99721 173 #define UART_FLAG_LBDF ((uint32_t)0x00000100)
Kojto 93:e188a91d3eaa 174 #endif /* !defined(STM32F030x6) && !defined(STM32F030x8) && !defined(STM32F070x6) && !defined(STM32F070xB) && !defined(STM32F030xC) */
bogdanm 85:024bf7f99721 175 #define UART_FLAG_TXE ((uint32_t)0x00000080)
bogdanm 85:024bf7f99721 176 #define UART_FLAG_TC ((uint32_t)0x00000040)
bogdanm 85:024bf7f99721 177 #define UART_FLAG_RXNE ((uint32_t)0x00000020)
bogdanm 85:024bf7f99721 178 #define UART_FLAG_IDLE ((uint32_t)0x00000010)
bogdanm 85:024bf7f99721 179 #define UART_FLAG_ORE ((uint32_t)0x00000008)
bogdanm 85:024bf7f99721 180 #define UART_FLAG_NE ((uint32_t)0x00000004)
bogdanm 85:024bf7f99721 181 #define UART_FLAG_FE ((uint32_t)0x00000002)
bogdanm 85:024bf7f99721 182 #define UART_FLAG_PE ((uint32_t)0x00000001)
bogdanm 85:024bf7f99721 183 /**
bogdanm 85:024bf7f99721 184 * @}
bogdanm 85:024bf7f99721 185 */
bogdanm 85:024bf7f99721 186
bogdanm 92:4fc01daae5a5 187 /** @defgroup UART_Interrupt_definition UARTEx Interrupts Definition
Kojto 93:e188a91d3eaa 188 * Elements values convention: 0000ZZZZZ0XXYYYYYb
bogdanm 85:024bf7f99721 189 * - YYYYY : Interrupt source position in the XX register (5bits)
bogdanm 85:024bf7f99721 190 * - XX : Interrupt source register (2bits)
bogdanm 85:024bf7f99721 191 * - 01: CR1 register
bogdanm 85:024bf7f99721 192 * - 10: CR2 register
bogdanm 85:024bf7f99721 193 * - 11: CR3 register
Kojto 93:e188a91d3eaa 194 * - ZZZZZ : Flag position in the ISR register(5bits)
bogdanm 85:024bf7f99721 195 * @{
bogdanm 85:024bf7f99721 196 */
bogdanm 85:024bf7f99721 197 #define UART_IT_PE ((uint16_t)0x0028)
bogdanm 85:024bf7f99721 198 #define UART_IT_TXE ((uint16_t)0x0727)
bogdanm 85:024bf7f99721 199 #define UART_IT_TC ((uint16_t)0x0626)
bogdanm 85:024bf7f99721 200 #define UART_IT_RXNE ((uint16_t)0x0525)
bogdanm 85:024bf7f99721 201 #define UART_IT_IDLE ((uint16_t)0x0424)
Kojto 93:e188a91d3eaa 202 #if !defined(STM32F030x6) && !defined(STM32F030x8) && !defined(STM32F070x6) && !defined(STM32F070xB) && !defined(STM32F030xC)
bogdanm 85:024bf7f99721 203 #define UART_IT_LBD ((uint16_t)0x0846)
Kojto 93:e188a91d3eaa 204 #endif /* !defined(STM32F030x6) && !defined(STM32F030x8) && !defined(STM32F070x6) && !defined(STM32F070xB) && !defined(STM32F030xC) */
bogdanm 85:024bf7f99721 205 #define UART_IT_CTS ((uint16_t)0x096A)
Kojto 93:e188a91d3eaa 206 #define UART_IT_CM ((uint16_t)0x112E)
Kojto 93:e188a91d3eaa 207 #if !defined(STM32F030x6) && !defined(STM32F030x8) && !defined(STM32F070x6) && !defined(STM32F070xB) && !defined(STM32F030xC)
bogdanm 85:024bf7f99721 208 #define UART_IT_WUF ((uint16_t)0x1476)
Kojto 93:e188a91d3eaa 209 #endif /* !defined(STM32F030x6) && !defined(STM32F030x8) && !defined(STM32F070x6) && !defined(STM32F070xB) && !defined(STM32F030xC) */
bogdanm 85:024bf7f99721 210 /**
bogdanm 85:024bf7f99721 211 * @}
bogdanm 85:024bf7f99721 212 */
bogdanm 85:024bf7f99721 213
bogdanm 85:024bf7f99721 214
bogdanm 92:4fc01daae5a5 215 /** @defgroup UART_IT_CLEAR_Flags UARTEx Interruption Clear Flags
bogdanm 85:024bf7f99721 216 * @{
bogdanm 85:024bf7f99721 217 */
bogdanm 85:024bf7f99721 218 #define UART_CLEAR_PEF USART_ICR_PECF /*!< Parity Error Clear Flag */
bogdanm 85:024bf7f99721 219 #define UART_CLEAR_FEF USART_ICR_FECF /*!< Framing Error Clear Flag */
bogdanm 85:024bf7f99721 220 #define UART_CLEAR_NEF USART_ICR_NCF /*!< Noise detected Clear Flag */
bogdanm 85:024bf7f99721 221 #define UART_CLEAR_OREF USART_ICR_ORECF /*!< OverRun Error Clear Flag */
bogdanm 85:024bf7f99721 222 #define UART_CLEAR_IDLEF USART_ICR_IDLECF /*!< IDLE line detected Clear Flag */
bogdanm 85:024bf7f99721 223 #define UART_CLEAR_TCF USART_ICR_TCCF /*!< Transmission Complete Clear Flag */
Kojto 93:e188a91d3eaa 224 #if !defined(STM32F030x6) && !defined(STM32F030x8) && !defined(STM32F070x6) && !defined(STM32F070xB) && !defined(STM32F030xC)
bogdanm 85:024bf7f99721 225 #define UART_CLEAR_LBDF USART_ICR_LBDCF /*!< LIN Break Detection Clear Flag (not available on F030xx devices)*/
Kojto 93:e188a91d3eaa 226 #endif /* !defined(STM32F030x6) && !defined(STM32F030x8) && !defined(STM32F070x6) && !defined(STM32F070xB) && !defined(STM32F030xC) */
bogdanm 85:024bf7f99721 227 #define UART_CLEAR_CTSF USART_ICR_CTSCF /*!< CTS Interrupt Clear Flag */
bogdanm 85:024bf7f99721 228 #define UART_CLEAR_RTOF USART_ICR_RTOCF /*!< Receiver Time Out Clear Flag */
Kojto 108:34e6b704fe68 229 #if !defined(STM32F030x6) && !defined(STM32F030x8) && !defined(STM32F070x6) && !defined(STM32F070xB) && !defined(STM32F030xC)
bogdanm 85:024bf7f99721 230 #define UART_CLEAR_EOBF USART_ICR_EOBCF /*!< End Of Block Clear Flag */
Kojto 108:34e6b704fe68 231 #endif /* !defined(STM32F030x6) && !defined(STM32F030x8) && !defined(STM32F070x6) && !defined(STM32F070xB) && !defined(STM32F030xC) */
bogdanm 85:024bf7f99721 232 #define UART_CLEAR_CMF USART_ICR_CMCF /*!< Character Match Clear Flag */
Kojto 93:e188a91d3eaa 233 #if !defined(STM32F030x6) && !defined(STM32F030x8) && !defined(STM32F070x6) && !defined(STM32F070xB) && !defined(STM32F030xC)
bogdanm 85:024bf7f99721 234 #define UART_CLEAR_WUF USART_ICR_WUCF /*!< Wake Up from stop mode Clear Flag */
Kojto 93:e188a91d3eaa 235 #endif /* !defined(STM32F030x6) && !defined(STM32F030x8) && !defined(STM32F070x6) && !defined(STM32F070xB) && !defined(STM32F030xC) */
bogdanm 85:024bf7f99721 236 /**
bogdanm 85:024bf7f99721 237 * @}
bogdanm 85:024bf7f99721 238 */
bogdanm 85:024bf7f99721 239
bogdanm 92:4fc01daae5a5 240 /** @defgroup UART_Request_Parameters UARTEx Request Parameters
bogdanm 85:024bf7f99721 241 * @{
bogdanm 85:024bf7f99721 242 */
bogdanm 85:024bf7f99721 243 #define UART_AUTOBAUD_REQUEST ((uint32_t)USART_RQR_ABRRQ) /*!< Auto-Baud Rate Request */
bogdanm 85:024bf7f99721 244 #define UART_SENDBREAK_REQUEST ((uint32_t)USART_RQR_SBKRQ) /*!< Send Break Request */
bogdanm 85:024bf7f99721 245 #define UART_MUTE_MODE_REQUEST ((uint32_t)USART_RQR_MMRQ) /*!< Mute Mode Request */
bogdanm 85:024bf7f99721 246 #define UART_RXDATA_FLUSH_REQUEST ((uint32_t)USART_RQR_RXFRQ) /*!< Receive Data flush Request */
Kojto 108:34e6b704fe68 247 #if !defined(STM32F030x6) && !defined(STM32F030x8) && !defined(STM32F070x6) && !defined(STM32F070xB) && !defined(STM32F030xC)
bogdanm 85:024bf7f99721 248 #define UART_TXDATA_FLUSH_REQUEST ((uint32_t)USART_RQR_TXFRQ) /*!< Transmit data flush Request */
bogdanm 85:024bf7f99721 249 #else
Kojto 108:34e6b704fe68 250 #endif /* !defined(STM32F030x6) && !defined(STM32F030x8) && !defined(STM32F070x6) && !defined(STM32F070xB) && !defined(STM32F030xC) */
bogdanm 85:024bf7f99721 251 /**
bogdanm 85:024bf7f99721 252 * @}
bogdanm 85:024bf7f99721 253 */
Kojto 108:34e6b704fe68 254
Kojto 93:e188a91d3eaa 255 #if !defined(STM32F030x6) && !defined(STM32F030x8) && !defined(STM32F070x6) && !defined(STM32F070xB) && !defined(STM32F030xC)
bogdanm 92:4fc01daae5a5 256 /** @defgroup UART_Stop_Mode_Enable UARTEx Advanced Feature Stop Mode Enable
bogdanm 85:024bf7f99721 257 * @{
bogdanm 85:024bf7f99721 258 */
Kojto 108:34e6b704fe68 259 #define UART_ADVFEATURE_STOPMODE_DISABLE ((uint32_t)0x00000000) /*!< UART stop mode disable */
Kojto 108:34e6b704fe68 260 #define UART_ADVFEATURE_STOPMODE_ENABLE ((uint32_t)USART_CR1_UESM) /*!< UART stop mode enable */
bogdanm 85:024bf7f99721 261 /**
bogdanm 85:024bf7f99721 262 * @}
bogdanm 85:024bf7f99721 263 */
Kojto 108:34e6b704fe68 264
bogdanm 85:024bf7f99721 265 /** @defgroup UART_WakeUp_from_Stop_Selection UART WakeUp From Stop Selection
bogdanm 85:024bf7f99721 266 * @{
bogdanm 85:024bf7f99721 267 */
Kojto 108:34e6b704fe68 268 #define UART_WAKEUP_ON_ADDRESS ((uint32_t)0x00000000) /*!< UART wake-up on address */
Kojto 108:34e6b704fe68 269 #define UART_WAKEUP_ON_STARTBIT ((uint32_t)USART_CR3_WUS_1) /*!< UART wake-up on start bit */
Kojto 108:34e6b704fe68 270 #define UART_WAKEUP_ON_READDATA_NONEMPTY ((uint32_t)USART_CR3_WUS) /*!< UART wake-up on receive data register not empty */
bogdanm 85:024bf7f99721 271 /**
bogdanm 85:024bf7f99721 272 * @}
Kojto 108:34e6b704fe68 273 */
Kojto 93:e188a91d3eaa 274 #endif /* !defined(STM32F030x6) && !defined(STM32F030x8) && !defined(STM32F070x6) && !defined(STM32F070xB) && !defined(STM32F030xC) */
Kojto 108:34e6b704fe68 275
bogdanm 85:024bf7f99721 276 /**
bogdanm 85:024bf7f99721 277 * @}
Kojto 108:34e6b704fe68 278 */
bogdanm 85:024bf7f99721 279
Kojto 108:34e6b704fe68 280 /* Exported macros ------------------------------------------------------------*/
bogdanm 92:4fc01daae5a5 281 /** @defgroup UARTEx_Exported_Macros UARTEx Exported Macros
bogdanm 85:024bf7f99721 282 * @{
bogdanm 85:024bf7f99721 283 */
bogdanm 85:024bf7f99721 284
Kojto 108:34e6b704fe68 285 /** @brief Flush the UART Data registers.
Kojto 108:34e6b704fe68 286 * @param __HANDLE__: specifies the UART Handle.
Kojto 108:34e6b704fe68 287 * @retval None
Kojto 108:34e6b704fe68 288 */
Kojto 108:34e6b704fe68 289 #if !defined(STM32F030x6) && !defined(STM32F030x8)
Kojto 108:34e6b704fe68 290 #define __HAL_UART_FLUSH_DRREGISTER(__HANDLE__) \
Kojto 108:34e6b704fe68 291 do{ \
Kojto 108:34e6b704fe68 292 SET_BIT((__HANDLE__)->Instance->RQR, UART_RXDATA_FLUSH_REQUEST); \
Kojto 108:34e6b704fe68 293 SET_BIT((__HANDLE__)->Instance->RQR, UART_TXDATA_FLUSH_REQUEST); \
Kojto 108:34e6b704fe68 294 } while(0)
Kojto 108:34e6b704fe68 295 #else
Kojto 108:34e6b704fe68 296 #define __HAL_UART_FLUSH_DRREGISTER(__HANDLE__) \
Kojto 108:34e6b704fe68 297 do{ \
Kojto 108:34e6b704fe68 298 SET_BIT((__HANDLE__)->Instance->RQR, UART_RXDATA_FLUSH_REQUEST); \
Kojto 108:34e6b704fe68 299 } while(0)
Kojto 108:34e6b704fe68 300 #endif /* !defined(STM32F030x6) && !defined(STM32F030x8) */
Kojto 108:34e6b704fe68 301
Kojto 108:34e6b704fe68 302 /**
Kojto 108:34e6b704fe68 303 * @}
Kojto 108:34e6b704fe68 304 */
Kojto 108:34e6b704fe68 305
Kojto 108:34e6b704fe68 306 /* Private macros ------------------------------------------------------------*/
Kojto 108:34e6b704fe68 307 /** @defgroup UARTEx_Private_Macros UARTEx Private Macros
Kojto 108:34e6b704fe68 308 * @{
Kojto 108:34e6b704fe68 309 */
Kojto 108:34e6b704fe68 310
Kojto 108:34e6b704fe68 311 /** @brief Report the UART clock source.
Kojto 108:34e6b704fe68 312 * @param __HANDLE__: specifies the UART Handle.
Kojto 108:34e6b704fe68 313 * @param __CLOCKSOURCE__: output variable.
bogdanm 85:024bf7f99721 314 * @retval UART clocking source, written in __CLOCKSOURCE__.
bogdanm 85:024bf7f99721 315 */
bogdanm 85:024bf7f99721 316
bogdanm 85:024bf7f99721 317
bogdanm 85:024bf7f99721 318 #if defined(STM32F030x6) || defined(STM32F031x6) || defined(STM32F038xx)
Kojto 108:34e6b704fe68 319 #define UART_GETCLOCKSOURCE(__HANDLE__,__CLOCKSOURCE__) \
bogdanm 85:024bf7f99721 320 do { \
bogdanm 85:024bf7f99721 321 switch(__HAL_RCC_GET_USART1_SOURCE()) \
bogdanm 85:024bf7f99721 322 { \
bogdanm 85:024bf7f99721 323 case RCC_USART1CLKSOURCE_PCLK1: \
bogdanm 85:024bf7f99721 324 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_PCLK1; \
bogdanm 85:024bf7f99721 325 break; \
bogdanm 85:024bf7f99721 326 case RCC_USART1CLKSOURCE_HSI: \
bogdanm 85:024bf7f99721 327 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_HSI; \
bogdanm 85:024bf7f99721 328 break; \
bogdanm 85:024bf7f99721 329 case RCC_USART1CLKSOURCE_SYSCLK: \
bogdanm 85:024bf7f99721 330 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_SYSCLK; \
bogdanm 85:024bf7f99721 331 break; \
bogdanm 85:024bf7f99721 332 case RCC_USART1CLKSOURCE_LSE: \
bogdanm 85:024bf7f99721 333 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_LSE; \
bogdanm 85:024bf7f99721 334 break; \
bogdanm 85:024bf7f99721 335 default: \
bogdanm 85:024bf7f99721 336 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_UNDEFINED; \
bogdanm 85:024bf7f99721 337 break; \
bogdanm 85:024bf7f99721 338 } \
bogdanm 85:024bf7f99721 339 } while(0)
Kojto 93:e188a91d3eaa 340 #elif defined (STM32F030x8) || defined (STM32F070x6) || \
bogdanm 85:024bf7f99721 341 defined (STM32F042x6) || defined (STM32F048xx) || \
bogdanm 85:024bf7f99721 342 defined (STM32F051x8) || defined (STM32F058xx)
Kojto 108:34e6b704fe68 343 #define UART_GETCLOCKSOURCE(__HANDLE__,__CLOCKSOURCE__) \
bogdanm 85:024bf7f99721 344 do { \
bogdanm 85:024bf7f99721 345 if((__HANDLE__)->Instance == USART1) \
bogdanm 85:024bf7f99721 346 { \
bogdanm 85:024bf7f99721 347 switch(__HAL_RCC_GET_USART1_SOURCE()) \
bogdanm 85:024bf7f99721 348 { \
bogdanm 85:024bf7f99721 349 case RCC_USART1CLKSOURCE_PCLK1: \
bogdanm 85:024bf7f99721 350 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_PCLK1; \
bogdanm 85:024bf7f99721 351 break; \
bogdanm 85:024bf7f99721 352 case RCC_USART1CLKSOURCE_HSI: \
bogdanm 85:024bf7f99721 353 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_HSI; \
bogdanm 85:024bf7f99721 354 break; \
bogdanm 85:024bf7f99721 355 case RCC_USART1CLKSOURCE_SYSCLK: \
bogdanm 85:024bf7f99721 356 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_SYSCLK; \
bogdanm 85:024bf7f99721 357 break; \
bogdanm 85:024bf7f99721 358 case RCC_USART1CLKSOURCE_LSE: \
bogdanm 85:024bf7f99721 359 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_LSE; \
bogdanm 85:024bf7f99721 360 break; \
bogdanm 85:024bf7f99721 361 default: \
bogdanm 85:024bf7f99721 362 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_UNDEFINED; \
bogdanm 85:024bf7f99721 363 break; \
bogdanm 85:024bf7f99721 364 } \
bogdanm 85:024bf7f99721 365 } \
bogdanm 85:024bf7f99721 366 else if((__HANDLE__)->Instance == USART2) \
bogdanm 85:024bf7f99721 367 { \
bogdanm 85:024bf7f99721 368 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_PCLK1; \
bogdanm 85:024bf7f99721 369 } \
bogdanm 85:024bf7f99721 370 else \
bogdanm 85:024bf7f99721 371 { \
bogdanm 85:024bf7f99721 372 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_UNDEFINED; \
bogdanm 85:024bf7f99721 373 } \
bogdanm 85:024bf7f99721 374 } while(0)
Kojto 93:e188a91d3eaa 375 #elif defined(STM32F070xB)
Kojto 108:34e6b704fe68 376 #define UART_GETCLOCKSOURCE(__HANDLE__,__CLOCKSOURCE__) \
Kojto 93:e188a91d3eaa 377 do { \
Kojto 93:e188a91d3eaa 378 if((__HANDLE__)->Instance == USART1) \
Kojto 93:e188a91d3eaa 379 { \
Kojto 93:e188a91d3eaa 380 switch(__HAL_RCC_GET_USART1_SOURCE()) \
Kojto 93:e188a91d3eaa 381 { \
Kojto 93:e188a91d3eaa 382 case RCC_USART1CLKSOURCE_PCLK1: \
Kojto 93:e188a91d3eaa 383 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_PCLK1; \
Kojto 93:e188a91d3eaa 384 break; \
Kojto 93:e188a91d3eaa 385 case RCC_USART1CLKSOURCE_HSI: \
Kojto 93:e188a91d3eaa 386 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_HSI; \
Kojto 93:e188a91d3eaa 387 break; \
Kojto 93:e188a91d3eaa 388 case RCC_USART1CLKSOURCE_SYSCLK: \
Kojto 93:e188a91d3eaa 389 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_SYSCLK; \
Kojto 93:e188a91d3eaa 390 break; \
Kojto 93:e188a91d3eaa 391 case RCC_USART1CLKSOURCE_LSE: \
Kojto 93:e188a91d3eaa 392 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_LSE; \
Kojto 93:e188a91d3eaa 393 break; \
Kojto 93:e188a91d3eaa 394 default: \
Kojto 93:e188a91d3eaa 395 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_UNDEFINED; \
Kojto 93:e188a91d3eaa 396 break; \
Kojto 93:e188a91d3eaa 397 } \
Kojto 93:e188a91d3eaa 398 } \
Kojto 93:e188a91d3eaa 399 else if((__HANDLE__)->Instance == USART2) \
Kojto 93:e188a91d3eaa 400 { \
Kojto 93:e188a91d3eaa 401 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_PCLK1; \
Kojto 93:e188a91d3eaa 402 } \
Kojto 93:e188a91d3eaa 403 else if((__HANDLE__)->Instance == USART3) \
Kojto 93:e188a91d3eaa 404 { \
Kojto 93:e188a91d3eaa 405 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_PCLK1; \
Kojto 93:e188a91d3eaa 406 } \
Kojto 93:e188a91d3eaa 407 else if((__HANDLE__)->Instance == USART4) \
Kojto 93:e188a91d3eaa 408 { \
Kojto 93:e188a91d3eaa 409 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_PCLK1; \
Kojto 93:e188a91d3eaa 410 } \
Kojto 93:e188a91d3eaa 411 else \
Kojto 93:e188a91d3eaa 412 { \
Kojto 93:e188a91d3eaa 413 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_UNDEFINED; \
Kojto 93:e188a91d3eaa 414 } \
Kojto 93:e188a91d3eaa 415 } while(0)
bogdanm 85:024bf7f99721 416 #elif defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx)
Kojto 108:34e6b704fe68 417 #define UART_GETCLOCKSOURCE(__HANDLE__,__CLOCKSOURCE__) \
bogdanm 85:024bf7f99721 418 do { \
bogdanm 85:024bf7f99721 419 if((__HANDLE__)->Instance == USART1) \
bogdanm 85:024bf7f99721 420 { \
bogdanm 85:024bf7f99721 421 switch(__HAL_RCC_GET_USART1_SOURCE()) \
bogdanm 85:024bf7f99721 422 { \
bogdanm 85:024bf7f99721 423 case RCC_USART1CLKSOURCE_PCLK1: \
bogdanm 85:024bf7f99721 424 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_PCLK1; \
bogdanm 85:024bf7f99721 425 break; \
bogdanm 85:024bf7f99721 426 case RCC_USART1CLKSOURCE_HSI: \
bogdanm 85:024bf7f99721 427 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_HSI; \
bogdanm 85:024bf7f99721 428 break; \
bogdanm 85:024bf7f99721 429 case RCC_USART1CLKSOURCE_SYSCLK: \
bogdanm 85:024bf7f99721 430 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_SYSCLK; \
bogdanm 85:024bf7f99721 431 break; \
bogdanm 85:024bf7f99721 432 case RCC_USART1CLKSOURCE_LSE: \
bogdanm 85:024bf7f99721 433 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_LSE; \
bogdanm 85:024bf7f99721 434 break; \
bogdanm 85:024bf7f99721 435 default: \
bogdanm 85:024bf7f99721 436 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_UNDEFINED; \
bogdanm 85:024bf7f99721 437 break; \
bogdanm 85:024bf7f99721 438 } \
bogdanm 85:024bf7f99721 439 } \
bogdanm 85:024bf7f99721 440 else if((__HANDLE__)->Instance == USART2) \
bogdanm 85:024bf7f99721 441 { \
bogdanm 85:024bf7f99721 442 switch(__HAL_RCC_GET_USART2_SOURCE()) \
bogdanm 85:024bf7f99721 443 { \
bogdanm 85:024bf7f99721 444 case RCC_USART2CLKSOURCE_PCLK1: \
bogdanm 85:024bf7f99721 445 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_PCLK1; \
bogdanm 85:024bf7f99721 446 break; \
bogdanm 85:024bf7f99721 447 case RCC_USART2CLKSOURCE_HSI: \
bogdanm 85:024bf7f99721 448 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_HSI; \
bogdanm 85:024bf7f99721 449 break; \
bogdanm 85:024bf7f99721 450 case RCC_USART2CLKSOURCE_SYSCLK: \
bogdanm 85:024bf7f99721 451 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_SYSCLK; \
bogdanm 85:024bf7f99721 452 break; \
bogdanm 85:024bf7f99721 453 case RCC_USART2CLKSOURCE_LSE: \
bogdanm 85:024bf7f99721 454 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_LSE; \
bogdanm 85:024bf7f99721 455 break; \
bogdanm 85:024bf7f99721 456 default: \
bogdanm 85:024bf7f99721 457 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_UNDEFINED; \
bogdanm 85:024bf7f99721 458 break; \
bogdanm 85:024bf7f99721 459 } \
bogdanm 85:024bf7f99721 460 } \
bogdanm 85:024bf7f99721 461 else if((__HANDLE__)->Instance == USART3) \
bogdanm 85:024bf7f99721 462 { \
bogdanm 85:024bf7f99721 463 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_PCLK1; \
bogdanm 85:024bf7f99721 464 } \
bogdanm 85:024bf7f99721 465 else if((__HANDLE__)->Instance == USART4) \
bogdanm 85:024bf7f99721 466 { \
bogdanm 85:024bf7f99721 467 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_PCLK1; \
bogdanm 85:024bf7f99721 468 } \
bogdanm 85:024bf7f99721 469 else \
bogdanm 85:024bf7f99721 470 { \
bogdanm 85:024bf7f99721 471 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_UNDEFINED; \
bogdanm 85:024bf7f99721 472 } \
bogdanm 85:024bf7f99721 473 } while(0)
bogdanm 92:4fc01daae5a5 474 #elif defined(STM32F091xC) || defined (STM32F098xx)
Kojto 108:34e6b704fe68 475 #define UART_GETCLOCKSOURCE(__HANDLE__,__CLOCKSOURCE__) \
bogdanm 92:4fc01daae5a5 476 do { \
bogdanm 92:4fc01daae5a5 477 if((__HANDLE__)->Instance == USART1) \
bogdanm 92:4fc01daae5a5 478 { \
bogdanm 92:4fc01daae5a5 479 switch(__HAL_RCC_GET_USART1_SOURCE()) \
bogdanm 92:4fc01daae5a5 480 { \
bogdanm 92:4fc01daae5a5 481 case RCC_USART1CLKSOURCE_PCLK1: \
bogdanm 92:4fc01daae5a5 482 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_PCLK1; \
bogdanm 92:4fc01daae5a5 483 break; \
bogdanm 92:4fc01daae5a5 484 case RCC_USART1CLKSOURCE_HSI: \
bogdanm 92:4fc01daae5a5 485 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_HSI; \
bogdanm 92:4fc01daae5a5 486 break; \
bogdanm 92:4fc01daae5a5 487 case RCC_USART1CLKSOURCE_SYSCLK: \
bogdanm 92:4fc01daae5a5 488 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_SYSCLK; \
bogdanm 92:4fc01daae5a5 489 break; \
bogdanm 92:4fc01daae5a5 490 case RCC_USART1CLKSOURCE_LSE: \
bogdanm 92:4fc01daae5a5 491 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_LSE; \
bogdanm 92:4fc01daae5a5 492 break; \
bogdanm 92:4fc01daae5a5 493 default: \
bogdanm 92:4fc01daae5a5 494 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_UNDEFINED; \
bogdanm 92:4fc01daae5a5 495 break; \
bogdanm 92:4fc01daae5a5 496 } \
bogdanm 92:4fc01daae5a5 497 } \
bogdanm 92:4fc01daae5a5 498 else if((__HANDLE__)->Instance == USART2) \
bogdanm 92:4fc01daae5a5 499 { \
bogdanm 92:4fc01daae5a5 500 switch(__HAL_RCC_GET_USART2_SOURCE()) \
bogdanm 92:4fc01daae5a5 501 { \
bogdanm 92:4fc01daae5a5 502 case RCC_USART2CLKSOURCE_PCLK1: \
bogdanm 92:4fc01daae5a5 503 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_PCLK1; \
bogdanm 92:4fc01daae5a5 504 break; \
bogdanm 92:4fc01daae5a5 505 case RCC_USART2CLKSOURCE_HSI: \
bogdanm 92:4fc01daae5a5 506 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_HSI; \
bogdanm 92:4fc01daae5a5 507 break; \
bogdanm 92:4fc01daae5a5 508 case RCC_USART2CLKSOURCE_SYSCLK: \
bogdanm 92:4fc01daae5a5 509 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_SYSCLK; \
bogdanm 92:4fc01daae5a5 510 break; \
bogdanm 92:4fc01daae5a5 511 case RCC_USART2CLKSOURCE_LSE: \
bogdanm 92:4fc01daae5a5 512 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_LSE; \
bogdanm 92:4fc01daae5a5 513 break; \
bogdanm 92:4fc01daae5a5 514 default: \
bogdanm 92:4fc01daae5a5 515 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_UNDEFINED; \
bogdanm 92:4fc01daae5a5 516 break; \
bogdanm 92:4fc01daae5a5 517 } \
bogdanm 92:4fc01daae5a5 518 } \
bogdanm 92:4fc01daae5a5 519 else if((__HANDLE__)->Instance == USART3) \
bogdanm 92:4fc01daae5a5 520 { \
bogdanm 92:4fc01daae5a5 521 switch(__HAL_RCC_GET_USART3_SOURCE()) \
bogdanm 92:4fc01daae5a5 522 { \
bogdanm 92:4fc01daae5a5 523 case RCC_USART3CLKSOURCE_PCLK1: \
bogdanm 92:4fc01daae5a5 524 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_PCLK1; \
bogdanm 92:4fc01daae5a5 525 break; \
bogdanm 92:4fc01daae5a5 526 case RCC_USART3CLKSOURCE_HSI: \
bogdanm 92:4fc01daae5a5 527 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_HSI; \
bogdanm 92:4fc01daae5a5 528 break; \
bogdanm 92:4fc01daae5a5 529 case RCC_USART3CLKSOURCE_SYSCLK: \
bogdanm 92:4fc01daae5a5 530 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_SYSCLK; \
bogdanm 92:4fc01daae5a5 531 break; \
bogdanm 92:4fc01daae5a5 532 case RCC_USART3CLKSOURCE_LSE: \
bogdanm 92:4fc01daae5a5 533 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_LSE; \
bogdanm 92:4fc01daae5a5 534 break; \
bogdanm 92:4fc01daae5a5 535 default: \
bogdanm 92:4fc01daae5a5 536 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_UNDEFINED; \
bogdanm 92:4fc01daae5a5 537 break; \
bogdanm 92:4fc01daae5a5 538 } \
bogdanm 92:4fc01daae5a5 539 } \
bogdanm 92:4fc01daae5a5 540 else if((__HANDLE__)->Instance == USART4) \
bogdanm 92:4fc01daae5a5 541 { \
bogdanm 92:4fc01daae5a5 542 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_PCLK1; \
bogdanm 92:4fc01daae5a5 543 } \
bogdanm 92:4fc01daae5a5 544 else if((__HANDLE__)->Instance == USART5) \
bogdanm 92:4fc01daae5a5 545 { \
bogdanm 92:4fc01daae5a5 546 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_PCLK1; \
bogdanm 92:4fc01daae5a5 547 } \
bogdanm 92:4fc01daae5a5 548 else if((__HANDLE__)->Instance == USART6) \
bogdanm 92:4fc01daae5a5 549 { \
bogdanm 92:4fc01daae5a5 550 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_PCLK1; \
bogdanm 92:4fc01daae5a5 551 } \
bogdanm 92:4fc01daae5a5 552 else if((__HANDLE__)->Instance == USART7) \
bogdanm 92:4fc01daae5a5 553 { \
bogdanm 92:4fc01daae5a5 554 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_PCLK1; \
bogdanm 92:4fc01daae5a5 555 } \
bogdanm 92:4fc01daae5a5 556 else if((__HANDLE__)->Instance == USART8) \
bogdanm 92:4fc01daae5a5 557 { \
bogdanm 92:4fc01daae5a5 558 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_PCLK1; \
bogdanm 92:4fc01daae5a5 559 } \
bogdanm 92:4fc01daae5a5 560 else \
bogdanm 92:4fc01daae5a5 561 { \
bogdanm 92:4fc01daae5a5 562 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_UNDEFINED; \
bogdanm 92:4fc01daae5a5 563 } \
bogdanm 92:4fc01daae5a5 564 } while(0)
Kojto 93:e188a91d3eaa 565 #elif defined(STM32F030xC)
Kojto 108:34e6b704fe68 566 #define UART_GETCLOCKSOURCE(__HANDLE__,__CLOCKSOURCE__) \
Kojto 93:e188a91d3eaa 567 do { \
Kojto 93:e188a91d3eaa 568 if((__HANDLE__)->Instance == USART1) \
Kojto 93:e188a91d3eaa 569 { \
Kojto 93:e188a91d3eaa 570 switch(__HAL_RCC_GET_USART1_SOURCE()) \
Kojto 93:e188a91d3eaa 571 { \
Kojto 93:e188a91d3eaa 572 case RCC_USART1CLKSOURCE_PCLK1: \
Kojto 93:e188a91d3eaa 573 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_PCLK1; \
Kojto 93:e188a91d3eaa 574 break; \
Kojto 93:e188a91d3eaa 575 case RCC_USART1CLKSOURCE_HSI: \
Kojto 93:e188a91d3eaa 576 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_HSI; \
Kojto 93:e188a91d3eaa 577 break; \
Kojto 93:e188a91d3eaa 578 case RCC_USART1CLKSOURCE_SYSCLK: \
Kojto 93:e188a91d3eaa 579 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_SYSCLK; \
Kojto 93:e188a91d3eaa 580 break; \
Kojto 93:e188a91d3eaa 581 case RCC_USART1CLKSOURCE_LSE: \
Kojto 93:e188a91d3eaa 582 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_LSE; \
Kojto 93:e188a91d3eaa 583 break; \
Kojto 93:e188a91d3eaa 584 default: \
Kojto 93:e188a91d3eaa 585 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_UNDEFINED; \
Kojto 93:e188a91d3eaa 586 break; \
Kojto 93:e188a91d3eaa 587 } \
Kojto 93:e188a91d3eaa 588 } \
Kojto 93:e188a91d3eaa 589 else if((__HANDLE__)->Instance == USART2) \
Kojto 93:e188a91d3eaa 590 { \
Kojto 93:e188a91d3eaa 591 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_PCLK1; \
Kojto 93:e188a91d3eaa 592 } \
Kojto 93:e188a91d3eaa 593 else if((__HANDLE__)->Instance == USART3) \
Kojto 93:e188a91d3eaa 594 { \
Kojto 93:e188a91d3eaa 595 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_PCLK1; \
Kojto 93:e188a91d3eaa 596 } \
Kojto 93:e188a91d3eaa 597 else if((__HANDLE__)->Instance == USART4) \
Kojto 93:e188a91d3eaa 598 { \
Kojto 93:e188a91d3eaa 599 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_PCLK1; \
Kojto 93:e188a91d3eaa 600 } \
Kojto 93:e188a91d3eaa 601 else if((__HANDLE__)->Instance == USART5) \
Kojto 93:e188a91d3eaa 602 { \
Kojto 93:e188a91d3eaa 603 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_PCLK1; \
Kojto 93:e188a91d3eaa 604 } \
Kojto 93:e188a91d3eaa 605 else if((__HANDLE__)->Instance == USART6) \
Kojto 93:e188a91d3eaa 606 { \
Kojto 93:e188a91d3eaa 607 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_PCLK1; \
Kojto 93:e188a91d3eaa 608 } \
Kojto 93:e188a91d3eaa 609 else \
Kojto 93:e188a91d3eaa 610 { \
Kojto 93:e188a91d3eaa 611 (__CLOCKSOURCE__) = UART_CLOCKSOURCE_UNDEFINED; \
Kojto 93:e188a91d3eaa 612 } \
Kojto 93:e188a91d3eaa 613 } while(0)
bogdanm 92:4fc01daae5a5 614
bogdanm 85:024bf7f99721 615 #endif /* defined(STM32F030x6) || defined(STM32F031x6) || defined(STM32F038xx) */
bogdanm 85:024bf7f99721 616
bogdanm 85:024bf7f99721 617
Kojto 108:34e6b704fe68 618 /** @brief Compute the UART mask to apply to retrieve the received data
bogdanm 85:024bf7f99721 619 * according to the word length and to the parity bits activation.
Kojto 108:34e6b704fe68 620 * @note If PCE = 1, the parity bit is not included in the data extracted
bogdanm 85:024bf7f99721 621 * by the reception API().
bogdanm 85:024bf7f99721 622 * This masking operation is not carried out in the case of
Kojto 108:34e6b704fe68 623 * DMA transfers.
Kojto 108:34e6b704fe68 624 * @param __HANDLE__: specifies the UART Handle.
Kojto 108:34e6b704fe68 625 * @retval None, the mask to apply to UART RDR register is stored in (__HANDLE__)->Mask field.
Kojto 108:34e6b704fe68 626 */
Kojto 93:e188a91d3eaa 627 #if defined (STM32F042x6) || defined (STM32F048xx) || defined (STM32F070x6) || \
Kojto 93:e188a91d3eaa 628 defined (STM32F071xB) || defined (STM32F072xB) || defined (STM32F078xx) || defined (STM32F070xB) || \
Kojto 93:e188a91d3eaa 629 defined (STM32F091xC) || defined (STM32F098xx) || defined (STM32F030xC)
Kojto 108:34e6b704fe68 630 #define UART_MASK_COMPUTATION(__HANDLE__) \
bogdanm 85:024bf7f99721 631 do { \
bogdanm 85:024bf7f99721 632 if ((__HANDLE__)->Init.WordLength == UART_WORDLENGTH_9B) \
bogdanm 85:024bf7f99721 633 { \
bogdanm 85:024bf7f99721 634 if ((__HANDLE__)->Init.Parity == UART_PARITY_NONE) \
bogdanm 85:024bf7f99721 635 { \
bogdanm 85:024bf7f99721 636 (__HANDLE__)->Mask = 0x01FF ; \
bogdanm 85:024bf7f99721 637 } \
bogdanm 85:024bf7f99721 638 else \
bogdanm 85:024bf7f99721 639 { \
bogdanm 85:024bf7f99721 640 (__HANDLE__)->Mask = 0x00FF ; \
bogdanm 85:024bf7f99721 641 } \
bogdanm 85:024bf7f99721 642 } \
bogdanm 85:024bf7f99721 643 else if ((__HANDLE__)->Init.WordLength == UART_WORDLENGTH_8B) \
bogdanm 85:024bf7f99721 644 { \
bogdanm 85:024bf7f99721 645 if ((__HANDLE__)->Init.Parity == UART_PARITY_NONE) \
bogdanm 85:024bf7f99721 646 { \
bogdanm 85:024bf7f99721 647 (__HANDLE__)->Mask = 0x00FF ; \
bogdanm 85:024bf7f99721 648 } \
bogdanm 85:024bf7f99721 649 else \
bogdanm 85:024bf7f99721 650 { \
bogdanm 85:024bf7f99721 651 (__HANDLE__)->Mask = 0x007F ; \
bogdanm 85:024bf7f99721 652 } \
bogdanm 85:024bf7f99721 653 } \
bogdanm 85:024bf7f99721 654 else if ((__HANDLE__)->Init.WordLength == UART_WORDLENGTH_7B) \
bogdanm 85:024bf7f99721 655 { \
bogdanm 85:024bf7f99721 656 if ((__HANDLE__)->Init.Parity == UART_PARITY_NONE) \
bogdanm 85:024bf7f99721 657 { \
bogdanm 85:024bf7f99721 658 (__HANDLE__)->Mask = 0x007F ; \
bogdanm 85:024bf7f99721 659 } \
bogdanm 85:024bf7f99721 660 else \
bogdanm 85:024bf7f99721 661 { \
bogdanm 85:024bf7f99721 662 (__HANDLE__)->Mask = 0x003F ; \
bogdanm 85:024bf7f99721 663 } \
bogdanm 85:024bf7f99721 664 } \
Kojto 108:34e6b704fe68 665 } while(0)
bogdanm 85:024bf7f99721 666 #else
Kojto 108:34e6b704fe68 667 #define UART_MASK_COMPUTATION(__HANDLE__) \
bogdanm 85:024bf7f99721 668 do { \
bogdanm 85:024bf7f99721 669 if ((__HANDLE__)->Init.WordLength == UART_WORDLENGTH_9B) \
bogdanm 85:024bf7f99721 670 { \
bogdanm 85:024bf7f99721 671 if ((__HANDLE__)->Init.Parity == UART_PARITY_NONE) \
bogdanm 85:024bf7f99721 672 { \
bogdanm 85:024bf7f99721 673 (__HANDLE__)->Mask = 0x01FF ; \
bogdanm 85:024bf7f99721 674 } \
bogdanm 85:024bf7f99721 675 else \
bogdanm 85:024bf7f99721 676 { \
bogdanm 85:024bf7f99721 677 (__HANDLE__)->Mask = 0x00FF ; \
bogdanm 85:024bf7f99721 678 } \
bogdanm 85:024bf7f99721 679 } \
bogdanm 85:024bf7f99721 680 else if ((__HANDLE__)->Init.WordLength == UART_WORDLENGTH_8B) \
bogdanm 85:024bf7f99721 681 { \
bogdanm 85:024bf7f99721 682 if ((__HANDLE__)->Init.Parity == UART_PARITY_NONE) \
bogdanm 85:024bf7f99721 683 { \
bogdanm 85:024bf7f99721 684 (__HANDLE__)->Mask = 0x00FF ; \
bogdanm 85:024bf7f99721 685 } \
bogdanm 85:024bf7f99721 686 else \
bogdanm 85:024bf7f99721 687 { \
bogdanm 85:024bf7f99721 688 (__HANDLE__)->Mask = 0x007F ; \
bogdanm 85:024bf7f99721 689 } \
bogdanm 85:024bf7f99721 690 } \
bogdanm 85:024bf7f99721 691 } while(0)
Kojto 93:e188a91d3eaa 692 #endif /* defined (STM32F042x6) || defined (STM32F048xx) || defined (STM32F070x6) || \
Kojto 93:e188a91d3eaa 693 defined (STM32F071xB) || defined (STM32F072xB) || defined (STM32F078xx) || defined (STM32F070xB) || \
Kojto 93:e188a91d3eaa 694 defined (STM32F091xC) || defined (STM32F098xx) || defined (STM32F030xC) */
Kojto 108:34e6b704fe68 695
Kojto 108:34e6b704fe68 696 /**
Kojto 108:34e6b704fe68 697 * @brief Ensure that UART frame length is valid.
Kojto 108:34e6b704fe68 698 * @param __LENGTH__: UART frame length.
Kojto 108:34e6b704fe68 699 * @retval SET (__LENGTH__ is valid) or RESET (__LENGTH__ is invalid)
Kojto 108:34e6b704fe68 700 */
Kojto 108:34e6b704fe68 701 #if defined (STM32F042x6) || defined (STM32F048xx) || defined (STM32F070x6) || \
Kojto 108:34e6b704fe68 702 defined (STM32F071xB) || defined (STM32F072xB) || defined (STM32F078xx) || defined (STM32F070xB) || \
Kojto 108:34e6b704fe68 703 defined (STM32F091xC) || defined (STM32F098xx) || defined (STM32F030xC)
Kojto 108:34e6b704fe68 704 #define IS_UART_WORD_LENGTH(__LENGTH__) (((__LENGTH__) == UART_WORDLENGTH_7B) || \
Kojto 108:34e6b704fe68 705 ((__LENGTH__) == UART_WORDLENGTH_8B) || \
Kojto 108:34e6b704fe68 706 ((__LENGTH__) == UART_WORDLENGTH_9B))
Kojto 108:34e6b704fe68 707 #else
Kojto 108:34e6b704fe68 708 #define IS_UART_WORD_LENGTH(__LENGTH__) (((__LENGTH__) == UART_WORDLENGTH_8B) || \
Kojto 108:34e6b704fe68 709 ((__LENGTH__) == UART_WORDLENGTH_9B))
Kojto 108:34e6b704fe68 710 #endif /* defined (STM32F042x6) || defined (STM32F048xx) || defined (STM32F070x6) || \
Kojto 108:34e6b704fe68 711 defined (STM32F071xB) || defined (STM32F072xB) || defined (STM32F078xx) || defined (STM32F070xB) || \
Kojto 108:34e6b704fe68 712 defined (STM32F091xC) || defined (STM32F098xx) || defined (STM32F030xC) */
Kojto 108:34e6b704fe68 713
Kojto 108:34e6b704fe68 714 /**
Kojto 108:34e6b704fe68 715 * @brief Ensure that UART auto Baud rate detection mode is valid.
Kojto 108:34e6b704fe68 716 * @param __MODE__: UART auto Baud rate detection mode.
Kojto 108:34e6b704fe68 717 * @retval SET (__MODE__ is valid) or RESET (__MODE__ is invalid)
Kojto 108:34e6b704fe68 718 */
Kojto 108:34e6b704fe68 719 #if defined (STM32F042x6) || defined (STM32F048xx) || defined (STM32F070x6) || \
Kojto 108:34e6b704fe68 720 defined (STM32F071xB) || defined (STM32F072xB) || defined (STM32F078xx) || defined (STM32F070xB) || \
Kojto 108:34e6b704fe68 721 defined (STM32F091xC) || defined (STM32F098xx) || defined (STM32F030xC)
Kojto 108:34e6b704fe68 722 #define IS_UART_ADVFEATURE_AUTOBAUDRATEMODE(__MODE__) (((__MODE__) == UART_ADVFEATURE_AUTOBAUDRATE_ONSTARTBIT) || \
Kojto 108:34e6b704fe68 723 ((__MODE__) == UART_ADVFEATURE_AUTOBAUDRATE_ONFALLINGEDGE) || \
Kojto 108:34e6b704fe68 724 ((__MODE__) == UART_ADVFEATURE_AUTOBAUDRATE_ON0X7FFRAME) || \
Kojto 108:34e6b704fe68 725 ((__MODE__) == UART_ADVFEATURE_AUTOBAUDRATE_ON0X55FRAME))
Kojto 108:34e6b704fe68 726 #else
Kojto 108:34e6b704fe68 727 #define IS_UART_ADVFEATURE_AUTOBAUDRATEMODE(__MODE__) (((__MODE__) == UART_ADVFEATURE_AUTOBAUDRATE_ONSTARTBIT) || \
Kojto 108:34e6b704fe68 728 ((__MODE__) == UART_ADVFEATURE_AUTOBAUDRATE_ONFALLINGEDGE))
Kojto 108:34e6b704fe68 729 #endif /* defined (STM32F042x6) || defined (STM32F048xx) || defined (STM32F070x6) || \
Kojto 108:34e6b704fe68 730 defined (STM32F071xB) || defined (STM32F072xB) || defined (STM32F078xx) || defined (STM32F070xB) || \
Kojto 108:34e6b704fe68 731 defined (STM32F091xC) || defined (STM32F098xx) || defined (STM32F030xC) */
Kojto 108:34e6b704fe68 732
Kojto 108:34e6b704fe68 733
Kojto 108:34e6b704fe68 734 #if !defined(STM32F030x6) && !defined(STM32F030x8) && !defined(STM32F070x6) && !defined(STM32F070xB) && !defined(STM32F030xC)
Kojto 108:34e6b704fe68 735 /**
Kojto 108:34e6b704fe68 736 * @brief Ensure that UART LIN state is valid.
Kojto 108:34e6b704fe68 737 * @param __LIN__: UART LIN state.
Kojto 108:34e6b704fe68 738 * @retval SET (__LIN__ is valid) or RESET (__LIN__ is invalid)
Kojto 108:34e6b704fe68 739 */
Kojto 108:34e6b704fe68 740 #define IS_UART_LIN(__LIN__) (((__LIN__) == UART_LIN_DISABLE) || \
Kojto 108:34e6b704fe68 741 ((__LIN__) == UART_LIN_ENABLE))
Kojto 108:34e6b704fe68 742
Kojto 108:34e6b704fe68 743 /**
Kojto 108:34e6b704fe68 744 * @brief Ensure that UART LIN break detection length is valid.
Kojto 108:34e6b704fe68 745 * @param __LENGTH__: UART LIN break detection length.
Kojto 108:34e6b704fe68 746 * @retval SET (__LENGTH__ is valid) or RESET (__LENGTH__ is invalid)
Kojto 108:34e6b704fe68 747 */
Kojto 108:34e6b704fe68 748 #define IS_UART_LIN_BREAK_DETECT_LENGTH(__LENGTH__) (((__LENGTH__) == UART_LINBREAKDETECTLENGTH_10B) || \
Kojto 108:34e6b704fe68 749 ((__LENGTH__) == UART_LINBREAKDETECTLENGTH_11B))
Kojto 108:34e6b704fe68 750 #endif /* !defined(STM32F030x6) && !defined(STM32F030x8) && !defined(STM32F070x6) && !defined(STM32F070xB) && !defined(STM32F030xC) */
Kojto 108:34e6b704fe68 751
Kojto 108:34e6b704fe68 752 /**
Kojto 108:34e6b704fe68 753 * @brief Ensure that UART request parameter is valid.
Kojto 108:34e6b704fe68 754 * @param __PARAM__: UART request parameter.
Kojto 108:34e6b704fe68 755 * @retval SET (__PARAM__ is valid) or RESET (__PARAM__ is invalid)
Kojto 108:34e6b704fe68 756 */
Kojto 108:34e6b704fe68 757 #if !defined(STM32F030x6) && !defined(STM32F030x8) && !defined(STM32F070x6) && !defined(STM32F070xB) && !defined(STM32F030xC)
Kojto 108:34e6b704fe68 758 #define IS_UART_REQUEST_PARAMETER(__PARAM__) (((__PARAM__) == UART_AUTOBAUD_REQUEST) || \
Kojto 108:34e6b704fe68 759 ((__PARAM__) == UART_SENDBREAK_REQUEST) || \
Kojto 108:34e6b704fe68 760 ((__PARAM__) == UART_MUTE_MODE_REQUEST) || \
Kojto 108:34e6b704fe68 761 ((__PARAM__) == UART_RXDATA_FLUSH_REQUEST) || \
Kojto 108:34e6b704fe68 762 ((__PARAM__) == UART_TXDATA_FLUSH_REQUEST))
Kojto 108:34e6b704fe68 763 #else
Kojto 108:34e6b704fe68 764 #define IS_UART_REQUEST_PARAMETER(__PARAM__) (((__PARAM__) == UART_AUTOBAUD_REQUEST) || \
Kojto 108:34e6b704fe68 765 ((__PARAM__) == UART_SENDBREAK_REQUEST) || \
Kojto 108:34e6b704fe68 766 ((__PARAM__) == UART_MUTE_MODE_REQUEST) || \
Kojto 108:34e6b704fe68 767 ((__PARAM__) == UART_RXDATA_FLUSH_REQUEST))
Kojto 108:34e6b704fe68 768 #endif /* !defined(STM32F030x6) && !defined(STM32F030x8) && !defined(STM32F070x6) && !defined(STM32F070xB) && !defined(STM32F030xC) */
Kojto 108:34e6b704fe68 769
Kojto 108:34e6b704fe68 770 #if !defined(STM32F030x6) && !defined(STM32F030x8) && !defined(STM32F070x6) && !defined(STM32F070xB) && !defined(STM32F030xC)
Kojto 108:34e6b704fe68 771 /**
Kojto 108:34e6b704fe68 772 * @brief Ensure that UART stop mode state is valid.
Kojto 108:34e6b704fe68 773 * @param __STOPMODE__: UART stop mode state.
Kojto 108:34e6b704fe68 774 * @retval SET (__STOPMODE__ is valid) or RESET (__STOPMODE__ is invalid)
Kojto 108:34e6b704fe68 775 */
Kojto 108:34e6b704fe68 776 #define IS_UART_ADVFEATURE_STOPMODE(__STOPMODE__) (((__STOPMODE__) == UART_ADVFEATURE_STOPMODE_DISABLE) || \
Kojto 108:34e6b704fe68 777 ((__STOPMODE__) == UART_ADVFEATURE_STOPMODE_ENABLE))
Kojto 108:34e6b704fe68 778
Kojto 108:34e6b704fe68 779 /**
Kojto 108:34e6b704fe68 780 * @brief Ensure that UART wake-up selection is valid.
Kojto 108:34e6b704fe68 781 * @param __WAKE__: UART wake-up selection.
Kojto 108:34e6b704fe68 782 * @retval SET (__WAKE__ is valid) or RESET (__WAKE__ is invalid)
Kojto 108:34e6b704fe68 783 */
Kojto 108:34e6b704fe68 784 #define IS_UART_WAKEUP_SELECTION(__WAKE__) (((__WAKE__) == UART_WAKEUP_ON_ADDRESS) || \
Kojto 108:34e6b704fe68 785 ((__WAKE__) == UART_WAKEUP_ON_STARTBIT) || \
Kojto 108:34e6b704fe68 786 ((__WAKE__) == UART_WAKEUP_ON_READDATA_NONEMPTY))
Kojto 108:34e6b704fe68 787 #endif /* !defined(STM32F030x6) && !defined(STM32F030x8) && !defined(STM32F070x6) && !defined(STM32F070xB) && !defined(STM32F030xC) */
Kojto 108:34e6b704fe68 788
bogdanm 85:024bf7f99721 789 /**
bogdanm 85:024bf7f99721 790 * @}
bogdanm 85:024bf7f99721 791 */
bogdanm 85:024bf7f99721 792
bogdanm 85:024bf7f99721 793 /* Exported functions --------------------------------------------------------*/
bogdanm 92:4fc01daae5a5 794 /** @addtogroup UARTEx_Exported_Functions
bogdanm 92:4fc01daae5a5 795 * @{
bogdanm 92:4fc01daae5a5 796 */
bogdanm 92:4fc01daae5a5 797
bogdanm 92:4fc01daae5a5 798 /** @addtogroup UARTEx_Exported_Functions_Group1
bogdanm 92:4fc01daae5a5 799 * @brief Extended Initialization and Configuration Functions
bogdanm 92:4fc01daae5a5 800 * @{
bogdanm 92:4fc01daae5a5 801 */
bogdanm 85:024bf7f99721 802 /* Initialization and de-initialization functions ****************************/
Kojto 108:34e6b704fe68 803 HAL_StatusTypeDef HAL_RS485Ex_Init(UART_HandleTypeDef *huart, uint32_t UART_DEPolarity, uint32_t UART_DEAssertionTime, uint32_t UART_DEDeassertionTime);
Kojto 93:e188a91d3eaa 804 #if !defined(STM32F030x6) && !defined(STM32F030x8)&& !defined(STM32F070xB)&& !defined(STM32F070x6)&& !defined(STM32F030xC)
bogdanm 92:4fc01daae5a5 805 HAL_StatusTypeDef HAL_LIN_Init(UART_HandleTypeDef *huart, uint32_t BreakDetectLength);
Kojto 93:e188a91d3eaa 806 #endif /* !defined(STM32F030x6) && !defined(STM32F030x8)&& !defined(STM32F070xB)&& !defined(STM32F070x6)&& !defined(STM32F030xC) */
bogdanm 92:4fc01daae5a5 807 /**
bogdanm 92:4fc01daae5a5 808 * @}
bogdanm 92:4fc01daae5a5 809 */
bogdanm 92:4fc01daae5a5 810
bogdanm 92:4fc01daae5a5 811 /** @addtogroup UARTEx_Exported_Functions_Group2
Kojto 93:e188a91d3eaa 812 * @brief Extended UART Interrupt handling function
bogdanm 92:4fc01daae5a5 813 * @{
bogdanm 92:4fc01daae5a5 814 */
Kojto 108:34e6b704fe68 815
Kojto 93:e188a91d3eaa 816 /* IO operation functions ***************************************************/
Kojto 93:e188a91d3eaa 817 #if !defined(STM32F030x6) && !defined(STM32F030x8)&& !defined(STM32F070xB)&& !defined(STM32F070x6)&& !defined(STM32F030xC)
Kojto 108:34e6b704fe68 818 void HAL_UARTEx_WakeupCallback(UART_HandleTypeDef *huart);
Kojto 93:e188a91d3eaa 819 #endif /* !defined(STM32F030x6) && !defined(STM32F030x8)&& !defined(STM32F070xB)&& !defined(STM32F070x6)&& !defined(STM32F030xC) */
bogdanm 92:4fc01daae5a5 820 /**
bogdanm 92:4fc01daae5a5 821 * @}
bogdanm 92:4fc01daae5a5 822 */
bogdanm 92:4fc01daae5a5 823
bogdanm 92:4fc01daae5a5 824 /** @addtogroup UARTEx_Exported_Functions_Group3
bogdanm 92:4fc01daae5a5 825 * @brief Extended Peripheral Control functions
bogdanm 92:4fc01daae5a5 826 * @{
bogdanm 92:4fc01daae5a5 827 */
bogdanm 92:4fc01daae5a5 828
bogdanm 85:024bf7f99721 829 /* Peripheral Control functions **********************************************/
bogdanm 85:024bf7f99721 830 HAL_StatusTypeDef HAL_MultiProcessorEx_AddressLength_Set(UART_HandleTypeDef *huart, uint32_t AddressLength);
Kojto 93:e188a91d3eaa 831 #if !defined(STM32F030x6) && !defined(STM32F030x8)&& !defined(STM32F070xB)&& !defined(STM32F070x6) && !defined(STM32F030xC)
Kojto 93:e188a91d3eaa 832 HAL_StatusTypeDef HAL_UARTEx_StopModeWakeUpSourceConfig(UART_HandleTypeDef *huart, UART_WakeUpTypeDef WakeUpSelection);
Kojto 93:e188a91d3eaa 833 HAL_StatusTypeDef HAL_UARTEx_EnableStopMode(UART_HandleTypeDef *huart);
Kojto 93:e188a91d3eaa 834 HAL_StatusTypeDef HAL_UARTEx_DisableStopMode(UART_HandleTypeDef *huart);
bogdanm 85:024bf7f99721 835 HAL_StatusTypeDef HAL_LIN_SendBreak(UART_HandleTypeDef *huart);
Kojto 93:e188a91d3eaa 836 #endif /* !defined(STM32F030x6) && !defined(STM32F030x8)&& !defined(STM32F070xB)&& !defined(STM32F070x6)&& !defined(STM32F030xC) */
bogdanm 92:4fc01daae5a5 837 /**
bogdanm 92:4fc01daae5a5 838 * @}
bogdanm 92:4fc01daae5a5 839 */
bogdanm 85:024bf7f99721 840 /* Peripheral State functions ************************************************/
bogdanm 85:024bf7f99721 841
bogdanm 92:4fc01daae5a5 842 /**
bogdanm 92:4fc01daae5a5 843 * @}
Kojto 108:34e6b704fe68 844 */
bogdanm 92:4fc01daae5a5 845
Kojto 108:34e6b704fe68 846 /* Private functions ---------------------------------------------------------*/
bogdanm 85:024bf7f99721 847
bogdanm 85:024bf7f99721 848 /**
bogdanm 85:024bf7f99721 849 * @}
Kojto 108:34e6b704fe68 850 */
bogdanm 85:024bf7f99721 851
bogdanm 85:024bf7f99721 852 /**
bogdanm 85:024bf7f99721 853 * @}
Kojto 108:34e6b704fe68 854 */
bogdanm 85:024bf7f99721 855
bogdanm 85:024bf7f99721 856 #ifdef __cplusplus
bogdanm 85:024bf7f99721 857 }
bogdanm 85:024bf7f99721 858 #endif
bogdanm 85:024bf7f99721 859
bogdanm 85:024bf7f99721 860 #endif /* __STM32F0xx_HAL_UART_EX_H */
bogdanm 85:024bf7f99721 861
bogdanm 85:024bf7f99721 862 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
bogdanm 92:4fc01daae5a5 863