my fork
Fork of mbed by
TARGET_NUCLEO_F072RB/stm32f0xx_hal_uart_ex.h@85:024bf7f99721, 2014-06-11 (annotated)
- Committer:
- bogdanm
- Date:
- Wed Jun 11 15:14:05 2014 +0100
- Revision:
- 85:024bf7f99721
- Child:
- 92:4fc01daae5a5
Release 85 of the mbed library
Main changes:
- K64F Ethernet fixes
- Updated tests
- Fixes for various mbed targets
- Code cleanup: fixed warnings, more consistent code style
- GCC support for K64F
There is a known issue with the I2C interface on some ST targets. If you
find the I2C interface problematic on your ST board, please log a bug
against this on mbed.org.
Who changed what in which revision?
User | Revision | Line number | New 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 |
bogdanm | 85:024bf7f99721 | 5 | * @version V1.0.0 |
bogdanm | 85:024bf7f99721 | 6 | * @date 28-May-2014 |
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 | * |
bogdanm | 85:024bf7f99721 | 11 | * <h2><center>© COPYRIGHT(c) 2014 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 | * |
bogdanm | 85:024bf7f99721 | 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 | * @{ |
bogdanm | 85:024bf7f99721 | 55 | */ |
bogdanm | 85:024bf7f99721 | 56 | |
bogdanm | 85:024bf7f99721 | 57 | /* Exported types ------------------------------------------------------------*/ |
bogdanm | 85:024bf7f99721 | 58 | /* Exported constants --------------------------------------------------------*/ |
bogdanm | 85:024bf7f99721 | 59 | /** @defgroup UARTEx_Exported_Constants |
bogdanm | 85:024bf7f99721 | 60 | * @{ |
bogdanm | 85:024bf7f99721 | 61 | */ |
bogdanm | 85:024bf7f99721 | 62 | |
bogdanm | 85:024bf7f99721 | 63 | /** @defgroup UARTEx_Word_Length UART Word Length |
bogdanm | 85:024bf7f99721 | 64 | * @{ |
bogdanm | 85:024bf7f99721 | 65 | */ |
bogdanm | 85:024bf7f99721 | 66 | #if defined (STM32F042x6) || defined (STM32F048xx) || \ |
bogdanm | 85:024bf7f99721 | 67 | defined (STM32F071xB) || defined (STM32F072xB) || defined (STM32F078xx) |
bogdanm | 85:024bf7f99721 | 68 | #define UART_WORDLENGTH_7B ((uint32_t)USART_CR1_M1) |
bogdanm | 85:024bf7f99721 | 69 | #define UART_WORDLENGTH_8B ((uint32_t)0x00000000) |
bogdanm | 85:024bf7f99721 | 70 | #define UART_WORDLENGTH_9B ((uint32_t)USART_CR1_M0) |
bogdanm | 85:024bf7f99721 | 71 | #define IS_UART_WORD_LENGTH(LENGTH) (((LENGTH) == UART_WORDLENGTH_7B) || \ |
bogdanm | 85:024bf7f99721 | 72 | ((LENGTH) == UART_WORDLENGTH_8B) || \ |
bogdanm | 85:024bf7f99721 | 73 | ((LENGTH) == UART_WORDLENGTH_9B)) |
bogdanm | 85:024bf7f99721 | 74 | #else |
bogdanm | 85:024bf7f99721 | 75 | #define UART_WORDLENGTH_8B ((uint32_t)0x00000000) |
bogdanm | 85:024bf7f99721 | 76 | #define UART_WORDLENGTH_9B ((uint32_t)USART_CR1_M) |
bogdanm | 85:024bf7f99721 | 77 | #define IS_UART_WORD_LENGTH(LENGTH) (((LENGTH) == UART_WORDLENGTH_8B) || \ |
bogdanm | 85:024bf7f99721 | 78 | ((LENGTH) == UART_WORDLENGTH_9B)) |
bogdanm | 85:024bf7f99721 | 79 | #endif /* defined (STM32F042x6) || defined (STM32F048xx) || \ |
bogdanm | 85:024bf7f99721 | 80 | defined (STM32F071xB) || defined (STM32F072xB) || defined (STM32F078xx) */ |
bogdanm | 85:024bf7f99721 | 81 | /** |
bogdanm | 85:024bf7f99721 | 82 | * @} |
bogdanm | 85:024bf7f99721 | 83 | */ |
bogdanm | 85:024bf7f99721 | 84 | |
bogdanm | 85:024bf7f99721 | 85 | /** @defgroup UARTEx_AutoBaud_Rate_Mode UART Advanced Feature AutoBaud Rate Mode |
bogdanm | 85:024bf7f99721 | 86 | * @{ |
bogdanm | 85:024bf7f99721 | 87 | */ |
bogdanm | 85:024bf7f99721 | 88 | #if defined (STM32F042x6) || defined (STM32F048xx) || \ |
bogdanm | 85:024bf7f99721 | 89 | defined (STM32F071xB) || defined (STM32F072xB) || defined (STM32F078xx) |
bogdanm | 85:024bf7f99721 | 90 | #define UART_ADVFEATURE_AUTOBAUDRATE_ONSTARTBIT ((uint32_t)0x0000) |
bogdanm | 85:024bf7f99721 | 91 | #define UART_ADVFEATURE_AUTOBAUDRATE_ONFALLINGEDGE ((uint32_t)USART_CR2_ABRMODE_0) |
bogdanm | 85:024bf7f99721 | 92 | #define UART_ADVFEATURE_AUTOBAUDRATE_ON0X7FFRAME ((uint32_t)USART_CR2_ABRMODE_1) |
bogdanm | 85:024bf7f99721 | 93 | #define UART_ADVFEATURE_AUTOBAUDRATE_ON0X55FRAME ((uint32_t)USART_CR2_ABRMODE) |
bogdanm | 85:024bf7f99721 | 94 | #define IS_UART_ADVFEATURE_AUTOBAUDRATEMODE(MODE) (((MODE) == UART_ADVFEATURE_AUTOBAUDRATE_ONSTARTBIT) || \ |
bogdanm | 85:024bf7f99721 | 95 | ((MODE) == UART_ADVFEATURE_AUTOBAUDRATE_ONFALLINGEDGE) || \ |
bogdanm | 85:024bf7f99721 | 96 | ((MODE) == UART_ADVFEATURE_AUTOBAUDRATE_ON0X7FFRAME) || \ |
bogdanm | 85:024bf7f99721 | 97 | ((MODE) == UART_ADVFEATURE_AUTOBAUDRATE_ON0X55FRAME)) |
bogdanm | 85:024bf7f99721 | 98 | #else |
bogdanm | 85:024bf7f99721 | 99 | #define UART_ADVFEATURE_AUTOBAUDRATE_ONSTARTBIT ((uint32_t)0x0000) |
bogdanm | 85:024bf7f99721 | 100 | #define UART_ADVFEATURE_AUTOBAUDRATE_ONFALLINGEDGE ((uint32_t)USART_CR2_ABRMODE_0) |
bogdanm | 85:024bf7f99721 | 101 | #define IS_UART_ADVFEATURE_AUTOBAUDRATEMODE(MODE) (((MODE) == UART_ADVFEATURE_AUTOBAUDRATE_ONSTARTBIT) || \ |
bogdanm | 85:024bf7f99721 | 102 | ((MODE) == UART_ADVFEATURE_AUTOBAUDRATE_ONFALLINGEDGE)) |
bogdanm | 85:024bf7f99721 | 103 | #endif /* defined (STM32F042x6) || defined (STM32F048xx) || \ |
bogdanm | 85:024bf7f99721 | 104 | defined (STM32F071xB) || defined (STM32F072xB) || defined (STM32F078xx) */ |
bogdanm | 85:024bf7f99721 | 105 | /** |
bogdanm | 85:024bf7f99721 | 106 | * @} |
bogdanm | 85:024bf7f99721 | 107 | */ |
bogdanm | 85:024bf7f99721 | 108 | |
bogdanm | 85:024bf7f99721 | 109 | |
bogdanm | 85:024bf7f99721 | 110 | #if !defined(STM32F030x6) && !defined(STM32F030x8) |
bogdanm | 85:024bf7f99721 | 111 | /** @defgroup UARTEx_LIN UART Local Interconnection Network mode |
bogdanm | 85:024bf7f99721 | 112 | * @{ |
bogdanm | 85:024bf7f99721 | 113 | */ |
bogdanm | 85:024bf7f99721 | 114 | #define UART_LIN_DISABLE ((uint32_t)0x00000000) |
bogdanm | 85:024bf7f99721 | 115 | #define UART_LIN_ENABLE ((uint32_t)USART_CR2_LINEN) |
bogdanm | 85:024bf7f99721 | 116 | #define IS_UART_LIN(LIN) (((LIN) == UART_LIN_DISABLE) || \ |
bogdanm | 85:024bf7f99721 | 117 | ((LIN) == UART_LIN_ENABLE)) |
bogdanm | 85:024bf7f99721 | 118 | /** |
bogdanm | 85:024bf7f99721 | 119 | * @} |
bogdanm | 85:024bf7f99721 | 120 | */ |
bogdanm | 85:024bf7f99721 | 121 | |
bogdanm | 85:024bf7f99721 | 122 | /** @defgroup UARTEx_LIN_Break_Detection UART LIN Break Detection |
bogdanm | 85:024bf7f99721 | 123 | * @{ |
bogdanm | 85:024bf7f99721 | 124 | */ |
bogdanm | 85:024bf7f99721 | 125 | #define UART_LINBREAKDETECTLENGTH_10B ((uint32_t)0x00000000) |
bogdanm | 85:024bf7f99721 | 126 | #define UART_LINBREAKDETECTLENGTH_11B ((uint32_t)USART_CR2_LBDL) |
bogdanm | 85:024bf7f99721 | 127 | #define IS_UART_LIN_BREAK_DETECT_LENGTH(LENGTH) (((LENGTH) == UART_LINBREAKDETECTLENGTH_10B) || \ |
bogdanm | 85:024bf7f99721 | 128 | ((LENGTH) == UART_LINBREAKDETECTLENGTH_11B)) |
bogdanm | 85:024bf7f99721 | 129 | /** |
bogdanm | 85:024bf7f99721 | 130 | * @} |
bogdanm | 85:024bf7f99721 | 131 | */ |
bogdanm | 85:024bf7f99721 | 132 | #endif /* !defined(STM32F030x6) && !defined(STM32F030x8) */ |
bogdanm | 85:024bf7f99721 | 133 | |
bogdanm | 85:024bf7f99721 | 134 | |
bogdanm | 85:024bf7f99721 | 135 | |
bogdanm | 85:024bf7f99721 | 136 | /** @defgroup UART_Flags UART Status Flags |
bogdanm | 85:024bf7f99721 | 137 | * Elements values convention: 0xXXXX |
bogdanm | 85:024bf7f99721 | 138 | * - 0xXXXX : Flag mask in the ISR register |
bogdanm | 85:024bf7f99721 | 139 | * @{ |
bogdanm | 85:024bf7f99721 | 140 | */ |
bogdanm | 85:024bf7f99721 | 141 | #define UART_FLAG_REACK ((uint32_t)0x00400000) |
bogdanm | 85:024bf7f99721 | 142 | #define UART_FLAG_TEACK ((uint32_t)0x00200000) |
bogdanm | 85:024bf7f99721 | 143 | #if !defined(STM32F030x6) && !defined(STM32F030x8) |
bogdanm | 85:024bf7f99721 | 144 | #define UART_FLAG_WUF ((uint32_t)0x00100000) |
bogdanm | 85:024bf7f99721 | 145 | #endif /* !defined(STM32F030x6) && !defined(STM32F030x8) */ |
bogdanm | 85:024bf7f99721 | 146 | #define UART_FLAG_RWU ((uint32_t)0x00080000) |
bogdanm | 85:024bf7f99721 | 147 | #define UART_FLAG_SBKF ((uint32_t)0x00040000 |
bogdanm | 85:024bf7f99721 | 148 | #define UART_FLAG_CMF ((uint32_t)0x00020000) |
bogdanm | 85:024bf7f99721 | 149 | #define UART_FLAG_BUSY ((uint32_t)0x00010000) |
bogdanm | 85:024bf7f99721 | 150 | #define UART_FLAG_ABRF ((uint32_t)0x00008000) |
bogdanm | 85:024bf7f99721 | 151 | #define UART_FLAG_ABRE ((uint32_t)0x00004000) |
bogdanm | 85:024bf7f99721 | 152 | #if !defined(STM32F030x6) && !defined(STM32F030x8) |
bogdanm | 85:024bf7f99721 | 153 | #define UART_FLAG_EOBF ((uint32_t)0x00001000) |
bogdanm | 85:024bf7f99721 | 154 | #endif /* !defined(STM32F030x6) && !defined(STM32F030x8) */ |
bogdanm | 85:024bf7f99721 | 155 | #define UART_FLAG_RTOF ((uint32_t)0x00000800) |
bogdanm | 85:024bf7f99721 | 156 | #define UART_FLAG_CTS ((uint32_t)0x00000400) |
bogdanm | 85:024bf7f99721 | 157 | #define UART_FLAG_CTSIF ((uint32_t)0x00000200) |
bogdanm | 85:024bf7f99721 | 158 | #if !defined(STM32F030x6) && !defined(STM32F030x8) |
bogdanm | 85:024bf7f99721 | 159 | #define UART_FLAG_LBDF ((uint32_t)0x00000100) |
bogdanm | 85:024bf7f99721 | 160 | #endif /* !defined(STM32F030x6) && !defined(STM32F030x8) */ |
bogdanm | 85:024bf7f99721 | 161 | #define UART_FLAG_TXE ((uint32_t)0x00000080) |
bogdanm | 85:024bf7f99721 | 162 | #define UART_FLAG_TC ((uint32_t)0x00000040) |
bogdanm | 85:024bf7f99721 | 163 | #define UART_FLAG_RXNE ((uint32_t)0x00000020) |
bogdanm | 85:024bf7f99721 | 164 | #define UART_FLAG_IDLE ((uint32_t)0x00000010) |
bogdanm | 85:024bf7f99721 | 165 | #define UART_FLAG_ORE ((uint32_t)0x00000008) |
bogdanm | 85:024bf7f99721 | 166 | #define UART_FLAG_NE ((uint32_t)0x00000004) |
bogdanm | 85:024bf7f99721 | 167 | #define UART_FLAG_FE ((uint32_t)0x00000002) |
bogdanm | 85:024bf7f99721 | 168 | #define UART_FLAG_PE ((uint32_t)0x00000001) |
bogdanm | 85:024bf7f99721 | 169 | /** |
bogdanm | 85:024bf7f99721 | 170 | * @} |
bogdanm | 85:024bf7f99721 | 171 | */ |
bogdanm | 85:024bf7f99721 | 172 | |
bogdanm | 85:024bf7f99721 | 173 | /** @defgroup UART_Interrupt_definition UART Interrupts Definition |
bogdanm | 85:024bf7f99721 | 174 | * Elements values convention: 0000ZZZZ0XXYYYYYb |
bogdanm | 85:024bf7f99721 | 175 | * - YYYYY : Interrupt source position in the XX register (5bits) |
bogdanm | 85:024bf7f99721 | 176 | * - XX : Interrupt source register (2bits) |
bogdanm | 85:024bf7f99721 | 177 | * - 01: CR1 register |
bogdanm | 85:024bf7f99721 | 178 | * - 10: CR2 register |
bogdanm | 85:024bf7f99721 | 179 | * - 11: CR3 register |
bogdanm | 85:024bf7f99721 | 180 | * - ZZZZ : Flag position in the ISR register(4bits) |
bogdanm | 85:024bf7f99721 | 181 | * @{ |
bogdanm | 85:024bf7f99721 | 182 | */ |
bogdanm | 85:024bf7f99721 | 183 | #define UART_IT_PE ((uint16_t)0x0028) |
bogdanm | 85:024bf7f99721 | 184 | #define UART_IT_TXE ((uint16_t)0x0727) |
bogdanm | 85:024bf7f99721 | 185 | #define UART_IT_TC ((uint16_t)0x0626) |
bogdanm | 85:024bf7f99721 | 186 | #define UART_IT_RXNE ((uint16_t)0x0525) |
bogdanm | 85:024bf7f99721 | 187 | #define UART_IT_IDLE ((uint16_t)0x0424) |
bogdanm | 85:024bf7f99721 | 188 | #if !defined(STM32F030x6) && !defined(STM32F030x8) |
bogdanm | 85:024bf7f99721 | 189 | #define UART_IT_LBD ((uint16_t)0x0846) |
bogdanm | 85:024bf7f99721 | 190 | #endif /* !defined(STM32F030x6) && !defined(STM32F030x8) */ |
bogdanm | 85:024bf7f99721 | 191 | #define UART_IT_CTS ((uint16_t)0x096A) |
bogdanm | 85:024bf7f99721 | 192 | #define UART_IT_CM ((uint16_t)0x142E) |
bogdanm | 85:024bf7f99721 | 193 | #if !defined(STM32F030x6) && !defined(STM32F030x8) |
bogdanm | 85:024bf7f99721 | 194 | #define UART_IT_WUF ((uint16_t)0x1476) |
bogdanm | 85:024bf7f99721 | 195 | #endif /* !defined(STM32F030x6) && !defined(STM32F030x8) */ |
bogdanm | 85:024bf7f99721 | 196 | /** |
bogdanm | 85:024bf7f99721 | 197 | * @} |
bogdanm | 85:024bf7f99721 | 198 | */ |
bogdanm | 85:024bf7f99721 | 199 | |
bogdanm | 85:024bf7f99721 | 200 | |
bogdanm | 85:024bf7f99721 | 201 | /** @defgroup UART_IT_CLEAR_Flags UART Interruption Clear Flags |
bogdanm | 85:024bf7f99721 | 202 | * @{ |
bogdanm | 85:024bf7f99721 | 203 | */ |
bogdanm | 85:024bf7f99721 | 204 | #define UART_CLEAR_PEF USART_ICR_PECF /*!< Parity Error Clear Flag */ |
bogdanm | 85:024bf7f99721 | 205 | #define UART_CLEAR_FEF USART_ICR_FECF /*!< Framing Error Clear Flag */ |
bogdanm | 85:024bf7f99721 | 206 | #define UART_CLEAR_NEF USART_ICR_NCF /*!< Noise detected Clear Flag */ |
bogdanm | 85:024bf7f99721 | 207 | #define UART_CLEAR_OREF USART_ICR_ORECF /*!< OverRun Error Clear Flag */ |
bogdanm | 85:024bf7f99721 | 208 | #define UART_CLEAR_IDLEF USART_ICR_IDLECF /*!< IDLE line detected Clear Flag */ |
bogdanm | 85:024bf7f99721 | 209 | #define UART_CLEAR_TCF USART_ICR_TCCF /*!< Transmission Complete Clear Flag */ |
bogdanm | 85:024bf7f99721 | 210 | #if !defined(STM32F030x6) && !defined(STM32F030x8) |
bogdanm | 85:024bf7f99721 | 211 | #define UART_CLEAR_LBDF USART_ICR_LBDCF /*!< LIN Break Detection Clear Flag (not available on F030xx devices)*/ |
bogdanm | 85:024bf7f99721 | 212 | #endif /* !defined(STM32F030x6) && !defined(STM32F030x8) */ |
bogdanm | 85:024bf7f99721 | 213 | #define UART_CLEAR_CTSF USART_ICR_CTSCF /*!< CTS Interrupt Clear Flag */ |
bogdanm | 85:024bf7f99721 | 214 | #define UART_CLEAR_RTOF USART_ICR_RTOCF /*!< Receiver Time Out Clear Flag */ |
bogdanm | 85:024bf7f99721 | 215 | #define UART_CLEAR_EOBF USART_ICR_EOBCF /*!< End Of Block Clear Flag */ |
bogdanm | 85:024bf7f99721 | 216 | #define UART_CLEAR_CMF USART_ICR_CMCF /*!< Character Match Clear Flag */ |
bogdanm | 85:024bf7f99721 | 217 | #if !defined(STM32F030x6) && !defined(STM32F030x8) |
bogdanm | 85:024bf7f99721 | 218 | #define UART_CLEAR_WUF USART_ICR_WUCF /*!< Wake Up from stop mode Clear Flag */ |
bogdanm | 85:024bf7f99721 | 219 | #endif /* !defined(STM32F030x6) && !defined(STM32F030x8) */ |
bogdanm | 85:024bf7f99721 | 220 | /** |
bogdanm | 85:024bf7f99721 | 221 | * @} |
bogdanm | 85:024bf7f99721 | 222 | */ |
bogdanm | 85:024bf7f99721 | 223 | |
bogdanm | 85:024bf7f99721 | 224 | /** @defgroup UART_Request_Parameters UART Request Parameters |
bogdanm | 85:024bf7f99721 | 225 | * @{ |
bogdanm | 85:024bf7f99721 | 226 | */ |
bogdanm | 85:024bf7f99721 | 227 | #define UART_AUTOBAUD_REQUEST ((uint32_t)USART_RQR_ABRRQ) /*!< Auto-Baud Rate Request */ |
bogdanm | 85:024bf7f99721 | 228 | #define UART_SENDBREAK_REQUEST ((uint32_t)USART_RQR_SBKRQ) /*!< Send Break Request */ |
bogdanm | 85:024bf7f99721 | 229 | #define UART_MUTE_MODE_REQUEST ((uint32_t)USART_RQR_MMRQ) /*!< Mute Mode Request */ |
bogdanm | 85:024bf7f99721 | 230 | #define UART_RXDATA_FLUSH_REQUEST ((uint32_t)USART_RQR_RXFRQ) /*!< Receive Data flush Request */ |
bogdanm | 85:024bf7f99721 | 231 | #if !defined(STM32F030x6) && !defined(STM32F030x8) |
bogdanm | 85:024bf7f99721 | 232 | #define UART_TXDATA_FLUSH_REQUEST ((uint32_t)USART_RQR_TXFRQ) /*!< Transmit data flush Request */ |
bogdanm | 85:024bf7f99721 | 233 | #define IS_UART_REQUEST_PARAMETER(PARAM) (((PARAM) == UART_AUTOBAUD_REQUEST) || \ |
bogdanm | 85:024bf7f99721 | 234 | ((PARAM) == UART_SENDBREAK_REQUEST) || \ |
bogdanm | 85:024bf7f99721 | 235 | ((PARAM) == UART_MUTE_MODE_REQUEST) || \ |
bogdanm | 85:024bf7f99721 | 236 | ((PARAM) == UART_RXDATA_FLUSH_REQUEST) || \ |
bogdanm | 85:024bf7f99721 | 237 | ((PARAM) == UART_TXDATA_FLUSH_REQUEST)) |
bogdanm | 85:024bf7f99721 | 238 | #else |
bogdanm | 85:024bf7f99721 | 239 | #define IS_UART_REQUEST_PARAMETER(PARAM) (((PARAM) == UART_AUTOBAUD_REQUEST) || \ |
bogdanm | 85:024bf7f99721 | 240 | ((PARAM) == UART_SENDBREAK_REQUEST) || \ |
bogdanm | 85:024bf7f99721 | 241 | ((PARAM) == UART_MUTE_MODE_REQUEST) || \ |
bogdanm | 85:024bf7f99721 | 242 | ((PARAM) == UART_RXDATA_FLUSH_REQUEST)) |
bogdanm | 85:024bf7f99721 | 243 | #endif /* !defined(STM32F030x6) && !defined(STM32F030x8) */ |
bogdanm | 85:024bf7f99721 | 244 | /** |
bogdanm | 85:024bf7f99721 | 245 | * @} |
bogdanm | 85:024bf7f99721 | 246 | */ |
bogdanm | 85:024bf7f99721 | 247 | |
bogdanm | 85:024bf7f99721 | 248 | #if !defined(STM32F030x6) && !defined(STM32F030x8) |
bogdanm | 85:024bf7f99721 | 249 | /** @defgroup UART_Stop_Mode_Enable UART Advanced Feature Stop Mode Enable |
bogdanm | 85:024bf7f99721 | 250 | * @{ |
bogdanm | 85:024bf7f99721 | 251 | */ |
bogdanm | 85:024bf7f99721 | 252 | #define UART_ADVFEATURE_STOPMODE_DISABLE ((uint32_t)0x00000000) |
bogdanm | 85:024bf7f99721 | 253 | #define UART_ADVFEATURE_STOPMODE_ENABLE ((uint32_t)USART_CR1_UESM) |
bogdanm | 85:024bf7f99721 | 254 | #define IS_UART_ADVFEATURE_STOPMODE(STOPMODE) (((STOPMODE) == UART_ADVFEATURE_STOPMODE_DISABLE) || \ |
bogdanm | 85:024bf7f99721 | 255 | ((STOPMODE) == UART_ADVFEATURE_STOPMODE_ENABLE)) |
bogdanm | 85:024bf7f99721 | 256 | /** |
bogdanm | 85:024bf7f99721 | 257 | * @} |
bogdanm | 85:024bf7f99721 | 258 | */ |
bogdanm | 85:024bf7f99721 | 259 | |
bogdanm | 85:024bf7f99721 | 260 | /** @defgroup UART_WakeUp_from_Stop_Selection UART WakeUp From Stop Selection |
bogdanm | 85:024bf7f99721 | 261 | * @{ |
bogdanm | 85:024bf7f99721 | 262 | */ |
bogdanm | 85:024bf7f99721 | 263 | #define UART_WAKEUP_ON_ADDRESS ((uint32_t)0x0000) |
bogdanm | 85:024bf7f99721 | 264 | #define UART_WAKEUP_ON_STARTBIT ((uint32_t)USART_CR3_WUS_1) |
bogdanm | 85:024bf7f99721 | 265 | #define UART_WAKEUP_ON_READDATA_NONEMPTY ((uint32_t)USART_CR3_WUS) |
bogdanm | 85:024bf7f99721 | 266 | #define IS_UART_WAKEUP_SELECTION(WAKE) (((WAKE) == UART_WAKEUP_ON_ADDRESS) || \ |
bogdanm | 85:024bf7f99721 | 267 | ((WAKE) == UART_WAKEUP_ON_STARTBIT) || \ |
bogdanm | 85:024bf7f99721 | 268 | ((WAKE) == UART_WAKEUP_ON_READDATA_NONEMPTY)) |
bogdanm | 85:024bf7f99721 | 269 | /** |
bogdanm | 85:024bf7f99721 | 270 | * @} |
bogdanm | 85:024bf7f99721 | 271 | */ |
bogdanm | 85:024bf7f99721 | 272 | #endif /* !defined(STM32F030x6) && !defined(STM32F030x8) */ |
bogdanm | 85:024bf7f99721 | 273 | |
bogdanm | 85:024bf7f99721 | 274 | /** |
bogdanm | 85:024bf7f99721 | 275 | * @} |
bogdanm | 85:024bf7f99721 | 276 | */ |
bogdanm | 85:024bf7f99721 | 277 | |
bogdanm | 85:024bf7f99721 | 278 | /* Exported macro ------------------------------------------------------------*/ |
bogdanm | 85:024bf7f99721 | 279 | |
bogdanm | 85:024bf7f99721 | 280 | /** @defgroup UARTEx_Exported_Macros |
bogdanm | 85:024bf7f99721 | 281 | * @{ |
bogdanm | 85:024bf7f99721 | 282 | */ |
bogdanm | 85:024bf7f99721 | 283 | |
bogdanm | 85:024bf7f99721 | 284 | /** @brief Reports the UART clock source. |
bogdanm | 85:024bf7f99721 | 285 | * @param __HANDLE__: specifies the UART Handle |
bogdanm | 85:024bf7f99721 | 286 | * @param __CLOCKSOURCE__ : output variable |
bogdanm | 85:024bf7f99721 | 287 | * @retval UART clocking source, written in __CLOCKSOURCE__. |
bogdanm | 85:024bf7f99721 | 288 | */ |
bogdanm | 85:024bf7f99721 | 289 | |
bogdanm | 85:024bf7f99721 | 290 | |
bogdanm | 85:024bf7f99721 | 291 | #if defined(STM32F030x6) || defined(STM32F031x6) || defined(STM32F038xx) |
bogdanm | 85:024bf7f99721 | 292 | #define __HAL_UART_GETCLOCKSOURCE(__HANDLE__,__CLOCKSOURCE__) \ |
bogdanm | 85:024bf7f99721 | 293 | do { \ |
bogdanm | 85:024bf7f99721 | 294 | switch(__HAL_RCC_GET_USART1_SOURCE()) \ |
bogdanm | 85:024bf7f99721 | 295 | { \ |
bogdanm | 85:024bf7f99721 | 296 | case RCC_USART1CLKSOURCE_PCLK1: \ |
bogdanm | 85:024bf7f99721 | 297 | (__CLOCKSOURCE__) = UART_CLOCKSOURCE_PCLK1; \ |
bogdanm | 85:024bf7f99721 | 298 | break; \ |
bogdanm | 85:024bf7f99721 | 299 | case RCC_USART1CLKSOURCE_HSI: \ |
bogdanm | 85:024bf7f99721 | 300 | (__CLOCKSOURCE__) = UART_CLOCKSOURCE_HSI; \ |
bogdanm | 85:024bf7f99721 | 301 | break; \ |
bogdanm | 85:024bf7f99721 | 302 | case RCC_USART1CLKSOURCE_SYSCLK: \ |
bogdanm | 85:024bf7f99721 | 303 | (__CLOCKSOURCE__) = UART_CLOCKSOURCE_SYSCLK; \ |
bogdanm | 85:024bf7f99721 | 304 | break; \ |
bogdanm | 85:024bf7f99721 | 305 | case RCC_USART1CLKSOURCE_LSE: \ |
bogdanm | 85:024bf7f99721 | 306 | (__CLOCKSOURCE__) = UART_CLOCKSOURCE_LSE; \ |
bogdanm | 85:024bf7f99721 | 307 | break; \ |
bogdanm | 85:024bf7f99721 | 308 | default: \ |
bogdanm | 85:024bf7f99721 | 309 | (__CLOCKSOURCE__) = UART_CLOCKSOURCE_UNDEFINED; \ |
bogdanm | 85:024bf7f99721 | 310 | break; \ |
bogdanm | 85:024bf7f99721 | 311 | } \ |
bogdanm | 85:024bf7f99721 | 312 | } while(0) |
bogdanm | 85:024bf7f99721 | 313 | #elif defined (STM32F030x8) || \ |
bogdanm | 85:024bf7f99721 | 314 | defined (STM32F042x6) || defined (STM32F048xx) || \ |
bogdanm | 85:024bf7f99721 | 315 | defined (STM32F051x8) || defined (STM32F058xx) |
bogdanm | 85:024bf7f99721 | 316 | #define __HAL_UART_GETCLOCKSOURCE(__HANDLE__,__CLOCKSOURCE__) \ |
bogdanm | 85:024bf7f99721 | 317 | do { \ |
bogdanm | 85:024bf7f99721 | 318 | if((__HANDLE__)->Instance == USART1) \ |
bogdanm | 85:024bf7f99721 | 319 | { \ |
bogdanm | 85:024bf7f99721 | 320 | switch(__HAL_RCC_GET_USART1_SOURCE()) \ |
bogdanm | 85:024bf7f99721 | 321 | { \ |
bogdanm | 85:024bf7f99721 | 322 | case RCC_USART1CLKSOURCE_PCLK1: \ |
bogdanm | 85:024bf7f99721 | 323 | (__CLOCKSOURCE__) = UART_CLOCKSOURCE_PCLK1; \ |
bogdanm | 85:024bf7f99721 | 324 | break; \ |
bogdanm | 85:024bf7f99721 | 325 | case RCC_USART1CLKSOURCE_HSI: \ |
bogdanm | 85:024bf7f99721 | 326 | (__CLOCKSOURCE__) = UART_CLOCKSOURCE_HSI; \ |
bogdanm | 85:024bf7f99721 | 327 | break; \ |
bogdanm | 85:024bf7f99721 | 328 | case RCC_USART1CLKSOURCE_SYSCLK: \ |
bogdanm | 85:024bf7f99721 | 329 | (__CLOCKSOURCE__) = UART_CLOCKSOURCE_SYSCLK; \ |
bogdanm | 85:024bf7f99721 | 330 | break; \ |
bogdanm | 85:024bf7f99721 | 331 | case RCC_USART1CLKSOURCE_LSE: \ |
bogdanm | 85:024bf7f99721 | 332 | (__CLOCKSOURCE__) = UART_CLOCKSOURCE_LSE; \ |
bogdanm | 85:024bf7f99721 | 333 | break; \ |
bogdanm | 85:024bf7f99721 | 334 | default: \ |
bogdanm | 85:024bf7f99721 | 335 | (__CLOCKSOURCE__) = UART_CLOCKSOURCE_UNDEFINED; \ |
bogdanm | 85:024bf7f99721 | 336 | break; \ |
bogdanm | 85:024bf7f99721 | 337 | } \ |
bogdanm | 85:024bf7f99721 | 338 | } \ |
bogdanm | 85:024bf7f99721 | 339 | else if((__HANDLE__)->Instance == USART2) \ |
bogdanm | 85:024bf7f99721 | 340 | { \ |
bogdanm | 85:024bf7f99721 | 341 | (__CLOCKSOURCE__) = UART_CLOCKSOURCE_PCLK1; \ |
bogdanm | 85:024bf7f99721 | 342 | } \ |
bogdanm | 85:024bf7f99721 | 343 | else \ |
bogdanm | 85:024bf7f99721 | 344 | { \ |
bogdanm | 85:024bf7f99721 | 345 | (__CLOCKSOURCE__) = UART_CLOCKSOURCE_UNDEFINED; \ |
bogdanm | 85:024bf7f99721 | 346 | } \ |
bogdanm | 85:024bf7f99721 | 347 | } while(0) |
bogdanm | 85:024bf7f99721 | 348 | #elif defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) |
bogdanm | 85:024bf7f99721 | 349 | #define __HAL_UART_GETCLOCKSOURCE(__HANDLE__,__CLOCKSOURCE__) \ |
bogdanm | 85:024bf7f99721 | 350 | do { \ |
bogdanm | 85:024bf7f99721 | 351 | if((__HANDLE__)->Instance == USART1) \ |
bogdanm | 85:024bf7f99721 | 352 | { \ |
bogdanm | 85:024bf7f99721 | 353 | switch(__HAL_RCC_GET_USART1_SOURCE()) \ |
bogdanm | 85:024bf7f99721 | 354 | { \ |
bogdanm | 85:024bf7f99721 | 355 | case RCC_USART1CLKSOURCE_PCLK1: \ |
bogdanm | 85:024bf7f99721 | 356 | (__CLOCKSOURCE__) = UART_CLOCKSOURCE_PCLK1; \ |
bogdanm | 85:024bf7f99721 | 357 | break; \ |
bogdanm | 85:024bf7f99721 | 358 | case RCC_USART1CLKSOURCE_HSI: \ |
bogdanm | 85:024bf7f99721 | 359 | (__CLOCKSOURCE__) = UART_CLOCKSOURCE_HSI; \ |
bogdanm | 85:024bf7f99721 | 360 | break; \ |
bogdanm | 85:024bf7f99721 | 361 | case RCC_USART1CLKSOURCE_SYSCLK: \ |
bogdanm | 85:024bf7f99721 | 362 | (__CLOCKSOURCE__) = UART_CLOCKSOURCE_SYSCLK; \ |
bogdanm | 85:024bf7f99721 | 363 | break; \ |
bogdanm | 85:024bf7f99721 | 364 | case RCC_USART1CLKSOURCE_LSE: \ |
bogdanm | 85:024bf7f99721 | 365 | (__CLOCKSOURCE__) = UART_CLOCKSOURCE_LSE; \ |
bogdanm | 85:024bf7f99721 | 366 | break; \ |
bogdanm | 85:024bf7f99721 | 367 | default: \ |
bogdanm | 85:024bf7f99721 | 368 | (__CLOCKSOURCE__) = UART_CLOCKSOURCE_UNDEFINED; \ |
bogdanm | 85:024bf7f99721 | 369 | break; \ |
bogdanm | 85:024bf7f99721 | 370 | } \ |
bogdanm | 85:024bf7f99721 | 371 | } \ |
bogdanm | 85:024bf7f99721 | 372 | else if((__HANDLE__)->Instance == USART2) \ |
bogdanm | 85:024bf7f99721 | 373 | { \ |
bogdanm | 85:024bf7f99721 | 374 | switch(__HAL_RCC_GET_USART2_SOURCE()) \ |
bogdanm | 85:024bf7f99721 | 375 | { \ |
bogdanm | 85:024bf7f99721 | 376 | case RCC_USART2CLKSOURCE_PCLK1: \ |
bogdanm | 85:024bf7f99721 | 377 | (__CLOCKSOURCE__) = UART_CLOCKSOURCE_PCLK1; \ |
bogdanm | 85:024bf7f99721 | 378 | break; \ |
bogdanm | 85:024bf7f99721 | 379 | case RCC_USART2CLKSOURCE_HSI: \ |
bogdanm | 85:024bf7f99721 | 380 | (__CLOCKSOURCE__) = UART_CLOCKSOURCE_HSI; \ |
bogdanm | 85:024bf7f99721 | 381 | break; \ |
bogdanm | 85:024bf7f99721 | 382 | case RCC_USART2CLKSOURCE_SYSCLK: \ |
bogdanm | 85:024bf7f99721 | 383 | (__CLOCKSOURCE__) = UART_CLOCKSOURCE_SYSCLK; \ |
bogdanm | 85:024bf7f99721 | 384 | break; \ |
bogdanm | 85:024bf7f99721 | 385 | case RCC_USART2CLKSOURCE_LSE: \ |
bogdanm | 85:024bf7f99721 | 386 | (__CLOCKSOURCE__) = UART_CLOCKSOURCE_LSE; \ |
bogdanm | 85:024bf7f99721 | 387 | break; \ |
bogdanm | 85:024bf7f99721 | 388 | default: \ |
bogdanm | 85:024bf7f99721 | 389 | (__CLOCKSOURCE__) = UART_CLOCKSOURCE_UNDEFINED; \ |
bogdanm | 85:024bf7f99721 | 390 | break; \ |
bogdanm | 85:024bf7f99721 | 391 | } \ |
bogdanm | 85:024bf7f99721 | 392 | } \ |
bogdanm | 85:024bf7f99721 | 393 | else if((__HANDLE__)->Instance == USART3) \ |
bogdanm | 85:024bf7f99721 | 394 | { \ |
bogdanm | 85:024bf7f99721 | 395 | (__CLOCKSOURCE__) = UART_CLOCKSOURCE_PCLK1; \ |
bogdanm | 85:024bf7f99721 | 396 | } \ |
bogdanm | 85:024bf7f99721 | 397 | else if((__HANDLE__)->Instance == USART4) \ |
bogdanm | 85:024bf7f99721 | 398 | { \ |
bogdanm | 85:024bf7f99721 | 399 | (__CLOCKSOURCE__) = UART_CLOCKSOURCE_PCLK1; \ |
bogdanm | 85:024bf7f99721 | 400 | } \ |
bogdanm | 85:024bf7f99721 | 401 | else \ |
bogdanm | 85:024bf7f99721 | 402 | { \ |
bogdanm | 85:024bf7f99721 | 403 | (__CLOCKSOURCE__) = UART_CLOCKSOURCE_UNDEFINED; \ |
bogdanm | 85:024bf7f99721 | 404 | } \ |
bogdanm | 85:024bf7f99721 | 405 | } while(0) |
bogdanm | 85:024bf7f99721 | 406 | #endif /* defined(STM32F030x6) || defined(STM32F031x6) || defined(STM32F038xx) */ |
bogdanm | 85:024bf7f99721 | 407 | |
bogdanm | 85:024bf7f99721 | 408 | |
bogdanm | 85:024bf7f99721 | 409 | /** @brief Computes the UART mask to apply to retrieve the received data |
bogdanm | 85:024bf7f99721 | 410 | * according to the word length and to the parity bits activation. |
bogdanm | 85:024bf7f99721 | 411 | * If PCE = 1, the parity bit is not included in the data extracted |
bogdanm | 85:024bf7f99721 | 412 | * by the reception API(). |
bogdanm | 85:024bf7f99721 | 413 | * This masking operation is not carried out in the case of |
bogdanm | 85:024bf7f99721 | 414 | * DMA transfers. |
bogdanm | 85:024bf7f99721 | 415 | * @param __HANDLE__: specifies the UART Handle |
bogdanm | 85:024bf7f99721 | 416 | * @retval none |
bogdanm | 85:024bf7f99721 | 417 | */ |
bogdanm | 85:024bf7f99721 | 418 | #if defined (STM32F042x6) || defined (STM32F048xx) || \ |
bogdanm | 85:024bf7f99721 | 419 | defined (STM32F071xB) || defined (STM32F072xB) || defined (STM32F078xx) |
bogdanm | 85:024bf7f99721 | 420 | #define __HAL_UART_MASK_COMPUTATION(__HANDLE__) \ |
bogdanm | 85:024bf7f99721 | 421 | do { \ |
bogdanm | 85:024bf7f99721 | 422 | if ((__HANDLE__)->Init.WordLength == UART_WORDLENGTH_9B) \ |
bogdanm | 85:024bf7f99721 | 423 | { \ |
bogdanm | 85:024bf7f99721 | 424 | if ((__HANDLE__)->Init.Parity == UART_PARITY_NONE) \ |
bogdanm | 85:024bf7f99721 | 425 | { \ |
bogdanm | 85:024bf7f99721 | 426 | (__HANDLE__)->Mask = 0x01FF ; \ |
bogdanm | 85:024bf7f99721 | 427 | } \ |
bogdanm | 85:024bf7f99721 | 428 | else \ |
bogdanm | 85:024bf7f99721 | 429 | { \ |
bogdanm | 85:024bf7f99721 | 430 | (__HANDLE__)->Mask = 0x00FF ; \ |
bogdanm | 85:024bf7f99721 | 431 | } \ |
bogdanm | 85:024bf7f99721 | 432 | } \ |
bogdanm | 85:024bf7f99721 | 433 | else if ((__HANDLE__)->Init.WordLength == UART_WORDLENGTH_8B) \ |
bogdanm | 85:024bf7f99721 | 434 | { \ |
bogdanm | 85:024bf7f99721 | 435 | if ((__HANDLE__)->Init.Parity == UART_PARITY_NONE) \ |
bogdanm | 85:024bf7f99721 | 436 | { \ |
bogdanm | 85:024bf7f99721 | 437 | (__HANDLE__)->Mask = 0x00FF ; \ |
bogdanm | 85:024bf7f99721 | 438 | } \ |
bogdanm | 85:024bf7f99721 | 439 | else \ |
bogdanm | 85:024bf7f99721 | 440 | { \ |
bogdanm | 85:024bf7f99721 | 441 | (__HANDLE__)->Mask = 0x007F ; \ |
bogdanm | 85:024bf7f99721 | 442 | } \ |
bogdanm | 85:024bf7f99721 | 443 | } \ |
bogdanm | 85:024bf7f99721 | 444 | else if ((__HANDLE__)->Init.WordLength == UART_WORDLENGTH_7B) \ |
bogdanm | 85:024bf7f99721 | 445 | { \ |
bogdanm | 85:024bf7f99721 | 446 | if ((__HANDLE__)->Init.Parity == UART_PARITY_NONE) \ |
bogdanm | 85:024bf7f99721 | 447 | { \ |
bogdanm | 85:024bf7f99721 | 448 | (__HANDLE__)->Mask = 0x007F ; \ |
bogdanm | 85:024bf7f99721 | 449 | } \ |
bogdanm | 85:024bf7f99721 | 450 | else \ |
bogdanm | 85:024bf7f99721 | 451 | { \ |
bogdanm | 85:024bf7f99721 | 452 | (__HANDLE__)->Mask = 0x003F ; \ |
bogdanm | 85:024bf7f99721 | 453 | } \ |
bogdanm | 85:024bf7f99721 | 454 | } \ |
bogdanm | 85:024bf7f99721 | 455 | } while(0) |
bogdanm | 85:024bf7f99721 | 456 | #else |
bogdanm | 85:024bf7f99721 | 457 | #define __HAL_UART_MASK_COMPUTATION(__HANDLE__) \ |
bogdanm | 85:024bf7f99721 | 458 | do { \ |
bogdanm | 85:024bf7f99721 | 459 | if ((__HANDLE__)->Init.WordLength == UART_WORDLENGTH_9B) \ |
bogdanm | 85:024bf7f99721 | 460 | { \ |
bogdanm | 85:024bf7f99721 | 461 | if ((__HANDLE__)->Init.Parity == UART_PARITY_NONE) \ |
bogdanm | 85:024bf7f99721 | 462 | { \ |
bogdanm | 85:024bf7f99721 | 463 | (__HANDLE__)->Mask = 0x01FF ; \ |
bogdanm | 85:024bf7f99721 | 464 | } \ |
bogdanm | 85:024bf7f99721 | 465 | else \ |
bogdanm | 85:024bf7f99721 | 466 | { \ |
bogdanm | 85:024bf7f99721 | 467 | (__HANDLE__)->Mask = 0x00FF ; \ |
bogdanm | 85:024bf7f99721 | 468 | } \ |
bogdanm | 85:024bf7f99721 | 469 | } \ |
bogdanm | 85:024bf7f99721 | 470 | else if ((__HANDLE__)->Init.WordLength == UART_WORDLENGTH_8B) \ |
bogdanm | 85:024bf7f99721 | 471 | { \ |
bogdanm | 85:024bf7f99721 | 472 | if ((__HANDLE__)->Init.Parity == UART_PARITY_NONE) \ |
bogdanm | 85:024bf7f99721 | 473 | { \ |
bogdanm | 85:024bf7f99721 | 474 | (__HANDLE__)->Mask = 0x00FF ; \ |
bogdanm | 85:024bf7f99721 | 475 | } \ |
bogdanm | 85:024bf7f99721 | 476 | else \ |
bogdanm | 85:024bf7f99721 | 477 | { \ |
bogdanm | 85:024bf7f99721 | 478 | (__HANDLE__)->Mask = 0x007F ; \ |
bogdanm | 85:024bf7f99721 | 479 | } \ |
bogdanm | 85:024bf7f99721 | 480 | } \ |
bogdanm | 85:024bf7f99721 | 481 | } while(0) |
bogdanm | 85:024bf7f99721 | 482 | #endif /* defined (STM32F042x6) || defined (STM32F048xx) || \ |
bogdanm | 85:024bf7f99721 | 483 | defined (STM32F071xB) || defined (STM32F072xB) || defined (STM32F078xx) */ |
bogdanm | 85:024bf7f99721 | 484 | /** |
bogdanm | 85:024bf7f99721 | 485 | * @} |
bogdanm | 85:024bf7f99721 | 486 | */ |
bogdanm | 85:024bf7f99721 | 487 | |
bogdanm | 85:024bf7f99721 | 488 | /* Exported functions --------------------------------------------------------*/ |
bogdanm | 85:024bf7f99721 | 489 | /* Initialization and de-initialization functions ****************************/ |
bogdanm | 85:024bf7f99721 | 490 | HAL_StatusTypeDef HAL_RS485Ex_Init(UART_HandleTypeDef *huart, uint32_t UART_DEPolarity, uint32_t UART_DEAssertionTime, uint32_t UART_DEDeassertionTime); |
bogdanm | 85:024bf7f99721 | 491 | HAL_StatusTypeDef HAL_LIN_Init(UART_HandleTypeDef *huart, uint16_t BreakDetectLength); |
bogdanm | 85:024bf7f99721 | 492 | HAL_StatusTypeDef HAL_UARTEx_StopModeWakeUpSourceConfig(UART_HandleTypeDef *huart, UART_WakeUpTypeDef WakeUpSelection); |
bogdanm | 85:024bf7f99721 | 493 | HAL_StatusTypeDef HAL_UARTEx_EnableStopMode(UART_HandleTypeDef *huart); |
bogdanm | 85:024bf7f99721 | 494 | HAL_StatusTypeDef HAL_UARTEx_DisableStopMode(UART_HandleTypeDef *huart); |
bogdanm | 85:024bf7f99721 | 495 | /* I/O operation functions ***************************************************/ |
bogdanm | 85:024bf7f99721 | 496 | void HAL_UART_IRQHandler(UART_HandleTypeDef *huart); |
bogdanm | 85:024bf7f99721 | 497 | void HAL_UART_WakeupCallback(UART_HandleTypeDef *huart); |
bogdanm | 85:024bf7f99721 | 498 | /* Peripheral Control functions **********************************************/ |
bogdanm | 85:024bf7f99721 | 499 | void UART_AdvFeatureConfig(UART_HandleTypeDef *huart); |
bogdanm | 85:024bf7f99721 | 500 | HAL_StatusTypeDef HAL_MultiProcessorEx_AddressLength_Set(UART_HandleTypeDef *huart, uint32_t AddressLength); |
bogdanm | 85:024bf7f99721 | 501 | HAL_StatusTypeDef HAL_LIN_SendBreak(UART_HandleTypeDef *huart); |
bogdanm | 85:024bf7f99721 | 502 | /* Peripheral State functions ************************************************/ |
bogdanm | 85:024bf7f99721 | 503 | |
bogdanm | 85:024bf7f99721 | 504 | |
bogdanm | 85:024bf7f99721 | 505 | /** |
bogdanm | 85:024bf7f99721 | 506 | * @} |
bogdanm | 85:024bf7f99721 | 507 | */ |
bogdanm | 85:024bf7f99721 | 508 | |
bogdanm | 85:024bf7f99721 | 509 | /** |
bogdanm | 85:024bf7f99721 | 510 | * @} |
bogdanm | 85:024bf7f99721 | 511 | */ |
bogdanm | 85:024bf7f99721 | 512 | |
bogdanm | 85:024bf7f99721 | 513 | #ifdef __cplusplus |
bogdanm | 85:024bf7f99721 | 514 | } |
bogdanm | 85:024bf7f99721 | 515 | #endif |
bogdanm | 85:024bf7f99721 | 516 | |
bogdanm | 85:024bf7f99721 | 517 | #endif /* __STM32F0xx_HAL_UART_EX_H */ |
bogdanm | 85:024bf7f99721 | 518 | |
bogdanm | 85:024bf7f99721 | 519 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |