001

Committer:
ganlikun
Date:
Sun Jun 12 14:02:44 2022 +0000
Revision:
0:13413ea9a877
00

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ganlikun 0:13413ea9a877 1 /**
ganlikun 0:13413ea9a877 2 ******************************************************************************
ganlikun 0:13413ea9a877 3 * @file stm32f4xx_ll_usart.h
ganlikun 0:13413ea9a877 4 * @author MCD Application Team
ganlikun 0:13413ea9a877 5 * @version V1.7.1
ganlikun 0:13413ea9a877 6 * @date 14-April-2017
ganlikun 0:13413ea9a877 7 * @brief Header file of USART LL module.
ganlikun 0:13413ea9a877 8 ******************************************************************************
ganlikun 0:13413ea9a877 9 * @attention
ganlikun 0:13413ea9a877 10 *
ganlikun 0:13413ea9a877 11 * <h2><center>&copy; COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
ganlikun 0:13413ea9a877 12 *
ganlikun 0:13413ea9a877 13 * Redistribution and use in source and binary forms, with or without modification,
ganlikun 0:13413ea9a877 14 * are permitted provided that the following conditions are met:
ganlikun 0:13413ea9a877 15 * 1. Redistributions of source code must retain the above copyright notice,
ganlikun 0:13413ea9a877 16 * this list of conditions and the following disclaimer.
ganlikun 0:13413ea9a877 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
ganlikun 0:13413ea9a877 18 * this list of conditions and the following disclaimer in the documentation
ganlikun 0:13413ea9a877 19 * and/or other materials provided with the distribution.
ganlikun 0:13413ea9a877 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
ganlikun 0:13413ea9a877 21 * may be used to endorse or promote products derived from this software
ganlikun 0:13413ea9a877 22 * without specific prior written permission.
ganlikun 0:13413ea9a877 23 *
ganlikun 0:13413ea9a877 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
ganlikun 0:13413ea9a877 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
ganlikun 0:13413ea9a877 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
ganlikun 0:13413ea9a877 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
ganlikun 0:13413ea9a877 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
ganlikun 0:13413ea9a877 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
ganlikun 0:13413ea9a877 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
ganlikun 0:13413ea9a877 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
ganlikun 0:13413ea9a877 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
ganlikun 0:13413ea9a877 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
ganlikun 0:13413ea9a877 34 *
ganlikun 0:13413ea9a877 35 ******************************************************************************
ganlikun 0:13413ea9a877 36 */
ganlikun 0:13413ea9a877 37
ganlikun 0:13413ea9a877 38 /* Define to prevent recursive inclusion -------------------------------------*/
ganlikun 0:13413ea9a877 39 #ifndef __STM32F4xx_LL_USART_H
ganlikun 0:13413ea9a877 40 #define __STM32F4xx_LL_USART_H
ganlikun 0:13413ea9a877 41
ganlikun 0:13413ea9a877 42 #ifdef __cplusplus
ganlikun 0:13413ea9a877 43 extern "C" {
ganlikun 0:13413ea9a877 44 #endif
ganlikun 0:13413ea9a877 45
ganlikun 0:13413ea9a877 46 /* Includes ------------------------------------------------------------------*/
ganlikun 0:13413ea9a877 47 #include "stm32f4xx.h"
ganlikun 0:13413ea9a877 48
ganlikun 0:13413ea9a877 49 /** @addtogroup STM32F4xx_LL_Driver
ganlikun 0:13413ea9a877 50 * @{
ganlikun 0:13413ea9a877 51 */
ganlikun 0:13413ea9a877 52
ganlikun 0:13413ea9a877 53 #if defined (USART1) || defined (USART2) || defined (USART3) || defined (USART6) || defined (UART4) || defined (UART5) || defined (UART7) || defined (UART8) || defined (UART9) || defined (UART10)
ganlikun 0:13413ea9a877 54
ganlikun 0:13413ea9a877 55 /** @defgroup USART_LL USART
ganlikun 0:13413ea9a877 56 * @{
ganlikun 0:13413ea9a877 57 */
ganlikun 0:13413ea9a877 58
ganlikun 0:13413ea9a877 59 /* Private types -------------------------------------------------------------*/
ganlikun 0:13413ea9a877 60 /* Private variables ---------------------------------------------------------*/
ganlikun 0:13413ea9a877 61
ganlikun 0:13413ea9a877 62 /* Private constants ---------------------------------------------------------*/
ganlikun 0:13413ea9a877 63 /** @defgroup USART_LL_Private_Constants USART Private Constants
ganlikun 0:13413ea9a877 64 * @{
ganlikun 0:13413ea9a877 65 */
ganlikun 0:13413ea9a877 66
ganlikun 0:13413ea9a877 67 /* Defines used for the bit position in the register and perform offsets*/
ganlikun 0:13413ea9a877 68 #define USART_POSITION_GTPR_GT USART_GTPR_GT_Pos
ganlikun 0:13413ea9a877 69 /**
ganlikun 0:13413ea9a877 70 * @}
ganlikun 0:13413ea9a877 71 */
ganlikun 0:13413ea9a877 72
ganlikun 0:13413ea9a877 73 /* Private macros ------------------------------------------------------------*/
ganlikun 0:13413ea9a877 74 #if defined(USE_FULL_LL_DRIVER)
ganlikun 0:13413ea9a877 75 /** @defgroup USART_LL_Private_Macros USART Private Macros
ganlikun 0:13413ea9a877 76 * @{
ganlikun 0:13413ea9a877 77 */
ganlikun 0:13413ea9a877 78 /**
ganlikun 0:13413ea9a877 79 * @}
ganlikun 0:13413ea9a877 80 */
ganlikun 0:13413ea9a877 81 #endif /*USE_FULL_LL_DRIVER*/
ganlikun 0:13413ea9a877 82
ganlikun 0:13413ea9a877 83 /* Exported types ------------------------------------------------------------*/
ganlikun 0:13413ea9a877 84 #if defined(USE_FULL_LL_DRIVER)
ganlikun 0:13413ea9a877 85 /** @defgroup USART_LL_ES_INIT USART Exported Init structures
ganlikun 0:13413ea9a877 86 * @{
ganlikun 0:13413ea9a877 87 */
ganlikun 0:13413ea9a877 88
ganlikun 0:13413ea9a877 89 /**
ganlikun 0:13413ea9a877 90 * @brief LL USART Init Structure definition
ganlikun 0:13413ea9a877 91 */
ganlikun 0:13413ea9a877 92 typedef struct
ganlikun 0:13413ea9a877 93 {
ganlikun 0:13413ea9a877 94 uint32_t BaudRate; /*!< This field defines expected Usart communication baud rate.
ganlikun 0:13413ea9a877 95
ganlikun 0:13413ea9a877 96 This feature can be modified afterwards using unitary function @ref LL_USART_SetBaudRate().*/
ganlikun 0:13413ea9a877 97
ganlikun 0:13413ea9a877 98 uint32_t DataWidth; /*!< Specifies the number of data bits transmitted or received in a frame.
ganlikun 0:13413ea9a877 99 This parameter can be a value of @ref USART_LL_EC_DATAWIDTH.
ganlikun 0:13413ea9a877 100
ganlikun 0:13413ea9a877 101 This feature can be modified afterwards using unitary function @ref LL_USART_SetDataWidth().*/
ganlikun 0:13413ea9a877 102
ganlikun 0:13413ea9a877 103 uint32_t StopBits; /*!< Specifies the number of stop bits transmitted.
ganlikun 0:13413ea9a877 104 This parameter can be a value of @ref USART_LL_EC_STOPBITS.
ganlikun 0:13413ea9a877 105
ganlikun 0:13413ea9a877 106 This feature can be modified afterwards using unitary function @ref LL_USART_SetStopBitsLength().*/
ganlikun 0:13413ea9a877 107
ganlikun 0:13413ea9a877 108 uint32_t Parity; /*!< Specifies the parity mode.
ganlikun 0:13413ea9a877 109 This parameter can be a value of @ref USART_LL_EC_PARITY.
ganlikun 0:13413ea9a877 110
ganlikun 0:13413ea9a877 111 This feature can be modified afterwards using unitary function @ref LL_USART_SetParity().*/
ganlikun 0:13413ea9a877 112
ganlikun 0:13413ea9a877 113 uint32_t TransferDirection; /*!< Specifies whether the Receive and/or Transmit mode is enabled or disabled.
ganlikun 0:13413ea9a877 114 This parameter can be a value of @ref USART_LL_EC_DIRECTION.
ganlikun 0:13413ea9a877 115
ganlikun 0:13413ea9a877 116 This feature can be modified afterwards using unitary function @ref LL_USART_SetTransferDirection().*/
ganlikun 0:13413ea9a877 117
ganlikun 0:13413ea9a877 118 uint32_t HardwareFlowControl; /*!< Specifies whether the hardware flow control mode is enabled or disabled.
ganlikun 0:13413ea9a877 119 This parameter can be a value of @ref USART_LL_EC_HWCONTROL.
ganlikun 0:13413ea9a877 120
ganlikun 0:13413ea9a877 121 This feature can be modified afterwards using unitary function @ref LL_USART_SetHWFlowCtrl().*/
ganlikun 0:13413ea9a877 122
ganlikun 0:13413ea9a877 123 uint32_t OverSampling; /*!< Specifies whether USART oversampling mode is 16 or 8.
ganlikun 0:13413ea9a877 124 This parameter can be a value of @ref USART_LL_EC_OVERSAMPLING.
ganlikun 0:13413ea9a877 125
ganlikun 0:13413ea9a877 126 This feature can be modified afterwards using unitary function @ref LL_USART_SetOverSampling().*/
ganlikun 0:13413ea9a877 127
ganlikun 0:13413ea9a877 128 } LL_USART_InitTypeDef;
ganlikun 0:13413ea9a877 129
ganlikun 0:13413ea9a877 130 /**
ganlikun 0:13413ea9a877 131 * @brief LL USART Clock Init Structure definition
ganlikun 0:13413ea9a877 132 */
ganlikun 0:13413ea9a877 133 typedef struct
ganlikun 0:13413ea9a877 134 {
ganlikun 0:13413ea9a877 135 uint32_t ClockOutput; /*!< Specifies whether the USART clock is enabled or disabled.
ganlikun 0:13413ea9a877 136 This parameter can be a value of @ref USART_LL_EC_CLOCK.
ganlikun 0:13413ea9a877 137
ganlikun 0:13413ea9a877 138 USART HW configuration can be modified afterwards using unitary functions
ganlikun 0:13413ea9a877 139 @ref LL_USART_EnableSCLKOutput() or @ref LL_USART_DisableSCLKOutput().
ganlikun 0:13413ea9a877 140 For more details, refer to description of this function. */
ganlikun 0:13413ea9a877 141
ganlikun 0:13413ea9a877 142 uint32_t ClockPolarity; /*!< Specifies the steady state of the serial clock.
ganlikun 0:13413ea9a877 143 This parameter can be a value of @ref USART_LL_EC_POLARITY.
ganlikun 0:13413ea9a877 144
ganlikun 0:13413ea9a877 145 USART HW configuration can be modified afterwards using unitary functions @ref LL_USART_SetClockPolarity().
ganlikun 0:13413ea9a877 146 For more details, refer to description of this function. */
ganlikun 0:13413ea9a877 147
ganlikun 0:13413ea9a877 148 uint32_t ClockPhase; /*!< Specifies the clock transition on which the bit capture is made.
ganlikun 0:13413ea9a877 149 This parameter can be a value of @ref USART_LL_EC_PHASE.
ganlikun 0:13413ea9a877 150
ganlikun 0:13413ea9a877 151 USART HW configuration can be modified afterwards using unitary functions @ref LL_USART_SetClockPhase().
ganlikun 0:13413ea9a877 152 For more details, refer to description of this function. */
ganlikun 0:13413ea9a877 153
ganlikun 0:13413ea9a877 154 uint32_t LastBitClockPulse; /*!< Specifies whether the clock pulse corresponding to the last transmitted
ganlikun 0:13413ea9a877 155 data bit (MSB) has to be output on the SCLK pin in synchronous mode.
ganlikun 0:13413ea9a877 156 This parameter can be a value of @ref USART_LL_EC_LASTCLKPULSE.
ganlikun 0:13413ea9a877 157
ganlikun 0:13413ea9a877 158 USART HW configuration can be modified afterwards using unitary functions @ref LL_USART_SetLastClkPulseOutput().
ganlikun 0:13413ea9a877 159 For more details, refer to description of this function. */
ganlikun 0:13413ea9a877 160
ganlikun 0:13413ea9a877 161 } LL_USART_ClockInitTypeDef;
ganlikun 0:13413ea9a877 162
ganlikun 0:13413ea9a877 163 /**
ganlikun 0:13413ea9a877 164 * @}
ganlikun 0:13413ea9a877 165 */
ganlikun 0:13413ea9a877 166 #endif /* USE_FULL_LL_DRIVER */
ganlikun 0:13413ea9a877 167
ganlikun 0:13413ea9a877 168 /* Exported constants --------------------------------------------------------*/
ganlikun 0:13413ea9a877 169 /** @defgroup USART_LL_Exported_Constants USART Exported Constants
ganlikun 0:13413ea9a877 170 * @{
ganlikun 0:13413ea9a877 171 */
ganlikun 0:13413ea9a877 172
ganlikun 0:13413ea9a877 173 /** @defgroup USART_LL_EC_GET_FLAG Get Flags Defines
ganlikun 0:13413ea9a877 174 * @brief Flags defines which can be used with LL_USART_ReadReg function
ganlikun 0:13413ea9a877 175 * @{
ganlikun 0:13413ea9a877 176 */
ganlikun 0:13413ea9a877 177 #define LL_USART_SR_PE USART_SR_PE /*!< Parity error flag */
ganlikun 0:13413ea9a877 178 #define LL_USART_SR_FE USART_SR_FE /*!< Framing error flag */
ganlikun 0:13413ea9a877 179 #define LL_USART_SR_NE USART_SR_NE /*!< Noise detected flag */
ganlikun 0:13413ea9a877 180 #define LL_USART_SR_ORE USART_SR_ORE /*!< Overrun error flag */
ganlikun 0:13413ea9a877 181 #define LL_USART_SR_IDLE USART_SR_IDLE /*!< Idle line detected flag */
ganlikun 0:13413ea9a877 182 #define LL_USART_SR_RXNE USART_SR_RXNE /*!< Read data register not empty flag */
ganlikun 0:13413ea9a877 183 #define LL_USART_SR_TC USART_SR_TC /*!< Transmission complete flag */
ganlikun 0:13413ea9a877 184 #define LL_USART_SR_TXE USART_SR_TXE /*!< Transmit data register empty flag */
ganlikun 0:13413ea9a877 185 #define LL_USART_SR_LBD USART_SR_LBD /*!< LIN break detection flag */
ganlikun 0:13413ea9a877 186 #define LL_USART_SR_CTS USART_SR_CTS /*!< CTS flag */
ganlikun 0:13413ea9a877 187 /**
ganlikun 0:13413ea9a877 188 * @}
ganlikun 0:13413ea9a877 189 */
ganlikun 0:13413ea9a877 190
ganlikun 0:13413ea9a877 191 /** @defgroup USART_LL_EC_IT IT Defines
ganlikun 0:13413ea9a877 192 * @brief IT defines which can be used with LL_USART_ReadReg and LL_USART_WriteReg functions
ganlikun 0:13413ea9a877 193 * @{
ganlikun 0:13413ea9a877 194 */
ganlikun 0:13413ea9a877 195 #define LL_USART_CR1_IDLEIE USART_CR1_IDLEIE /*!< IDLE interrupt enable */
ganlikun 0:13413ea9a877 196 #define LL_USART_CR1_RXNEIE USART_CR1_RXNEIE /*!< Read data register not empty interrupt enable */
ganlikun 0:13413ea9a877 197 #define LL_USART_CR1_TCIE USART_CR1_TCIE /*!< Transmission complete interrupt enable */
ganlikun 0:13413ea9a877 198 #define LL_USART_CR1_TXEIE USART_CR1_TXEIE /*!< Transmit data register empty interrupt enable */
ganlikun 0:13413ea9a877 199 #define LL_USART_CR1_PEIE USART_CR1_PEIE /*!< Parity error */
ganlikun 0:13413ea9a877 200 #define LL_USART_CR2_LBDIE USART_CR2_LBDIE /*!< LIN break detection interrupt enable */
ganlikun 0:13413ea9a877 201 #define LL_USART_CR3_EIE USART_CR3_EIE /*!< Error interrupt enable */
ganlikun 0:13413ea9a877 202 #define LL_USART_CR3_CTSIE USART_CR3_CTSIE /*!< CTS interrupt enable */
ganlikun 0:13413ea9a877 203 /**
ganlikun 0:13413ea9a877 204 * @}
ganlikun 0:13413ea9a877 205 */
ganlikun 0:13413ea9a877 206
ganlikun 0:13413ea9a877 207 /** @defgroup USART_LL_EC_DIRECTION Communication Direction
ganlikun 0:13413ea9a877 208 * @{
ganlikun 0:13413ea9a877 209 */
ganlikun 0:13413ea9a877 210 #define LL_USART_DIRECTION_NONE 0x00000000U /*!< Transmitter and Receiver are disabled */
ganlikun 0:13413ea9a877 211 #define LL_USART_DIRECTION_RX USART_CR1_RE /*!< Transmitter is disabled and Receiver is enabled */
ganlikun 0:13413ea9a877 212 #define LL_USART_DIRECTION_TX USART_CR1_TE /*!< Transmitter is enabled and Receiver is disabled */
ganlikun 0:13413ea9a877 213 #define LL_USART_DIRECTION_TX_RX (USART_CR1_TE |USART_CR1_RE) /*!< Transmitter and Receiver are enabled */
ganlikun 0:13413ea9a877 214 /**
ganlikun 0:13413ea9a877 215 * @}
ganlikun 0:13413ea9a877 216 */
ganlikun 0:13413ea9a877 217
ganlikun 0:13413ea9a877 218 /** @defgroup USART_LL_EC_PARITY Parity Control
ganlikun 0:13413ea9a877 219 * @{
ganlikun 0:13413ea9a877 220 */
ganlikun 0:13413ea9a877 221 #define LL_USART_PARITY_NONE 0x00000000U /*!< Parity control disabled */
ganlikun 0:13413ea9a877 222 #define LL_USART_PARITY_EVEN USART_CR1_PCE /*!< Parity control enabled and Even Parity is selected */
ganlikun 0:13413ea9a877 223 #define LL_USART_PARITY_ODD (USART_CR1_PCE | USART_CR1_PS) /*!< Parity control enabled and Odd Parity is selected */
ganlikun 0:13413ea9a877 224 /**
ganlikun 0:13413ea9a877 225 * @}
ganlikun 0:13413ea9a877 226 */
ganlikun 0:13413ea9a877 227
ganlikun 0:13413ea9a877 228 /** @defgroup USART_LL_EC_WAKEUP Wakeup
ganlikun 0:13413ea9a877 229 * @{
ganlikun 0:13413ea9a877 230 */
ganlikun 0:13413ea9a877 231 #define LL_USART_WAKEUP_IDLELINE 0x00000000U /*!< USART wake up from Mute mode on Idle Line */
ganlikun 0:13413ea9a877 232 #define LL_USART_WAKEUP_ADDRESSMARK USART_CR1_WAKE /*!< USART wake up from Mute mode on Address Mark */
ganlikun 0:13413ea9a877 233 /**
ganlikun 0:13413ea9a877 234 * @}
ganlikun 0:13413ea9a877 235 */
ganlikun 0:13413ea9a877 236
ganlikun 0:13413ea9a877 237 /** @defgroup USART_LL_EC_DATAWIDTH Datawidth
ganlikun 0:13413ea9a877 238 * @{
ganlikun 0:13413ea9a877 239 */
ganlikun 0:13413ea9a877 240 #define LL_USART_DATAWIDTH_8B 0x00000000U /*!< 8 bits word length : Start bit, 8 data bits, n stop bits */
ganlikun 0:13413ea9a877 241 #define LL_USART_DATAWIDTH_9B USART_CR1_M /*!< 9 bits word length : Start bit, 9 data bits, n stop bits */
ganlikun 0:13413ea9a877 242 /**
ganlikun 0:13413ea9a877 243 * @}
ganlikun 0:13413ea9a877 244 */
ganlikun 0:13413ea9a877 245
ganlikun 0:13413ea9a877 246 /** @defgroup USART_LL_EC_OVERSAMPLING Oversampling
ganlikun 0:13413ea9a877 247 * @{
ganlikun 0:13413ea9a877 248 */
ganlikun 0:13413ea9a877 249 #define LL_USART_OVERSAMPLING_16 0x00000000U /*!< Oversampling by 16 */
ganlikun 0:13413ea9a877 250 #define LL_USART_OVERSAMPLING_8 USART_CR1_OVER8 /*!< Oversampling by 8 */
ganlikun 0:13413ea9a877 251 /**
ganlikun 0:13413ea9a877 252 * @}
ganlikun 0:13413ea9a877 253 */
ganlikun 0:13413ea9a877 254
ganlikun 0:13413ea9a877 255 #if defined(USE_FULL_LL_DRIVER)
ganlikun 0:13413ea9a877 256 /** @defgroup USART_LL_EC_CLOCK Clock Signal
ganlikun 0:13413ea9a877 257 * @{
ganlikun 0:13413ea9a877 258 */
ganlikun 0:13413ea9a877 259
ganlikun 0:13413ea9a877 260 #define LL_USART_CLOCK_DISABLE 0x00000000U /*!< Clock signal not provided */
ganlikun 0:13413ea9a877 261 #define LL_USART_CLOCK_ENABLE USART_CR2_CLKEN /*!< Clock signal provided */
ganlikun 0:13413ea9a877 262 /**
ganlikun 0:13413ea9a877 263 * @}
ganlikun 0:13413ea9a877 264 */
ganlikun 0:13413ea9a877 265 #endif /*USE_FULL_LL_DRIVER*/
ganlikun 0:13413ea9a877 266
ganlikun 0:13413ea9a877 267 /** @defgroup USART_LL_EC_LASTCLKPULSE Last Clock Pulse
ganlikun 0:13413ea9a877 268 * @{
ganlikun 0:13413ea9a877 269 */
ganlikun 0:13413ea9a877 270 #define LL_USART_LASTCLKPULSE_NO_OUTPUT 0x00000000U /*!< The clock pulse of the last data bit is not output to the SCLK pin */
ganlikun 0:13413ea9a877 271 #define LL_USART_LASTCLKPULSE_OUTPUT USART_CR2_LBCL /*!< The clock pulse of the last data bit is output to the SCLK pin */
ganlikun 0:13413ea9a877 272 /**
ganlikun 0:13413ea9a877 273 * @}
ganlikun 0:13413ea9a877 274 */
ganlikun 0:13413ea9a877 275
ganlikun 0:13413ea9a877 276 /** @defgroup USART_LL_EC_PHASE Clock Phase
ganlikun 0:13413ea9a877 277 * @{
ganlikun 0:13413ea9a877 278 */
ganlikun 0:13413ea9a877 279 #define LL_USART_PHASE_1EDGE 0x00000000U /*!< The first clock transition is the first data capture edge */
ganlikun 0:13413ea9a877 280 #define LL_USART_PHASE_2EDGE USART_CR2_CPHA /*!< The second clock transition is the first data capture edge */
ganlikun 0:13413ea9a877 281 /**
ganlikun 0:13413ea9a877 282 * @}
ganlikun 0:13413ea9a877 283 */
ganlikun 0:13413ea9a877 284
ganlikun 0:13413ea9a877 285 /** @defgroup USART_LL_EC_POLARITY Clock Polarity
ganlikun 0:13413ea9a877 286 * @{
ganlikun 0:13413ea9a877 287 */
ganlikun 0:13413ea9a877 288 #define LL_USART_POLARITY_LOW 0x00000000U /*!< Steady low value on SCLK pin outside transmission window*/
ganlikun 0:13413ea9a877 289 #define LL_USART_POLARITY_HIGH USART_CR2_CPOL /*!< Steady high value on SCLK pin outside transmission window */
ganlikun 0:13413ea9a877 290 /**
ganlikun 0:13413ea9a877 291 * @}
ganlikun 0:13413ea9a877 292 */
ganlikun 0:13413ea9a877 293
ganlikun 0:13413ea9a877 294 /** @defgroup USART_LL_EC_STOPBITS Stop Bits
ganlikun 0:13413ea9a877 295 * @{
ganlikun 0:13413ea9a877 296 */
ganlikun 0:13413ea9a877 297 #define LL_USART_STOPBITS_0_5 USART_CR2_STOP_0 /*!< 0.5 stop bit */
ganlikun 0:13413ea9a877 298 #define LL_USART_STOPBITS_1 0x00000000U /*!< 1 stop bit */
ganlikun 0:13413ea9a877 299 #define LL_USART_STOPBITS_1_5 (USART_CR2_STOP_0 | USART_CR2_STOP_1) /*!< 1.5 stop bits */
ganlikun 0:13413ea9a877 300 #define LL_USART_STOPBITS_2 USART_CR2_STOP_1 /*!< 2 stop bits */
ganlikun 0:13413ea9a877 301 /**
ganlikun 0:13413ea9a877 302 * @}
ganlikun 0:13413ea9a877 303 */
ganlikun 0:13413ea9a877 304
ganlikun 0:13413ea9a877 305 /** @defgroup USART_LL_EC_HWCONTROL Hardware Control
ganlikun 0:13413ea9a877 306 * @{
ganlikun 0:13413ea9a877 307 */
ganlikun 0:13413ea9a877 308 #define LL_USART_HWCONTROL_NONE 0x00000000U /*!< CTS and RTS hardware flow control disabled */
ganlikun 0:13413ea9a877 309 #define LL_USART_HWCONTROL_RTS USART_CR3_RTSE /*!< RTS output enabled, data is only requested when there is space in the receive buffer */
ganlikun 0:13413ea9a877 310 #define LL_USART_HWCONTROL_CTS USART_CR3_CTSE /*!< CTS mode enabled, data is only transmitted when the nCTS input is asserted (tied to 0) */
ganlikun 0:13413ea9a877 311 #define LL_USART_HWCONTROL_RTS_CTS (USART_CR3_RTSE | USART_CR3_CTSE) /*!< CTS and RTS hardware flow control enabled */
ganlikun 0:13413ea9a877 312 /**
ganlikun 0:13413ea9a877 313 * @}
ganlikun 0:13413ea9a877 314 */
ganlikun 0:13413ea9a877 315
ganlikun 0:13413ea9a877 316 /** @defgroup USART_LL_EC_IRDA_POWER IrDA Power
ganlikun 0:13413ea9a877 317 * @{
ganlikun 0:13413ea9a877 318 */
ganlikun 0:13413ea9a877 319 #define LL_USART_IRDA_POWER_NORMAL 0x00000000U /*!< IrDA normal power mode */
ganlikun 0:13413ea9a877 320 #define LL_USART_IRDA_POWER_LOW USART_CR3_IRLP /*!< IrDA low power mode */
ganlikun 0:13413ea9a877 321 /**
ganlikun 0:13413ea9a877 322 * @}
ganlikun 0:13413ea9a877 323 */
ganlikun 0:13413ea9a877 324
ganlikun 0:13413ea9a877 325 /** @defgroup USART_LL_EC_LINBREAK_DETECT LIN Break Detection Length
ganlikun 0:13413ea9a877 326 * @{
ganlikun 0:13413ea9a877 327 */
ganlikun 0:13413ea9a877 328 #define LL_USART_LINBREAK_DETECT_10B 0x00000000U /*!< 10-bit break detection method selected */
ganlikun 0:13413ea9a877 329 #define LL_USART_LINBREAK_DETECT_11B USART_CR2_LBDL /*!< 11-bit break detection method selected */
ganlikun 0:13413ea9a877 330 /**
ganlikun 0:13413ea9a877 331 * @}
ganlikun 0:13413ea9a877 332 */
ganlikun 0:13413ea9a877 333
ganlikun 0:13413ea9a877 334 /**
ganlikun 0:13413ea9a877 335 * @}
ganlikun 0:13413ea9a877 336 */
ganlikun 0:13413ea9a877 337
ganlikun 0:13413ea9a877 338 /* Exported macro ------------------------------------------------------------*/
ganlikun 0:13413ea9a877 339 /** @defgroup USART_LL_Exported_Macros USART Exported Macros
ganlikun 0:13413ea9a877 340 * @{
ganlikun 0:13413ea9a877 341 */
ganlikun 0:13413ea9a877 342
ganlikun 0:13413ea9a877 343 /** @defgroup USART_LL_EM_WRITE_READ Common Write and read registers Macros
ganlikun 0:13413ea9a877 344 * @{
ganlikun 0:13413ea9a877 345 */
ganlikun 0:13413ea9a877 346
ganlikun 0:13413ea9a877 347 /**
ganlikun 0:13413ea9a877 348 * @brief Write a value in USART register
ganlikun 0:13413ea9a877 349 * @param __INSTANCE__ USART Instance
ganlikun 0:13413ea9a877 350 * @param __REG__ Register to be written
ganlikun 0:13413ea9a877 351 * @param __VALUE__ Value to be written in the register
ganlikun 0:13413ea9a877 352 * @retval None
ganlikun 0:13413ea9a877 353 */
ganlikun 0:13413ea9a877 354 #define LL_USART_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__))
ganlikun 0:13413ea9a877 355
ganlikun 0:13413ea9a877 356 /**
ganlikun 0:13413ea9a877 357 * @brief Read a value in USART register
ganlikun 0:13413ea9a877 358 * @param __INSTANCE__ USART Instance
ganlikun 0:13413ea9a877 359 * @param __REG__ Register to be read
ganlikun 0:13413ea9a877 360 * @retval Register value
ganlikun 0:13413ea9a877 361 */
ganlikun 0:13413ea9a877 362 #define LL_USART_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__)
ganlikun 0:13413ea9a877 363 /**
ganlikun 0:13413ea9a877 364 * @}
ganlikun 0:13413ea9a877 365 */
ganlikun 0:13413ea9a877 366
ganlikun 0:13413ea9a877 367 /** @defgroup USART_LL_EM_Exported_Macros_Helper Exported_Macros_Helper
ganlikun 0:13413ea9a877 368 * @{
ganlikun 0:13413ea9a877 369 */
ganlikun 0:13413ea9a877 370
ganlikun 0:13413ea9a877 371 /**
ganlikun 0:13413ea9a877 372 * @brief Compute USARTDIV value according to Peripheral Clock and
ganlikun 0:13413ea9a877 373 * expected Baud Rate in 8 bits sampling mode (32 bits value of USARTDIV is returned)
ganlikun 0:13413ea9a877 374 * @param __PERIPHCLK__ Peripheral Clock frequency used for USART instance
ganlikun 0:13413ea9a877 375 * @param __BAUDRATE__ Baud rate value to achieve
ganlikun 0:13413ea9a877 376 * @retval USARTDIV value to be used for BRR register filling in OverSampling_8 case
ganlikun 0:13413ea9a877 377 */
ganlikun 0:13413ea9a877 378 #define __LL_USART_DIV_SAMPLING8_100(__PERIPHCLK__, __BAUDRATE__) (((__PERIPHCLK__)*25)/(2*(__BAUDRATE__)))
ganlikun 0:13413ea9a877 379 #define __LL_USART_DIVMANT_SAMPLING8(__PERIPHCLK__, __BAUDRATE__) (__LL_USART_DIV_SAMPLING8_100((__PERIPHCLK__), (__BAUDRATE__))/100)
ganlikun 0:13413ea9a877 380 #define __LL_USART_DIVFRAQ_SAMPLING8(__PERIPHCLK__, __BAUDRATE__) (((__LL_USART_DIV_SAMPLING8_100((__PERIPHCLK__), (__BAUDRATE__)) - (__LL_USART_DIVMANT_SAMPLING8((__PERIPHCLK__), (__BAUDRATE__)) * 100)) * 8 + 50) / 100)
ganlikun 0:13413ea9a877 381 /* UART BRR = mantissa + overflow + fraction
ganlikun 0:13413ea9a877 382 = (UART DIVMANT << 4) + ((UART DIVFRAQ & 0xF8) << 1) + (UART DIVFRAQ & 0x07) */
ganlikun 0:13413ea9a877 383 #define __LL_USART_DIV_SAMPLING8(__PERIPHCLK__, __BAUDRATE__) (((__LL_USART_DIVMANT_SAMPLING8((__PERIPHCLK__), (__BAUDRATE__)) << 4) + \
ganlikun 0:13413ea9a877 384 ((__LL_USART_DIVFRAQ_SAMPLING8((__PERIPHCLK__), (__BAUDRATE__)) & 0xF8) << 1)) + \
ganlikun 0:13413ea9a877 385 (__LL_USART_DIVFRAQ_SAMPLING8((__PERIPHCLK__), (__BAUDRATE__)) & 0x07))
ganlikun 0:13413ea9a877 386
ganlikun 0:13413ea9a877 387 /**
ganlikun 0:13413ea9a877 388 * @brief Compute USARTDIV value according to Peripheral Clock and
ganlikun 0:13413ea9a877 389 * expected Baud Rate in 16 bits sampling mode (32 bits value of USARTDIV is returned)
ganlikun 0:13413ea9a877 390 * @param __PERIPHCLK__ Peripheral Clock frequency used for USART instance
ganlikun 0:13413ea9a877 391 * @param __BAUDRATE__ Baud rate value to achieve
ganlikun 0:13413ea9a877 392 * @retval USARTDIV value to be used for BRR register filling in OverSampling_16 case
ganlikun 0:13413ea9a877 393 */
ganlikun 0:13413ea9a877 394 #define __LL_USART_DIV_SAMPLING16_100(__PERIPHCLK__, __BAUDRATE__) (((__PERIPHCLK__)*25)/(4*(__BAUDRATE__)))
ganlikun 0:13413ea9a877 395 #define __LL_USART_DIVMANT_SAMPLING16(__PERIPHCLK__, __BAUDRATE__) (__LL_USART_DIV_SAMPLING16_100((__PERIPHCLK__), (__BAUDRATE__))/100)
ganlikun 0:13413ea9a877 396 #define __LL_USART_DIVFRAQ_SAMPLING16(__PERIPHCLK__, __BAUDRATE__) (((__LL_USART_DIV_SAMPLING16_100((__PERIPHCLK__), (__BAUDRATE__)) - (__LL_USART_DIVMANT_SAMPLING16((__PERIPHCLK__), (__BAUDRATE__)) * 100)) * 16 + 50) / 100)
ganlikun 0:13413ea9a877 397 /* USART BRR = mantissa + overflow + fraction
ganlikun 0:13413ea9a877 398 = (USART DIVMANT << 4) + (USART DIVFRAQ & 0xF0) + (USART DIVFRAQ & 0x0F) */
ganlikun 0:13413ea9a877 399 #define __LL_USART_DIV_SAMPLING16(__PERIPHCLK__, __BAUDRATE__) (((__LL_USART_DIVMANT_SAMPLING16((__PERIPHCLK__), (__BAUDRATE__)) << 4) + \
ganlikun 0:13413ea9a877 400 (__LL_USART_DIVFRAQ_SAMPLING16((__PERIPHCLK__), (__BAUDRATE__)) & 0xF0)) + \
ganlikun 0:13413ea9a877 401 (__LL_USART_DIVFRAQ_SAMPLING16((__PERIPHCLK__), (__BAUDRATE__)) & 0x0F))
ganlikun 0:13413ea9a877 402
ganlikun 0:13413ea9a877 403 /**
ganlikun 0:13413ea9a877 404 * @}
ganlikun 0:13413ea9a877 405 */
ganlikun 0:13413ea9a877 406
ganlikun 0:13413ea9a877 407 /**
ganlikun 0:13413ea9a877 408 * @}
ganlikun 0:13413ea9a877 409 */
ganlikun 0:13413ea9a877 410
ganlikun 0:13413ea9a877 411 /* Exported functions --------------------------------------------------------*/
ganlikun 0:13413ea9a877 412
ganlikun 0:13413ea9a877 413 /** @defgroup USART_LL_Exported_Functions USART Exported Functions
ganlikun 0:13413ea9a877 414 * @{
ganlikun 0:13413ea9a877 415 */
ganlikun 0:13413ea9a877 416
ganlikun 0:13413ea9a877 417 /** @defgroup USART_LL_EF_Configuration Configuration functions
ganlikun 0:13413ea9a877 418 * @{
ganlikun 0:13413ea9a877 419 */
ganlikun 0:13413ea9a877 420
ganlikun 0:13413ea9a877 421 /**
ganlikun 0:13413ea9a877 422 * @brief USART Enable
ganlikun 0:13413ea9a877 423 * @rmtoll CR1 UE LL_USART_Enable
ganlikun 0:13413ea9a877 424 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 425 * @retval None
ganlikun 0:13413ea9a877 426 */
ganlikun 0:13413ea9a877 427 __STATIC_INLINE void LL_USART_Enable(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 428 {
ganlikun 0:13413ea9a877 429 SET_BIT(USARTx->CR1, USART_CR1_UE);
ganlikun 0:13413ea9a877 430 }
ganlikun 0:13413ea9a877 431
ganlikun 0:13413ea9a877 432 /**
ganlikun 0:13413ea9a877 433 * @brief USART Disable (all USART prescalers and outputs are disabled)
ganlikun 0:13413ea9a877 434 * @note When USART is disabled, USART prescalers and outputs are stopped immediately,
ganlikun 0:13413ea9a877 435 * and current operations are discarded. The configuration of the USART is kept, but all the status
ganlikun 0:13413ea9a877 436 * flags, in the USARTx_SR are set to their default values.
ganlikun 0:13413ea9a877 437 * @rmtoll CR1 UE LL_USART_Disable
ganlikun 0:13413ea9a877 438 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 439 * @retval None
ganlikun 0:13413ea9a877 440 */
ganlikun 0:13413ea9a877 441 __STATIC_INLINE void LL_USART_Disable(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 442 {
ganlikun 0:13413ea9a877 443 CLEAR_BIT(USARTx->CR1, USART_CR1_UE);
ganlikun 0:13413ea9a877 444 }
ganlikun 0:13413ea9a877 445
ganlikun 0:13413ea9a877 446 /**
ganlikun 0:13413ea9a877 447 * @brief Indicate if USART is enabled
ganlikun 0:13413ea9a877 448 * @rmtoll CR1 UE LL_USART_IsEnabled
ganlikun 0:13413ea9a877 449 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 450 * @retval State of bit (1 or 0).
ganlikun 0:13413ea9a877 451 */
ganlikun 0:13413ea9a877 452 __STATIC_INLINE uint32_t LL_USART_IsEnabled(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 453 {
ganlikun 0:13413ea9a877 454 return (READ_BIT(USARTx->CR1, USART_CR1_UE) == (USART_CR1_UE));
ganlikun 0:13413ea9a877 455 }
ganlikun 0:13413ea9a877 456
ganlikun 0:13413ea9a877 457 /**
ganlikun 0:13413ea9a877 458 * @brief Receiver Enable (Receiver is enabled and begins searching for a start bit)
ganlikun 0:13413ea9a877 459 * @rmtoll CR1 RE LL_USART_EnableDirectionRx
ganlikun 0:13413ea9a877 460 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 461 * @retval None
ganlikun 0:13413ea9a877 462 */
ganlikun 0:13413ea9a877 463 __STATIC_INLINE void LL_USART_EnableDirectionRx(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 464 {
ganlikun 0:13413ea9a877 465 SET_BIT(USARTx->CR1, USART_CR1_RE);
ganlikun 0:13413ea9a877 466 }
ganlikun 0:13413ea9a877 467
ganlikun 0:13413ea9a877 468 /**
ganlikun 0:13413ea9a877 469 * @brief Receiver Disable
ganlikun 0:13413ea9a877 470 * @rmtoll CR1 RE LL_USART_DisableDirectionRx
ganlikun 0:13413ea9a877 471 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 472 * @retval None
ganlikun 0:13413ea9a877 473 */
ganlikun 0:13413ea9a877 474 __STATIC_INLINE void LL_USART_DisableDirectionRx(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 475 {
ganlikun 0:13413ea9a877 476 CLEAR_BIT(USARTx->CR1, USART_CR1_RE);
ganlikun 0:13413ea9a877 477 }
ganlikun 0:13413ea9a877 478
ganlikun 0:13413ea9a877 479 /**
ganlikun 0:13413ea9a877 480 * @brief Transmitter Enable
ganlikun 0:13413ea9a877 481 * @rmtoll CR1 TE LL_USART_EnableDirectionTx
ganlikun 0:13413ea9a877 482 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 483 * @retval None
ganlikun 0:13413ea9a877 484 */
ganlikun 0:13413ea9a877 485 __STATIC_INLINE void LL_USART_EnableDirectionTx(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 486 {
ganlikun 0:13413ea9a877 487 SET_BIT(USARTx->CR1, USART_CR1_TE);
ganlikun 0:13413ea9a877 488 }
ganlikun 0:13413ea9a877 489
ganlikun 0:13413ea9a877 490 /**
ganlikun 0:13413ea9a877 491 * @brief Transmitter Disable
ganlikun 0:13413ea9a877 492 * @rmtoll CR1 TE LL_USART_DisableDirectionTx
ganlikun 0:13413ea9a877 493 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 494 * @retval None
ganlikun 0:13413ea9a877 495 */
ganlikun 0:13413ea9a877 496 __STATIC_INLINE void LL_USART_DisableDirectionTx(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 497 {
ganlikun 0:13413ea9a877 498 CLEAR_BIT(USARTx->CR1, USART_CR1_TE);
ganlikun 0:13413ea9a877 499 }
ganlikun 0:13413ea9a877 500
ganlikun 0:13413ea9a877 501 /**
ganlikun 0:13413ea9a877 502 * @brief Configure simultaneously enabled/disabled states
ganlikun 0:13413ea9a877 503 * of Transmitter and Receiver
ganlikun 0:13413ea9a877 504 * @rmtoll CR1 RE LL_USART_SetTransferDirection\n
ganlikun 0:13413ea9a877 505 * CR1 TE LL_USART_SetTransferDirection
ganlikun 0:13413ea9a877 506 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 507 * @param TransferDirection This parameter can be one of the following values:
ganlikun 0:13413ea9a877 508 * @arg @ref LL_USART_DIRECTION_NONE
ganlikun 0:13413ea9a877 509 * @arg @ref LL_USART_DIRECTION_RX
ganlikun 0:13413ea9a877 510 * @arg @ref LL_USART_DIRECTION_TX
ganlikun 0:13413ea9a877 511 * @arg @ref LL_USART_DIRECTION_TX_RX
ganlikun 0:13413ea9a877 512 * @retval None
ganlikun 0:13413ea9a877 513 */
ganlikun 0:13413ea9a877 514 __STATIC_INLINE void LL_USART_SetTransferDirection(USART_TypeDef *USARTx, uint32_t TransferDirection)
ganlikun 0:13413ea9a877 515 {
ganlikun 0:13413ea9a877 516 MODIFY_REG(USARTx->CR1, USART_CR1_RE | USART_CR1_TE, TransferDirection);
ganlikun 0:13413ea9a877 517 }
ganlikun 0:13413ea9a877 518
ganlikun 0:13413ea9a877 519 /**
ganlikun 0:13413ea9a877 520 * @brief Return enabled/disabled states of Transmitter and Receiver
ganlikun 0:13413ea9a877 521 * @rmtoll CR1 RE LL_USART_GetTransferDirection\n
ganlikun 0:13413ea9a877 522 * CR1 TE LL_USART_GetTransferDirection
ganlikun 0:13413ea9a877 523 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 524 * @retval Returned value can be one of the following values:
ganlikun 0:13413ea9a877 525 * @arg @ref LL_USART_DIRECTION_NONE
ganlikun 0:13413ea9a877 526 * @arg @ref LL_USART_DIRECTION_RX
ganlikun 0:13413ea9a877 527 * @arg @ref LL_USART_DIRECTION_TX
ganlikun 0:13413ea9a877 528 * @arg @ref LL_USART_DIRECTION_TX_RX
ganlikun 0:13413ea9a877 529 */
ganlikun 0:13413ea9a877 530 __STATIC_INLINE uint32_t LL_USART_GetTransferDirection(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 531 {
ganlikun 0:13413ea9a877 532 return (uint32_t)(READ_BIT(USARTx->CR1, USART_CR1_RE | USART_CR1_TE));
ganlikun 0:13413ea9a877 533 }
ganlikun 0:13413ea9a877 534
ganlikun 0:13413ea9a877 535 /**
ganlikun 0:13413ea9a877 536 * @brief Configure Parity (enabled/disabled and parity mode if enabled).
ganlikun 0:13413ea9a877 537 * @note This function selects if hardware parity control (generation and detection) is enabled or disabled.
ganlikun 0:13413ea9a877 538 * When the parity control is enabled (Odd or Even), computed parity bit is inserted at the MSB position
ganlikun 0:13413ea9a877 539 * (9th or 8th bit depending on data width) and parity is checked on the received data.
ganlikun 0:13413ea9a877 540 * @rmtoll CR1 PS LL_USART_SetParity\n
ganlikun 0:13413ea9a877 541 * CR1 PCE LL_USART_SetParity
ganlikun 0:13413ea9a877 542 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 543 * @param Parity This parameter can be one of the following values:
ganlikun 0:13413ea9a877 544 * @arg @ref LL_USART_PARITY_NONE
ganlikun 0:13413ea9a877 545 * @arg @ref LL_USART_PARITY_EVEN
ganlikun 0:13413ea9a877 546 * @arg @ref LL_USART_PARITY_ODD
ganlikun 0:13413ea9a877 547 * @retval None
ganlikun 0:13413ea9a877 548 */
ganlikun 0:13413ea9a877 549 __STATIC_INLINE void LL_USART_SetParity(USART_TypeDef *USARTx, uint32_t Parity)
ganlikun 0:13413ea9a877 550 {
ganlikun 0:13413ea9a877 551 MODIFY_REG(USARTx->CR1, USART_CR1_PS | USART_CR1_PCE, Parity);
ganlikun 0:13413ea9a877 552 }
ganlikun 0:13413ea9a877 553
ganlikun 0:13413ea9a877 554 /**
ganlikun 0:13413ea9a877 555 * @brief Return Parity configuration (enabled/disabled and parity mode if enabled)
ganlikun 0:13413ea9a877 556 * @rmtoll CR1 PS LL_USART_GetParity\n
ganlikun 0:13413ea9a877 557 * CR1 PCE LL_USART_GetParity
ganlikun 0:13413ea9a877 558 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 559 * @retval Returned value can be one of the following values:
ganlikun 0:13413ea9a877 560 * @arg @ref LL_USART_PARITY_NONE
ganlikun 0:13413ea9a877 561 * @arg @ref LL_USART_PARITY_EVEN
ganlikun 0:13413ea9a877 562 * @arg @ref LL_USART_PARITY_ODD
ganlikun 0:13413ea9a877 563 */
ganlikun 0:13413ea9a877 564 __STATIC_INLINE uint32_t LL_USART_GetParity(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 565 {
ganlikun 0:13413ea9a877 566 return (uint32_t)(READ_BIT(USARTx->CR1, USART_CR1_PS | USART_CR1_PCE));
ganlikun 0:13413ea9a877 567 }
ganlikun 0:13413ea9a877 568
ganlikun 0:13413ea9a877 569 /**
ganlikun 0:13413ea9a877 570 * @brief Set Receiver Wake Up method from Mute mode.
ganlikun 0:13413ea9a877 571 * @rmtoll CR1 WAKE LL_USART_SetWakeUpMethod
ganlikun 0:13413ea9a877 572 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 573 * @param Method This parameter can be one of the following values:
ganlikun 0:13413ea9a877 574 * @arg @ref LL_USART_WAKEUP_IDLELINE
ganlikun 0:13413ea9a877 575 * @arg @ref LL_USART_WAKEUP_ADDRESSMARK
ganlikun 0:13413ea9a877 576 * @retval None
ganlikun 0:13413ea9a877 577 */
ganlikun 0:13413ea9a877 578 __STATIC_INLINE void LL_USART_SetWakeUpMethod(USART_TypeDef *USARTx, uint32_t Method)
ganlikun 0:13413ea9a877 579 {
ganlikun 0:13413ea9a877 580 MODIFY_REG(USARTx->CR1, USART_CR1_WAKE, Method);
ganlikun 0:13413ea9a877 581 }
ganlikun 0:13413ea9a877 582
ganlikun 0:13413ea9a877 583 /**
ganlikun 0:13413ea9a877 584 * @brief Return Receiver Wake Up method from Mute mode
ganlikun 0:13413ea9a877 585 * @rmtoll CR1 WAKE LL_USART_GetWakeUpMethod
ganlikun 0:13413ea9a877 586 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 587 * @retval Returned value can be one of the following values:
ganlikun 0:13413ea9a877 588 * @arg @ref LL_USART_WAKEUP_IDLELINE
ganlikun 0:13413ea9a877 589 * @arg @ref LL_USART_WAKEUP_ADDRESSMARK
ganlikun 0:13413ea9a877 590 */
ganlikun 0:13413ea9a877 591 __STATIC_INLINE uint32_t LL_USART_GetWakeUpMethod(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 592 {
ganlikun 0:13413ea9a877 593 return (uint32_t)(READ_BIT(USARTx->CR1, USART_CR1_WAKE));
ganlikun 0:13413ea9a877 594 }
ganlikun 0:13413ea9a877 595
ganlikun 0:13413ea9a877 596 /**
ganlikun 0:13413ea9a877 597 * @brief Set Word length (i.e. nb of data bits, excluding start and stop bits)
ganlikun 0:13413ea9a877 598 * @rmtoll CR1 M LL_USART_SetDataWidth
ganlikun 0:13413ea9a877 599 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 600 * @param DataWidth This parameter can be one of the following values:
ganlikun 0:13413ea9a877 601 * @arg @ref LL_USART_DATAWIDTH_8B
ganlikun 0:13413ea9a877 602 * @arg @ref LL_USART_DATAWIDTH_9B
ganlikun 0:13413ea9a877 603 * @retval None
ganlikun 0:13413ea9a877 604 */
ganlikun 0:13413ea9a877 605 __STATIC_INLINE void LL_USART_SetDataWidth(USART_TypeDef *USARTx, uint32_t DataWidth)
ganlikun 0:13413ea9a877 606 {
ganlikun 0:13413ea9a877 607 MODIFY_REG(USARTx->CR1, USART_CR1_M, DataWidth);
ganlikun 0:13413ea9a877 608 }
ganlikun 0:13413ea9a877 609
ganlikun 0:13413ea9a877 610 /**
ganlikun 0:13413ea9a877 611 * @brief Return Word length (i.e. nb of data bits, excluding start and stop bits)
ganlikun 0:13413ea9a877 612 * @rmtoll CR1 M LL_USART_GetDataWidth
ganlikun 0:13413ea9a877 613 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 614 * @retval Returned value can be one of the following values:
ganlikun 0:13413ea9a877 615 * @arg @ref LL_USART_DATAWIDTH_8B
ganlikun 0:13413ea9a877 616 * @arg @ref LL_USART_DATAWIDTH_9B
ganlikun 0:13413ea9a877 617 */
ganlikun 0:13413ea9a877 618 __STATIC_INLINE uint32_t LL_USART_GetDataWidth(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 619 {
ganlikun 0:13413ea9a877 620 return (uint32_t)(READ_BIT(USARTx->CR1, USART_CR1_M));
ganlikun 0:13413ea9a877 621 }
ganlikun 0:13413ea9a877 622
ganlikun 0:13413ea9a877 623 /**
ganlikun 0:13413ea9a877 624 * @brief Set Oversampling to 8-bit or 16-bit mode
ganlikun 0:13413ea9a877 625 * @rmtoll CR1 OVER8 LL_USART_SetOverSampling
ganlikun 0:13413ea9a877 626 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 627 * @param OverSampling This parameter can be one of the following values:
ganlikun 0:13413ea9a877 628 * @arg @ref LL_USART_OVERSAMPLING_16
ganlikun 0:13413ea9a877 629 * @arg @ref LL_USART_OVERSAMPLING_8
ganlikun 0:13413ea9a877 630 * @retval None
ganlikun 0:13413ea9a877 631 */
ganlikun 0:13413ea9a877 632 __STATIC_INLINE void LL_USART_SetOverSampling(USART_TypeDef *USARTx, uint32_t OverSampling)
ganlikun 0:13413ea9a877 633 {
ganlikun 0:13413ea9a877 634 MODIFY_REG(USARTx->CR1, USART_CR1_OVER8, OverSampling);
ganlikun 0:13413ea9a877 635 }
ganlikun 0:13413ea9a877 636
ganlikun 0:13413ea9a877 637 /**
ganlikun 0:13413ea9a877 638 * @brief Return Oversampling mode
ganlikun 0:13413ea9a877 639 * @rmtoll CR1 OVER8 LL_USART_GetOverSampling
ganlikun 0:13413ea9a877 640 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 641 * @retval Returned value can be one of the following values:
ganlikun 0:13413ea9a877 642 * @arg @ref LL_USART_OVERSAMPLING_16
ganlikun 0:13413ea9a877 643 * @arg @ref LL_USART_OVERSAMPLING_8
ganlikun 0:13413ea9a877 644 */
ganlikun 0:13413ea9a877 645 __STATIC_INLINE uint32_t LL_USART_GetOverSampling(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 646 {
ganlikun 0:13413ea9a877 647 return (uint32_t)(READ_BIT(USARTx->CR1, USART_CR1_OVER8));
ganlikun 0:13413ea9a877 648 }
ganlikun 0:13413ea9a877 649
ganlikun 0:13413ea9a877 650 /**
ganlikun 0:13413ea9a877 651 * @brief Configure if Clock pulse of the last data bit is output to the SCLK pin or not
ganlikun 0:13413ea9a877 652 * @note Macro @ref IS_USART_INSTANCE(USARTx) can be used to check whether or not
ganlikun 0:13413ea9a877 653 * Synchronous mode is supported by the USARTx instance.
ganlikun 0:13413ea9a877 654 * @rmtoll CR2 LBCL LL_USART_SetLastClkPulseOutput
ganlikun 0:13413ea9a877 655 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 656 * @param LastBitClockPulse This parameter can be one of the following values:
ganlikun 0:13413ea9a877 657 * @arg @ref LL_USART_LASTCLKPULSE_NO_OUTPUT
ganlikun 0:13413ea9a877 658 * @arg @ref LL_USART_LASTCLKPULSE_OUTPUT
ganlikun 0:13413ea9a877 659 * @retval None
ganlikun 0:13413ea9a877 660 */
ganlikun 0:13413ea9a877 661 __STATIC_INLINE void LL_USART_SetLastClkPulseOutput(USART_TypeDef *USARTx, uint32_t LastBitClockPulse)
ganlikun 0:13413ea9a877 662 {
ganlikun 0:13413ea9a877 663 MODIFY_REG(USARTx->CR2, USART_CR2_LBCL, LastBitClockPulse);
ganlikun 0:13413ea9a877 664 }
ganlikun 0:13413ea9a877 665
ganlikun 0:13413ea9a877 666 /**
ganlikun 0:13413ea9a877 667 * @brief Retrieve Clock pulse of the last data bit output configuration
ganlikun 0:13413ea9a877 668 * (Last bit Clock pulse output to the SCLK pin or not)
ganlikun 0:13413ea9a877 669 * @note Macro @ref IS_USART_INSTANCE(USARTx) can be used to check whether or not
ganlikun 0:13413ea9a877 670 * Synchronous mode is supported by the USARTx instance.
ganlikun 0:13413ea9a877 671 * @rmtoll CR2 LBCL LL_USART_GetLastClkPulseOutput
ganlikun 0:13413ea9a877 672 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 673 * @retval Returned value can be one of the following values:
ganlikun 0:13413ea9a877 674 * @arg @ref LL_USART_LASTCLKPULSE_NO_OUTPUT
ganlikun 0:13413ea9a877 675 * @arg @ref LL_USART_LASTCLKPULSE_OUTPUT
ganlikun 0:13413ea9a877 676 */
ganlikun 0:13413ea9a877 677 __STATIC_INLINE uint32_t LL_USART_GetLastClkPulseOutput(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 678 {
ganlikun 0:13413ea9a877 679 return (uint32_t)(READ_BIT(USARTx->CR2, USART_CR2_LBCL));
ganlikun 0:13413ea9a877 680 }
ganlikun 0:13413ea9a877 681
ganlikun 0:13413ea9a877 682 /**
ganlikun 0:13413ea9a877 683 * @brief Select the phase of the clock output on the SCLK pin in synchronous mode
ganlikun 0:13413ea9a877 684 * @note Macro @ref IS_USART_INSTANCE(USARTx) can be used to check whether or not
ganlikun 0:13413ea9a877 685 * Synchronous mode is supported by the USARTx instance.
ganlikun 0:13413ea9a877 686 * @rmtoll CR2 CPHA LL_USART_SetClockPhase
ganlikun 0:13413ea9a877 687 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 688 * @param ClockPhase This parameter can be one of the following values:
ganlikun 0:13413ea9a877 689 * @arg @ref LL_USART_PHASE_1EDGE
ganlikun 0:13413ea9a877 690 * @arg @ref LL_USART_PHASE_2EDGE
ganlikun 0:13413ea9a877 691 * @retval None
ganlikun 0:13413ea9a877 692 */
ganlikun 0:13413ea9a877 693 __STATIC_INLINE void LL_USART_SetClockPhase(USART_TypeDef *USARTx, uint32_t ClockPhase)
ganlikun 0:13413ea9a877 694 {
ganlikun 0:13413ea9a877 695 MODIFY_REG(USARTx->CR2, USART_CR2_CPHA, ClockPhase);
ganlikun 0:13413ea9a877 696 }
ganlikun 0:13413ea9a877 697
ganlikun 0:13413ea9a877 698 /**
ganlikun 0:13413ea9a877 699 * @brief Return phase of the clock output on the SCLK pin in synchronous mode
ganlikun 0:13413ea9a877 700 * @note Macro @ref IS_USART_INSTANCE(USARTx) can be used to check whether or not
ganlikun 0:13413ea9a877 701 * Synchronous mode is supported by the USARTx instance.
ganlikun 0:13413ea9a877 702 * @rmtoll CR2 CPHA LL_USART_GetClockPhase
ganlikun 0:13413ea9a877 703 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 704 * @retval Returned value can be one of the following values:
ganlikun 0:13413ea9a877 705 * @arg @ref LL_USART_PHASE_1EDGE
ganlikun 0:13413ea9a877 706 * @arg @ref LL_USART_PHASE_2EDGE
ganlikun 0:13413ea9a877 707 */
ganlikun 0:13413ea9a877 708 __STATIC_INLINE uint32_t LL_USART_GetClockPhase(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 709 {
ganlikun 0:13413ea9a877 710 return (uint32_t)(READ_BIT(USARTx->CR2, USART_CR2_CPHA));
ganlikun 0:13413ea9a877 711 }
ganlikun 0:13413ea9a877 712
ganlikun 0:13413ea9a877 713 /**
ganlikun 0:13413ea9a877 714 * @brief Select the polarity of the clock output on the SCLK pin in synchronous mode
ganlikun 0:13413ea9a877 715 * @note Macro @ref IS_USART_INSTANCE(USARTx) can be used to check whether or not
ganlikun 0:13413ea9a877 716 * Synchronous mode is supported by the USARTx instance.
ganlikun 0:13413ea9a877 717 * @rmtoll CR2 CPOL LL_USART_SetClockPolarity
ganlikun 0:13413ea9a877 718 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 719 * @param ClockPolarity This parameter can be one of the following values:
ganlikun 0:13413ea9a877 720 * @arg @ref LL_USART_POLARITY_LOW
ganlikun 0:13413ea9a877 721 * @arg @ref LL_USART_POLARITY_HIGH
ganlikun 0:13413ea9a877 722 * @retval None
ganlikun 0:13413ea9a877 723 */
ganlikun 0:13413ea9a877 724 __STATIC_INLINE void LL_USART_SetClockPolarity(USART_TypeDef *USARTx, uint32_t ClockPolarity)
ganlikun 0:13413ea9a877 725 {
ganlikun 0:13413ea9a877 726 MODIFY_REG(USARTx->CR2, USART_CR2_CPOL, ClockPolarity);
ganlikun 0:13413ea9a877 727 }
ganlikun 0:13413ea9a877 728
ganlikun 0:13413ea9a877 729 /**
ganlikun 0:13413ea9a877 730 * @brief Return polarity of the clock output on the SCLK pin in synchronous mode
ganlikun 0:13413ea9a877 731 * @note Macro @ref IS_USART_INSTANCE(USARTx) can be used to check whether or not
ganlikun 0:13413ea9a877 732 * Synchronous mode is supported by the USARTx instance.
ganlikun 0:13413ea9a877 733 * @rmtoll CR2 CPOL LL_USART_GetClockPolarity
ganlikun 0:13413ea9a877 734 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 735 * @retval Returned value can be one of the following values:
ganlikun 0:13413ea9a877 736 * @arg @ref LL_USART_POLARITY_LOW
ganlikun 0:13413ea9a877 737 * @arg @ref LL_USART_POLARITY_HIGH
ganlikun 0:13413ea9a877 738 */
ganlikun 0:13413ea9a877 739 __STATIC_INLINE uint32_t LL_USART_GetClockPolarity(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 740 {
ganlikun 0:13413ea9a877 741 return (uint32_t)(READ_BIT(USARTx->CR2, USART_CR2_CPOL));
ganlikun 0:13413ea9a877 742 }
ganlikun 0:13413ea9a877 743
ganlikun 0:13413ea9a877 744 /**
ganlikun 0:13413ea9a877 745 * @brief Configure Clock signal format (Phase Polarity and choice about output of last bit clock pulse)
ganlikun 0:13413ea9a877 746 * @note Macro @ref IS_USART_INSTANCE(USARTx) can be used to check whether or not
ganlikun 0:13413ea9a877 747 * Synchronous mode is supported by the USARTx instance.
ganlikun 0:13413ea9a877 748 * @note Call of this function is equivalent to following function call sequence :
ganlikun 0:13413ea9a877 749 * - Clock Phase configuration using @ref LL_USART_SetClockPhase() function
ganlikun 0:13413ea9a877 750 * - Clock Polarity configuration using @ref LL_USART_SetClockPolarity() function
ganlikun 0:13413ea9a877 751 * - Output of Last bit Clock pulse configuration using @ref LL_USART_SetLastClkPulseOutput() function
ganlikun 0:13413ea9a877 752 * @rmtoll CR2 CPHA LL_USART_ConfigClock\n
ganlikun 0:13413ea9a877 753 * CR2 CPOL LL_USART_ConfigClock\n
ganlikun 0:13413ea9a877 754 * CR2 LBCL LL_USART_ConfigClock
ganlikun 0:13413ea9a877 755 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 756 * @param Phase This parameter can be one of the following values:
ganlikun 0:13413ea9a877 757 * @arg @ref LL_USART_PHASE_1EDGE
ganlikun 0:13413ea9a877 758 * @arg @ref LL_USART_PHASE_2EDGE
ganlikun 0:13413ea9a877 759 * @param Polarity This parameter can be one of the following values:
ganlikun 0:13413ea9a877 760 * @arg @ref LL_USART_POLARITY_LOW
ganlikun 0:13413ea9a877 761 * @arg @ref LL_USART_POLARITY_HIGH
ganlikun 0:13413ea9a877 762 * @param LBCPOutput This parameter can be one of the following values:
ganlikun 0:13413ea9a877 763 * @arg @ref LL_USART_LASTCLKPULSE_NO_OUTPUT
ganlikun 0:13413ea9a877 764 * @arg @ref LL_USART_LASTCLKPULSE_OUTPUT
ganlikun 0:13413ea9a877 765 * @retval None
ganlikun 0:13413ea9a877 766 */
ganlikun 0:13413ea9a877 767 __STATIC_INLINE void LL_USART_ConfigClock(USART_TypeDef *USARTx, uint32_t Phase, uint32_t Polarity, uint32_t LBCPOutput)
ganlikun 0:13413ea9a877 768 {
ganlikun 0:13413ea9a877 769 MODIFY_REG(USARTx->CR2, USART_CR2_CPHA | USART_CR2_CPOL | USART_CR2_LBCL, Phase | Polarity | LBCPOutput);
ganlikun 0:13413ea9a877 770 }
ganlikun 0:13413ea9a877 771
ganlikun 0:13413ea9a877 772 /**
ganlikun 0:13413ea9a877 773 * @brief Enable Clock output on SCLK pin
ganlikun 0:13413ea9a877 774 * @note Macro @ref IS_USART_INSTANCE(USARTx) can be used to check whether or not
ganlikun 0:13413ea9a877 775 * Synchronous mode is supported by the USARTx instance.
ganlikun 0:13413ea9a877 776 * @rmtoll CR2 CLKEN LL_USART_EnableSCLKOutput
ganlikun 0:13413ea9a877 777 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 778 * @retval None
ganlikun 0:13413ea9a877 779 */
ganlikun 0:13413ea9a877 780 __STATIC_INLINE void LL_USART_EnableSCLKOutput(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 781 {
ganlikun 0:13413ea9a877 782 SET_BIT(USARTx->CR2, USART_CR2_CLKEN);
ganlikun 0:13413ea9a877 783 }
ganlikun 0:13413ea9a877 784
ganlikun 0:13413ea9a877 785 /**
ganlikun 0:13413ea9a877 786 * @brief Disable Clock output on SCLK pin
ganlikun 0:13413ea9a877 787 * @note Macro @ref IS_USART_INSTANCE(USARTx) can be used to check whether or not
ganlikun 0:13413ea9a877 788 * Synchronous mode is supported by the USARTx instance.
ganlikun 0:13413ea9a877 789 * @rmtoll CR2 CLKEN LL_USART_DisableSCLKOutput
ganlikun 0:13413ea9a877 790 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 791 * @retval None
ganlikun 0:13413ea9a877 792 */
ganlikun 0:13413ea9a877 793 __STATIC_INLINE void LL_USART_DisableSCLKOutput(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 794 {
ganlikun 0:13413ea9a877 795 CLEAR_BIT(USARTx->CR2, USART_CR2_CLKEN);
ganlikun 0:13413ea9a877 796 }
ganlikun 0:13413ea9a877 797
ganlikun 0:13413ea9a877 798 /**
ganlikun 0:13413ea9a877 799 * @brief Indicate if Clock output on SCLK pin is enabled
ganlikun 0:13413ea9a877 800 * @note Macro @ref IS_USART_INSTANCE(USARTx) can be used to check whether or not
ganlikun 0:13413ea9a877 801 * Synchronous mode is supported by the USARTx instance.
ganlikun 0:13413ea9a877 802 * @rmtoll CR2 CLKEN LL_USART_IsEnabledSCLKOutput
ganlikun 0:13413ea9a877 803 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 804 * @retval State of bit (1 or 0).
ganlikun 0:13413ea9a877 805 */
ganlikun 0:13413ea9a877 806 __STATIC_INLINE uint32_t LL_USART_IsEnabledSCLKOutput(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 807 {
ganlikun 0:13413ea9a877 808 return (READ_BIT(USARTx->CR2, USART_CR2_CLKEN) == (USART_CR2_CLKEN));
ganlikun 0:13413ea9a877 809 }
ganlikun 0:13413ea9a877 810
ganlikun 0:13413ea9a877 811 /**
ganlikun 0:13413ea9a877 812 * @brief Set the length of the stop bits
ganlikun 0:13413ea9a877 813 * @rmtoll CR2 STOP LL_USART_SetStopBitsLength
ganlikun 0:13413ea9a877 814 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 815 * @param StopBits This parameter can be one of the following values:
ganlikun 0:13413ea9a877 816 * @arg @ref LL_USART_STOPBITS_0_5
ganlikun 0:13413ea9a877 817 * @arg @ref LL_USART_STOPBITS_1
ganlikun 0:13413ea9a877 818 * @arg @ref LL_USART_STOPBITS_1_5
ganlikun 0:13413ea9a877 819 * @arg @ref LL_USART_STOPBITS_2
ganlikun 0:13413ea9a877 820 * @retval None
ganlikun 0:13413ea9a877 821 */
ganlikun 0:13413ea9a877 822 __STATIC_INLINE void LL_USART_SetStopBitsLength(USART_TypeDef *USARTx, uint32_t StopBits)
ganlikun 0:13413ea9a877 823 {
ganlikun 0:13413ea9a877 824 MODIFY_REG(USARTx->CR2, USART_CR2_STOP, StopBits);
ganlikun 0:13413ea9a877 825 }
ganlikun 0:13413ea9a877 826
ganlikun 0:13413ea9a877 827 /**
ganlikun 0:13413ea9a877 828 * @brief Retrieve the length of the stop bits
ganlikun 0:13413ea9a877 829 * @rmtoll CR2 STOP LL_USART_GetStopBitsLength
ganlikun 0:13413ea9a877 830 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 831 * @retval Returned value can be one of the following values:
ganlikun 0:13413ea9a877 832 * @arg @ref LL_USART_STOPBITS_0_5
ganlikun 0:13413ea9a877 833 * @arg @ref LL_USART_STOPBITS_1
ganlikun 0:13413ea9a877 834 * @arg @ref LL_USART_STOPBITS_1_5
ganlikun 0:13413ea9a877 835 * @arg @ref LL_USART_STOPBITS_2
ganlikun 0:13413ea9a877 836 */
ganlikun 0:13413ea9a877 837 __STATIC_INLINE uint32_t LL_USART_GetStopBitsLength(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 838 {
ganlikun 0:13413ea9a877 839 return (uint32_t)(READ_BIT(USARTx->CR2, USART_CR2_STOP));
ganlikun 0:13413ea9a877 840 }
ganlikun 0:13413ea9a877 841
ganlikun 0:13413ea9a877 842 /**
ganlikun 0:13413ea9a877 843 * @brief Configure Character frame format (Datawidth, Parity control, Stop Bits)
ganlikun 0:13413ea9a877 844 * @note Call of this function is equivalent to following function call sequence :
ganlikun 0:13413ea9a877 845 * - Data Width configuration using @ref LL_USART_SetDataWidth() function
ganlikun 0:13413ea9a877 846 * - Parity Control and mode configuration using @ref LL_USART_SetParity() function
ganlikun 0:13413ea9a877 847 * - Stop bits configuration using @ref LL_USART_SetStopBitsLength() function
ganlikun 0:13413ea9a877 848 * @rmtoll CR1 PS LL_USART_ConfigCharacter\n
ganlikun 0:13413ea9a877 849 * CR1 PCE LL_USART_ConfigCharacter\n
ganlikun 0:13413ea9a877 850 * CR1 M LL_USART_ConfigCharacter\n
ganlikun 0:13413ea9a877 851 * CR2 STOP LL_USART_ConfigCharacter
ganlikun 0:13413ea9a877 852 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 853 * @param DataWidth This parameter can be one of the following values:
ganlikun 0:13413ea9a877 854 * @arg @ref LL_USART_DATAWIDTH_8B
ganlikun 0:13413ea9a877 855 * @arg @ref LL_USART_DATAWIDTH_9B
ganlikun 0:13413ea9a877 856 * @param Parity This parameter can be one of the following values:
ganlikun 0:13413ea9a877 857 * @arg @ref LL_USART_PARITY_NONE
ganlikun 0:13413ea9a877 858 * @arg @ref LL_USART_PARITY_EVEN
ganlikun 0:13413ea9a877 859 * @arg @ref LL_USART_PARITY_ODD
ganlikun 0:13413ea9a877 860 * @param StopBits This parameter can be one of the following values:
ganlikun 0:13413ea9a877 861 * @arg @ref LL_USART_STOPBITS_0_5
ganlikun 0:13413ea9a877 862 * @arg @ref LL_USART_STOPBITS_1
ganlikun 0:13413ea9a877 863 * @arg @ref LL_USART_STOPBITS_1_5
ganlikun 0:13413ea9a877 864 * @arg @ref LL_USART_STOPBITS_2
ganlikun 0:13413ea9a877 865 * @retval None
ganlikun 0:13413ea9a877 866 */
ganlikun 0:13413ea9a877 867 __STATIC_INLINE void LL_USART_ConfigCharacter(USART_TypeDef *USARTx, uint32_t DataWidth, uint32_t Parity,
ganlikun 0:13413ea9a877 868 uint32_t StopBits)
ganlikun 0:13413ea9a877 869 {
ganlikun 0:13413ea9a877 870 MODIFY_REG(USARTx->CR1, USART_CR1_PS | USART_CR1_PCE | USART_CR1_M, Parity | DataWidth);
ganlikun 0:13413ea9a877 871 MODIFY_REG(USARTx->CR2, USART_CR2_STOP, StopBits);
ganlikun 0:13413ea9a877 872 }
ganlikun 0:13413ea9a877 873
ganlikun 0:13413ea9a877 874 /**
ganlikun 0:13413ea9a877 875 * @brief Set Address of the USART node.
ganlikun 0:13413ea9a877 876 * @note This is used in multiprocessor communication during Mute mode or Stop mode,
ganlikun 0:13413ea9a877 877 * for wake up with address mark detection.
ganlikun 0:13413ea9a877 878 * @rmtoll CR2 ADD LL_USART_SetNodeAddress
ganlikun 0:13413ea9a877 879 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 880 * @param NodeAddress 4 bit Address of the USART node.
ganlikun 0:13413ea9a877 881 * @retval None
ganlikun 0:13413ea9a877 882 */
ganlikun 0:13413ea9a877 883 __STATIC_INLINE void LL_USART_SetNodeAddress(USART_TypeDef *USARTx, uint32_t NodeAddress)
ganlikun 0:13413ea9a877 884 {
ganlikun 0:13413ea9a877 885 MODIFY_REG(USARTx->CR2, USART_CR2_ADD, (NodeAddress & USART_CR2_ADD));
ganlikun 0:13413ea9a877 886 }
ganlikun 0:13413ea9a877 887
ganlikun 0:13413ea9a877 888 /**
ganlikun 0:13413ea9a877 889 * @brief Return 4 bit Address of the USART node as set in ADD field of CR2.
ganlikun 0:13413ea9a877 890 * @note only 4bits (b3-b0) of returned value are relevant (b31-b4 are not relevant)
ganlikun 0:13413ea9a877 891 * @rmtoll CR2 ADD LL_USART_GetNodeAddress
ganlikun 0:13413ea9a877 892 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 893 * @retval Address of the USART node (Value between Min_Data=0 and Max_Data=255)
ganlikun 0:13413ea9a877 894 */
ganlikun 0:13413ea9a877 895 __STATIC_INLINE uint32_t LL_USART_GetNodeAddress(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 896 {
ganlikun 0:13413ea9a877 897 return (uint32_t)(READ_BIT(USARTx->CR2, USART_CR2_ADD));
ganlikun 0:13413ea9a877 898 }
ganlikun 0:13413ea9a877 899
ganlikun 0:13413ea9a877 900 /**
ganlikun 0:13413ea9a877 901 * @brief Enable RTS HW Flow Control
ganlikun 0:13413ea9a877 902 * @note Macro @ref IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not
ganlikun 0:13413ea9a877 903 * Hardware Flow control feature is supported by the USARTx instance.
ganlikun 0:13413ea9a877 904 * @rmtoll CR3 RTSE LL_USART_EnableRTSHWFlowCtrl
ganlikun 0:13413ea9a877 905 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 906 * @retval None
ganlikun 0:13413ea9a877 907 */
ganlikun 0:13413ea9a877 908 __STATIC_INLINE void LL_USART_EnableRTSHWFlowCtrl(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 909 {
ganlikun 0:13413ea9a877 910 SET_BIT(USARTx->CR3, USART_CR3_RTSE);
ganlikun 0:13413ea9a877 911 }
ganlikun 0:13413ea9a877 912
ganlikun 0:13413ea9a877 913 /**
ganlikun 0:13413ea9a877 914 * @brief Disable RTS HW Flow Control
ganlikun 0:13413ea9a877 915 * @note Macro @ref IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not
ganlikun 0:13413ea9a877 916 * Hardware Flow control feature is supported by the USARTx instance.
ganlikun 0:13413ea9a877 917 * @rmtoll CR3 RTSE LL_USART_DisableRTSHWFlowCtrl
ganlikun 0:13413ea9a877 918 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 919 * @retval None
ganlikun 0:13413ea9a877 920 */
ganlikun 0:13413ea9a877 921 __STATIC_INLINE void LL_USART_DisableRTSHWFlowCtrl(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 922 {
ganlikun 0:13413ea9a877 923 CLEAR_BIT(USARTx->CR3, USART_CR3_RTSE);
ganlikun 0:13413ea9a877 924 }
ganlikun 0:13413ea9a877 925
ganlikun 0:13413ea9a877 926 /**
ganlikun 0:13413ea9a877 927 * @brief Enable CTS HW Flow Control
ganlikun 0:13413ea9a877 928 * @note Macro @ref IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not
ganlikun 0:13413ea9a877 929 * Hardware Flow control feature is supported by the USARTx instance.
ganlikun 0:13413ea9a877 930 * @rmtoll CR3 CTSE LL_USART_EnableCTSHWFlowCtrl
ganlikun 0:13413ea9a877 931 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 932 * @retval None
ganlikun 0:13413ea9a877 933 */
ganlikun 0:13413ea9a877 934 __STATIC_INLINE void LL_USART_EnableCTSHWFlowCtrl(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 935 {
ganlikun 0:13413ea9a877 936 SET_BIT(USARTx->CR3, USART_CR3_CTSE);
ganlikun 0:13413ea9a877 937 }
ganlikun 0:13413ea9a877 938
ganlikun 0:13413ea9a877 939 /**
ganlikun 0:13413ea9a877 940 * @brief Disable CTS HW Flow Control
ganlikun 0:13413ea9a877 941 * @note Macro @ref IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not
ganlikun 0:13413ea9a877 942 * Hardware Flow control feature is supported by the USARTx instance.
ganlikun 0:13413ea9a877 943 * @rmtoll CR3 CTSE LL_USART_DisableCTSHWFlowCtrl
ganlikun 0:13413ea9a877 944 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 945 * @retval None
ganlikun 0:13413ea9a877 946 */
ganlikun 0:13413ea9a877 947 __STATIC_INLINE void LL_USART_DisableCTSHWFlowCtrl(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 948 {
ganlikun 0:13413ea9a877 949 CLEAR_BIT(USARTx->CR3, USART_CR3_CTSE);
ganlikun 0:13413ea9a877 950 }
ganlikun 0:13413ea9a877 951
ganlikun 0:13413ea9a877 952 /**
ganlikun 0:13413ea9a877 953 * @brief Configure HW Flow Control mode (both CTS and RTS)
ganlikun 0:13413ea9a877 954 * @note Macro @ref IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not
ganlikun 0:13413ea9a877 955 * Hardware Flow control feature is supported by the USARTx instance.
ganlikun 0:13413ea9a877 956 * @rmtoll CR3 RTSE LL_USART_SetHWFlowCtrl\n
ganlikun 0:13413ea9a877 957 * CR3 CTSE LL_USART_SetHWFlowCtrl
ganlikun 0:13413ea9a877 958 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 959 * @param HardwareFlowControl This parameter can be one of the following values:
ganlikun 0:13413ea9a877 960 * @arg @ref LL_USART_HWCONTROL_NONE
ganlikun 0:13413ea9a877 961 * @arg @ref LL_USART_HWCONTROL_RTS
ganlikun 0:13413ea9a877 962 * @arg @ref LL_USART_HWCONTROL_CTS
ganlikun 0:13413ea9a877 963 * @arg @ref LL_USART_HWCONTROL_RTS_CTS
ganlikun 0:13413ea9a877 964 * @retval None
ganlikun 0:13413ea9a877 965 */
ganlikun 0:13413ea9a877 966 __STATIC_INLINE void LL_USART_SetHWFlowCtrl(USART_TypeDef *USARTx, uint32_t HardwareFlowControl)
ganlikun 0:13413ea9a877 967 {
ganlikun 0:13413ea9a877 968 MODIFY_REG(USARTx->CR3, USART_CR3_RTSE | USART_CR3_CTSE, HardwareFlowControl);
ganlikun 0:13413ea9a877 969 }
ganlikun 0:13413ea9a877 970
ganlikun 0:13413ea9a877 971 /**
ganlikun 0:13413ea9a877 972 * @brief Return HW Flow Control configuration (both CTS and RTS)
ganlikun 0:13413ea9a877 973 * @note Macro @ref IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not
ganlikun 0:13413ea9a877 974 * Hardware Flow control feature is supported by the USARTx instance.
ganlikun 0:13413ea9a877 975 * @rmtoll CR3 RTSE LL_USART_GetHWFlowCtrl\n
ganlikun 0:13413ea9a877 976 * CR3 CTSE LL_USART_GetHWFlowCtrl
ganlikun 0:13413ea9a877 977 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 978 * @retval Returned value can be one of the following values:
ganlikun 0:13413ea9a877 979 * @arg @ref LL_USART_HWCONTROL_NONE
ganlikun 0:13413ea9a877 980 * @arg @ref LL_USART_HWCONTROL_RTS
ganlikun 0:13413ea9a877 981 * @arg @ref LL_USART_HWCONTROL_CTS
ganlikun 0:13413ea9a877 982 * @arg @ref LL_USART_HWCONTROL_RTS_CTS
ganlikun 0:13413ea9a877 983 */
ganlikun 0:13413ea9a877 984 __STATIC_INLINE uint32_t LL_USART_GetHWFlowCtrl(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 985 {
ganlikun 0:13413ea9a877 986 return (uint32_t)(READ_BIT(USARTx->CR3, USART_CR3_RTSE | USART_CR3_CTSE));
ganlikun 0:13413ea9a877 987 }
ganlikun 0:13413ea9a877 988
ganlikun 0:13413ea9a877 989 /**
ganlikun 0:13413ea9a877 990 * @brief Enable One bit sampling method
ganlikun 0:13413ea9a877 991 * @rmtoll CR3 ONEBIT LL_USART_EnableOneBitSamp
ganlikun 0:13413ea9a877 992 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 993 * @retval None
ganlikun 0:13413ea9a877 994 */
ganlikun 0:13413ea9a877 995 __STATIC_INLINE void LL_USART_EnableOneBitSamp(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 996 {
ganlikun 0:13413ea9a877 997 SET_BIT(USARTx->CR3, USART_CR3_ONEBIT);
ganlikun 0:13413ea9a877 998 }
ganlikun 0:13413ea9a877 999
ganlikun 0:13413ea9a877 1000 /**
ganlikun 0:13413ea9a877 1001 * @brief Disable One bit sampling method
ganlikun 0:13413ea9a877 1002 * @rmtoll CR3 ONEBIT LL_USART_DisableOneBitSamp
ganlikun 0:13413ea9a877 1003 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 1004 * @retval None
ganlikun 0:13413ea9a877 1005 */
ganlikun 0:13413ea9a877 1006 __STATIC_INLINE void LL_USART_DisableOneBitSamp(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 1007 {
ganlikun 0:13413ea9a877 1008 CLEAR_BIT(USARTx->CR3, USART_CR3_ONEBIT);
ganlikun 0:13413ea9a877 1009 }
ganlikun 0:13413ea9a877 1010
ganlikun 0:13413ea9a877 1011 /**
ganlikun 0:13413ea9a877 1012 * @brief Indicate if One bit sampling method is enabled
ganlikun 0:13413ea9a877 1013 * @rmtoll CR3 ONEBIT LL_USART_IsEnabledOneBitSamp
ganlikun 0:13413ea9a877 1014 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 1015 * @retval State of bit (1 or 0).
ganlikun 0:13413ea9a877 1016 */
ganlikun 0:13413ea9a877 1017 __STATIC_INLINE uint32_t LL_USART_IsEnabledOneBitSamp(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 1018 {
ganlikun 0:13413ea9a877 1019 return (READ_BIT(USARTx->CR3, USART_CR3_ONEBIT) == (USART_CR3_ONEBIT));
ganlikun 0:13413ea9a877 1020 }
ganlikun 0:13413ea9a877 1021
ganlikun 0:13413ea9a877 1022 /**
ganlikun 0:13413ea9a877 1023 * @brief Configure USART BRR register for achieving expected Baud Rate value.
ganlikun 0:13413ea9a877 1024 * @note Compute and set USARTDIV value in BRR Register (full BRR content)
ganlikun 0:13413ea9a877 1025 * according to used Peripheral Clock, Oversampling mode, and expected Baud Rate values
ganlikun 0:13413ea9a877 1026 * @note Peripheral clock and Baud rate values provided as function parameters should be valid
ganlikun 0:13413ea9a877 1027 * (Baud rate value != 0)
ganlikun 0:13413ea9a877 1028 * @rmtoll BRR BRR LL_USART_SetBaudRate
ganlikun 0:13413ea9a877 1029 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 1030 * @param PeriphClk Peripheral Clock
ganlikun 0:13413ea9a877 1031 * @param OverSampling This parameter can be one of the following values:
ganlikun 0:13413ea9a877 1032 * @arg @ref LL_USART_OVERSAMPLING_16
ganlikun 0:13413ea9a877 1033 * @arg @ref LL_USART_OVERSAMPLING_8
ganlikun 0:13413ea9a877 1034 * @param BaudRate Baud Rate
ganlikun 0:13413ea9a877 1035 * @retval None
ganlikun 0:13413ea9a877 1036 */
ganlikun 0:13413ea9a877 1037 __STATIC_INLINE void LL_USART_SetBaudRate(USART_TypeDef *USARTx, uint32_t PeriphClk, uint32_t OverSampling,
ganlikun 0:13413ea9a877 1038 uint32_t BaudRate)
ganlikun 0:13413ea9a877 1039 {
ganlikun 0:13413ea9a877 1040 if (OverSampling == LL_USART_OVERSAMPLING_8)
ganlikun 0:13413ea9a877 1041 {
ganlikun 0:13413ea9a877 1042 USARTx->BRR = (uint16_t)(__LL_USART_DIV_SAMPLING8(PeriphClk, BaudRate));
ganlikun 0:13413ea9a877 1043 }
ganlikun 0:13413ea9a877 1044 else
ganlikun 0:13413ea9a877 1045 {
ganlikun 0:13413ea9a877 1046 USARTx->BRR = (uint16_t)(__LL_USART_DIV_SAMPLING16(PeriphClk, BaudRate));
ganlikun 0:13413ea9a877 1047 }
ganlikun 0:13413ea9a877 1048 }
ganlikun 0:13413ea9a877 1049
ganlikun 0:13413ea9a877 1050 /**
ganlikun 0:13413ea9a877 1051 * @brief Return current Baud Rate value, according to USARTDIV present in BRR register
ganlikun 0:13413ea9a877 1052 * (full BRR content), and to used Peripheral Clock and Oversampling mode values
ganlikun 0:13413ea9a877 1053 * @note In case of non-initialized or invalid value stored in BRR register, value 0 will be returned.
ganlikun 0:13413ea9a877 1054 * @rmtoll BRR BRR LL_USART_GetBaudRate
ganlikun 0:13413ea9a877 1055 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 1056 * @param PeriphClk Peripheral Clock
ganlikun 0:13413ea9a877 1057 * @param OverSampling This parameter can be one of the following values:
ganlikun 0:13413ea9a877 1058 * @arg @ref LL_USART_OVERSAMPLING_16
ganlikun 0:13413ea9a877 1059 * @arg @ref LL_USART_OVERSAMPLING_8
ganlikun 0:13413ea9a877 1060 * @retval Baud Rate
ganlikun 0:13413ea9a877 1061 */
ganlikun 0:13413ea9a877 1062 __STATIC_INLINE uint32_t LL_USART_GetBaudRate(USART_TypeDef *USARTx, uint32_t PeriphClk, uint32_t OverSampling)
ganlikun 0:13413ea9a877 1063 {
ganlikun 0:13413ea9a877 1064 register uint32_t usartdiv = 0x0U;
ganlikun 0:13413ea9a877 1065 register uint32_t brrresult = 0x0U;
ganlikun 0:13413ea9a877 1066
ganlikun 0:13413ea9a877 1067 usartdiv = USARTx->BRR;
ganlikun 0:13413ea9a877 1068
ganlikun 0:13413ea9a877 1069 if (OverSampling == LL_USART_OVERSAMPLING_8)
ganlikun 0:13413ea9a877 1070 {
ganlikun 0:13413ea9a877 1071 if ((usartdiv & 0xFFF7U) != 0U)
ganlikun 0:13413ea9a877 1072 {
ganlikun 0:13413ea9a877 1073 usartdiv = (uint16_t)((usartdiv & 0xFFF0U) | ((usartdiv & 0x0007U) << 1U)) ;
ganlikun 0:13413ea9a877 1074 brrresult = (PeriphClk * 2U) / usartdiv;
ganlikun 0:13413ea9a877 1075 }
ganlikun 0:13413ea9a877 1076 }
ganlikun 0:13413ea9a877 1077 else
ganlikun 0:13413ea9a877 1078 {
ganlikun 0:13413ea9a877 1079 if ((usartdiv & 0xFFFFU) != 0U)
ganlikun 0:13413ea9a877 1080 {
ganlikun 0:13413ea9a877 1081 brrresult = PeriphClk / usartdiv;
ganlikun 0:13413ea9a877 1082 }
ganlikun 0:13413ea9a877 1083 }
ganlikun 0:13413ea9a877 1084 return (brrresult);
ganlikun 0:13413ea9a877 1085 }
ganlikun 0:13413ea9a877 1086
ganlikun 0:13413ea9a877 1087 /**
ganlikun 0:13413ea9a877 1088 * @}
ganlikun 0:13413ea9a877 1089 */
ganlikun 0:13413ea9a877 1090
ganlikun 0:13413ea9a877 1091 /** @defgroup USART_LL_EF_Configuration_IRDA Configuration functions related to Irda feature
ganlikun 0:13413ea9a877 1092 * @{
ganlikun 0:13413ea9a877 1093 */
ganlikun 0:13413ea9a877 1094
ganlikun 0:13413ea9a877 1095 /**
ganlikun 0:13413ea9a877 1096 * @brief Enable IrDA mode
ganlikun 0:13413ea9a877 1097 * @note Macro @ref IS_IRDA_INSTANCE(USARTx) can be used to check whether or not
ganlikun 0:13413ea9a877 1098 * IrDA feature is supported by the USARTx instance.
ganlikun 0:13413ea9a877 1099 * @rmtoll CR3 IREN LL_USART_EnableIrda
ganlikun 0:13413ea9a877 1100 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 1101 * @retval None
ganlikun 0:13413ea9a877 1102 */
ganlikun 0:13413ea9a877 1103 __STATIC_INLINE void LL_USART_EnableIrda(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 1104 {
ganlikun 0:13413ea9a877 1105 SET_BIT(USARTx->CR3, USART_CR3_IREN);
ganlikun 0:13413ea9a877 1106 }
ganlikun 0:13413ea9a877 1107
ganlikun 0:13413ea9a877 1108 /**
ganlikun 0:13413ea9a877 1109 * @brief Disable IrDA mode
ganlikun 0:13413ea9a877 1110 * @note Macro @ref IS_IRDA_INSTANCE(USARTx) can be used to check whether or not
ganlikun 0:13413ea9a877 1111 * IrDA feature is supported by the USARTx instance.
ganlikun 0:13413ea9a877 1112 * @rmtoll CR3 IREN LL_USART_DisableIrda
ganlikun 0:13413ea9a877 1113 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 1114 * @retval None
ganlikun 0:13413ea9a877 1115 */
ganlikun 0:13413ea9a877 1116 __STATIC_INLINE void LL_USART_DisableIrda(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 1117 {
ganlikun 0:13413ea9a877 1118 CLEAR_BIT(USARTx->CR3, USART_CR3_IREN);
ganlikun 0:13413ea9a877 1119 }
ganlikun 0:13413ea9a877 1120
ganlikun 0:13413ea9a877 1121 /**
ganlikun 0:13413ea9a877 1122 * @brief Indicate if IrDA mode is enabled
ganlikun 0:13413ea9a877 1123 * @note Macro @ref IS_IRDA_INSTANCE(USARTx) can be used to check whether or not
ganlikun 0:13413ea9a877 1124 * IrDA feature is supported by the USARTx instance.
ganlikun 0:13413ea9a877 1125 * @rmtoll CR3 IREN LL_USART_IsEnabledIrda
ganlikun 0:13413ea9a877 1126 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 1127 * @retval State of bit (1 or 0).
ganlikun 0:13413ea9a877 1128 */
ganlikun 0:13413ea9a877 1129 __STATIC_INLINE uint32_t LL_USART_IsEnabledIrda(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 1130 {
ganlikun 0:13413ea9a877 1131 return (READ_BIT(USARTx->CR3, USART_CR3_IREN) == (USART_CR3_IREN));
ganlikun 0:13413ea9a877 1132 }
ganlikun 0:13413ea9a877 1133
ganlikun 0:13413ea9a877 1134 /**
ganlikun 0:13413ea9a877 1135 * @brief Configure IrDA Power Mode (Normal or Low Power)
ganlikun 0:13413ea9a877 1136 * @note Macro @ref IS_IRDA_INSTANCE(USARTx) can be used to check whether or not
ganlikun 0:13413ea9a877 1137 * IrDA feature is supported by the USARTx instance.
ganlikun 0:13413ea9a877 1138 * @rmtoll CR3 IRLP LL_USART_SetIrdaPowerMode
ganlikun 0:13413ea9a877 1139 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 1140 * @param PowerMode This parameter can be one of the following values:
ganlikun 0:13413ea9a877 1141 * @arg @ref LL_USART_IRDA_POWER_NORMAL
ganlikun 0:13413ea9a877 1142 * @arg @ref LL_USART_IRDA_POWER_LOW
ganlikun 0:13413ea9a877 1143 * @retval None
ganlikun 0:13413ea9a877 1144 */
ganlikun 0:13413ea9a877 1145 __STATIC_INLINE void LL_USART_SetIrdaPowerMode(USART_TypeDef *USARTx, uint32_t PowerMode)
ganlikun 0:13413ea9a877 1146 {
ganlikun 0:13413ea9a877 1147 MODIFY_REG(USARTx->CR3, USART_CR3_IRLP, PowerMode);
ganlikun 0:13413ea9a877 1148 }
ganlikun 0:13413ea9a877 1149
ganlikun 0:13413ea9a877 1150 /**
ganlikun 0:13413ea9a877 1151 * @brief Retrieve IrDA Power Mode configuration (Normal or Low Power)
ganlikun 0:13413ea9a877 1152 * @note Macro @ref IS_IRDA_INSTANCE(USARTx) can be used to check whether or not
ganlikun 0:13413ea9a877 1153 * IrDA feature is supported by the USARTx instance.
ganlikun 0:13413ea9a877 1154 * @rmtoll CR3 IRLP LL_USART_GetIrdaPowerMode
ganlikun 0:13413ea9a877 1155 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 1156 * @retval Returned value can be one of the following values:
ganlikun 0:13413ea9a877 1157 * @arg @ref LL_USART_IRDA_POWER_NORMAL
ganlikun 0:13413ea9a877 1158 * @arg @ref LL_USART_PHASE_2EDGE
ganlikun 0:13413ea9a877 1159 */
ganlikun 0:13413ea9a877 1160 __STATIC_INLINE uint32_t LL_USART_GetIrdaPowerMode(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 1161 {
ganlikun 0:13413ea9a877 1162 return (uint32_t)(READ_BIT(USARTx->CR3, USART_CR3_IRLP));
ganlikun 0:13413ea9a877 1163 }
ganlikun 0:13413ea9a877 1164
ganlikun 0:13413ea9a877 1165 /**
ganlikun 0:13413ea9a877 1166 * @brief Set Irda prescaler value, used for dividing the USART clock source
ganlikun 0:13413ea9a877 1167 * to achieve the Irda Low Power frequency (8 bits value)
ganlikun 0:13413ea9a877 1168 * @note Macro @ref IS_IRDA_INSTANCE(USARTx) can be used to check whether or not
ganlikun 0:13413ea9a877 1169 * IrDA feature is supported by the USARTx instance.
ganlikun 0:13413ea9a877 1170 * @rmtoll GTPR PSC LL_USART_SetIrdaPrescaler
ganlikun 0:13413ea9a877 1171 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 1172 * @param PrescalerValue Value between Min_Data=0x00 and Max_Data=0xFF
ganlikun 0:13413ea9a877 1173 * @retval None
ganlikun 0:13413ea9a877 1174 */
ganlikun 0:13413ea9a877 1175 __STATIC_INLINE void LL_USART_SetIrdaPrescaler(USART_TypeDef *USARTx, uint32_t PrescalerValue)
ganlikun 0:13413ea9a877 1176 {
ganlikun 0:13413ea9a877 1177 MODIFY_REG(USARTx->GTPR, USART_GTPR_PSC, PrescalerValue);
ganlikun 0:13413ea9a877 1178 }
ganlikun 0:13413ea9a877 1179
ganlikun 0:13413ea9a877 1180 /**
ganlikun 0:13413ea9a877 1181 * @brief Return Irda prescaler value, used for dividing the USART clock source
ganlikun 0:13413ea9a877 1182 * to achieve the Irda Low Power frequency (8 bits value)
ganlikun 0:13413ea9a877 1183 * @note Macro @ref IS_IRDA_INSTANCE(USARTx) can be used to check whether or not
ganlikun 0:13413ea9a877 1184 * IrDA feature is supported by the USARTx instance.
ganlikun 0:13413ea9a877 1185 * @rmtoll GTPR PSC LL_USART_GetIrdaPrescaler
ganlikun 0:13413ea9a877 1186 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 1187 * @retval Irda prescaler value (Value between Min_Data=0x00 and Max_Data=0xFF)
ganlikun 0:13413ea9a877 1188 */
ganlikun 0:13413ea9a877 1189 __STATIC_INLINE uint32_t LL_USART_GetIrdaPrescaler(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 1190 {
ganlikun 0:13413ea9a877 1191 return (uint32_t)(READ_BIT(USARTx->GTPR, USART_GTPR_PSC));
ganlikun 0:13413ea9a877 1192 }
ganlikun 0:13413ea9a877 1193
ganlikun 0:13413ea9a877 1194 /**
ganlikun 0:13413ea9a877 1195 * @}
ganlikun 0:13413ea9a877 1196 */
ganlikun 0:13413ea9a877 1197
ganlikun 0:13413ea9a877 1198 /** @defgroup USART_LL_EF_Configuration_Smartcard Configuration functions related to Smartcard feature
ganlikun 0:13413ea9a877 1199 * @{
ganlikun 0:13413ea9a877 1200 */
ganlikun 0:13413ea9a877 1201
ganlikun 0:13413ea9a877 1202 /**
ganlikun 0:13413ea9a877 1203 * @brief Enable Smartcard NACK transmission
ganlikun 0:13413ea9a877 1204 * @note Macro @ref IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not
ganlikun 0:13413ea9a877 1205 * Smartcard feature is supported by the USARTx instance.
ganlikun 0:13413ea9a877 1206 * @rmtoll CR3 NACK LL_USART_EnableSmartcardNACK
ganlikun 0:13413ea9a877 1207 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 1208 * @retval None
ganlikun 0:13413ea9a877 1209 */
ganlikun 0:13413ea9a877 1210 __STATIC_INLINE void LL_USART_EnableSmartcardNACK(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 1211 {
ganlikun 0:13413ea9a877 1212 SET_BIT(USARTx->CR3, USART_CR3_NACK);
ganlikun 0:13413ea9a877 1213 }
ganlikun 0:13413ea9a877 1214
ganlikun 0:13413ea9a877 1215 /**
ganlikun 0:13413ea9a877 1216 * @brief Disable Smartcard NACK transmission
ganlikun 0:13413ea9a877 1217 * @note Macro @ref IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not
ganlikun 0:13413ea9a877 1218 * Smartcard feature is supported by the USARTx instance.
ganlikun 0:13413ea9a877 1219 * @rmtoll CR3 NACK LL_USART_DisableSmartcardNACK
ganlikun 0:13413ea9a877 1220 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 1221 * @retval None
ganlikun 0:13413ea9a877 1222 */
ganlikun 0:13413ea9a877 1223 __STATIC_INLINE void LL_USART_DisableSmartcardNACK(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 1224 {
ganlikun 0:13413ea9a877 1225 CLEAR_BIT(USARTx->CR3, USART_CR3_NACK);
ganlikun 0:13413ea9a877 1226 }
ganlikun 0:13413ea9a877 1227
ganlikun 0:13413ea9a877 1228 /**
ganlikun 0:13413ea9a877 1229 * @brief Indicate if Smartcard NACK transmission is enabled
ganlikun 0:13413ea9a877 1230 * @note Macro @ref IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not
ganlikun 0:13413ea9a877 1231 * Smartcard feature is supported by the USARTx instance.
ganlikun 0:13413ea9a877 1232 * @rmtoll CR3 NACK LL_USART_IsEnabledSmartcardNACK
ganlikun 0:13413ea9a877 1233 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 1234 * @retval State of bit (1 or 0).
ganlikun 0:13413ea9a877 1235 */
ganlikun 0:13413ea9a877 1236 __STATIC_INLINE uint32_t LL_USART_IsEnabledSmartcardNACK(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 1237 {
ganlikun 0:13413ea9a877 1238 return (READ_BIT(USARTx->CR3, USART_CR3_NACK) == (USART_CR3_NACK));
ganlikun 0:13413ea9a877 1239 }
ganlikun 0:13413ea9a877 1240
ganlikun 0:13413ea9a877 1241 /**
ganlikun 0:13413ea9a877 1242 * @brief Enable Smartcard mode
ganlikun 0:13413ea9a877 1243 * @note Macro @ref IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not
ganlikun 0:13413ea9a877 1244 * Smartcard feature is supported by the USARTx instance.
ganlikun 0:13413ea9a877 1245 * @rmtoll CR3 SCEN LL_USART_EnableSmartcard
ganlikun 0:13413ea9a877 1246 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 1247 * @retval None
ganlikun 0:13413ea9a877 1248 */
ganlikun 0:13413ea9a877 1249 __STATIC_INLINE void LL_USART_EnableSmartcard(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 1250 {
ganlikun 0:13413ea9a877 1251 SET_BIT(USARTx->CR3, USART_CR3_SCEN);
ganlikun 0:13413ea9a877 1252 }
ganlikun 0:13413ea9a877 1253
ganlikun 0:13413ea9a877 1254 /**
ganlikun 0:13413ea9a877 1255 * @brief Disable Smartcard mode
ganlikun 0:13413ea9a877 1256 * @note Macro @ref IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not
ganlikun 0:13413ea9a877 1257 * Smartcard feature is supported by the USARTx instance.
ganlikun 0:13413ea9a877 1258 * @rmtoll CR3 SCEN LL_USART_DisableSmartcard
ganlikun 0:13413ea9a877 1259 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 1260 * @retval None
ganlikun 0:13413ea9a877 1261 */
ganlikun 0:13413ea9a877 1262 __STATIC_INLINE void LL_USART_DisableSmartcard(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 1263 {
ganlikun 0:13413ea9a877 1264 CLEAR_BIT(USARTx->CR3, USART_CR3_SCEN);
ganlikun 0:13413ea9a877 1265 }
ganlikun 0:13413ea9a877 1266
ganlikun 0:13413ea9a877 1267 /**
ganlikun 0:13413ea9a877 1268 * @brief Indicate if Smartcard mode is enabled
ganlikun 0:13413ea9a877 1269 * @note Macro @ref IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not
ganlikun 0:13413ea9a877 1270 * Smartcard feature is supported by the USARTx instance.
ganlikun 0:13413ea9a877 1271 * @rmtoll CR3 SCEN LL_USART_IsEnabledSmartcard
ganlikun 0:13413ea9a877 1272 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 1273 * @retval State of bit (1 or 0).
ganlikun 0:13413ea9a877 1274 */
ganlikun 0:13413ea9a877 1275 __STATIC_INLINE uint32_t LL_USART_IsEnabledSmartcard(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 1276 {
ganlikun 0:13413ea9a877 1277 return (READ_BIT(USARTx->CR3, USART_CR3_SCEN) == (USART_CR3_SCEN));
ganlikun 0:13413ea9a877 1278 }
ganlikun 0:13413ea9a877 1279
ganlikun 0:13413ea9a877 1280 /**
ganlikun 0:13413ea9a877 1281 * @brief Set Smartcard prescaler value, used for dividing the USART clock
ganlikun 0:13413ea9a877 1282 * source to provide the SMARTCARD Clock (5 bits value)
ganlikun 0:13413ea9a877 1283 * @note Macro @ref IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not
ganlikun 0:13413ea9a877 1284 * Smartcard feature is supported by the USARTx instance.
ganlikun 0:13413ea9a877 1285 * @rmtoll GTPR PSC LL_USART_SetSmartcardPrescaler
ganlikun 0:13413ea9a877 1286 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 1287 * @param PrescalerValue Value between Min_Data=0 and Max_Data=31
ganlikun 0:13413ea9a877 1288 * @retval None
ganlikun 0:13413ea9a877 1289 */
ganlikun 0:13413ea9a877 1290 __STATIC_INLINE void LL_USART_SetSmartcardPrescaler(USART_TypeDef *USARTx, uint32_t PrescalerValue)
ganlikun 0:13413ea9a877 1291 {
ganlikun 0:13413ea9a877 1292 MODIFY_REG(USARTx->GTPR, USART_GTPR_PSC, PrescalerValue);
ganlikun 0:13413ea9a877 1293 }
ganlikun 0:13413ea9a877 1294
ganlikun 0:13413ea9a877 1295 /**
ganlikun 0:13413ea9a877 1296 * @brief Return Smartcard prescaler value, used for dividing the USART clock
ganlikun 0:13413ea9a877 1297 * source to provide the SMARTCARD Clock (5 bits value)
ganlikun 0:13413ea9a877 1298 * @note Macro @ref IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not
ganlikun 0:13413ea9a877 1299 * Smartcard feature is supported by the USARTx instance.
ganlikun 0:13413ea9a877 1300 * @rmtoll GTPR PSC LL_USART_GetSmartcardPrescaler
ganlikun 0:13413ea9a877 1301 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 1302 * @retval Smartcard prescaler value (Value between Min_Data=0 and Max_Data=31)
ganlikun 0:13413ea9a877 1303 */
ganlikun 0:13413ea9a877 1304 __STATIC_INLINE uint32_t LL_USART_GetSmartcardPrescaler(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 1305 {
ganlikun 0:13413ea9a877 1306 return (uint32_t)(READ_BIT(USARTx->GTPR, USART_GTPR_PSC));
ganlikun 0:13413ea9a877 1307 }
ganlikun 0:13413ea9a877 1308
ganlikun 0:13413ea9a877 1309 /**
ganlikun 0:13413ea9a877 1310 * @brief Set Smartcard Guard time value, expressed in nb of baud clocks periods
ganlikun 0:13413ea9a877 1311 * (GT[7:0] bits : Guard time value)
ganlikun 0:13413ea9a877 1312 * @note Macro @ref IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not
ganlikun 0:13413ea9a877 1313 * Smartcard feature is supported by the USARTx instance.
ganlikun 0:13413ea9a877 1314 * @rmtoll GTPR GT LL_USART_SetSmartcardGuardTime
ganlikun 0:13413ea9a877 1315 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 1316 * @param GuardTime Value between Min_Data=0x00 and Max_Data=0xFF
ganlikun 0:13413ea9a877 1317 * @retval None
ganlikun 0:13413ea9a877 1318 */
ganlikun 0:13413ea9a877 1319 __STATIC_INLINE void LL_USART_SetSmartcardGuardTime(USART_TypeDef *USARTx, uint32_t GuardTime)
ganlikun 0:13413ea9a877 1320 {
ganlikun 0:13413ea9a877 1321 MODIFY_REG(USARTx->GTPR, USART_GTPR_GT, GuardTime << USART_POSITION_GTPR_GT);
ganlikun 0:13413ea9a877 1322 }
ganlikun 0:13413ea9a877 1323
ganlikun 0:13413ea9a877 1324 /**
ganlikun 0:13413ea9a877 1325 * @brief Return Smartcard Guard time value, expressed in nb of baud clocks periods
ganlikun 0:13413ea9a877 1326 * (GT[7:0] bits : Guard time value)
ganlikun 0:13413ea9a877 1327 * @note Macro @ref IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not
ganlikun 0:13413ea9a877 1328 * Smartcard feature is supported by the USARTx instance.
ganlikun 0:13413ea9a877 1329 * @rmtoll GTPR GT LL_USART_GetSmartcardGuardTime
ganlikun 0:13413ea9a877 1330 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 1331 * @retval Smartcard Guard time value (Value between Min_Data=0x00 and Max_Data=0xFF)
ganlikun 0:13413ea9a877 1332 */
ganlikun 0:13413ea9a877 1333 __STATIC_INLINE uint32_t LL_USART_GetSmartcardGuardTime(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 1334 {
ganlikun 0:13413ea9a877 1335 return (uint32_t)(READ_BIT(USARTx->GTPR, USART_GTPR_GT) >> USART_POSITION_GTPR_GT);
ganlikun 0:13413ea9a877 1336 }
ganlikun 0:13413ea9a877 1337
ganlikun 0:13413ea9a877 1338 /**
ganlikun 0:13413ea9a877 1339 * @}
ganlikun 0:13413ea9a877 1340 */
ganlikun 0:13413ea9a877 1341
ganlikun 0:13413ea9a877 1342 /** @defgroup USART_LL_EF_Configuration_HalfDuplex Configuration functions related to Half Duplex feature
ganlikun 0:13413ea9a877 1343 * @{
ganlikun 0:13413ea9a877 1344 */
ganlikun 0:13413ea9a877 1345
ganlikun 0:13413ea9a877 1346 /**
ganlikun 0:13413ea9a877 1347 * @brief Enable Single Wire Half-Duplex mode
ganlikun 0:13413ea9a877 1348 * @note Macro @ref IS_UART_HALFDUPLEX_INSTANCE(USARTx) can be used to check whether or not
ganlikun 0:13413ea9a877 1349 * Half-Duplex mode is supported by the USARTx instance.
ganlikun 0:13413ea9a877 1350 * @rmtoll CR3 HDSEL LL_USART_EnableHalfDuplex
ganlikun 0:13413ea9a877 1351 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 1352 * @retval None
ganlikun 0:13413ea9a877 1353 */
ganlikun 0:13413ea9a877 1354 __STATIC_INLINE void LL_USART_EnableHalfDuplex(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 1355 {
ganlikun 0:13413ea9a877 1356 SET_BIT(USARTx->CR3, USART_CR3_HDSEL);
ganlikun 0:13413ea9a877 1357 }
ganlikun 0:13413ea9a877 1358
ganlikun 0:13413ea9a877 1359 /**
ganlikun 0:13413ea9a877 1360 * @brief Disable Single Wire Half-Duplex mode
ganlikun 0:13413ea9a877 1361 * @note Macro @ref IS_UART_HALFDUPLEX_INSTANCE(USARTx) can be used to check whether or not
ganlikun 0:13413ea9a877 1362 * Half-Duplex mode is supported by the USARTx instance.
ganlikun 0:13413ea9a877 1363 * @rmtoll CR3 HDSEL LL_USART_DisableHalfDuplex
ganlikun 0:13413ea9a877 1364 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 1365 * @retval None
ganlikun 0:13413ea9a877 1366 */
ganlikun 0:13413ea9a877 1367 __STATIC_INLINE void LL_USART_DisableHalfDuplex(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 1368 {
ganlikun 0:13413ea9a877 1369 CLEAR_BIT(USARTx->CR3, USART_CR3_HDSEL);
ganlikun 0:13413ea9a877 1370 }
ganlikun 0:13413ea9a877 1371
ganlikun 0:13413ea9a877 1372 /**
ganlikun 0:13413ea9a877 1373 * @brief Indicate if Single Wire Half-Duplex mode is enabled
ganlikun 0:13413ea9a877 1374 * @note Macro @ref IS_UART_HALFDUPLEX_INSTANCE(USARTx) can be used to check whether or not
ganlikun 0:13413ea9a877 1375 * Half-Duplex mode is supported by the USARTx instance.
ganlikun 0:13413ea9a877 1376 * @rmtoll CR3 HDSEL LL_USART_IsEnabledHalfDuplex
ganlikun 0:13413ea9a877 1377 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 1378 * @retval State of bit (1 or 0).
ganlikun 0:13413ea9a877 1379 */
ganlikun 0:13413ea9a877 1380 __STATIC_INLINE uint32_t LL_USART_IsEnabledHalfDuplex(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 1381 {
ganlikun 0:13413ea9a877 1382 return (READ_BIT(USARTx->CR3, USART_CR3_HDSEL) == (USART_CR3_HDSEL));
ganlikun 0:13413ea9a877 1383 }
ganlikun 0:13413ea9a877 1384
ganlikun 0:13413ea9a877 1385 /**
ganlikun 0:13413ea9a877 1386 * @}
ganlikun 0:13413ea9a877 1387 */
ganlikun 0:13413ea9a877 1388
ganlikun 0:13413ea9a877 1389 /** @defgroup USART_LL_EF_Configuration_LIN Configuration functions related to LIN feature
ganlikun 0:13413ea9a877 1390 * @{
ganlikun 0:13413ea9a877 1391 */
ganlikun 0:13413ea9a877 1392
ganlikun 0:13413ea9a877 1393 /**
ganlikun 0:13413ea9a877 1394 * @brief Set LIN Break Detection Length
ganlikun 0:13413ea9a877 1395 * @note Macro @ref IS_UART_LIN_INSTANCE(USARTx) can be used to check whether or not
ganlikun 0:13413ea9a877 1396 * LIN feature is supported by the USARTx instance.
ganlikun 0:13413ea9a877 1397 * @rmtoll CR2 LBDL LL_USART_SetLINBrkDetectionLen
ganlikun 0:13413ea9a877 1398 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 1399 * @param LINBDLength This parameter can be one of the following values:
ganlikun 0:13413ea9a877 1400 * @arg @ref LL_USART_LINBREAK_DETECT_10B
ganlikun 0:13413ea9a877 1401 * @arg @ref LL_USART_LINBREAK_DETECT_11B
ganlikun 0:13413ea9a877 1402 * @retval None
ganlikun 0:13413ea9a877 1403 */
ganlikun 0:13413ea9a877 1404 __STATIC_INLINE void LL_USART_SetLINBrkDetectionLen(USART_TypeDef *USARTx, uint32_t LINBDLength)
ganlikun 0:13413ea9a877 1405 {
ganlikun 0:13413ea9a877 1406 MODIFY_REG(USARTx->CR2, USART_CR2_LBDL, LINBDLength);
ganlikun 0:13413ea9a877 1407 }
ganlikun 0:13413ea9a877 1408
ganlikun 0:13413ea9a877 1409 /**
ganlikun 0:13413ea9a877 1410 * @brief Return LIN Break Detection Length
ganlikun 0:13413ea9a877 1411 * @note Macro @ref IS_UART_LIN_INSTANCE(USARTx) can be used to check whether or not
ganlikun 0:13413ea9a877 1412 * LIN feature is supported by the USARTx instance.
ganlikun 0:13413ea9a877 1413 * @rmtoll CR2 LBDL LL_USART_GetLINBrkDetectionLen
ganlikun 0:13413ea9a877 1414 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 1415 * @retval Returned value can be one of the following values:
ganlikun 0:13413ea9a877 1416 * @arg @ref LL_USART_LINBREAK_DETECT_10B
ganlikun 0:13413ea9a877 1417 * @arg @ref LL_USART_LINBREAK_DETECT_11B
ganlikun 0:13413ea9a877 1418 */
ganlikun 0:13413ea9a877 1419 __STATIC_INLINE uint32_t LL_USART_GetLINBrkDetectionLen(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 1420 {
ganlikun 0:13413ea9a877 1421 return (uint32_t)(READ_BIT(USARTx->CR2, USART_CR2_LBDL));
ganlikun 0:13413ea9a877 1422 }
ganlikun 0:13413ea9a877 1423
ganlikun 0:13413ea9a877 1424 /**
ganlikun 0:13413ea9a877 1425 * @brief Enable LIN mode
ganlikun 0:13413ea9a877 1426 * @note Macro @ref IS_UART_LIN_INSTANCE(USARTx) can be used to check whether or not
ganlikun 0:13413ea9a877 1427 * LIN feature is supported by the USARTx instance.
ganlikun 0:13413ea9a877 1428 * @rmtoll CR2 LINEN LL_USART_EnableLIN
ganlikun 0:13413ea9a877 1429 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 1430 * @retval None
ganlikun 0:13413ea9a877 1431 */
ganlikun 0:13413ea9a877 1432 __STATIC_INLINE void LL_USART_EnableLIN(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 1433 {
ganlikun 0:13413ea9a877 1434 SET_BIT(USARTx->CR2, USART_CR2_LINEN);
ganlikun 0:13413ea9a877 1435 }
ganlikun 0:13413ea9a877 1436
ganlikun 0:13413ea9a877 1437 /**
ganlikun 0:13413ea9a877 1438 * @brief Disable LIN mode
ganlikun 0:13413ea9a877 1439 * @note Macro @ref IS_UART_LIN_INSTANCE(USARTx) can be used to check whether or not
ganlikun 0:13413ea9a877 1440 * LIN feature is supported by the USARTx instance.
ganlikun 0:13413ea9a877 1441 * @rmtoll CR2 LINEN LL_USART_DisableLIN
ganlikun 0:13413ea9a877 1442 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 1443 * @retval None
ganlikun 0:13413ea9a877 1444 */
ganlikun 0:13413ea9a877 1445 __STATIC_INLINE void LL_USART_DisableLIN(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 1446 {
ganlikun 0:13413ea9a877 1447 CLEAR_BIT(USARTx->CR2, USART_CR2_LINEN);
ganlikun 0:13413ea9a877 1448 }
ganlikun 0:13413ea9a877 1449
ganlikun 0:13413ea9a877 1450 /**
ganlikun 0:13413ea9a877 1451 * @brief Indicate if LIN mode is enabled
ganlikun 0:13413ea9a877 1452 * @note Macro @ref IS_UART_LIN_INSTANCE(USARTx) can be used to check whether or not
ganlikun 0:13413ea9a877 1453 * LIN feature is supported by the USARTx instance.
ganlikun 0:13413ea9a877 1454 * @rmtoll CR2 LINEN LL_USART_IsEnabledLIN
ganlikun 0:13413ea9a877 1455 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 1456 * @retval State of bit (1 or 0).
ganlikun 0:13413ea9a877 1457 */
ganlikun 0:13413ea9a877 1458 __STATIC_INLINE uint32_t LL_USART_IsEnabledLIN(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 1459 {
ganlikun 0:13413ea9a877 1460 return (READ_BIT(USARTx->CR2, USART_CR2_LINEN) == (USART_CR2_LINEN));
ganlikun 0:13413ea9a877 1461 }
ganlikun 0:13413ea9a877 1462
ganlikun 0:13413ea9a877 1463 /**
ganlikun 0:13413ea9a877 1464 * @}
ganlikun 0:13413ea9a877 1465 */
ganlikun 0:13413ea9a877 1466
ganlikun 0:13413ea9a877 1467 /** @defgroup USART_LL_EF_AdvancedConfiguration Advanced Configurations services
ganlikun 0:13413ea9a877 1468 * @{
ganlikun 0:13413ea9a877 1469 */
ganlikun 0:13413ea9a877 1470
ganlikun 0:13413ea9a877 1471 /**
ganlikun 0:13413ea9a877 1472 * @brief Perform basic configuration of USART for enabling use in Asynchronous Mode (UART)
ganlikun 0:13413ea9a877 1473 * @note In UART mode, the following bits must be kept cleared:
ganlikun 0:13413ea9a877 1474 * - LINEN bit in the USART_CR2 register,
ganlikun 0:13413ea9a877 1475 * - CLKEN bit in the USART_CR2 register,
ganlikun 0:13413ea9a877 1476 * - SCEN bit in the USART_CR3 register,
ganlikun 0:13413ea9a877 1477 * - IREN bit in the USART_CR3 register,
ganlikun 0:13413ea9a877 1478 * - HDSEL bit in the USART_CR3 register.
ganlikun 0:13413ea9a877 1479 * @note Call of this function is equivalent to following function call sequence :
ganlikun 0:13413ea9a877 1480 * - Clear LINEN in CR2 using @ref LL_USART_DisableLIN() function
ganlikun 0:13413ea9a877 1481 * - Clear CLKEN in CR2 using @ref LL_USART_DisableSCLKOutput() function
ganlikun 0:13413ea9a877 1482 * - Clear SCEN in CR3 using @ref LL_USART_DisableSmartcard() function
ganlikun 0:13413ea9a877 1483 * - Clear IREN in CR3 using @ref LL_USART_DisableIrda() function
ganlikun 0:13413ea9a877 1484 * - Clear HDSEL in CR3 using @ref LL_USART_DisableHalfDuplex() function
ganlikun 0:13413ea9a877 1485 * @note Other remaining configurations items related to Asynchronous Mode
ganlikun 0:13413ea9a877 1486 * (as Baud Rate, Word length, Parity, ...) should be set using
ganlikun 0:13413ea9a877 1487 * dedicated functions
ganlikun 0:13413ea9a877 1488 * @rmtoll CR2 LINEN LL_USART_ConfigAsyncMode\n
ganlikun 0:13413ea9a877 1489 * CR2 CLKEN LL_USART_ConfigAsyncMode\n
ganlikun 0:13413ea9a877 1490 * CR3 SCEN LL_USART_ConfigAsyncMode\n
ganlikun 0:13413ea9a877 1491 * CR3 IREN LL_USART_ConfigAsyncMode\n
ganlikun 0:13413ea9a877 1492 * CR3 HDSEL LL_USART_ConfigAsyncMode
ganlikun 0:13413ea9a877 1493 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 1494 * @retval None
ganlikun 0:13413ea9a877 1495 */
ganlikun 0:13413ea9a877 1496 __STATIC_INLINE void LL_USART_ConfigAsyncMode(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 1497 {
ganlikun 0:13413ea9a877 1498 /* In Asynchronous mode, the following bits must be kept cleared:
ganlikun 0:13413ea9a877 1499 - LINEN, CLKEN bits in the USART_CR2 register,
ganlikun 0:13413ea9a877 1500 - SCEN, IREN and HDSEL bits in the USART_CR3 register.*/
ganlikun 0:13413ea9a877 1501 CLEAR_BIT(USARTx->CR2, (USART_CR2_LINEN | USART_CR2_CLKEN));
ganlikun 0:13413ea9a877 1502 CLEAR_BIT(USARTx->CR3, (USART_CR3_SCEN | USART_CR3_IREN | USART_CR3_HDSEL));
ganlikun 0:13413ea9a877 1503 }
ganlikun 0:13413ea9a877 1504
ganlikun 0:13413ea9a877 1505 /**
ganlikun 0:13413ea9a877 1506 * @brief Perform basic configuration of USART for enabling use in Synchronous Mode
ganlikun 0:13413ea9a877 1507 * @note In Synchronous mode, the following bits must be kept cleared:
ganlikun 0:13413ea9a877 1508 * - LINEN bit in the USART_CR2 register,
ganlikun 0:13413ea9a877 1509 * - SCEN bit in the USART_CR3 register,
ganlikun 0:13413ea9a877 1510 * - IREN bit in the USART_CR3 register,
ganlikun 0:13413ea9a877 1511 * - HDSEL bit in the USART_CR3 register.
ganlikun 0:13413ea9a877 1512 * This function also sets the USART in Synchronous mode.
ganlikun 0:13413ea9a877 1513 * @note Macro @ref IS_USART_INSTANCE(USARTx) can be used to check whether or not
ganlikun 0:13413ea9a877 1514 * Synchronous mode is supported by the USARTx instance.
ganlikun 0:13413ea9a877 1515 * @note Call of this function is equivalent to following function call sequence :
ganlikun 0:13413ea9a877 1516 * - Clear LINEN in CR2 using @ref LL_USART_DisableLIN() function
ganlikun 0:13413ea9a877 1517 * - Clear IREN in CR3 using @ref LL_USART_DisableIrda() function
ganlikun 0:13413ea9a877 1518 * - Clear SCEN in CR3 using @ref LL_USART_DisableSmartcard() function
ganlikun 0:13413ea9a877 1519 * - Clear HDSEL in CR3 using @ref LL_USART_DisableHalfDuplex() function
ganlikun 0:13413ea9a877 1520 * - Set CLKEN in CR2 using @ref LL_USART_EnableSCLKOutput() function
ganlikun 0:13413ea9a877 1521 * @note Other remaining configurations items related to Synchronous Mode
ganlikun 0:13413ea9a877 1522 * (as Baud Rate, Word length, Parity, Clock Polarity, ...) should be set using
ganlikun 0:13413ea9a877 1523 * dedicated functions
ganlikun 0:13413ea9a877 1524 * @rmtoll CR2 LINEN LL_USART_ConfigSyncMode\n
ganlikun 0:13413ea9a877 1525 * CR2 CLKEN LL_USART_ConfigSyncMode\n
ganlikun 0:13413ea9a877 1526 * CR3 SCEN LL_USART_ConfigSyncMode\n
ganlikun 0:13413ea9a877 1527 * CR3 IREN LL_USART_ConfigSyncMode\n
ganlikun 0:13413ea9a877 1528 * CR3 HDSEL LL_USART_ConfigSyncMode
ganlikun 0:13413ea9a877 1529 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 1530 * @retval None
ganlikun 0:13413ea9a877 1531 */
ganlikun 0:13413ea9a877 1532 __STATIC_INLINE void LL_USART_ConfigSyncMode(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 1533 {
ganlikun 0:13413ea9a877 1534 /* In Synchronous mode, the following bits must be kept cleared:
ganlikun 0:13413ea9a877 1535 - LINEN bit in the USART_CR2 register,
ganlikun 0:13413ea9a877 1536 - SCEN, IREN and HDSEL bits in the USART_CR3 register.*/
ganlikun 0:13413ea9a877 1537 CLEAR_BIT(USARTx->CR2, (USART_CR2_LINEN));
ganlikun 0:13413ea9a877 1538 CLEAR_BIT(USARTx->CR3, (USART_CR3_SCEN | USART_CR3_IREN | USART_CR3_HDSEL));
ganlikun 0:13413ea9a877 1539 /* set the UART/USART in Synchronous mode */
ganlikun 0:13413ea9a877 1540 SET_BIT(USARTx->CR2, USART_CR2_CLKEN);
ganlikun 0:13413ea9a877 1541 }
ganlikun 0:13413ea9a877 1542
ganlikun 0:13413ea9a877 1543 /**
ganlikun 0:13413ea9a877 1544 * @brief Perform basic configuration of USART for enabling use in LIN Mode
ganlikun 0:13413ea9a877 1545 * @note In LIN mode, the following bits must be kept cleared:
ganlikun 0:13413ea9a877 1546 * - STOP and CLKEN bits in the USART_CR2 register,
ganlikun 0:13413ea9a877 1547 * - SCEN bit in the USART_CR3 register,
ganlikun 0:13413ea9a877 1548 * - IREN bit in the USART_CR3 register,
ganlikun 0:13413ea9a877 1549 * - HDSEL bit in the USART_CR3 register.
ganlikun 0:13413ea9a877 1550 * This function also set the UART/USART in LIN mode.
ganlikun 0:13413ea9a877 1551 * @note Macro @ref IS_UART_LIN_INSTANCE(USARTx) can be used to check whether or not
ganlikun 0:13413ea9a877 1552 * LIN feature is supported by the USARTx instance.
ganlikun 0:13413ea9a877 1553 * @note Call of this function is equivalent to following function call sequence :
ganlikun 0:13413ea9a877 1554 * - Clear CLKEN in CR2 using @ref LL_USART_DisableSCLKOutput() function
ganlikun 0:13413ea9a877 1555 * - Clear STOP in CR2 using @ref LL_USART_SetStopBitsLength() function
ganlikun 0:13413ea9a877 1556 * - Clear SCEN in CR3 using @ref LL_USART_DisableSmartcard() function
ganlikun 0:13413ea9a877 1557 * - Clear IREN in CR3 using @ref LL_USART_DisableIrda() function
ganlikun 0:13413ea9a877 1558 * - Clear HDSEL in CR3 using @ref LL_USART_DisableHalfDuplex() function
ganlikun 0:13413ea9a877 1559 * - Set LINEN in CR2 using @ref LL_USART_EnableLIN() function
ganlikun 0:13413ea9a877 1560 * @note Other remaining configurations items related to LIN Mode
ganlikun 0:13413ea9a877 1561 * (as Baud Rate, Word length, LIN Break Detection Length, ...) should be set using
ganlikun 0:13413ea9a877 1562 * dedicated functions
ganlikun 0:13413ea9a877 1563 * @rmtoll CR2 CLKEN LL_USART_ConfigLINMode\n
ganlikun 0:13413ea9a877 1564 * CR2 STOP LL_USART_ConfigLINMode\n
ganlikun 0:13413ea9a877 1565 * CR2 LINEN LL_USART_ConfigLINMode\n
ganlikun 0:13413ea9a877 1566 * CR3 IREN LL_USART_ConfigLINMode\n
ganlikun 0:13413ea9a877 1567 * CR3 SCEN LL_USART_ConfigLINMode\n
ganlikun 0:13413ea9a877 1568 * CR3 HDSEL LL_USART_ConfigLINMode
ganlikun 0:13413ea9a877 1569 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 1570 * @retval None
ganlikun 0:13413ea9a877 1571 */
ganlikun 0:13413ea9a877 1572 __STATIC_INLINE void LL_USART_ConfigLINMode(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 1573 {
ganlikun 0:13413ea9a877 1574 /* In LIN mode, the following bits must be kept cleared:
ganlikun 0:13413ea9a877 1575 - STOP and CLKEN bits in the USART_CR2 register,
ganlikun 0:13413ea9a877 1576 - IREN, SCEN and HDSEL bits in the USART_CR3 register.*/
ganlikun 0:13413ea9a877 1577 CLEAR_BIT(USARTx->CR2, (USART_CR2_CLKEN | USART_CR2_STOP));
ganlikun 0:13413ea9a877 1578 CLEAR_BIT(USARTx->CR3, (USART_CR3_IREN | USART_CR3_SCEN | USART_CR3_HDSEL));
ganlikun 0:13413ea9a877 1579 /* Set the UART/USART in LIN mode */
ganlikun 0:13413ea9a877 1580 SET_BIT(USARTx->CR2, USART_CR2_LINEN);
ganlikun 0:13413ea9a877 1581 }
ganlikun 0:13413ea9a877 1582
ganlikun 0:13413ea9a877 1583 /**
ganlikun 0:13413ea9a877 1584 * @brief Perform basic configuration of USART for enabling use in Half Duplex Mode
ganlikun 0:13413ea9a877 1585 * @note In Half Duplex mode, the following bits must be kept cleared:
ganlikun 0:13413ea9a877 1586 * - LINEN bit in the USART_CR2 register,
ganlikun 0:13413ea9a877 1587 * - CLKEN bit in the USART_CR2 register,
ganlikun 0:13413ea9a877 1588 * - SCEN bit in the USART_CR3 register,
ganlikun 0:13413ea9a877 1589 * - IREN bit in the USART_CR3 register,
ganlikun 0:13413ea9a877 1590 * This function also sets the UART/USART in Half Duplex mode.
ganlikun 0:13413ea9a877 1591 * @note Macro @ref IS_UART_HALFDUPLEX_INSTANCE(USARTx) can be used to check whether or not
ganlikun 0:13413ea9a877 1592 * Half-Duplex mode is supported by the USARTx instance.
ganlikun 0:13413ea9a877 1593 * @note Call of this function is equivalent to following function call sequence :
ganlikun 0:13413ea9a877 1594 * - Clear LINEN in CR2 using @ref LL_USART_DisableLIN() function
ganlikun 0:13413ea9a877 1595 * - Clear CLKEN in CR2 using @ref LL_USART_DisableSCLKOutput() function
ganlikun 0:13413ea9a877 1596 * - Clear SCEN in CR3 using @ref LL_USART_DisableSmartcard() function
ganlikun 0:13413ea9a877 1597 * - Clear IREN in CR3 using @ref LL_USART_DisableIrda() function
ganlikun 0:13413ea9a877 1598 * - Set HDSEL in CR3 using @ref LL_USART_EnableHalfDuplex() function
ganlikun 0:13413ea9a877 1599 * @note Other remaining configurations items related to Half Duplex Mode
ganlikun 0:13413ea9a877 1600 * (as Baud Rate, Word length, Parity, ...) should be set using
ganlikun 0:13413ea9a877 1601 * dedicated functions
ganlikun 0:13413ea9a877 1602 * @rmtoll CR2 LINEN LL_USART_ConfigHalfDuplexMode\n
ganlikun 0:13413ea9a877 1603 * CR2 CLKEN LL_USART_ConfigHalfDuplexMode\n
ganlikun 0:13413ea9a877 1604 * CR3 HDSEL LL_USART_ConfigHalfDuplexMode\n
ganlikun 0:13413ea9a877 1605 * CR3 SCEN LL_USART_ConfigHalfDuplexMode\n
ganlikun 0:13413ea9a877 1606 * CR3 IREN LL_USART_ConfigHalfDuplexMode
ganlikun 0:13413ea9a877 1607 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 1608 * @retval None
ganlikun 0:13413ea9a877 1609 */
ganlikun 0:13413ea9a877 1610 __STATIC_INLINE void LL_USART_ConfigHalfDuplexMode(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 1611 {
ganlikun 0:13413ea9a877 1612 /* In Half Duplex mode, the following bits must be kept cleared:
ganlikun 0:13413ea9a877 1613 - LINEN and CLKEN bits in the USART_CR2 register,
ganlikun 0:13413ea9a877 1614 - SCEN and IREN bits in the USART_CR3 register.*/
ganlikun 0:13413ea9a877 1615 CLEAR_BIT(USARTx->CR2, (USART_CR2_LINEN | USART_CR2_CLKEN));
ganlikun 0:13413ea9a877 1616 CLEAR_BIT(USARTx->CR3, (USART_CR3_SCEN | USART_CR3_IREN));
ganlikun 0:13413ea9a877 1617 /* set the UART/USART in Half Duplex mode */
ganlikun 0:13413ea9a877 1618 SET_BIT(USARTx->CR3, USART_CR3_HDSEL);
ganlikun 0:13413ea9a877 1619 }
ganlikun 0:13413ea9a877 1620
ganlikun 0:13413ea9a877 1621 /**
ganlikun 0:13413ea9a877 1622 * @brief Perform basic configuration of USART for enabling use in Smartcard Mode
ganlikun 0:13413ea9a877 1623 * @note In Smartcard mode, the following bits must be kept cleared:
ganlikun 0:13413ea9a877 1624 * - LINEN bit in the USART_CR2 register,
ganlikun 0:13413ea9a877 1625 * - IREN bit in the USART_CR3 register,
ganlikun 0:13413ea9a877 1626 * - HDSEL bit in the USART_CR3 register.
ganlikun 0:13413ea9a877 1627 * This function also configures Stop bits to 1.5 bits and
ganlikun 0:13413ea9a877 1628 * sets the USART in Smartcard mode (SCEN bit).
ganlikun 0:13413ea9a877 1629 * Clock Output is also enabled (CLKEN).
ganlikun 0:13413ea9a877 1630 * @note Macro @ref IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not
ganlikun 0:13413ea9a877 1631 * Smartcard feature is supported by the USARTx instance.
ganlikun 0:13413ea9a877 1632 * @note Call of this function is equivalent to following function call sequence :
ganlikun 0:13413ea9a877 1633 * - Clear LINEN in CR2 using @ref LL_USART_DisableLIN() function
ganlikun 0:13413ea9a877 1634 * - Clear IREN in CR3 using @ref LL_USART_DisableIrda() function
ganlikun 0:13413ea9a877 1635 * - Clear HDSEL in CR3 using @ref LL_USART_DisableHalfDuplex() function
ganlikun 0:13413ea9a877 1636 * - Configure STOP in CR2 using @ref LL_USART_SetStopBitsLength() function
ganlikun 0:13413ea9a877 1637 * - Set CLKEN in CR2 using @ref LL_USART_EnableSCLKOutput() function
ganlikun 0:13413ea9a877 1638 * - Set SCEN in CR3 using @ref LL_USART_EnableSmartcard() function
ganlikun 0:13413ea9a877 1639 * @note Other remaining configurations items related to Smartcard Mode
ganlikun 0:13413ea9a877 1640 * (as Baud Rate, Word length, Parity, ...) should be set using
ganlikun 0:13413ea9a877 1641 * dedicated functions
ganlikun 0:13413ea9a877 1642 * @rmtoll CR2 LINEN LL_USART_ConfigSmartcardMode\n
ganlikun 0:13413ea9a877 1643 * CR2 STOP LL_USART_ConfigSmartcardMode\n
ganlikun 0:13413ea9a877 1644 * CR2 CLKEN LL_USART_ConfigSmartcardMode\n
ganlikun 0:13413ea9a877 1645 * CR3 HDSEL LL_USART_ConfigSmartcardMode\n
ganlikun 0:13413ea9a877 1646 * CR3 SCEN LL_USART_ConfigSmartcardMode
ganlikun 0:13413ea9a877 1647 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 1648 * @retval None
ganlikun 0:13413ea9a877 1649 */
ganlikun 0:13413ea9a877 1650 __STATIC_INLINE void LL_USART_ConfigSmartcardMode(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 1651 {
ganlikun 0:13413ea9a877 1652 /* In Smartcard mode, the following bits must be kept cleared:
ganlikun 0:13413ea9a877 1653 - LINEN bit in the USART_CR2 register,
ganlikun 0:13413ea9a877 1654 - IREN and HDSEL bits in the USART_CR3 register.*/
ganlikun 0:13413ea9a877 1655 CLEAR_BIT(USARTx->CR2, (USART_CR2_LINEN));
ganlikun 0:13413ea9a877 1656 CLEAR_BIT(USARTx->CR3, (USART_CR3_IREN | USART_CR3_HDSEL));
ganlikun 0:13413ea9a877 1657 /* Configure Stop bits to 1.5 bits */
ganlikun 0:13413ea9a877 1658 /* Synchronous mode is activated by default */
ganlikun 0:13413ea9a877 1659 SET_BIT(USARTx->CR2, (USART_CR2_STOP_0 | USART_CR2_STOP_1 | USART_CR2_CLKEN));
ganlikun 0:13413ea9a877 1660 /* set the UART/USART in Smartcard mode */
ganlikun 0:13413ea9a877 1661 SET_BIT(USARTx->CR3, USART_CR3_SCEN);
ganlikun 0:13413ea9a877 1662 }
ganlikun 0:13413ea9a877 1663
ganlikun 0:13413ea9a877 1664 /**
ganlikun 0:13413ea9a877 1665 * @brief Perform basic configuration of USART for enabling use in Irda Mode
ganlikun 0:13413ea9a877 1666 * @note In IRDA mode, the following bits must be kept cleared:
ganlikun 0:13413ea9a877 1667 * - LINEN bit in the USART_CR2 register,
ganlikun 0:13413ea9a877 1668 * - STOP and CLKEN bits in the USART_CR2 register,
ganlikun 0:13413ea9a877 1669 * - SCEN bit in the USART_CR3 register,
ganlikun 0:13413ea9a877 1670 * - HDSEL bit in the USART_CR3 register.
ganlikun 0:13413ea9a877 1671 * This function also sets the UART/USART in IRDA mode (IREN bit).
ganlikun 0:13413ea9a877 1672 * @note Macro @ref IS_IRDA_INSTANCE(USARTx) can be used to check whether or not
ganlikun 0:13413ea9a877 1673 * IrDA feature is supported by the USARTx instance.
ganlikun 0:13413ea9a877 1674 * @note Call of this function is equivalent to following function call sequence :
ganlikun 0:13413ea9a877 1675 * - Clear LINEN in CR2 using @ref LL_USART_DisableLIN() function
ganlikun 0:13413ea9a877 1676 * - Clear CLKEN in CR2 using @ref LL_USART_DisableSCLKOutput() function
ganlikun 0:13413ea9a877 1677 * - Clear SCEN in CR3 using @ref LL_USART_DisableSmartcard() function
ganlikun 0:13413ea9a877 1678 * - Clear HDSEL in CR3 using @ref LL_USART_DisableHalfDuplex() function
ganlikun 0:13413ea9a877 1679 * - Configure STOP in CR2 using @ref LL_USART_SetStopBitsLength() function
ganlikun 0:13413ea9a877 1680 * - Set IREN in CR3 using @ref LL_USART_EnableIrda() function
ganlikun 0:13413ea9a877 1681 * @note Other remaining configurations items related to Irda Mode
ganlikun 0:13413ea9a877 1682 * (as Baud Rate, Word length, Power mode, ...) should be set using
ganlikun 0:13413ea9a877 1683 * dedicated functions
ganlikun 0:13413ea9a877 1684 * @rmtoll CR2 LINEN LL_USART_ConfigIrdaMode\n
ganlikun 0:13413ea9a877 1685 * CR2 CLKEN LL_USART_ConfigIrdaMode\n
ganlikun 0:13413ea9a877 1686 * CR2 STOP LL_USART_ConfigIrdaMode\n
ganlikun 0:13413ea9a877 1687 * CR3 SCEN LL_USART_ConfigIrdaMode\n
ganlikun 0:13413ea9a877 1688 * CR3 HDSEL LL_USART_ConfigIrdaMode\n
ganlikun 0:13413ea9a877 1689 * CR3 IREN LL_USART_ConfigIrdaMode
ganlikun 0:13413ea9a877 1690 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 1691 * @retval None
ganlikun 0:13413ea9a877 1692 */
ganlikun 0:13413ea9a877 1693 __STATIC_INLINE void LL_USART_ConfigIrdaMode(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 1694 {
ganlikun 0:13413ea9a877 1695 /* In IRDA mode, the following bits must be kept cleared:
ganlikun 0:13413ea9a877 1696 - LINEN, STOP and CLKEN bits in the USART_CR2 register,
ganlikun 0:13413ea9a877 1697 - SCEN and HDSEL bits in the USART_CR3 register.*/
ganlikun 0:13413ea9a877 1698 CLEAR_BIT(USARTx->CR2, (USART_CR2_LINEN | USART_CR2_CLKEN | USART_CR2_STOP));
ganlikun 0:13413ea9a877 1699 CLEAR_BIT(USARTx->CR3, (USART_CR3_SCEN | USART_CR3_HDSEL));
ganlikun 0:13413ea9a877 1700 /* set the UART/USART in IRDA mode */
ganlikun 0:13413ea9a877 1701 SET_BIT(USARTx->CR3, USART_CR3_IREN);
ganlikun 0:13413ea9a877 1702 }
ganlikun 0:13413ea9a877 1703
ganlikun 0:13413ea9a877 1704 /**
ganlikun 0:13413ea9a877 1705 * @brief Perform basic configuration of USART for enabling use in Multi processor Mode
ganlikun 0:13413ea9a877 1706 * (several USARTs connected in a network, one of the USARTs can be the master,
ganlikun 0:13413ea9a877 1707 * its TX output connected to the RX inputs of the other slaves USARTs).
ganlikun 0:13413ea9a877 1708 * @note In MultiProcessor mode, the following bits must be kept cleared:
ganlikun 0:13413ea9a877 1709 * - LINEN bit in the USART_CR2 register,
ganlikun 0:13413ea9a877 1710 * - CLKEN bit in the USART_CR2 register,
ganlikun 0:13413ea9a877 1711 * - SCEN bit in the USART_CR3 register,
ganlikun 0:13413ea9a877 1712 * - IREN bit in the USART_CR3 register,
ganlikun 0:13413ea9a877 1713 * - HDSEL bit in the USART_CR3 register.
ganlikun 0:13413ea9a877 1714 * @note Call of this function is equivalent to following function call sequence :
ganlikun 0:13413ea9a877 1715 * - Clear LINEN in CR2 using @ref LL_USART_DisableLIN() function
ganlikun 0:13413ea9a877 1716 * - Clear CLKEN in CR2 using @ref LL_USART_DisableSCLKOutput() function
ganlikun 0:13413ea9a877 1717 * - Clear SCEN in CR3 using @ref LL_USART_DisableSmartcard() function
ganlikun 0:13413ea9a877 1718 * - Clear IREN in CR3 using @ref LL_USART_DisableIrda() function
ganlikun 0:13413ea9a877 1719 * - Clear HDSEL in CR3 using @ref LL_USART_DisableHalfDuplex() function
ganlikun 0:13413ea9a877 1720 * @note Other remaining configurations items related to Multi processor Mode
ganlikun 0:13413ea9a877 1721 * (as Baud Rate, Wake Up Method, Node address, ...) should be set using
ganlikun 0:13413ea9a877 1722 * dedicated functions
ganlikun 0:13413ea9a877 1723 * @rmtoll CR2 LINEN LL_USART_ConfigMultiProcessMode\n
ganlikun 0:13413ea9a877 1724 * CR2 CLKEN LL_USART_ConfigMultiProcessMode\n
ganlikun 0:13413ea9a877 1725 * CR3 SCEN LL_USART_ConfigMultiProcessMode\n
ganlikun 0:13413ea9a877 1726 * CR3 HDSEL LL_USART_ConfigMultiProcessMode\n
ganlikun 0:13413ea9a877 1727 * CR3 IREN LL_USART_ConfigMultiProcessMode
ganlikun 0:13413ea9a877 1728 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 1729 * @retval None
ganlikun 0:13413ea9a877 1730 */
ganlikun 0:13413ea9a877 1731 __STATIC_INLINE void LL_USART_ConfigMultiProcessMode(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 1732 {
ganlikun 0:13413ea9a877 1733 /* In Multi Processor mode, the following bits must be kept cleared:
ganlikun 0:13413ea9a877 1734 - LINEN and CLKEN bits in the USART_CR2 register,
ganlikun 0:13413ea9a877 1735 - IREN, SCEN and HDSEL bits in the USART_CR3 register.*/
ganlikun 0:13413ea9a877 1736 CLEAR_BIT(USARTx->CR2, (USART_CR2_LINEN | USART_CR2_CLKEN));
ganlikun 0:13413ea9a877 1737 CLEAR_BIT(USARTx->CR3, (USART_CR3_SCEN | USART_CR3_HDSEL | USART_CR3_IREN));
ganlikun 0:13413ea9a877 1738 }
ganlikun 0:13413ea9a877 1739
ganlikun 0:13413ea9a877 1740 /**
ganlikun 0:13413ea9a877 1741 * @}
ganlikun 0:13413ea9a877 1742 */
ganlikun 0:13413ea9a877 1743
ganlikun 0:13413ea9a877 1744 /** @defgroup USART_LL_EF_FLAG_Management FLAG_Management
ganlikun 0:13413ea9a877 1745 * @{
ganlikun 0:13413ea9a877 1746 */
ganlikun 0:13413ea9a877 1747
ganlikun 0:13413ea9a877 1748 /**
ganlikun 0:13413ea9a877 1749 * @brief Check if the USART Parity Error Flag is set or not
ganlikun 0:13413ea9a877 1750 * @rmtoll SR PE LL_USART_IsActiveFlag_PE
ganlikun 0:13413ea9a877 1751 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 1752 * @retval State of bit (1 or 0).
ganlikun 0:13413ea9a877 1753 */
ganlikun 0:13413ea9a877 1754 __STATIC_INLINE uint32_t LL_USART_IsActiveFlag_PE(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 1755 {
ganlikun 0:13413ea9a877 1756 return (READ_BIT(USARTx->SR, USART_SR_PE) == (USART_SR_PE));
ganlikun 0:13413ea9a877 1757 }
ganlikun 0:13413ea9a877 1758
ganlikun 0:13413ea9a877 1759 /**
ganlikun 0:13413ea9a877 1760 * @brief Check if the USART Framing Error Flag is set or not
ganlikun 0:13413ea9a877 1761 * @rmtoll SR FE LL_USART_IsActiveFlag_FE
ganlikun 0:13413ea9a877 1762 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 1763 * @retval State of bit (1 or 0).
ganlikun 0:13413ea9a877 1764 */
ganlikun 0:13413ea9a877 1765 __STATIC_INLINE uint32_t LL_USART_IsActiveFlag_FE(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 1766 {
ganlikun 0:13413ea9a877 1767 return (READ_BIT(USARTx->SR, USART_SR_FE) == (USART_SR_FE));
ganlikun 0:13413ea9a877 1768 }
ganlikun 0:13413ea9a877 1769
ganlikun 0:13413ea9a877 1770 /**
ganlikun 0:13413ea9a877 1771 * @brief Check if the USART Noise error detected Flag is set or not
ganlikun 0:13413ea9a877 1772 * @rmtoll SR NF LL_USART_IsActiveFlag_NE
ganlikun 0:13413ea9a877 1773 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 1774 * @retval State of bit (1 or 0).
ganlikun 0:13413ea9a877 1775 */
ganlikun 0:13413ea9a877 1776 __STATIC_INLINE uint32_t LL_USART_IsActiveFlag_NE(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 1777 {
ganlikun 0:13413ea9a877 1778 return (READ_BIT(USARTx->SR, USART_SR_NE) == (USART_SR_NE));
ganlikun 0:13413ea9a877 1779 }
ganlikun 0:13413ea9a877 1780
ganlikun 0:13413ea9a877 1781 /**
ganlikun 0:13413ea9a877 1782 * @brief Check if the USART OverRun Error Flag is set or not
ganlikun 0:13413ea9a877 1783 * @rmtoll SR ORE LL_USART_IsActiveFlag_ORE
ganlikun 0:13413ea9a877 1784 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 1785 * @retval State of bit (1 or 0).
ganlikun 0:13413ea9a877 1786 */
ganlikun 0:13413ea9a877 1787 __STATIC_INLINE uint32_t LL_USART_IsActiveFlag_ORE(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 1788 {
ganlikun 0:13413ea9a877 1789 return (READ_BIT(USARTx->SR, USART_SR_ORE) == (USART_SR_ORE));
ganlikun 0:13413ea9a877 1790 }
ganlikun 0:13413ea9a877 1791
ganlikun 0:13413ea9a877 1792 /**
ganlikun 0:13413ea9a877 1793 * @brief Check if the USART IDLE line detected Flag is set or not
ganlikun 0:13413ea9a877 1794 * @rmtoll SR IDLE LL_USART_IsActiveFlag_IDLE
ganlikun 0:13413ea9a877 1795 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 1796 * @retval State of bit (1 or 0).
ganlikun 0:13413ea9a877 1797 */
ganlikun 0:13413ea9a877 1798 __STATIC_INLINE uint32_t LL_USART_IsActiveFlag_IDLE(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 1799 {
ganlikun 0:13413ea9a877 1800 return (READ_BIT(USARTx->SR, USART_SR_IDLE) == (USART_SR_IDLE));
ganlikun 0:13413ea9a877 1801 }
ganlikun 0:13413ea9a877 1802
ganlikun 0:13413ea9a877 1803 /**
ganlikun 0:13413ea9a877 1804 * @brief Check if the USART Read Data Register Not Empty Flag is set or not
ganlikun 0:13413ea9a877 1805 * @rmtoll SR RXNE LL_USART_IsActiveFlag_RXNE
ganlikun 0:13413ea9a877 1806 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 1807 * @retval State of bit (1 or 0).
ganlikun 0:13413ea9a877 1808 */
ganlikun 0:13413ea9a877 1809 __STATIC_INLINE uint32_t LL_USART_IsActiveFlag_RXNE(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 1810 {
ganlikun 0:13413ea9a877 1811 return (READ_BIT(USARTx->SR, USART_SR_RXNE) == (USART_SR_RXNE));
ganlikun 0:13413ea9a877 1812 }
ganlikun 0:13413ea9a877 1813
ganlikun 0:13413ea9a877 1814 /**
ganlikun 0:13413ea9a877 1815 * @brief Check if the USART Transmission Complete Flag is set or not
ganlikun 0:13413ea9a877 1816 * @rmtoll SR TC LL_USART_IsActiveFlag_TC
ganlikun 0:13413ea9a877 1817 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 1818 * @retval State of bit (1 or 0).
ganlikun 0:13413ea9a877 1819 */
ganlikun 0:13413ea9a877 1820 __STATIC_INLINE uint32_t LL_USART_IsActiveFlag_TC(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 1821 {
ganlikun 0:13413ea9a877 1822 return (READ_BIT(USARTx->SR, USART_SR_TC) == (USART_SR_TC));
ganlikun 0:13413ea9a877 1823 }
ganlikun 0:13413ea9a877 1824
ganlikun 0:13413ea9a877 1825 /**
ganlikun 0:13413ea9a877 1826 * @brief Check if the USART Transmit Data Register Empty Flag is set or not
ganlikun 0:13413ea9a877 1827 * @rmtoll SR TXE LL_USART_IsActiveFlag_TXE
ganlikun 0:13413ea9a877 1828 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 1829 * @retval State of bit (1 or 0).
ganlikun 0:13413ea9a877 1830 */
ganlikun 0:13413ea9a877 1831 __STATIC_INLINE uint32_t LL_USART_IsActiveFlag_TXE(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 1832 {
ganlikun 0:13413ea9a877 1833 return (READ_BIT(USARTx->SR, USART_SR_TXE) == (USART_SR_TXE));
ganlikun 0:13413ea9a877 1834 }
ganlikun 0:13413ea9a877 1835
ganlikun 0:13413ea9a877 1836 /**
ganlikun 0:13413ea9a877 1837 * @brief Check if the USART LIN Break Detection Flag is set or not
ganlikun 0:13413ea9a877 1838 * @note Macro @ref IS_UART_LIN_INSTANCE(USARTx) can be used to check whether or not
ganlikun 0:13413ea9a877 1839 * LIN feature is supported by the USARTx instance.
ganlikun 0:13413ea9a877 1840 * @rmtoll SR LBD LL_USART_IsActiveFlag_LBD
ganlikun 0:13413ea9a877 1841 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 1842 * @retval State of bit (1 or 0).
ganlikun 0:13413ea9a877 1843 */
ganlikun 0:13413ea9a877 1844 __STATIC_INLINE uint32_t LL_USART_IsActiveFlag_LBD(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 1845 {
ganlikun 0:13413ea9a877 1846 return (READ_BIT(USARTx->SR, USART_SR_LBD) == (USART_SR_LBD));
ganlikun 0:13413ea9a877 1847 }
ganlikun 0:13413ea9a877 1848
ganlikun 0:13413ea9a877 1849 /**
ganlikun 0:13413ea9a877 1850 * @brief Check if the USART CTS Flag is set or not
ganlikun 0:13413ea9a877 1851 * @note Macro @ref IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not
ganlikun 0:13413ea9a877 1852 * Hardware Flow control feature is supported by the USARTx instance.
ganlikun 0:13413ea9a877 1853 * @rmtoll SR CTS LL_USART_IsActiveFlag_nCTS
ganlikun 0:13413ea9a877 1854 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 1855 * @retval State of bit (1 or 0).
ganlikun 0:13413ea9a877 1856 */
ganlikun 0:13413ea9a877 1857 __STATIC_INLINE uint32_t LL_USART_IsActiveFlag_nCTS(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 1858 {
ganlikun 0:13413ea9a877 1859 return (READ_BIT(USARTx->SR, USART_SR_CTS) == (USART_SR_CTS));
ganlikun 0:13413ea9a877 1860 }
ganlikun 0:13413ea9a877 1861
ganlikun 0:13413ea9a877 1862 /**
ganlikun 0:13413ea9a877 1863 * @brief Check if the USART Send Break Flag is set or not
ganlikun 0:13413ea9a877 1864 * @rmtoll CR1 SBK LL_USART_IsActiveFlag_SBK
ganlikun 0:13413ea9a877 1865 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 1866 * @retval State of bit (1 or 0).
ganlikun 0:13413ea9a877 1867 */
ganlikun 0:13413ea9a877 1868 __STATIC_INLINE uint32_t LL_USART_IsActiveFlag_SBK(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 1869 {
ganlikun 0:13413ea9a877 1870 return (READ_BIT(USARTx->CR1, USART_CR1_SBK) == (USART_CR1_SBK));
ganlikun 0:13413ea9a877 1871 }
ganlikun 0:13413ea9a877 1872
ganlikun 0:13413ea9a877 1873 /**
ganlikun 0:13413ea9a877 1874 * @brief Check if the USART Receive Wake Up from mute mode Flag is set or not
ganlikun 0:13413ea9a877 1875 * @rmtoll CR1 RWU LL_USART_IsActiveFlag_RWU
ganlikun 0:13413ea9a877 1876 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 1877 * @retval State of bit (1 or 0).
ganlikun 0:13413ea9a877 1878 */
ganlikun 0:13413ea9a877 1879 __STATIC_INLINE uint32_t LL_USART_IsActiveFlag_RWU(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 1880 {
ganlikun 0:13413ea9a877 1881 return (READ_BIT(USARTx->CR1, USART_CR1_RWU) == (USART_CR1_RWU));
ganlikun 0:13413ea9a877 1882 }
ganlikun 0:13413ea9a877 1883
ganlikun 0:13413ea9a877 1884 /**
ganlikun 0:13413ea9a877 1885 * @brief Clear Parity Error Flag
ganlikun 0:13413ea9a877 1886 * @note Clearing this flag is done by a read access to the USARTx_SR
ganlikun 0:13413ea9a877 1887 * register followed by a read access to the USARTx_DR register.
ganlikun 0:13413ea9a877 1888 * @note Please also consider that when clearing this flag, other flags as
ganlikun 0:13413ea9a877 1889 * NE, FE, ORE, IDLE would also be cleared.
ganlikun 0:13413ea9a877 1890 * @rmtoll SR PE LL_USART_ClearFlag_PE
ganlikun 0:13413ea9a877 1891 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 1892 * @retval None
ganlikun 0:13413ea9a877 1893 */
ganlikun 0:13413ea9a877 1894 __STATIC_INLINE void LL_USART_ClearFlag_PE(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 1895 {
ganlikun 0:13413ea9a877 1896 __IO uint32_t tmpreg;
ganlikun 0:13413ea9a877 1897 tmpreg = USARTx->SR;
ganlikun 0:13413ea9a877 1898 (void) tmpreg;
ganlikun 0:13413ea9a877 1899 tmpreg = USARTx->DR;
ganlikun 0:13413ea9a877 1900 (void) tmpreg;
ganlikun 0:13413ea9a877 1901 }
ganlikun 0:13413ea9a877 1902
ganlikun 0:13413ea9a877 1903 /**
ganlikun 0:13413ea9a877 1904 * @brief Clear Framing Error Flag
ganlikun 0:13413ea9a877 1905 * @note Clearing this flag is done by a read access to the USARTx_SR
ganlikun 0:13413ea9a877 1906 * register followed by a read access to the USARTx_DR register.
ganlikun 0:13413ea9a877 1907 * @note Please also consider that when clearing this flag, other flags as
ganlikun 0:13413ea9a877 1908 * PE, NE, ORE, IDLE would also be cleared.
ganlikun 0:13413ea9a877 1909 * @rmtoll SR FE LL_USART_ClearFlag_FE
ganlikun 0:13413ea9a877 1910 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 1911 * @retval None
ganlikun 0:13413ea9a877 1912 */
ganlikun 0:13413ea9a877 1913 __STATIC_INLINE void LL_USART_ClearFlag_FE(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 1914 {
ganlikun 0:13413ea9a877 1915 __IO uint32_t tmpreg;
ganlikun 0:13413ea9a877 1916 tmpreg = USARTx->SR;
ganlikun 0:13413ea9a877 1917 (void) tmpreg;
ganlikun 0:13413ea9a877 1918 tmpreg = USARTx->DR;
ganlikun 0:13413ea9a877 1919 (void) tmpreg;
ganlikun 0:13413ea9a877 1920 }
ganlikun 0:13413ea9a877 1921
ganlikun 0:13413ea9a877 1922 /**
ganlikun 0:13413ea9a877 1923 * @brief Clear Noise detected Flag
ganlikun 0:13413ea9a877 1924 * @note Clearing this flag is done by a read access to the USARTx_SR
ganlikun 0:13413ea9a877 1925 * register followed by a read access to the USARTx_DR register.
ganlikun 0:13413ea9a877 1926 * @note Please also consider that when clearing this flag, other flags as
ganlikun 0:13413ea9a877 1927 * PE, FE, ORE, IDLE would also be cleared.
ganlikun 0:13413ea9a877 1928 * @rmtoll SR NF LL_USART_ClearFlag_NE
ganlikun 0:13413ea9a877 1929 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 1930 * @retval None
ganlikun 0:13413ea9a877 1931 */
ganlikun 0:13413ea9a877 1932 __STATIC_INLINE void LL_USART_ClearFlag_NE(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 1933 {
ganlikun 0:13413ea9a877 1934 __IO uint32_t tmpreg;
ganlikun 0:13413ea9a877 1935 tmpreg = USARTx->SR;
ganlikun 0:13413ea9a877 1936 (void) tmpreg;
ganlikun 0:13413ea9a877 1937 tmpreg = USARTx->DR;
ganlikun 0:13413ea9a877 1938 (void) tmpreg;
ganlikun 0:13413ea9a877 1939 }
ganlikun 0:13413ea9a877 1940
ganlikun 0:13413ea9a877 1941 /**
ganlikun 0:13413ea9a877 1942 * @brief Clear OverRun Error Flag
ganlikun 0:13413ea9a877 1943 * @note Clearing this flag is done by a read access to the USARTx_SR
ganlikun 0:13413ea9a877 1944 * register followed by a read access to the USARTx_DR register.
ganlikun 0:13413ea9a877 1945 * @note Please also consider that when clearing this flag, other flags as
ganlikun 0:13413ea9a877 1946 * PE, NE, FE, IDLE would also be cleared.
ganlikun 0:13413ea9a877 1947 * @rmtoll SR ORE LL_USART_ClearFlag_ORE
ganlikun 0:13413ea9a877 1948 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 1949 * @retval None
ganlikun 0:13413ea9a877 1950 */
ganlikun 0:13413ea9a877 1951 __STATIC_INLINE void LL_USART_ClearFlag_ORE(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 1952 {
ganlikun 0:13413ea9a877 1953 __IO uint32_t tmpreg;
ganlikun 0:13413ea9a877 1954 tmpreg = USARTx->SR;
ganlikun 0:13413ea9a877 1955 (void) tmpreg;
ganlikun 0:13413ea9a877 1956 tmpreg = USARTx->DR;
ganlikun 0:13413ea9a877 1957 (void) tmpreg;
ganlikun 0:13413ea9a877 1958 }
ganlikun 0:13413ea9a877 1959
ganlikun 0:13413ea9a877 1960 /**
ganlikun 0:13413ea9a877 1961 * @brief Clear IDLE line detected Flag
ganlikun 0:13413ea9a877 1962 * @note Clearing this flag is done by a read access to the USARTx_SR
ganlikun 0:13413ea9a877 1963 * register followed by a read access to the USARTx_DR register.
ganlikun 0:13413ea9a877 1964 * @note Please also consider that when clearing this flag, other flags as
ganlikun 0:13413ea9a877 1965 * PE, NE, FE, ORE would also be cleared.
ganlikun 0:13413ea9a877 1966 * @rmtoll SR IDLE LL_USART_ClearFlag_IDLE
ganlikun 0:13413ea9a877 1967 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 1968 * @retval None
ganlikun 0:13413ea9a877 1969 */
ganlikun 0:13413ea9a877 1970 __STATIC_INLINE void LL_USART_ClearFlag_IDLE(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 1971 {
ganlikun 0:13413ea9a877 1972 __IO uint32_t tmpreg;
ganlikun 0:13413ea9a877 1973 tmpreg = USARTx->SR;
ganlikun 0:13413ea9a877 1974 (void) tmpreg;
ganlikun 0:13413ea9a877 1975 tmpreg = USARTx->DR;
ganlikun 0:13413ea9a877 1976 (void) tmpreg;
ganlikun 0:13413ea9a877 1977 }
ganlikun 0:13413ea9a877 1978
ganlikun 0:13413ea9a877 1979 /**
ganlikun 0:13413ea9a877 1980 * @brief Clear Transmission Complete Flag
ganlikun 0:13413ea9a877 1981 * @rmtoll SR TC LL_USART_ClearFlag_TC
ganlikun 0:13413ea9a877 1982 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 1983 * @retval None
ganlikun 0:13413ea9a877 1984 */
ganlikun 0:13413ea9a877 1985 __STATIC_INLINE void LL_USART_ClearFlag_TC(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 1986 {
ganlikun 0:13413ea9a877 1987 WRITE_REG(USARTx->SR , ~(USART_SR_TC));
ganlikun 0:13413ea9a877 1988 }
ganlikun 0:13413ea9a877 1989
ganlikun 0:13413ea9a877 1990 /**
ganlikun 0:13413ea9a877 1991 * @brief Clear RX Not Empty Flag
ganlikun 0:13413ea9a877 1992 * @rmtoll SR RXNE LL_USART_ClearFlag_RXNE
ganlikun 0:13413ea9a877 1993 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 1994 * @retval None
ganlikun 0:13413ea9a877 1995 */
ganlikun 0:13413ea9a877 1996 __STATIC_INLINE void LL_USART_ClearFlag_RXNE(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 1997 {
ganlikun 0:13413ea9a877 1998 WRITE_REG(USARTx->SR , ~(USART_SR_RXNE));
ganlikun 0:13413ea9a877 1999 }
ganlikun 0:13413ea9a877 2000
ganlikun 0:13413ea9a877 2001 /**
ganlikun 0:13413ea9a877 2002 * @brief Clear LIN Break Detection Flag
ganlikun 0:13413ea9a877 2003 * @note Macro @ref IS_UART_LIN_INSTANCE(USARTx) can be used to check whether or not
ganlikun 0:13413ea9a877 2004 * LIN feature is supported by the USARTx instance.
ganlikun 0:13413ea9a877 2005 * @rmtoll SR LBD LL_USART_ClearFlag_LBD
ganlikun 0:13413ea9a877 2006 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 2007 * @retval None
ganlikun 0:13413ea9a877 2008 */
ganlikun 0:13413ea9a877 2009 __STATIC_INLINE void LL_USART_ClearFlag_LBD(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 2010 {
ganlikun 0:13413ea9a877 2011 WRITE_REG(USARTx->SR , ~(USART_SR_LBD));
ganlikun 0:13413ea9a877 2012 }
ganlikun 0:13413ea9a877 2013
ganlikun 0:13413ea9a877 2014 /**
ganlikun 0:13413ea9a877 2015 * @brief Clear CTS Interrupt Flag
ganlikun 0:13413ea9a877 2016 * @note Macro @ref IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not
ganlikun 0:13413ea9a877 2017 * Hardware Flow control feature is supported by the USARTx instance.
ganlikun 0:13413ea9a877 2018 * @rmtoll SR CTS LL_USART_ClearFlag_nCTS
ganlikun 0:13413ea9a877 2019 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 2020 * @retval None
ganlikun 0:13413ea9a877 2021 */
ganlikun 0:13413ea9a877 2022 __STATIC_INLINE void LL_USART_ClearFlag_nCTS(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 2023 {
ganlikun 0:13413ea9a877 2024 WRITE_REG(USARTx->SR , ~(USART_SR_CTS));
ganlikun 0:13413ea9a877 2025 }
ganlikun 0:13413ea9a877 2026
ganlikun 0:13413ea9a877 2027 /**
ganlikun 0:13413ea9a877 2028 * @}
ganlikun 0:13413ea9a877 2029 */
ganlikun 0:13413ea9a877 2030
ganlikun 0:13413ea9a877 2031 /** @defgroup USART_LL_EF_IT_Management IT_Management
ganlikun 0:13413ea9a877 2032 * @{
ganlikun 0:13413ea9a877 2033 */
ganlikun 0:13413ea9a877 2034
ganlikun 0:13413ea9a877 2035 /**
ganlikun 0:13413ea9a877 2036 * @brief Enable IDLE Interrupt
ganlikun 0:13413ea9a877 2037 * @rmtoll CR1 IDLEIE LL_USART_EnableIT_IDLE
ganlikun 0:13413ea9a877 2038 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 2039 * @retval None
ganlikun 0:13413ea9a877 2040 */
ganlikun 0:13413ea9a877 2041 __STATIC_INLINE void LL_USART_EnableIT_IDLE(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 2042 {
ganlikun 0:13413ea9a877 2043 SET_BIT(USARTx->CR1, USART_CR1_IDLEIE);
ganlikun 0:13413ea9a877 2044 }
ganlikun 0:13413ea9a877 2045
ganlikun 0:13413ea9a877 2046 /**
ganlikun 0:13413ea9a877 2047 * @brief Enable RX Not Empty Interrupt
ganlikun 0:13413ea9a877 2048 * @rmtoll CR1 RXNEIE LL_USART_EnableIT_RXNE
ganlikun 0:13413ea9a877 2049 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 2050 * @retval None
ganlikun 0:13413ea9a877 2051 */
ganlikun 0:13413ea9a877 2052 __STATIC_INLINE void LL_USART_EnableIT_RXNE(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 2053 {
ganlikun 0:13413ea9a877 2054 SET_BIT(USARTx->CR1, USART_CR1_RXNEIE);
ganlikun 0:13413ea9a877 2055 }
ganlikun 0:13413ea9a877 2056
ganlikun 0:13413ea9a877 2057 /**
ganlikun 0:13413ea9a877 2058 * @brief Enable Transmission Complete Interrupt
ganlikun 0:13413ea9a877 2059 * @rmtoll CR1 TCIE LL_USART_EnableIT_TC
ganlikun 0:13413ea9a877 2060 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 2061 * @retval None
ganlikun 0:13413ea9a877 2062 */
ganlikun 0:13413ea9a877 2063 __STATIC_INLINE void LL_USART_EnableIT_TC(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 2064 {
ganlikun 0:13413ea9a877 2065 SET_BIT(USARTx->CR1, USART_CR1_TCIE);
ganlikun 0:13413ea9a877 2066 }
ganlikun 0:13413ea9a877 2067
ganlikun 0:13413ea9a877 2068 /**
ganlikun 0:13413ea9a877 2069 * @brief Enable TX Empty Interrupt
ganlikun 0:13413ea9a877 2070 * @rmtoll CR1 TXEIE LL_USART_EnableIT_TXE
ganlikun 0:13413ea9a877 2071 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 2072 * @retval None
ganlikun 0:13413ea9a877 2073 */
ganlikun 0:13413ea9a877 2074 __STATIC_INLINE void LL_USART_EnableIT_TXE(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 2075 {
ganlikun 0:13413ea9a877 2076 SET_BIT(USARTx->CR1, USART_CR1_TXEIE);
ganlikun 0:13413ea9a877 2077 }
ganlikun 0:13413ea9a877 2078
ganlikun 0:13413ea9a877 2079 /**
ganlikun 0:13413ea9a877 2080 * @brief Enable Parity Error Interrupt
ganlikun 0:13413ea9a877 2081 * @rmtoll CR1 PEIE LL_USART_EnableIT_PE
ganlikun 0:13413ea9a877 2082 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 2083 * @retval None
ganlikun 0:13413ea9a877 2084 */
ganlikun 0:13413ea9a877 2085 __STATIC_INLINE void LL_USART_EnableIT_PE(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 2086 {
ganlikun 0:13413ea9a877 2087 SET_BIT(USARTx->CR1, USART_CR1_PEIE);
ganlikun 0:13413ea9a877 2088 }
ganlikun 0:13413ea9a877 2089
ganlikun 0:13413ea9a877 2090 /**
ganlikun 0:13413ea9a877 2091 * @brief Enable LIN Break Detection Interrupt
ganlikun 0:13413ea9a877 2092 * @note Macro @ref IS_UART_LIN_INSTANCE(USARTx) can be used to check whether or not
ganlikun 0:13413ea9a877 2093 * LIN feature is supported by the USARTx instance.
ganlikun 0:13413ea9a877 2094 * @rmtoll CR2 LBDIE LL_USART_EnableIT_LBD
ganlikun 0:13413ea9a877 2095 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 2096 * @retval None
ganlikun 0:13413ea9a877 2097 */
ganlikun 0:13413ea9a877 2098 __STATIC_INLINE void LL_USART_EnableIT_LBD(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 2099 {
ganlikun 0:13413ea9a877 2100 SET_BIT(USARTx->CR2, USART_CR2_LBDIE);
ganlikun 0:13413ea9a877 2101 }
ganlikun 0:13413ea9a877 2102
ganlikun 0:13413ea9a877 2103 /**
ganlikun 0:13413ea9a877 2104 * @brief Enable Error Interrupt
ganlikun 0:13413ea9a877 2105 * @note When set, Error Interrupt Enable Bit is enabling interrupt generation in case of a framing
ganlikun 0:13413ea9a877 2106 * error, overrun error or noise flag (FE=1 or ORE=1 or NF=1 in the USARTx_SR register).
ganlikun 0:13413ea9a877 2107 * 0: Interrupt is inhibited
ganlikun 0:13413ea9a877 2108 * 1: An interrupt is generated when FE=1 or ORE=1 or NF=1 in the USARTx_SR register.
ganlikun 0:13413ea9a877 2109 * @rmtoll CR3 EIE LL_USART_EnableIT_ERROR
ganlikun 0:13413ea9a877 2110 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 2111 * @retval None
ganlikun 0:13413ea9a877 2112 */
ganlikun 0:13413ea9a877 2113 __STATIC_INLINE void LL_USART_EnableIT_ERROR(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 2114 {
ganlikun 0:13413ea9a877 2115 SET_BIT(USARTx->CR3, USART_CR3_EIE);
ganlikun 0:13413ea9a877 2116 }
ganlikun 0:13413ea9a877 2117
ganlikun 0:13413ea9a877 2118 /**
ganlikun 0:13413ea9a877 2119 * @brief Enable CTS Interrupt
ganlikun 0:13413ea9a877 2120 * @note Macro @ref IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not
ganlikun 0:13413ea9a877 2121 * Hardware Flow control feature is supported by the USARTx instance.
ganlikun 0:13413ea9a877 2122 * @rmtoll CR3 CTSIE LL_USART_EnableIT_CTS
ganlikun 0:13413ea9a877 2123 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 2124 * @retval None
ganlikun 0:13413ea9a877 2125 */
ganlikun 0:13413ea9a877 2126 __STATIC_INLINE void LL_USART_EnableIT_CTS(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 2127 {
ganlikun 0:13413ea9a877 2128 SET_BIT(USARTx->CR3, USART_CR3_CTSIE);
ganlikun 0:13413ea9a877 2129 }
ganlikun 0:13413ea9a877 2130
ganlikun 0:13413ea9a877 2131 /**
ganlikun 0:13413ea9a877 2132 * @brief Disable IDLE Interrupt
ganlikun 0:13413ea9a877 2133 * @rmtoll CR1 IDLEIE LL_USART_DisableIT_IDLE
ganlikun 0:13413ea9a877 2134 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 2135 * @retval None
ganlikun 0:13413ea9a877 2136 */
ganlikun 0:13413ea9a877 2137 __STATIC_INLINE void LL_USART_DisableIT_IDLE(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 2138 {
ganlikun 0:13413ea9a877 2139 CLEAR_BIT(USARTx->CR1, USART_CR1_IDLEIE);
ganlikun 0:13413ea9a877 2140 }
ganlikun 0:13413ea9a877 2141
ganlikun 0:13413ea9a877 2142 /**
ganlikun 0:13413ea9a877 2143 * @brief Disable RX Not Empty Interrupt
ganlikun 0:13413ea9a877 2144 * @rmtoll CR1 RXNEIE LL_USART_DisableIT_RXNE
ganlikun 0:13413ea9a877 2145 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 2146 * @retval None
ganlikun 0:13413ea9a877 2147 */
ganlikun 0:13413ea9a877 2148 __STATIC_INLINE void LL_USART_DisableIT_RXNE(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 2149 {
ganlikun 0:13413ea9a877 2150 CLEAR_BIT(USARTx->CR1, USART_CR1_RXNEIE);
ganlikun 0:13413ea9a877 2151 }
ganlikun 0:13413ea9a877 2152
ganlikun 0:13413ea9a877 2153 /**
ganlikun 0:13413ea9a877 2154 * @brief Disable Transmission Complete Interrupt
ganlikun 0:13413ea9a877 2155 * @rmtoll CR1 TCIE LL_USART_DisableIT_TC
ganlikun 0:13413ea9a877 2156 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 2157 * @retval None
ganlikun 0:13413ea9a877 2158 */
ganlikun 0:13413ea9a877 2159 __STATIC_INLINE void LL_USART_DisableIT_TC(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 2160 {
ganlikun 0:13413ea9a877 2161 CLEAR_BIT(USARTx->CR1, USART_CR1_TCIE);
ganlikun 0:13413ea9a877 2162 }
ganlikun 0:13413ea9a877 2163
ganlikun 0:13413ea9a877 2164 /**
ganlikun 0:13413ea9a877 2165 * @brief Disable TX Empty Interrupt
ganlikun 0:13413ea9a877 2166 * @rmtoll CR1 TXEIE LL_USART_DisableIT_TXE
ganlikun 0:13413ea9a877 2167 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 2168 * @retval None
ganlikun 0:13413ea9a877 2169 */
ganlikun 0:13413ea9a877 2170 __STATIC_INLINE void LL_USART_DisableIT_TXE(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 2171 {
ganlikun 0:13413ea9a877 2172 CLEAR_BIT(USARTx->CR1, USART_CR1_TXEIE);
ganlikun 0:13413ea9a877 2173 }
ganlikun 0:13413ea9a877 2174
ganlikun 0:13413ea9a877 2175 /**
ganlikun 0:13413ea9a877 2176 * @brief Disable Parity Error Interrupt
ganlikun 0:13413ea9a877 2177 * @rmtoll CR1 PEIE LL_USART_DisableIT_PE
ganlikun 0:13413ea9a877 2178 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 2179 * @retval None
ganlikun 0:13413ea9a877 2180 */
ganlikun 0:13413ea9a877 2181 __STATIC_INLINE void LL_USART_DisableIT_PE(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 2182 {
ganlikun 0:13413ea9a877 2183 CLEAR_BIT(USARTx->CR1, USART_CR1_PEIE);
ganlikun 0:13413ea9a877 2184 }
ganlikun 0:13413ea9a877 2185
ganlikun 0:13413ea9a877 2186 /**
ganlikun 0:13413ea9a877 2187 * @brief Disable LIN Break Detection Interrupt
ganlikun 0:13413ea9a877 2188 * @note Macro @ref IS_UART_LIN_INSTANCE(USARTx) can be used to check whether or not
ganlikun 0:13413ea9a877 2189 * LIN feature is supported by the USARTx instance.
ganlikun 0:13413ea9a877 2190 * @rmtoll CR2 LBDIE LL_USART_DisableIT_LBD
ganlikun 0:13413ea9a877 2191 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 2192 * @retval None
ganlikun 0:13413ea9a877 2193 */
ganlikun 0:13413ea9a877 2194 __STATIC_INLINE void LL_USART_DisableIT_LBD(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 2195 {
ganlikun 0:13413ea9a877 2196 CLEAR_BIT(USARTx->CR2, USART_CR2_LBDIE);
ganlikun 0:13413ea9a877 2197 }
ganlikun 0:13413ea9a877 2198
ganlikun 0:13413ea9a877 2199 /**
ganlikun 0:13413ea9a877 2200 * @brief Disable Error Interrupt
ganlikun 0:13413ea9a877 2201 * @note When set, Error Interrupt Enable Bit is enabling interrupt generation in case of a framing
ganlikun 0:13413ea9a877 2202 * error, overrun error or noise flag (FE=1 or ORE=1 or NF=1 in the USARTx_SR register).
ganlikun 0:13413ea9a877 2203 * 0: Interrupt is inhibited
ganlikun 0:13413ea9a877 2204 * 1: An interrupt is generated when FE=1 or ORE=1 or NF=1 in the USARTx_SR register.
ganlikun 0:13413ea9a877 2205 * @rmtoll CR3 EIE LL_USART_DisableIT_ERROR
ganlikun 0:13413ea9a877 2206 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 2207 * @retval None
ganlikun 0:13413ea9a877 2208 */
ganlikun 0:13413ea9a877 2209 __STATIC_INLINE void LL_USART_DisableIT_ERROR(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 2210 {
ganlikun 0:13413ea9a877 2211 CLEAR_BIT(USARTx->CR3, USART_CR3_EIE);
ganlikun 0:13413ea9a877 2212 }
ganlikun 0:13413ea9a877 2213
ganlikun 0:13413ea9a877 2214 /**
ganlikun 0:13413ea9a877 2215 * @brief Disable CTS Interrupt
ganlikun 0:13413ea9a877 2216 * @note Macro @ref IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not
ganlikun 0:13413ea9a877 2217 * Hardware Flow control feature is supported by the USARTx instance.
ganlikun 0:13413ea9a877 2218 * @rmtoll CR3 CTSIE LL_USART_DisableIT_CTS
ganlikun 0:13413ea9a877 2219 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 2220 * @retval None
ganlikun 0:13413ea9a877 2221 */
ganlikun 0:13413ea9a877 2222 __STATIC_INLINE void LL_USART_DisableIT_CTS(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 2223 {
ganlikun 0:13413ea9a877 2224 CLEAR_BIT(USARTx->CR3, USART_CR3_CTSIE);
ganlikun 0:13413ea9a877 2225 }
ganlikun 0:13413ea9a877 2226
ganlikun 0:13413ea9a877 2227 /**
ganlikun 0:13413ea9a877 2228 * @brief Check if the USART IDLE Interrupt source is enabled or disabled.
ganlikun 0:13413ea9a877 2229 * @rmtoll CR1 IDLEIE LL_USART_IsEnabledIT_IDLE
ganlikun 0:13413ea9a877 2230 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 2231 * @retval State of bit (1 or 0).
ganlikun 0:13413ea9a877 2232 */
ganlikun 0:13413ea9a877 2233 __STATIC_INLINE uint32_t LL_USART_IsEnabledIT_IDLE(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 2234 {
ganlikun 0:13413ea9a877 2235 return (READ_BIT(USARTx->CR1, USART_CR1_IDLEIE) == (USART_CR1_IDLEIE));
ganlikun 0:13413ea9a877 2236 }
ganlikun 0:13413ea9a877 2237
ganlikun 0:13413ea9a877 2238 /**
ganlikun 0:13413ea9a877 2239 * @brief Check if the USART RX Not Empty Interrupt is enabled or disabled.
ganlikun 0:13413ea9a877 2240 * @rmtoll CR1 RXNEIE LL_USART_IsEnabledIT_RXNE
ganlikun 0:13413ea9a877 2241 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 2242 * @retval State of bit (1 or 0).
ganlikun 0:13413ea9a877 2243 */
ganlikun 0:13413ea9a877 2244 __STATIC_INLINE uint32_t LL_USART_IsEnabledIT_RXNE(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 2245 {
ganlikun 0:13413ea9a877 2246 return (READ_BIT(USARTx->CR1, USART_CR1_RXNEIE) == (USART_CR1_RXNEIE));
ganlikun 0:13413ea9a877 2247 }
ganlikun 0:13413ea9a877 2248
ganlikun 0:13413ea9a877 2249 /**
ganlikun 0:13413ea9a877 2250 * @brief Check if the USART Transmission Complete Interrupt is enabled or disabled.
ganlikun 0:13413ea9a877 2251 * @rmtoll CR1 TCIE LL_USART_IsEnabledIT_TC
ganlikun 0:13413ea9a877 2252 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 2253 * @retval State of bit (1 or 0).
ganlikun 0:13413ea9a877 2254 */
ganlikun 0:13413ea9a877 2255 __STATIC_INLINE uint32_t LL_USART_IsEnabledIT_TC(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 2256 {
ganlikun 0:13413ea9a877 2257 return (READ_BIT(USARTx->CR1, USART_CR1_TCIE) == (USART_CR1_TCIE));
ganlikun 0:13413ea9a877 2258 }
ganlikun 0:13413ea9a877 2259
ganlikun 0:13413ea9a877 2260 /**
ganlikun 0:13413ea9a877 2261 * @brief Check if the USART TX Empty Interrupt is enabled or disabled.
ganlikun 0:13413ea9a877 2262 * @rmtoll CR1 TXEIE LL_USART_IsEnabledIT_TXE
ganlikun 0:13413ea9a877 2263 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 2264 * @retval State of bit (1 or 0).
ganlikun 0:13413ea9a877 2265 */
ganlikun 0:13413ea9a877 2266 __STATIC_INLINE uint32_t LL_USART_IsEnabledIT_TXE(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 2267 {
ganlikun 0:13413ea9a877 2268 return (READ_BIT(USARTx->CR1, USART_CR1_TXEIE) == (USART_CR1_TXEIE));
ganlikun 0:13413ea9a877 2269 }
ganlikun 0:13413ea9a877 2270
ganlikun 0:13413ea9a877 2271 /**
ganlikun 0:13413ea9a877 2272 * @brief Check if the USART Parity Error Interrupt is enabled or disabled.
ganlikun 0:13413ea9a877 2273 * @rmtoll CR1 PEIE LL_USART_IsEnabledIT_PE
ganlikun 0:13413ea9a877 2274 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 2275 * @retval State of bit (1 or 0).
ganlikun 0:13413ea9a877 2276 */
ganlikun 0:13413ea9a877 2277 __STATIC_INLINE uint32_t LL_USART_IsEnabledIT_PE(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 2278 {
ganlikun 0:13413ea9a877 2279 return (READ_BIT(USARTx->CR1, USART_CR1_PEIE) == (USART_CR1_PEIE));
ganlikun 0:13413ea9a877 2280 }
ganlikun 0:13413ea9a877 2281
ganlikun 0:13413ea9a877 2282 /**
ganlikun 0:13413ea9a877 2283 * @brief Check if the USART LIN Break Detection Interrupt is enabled or disabled.
ganlikun 0:13413ea9a877 2284 * @note Macro @ref IS_UART_LIN_INSTANCE(USARTx) can be used to check whether or not
ganlikun 0:13413ea9a877 2285 * LIN feature is supported by the USARTx instance.
ganlikun 0:13413ea9a877 2286 * @rmtoll CR2 LBDIE LL_USART_IsEnabledIT_LBD
ganlikun 0:13413ea9a877 2287 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 2288 * @retval State of bit (1 or 0).
ganlikun 0:13413ea9a877 2289 */
ganlikun 0:13413ea9a877 2290 __STATIC_INLINE uint32_t LL_USART_IsEnabledIT_LBD(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 2291 {
ganlikun 0:13413ea9a877 2292 return (READ_BIT(USARTx->CR2, USART_CR2_LBDIE) == (USART_CR2_LBDIE));
ganlikun 0:13413ea9a877 2293 }
ganlikun 0:13413ea9a877 2294
ganlikun 0:13413ea9a877 2295 /**
ganlikun 0:13413ea9a877 2296 * @brief Check if the USART Error Interrupt is enabled or disabled.
ganlikun 0:13413ea9a877 2297 * @rmtoll CR3 EIE LL_USART_IsEnabledIT_ERROR
ganlikun 0:13413ea9a877 2298 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 2299 * @retval State of bit (1 or 0).
ganlikun 0:13413ea9a877 2300 */
ganlikun 0:13413ea9a877 2301 __STATIC_INLINE uint32_t LL_USART_IsEnabledIT_ERROR(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 2302 {
ganlikun 0:13413ea9a877 2303 return (READ_BIT(USARTx->CR3, USART_CR3_EIE) == (USART_CR3_EIE));
ganlikun 0:13413ea9a877 2304 }
ganlikun 0:13413ea9a877 2305
ganlikun 0:13413ea9a877 2306 /**
ganlikun 0:13413ea9a877 2307 * @brief Check if the USART CTS Interrupt is enabled or disabled.
ganlikun 0:13413ea9a877 2308 * @note Macro @ref IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not
ganlikun 0:13413ea9a877 2309 * Hardware Flow control feature is supported by the USARTx instance.
ganlikun 0:13413ea9a877 2310 * @rmtoll CR3 CTSIE LL_USART_IsEnabledIT_CTS
ganlikun 0:13413ea9a877 2311 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 2312 * @retval State of bit (1 or 0).
ganlikun 0:13413ea9a877 2313 */
ganlikun 0:13413ea9a877 2314 __STATIC_INLINE uint32_t LL_USART_IsEnabledIT_CTS(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 2315 {
ganlikun 0:13413ea9a877 2316 return (READ_BIT(USARTx->CR3, USART_CR3_CTSIE) == (USART_CR3_CTSIE));
ganlikun 0:13413ea9a877 2317 }
ganlikun 0:13413ea9a877 2318
ganlikun 0:13413ea9a877 2319 /**
ganlikun 0:13413ea9a877 2320 * @}
ganlikun 0:13413ea9a877 2321 */
ganlikun 0:13413ea9a877 2322
ganlikun 0:13413ea9a877 2323 /** @defgroup USART_LL_EF_DMA_Management DMA_Management
ganlikun 0:13413ea9a877 2324 * @{
ganlikun 0:13413ea9a877 2325 */
ganlikun 0:13413ea9a877 2326
ganlikun 0:13413ea9a877 2327 /**
ganlikun 0:13413ea9a877 2328 * @brief Enable DMA Mode for reception
ganlikun 0:13413ea9a877 2329 * @rmtoll CR3 DMAR LL_USART_EnableDMAReq_RX
ganlikun 0:13413ea9a877 2330 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 2331 * @retval None
ganlikun 0:13413ea9a877 2332 */
ganlikun 0:13413ea9a877 2333 __STATIC_INLINE void LL_USART_EnableDMAReq_RX(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 2334 {
ganlikun 0:13413ea9a877 2335 SET_BIT(USARTx->CR3, USART_CR3_DMAR);
ganlikun 0:13413ea9a877 2336 }
ganlikun 0:13413ea9a877 2337
ganlikun 0:13413ea9a877 2338 /**
ganlikun 0:13413ea9a877 2339 * @brief Disable DMA Mode for reception
ganlikun 0:13413ea9a877 2340 * @rmtoll CR3 DMAR LL_USART_DisableDMAReq_RX
ganlikun 0:13413ea9a877 2341 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 2342 * @retval None
ganlikun 0:13413ea9a877 2343 */
ganlikun 0:13413ea9a877 2344 __STATIC_INLINE void LL_USART_DisableDMAReq_RX(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 2345 {
ganlikun 0:13413ea9a877 2346 CLEAR_BIT(USARTx->CR3, USART_CR3_DMAR);
ganlikun 0:13413ea9a877 2347 }
ganlikun 0:13413ea9a877 2348
ganlikun 0:13413ea9a877 2349 /**
ganlikun 0:13413ea9a877 2350 * @brief Check if DMA Mode is enabled for reception
ganlikun 0:13413ea9a877 2351 * @rmtoll CR3 DMAR LL_USART_IsEnabledDMAReq_RX
ganlikun 0:13413ea9a877 2352 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 2353 * @retval State of bit (1 or 0).
ganlikun 0:13413ea9a877 2354 */
ganlikun 0:13413ea9a877 2355 __STATIC_INLINE uint32_t LL_USART_IsEnabledDMAReq_RX(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 2356 {
ganlikun 0:13413ea9a877 2357 return (READ_BIT(USARTx->CR3, USART_CR3_DMAR) == (USART_CR3_DMAR));
ganlikun 0:13413ea9a877 2358 }
ganlikun 0:13413ea9a877 2359
ganlikun 0:13413ea9a877 2360 /**
ganlikun 0:13413ea9a877 2361 * @brief Enable DMA Mode for transmission
ganlikun 0:13413ea9a877 2362 * @rmtoll CR3 DMAT LL_USART_EnableDMAReq_TX
ganlikun 0:13413ea9a877 2363 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 2364 * @retval None
ganlikun 0:13413ea9a877 2365 */
ganlikun 0:13413ea9a877 2366 __STATIC_INLINE void LL_USART_EnableDMAReq_TX(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 2367 {
ganlikun 0:13413ea9a877 2368 SET_BIT(USARTx->CR3, USART_CR3_DMAT);
ganlikun 0:13413ea9a877 2369 }
ganlikun 0:13413ea9a877 2370
ganlikun 0:13413ea9a877 2371 /**
ganlikun 0:13413ea9a877 2372 * @brief Disable DMA Mode for transmission
ganlikun 0:13413ea9a877 2373 * @rmtoll CR3 DMAT LL_USART_DisableDMAReq_TX
ganlikun 0:13413ea9a877 2374 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 2375 * @retval None
ganlikun 0:13413ea9a877 2376 */
ganlikun 0:13413ea9a877 2377 __STATIC_INLINE void LL_USART_DisableDMAReq_TX(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 2378 {
ganlikun 0:13413ea9a877 2379 CLEAR_BIT(USARTx->CR3, USART_CR3_DMAT);
ganlikun 0:13413ea9a877 2380 }
ganlikun 0:13413ea9a877 2381
ganlikun 0:13413ea9a877 2382 /**
ganlikun 0:13413ea9a877 2383 * @brief Check if DMA Mode is enabled for transmission
ganlikun 0:13413ea9a877 2384 * @rmtoll CR3 DMAT LL_USART_IsEnabledDMAReq_TX
ganlikun 0:13413ea9a877 2385 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 2386 * @retval State of bit (1 or 0).
ganlikun 0:13413ea9a877 2387 */
ganlikun 0:13413ea9a877 2388 __STATIC_INLINE uint32_t LL_USART_IsEnabledDMAReq_TX(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 2389 {
ganlikun 0:13413ea9a877 2390 return (READ_BIT(USARTx->CR3, USART_CR3_DMAT) == (USART_CR3_DMAT));
ganlikun 0:13413ea9a877 2391 }
ganlikun 0:13413ea9a877 2392
ganlikun 0:13413ea9a877 2393 /**
ganlikun 0:13413ea9a877 2394 * @brief Get the data register address used for DMA transfer
ganlikun 0:13413ea9a877 2395 * @rmtoll DR DR LL_USART_DMA_GetRegAddr
ganlikun 0:13413ea9a877 2396 * @note Address of Data Register is valid for both Transmit and Receive transfers.
ganlikun 0:13413ea9a877 2397 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 2398 * @retval Address of data register
ganlikun 0:13413ea9a877 2399 */
ganlikun 0:13413ea9a877 2400 __STATIC_INLINE uint32_t LL_USART_DMA_GetRegAddr(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 2401 {
ganlikun 0:13413ea9a877 2402 /* return address of DR register */
ganlikun 0:13413ea9a877 2403 return ((uint32_t) &(USARTx->DR));
ganlikun 0:13413ea9a877 2404 }
ganlikun 0:13413ea9a877 2405
ganlikun 0:13413ea9a877 2406 /**
ganlikun 0:13413ea9a877 2407 * @}
ganlikun 0:13413ea9a877 2408 */
ganlikun 0:13413ea9a877 2409
ganlikun 0:13413ea9a877 2410 /** @defgroup USART_LL_EF_Data_Management Data_Management
ganlikun 0:13413ea9a877 2411 * @{
ganlikun 0:13413ea9a877 2412 */
ganlikun 0:13413ea9a877 2413
ganlikun 0:13413ea9a877 2414 /**
ganlikun 0:13413ea9a877 2415 * @brief Read Receiver Data register (Receive Data value, 8 bits)
ganlikun 0:13413ea9a877 2416 * @rmtoll DR DR LL_USART_ReceiveData8
ganlikun 0:13413ea9a877 2417 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 2418 * @retval Value between Min_Data=0x00 and Max_Data=0xFF
ganlikun 0:13413ea9a877 2419 */
ganlikun 0:13413ea9a877 2420 __STATIC_INLINE uint8_t LL_USART_ReceiveData8(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 2421 {
ganlikun 0:13413ea9a877 2422 return (uint8_t)(READ_BIT(USARTx->DR, USART_DR_DR));
ganlikun 0:13413ea9a877 2423 }
ganlikun 0:13413ea9a877 2424
ganlikun 0:13413ea9a877 2425 /**
ganlikun 0:13413ea9a877 2426 * @brief Read Receiver Data register (Receive Data value, 9 bits)
ganlikun 0:13413ea9a877 2427 * @rmtoll DR DR LL_USART_ReceiveData9
ganlikun 0:13413ea9a877 2428 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 2429 * @retval Value between Min_Data=0x00 and Max_Data=0x1FF
ganlikun 0:13413ea9a877 2430 */
ganlikun 0:13413ea9a877 2431 __STATIC_INLINE uint16_t LL_USART_ReceiveData9(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 2432 {
ganlikun 0:13413ea9a877 2433 return (uint16_t)(READ_BIT(USARTx->DR, USART_DR_DR));
ganlikun 0:13413ea9a877 2434 }
ganlikun 0:13413ea9a877 2435
ganlikun 0:13413ea9a877 2436 /**
ganlikun 0:13413ea9a877 2437 * @brief Write in Transmitter Data Register (Transmit Data value, 8 bits)
ganlikun 0:13413ea9a877 2438 * @rmtoll DR DR LL_USART_TransmitData8
ganlikun 0:13413ea9a877 2439 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 2440 * @param Value between Min_Data=0x00 and Max_Data=0xFF
ganlikun 0:13413ea9a877 2441 * @retval None
ganlikun 0:13413ea9a877 2442 */
ganlikun 0:13413ea9a877 2443 __STATIC_INLINE void LL_USART_TransmitData8(USART_TypeDef *USARTx, uint8_t Value)
ganlikun 0:13413ea9a877 2444 {
ganlikun 0:13413ea9a877 2445 USARTx->DR = Value;
ganlikun 0:13413ea9a877 2446 }
ganlikun 0:13413ea9a877 2447
ganlikun 0:13413ea9a877 2448 /**
ganlikun 0:13413ea9a877 2449 * @brief Write in Transmitter Data Register (Transmit Data value, 9 bits)
ganlikun 0:13413ea9a877 2450 * @rmtoll DR DR LL_USART_TransmitData9
ganlikun 0:13413ea9a877 2451 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 2452 * @param Value between Min_Data=0x00 and Max_Data=0x1FF
ganlikun 0:13413ea9a877 2453 * @retval None
ganlikun 0:13413ea9a877 2454 */
ganlikun 0:13413ea9a877 2455 __STATIC_INLINE void LL_USART_TransmitData9(USART_TypeDef *USARTx, uint16_t Value)
ganlikun 0:13413ea9a877 2456 {
ganlikun 0:13413ea9a877 2457 USARTx->DR = Value & 0x1FFU;
ganlikun 0:13413ea9a877 2458 }
ganlikun 0:13413ea9a877 2459
ganlikun 0:13413ea9a877 2460 /**
ganlikun 0:13413ea9a877 2461 * @}
ganlikun 0:13413ea9a877 2462 */
ganlikun 0:13413ea9a877 2463
ganlikun 0:13413ea9a877 2464 /** @defgroup USART_LL_EF_Execution Execution
ganlikun 0:13413ea9a877 2465 * @{
ganlikun 0:13413ea9a877 2466 */
ganlikun 0:13413ea9a877 2467
ganlikun 0:13413ea9a877 2468 /**
ganlikun 0:13413ea9a877 2469 * @brief Request Break sending
ganlikun 0:13413ea9a877 2470 * @rmtoll CR1 SBK LL_USART_RequestBreakSending
ganlikun 0:13413ea9a877 2471 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 2472 * @retval None
ganlikun 0:13413ea9a877 2473 */
ganlikun 0:13413ea9a877 2474 __STATIC_INLINE void LL_USART_RequestBreakSending(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 2475 {
ganlikun 0:13413ea9a877 2476 SET_BIT(USARTx->CR1, USART_CR1_SBK);
ganlikun 0:13413ea9a877 2477 }
ganlikun 0:13413ea9a877 2478
ganlikun 0:13413ea9a877 2479 /**
ganlikun 0:13413ea9a877 2480 * @brief Put USART in Mute mode
ganlikun 0:13413ea9a877 2481 * @rmtoll CR1 RWU LL_USART_RequestEnterMuteMode
ganlikun 0:13413ea9a877 2482 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 2483 * @retval None
ganlikun 0:13413ea9a877 2484 */
ganlikun 0:13413ea9a877 2485 __STATIC_INLINE void LL_USART_RequestEnterMuteMode(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 2486 {
ganlikun 0:13413ea9a877 2487 SET_BIT(USARTx->CR1, USART_CR1_RWU);
ganlikun 0:13413ea9a877 2488 }
ganlikun 0:13413ea9a877 2489
ganlikun 0:13413ea9a877 2490 /**
ganlikun 0:13413ea9a877 2491 * @brief Put USART in Active mode
ganlikun 0:13413ea9a877 2492 * @rmtoll CR1 RWU LL_USART_RequestExitMuteMode
ganlikun 0:13413ea9a877 2493 * @param USARTx USART Instance
ganlikun 0:13413ea9a877 2494 * @retval None
ganlikun 0:13413ea9a877 2495 */
ganlikun 0:13413ea9a877 2496 __STATIC_INLINE void LL_USART_RequestExitMuteMode(USART_TypeDef *USARTx)
ganlikun 0:13413ea9a877 2497 {
ganlikun 0:13413ea9a877 2498 CLEAR_BIT(USARTx->CR1, USART_CR1_RWU);
ganlikun 0:13413ea9a877 2499 }
ganlikun 0:13413ea9a877 2500
ganlikun 0:13413ea9a877 2501 /**
ganlikun 0:13413ea9a877 2502 * @}
ganlikun 0:13413ea9a877 2503 */
ganlikun 0:13413ea9a877 2504
ganlikun 0:13413ea9a877 2505 #if defined(USE_FULL_LL_DRIVER)
ganlikun 0:13413ea9a877 2506 /** @defgroup USART_LL_EF_Init Initialization and de-initialization functions
ganlikun 0:13413ea9a877 2507 * @{
ganlikun 0:13413ea9a877 2508 */
ganlikun 0:13413ea9a877 2509 ErrorStatus LL_USART_DeInit(USART_TypeDef *USARTx);
ganlikun 0:13413ea9a877 2510 ErrorStatus LL_USART_Init(USART_TypeDef *USARTx, LL_USART_InitTypeDef *USART_InitStruct);
ganlikun 0:13413ea9a877 2511 void LL_USART_StructInit(LL_USART_InitTypeDef *USART_InitStruct);
ganlikun 0:13413ea9a877 2512 ErrorStatus LL_USART_ClockInit(USART_TypeDef *USARTx, LL_USART_ClockInitTypeDef *USART_ClockInitStruct);
ganlikun 0:13413ea9a877 2513 void LL_USART_ClockStructInit(LL_USART_ClockInitTypeDef *USART_ClockInitStruct);
ganlikun 0:13413ea9a877 2514 /**
ganlikun 0:13413ea9a877 2515 * @}
ganlikun 0:13413ea9a877 2516 */
ganlikun 0:13413ea9a877 2517 #endif /* USE_FULL_LL_DRIVER */
ganlikun 0:13413ea9a877 2518
ganlikun 0:13413ea9a877 2519 /**
ganlikun 0:13413ea9a877 2520 * @}
ganlikun 0:13413ea9a877 2521 */
ganlikun 0:13413ea9a877 2522
ganlikun 0:13413ea9a877 2523 /**
ganlikun 0:13413ea9a877 2524 * @}
ganlikun 0:13413ea9a877 2525 */
ganlikun 0:13413ea9a877 2526
ganlikun 0:13413ea9a877 2527 #endif /* USART1 || USART2 || USART3 || USART6 || UART4 || UART5 || UART7 || UART8 || UART9 || UART10 */
ganlikun 0:13413ea9a877 2528
ganlikun 0:13413ea9a877 2529 /**
ganlikun 0:13413ea9a877 2530 * @}
ganlikun 0:13413ea9a877 2531 */
ganlikun 0:13413ea9a877 2532
ganlikun 0:13413ea9a877 2533 #ifdef __cplusplus
ganlikun 0:13413ea9a877 2534 }
ganlikun 0:13413ea9a877 2535 #endif
ganlikun 0:13413ea9a877 2536
ganlikun 0:13413ea9a877 2537 #endif /* __STM32F4xx_LL_USART_H */
ganlikun 0:13413ea9a877 2538
ganlikun 0:13413ea9a877 2539 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
ganlikun 0:13413ea9a877 2540