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