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