Iftikhar Aziz / mbed-dev

Dependents:   LSS_Rev_1

Fork of mbed-dev by Umar Naeem

Committer:
iftaziz
Date:
Wed Aug 23 10:32:38 2017 +0000
Revision:
166:33361e55dd8c
Parent:
149:156823d33999
r1

Who changed what in which revision?

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