mbed library sources modified for open wear
Dependents: openwear-lifelogger-example
Fork of mbed-src by
targets/cmsis/TARGET_STM/TARGET_NUCLEO_F072RB/stm32f0xx_hal_uart_ex.h@310:6188e0254baa, 2014-09-16 (annotated)
- Committer:
- janekm
- Date:
- Tue Sep 16 22:42:01 2014 +0000
- Revision:
- 310:6188e0254baa
- Parent:
- 218:44081b78fdc2
N/A
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbed_official | 205:c41fc65bcfb4 | 1 | /** |
mbed_official | 205:c41fc65bcfb4 | 2 | ****************************************************************************** |
mbed_official | 205:c41fc65bcfb4 | 3 | * @file stm32f0xx_hal_uart_ex.h |
mbed_official | 205:c41fc65bcfb4 | 4 | * @author MCD Application Team |
mbed_official | 205:c41fc65bcfb4 | 5 | * @version V1.0.0 |
mbed_official | 218:44081b78fdc2 | 6 | * @date 28-May-2014 |
mbed_official | 205:c41fc65bcfb4 | 7 | * @brief Header file of UART HAL Extension module. |
mbed_official | 205:c41fc65bcfb4 | 8 | ****************************************************************************** |
mbed_official | 205:c41fc65bcfb4 | 9 | * @attention |
mbed_official | 205:c41fc65bcfb4 | 10 | * |
mbed_official | 205:c41fc65bcfb4 | 11 | * <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2> |
mbed_official | 205:c41fc65bcfb4 | 12 | * |
mbed_official | 205:c41fc65bcfb4 | 13 | * Redistribution and use in source and binary forms, with or without modification, |
mbed_official | 205:c41fc65bcfb4 | 14 | * are permitted provided that the following conditions are met: |
mbed_official | 205:c41fc65bcfb4 | 15 | * 1. Redistributions of source code must retain the above copyright notice, |
mbed_official | 205:c41fc65bcfb4 | 16 | * this list of conditions and the following disclaimer. |
mbed_official | 205:c41fc65bcfb4 | 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
mbed_official | 205:c41fc65bcfb4 | 18 | * this list of conditions and the following disclaimer in the documentation |
mbed_official | 205:c41fc65bcfb4 | 19 | * and/or other materials provided with the distribution. |
mbed_official | 205:c41fc65bcfb4 | 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
mbed_official | 205:c41fc65bcfb4 | 21 | * may be used to endorse or promote products derived from this software |
mbed_official | 205:c41fc65bcfb4 | 22 | * without specific prior written permission. |
mbed_official | 205:c41fc65bcfb4 | 23 | * |
mbed_official | 205:c41fc65bcfb4 | 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
mbed_official | 205:c41fc65bcfb4 | 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
mbed_official | 205:c41fc65bcfb4 | 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
mbed_official | 205:c41fc65bcfb4 | 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
mbed_official | 205:c41fc65bcfb4 | 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
mbed_official | 205:c41fc65bcfb4 | 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
mbed_official | 205:c41fc65bcfb4 | 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
mbed_official | 205:c41fc65bcfb4 | 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
mbed_official | 205:c41fc65bcfb4 | 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
mbed_official | 205:c41fc65bcfb4 | 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
mbed_official | 205:c41fc65bcfb4 | 34 | * |
mbed_official | 205:c41fc65bcfb4 | 35 | ****************************************************************************** |
mbed_official | 205:c41fc65bcfb4 | 36 | */ |
mbed_official | 205:c41fc65bcfb4 | 37 | |
mbed_official | 205:c41fc65bcfb4 | 38 | /* Define to prevent recursive inclusion -------------------------------------*/ |
mbed_official | 205:c41fc65bcfb4 | 39 | #ifndef __STM32F0xx_HAL_UART_EX_H |
mbed_official | 205:c41fc65bcfb4 | 40 | #define __STM32F0xx_HAL_UART_EX_H |
mbed_official | 205:c41fc65bcfb4 | 41 | |
mbed_official | 205:c41fc65bcfb4 | 42 | #ifdef __cplusplus |
mbed_official | 205:c41fc65bcfb4 | 43 | extern "C" { |
mbed_official | 205:c41fc65bcfb4 | 44 | #endif |
mbed_official | 205:c41fc65bcfb4 | 45 | |
mbed_official | 205:c41fc65bcfb4 | 46 | /* Includes ------------------------------------------------------------------*/ |
mbed_official | 205:c41fc65bcfb4 | 47 | #include "stm32f0xx_hal_def.h" |
mbed_official | 205:c41fc65bcfb4 | 48 | |
mbed_official | 205:c41fc65bcfb4 | 49 | /** @addtogroup STM32F0xx_HAL_Driver |
mbed_official | 205:c41fc65bcfb4 | 50 | * @{ |
mbed_official | 205:c41fc65bcfb4 | 51 | */ |
mbed_official | 205:c41fc65bcfb4 | 52 | |
mbed_official | 205:c41fc65bcfb4 | 53 | /** @addtogroup UARTEx |
mbed_official | 205:c41fc65bcfb4 | 54 | * @{ |
mbed_official | 205:c41fc65bcfb4 | 55 | */ |
mbed_official | 205:c41fc65bcfb4 | 56 | |
mbed_official | 205:c41fc65bcfb4 | 57 | /* Exported types ------------------------------------------------------------*/ |
mbed_official | 205:c41fc65bcfb4 | 58 | /* Exported constants --------------------------------------------------------*/ |
mbed_official | 205:c41fc65bcfb4 | 59 | /** @defgroup UARTEx_Exported_Constants |
mbed_official | 205:c41fc65bcfb4 | 60 | * @{ |
mbed_official | 205:c41fc65bcfb4 | 61 | */ |
mbed_official | 205:c41fc65bcfb4 | 62 | |
mbed_official | 205:c41fc65bcfb4 | 63 | /** @defgroup UARTEx_Word_Length UART Word Length |
mbed_official | 205:c41fc65bcfb4 | 64 | * @{ |
mbed_official | 205:c41fc65bcfb4 | 65 | */ |
mbed_official | 205:c41fc65bcfb4 | 66 | #if defined (STM32F042x6) || defined (STM32F048xx) || \ |
mbed_official | 205:c41fc65bcfb4 | 67 | defined (STM32F071xB) || defined (STM32F072xB) || defined (STM32F078xx) |
mbed_official | 205:c41fc65bcfb4 | 68 | #define UART_WORDLENGTH_7B ((uint32_t)USART_CR1_M1) |
mbed_official | 205:c41fc65bcfb4 | 69 | #define UART_WORDLENGTH_8B ((uint32_t)0x00000000) |
mbed_official | 205:c41fc65bcfb4 | 70 | #define UART_WORDLENGTH_9B ((uint32_t)USART_CR1_M0) |
mbed_official | 205:c41fc65bcfb4 | 71 | #define IS_UART_WORD_LENGTH(LENGTH) (((LENGTH) == UART_WORDLENGTH_7B) || \ |
mbed_official | 205:c41fc65bcfb4 | 72 | ((LENGTH) == UART_WORDLENGTH_8B) || \ |
mbed_official | 205:c41fc65bcfb4 | 73 | ((LENGTH) == UART_WORDLENGTH_9B)) |
mbed_official | 205:c41fc65bcfb4 | 74 | #else |
mbed_official | 205:c41fc65bcfb4 | 75 | #define UART_WORDLENGTH_8B ((uint32_t)0x00000000) |
mbed_official | 205:c41fc65bcfb4 | 76 | #define UART_WORDLENGTH_9B ((uint32_t)USART_CR1_M) |
mbed_official | 205:c41fc65bcfb4 | 77 | #define IS_UART_WORD_LENGTH(LENGTH) (((LENGTH) == UART_WORDLENGTH_8B) || \ |
mbed_official | 205:c41fc65bcfb4 | 78 | ((LENGTH) == UART_WORDLENGTH_9B)) |
mbed_official | 205:c41fc65bcfb4 | 79 | #endif /* defined (STM32F042x6) || defined (STM32F048xx) || \ |
mbed_official | 205:c41fc65bcfb4 | 80 | defined (STM32F071xB) || defined (STM32F072xB) || defined (STM32F078xx) */ |
mbed_official | 205:c41fc65bcfb4 | 81 | /** |
mbed_official | 205:c41fc65bcfb4 | 82 | * @} |
mbed_official | 205:c41fc65bcfb4 | 83 | */ |
mbed_official | 205:c41fc65bcfb4 | 84 | |
mbed_official | 205:c41fc65bcfb4 | 85 | /** @defgroup UARTEx_AutoBaud_Rate_Mode UART Advanced Feature AutoBaud Rate Mode |
mbed_official | 205:c41fc65bcfb4 | 86 | * @{ |
mbed_official | 205:c41fc65bcfb4 | 87 | */ |
mbed_official | 205:c41fc65bcfb4 | 88 | #if defined (STM32F042x6) || defined (STM32F048xx) || \ |
mbed_official | 205:c41fc65bcfb4 | 89 | defined (STM32F071xB) || defined (STM32F072xB) || defined (STM32F078xx) |
mbed_official | 205:c41fc65bcfb4 | 90 | #define UART_ADVFEATURE_AUTOBAUDRATE_ONSTARTBIT ((uint32_t)0x0000) |
mbed_official | 205:c41fc65bcfb4 | 91 | #define UART_ADVFEATURE_AUTOBAUDRATE_ONFALLINGEDGE ((uint32_t)USART_CR2_ABRMODE_0) |
mbed_official | 205:c41fc65bcfb4 | 92 | #define UART_ADVFEATURE_AUTOBAUDRATE_ON0X7FFRAME ((uint32_t)USART_CR2_ABRMODE_1) |
mbed_official | 205:c41fc65bcfb4 | 93 | #define UART_ADVFEATURE_AUTOBAUDRATE_ON0X55FRAME ((uint32_t)USART_CR2_ABRMODE) |
mbed_official | 205:c41fc65bcfb4 | 94 | #define IS_UART_ADVFEATURE_AUTOBAUDRATEMODE(MODE) (((MODE) == UART_ADVFEATURE_AUTOBAUDRATE_ONSTARTBIT) || \ |
mbed_official | 205:c41fc65bcfb4 | 95 | ((MODE) == UART_ADVFEATURE_AUTOBAUDRATE_ONFALLINGEDGE) || \ |
mbed_official | 205:c41fc65bcfb4 | 96 | ((MODE) == UART_ADVFEATURE_AUTOBAUDRATE_ON0X7FFRAME) || \ |
mbed_official | 205:c41fc65bcfb4 | 97 | ((MODE) == UART_ADVFEATURE_AUTOBAUDRATE_ON0X55FRAME)) |
mbed_official | 205:c41fc65bcfb4 | 98 | #else |
mbed_official | 205:c41fc65bcfb4 | 99 | #define UART_ADVFEATURE_AUTOBAUDRATE_ONSTARTBIT ((uint32_t)0x0000) |
mbed_official | 205:c41fc65bcfb4 | 100 | #define UART_ADVFEATURE_AUTOBAUDRATE_ONFALLINGEDGE ((uint32_t)USART_CR2_ABRMODE_0) |
mbed_official | 205:c41fc65bcfb4 | 101 | #define IS_UART_ADVFEATURE_AUTOBAUDRATEMODE(MODE) (((MODE) == UART_ADVFEATURE_AUTOBAUDRATE_ONSTARTBIT) || \ |
mbed_official | 205:c41fc65bcfb4 | 102 | ((MODE) == UART_ADVFEATURE_AUTOBAUDRATE_ONFALLINGEDGE)) |
mbed_official | 205:c41fc65bcfb4 | 103 | #endif /* defined (STM32F042x6) || defined (STM32F048xx) || \ |
mbed_official | 205:c41fc65bcfb4 | 104 | defined (STM32F071xB) || defined (STM32F072xB) || defined (STM32F078xx) */ |
mbed_official | 205:c41fc65bcfb4 | 105 | /** |
mbed_official | 205:c41fc65bcfb4 | 106 | * @} |
mbed_official | 205:c41fc65bcfb4 | 107 | */ |
mbed_official | 205:c41fc65bcfb4 | 108 | |
mbed_official | 205:c41fc65bcfb4 | 109 | |
mbed_official | 205:c41fc65bcfb4 | 110 | #if !defined(STM32F030x6) && !defined(STM32F030x8) |
mbed_official | 205:c41fc65bcfb4 | 111 | /** @defgroup UARTEx_LIN UART Local Interconnection Network mode |
mbed_official | 205:c41fc65bcfb4 | 112 | * @{ |
mbed_official | 205:c41fc65bcfb4 | 113 | */ |
mbed_official | 205:c41fc65bcfb4 | 114 | #define UART_LIN_DISABLE ((uint32_t)0x00000000) |
mbed_official | 205:c41fc65bcfb4 | 115 | #define UART_LIN_ENABLE ((uint32_t)USART_CR2_LINEN) |
mbed_official | 205:c41fc65bcfb4 | 116 | #define IS_UART_LIN(LIN) (((LIN) == UART_LIN_DISABLE) || \ |
mbed_official | 205:c41fc65bcfb4 | 117 | ((LIN) == UART_LIN_ENABLE)) |
mbed_official | 205:c41fc65bcfb4 | 118 | /** |
mbed_official | 205:c41fc65bcfb4 | 119 | * @} |
mbed_official | 205:c41fc65bcfb4 | 120 | */ |
mbed_official | 205:c41fc65bcfb4 | 121 | |
mbed_official | 205:c41fc65bcfb4 | 122 | /** @defgroup UARTEx_LIN_Break_Detection UART LIN Break Detection |
mbed_official | 205:c41fc65bcfb4 | 123 | * @{ |
mbed_official | 205:c41fc65bcfb4 | 124 | */ |
mbed_official | 205:c41fc65bcfb4 | 125 | #define UART_LINBREAKDETECTLENGTH_10B ((uint32_t)0x00000000) |
mbed_official | 205:c41fc65bcfb4 | 126 | #define UART_LINBREAKDETECTLENGTH_11B ((uint32_t)USART_CR2_LBDL) |
mbed_official | 205:c41fc65bcfb4 | 127 | #define IS_UART_LIN_BREAK_DETECT_LENGTH(LENGTH) (((LENGTH) == UART_LINBREAKDETECTLENGTH_10B) || \ |
mbed_official | 205:c41fc65bcfb4 | 128 | ((LENGTH) == UART_LINBREAKDETECTLENGTH_11B)) |
mbed_official | 205:c41fc65bcfb4 | 129 | /** |
mbed_official | 205:c41fc65bcfb4 | 130 | * @} |
mbed_official | 205:c41fc65bcfb4 | 131 | */ |
mbed_official | 205:c41fc65bcfb4 | 132 | #endif /* !defined(STM32F030x6) && !defined(STM32F030x8) */ |
mbed_official | 205:c41fc65bcfb4 | 133 | |
mbed_official | 205:c41fc65bcfb4 | 134 | |
mbed_official | 205:c41fc65bcfb4 | 135 | |
mbed_official | 205:c41fc65bcfb4 | 136 | /** @defgroup UART_Flags UART Status Flags |
mbed_official | 205:c41fc65bcfb4 | 137 | * Elements values convention: 0xXXXX |
mbed_official | 205:c41fc65bcfb4 | 138 | * - 0xXXXX : Flag mask in the ISR register |
mbed_official | 205:c41fc65bcfb4 | 139 | * @{ |
mbed_official | 205:c41fc65bcfb4 | 140 | */ |
mbed_official | 205:c41fc65bcfb4 | 141 | #define UART_FLAG_REACK ((uint32_t)0x00400000) |
mbed_official | 205:c41fc65bcfb4 | 142 | #define UART_FLAG_TEACK ((uint32_t)0x00200000) |
mbed_official | 205:c41fc65bcfb4 | 143 | #if !defined(STM32F030x6) && !defined(STM32F030x8) |
mbed_official | 205:c41fc65bcfb4 | 144 | #define UART_FLAG_WUF ((uint32_t)0x00100000) |
mbed_official | 205:c41fc65bcfb4 | 145 | #endif /* !defined(STM32F030x6) && !defined(STM32F030x8) */ |
mbed_official | 205:c41fc65bcfb4 | 146 | #define UART_FLAG_RWU ((uint32_t)0x00080000) |
mbed_official | 205:c41fc65bcfb4 | 147 | #define UART_FLAG_SBKF ((uint32_t)0x00040000 |
mbed_official | 205:c41fc65bcfb4 | 148 | #define UART_FLAG_CMF ((uint32_t)0x00020000) |
mbed_official | 205:c41fc65bcfb4 | 149 | #define UART_FLAG_BUSY ((uint32_t)0x00010000) |
mbed_official | 205:c41fc65bcfb4 | 150 | #define UART_FLAG_ABRF ((uint32_t)0x00008000) |
mbed_official | 205:c41fc65bcfb4 | 151 | #define UART_FLAG_ABRE ((uint32_t)0x00004000) |
mbed_official | 205:c41fc65bcfb4 | 152 | #if !defined(STM32F030x6) && !defined(STM32F030x8) |
mbed_official | 205:c41fc65bcfb4 | 153 | #define UART_FLAG_EOBF ((uint32_t)0x00001000) |
mbed_official | 205:c41fc65bcfb4 | 154 | #endif /* !defined(STM32F030x6) && !defined(STM32F030x8) */ |
mbed_official | 205:c41fc65bcfb4 | 155 | #define UART_FLAG_RTOF ((uint32_t)0x00000800) |
mbed_official | 205:c41fc65bcfb4 | 156 | #define UART_FLAG_CTS ((uint32_t)0x00000400) |
mbed_official | 205:c41fc65bcfb4 | 157 | #define UART_FLAG_CTSIF ((uint32_t)0x00000200) |
mbed_official | 205:c41fc65bcfb4 | 158 | #if !defined(STM32F030x6) && !defined(STM32F030x8) |
mbed_official | 205:c41fc65bcfb4 | 159 | #define UART_FLAG_LBDF ((uint32_t)0x00000100) |
mbed_official | 205:c41fc65bcfb4 | 160 | #endif /* !defined(STM32F030x6) && !defined(STM32F030x8) */ |
mbed_official | 205:c41fc65bcfb4 | 161 | #define UART_FLAG_TXE ((uint32_t)0x00000080) |
mbed_official | 205:c41fc65bcfb4 | 162 | #define UART_FLAG_TC ((uint32_t)0x00000040) |
mbed_official | 205:c41fc65bcfb4 | 163 | #define UART_FLAG_RXNE ((uint32_t)0x00000020) |
mbed_official | 205:c41fc65bcfb4 | 164 | #define UART_FLAG_IDLE ((uint32_t)0x00000010) |
mbed_official | 205:c41fc65bcfb4 | 165 | #define UART_FLAG_ORE ((uint32_t)0x00000008) |
mbed_official | 205:c41fc65bcfb4 | 166 | #define UART_FLAG_NE ((uint32_t)0x00000004) |
mbed_official | 205:c41fc65bcfb4 | 167 | #define UART_FLAG_FE ((uint32_t)0x00000002) |
mbed_official | 205:c41fc65bcfb4 | 168 | #define UART_FLAG_PE ((uint32_t)0x00000001) |
mbed_official | 205:c41fc65bcfb4 | 169 | /** |
mbed_official | 205:c41fc65bcfb4 | 170 | * @} |
mbed_official | 205:c41fc65bcfb4 | 171 | */ |
mbed_official | 205:c41fc65bcfb4 | 172 | |
mbed_official | 205:c41fc65bcfb4 | 173 | /** @defgroup UART_Interrupt_definition UART Interrupts Definition |
mbed_official | 205:c41fc65bcfb4 | 174 | * Elements values convention: 0000ZZZZ0XXYYYYYb |
mbed_official | 205:c41fc65bcfb4 | 175 | * - YYYYY : Interrupt source position in the XX register (5bits) |
mbed_official | 205:c41fc65bcfb4 | 176 | * - XX : Interrupt source register (2bits) |
mbed_official | 205:c41fc65bcfb4 | 177 | * - 01: CR1 register |
mbed_official | 205:c41fc65bcfb4 | 178 | * - 10: CR2 register |
mbed_official | 205:c41fc65bcfb4 | 179 | * - 11: CR3 register |
mbed_official | 205:c41fc65bcfb4 | 180 | * - ZZZZ : Flag position in the ISR register(4bits) |
mbed_official | 205:c41fc65bcfb4 | 181 | * @{ |
mbed_official | 205:c41fc65bcfb4 | 182 | */ |
mbed_official | 205:c41fc65bcfb4 | 183 | #define UART_IT_PE ((uint16_t)0x0028) |
mbed_official | 205:c41fc65bcfb4 | 184 | #define UART_IT_TXE ((uint16_t)0x0727) |
mbed_official | 205:c41fc65bcfb4 | 185 | #define UART_IT_TC ((uint16_t)0x0626) |
mbed_official | 205:c41fc65bcfb4 | 186 | #define UART_IT_RXNE ((uint16_t)0x0525) |
mbed_official | 205:c41fc65bcfb4 | 187 | #define UART_IT_IDLE ((uint16_t)0x0424) |
mbed_official | 205:c41fc65bcfb4 | 188 | #if !defined(STM32F030x6) && !defined(STM32F030x8) |
mbed_official | 205:c41fc65bcfb4 | 189 | #define UART_IT_LBD ((uint16_t)0x0846) |
mbed_official | 205:c41fc65bcfb4 | 190 | #endif /* !defined(STM32F030x6) && !defined(STM32F030x8) */ |
mbed_official | 205:c41fc65bcfb4 | 191 | #define UART_IT_CTS ((uint16_t)0x096A) |
mbed_official | 205:c41fc65bcfb4 | 192 | #define UART_IT_CM ((uint16_t)0x142E) |
mbed_official | 205:c41fc65bcfb4 | 193 | #if !defined(STM32F030x6) && !defined(STM32F030x8) |
mbed_official | 205:c41fc65bcfb4 | 194 | #define UART_IT_WUF ((uint16_t)0x1476) |
mbed_official | 205:c41fc65bcfb4 | 195 | #endif /* !defined(STM32F030x6) && !defined(STM32F030x8) */ |
mbed_official | 205:c41fc65bcfb4 | 196 | /** |
mbed_official | 205:c41fc65bcfb4 | 197 | * @} |
mbed_official | 205:c41fc65bcfb4 | 198 | */ |
mbed_official | 205:c41fc65bcfb4 | 199 | |
mbed_official | 205:c41fc65bcfb4 | 200 | |
mbed_official | 205:c41fc65bcfb4 | 201 | /** @defgroup UART_IT_CLEAR_Flags UART Interruption Clear Flags |
mbed_official | 205:c41fc65bcfb4 | 202 | * @{ |
mbed_official | 205:c41fc65bcfb4 | 203 | */ |
mbed_official | 205:c41fc65bcfb4 | 204 | #define UART_CLEAR_PEF USART_ICR_PECF /*!< Parity Error Clear Flag */ |
mbed_official | 205:c41fc65bcfb4 | 205 | #define UART_CLEAR_FEF USART_ICR_FECF /*!< Framing Error Clear Flag */ |
mbed_official | 205:c41fc65bcfb4 | 206 | #define UART_CLEAR_NEF USART_ICR_NCF /*!< Noise detected Clear Flag */ |
mbed_official | 205:c41fc65bcfb4 | 207 | #define UART_CLEAR_OREF USART_ICR_ORECF /*!< OverRun Error Clear Flag */ |
mbed_official | 205:c41fc65bcfb4 | 208 | #define UART_CLEAR_IDLEF USART_ICR_IDLECF /*!< IDLE line detected Clear Flag */ |
mbed_official | 205:c41fc65bcfb4 | 209 | #define UART_CLEAR_TCF USART_ICR_TCCF /*!< Transmission Complete Clear Flag */ |
mbed_official | 205:c41fc65bcfb4 | 210 | #if !defined(STM32F030x6) && !defined(STM32F030x8) |
mbed_official | 205:c41fc65bcfb4 | 211 | #define UART_CLEAR_LBDF USART_ICR_LBDCF /*!< LIN Break Detection Clear Flag (not available on F030xx devices)*/ |
mbed_official | 205:c41fc65bcfb4 | 212 | #endif /* !defined(STM32F030x6) && !defined(STM32F030x8) */ |
mbed_official | 205:c41fc65bcfb4 | 213 | #define UART_CLEAR_CTSF USART_ICR_CTSCF /*!< CTS Interrupt Clear Flag */ |
mbed_official | 205:c41fc65bcfb4 | 214 | #define UART_CLEAR_RTOF USART_ICR_RTOCF /*!< Receiver Time Out Clear Flag */ |
mbed_official | 205:c41fc65bcfb4 | 215 | #define UART_CLEAR_EOBF USART_ICR_EOBCF /*!< End Of Block Clear Flag */ |
mbed_official | 205:c41fc65bcfb4 | 216 | #define UART_CLEAR_CMF USART_ICR_CMCF /*!< Character Match Clear Flag */ |
mbed_official | 205:c41fc65bcfb4 | 217 | #if !defined(STM32F030x6) && !defined(STM32F030x8) |
mbed_official | 205:c41fc65bcfb4 | 218 | #define UART_CLEAR_WUF USART_ICR_WUCF /*!< Wake Up from stop mode Clear Flag */ |
mbed_official | 205:c41fc65bcfb4 | 219 | #endif /* !defined(STM32F030x6) && !defined(STM32F030x8) */ |
mbed_official | 205:c41fc65bcfb4 | 220 | /** |
mbed_official | 205:c41fc65bcfb4 | 221 | * @} |
mbed_official | 205:c41fc65bcfb4 | 222 | */ |
mbed_official | 205:c41fc65bcfb4 | 223 | |
mbed_official | 205:c41fc65bcfb4 | 224 | /** @defgroup UART_Request_Parameters UART Request Parameters |
mbed_official | 205:c41fc65bcfb4 | 225 | * @{ |
mbed_official | 205:c41fc65bcfb4 | 226 | */ |
mbed_official | 205:c41fc65bcfb4 | 227 | #define UART_AUTOBAUD_REQUEST ((uint32_t)USART_RQR_ABRRQ) /*!< Auto-Baud Rate Request */ |
mbed_official | 205:c41fc65bcfb4 | 228 | #define UART_SENDBREAK_REQUEST ((uint32_t)USART_RQR_SBKRQ) /*!< Send Break Request */ |
mbed_official | 205:c41fc65bcfb4 | 229 | #define UART_MUTE_MODE_REQUEST ((uint32_t)USART_RQR_MMRQ) /*!< Mute Mode Request */ |
mbed_official | 205:c41fc65bcfb4 | 230 | #define UART_RXDATA_FLUSH_REQUEST ((uint32_t)USART_RQR_RXFRQ) /*!< Receive Data flush Request */ |
mbed_official | 205:c41fc65bcfb4 | 231 | #if !defined(STM32F030x6) && !defined(STM32F030x8) |
mbed_official | 205:c41fc65bcfb4 | 232 | #define UART_TXDATA_FLUSH_REQUEST ((uint32_t)USART_RQR_TXFRQ) /*!< Transmit data flush Request */ |
mbed_official | 205:c41fc65bcfb4 | 233 | #define IS_UART_REQUEST_PARAMETER(PARAM) (((PARAM) == UART_AUTOBAUD_REQUEST) || \ |
mbed_official | 205:c41fc65bcfb4 | 234 | ((PARAM) == UART_SENDBREAK_REQUEST) || \ |
mbed_official | 205:c41fc65bcfb4 | 235 | ((PARAM) == UART_MUTE_MODE_REQUEST) || \ |
mbed_official | 205:c41fc65bcfb4 | 236 | ((PARAM) == UART_RXDATA_FLUSH_REQUEST) || \ |
mbed_official | 205:c41fc65bcfb4 | 237 | ((PARAM) == UART_TXDATA_FLUSH_REQUEST)) |
mbed_official | 205:c41fc65bcfb4 | 238 | #else |
mbed_official | 205:c41fc65bcfb4 | 239 | #define IS_UART_REQUEST_PARAMETER(PARAM) (((PARAM) == UART_AUTOBAUD_REQUEST) || \ |
mbed_official | 205:c41fc65bcfb4 | 240 | ((PARAM) == UART_SENDBREAK_REQUEST) || \ |
mbed_official | 205:c41fc65bcfb4 | 241 | ((PARAM) == UART_MUTE_MODE_REQUEST) || \ |
mbed_official | 205:c41fc65bcfb4 | 242 | ((PARAM) == UART_RXDATA_FLUSH_REQUEST)) |
mbed_official | 205:c41fc65bcfb4 | 243 | #endif /* !defined(STM32F030x6) && !defined(STM32F030x8) */ |
mbed_official | 205:c41fc65bcfb4 | 244 | /** |
mbed_official | 205:c41fc65bcfb4 | 245 | * @} |
mbed_official | 205:c41fc65bcfb4 | 246 | */ |
mbed_official | 205:c41fc65bcfb4 | 247 | |
mbed_official | 205:c41fc65bcfb4 | 248 | #if !defined(STM32F030x6) && !defined(STM32F030x8) |
mbed_official | 205:c41fc65bcfb4 | 249 | /** @defgroup UART_Stop_Mode_Enable UART Advanced Feature Stop Mode Enable |
mbed_official | 205:c41fc65bcfb4 | 250 | * @{ |
mbed_official | 205:c41fc65bcfb4 | 251 | */ |
mbed_official | 205:c41fc65bcfb4 | 252 | #define UART_ADVFEATURE_STOPMODE_DISABLE ((uint32_t)0x00000000) |
mbed_official | 205:c41fc65bcfb4 | 253 | #define UART_ADVFEATURE_STOPMODE_ENABLE ((uint32_t)USART_CR1_UESM) |
mbed_official | 205:c41fc65bcfb4 | 254 | #define IS_UART_ADVFEATURE_STOPMODE(STOPMODE) (((STOPMODE) == UART_ADVFEATURE_STOPMODE_DISABLE) || \ |
mbed_official | 205:c41fc65bcfb4 | 255 | ((STOPMODE) == UART_ADVFEATURE_STOPMODE_ENABLE)) |
mbed_official | 205:c41fc65bcfb4 | 256 | /** |
mbed_official | 205:c41fc65bcfb4 | 257 | * @} |
mbed_official | 205:c41fc65bcfb4 | 258 | */ |
mbed_official | 205:c41fc65bcfb4 | 259 | |
mbed_official | 205:c41fc65bcfb4 | 260 | /** @defgroup UART_WakeUp_from_Stop_Selection UART WakeUp From Stop Selection |
mbed_official | 205:c41fc65bcfb4 | 261 | * @{ |
mbed_official | 205:c41fc65bcfb4 | 262 | */ |
mbed_official | 205:c41fc65bcfb4 | 263 | #define UART_WAKEUP_ON_ADDRESS ((uint32_t)0x0000) |
mbed_official | 205:c41fc65bcfb4 | 264 | #define UART_WAKEUP_ON_STARTBIT ((uint32_t)USART_CR3_WUS_1) |
mbed_official | 205:c41fc65bcfb4 | 265 | #define UART_WAKEUP_ON_READDATA_NONEMPTY ((uint32_t)USART_CR3_WUS) |
mbed_official | 205:c41fc65bcfb4 | 266 | #define IS_UART_WAKEUP_SELECTION(WAKE) (((WAKE) == UART_WAKEUP_ON_ADDRESS) || \ |
mbed_official | 205:c41fc65bcfb4 | 267 | ((WAKE) == UART_WAKEUP_ON_STARTBIT) || \ |
mbed_official | 205:c41fc65bcfb4 | 268 | ((WAKE) == UART_WAKEUP_ON_READDATA_NONEMPTY)) |
mbed_official | 205:c41fc65bcfb4 | 269 | /** |
mbed_official | 205:c41fc65bcfb4 | 270 | * @} |
mbed_official | 205:c41fc65bcfb4 | 271 | */ |
mbed_official | 205:c41fc65bcfb4 | 272 | #endif /* !defined(STM32F030x6) && !defined(STM32F030x8) */ |
mbed_official | 205:c41fc65bcfb4 | 273 | |
mbed_official | 205:c41fc65bcfb4 | 274 | /** |
mbed_official | 205:c41fc65bcfb4 | 275 | * @} |
mbed_official | 205:c41fc65bcfb4 | 276 | */ |
mbed_official | 205:c41fc65bcfb4 | 277 | |
mbed_official | 205:c41fc65bcfb4 | 278 | /* Exported macro ------------------------------------------------------------*/ |
mbed_official | 205:c41fc65bcfb4 | 279 | |
mbed_official | 205:c41fc65bcfb4 | 280 | /** @defgroup UARTEx_Exported_Macros |
mbed_official | 205:c41fc65bcfb4 | 281 | * @{ |
mbed_official | 205:c41fc65bcfb4 | 282 | */ |
mbed_official | 205:c41fc65bcfb4 | 283 | |
mbed_official | 205:c41fc65bcfb4 | 284 | /** @brief Reports the UART clock source. |
mbed_official | 205:c41fc65bcfb4 | 285 | * @param __HANDLE__: specifies the UART Handle |
mbed_official | 205:c41fc65bcfb4 | 286 | * @param __CLOCKSOURCE__ : output variable |
mbed_official | 205:c41fc65bcfb4 | 287 | * @retval UART clocking source, written in __CLOCKSOURCE__. |
mbed_official | 205:c41fc65bcfb4 | 288 | */ |
mbed_official | 205:c41fc65bcfb4 | 289 | |
mbed_official | 205:c41fc65bcfb4 | 290 | |
mbed_official | 205:c41fc65bcfb4 | 291 | #if defined(STM32F030x6) || defined(STM32F031x6) || defined(STM32F038xx) |
mbed_official | 205:c41fc65bcfb4 | 292 | #define __HAL_UART_GETCLOCKSOURCE(__HANDLE__,__CLOCKSOURCE__) \ |
mbed_official | 205:c41fc65bcfb4 | 293 | do { \ |
mbed_official | 205:c41fc65bcfb4 | 294 | switch(__HAL_RCC_GET_USART1_SOURCE()) \ |
mbed_official | 205:c41fc65bcfb4 | 295 | { \ |
mbed_official | 205:c41fc65bcfb4 | 296 | case RCC_USART1CLKSOURCE_PCLK1: \ |
mbed_official | 205:c41fc65bcfb4 | 297 | (__CLOCKSOURCE__) = UART_CLOCKSOURCE_PCLK1; \ |
mbed_official | 205:c41fc65bcfb4 | 298 | break; \ |
mbed_official | 205:c41fc65bcfb4 | 299 | case RCC_USART1CLKSOURCE_HSI: \ |
mbed_official | 205:c41fc65bcfb4 | 300 | (__CLOCKSOURCE__) = UART_CLOCKSOURCE_HSI; \ |
mbed_official | 205:c41fc65bcfb4 | 301 | break; \ |
mbed_official | 205:c41fc65bcfb4 | 302 | case RCC_USART1CLKSOURCE_SYSCLK: \ |
mbed_official | 205:c41fc65bcfb4 | 303 | (__CLOCKSOURCE__) = UART_CLOCKSOURCE_SYSCLK; \ |
mbed_official | 205:c41fc65bcfb4 | 304 | break; \ |
mbed_official | 205:c41fc65bcfb4 | 305 | case RCC_USART1CLKSOURCE_LSE: \ |
mbed_official | 205:c41fc65bcfb4 | 306 | (__CLOCKSOURCE__) = UART_CLOCKSOURCE_LSE; \ |
mbed_official | 205:c41fc65bcfb4 | 307 | break; \ |
mbed_official | 205:c41fc65bcfb4 | 308 | default: \ |
mbed_official | 205:c41fc65bcfb4 | 309 | (__CLOCKSOURCE__) = UART_CLOCKSOURCE_UNDEFINED; \ |
mbed_official | 205:c41fc65bcfb4 | 310 | break; \ |
mbed_official | 205:c41fc65bcfb4 | 311 | } \ |
mbed_official | 205:c41fc65bcfb4 | 312 | } while(0) |
mbed_official | 205:c41fc65bcfb4 | 313 | #elif defined (STM32F030x8) || \ |
mbed_official | 205:c41fc65bcfb4 | 314 | defined (STM32F042x6) || defined (STM32F048xx) || \ |
mbed_official | 205:c41fc65bcfb4 | 315 | defined (STM32F051x8) || defined (STM32F058xx) |
mbed_official | 205:c41fc65bcfb4 | 316 | #define __HAL_UART_GETCLOCKSOURCE(__HANDLE__,__CLOCKSOURCE__) \ |
mbed_official | 205:c41fc65bcfb4 | 317 | do { \ |
mbed_official | 205:c41fc65bcfb4 | 318 | if((__HANDLE__)->Instance == USART1) \ |
mbed_official | 205:c41fc65bcfb4 | 319 | { \ |
mbed_official | 205:c41fc65bcfb4 | 320 | switch(__HAL_RCC_GET_USART1_SOURCE()) \ |
mbed_official | 205:c41fc65bcfb4 | 321 | { \ |
mbed_official | 205:c41fc65bcfb4 | 322 | case RCC_USART1CLKSOURCE_PCLK1: \ |
mbed_official | 205:c41fc65bcfb4 | 323 | (__CLOCKSOURCE__) = UART_CLOCKSOURCE_PCLK1; \ |
mbed_official | 205:c41fc65bcfb4 | 324 | break; \ |
mbed_official | 205:c41fc65bcfb4 | 325 | case RCC_USART1CLKSOURCE_HSI: \ |
mbed_official | 205:c41fc65bcfb4 | 326 | (__CLOCKSOURCE__) = UART_CLOCKSOURCE_HSI; \ |
mbed_official | 205:c41fc65bcfb4 | 327 | break; \ |
mbed_official | 205:c41fc65bcfb4 | 328 | case RCC_USART1CLKSOURCE_SYSCLK: \ |
mbed_official | 205:c41fc65bcfb4 | 329 | (__CLOCKSOURCE__) = UART_CLOCKSOURCE_SYSCLK; \ |
mbed_official | 205:c41fc65bcfb4 | 330 | break; \ |
mbed_official | 205:c41fc65bcfb4 | 331 | case RCC_USART1CLKSOURCE_LSE: \ |
mbed_official | 205:c41fc65bcfb4 | 332 | (__CLOCKSOURCE__) = UART_CLOCKSOURCE_LSE; \ |
mbed_official | 205:c41fc65bcfb4 | 333 | break; \ |
mbed_official | 205:c41fc65bcfb4 | 334 | default: \ |
mbed_official | 205:c41fc65bcfb4 | 335 | (__CLOCKSOURCE__) = UART_CLOCKSOURCE_UNDEFINED; \ |
mbed_official | 205:c41fc65bcfb4 | 336 | break; \ |
mbed_official | 205:c41fc65bcfb4 | 337 | } \ |
mbed_official | 205:c41fc65bcfb4 | 338 | } \ |
mbed_official | 205:c41fc65bcfb4 | 339 | else if((__HANDLE__)->Instance == USART2) \ |
mbed_official | 205:c41fc65bcfb4 | 340 | { \ |
mbed_official | 205:c41fc65bcfb4 | 341 | (__CLOCKSOURCE__) = UART_CLOCKSOURCE_PCLK1; \ |
mbed_official | 205:c41fc65bcfb4 | 342 | } \ |
mbed_official | 205:c41fc65bcfb4 | 343 | else \ |
mbed_official | 205:c41fc65bcfb4 | 344 | { \ |
mbed_official | 205:c41fc65bcfb4 | 345 | (__CLOCKSOURCE__) = UART_CLOCKSOURCE_UNDEFINED; \ |
mbed_official | 205:c41fc65bcfb4 | 346 | } \ |
mbed_official | 205:c41fc65bcfb4 | 347 | } while(0) |
mbed_official | 205:c41fc65bcfb4 | 348 | #elif defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) |
mbed_official | 205:c41fc65bcfb4 | 349 | #define __HAL_UART_GETCLOCKSOURCE(__HANDLE__,__CLOCKSOURCE__) \ |
mbed_official | 205:c41fc65bcfb4 | 350 | do { \ |
mbed_official | 205:c41fc65bcfb4 | 351 | if((__HANDLE__)->Instance == USART1) \ |
mbed_official | 205:c41fc65bcfb4 | 352 | { \ |
mbed_official | 205:c41fc65bcfb4 | 353 | switch(__HAL_RCC_GET_USART1_SOURCE()) \ |
mbed_official | 205:c41fc65bcfb4 | 354 | { \ |
mbed_official | 205:c41fc65bcfb4 | 355 | case RCC_USART1CLKSOURCE_PCLK1: \ |
mbed_official | 205:c41fc65bcfb4 | 356 | (__CLOCKSOURCE__) = UART_CLOCKSOURCE_PCLK1; \ |
mbed_official | 205:c41fc65bcfb4 | 357 | break; \ |
mbed_official | 205:c41fc65bcfb4 | 358 | case RCC_USART1CLKSOURCE_HSI: \ |
mbed_official | 205:c41fc65bcfb4 | 359 | (__CLOCKSOURCE__) = UART_CLOCKSOURCE_HSI; \ |
mbed_official | 205:c41fc65bcfb4 | 360 | break; \ |
mbed_official | 205:c41fc65bcfb4 | 361 | case RCC_USART1CLKSOURCE_SYSCLK: \ |
mbed_official | 205:c41fc65bcfb4 | 362 | (__CLOCKSOURCE__) = UART_CLOCKSOURCE_SYSCLK; \ |
mbed_official | 205:c41fc65bcfb4 | 363 | break; \ |
mbed_official | 205:c41fc65bcfb4 | 364 | case RCC_USART1CLKSOURCE_LSE: \ |
mbed_official | 205:c41fc65bcfb4 | 365 | (__CLOCKSOURCE__) = UART_CLOCKSOURCE_LSE; \ |
mbed_official | 205:c41fc65bcfb4 | 366 | break; \ |
mbed_official | 205:c41fc65bcfb4 | 367 | default: \ |
mbed_official | 205:c41fc65bcfb4 | 368 | (__CLOCKSOURCE__) = UART_CLOCKSOURCE_UNDEFINED; \ |
mbed_official | 205:c41fc65bcfb4 | 369 | break; \ |
mbed_official | 205:c41fc65bcfb4 | 370 | } \ |
mbed_official | 205:c41fc65bcfb4 | 371 | } \ |
mbed_official | 205:c41fc65bcfb4 | 372 | else if((__HANDLE__)->Instance == USART2) \ |
mbed_official | 205:c41fc65bcfb4 | 373 | { \ |
mbed_official | 205:c41fc65bcfb4 | 374 | switch(__HAL_RCC_GET_USART2_SOURCE()) \ |
mbed_official | 205:c41fc65bcfb4 | 375 | { \ |
mbed_official | 205:c41fc65bcfb4 | 376 | case RCC_USART2CLKSOURCE_PCLK1: \ |
mbed_official | 205:c41fc65bcfb4 | 377 | (__CLOCKSOURCE__) = UART_CLOCKSOURCE_PCLK1; \ |
mbed_official | 205:c41fc65bcfb4 | 378 | break; \ |
mbed_official | 205:c41fc65bcfb4 | 379 | case RCC_USART2CLKSOURCE_HSI: \ |
mbed_official | 205:c41fc65bcfb4 | 380 | (__CLOCKSOURCE__) = UART_CLOCKSOURCE_HSI; \ |
mbed_official | 205:c41fc65bcfb4 | 381 | break; \ |
mbed_official | 205:c41fc65bcfb4 | 382 | case RCC_USART2CLKSOURCE_SYSCLK: \ |
mbed_official | 205:c41fc65bcfb4 | 383 | (__CLOCKSOURCE__) = UART_CLOCKSOURCE_SYSCLK; \ |
mbed_official | 205:c41fc65bcfb4 | 384 | break; \ |
mbed_official | 205:c41fc65bcfb4 | 385 | case RCC_USART2CLKSOURCE_LSE: \ |
mbed_official | 205:c41fc65bcfb4 | 386 | (__CLOCKSOURCE__) = UART_CLOCKSOURCE_LSE; \ |
mbed_official | 205:c41fc65bcfb4 | 387 | break; \ |
mbed_official | 205:c41fc65bcfb4 | 388 | default: \ |
mbed_official | 205:c41fc65bcfb4 | 389 | (__CLOCKSOURCE__) = UART_CLOCKSOURCE_UNDEFINED; \ |
mbed_official | 205:c41fc65bcfb4 | 390 | break; \ |
mbed_official | 205:c41fc65bcfb4 | 391 | } \ |
mbed_official | 205:c41fc65bcfb4 | 392 | } \ |
mbed_official | 205:c41fc65bcfb4 | 393 | else if((__HANDLE__)->Instance == USART3) \ |
mbed_official | 205:c41fc65bcfb4 | 394 | { \ |
mbed_official | 205:c41fc65bcfb4 | 395 | (__CLOCKSOURCE__) = UART_CLOCKSOURCE_PCLK1; \ |
mbed_official | 205:c41fc65bcfb4 | 396 | } \ |
mbed_official | 205:c41fc65bcfb4 | 397 | else if((__HANDLE__)->Instance == USART4) \ |
mbed_official | 205:c41fc65bcfb4 | 398 | { \ |
mbed_official | 205:c41fc65bcfb4 | 399 | (__CLOCKSOURCE__) = UART_CLOCKSOURCE_PCLK1; \ |
mbed_official | 205:c41fc65bcfb4 | 400 | } \ |
mbed_official | 205:c41fc65bcfb4 | 401 | else \ |
mbed_official | 205:c41fc65bcfb4 | 402 | { \ |
mbed_official | 205:c41fc65bcfb4 | 403 | (__CLOCKSOURCE__) = UART_CLOCKSOURCE_UNDEFINED; \ |
mbed_official | 205:c41fc65bcfb4 | 404 | } \ |
mbed_official | 205:c41fc65bcfb4 | 405 | } while(0) |
mbed_official | 205:c41fc65bcfb4 | 406 | #endif /* defined(STM32F030x6) || defined(STM32F031x6) || defined(STM32F038xx) */ |
mbed_official | 205:c41fc65bcfb4 | 407 | |
mbed_official | 205:c41fc65bcfb4 | 408 | |
mbed_official | 205:c41fc65bcfb4 | 409 | /** @brief Computes the UART mask to apply to retrieve the received data |
mbed_official | 205:c41fc65bcfb4 | 410 | * according to the word length and to the parity bits activation. |
mbed_official | 205:c41fc65bcfb4 | 411 | * If PCE = 1, the parity bit is not included in the data extracted |
mbed_official | 205:c41fc65bcfb4 | 412 | * by the reception API(). |
mbed_official | 205:c41fc65bcfb4 | 413 | * This masking operation is not carried out in the case of |
mbed_official | 205:c41fc65bcfb4 | 414 | * DMA transfers. |
mbed_official | 205:c41fc65bcfb4 | 415 | * @param __HANDLE__: specifies the UART Handle |
mbed_official | 205:c41fc65bcfb4 | 416 | * @retval none |
mbed_official | 205:c41fc65bcfb4 | 417 | */ |
mbed_official | 205:c41fc65bcfb4 | 418 | #if defined (STM32F042x6) || defined (STM32F048xx) || \ |
mbed_official | 205:c41fc65bcfb4 | 419 | defined (STM32F071xB) || defined (STM32F072xB) || defined (STM32F078xx) |
mbed_official | 205:c41fc65bcfb4 | 420 | #define __HAL_UART_MASK_COMPUTATION(__HANDLE__) \ |
mbed_official | 205:c41fc65bcfb4 | 421 | do { \ |
mbed_official | 205:c41fc65bcfb4 | 422 | if ((__HANDLE__)->Init.WordLength == UART_WORDLENGTH_9B) \ |
mbed_official | 205:c41fc65bcfb4 | 423 | { \ |
mbed_official | 205:c41fc65bcfb4 | 424 | if ((__HANDLE__)->Init.Parity == UART_PARITY_NONE) \ |
mbed_official | 205:c41fc65bcfb4 | 425 | { \ |
mbed_official | 205:c41fc65bcfb4 | 426 | (__HANDLE__)->Mask = 0x01FF ; \ |
mbed_official | 205:c41fc65bcfb4 | 427 | } \ |
mbed_official | 205:c41fc65bcfb4 | 428 | else \ |
mbed_official | 205:c41fc65bcfb4 | 429 | { \ |
mbed_official | 205:c41fc65bcfb4 | 430 | (__HANDLE__)->Mask = 0x00FF ; \ |
mbed_official | 205:c41fc65bcfb4 | 431 | } \ |
mbed_official | 205:c41fc65bcfb4 | 432 | } \ |
mbed_official | 205:c41fc65bcfb4 | 433 | else if ((__HANDLE__)->Init.WordLength == UART_WORDLENGTH_8B) \ |
mbed_official | 205:c41fc65bcfb4 | 434 | { \ |
mbed_official | 205:c41fc65bcfb4 | 435 | if ((__HANDLE__)->Init.Parity == UART_PARITY_NONE) \ |
mbed_official | 205:c41fc65bcfb4 | 436 | { \ |
mbed_official | 205:c41fc65bcfb4 | 437 | (__HANDLE__)->Mask = 0x00FF ; \ |
mbed_official | 205:c41fc65bcfb4 | 438 | } \ |
mbed_official | 205:c41fc65bcfb4 | 439 | else \ |
mbed_official | 205:c41fc65bcfb4 | 440 | { \ |
mbed_official | 205:c41fc65bcfb4 | 441 | (__HANDLE__)->Mask = 0x007F ; \ |
mbed_official | 205:c41fc65bcfb4 | 442 | } \ |
mbed_official | 205:c41fc65bcfb4 | 443 | } \ |
mbed_official | 205:c41fc65bcfb4 | 444 | else if ((__HANDLE__)->Init.WordLength == UART_WORDLENGTH_7B) \ |
mbed_official | 205:c41fc65bcfb4 | 445 | { \ |
mbed_official | 205:c41fc65bcfb4 | 446 | if ((__HANDLE__)->Init.Parity == UART_PARITY_NONE) \ |
mbed_official | 205:c41fc65bcfb4 | 447 | { \ |
mbed_official | 205:c41fc65bcfb4 | 448 | (__HANDLE__)->Mask = 0x007F ; \ |
mbed_official | 205:c41fc65bcfb4 | 449 | } \ |
mbed_official | 205:c41fc65bcfb4 | 450 | else \ |
mbed_official | 205:c41fc65bcfb4 | 451 | { \ |
mbed_official | 205:c41fc65bcfb4 | 452 | (__HANDLE__)->Mask = 0x003F ; \ |
mbed_official | 205:c41fc65bcfb4 | 453 | } \ |
mbed_official | 205:c41fc65bcfb4 | 454 | } \ |
mbed_official | 205:c41fc65bcfb4 | 455 | } while(0) |
mbed_official | 205:c41fc65bcfb4 | 456 | #else |
mbed_official | 205:c41fc65bcfb4 | 457 | #define __HAL_UART_MASK_COMPUTATION(__HANDLE__) \ |
mbed_official | 205:c41fc65bcfb4 | 458 | do { \ |
mbed_official | 205:c41fc65bcfb4 | 459 | if ((__HANDLE__)->Init.WordLength == UART_WORDLENGTH_9B) \ |
mbed_official | 205:c41fc65bcfb4 | 460 | { \ |
mbed_official | 205:c41fc65bcfb4 | 461 | if ((__HANDLE__)->Init.Parity == UART_PARITY_NONE) \ |
mbed_official | 205:c41fc65bcfb4 | 462 | { \ |
mbed_official | 205:c41fc65bcfb4 | 463 | (__HANDLE__)->Mask = 0x01FF ; \ |
mbed_official | 205:c41fc65bcfb4 | 464 | } \ |
mbed_official | 205:c41fc65bcfb4 | 465 | else \ |
mbed_official | 205:c41fc65bcfb4 | 466 | { \ |
mbed_official | 205:c41fc65bcfb4 | 467 | (__HANDLE__)->Mask = 0x00FF ; \ |
mbed_official | 205:c41fc65bcfb4 | 468 | } \ |
mbed_official | 205:c41fc65bcfb4 | 469 | } \ |
mbed_official | 205:c41fc65bcfb4 | 470 | else if ((__HANDLE__)->Init.WordLength == UART_WORDLENGTH_8B) \ |
mbed_official | 205:c41fc65bcfb4 | 471 | { \ |
mbed_official | 205:c41fc65bcfb4 | 472 | if ((__HANDLE__)->Init.Parity == UART_PARITY_NONE) \ |
mbed_official | 205:c41fc65bcfb4 | 473 | { \ |
mbed_official | 205:c41fc65bcfb4 | 474 | (__HANDLE__)->Mask = 0x00FF ; \ |
mbed_official | 205:c41fc65bcfb4 | 475 | } \ |
mbed_official | 205:c41fc65bcfb4 | 476 | else \ |
mbed_official | 205:c41fc65bcfb4 | 477 | { \ |
mbed_official | 205:c41fc65bcfb4 | 478 | (__HANDLE__)->Mask = 0x007F ; \ |
mbed_official | 205:c41fc65bcfb4 | 479 | } \ |
mbed_official | 205:c41fc65bcfb4 | 480 | } \ |
mbed_official | 205:c41fc65bcfb4 | 481 | } while(0) |
mbed_official | 205:c41fc65bcfb4 | 482 | #endif /* defined (STM32F042x6) || defined (STM32F048xx) || \ |
mbed_official | 205:c41fc65bcfb4 | 483 | defined (STM32F071xB) || defined (STM32F072xB) || defined (STM32F078xx) */ |
mbed_official | 205:c41fc65bcfb4 | 484 | /** |
mbed_official | 205:c41fc65bcfb4 | 485 | * @} |
mbed_official | 205:c41fc65bcfb4 | 486 | */ |
mbed_official | 205:c41fc65bcfb4 | 487 | |
mbed_official | 205:c41fc65bcfb4 | 488 | /* Exported functions --------------------------------------------------------*/ |
mbed_official | 205:c41fc65bcfb4 | 489 | /* Initialization and de-initialization functions ****************************/ |
mbed_official | 205:c41fc65bcfb4 | 490 | HAL_StatusTypeDef HAL_RS485Ex_Init(UART_HandleTypeDef *huart, uint32_t UART_DEPolarity, uint32_t UART_DEAssertionTime, uint32_t UART_DEDeassertionTime); |
mbed_official | 205:c41fc65bcfb4 | 491 | HAL_StatusTypeDef HAL_LIN_Init(UART_HandleTypeDef *huart, uint16_t BreakDetectLength); |
mbed_official | 205:c41fc65bcfb4 | 492 | HAL_StatusTypeDef HAL_UARTEx_StopModeWakeUpSourceConfig(UART_HandleTypeDef *huart, UART_WakeUpTypeDef WakeUpSelection); |
mbed_official | 205:c41fc65bcfb4 | 493 | HAL_StatusTypeDef HAL_UARTEx_EnableStopMode(UART_HandleTypeDef *huart); |
mbed_official | 205:c41fc65bcfb4 | 494 | HAL_StatusTypeDef HAL_UARTEx_DisableStopMode(UART_HandleTypeDef *huart); |
mbed_official | 205:c41fc65bcfb4 | 495 | /* I/O operation functions ***************************************************/ |
mbed_official | 205:c41fc65bcfb4 | 496 | void HAL_UART_IRQHandler(UART_HandleTypeDef *huart); |
mbed_official | 205:c41fc65bcfb4 | 497 | void HAL_UART_WakeupCallback(UART_HandleTypeDef *huart); |
mbed_official | 205:c41fc65bcfb4 | 498 | /* Peripheral Control functions **********************************************/ |
mbed_official | 205:c41fc65bcfb4 | 499 | void UART_AdvFeatureConfig(UART_HandleTypeDef *huart); |
mbed_official | 205:c41fc65bcfb4 | 500 | HAL_StatusTypeDef HAL_MultiProcessorEx_AddressLength_Set(UART_HandleTypeDef *huart, uint32_t AddressLength); |
mbed_official | 205:c41fc65bcfb4 | 501 | HAL_StatusTypeDef HAL_LIN_SendBreak(UART_HandleTypeDef *huart); |
mbed_official | 205:c41fc65bcfb4 | 502 | /* Peripheral State functions ************************************************/ |
mbed_official | 205:c41fc65bcfb4 | 503 | |
mbed_official | 205:c41fc65bcfb4 | 504 | |
mbed_official | 205:c41fc65bcfb4 | 505 | /** |
mbed_official | 205:c41fc65bcfb4 | 506 | * @} |
mbed_official | 205:c41fc65bcfb4 | 507 | */ |
mbed_official | 205:c41fc65bcfb4 | 508 | |
mbed_official | 205:c41fc65bcfb4 | 509 | /** |
mbed_official | 205:c41fc65bcfb4 | 510 | * @} |
mbed_official | 205:c41fc65bcfb4 | 511 | */ |
mbed_official | 205:c41fc65bcfb4 | 512 | |
mbed_official | 205:c41fc65bcfb4 | 513 | #ifdef __cplusplus |
mbed_official | 205:c41fc65bcfb4 | 514 | } |
mbed_official | 205:c41fc65bcfb4 | 515 | #endif |
mbed_official | 205:c41fc65bcfb4 | 516 | |
mbed_official | 205:c41fc65bcfb4 | 517 | #endif /* __STM32F0xx_HAL_UART_EX_H */ |
mbed_official | 205:c41fc65bcfb4 | 518 | |
mbed_official | 205:c41fc65bcfb4 | 519 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |