The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

mbed 2

This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.

Committer:
AnnaBridge
Date:
Wed Jun 21 17:31:38 2017 +0100
Revision:
145:64910690c574
Parent:
128:9bcdf88f62b0
Release 145 of the mbed library.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Kojto 122:f9eeca106725 1 /**
Kojto 122:f9eeca106725 2 ******************************************************************************
Kojto 122:f9eeca106725 3 * @file stm32l4xx_ll_usart.h
Kojto 122:f9eeca106725 4 * @author MCD Application Team
AnnaBridge 145:64910690c574 5 * @version V1.7.1
AnnaBridge 145:64910690c574 6 * @date 21-April-2017
Kojto 122:f9eeca106725 7 * @brief Header file of USART LL module.
Kojto 122:f9eeca106725 8 ******************************************************************************
Kojto 122:f9eeca106725 9 * @attention
Kojto 122:f9eeca106725 10 *
AnnaBridge 145:64910690c574 11 * <h2><center>&copy; COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
Kojto 122:f9eeca106725 12 *
Kojto 122:f9eeca106725 13 * Redistribution and use in source and binary forms, with or without modification,
Kojto 122:f9eeca106725 14 * are permitted provided that the following conditions are met:
Kojto 122:f9eeca106725 15 * 1. Redistributions of source code must retain the above copyright notice,
Kojto 122:f9eeca106725 16 * this list of conditions and the following disclaimer.
Kojto 122:f9eeca106725 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
Kojto 122:f9eeca106725 18 * this list of conditions and the following disclaimer in the documentation
Kojto 122:f9eeca106725 19 * and/or other materials provided with the distribution.
Kojto 122:f9eeca106725 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
Kojto 122:f9eeca106725 21 * may be used to endorse or promote products derived from this software
Kojto 122:f9eeca106725 22 * without specific prior written permission.
Kojto 122:f9eeca106725 23 *
Kojto 122:f9eeca106725 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
Kojto 122:f9eeca106725 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Kojto 122:f9eeca106725 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Kojto 122:f9eeca106725 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
Kojto 122:f9eeca106725 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Kojto 122:f9eeca106725 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
Kojto 122:f9eeca106725 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
Kojto 122:f9eeca106725 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
Kojto 122:f9eeca106725 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Kojto 122:f9eeca106725 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Kojto 122:f9eeca106725 34 *
Kojto 122:f9eeca106725 35 ******************************************************************************
Kojto 122:f9eeca106725 36 */
Kojto 122:f9eeca106725 37
Kojto 122:f9eeca106725 38 /* Define to prevent recursive inclusion -------------------------------------*/
Kojto 122:f9eeca106725 39 #ifndef __STM32L4xx_LL_USART_H
Kojto 122:f9eeca106725 40 #define __STM32L4xx_LL_USART_H
Kojto 122:f9eeca106725 41
Kojto 122:f9eeca106725 42 #ifdef __cplusplus
Kojto 122:f9eeca106725 43 extern "C" {
Kojto 122:f9eeca106725 44 #endif
Kojto 122:f9eeca106725 45
Kojto 122:f9eeca106725 46 /* Includes ------------------------------------------------------------------*/
Kojto 122:f9eeca106725 47 #include "stm32l4xx.h"
Kojto 122:f9eeca106725 48
Kojto 122:f9eeca106725 49 /** @addtogroup STM32L4xx_LL_Driver
Kojto 122:f9eeca106725 50 * @{
Kojto 122:f9eeca106725 51 */
Kojto 122:f9eeca106725 52
Kojto 122:f9eeca106725 53 #if defined (USART1) || defined (USART2) || defined (USART3) || defined (UART4) || defined (UART5)
Kojto 122:f9eeca106725 54
Kojto 122:f9eeca106725 55 /** @defgroup USART_LL USART
Kojto 122:f9eeca106725 56 * @{
Kojto 122:f9eeca106725 57 */
Kojto 122:f9eeca106725 58
Kojto 122:f9eeca106725 59 /* Private types -------------------------------------------------------------*/
Kojto 122:f9eeca106725 60 /* Private variables ---------------------------------------------------------*/
Kojto 122:f9eeca106725 61
Kojto 122:f9eeca106725 62 /* Private constants ---------------------------------------------------------*/
Kojto 122:f9eeca106725 63 /** @defgroup USART_LL_Private_Constants USART Private Constants
Kojto 122:f9eeca106725 64 * @{
Kojto 122:f9eeca106725 65 */
Kojto 122:f9eeca106725 66 /**
Kojto 122:f9eeca106725 67 * @}
Kojto 122:f9eeca106725 68 */
Kojto 122:f9eeca106725 69
Kojto 122:f9eeca106725 70 /* Private macros ------------------------------------------------------------*/
Kojto 122:f9eeca106725 71 #if defined(USE_FULL_LL_DRIVER)
Kojto 122:f9eeca106725 72 /** @defgroup USART_LL_Private_Macros USART Private Macros
Kojto 122:f9eeca106725 73 * @{
Kojto 122:f9eeca106725 74 */
Kojto 122:f9eeca106725 75 /**
Kojto 122:f9eeca106725 76 * @}
Kojto 122:f9eeca106725 77 */
Kojto 122:f9eeca106725 78 #endif /*USE_FULL_LL_DRIVER*/
Kojto 122:f9eeca106725 79
Kojto 122:f9eeca106725 80 /* Exported types ------------------------------------------------------------*/
Kojto 122:f9eeca106725 81 #if defined(USE_FULL_LL_DRIVER)
Kojto 122:f9eeca106725 82 /** @defgroup USART_LL_ES_INIT USART Exported Init structures
Kojto 122:f9eeca106725 83 * @{
Kojto 122:f9eeca106725 84 */
Kojto 122:f9eeca106725 85
Kojto 122:f9eeca106725 86 /**
Kojto 122:f9eeca106725 87 * @brief LL USART Init Structure definition
Kojto 122:f9eeca106725 88 */
Kojto 122:f9eeca106725 89 typedef struct
Kojto 122:f9eeca106725 90 {
Kojto 122:f9eeca106725 91 uint32_t BaudRate; /*!< This field defines expected Usart communication baud rate.
Kojto 122:f9eeca106725 92
Kojto 122:f9eeca106725 93 This feature can be modified afterwards using unitary function @ref LL_USART_SetBaudRate().*/
Kojto 122:f9eeca106725 94
Kojto 122:f9eeca106725 95 uint32_t DataWidth; /*!< Specifies the number of data bits transmitted or received in a frame.
Kojto 122:f9eeca106725 96 This parameter can be a value of @ref USART_LL_EC_DATAWIDTH.
Kojto 122:f9eeca106725 97
Kojto 122:f9eeca106725 98 This feature can be modified afterwards using unitary function @ref LL_USART_SetDataWidth().*/
Kojto 122:f9eeca106725 99
Kojto 122:f9eeca106725 100 uint32_t StopBits; /*!< Specifies the number of stop bits transmitted.
Kojto 122:f9eeca106725 101 This parameter can be a value of @ref USART_LL_EC_STOPBITS.
Kojto 122:f9eeca106725 102
Kojto 122:f9eeca106725 103 This feature can be modified afterwards using unitary function @ref LL_USART_SetStopBitsLength().*/
Kojto 122:f9eeca106725 104
Kojto 122:f9eeca106725 105 uint32_t Parity; /*!< Specifies the parity mode.
Kojto 122:f9eeca106725 106 This parameter can be a value of @ref USART_LL_EC_PARITY.
Kojto 122:f9eeca106725 107
Kojto 122:f9eeca106725 108 This feature can be modified afterwards using unitary function @ref LL_USART_SetParity().*/
Kojto 122:f9eeca106725 109
Kojto 122:f9eeca106725 110 uint32_t TransferDirection; /*!< Specifies whether the Receive and/or Transmit mode is enabled or disabled.
Kojto 122:f9eeca106725 111 This parameter can be a value of @ref USART_LL_EC_DIRECTION.
Kojto 122:f9eeca106725 112
Kojto 122:f9eeca106725 113 This feature can be modified afterwards using unitary function @ref LL_USART_SetTransferDirection().*/
Kojto 122:f9eeca106725 114
Kojto 122:f9eeca106725 115 uint32_t HardwareFlowControl; /*!< Specifies whether the hardware flow control mode is enabled or disabled.
Kojto 122:f9eeca106725 116 This parameter can be a value of @ref USART_LL_EC_HWCONTROL.
Kojto 122:f9eeca106725 117
Kojto 122:f9eeca106725 118 This feature can be modified afterwards using unitary function @ref LL_USART_SetHWFlowCtrl().*/
Kojto 122:f9eeca106725 119
Kojto 122:f9eeca106725 120 uint32_t OverSampling; /*!< Specifies whether USART oversampling mode is 16 or 8.
Kojto 122:f9eeca106725 121 This parameter can be a value of @ref USART_LL_EC_OVERSAMPLING.
Kojto 122:f9eeca106725 122
Kojto 122:f9eeca106725 123 This feature can be modified afterwards using unitary function @ref LL_USART_SetOverSampling().*/
Kojto 122:f9eeca106725 124
Kojto 122:f9eeca106725 125 } LL_USART_InitTypeDef;
Kojto 122:f9eeca106725 126
Kojto 122:f9eeca106725 127 /**
Kojto 122:f9eeca106725 128 * @brief LL USART Clock Init Structure definition
Kojto 122:f9eeca106725 129 */
Kojto 122:f9eeca106725 130 typedef struct
Kojto 122:f9eeca106725 131 {
Kojto 122:f9eeca106725 132 uint32_t ClockOutput; /*!< Specifies whether the USART clock is enabled or disabled.
Kojto 122:f9eeca106725 133 This parameter can be a value of @ref USART_LL_EC_CLOCK.
Kojto 122:f9eeca106725 134
Kojto 122:f9eeca106725 135 USART HW configuration can be modified afterwards using unitary functions
Kojto 122:f9eeca106725 136 @ref LL_USART_EnableSCLKOutput() or @ref LL_USART_DisableSCLKOutput().
Kojto 122:f9eeca106725 137 For more details, refer to description of this function. */
Kojto 122:f9eeca106725 138
Kojto 122:f9eeca106725 139 uint32_t ClockPolarity; /*!< Specifies the steady state of the serial clock.
Kojto 122:f9eeca106725 140 This parameter can be a value of @ref USART_LL_EC_POLARITY.
Kojto 122:f9eeca106725 141
Kojto 122:f9eeca106725 142 USART HW configuration can be modified afterwards using unitary functions @ref LL_USART_SetClockPolarity().
Kojto 122:f9eeca106725 143 For more details, refer to description of this function. */
Kojto 122:f9eeca106725 144
Kojto 122:f9eeca106725 145 uint32_t ClockPhase; /*!< Specifies the clock transition on which the bit capture is made.
Kojto 122:f9eeca106725 146 This parameter can be a value of @ref USART_LL_EC_PHASE.
Kojto 122:f9eeca106725 147
Kojto 122:f9eeca106725 148 USART HW configuration can be modified afterwards using unitary functions @ref LL_USART_SetClockPhase().
Kojto 122:f9eeca106725 149 For more details, refer to description of this function. */
Kojto 122:f9eeca106725 150
Kojto 122:f9eeca106725 151 uint32_t LastBitClockPulse; /*!< Specifies whether the clock pulse corresponding to the last transmitted
Kojto 122:f9eeca106725 152 data bit (MSB) has to be output on the SCLK pin in synchronous mode.
Kojto 122:f9eeca106725 153 This parameter can be a value of @ref USART_LL_EC_LASTCLKPULSE.
Kojto 122:f9eeca106725 154
Kojto 122:f9eeca106725 155 USART HW configuration can be modified afterwards using unitary functions @ref LL_USART_SetLastClkPulseOutput().
Kojto 122:f9eeca106725 156 For more details, refer to description of this function. */
Kojto 122:f9eeca106725 157
Kojto 122:f9eeca106725 158 } LL_USART_ClockInitTypeDef;
Kojto 122:f9eeca106725 159
Kojto 122:f9eeca106725 160 /**
Kojto 122:f9eeca106725 161 * @}
Kojto 122:f9eeca106725 162 */
Kojto 122:f9eeca106725 163 #endif /* USE_FULL_LL_DRIVER */
Kojto 122:f9eeca106725 164
Kojto 122:f9eeca106725 165 /* Exported constants --------------------------------------------------------*/
Kojto 122:f9eeca106725 166 /** @defgroup USART_LL_Exported_Constants USART Exported Constants
Kojto 122:f9eeca106725 167 * @{
Kojto 122:f9eeca106725 168 */
Kojto 122:f9eeca106725 169
Kojto 122:f9eeca106725 170 /** @defgroup USART_LL_EC_CLEAR_FLAG Clear Flags Defines
Kojto 122:f9eeca106725 171 * @brief Flags defines which can be used with LL_USART_WriteReg function
Kojto 122:f9eeca106725 172 * @{
Kojto 122:f9eeca106725 173 */
Kojto 122:f9eeca106725 174 #define LL_USART_ICR_PECF USART_ICR_PECF /*!< Parity error flag */
Kojto 122:f9eeca106725 175 #define LL_USART_ICR_FECF USART_ICR_FECF /*!< Framing error flag */
Kojto 122:f9eeca106725 176 #define LL_USART_ICR_NCF USART_ICR_NCF /*!< Noise detected flag */
Kojto 122:f9eeca106725 177 #define LL_USART_ICR_ORECF USART_ICR_ORECF /*!< Overrun error flag */
Kojto 122:f9eeca106725 178 #define LL_USART_ICR_IDLECF USART_ICR_IDLECF /*!< Idle line detected flag */
Kojto 122:f9eeca106725 179 #define LL_USART_ICR_TCCF USART_ICR_TCCF /*!< Transmission complete flag */
Kojto 122:f9eeca106725 180 #if defined(USART_TCBGT_SUPPORT)
Kojto 122:f9eeca106725 181 #define LL_USART_ICR_TCBGTCF USART_ICR_TCBGTCF /*!< Transmission completed before guard time flag */
Kojto 122:f9eeca106725 182 #endif
Kojto 122:f9eeca106725 183 #define LL_USART_ICR_LBDCF USART_ICR_LBDCF /*!< LIN break detection flag */
Kojto 122:f9eeca106725 184 #define LL_USART_ICR_CTSCF USART_ICR_CTSCF /*!< CTS flag */
Kojto 122:f9eeca106725 185 #define LL_USART_ICR_RTOCF USART_ICR_RTOCF /*!< Receiver timeout flag */
Kojto 122:f9eeca106725 186 #define LL_USART_ICR_EOBCF USART_ICR_EOBCF /*!< End of block flag */
Kojto 122:f9eeca106725 187 #define LL_USART_ICR_CMCF USART_ICR_CMCF /*!< Character match flag */
Kojto 122:f9eeca106725 188 #define LL_USART_ICR_WUCF USART_ICR_WUCF /*!< Wakeup from Stop mode flag */
Kojto 122:f9eeca106725 189 /**
Kojto 122:f9eeca106725 190 * @}
Kojto 122:f9eeca106725 191 */
Kojto 122:f9eeca106725 192
Kojto 122:f9eeca106725 193 /** @defgroup USART_LL_EC_GET_FLAG Get Flags Defines
Kojto 122:f9eeca106725 194 * @brief Flags defines which can be used with LL_USART_ReadReg function
Kojto 122:f9eeca106725 195 * @{
Kojto 122:f9eeca106725 196 */
Kojto 122:f9eeca106725 197 #define LL_USART_ISR_PE USART_ISR_PE /*!< Parity error flag */
Kojto 122:f9eeca106725 198 #define LL_USART_ISR_FE USART_ISR_FE /*!< Framing error flag */
Kojto 122:f9eeca106725 199 #define LL_USART_ISR_NE USART_ISR_NE /*!< Noise detected flag */
Kojto 122:f9eeca106725 200 #define LL_USART_ISR_ORE USART_ISR_ORE /*!< Overrun error flag */
Kojto 122:f9eeca106725 201 #define LL_USART_ISR_IDLE USART_ISR_IDLE /*!< Idle line detected flag */
Kojto 122:f9eeca106725 202 #define LL_USART_ISR_RXNE USART_ISR_RXNE /*!< Read data register not empty flag */
Kojto 122:f9eeca106725 203 #define LL_USART_ISR_TC USART_ISR_TC /*!< Transmission complete flag */
Kojto 122:f9eeca106725 204 #define LL_USART_ISR_TXE USART_ISR_TXE /*!< Transmit data register empty flag */
Kojto 122:f9eeca106725 205 #define LL_USART_ISR_LBDF USART_ISR_LBDF /*!< LIN break detection flag */
Kojto 122:f9eeca106725 206 #define LL_USART_ISR_CTSIF USART_ISR_CTSIF /*!< CTS interrupt flag */
Kojto 122:f9eeca106725 207 #define LL_USART_ISR_CTS USART_ISR_CTS /*!< CTS flag */
Kojto 122:f9eeca106725 208 #define LL_USART_ISR_RTOF USART_ISR_RTOF /*!< Receiver timeout flag */
Kojto 122:f9eeca106725 209 #define LL_USART_ISR_EOBF USART_ISR_EOBF /*!< End of block flag */
Kojto 122:f9eeca106725 210 #define LL_USART_ISR_ABRE USART_ISR_ABRE /*!< Auto baud rate error flag */
Kojto 122:f9eeca106725 211 #define LL_USART_ISR_ABRF USART_ISR_ABRF /*!< Auto baud rate flag */
Kojto 122:f9eeca106725 212 #define LL_USART_ISR_BUSY USART_ISR_BUSY /*!< Busy flag */
Kojto 122:f9eeca106725 213 #define LL_USART_ISR_CMF USART_ISR_CMF /*!< Character match flag */
Kojto 122:f9eeca106725 214 #define LL_USART_ISR_SBKF USART_ISR_SBKF /*!< Send break flag */
Kojto 122:f9eeca106725 215 #define LL_USART_ISR_RWU USART_ISR_RWU /*!< Receiver wakeup from Mute mode flag */
Kojto 122:f9eeca106725 216 #define LL_USART_ISR_WUF USART_ISR_WUF /*!< Wakeup from Stop mode flag */
Kojto 122:f9eeca106725 217 #define LL_USART_ISR_TEACK USART_ISR_TEACK /*!< Transmit enable acknowledge flag */
Kojto 122:f9eeca106725 218 #define LL_USART_ISR_REACK USART_ISR_REACK /*!< Receive enable acknowledge flag */
Kojto 122:f9eeca106725 219 #if defined(USART_TCBGT_SUPPORT)
Kojto 122:f9eeca106725 220 #define LL_USART_ISR_TCBGT USART_ISR_TCBGT /*!< Transmission complete before guard time completion flag */
Kojto 122:f9eeca106725 221 #endif
Kojto 122:f9eeca106725 222 /**
Kojto 122:f9eeca106725 223 * @}
Kojto 122:f9eeca106725 224 */
Kojto 122:f9eeca106725 225
Kojto 122:f9eeca106725 226 /** @defgroup USART_LL_EC_IT IT Defines
Kojto 122:f9eeca106725 227 * @brief IT defines which can be used with LL_USART_ReadReg and LL_USART_WriteReg functions
Kojto 122:f9eeca106725 228 * @{
Kojto 122:f9eeca106725 229 */
Kojto 122:f9eeca106725 230 #define LL_USART_CR1_IDLEIE USART_CR1_IDLEIE /*!< IDLE interrupt enable */
Kojto 122:f9eeca106725 231 #define LL_USART_CR1_RXNEIE USART_CR1_RXNEIE /*!< Read data register not empty interrupt enable */
Kojto 122:f9eeca106725 232 #define LL_USART_CR1_TCIE USART_CR1_TCIE /*!< Transmission complete interrupt enable */
Kojto 122:f9eeca106725 233 #define LL_USART_CR1_TXEIE USART_CR1_TXEIE /*!< Transmit data register empty interrupt enable */
Kojto 122:f9eeca106725 234 #define LL_USART_CR1_PEIE USART_CR1_PEIE /*!< Parity error */
Kojto 122:f9eeca106725 235 #define LL_USART_CR1_CMIE USART_CR1_CMIE /*!< Character match interrupt enable */
Kojto 122:f9eeca106725 236 #define LL_USART_CR1_RTOIE USART_CR1_RTOIE /*!< Receiver timeout interrupt enable */
Kojto 122:f9eeca106725 237 #define LL_USART_CR1_EOBIE USART_CR1_EOBIE /*!< End of Block interrupt enable */
Kojto 122:f9eeca106725 238 #define LL_USART_CR2_LBDIE USART_CR2_LBDIE /*!< LIN break detection interrupt enable */
Kojto 122:f9eeca106725 239 #define LL_USART_CR3_EIE USART_CR3_EIE /*!< Error interrupt enable */
Kojto 122:f9eeca106725 240 #define LL_USART_CR3_CTSIE USART_CR3_CTSIE /*!< CTS interrupt enable */
Kojto 122:f9eeca106725 241 #define LL_USART_CR3_WUFIE USART_CR3_WUFIE /*!< Wakeup from Stop mode interrupt enable */
Kojto 122:f9eeca106725 242 #if defined(USART_TCBGT_SUPPORT)
Kojto 122:f9eeca106725 243 #define LL_USART_CR3_TCBGTIE USART_CR3_TCBGTIE /*!< Transmission complete before guard time interrupt enable */
Kojto 122:f9eeca106725 244 #endif
Kojto 122:f9eeca106725 245 /**
Kojto 122:f9eeca106725 246 * @}
Kojto 122:f9eeca106725 247 */
Kojto 122:f9eeca106725 248
Kojto 122:f9eeca106725 249 /** @defgroup USART_LL_EC_DIRECTION Communication Direction
Kojto 122:f9eeca106725 250 * @{
Kojto 122:f9eeca106725 251 */
AnnaBridge 145:64910690c574 252 #define LL_USART_DIRECTION_NONE 0x00000000U /*!< Transmitter and Receiver are disabled */
Kojto 122:f9eeca106725 253 #define LL_USART_DIRECTION_RX USART_CR1_RE /*!< Transmitter is disabled and Receiver is enabled */
Kojto 122:f9eeca106725 254 #define LL_USART_DIRECTION_TX USART_CR1_TE /*!< Transmitter is enabled and Receiver is disabled */
Kojto 122:f9eeca106725 255 #define LL_USART_DIRECTION_TX_RX (USART_CR1_TE |USART_CR1_RE) /*!< Transmitter and Receiver are enabled */
Kojto 122:f9eeca106725 256 /**
Kojto 122:f9eeca106725 257 * @}
Kojto 122:f9eeca106725 258 */
Kojto 122:f9eeca106725 259
Kojto 122:f9eeca106725 260 /** @defgroup USART_LL_EC_PARITY Parity Control
Kojto 122:f9eeca106725 261 * @{
Kojto 122:f9eeca106725 262 */
AnnaBridge 145:64910690c574 263 #define LL_USART_PARITY_NONE 0x00000000U /*!< Parity control disabled */
Kojto 122:f9eeca106725 264 #define LL_USART_PARITY_EVEN USART_CR1_PCE /*!< Parity control enabled and Even Parity is selected */
Kojto 122:f9eeca106725 265 #define LL_USART_PARITY_ODD (USART_CR1_PCE | USART_CR1_PS) /*!< Parity control enabled and Odd Parity is selected */
Kojto 122:f9eeca106725 266 /**
Kojto 122:f9eeca106725 267 * @}
Kojto 122:f9eeca106725 268 */
Kojto 122:f9eeca106725 269
Kojto 122:f9eeca106725 270 /** @defgroup USART_LL_EC_WAKEUP Wakeup
Kojto 122:f9eeca106725 271 * @{
Kojto 122:f9eeca106725 272 */
AnnaBridge 145:64910690c574 273 #define LL_USART_WAKEUP_IDLELINE 0x00000000U /*!< USART wake up from Mute mode on Idle Line */
Kojto 122:f9eeca106725 274 #define LL_USART_WAKEUP_ADDRESSMARK USART_CR1_WAKE /*!< USART wake up from Mute mode on Address Mark */
Kojto 122:f9eeca106725 275 /**
Kojto 122:f9eeca106725 276 * @}
Kojto 122:f9eeca106725 277 */
Kojto 122:f9eeca106725 278
Kojto 122:f9eeca106725 279 /** @defgroup USART_LL_EC_DATAWIDTH Datawidth
Kojto 122:f9eeca106725 280 * @{
Kojto 122:f9eeca106725 281 */
Kojto 122:f9eeca106725 282 #define LL_USART_DATAWIDTH_7B USART_CR1_M1 /*!< 7 bits word length : Start bit, 7 data bits, n stop bits */
AnnaBridge 145:64910690c574 283 #define LL_USART_DATAWIDTH_8B 0x00000000U /*!< 8 bits word length : Start bit, 8 data bits, n stop bits */
Kojto 122:f9eeca106725 284 #define LL_USART_DATAWIDTH_9B USART_CR1_M0 /*!< 9 bits word length : Start bit, 9 data bits, n stop bits */
Kojto 122:f9eeca106725 285 /**
Kojto 122:f9eeca106725 286 * @}
Kojto 122:f9eeca106725 287 */
Kojto 122:f9eeca106725 288
Kojto 122:f9eeca106725 289 /** @defgroup USART_LL_EC_OVERSAMPLING Oversampling
Kojto 122:f9eeca106725 290 * @{
Kojto 122:f9eeca106725 291 */
AnnaBridge 145:64910690c574 292 #define LL_USART_OVERSAMPLING_16 0x00000000U /*!< Oversampling by 16 */
Kojto 122:f9eeca106725 293 #define LL_USART_OVERSAMPLING_8 USART_CR1_OVER8 /*!< Oversampling by 8 */
Kojto 122:f9eeca106725 294 /**
Kojto 122:f9eeca106725 295 * @}
Kojto 122:f9eeca106725 296 */
Kojto 122:f9eeca106725 297
Kojto 122:f9eeca106725 298 #if defined(USE_FULL_LL_DRIVER)
Kojto 122:f9eeca106725 299 /** @defgroup USART_LL_EC_CLOCK Clock Signal
Kojto 122:f9eeca106725 300 * @{
Kojto 122:f9eeca106725 301 */
Kojto 122:f9eeca106725 302
AnnaBridge 145:64910690c574 303 #define LL_USART_CLOCK_DISABLE 0x00000000U /*!< Clock signal not provided */
Kojto 122:f9eeca106725 304 #define LL_USART_CLOCK_ENABLE USART_CR2_CLKEN /*!< Clock signal provided */
Kojto 122:f9eeca106725 305 /**
Kojto 122:f9eeca106725 306 * @}
Kojto 122:f9eeca106725 307 */
Kojto 122:f9eeca106725 308 #endif /*USE_FULL_LL_DRIVER*/
Kojto 122:f9eeca106725 309
Kojto 122:f9eeca106725 310 /** @defgroup USART_LL_EC_LASTCLKPULSE Last Clock Pulse
Kojto 122:f9eeca106725 311 * @{
Kojto 122:f9eeca106725 312 */
AnnaBridge 145:64910690c574 313 #define LL_USART_LASTCLKPULSE_NO_OUTPUT 0x00000000U /*!< The clock pulse of the last data bit is not output to the SCLK pin */
Kojto 122:f9eeca106725 314 #define LL_USART_LASTCLKPULSE_OUTPUT USART_CR2_LBCL /*!< The clock pulse of the last data bit is output to the SCLK pin */
Kojto 122:f9eeca106725 315 /**
Kojto 122:f9eeca106725 316 * @}
Kojto 122:f9eeca106725 317 */
Kojto 122:f9eeca106725 318
Kojto 122:f9eeca106725 319 /** @defgroup USART_LL_EC_PHASE Clock Phase
Kojto 122:f9eeca106725 320 * @{
Kojto 122:f9eeca106725 321 */
AnnaBridge 145:64910690c574 322 #define LL_USART_PHASE_1EDGE 0x00000000U /*!< The first clock transition is the first data capture edge */
Kojto 122:f9eeca106725 323 #define LL_USART_PHASE_2EDGE USART_CR2_CPHA /*!< The second clock transition is the first data capture edge */
Kojto 122:f9eeca106725 324 /**
Kojto 122:f9eeca106725 325 * @}
Kojto 122:f9eeca106725 326 */
Kojto 122:f9eeca106725 327
Kojto 122:f9eeca106725 328 /** @defgroup USART_LL_EC_POLARITY Clock Polarity
Kojto 122:f9eeca106725 329 * @{
Kojto 122:f9eeca106725 330 */
AnnaBridge 145:64910690c574 331 #define LL_USART_POLARITY_LOW 0x00000000U /*!< Steady low value on SCLK pin outside transmission window*/
Kojto 122:f9eeca106725 332 #define LL_USART_POLARITY_HIGH USART_CR2_CPOL /*!< Steady high value on SCLK pin outside transmission window */
Kojto 122:f9eeca106725 333 /**
Kojto 122:f9eeca106725 334 * @}
Kojto 122:f9eeca106725 335 */
Kojto 122:f9eeca106725 336
Kojto 122:f9eeca106725 337 /** @defgroup USART_LL_EC_STOPBITS Stop Bits
Kojto 122:f9eeca106725 338 * @{
Kojto 122:f9eeca106725 339 */
Kojto 122:f9eeca106725 340 #define LL_USART_STOPBITS_0_5 USART_CR2_STOP_0 /*!< 0.5 stop bit */
AnnaBridge 145:64910690c574 341 #define LL_USART_STOPBITS_1 0x00000000U /*!< 1 stop bit */
Kojto 122:f9eeca106725 342 #define LL_USART_STOPBITS_1_5 (USART_CR2_STOP_0 | USART_CR2_STOP_1) /*!< 1.5 stop bits */
Kojto 122:f9eeca106725 343 #define LL_USART_STOPBITS_2 USART_CR2_STOP_1 /*!< 2 stop bits */
Kojto 122:f9eeca106725 344 /**
Kojto 122:f9eeca106725 345 * @}
Kojto 122:f9eeca106725 346 */
Kojto 122:f9eeca106725 347
Kojto 122:f9eeca106725 348 /** @defgroup USART_LL_EC_TXRX TX RX Pins Swap
Kojto 122:f9eeca106725 349 * @{
Kojto 122:f9eeca106725 350 */
AnnaBridge 145:64910690c574 351 #define LL_USART_TXRX_STANDARD 0x00000000U /*!< TX/RX pins are used as defined in standard pinout */
Kojto 122:f9eeca106725 352 #define LL_USART_TXRX_SWAPPED (USART_CR2_SWAP) /*!< TX and RX pins functions are swapped. */
Kojto 122:f9eeca106725 353 /**
Kojto 122:f9eeca106725 354 * @}
Kojto 122:f9eeca106725 355 */
Kojto 122:f9eeca106725 356
Kojto 122:f9eeca106725 357 /** @defgroup USART_LL_EC_RXPIN_LEVEL RX Pin Active Level Inversion
Kojto 122:f9eeca106725 358 * @{
Kojto 122:f9eeca106725 359 */
AnnaBridge 145:64910690c574 360 #define LL_USART_RXPIN_LEVEL_STANDARD 0x00000000U /*!< RX pin signal works using the standard logic levels */
Kojto 122:f9eeca106725 361 #define LL_USART_RXPIN_LEVEL_INVERTED (USART_CR2_RXINV) /*!< RX pin signal values are inverted. */
Kojto 122:f9eeca106725 362 /**
Kojto 122:f9eeca106725 363 * @}
Kojto 122:f9eeca106725 364 */
Kojto 122:f9eeca106725 365
Kojto 122:f9eeca106725 366 /** @defgroup USART_LL_EC_TXPIN_LEVEL TX Pin Active Level Inversion
Kojto 122:f9eeca106725 367 * @{
Kojto 122:f9eeca106725 368 */
AnnaBridge 145:64910690c574 369 #define LL_USART_TXPIN_LEVEL_STANDARD 0x00000000U /*!< TX pin signal works using the standard logic levels */
Kojto 122:f9eeca106725 370 #define LL_USART_TXPIN_LEVEL_INVERTED (USART_CR2_TXINV) /*!< TX pin signal values are inverted. */
Kojto 122:f9eeca106725 371 /**
Kojto 122:f9eeca106725 372 * @}
Kojto 122:f9eeca106725 373 */
Kojto 122:f9eeca106725 374
Kojto 122:f9eeca106725 375 /** @defgroup USART_LL_EC_BINARY_LOGIC Binary Data Inversion
Kojto 122:f9eeca106725 376 * @{
Kojto 122:f9eeca106725 377 */
AnnaBridge 145:64910690c574 378 #define LL_USART_BINARY_LOGIC_POSITIVE 0x00000000U /*!< Logical data from the data register are send/received in positive/direct logic. (1=H, 0=L) */
Kojto 122:f9eeca106725 379 #define LL_USART_BINARY_LOGIC_NEGATIVE USART_CR2_DATAINV /*!< Logical data from the data register are send/received in negative/inverse logic. (1=L, 0=H). The parity bit is also inverted. */
Kojto 122:f9eeca106725 380 /**
Kojto 122:f9eeca106725 381 * @}
Kojto 122:f9eeca106725 382 */
Kojto 122:f9eeca106725 383
Kojto 122:f9eeca106725 384 /** @defgroup USART_LL_EC_BITORDER Bit Order
Kojto 122:f9eeca106725 385 * @{
Kojto 122:f9eeca106725 386 */
AnnaBridge 145:64910690c574 387 #define LL_USART_BITORDER_LSBFIRST 0x00000000U /*!< data is transmitted/received with data bit 0 first, following the start bit */
Kojto 122:f9eeca106725 388 #define LL_USART_BITORDER_MSBFIRST USART_CR2_MSBFIRST /*!< data is transmitted/received with the MSB first, following the start bit */
Kojto 122:f9eeca106725 389 /**
Kojto 122:f9eeca106725 390 * @}
Kojto 122:f9eeca106725 391 */
Kojto 122:f9eeca106725 392
Kojto 122:f9eeca106725 393 /** @defgroup USART_LL_EC_AUTOBAUD_DETECT_ON Autobaud Detection
Kojto 122:f9eeca106725 394 * @{
Kojto 122:f9eeca106725 395 */
AnnaBridge 145:64910690c574 396 #define LL_USART_AUTOBAUD_DETECT_ON_STARTBIT 0x00000000U /*!< Measurement of the start bit is used to detect the baud rate */
Kojto 122:f9eeca106725 397 #define LL_USART_AUTOBAUD_DETECT_ON_FALLINGEDGE USART_CR2_ABRMODE_0 /*!< Falling edge to falling edge measurement. Received frame must start with a single bit = 1 -> Frame = Start10xxxxxx */
Kojto 122:f9eeca106725 398 #define LL_USART_AUTOBAUD_DETECT_ON_7F_FRAME USART_CR2_ABRMODE_1 /*!< 0x7F frame detection */
Kojto 122:f9eeca106725 399 #define LL_USART_AUTOBAUD_DETECT_ON_55_FRAME (USART_CR2_ABRMODE_1 | USART_CR2_ABRMODE_0) /*!< 0x55 frame detection */
Kojto 122:f9eeca106725 400 /**
Kojto 122:f9eeca106725 401 * @}
Kojto 122:f9eeca106725 402 */
Kojto 122:f9eeca106725 403
Kojto 122:f9eeca106725 404 /** @defgroup USART_LL_EC_ADDRESS_DETECT Address Length Detection
Kojto 122:f9eeca106725 405 * @{
Kojto 122:f9eeca106725 406 */
AnnaBridge 145:64910690c574 407 #define LL_USART_ADDRESS_DETECT_4B 0x00000000U /*!< 4-bit address detection method selected */
Kojto 122:f9eeca106725 408 #define LL_USART_ADDRESS_DETECT_7B USART_CR2_ADDM7 /*!< 7-bit address detection (in 8-bit data mode) method selected */
Kojto 122:f9eeca106725 409 /**
Kojto 122:f9eeca106725 410 * @}
Kojto 122:f9eeca106725 411 */
Kojto 122:f9eeca106725 412
Kojto 122:f9eeca106725 413 /** @defgroup USART_LL_EC_HWCONTROL Hardware Control
Kojto 122:f9eeca106725 414 * @{
Kojto 122:f9eeca106725 415 */
AnnaBridge 145:64910690c574 416 #define LL_USART_HWCONTROL_NONE 0x00000000U /*!< CTS and RTS hardware flow control disabled */
Kojto 122:f9eeca106725 417 #define LL_USART_HWCONTROL_RTS USART_CR3_RTSE /*!< RTS output enabled, data is only requested when there is space in the receive buffer */
Kojto 122:f9eeca106725 418 #define LL_USART_HWCONTROL_CTS USART_CR3_CTSE /*!< CTS mode enabled, data is only transmitted when the nCTS input is asserted (tied to 0) */
Kojto 122:f9eeca106725 419 #define LL_USART_HWCONTROL_RTS_CTS (USART_CR3_RTSE | USART_CR3_CTSE) /*!< CTS and RTS hardware flow control enabled */
Kojto 122:f9eeca106725 420 /**
Kojto 122:f9eeca106725 421 * @}
Kojto 122:f9eeca106725 422 */
Kojto 122:f9eeca106725 423
Kojto 122:f9eeca106725 424 /** @defgroup USART_LL_EC_WAKEUP_ON Wakeup Activation
Kojto 122:f9eeca106725 425 * @{
Kojto 122:f9eeca106725 426 */
AnnaBridge 145:64910690c574 427 #define LL_USART_WAKEUP_ON_ADDRESS 0x00000000U /*!< Wake up active on address match */
Kojto 122:f9eeca106725 428 #define LL_USART_WAKEUP_ON_STARTBIT USART_CR3_WUS_1 /*!< Wake up active on Start bit detection */
Kojto 122:f9eeca106725 429 #define LL_USART_WAKEUP_ON_RXNE (USART_CR3_WUS_0 | USART_CR3_WUS_1) /*!< Wake up active on RXNE */
Kojto 122:f9eeca106725 430 /**
Kojto 122:f9eeca106725 431 * @}
Kojto 122:f9eeca106725 432 */
Kojto 122:f9eeca106725 433
Kojto 122:f9eeca106725 434 /** @defgroup USART_LL_EC_IRDA_POWER IrDA Power
Kojto 122:f9eeca106725 435 * @{
Kojto 122:f9eeca106725 436 */
AnnaBridge 145:64910690c574 437 #define LL_USART_IRDA_POWER_NORMAL 0x00000000U /*!< IrDA normal power mode */
Kojto 122:f9eeca106725 438 #define LL_USART_IRDA_POWER_LOW USART_CR3_IRLP /*!< IrDA low power mode */
Kojto 122:f9eeca106725 439 /**
Kojto 122:f9eeca106725 440 * @}
Kojto 122:f9eeca106725 441 */
Kojto 122:f9eeca106725 442
Kojto 122:f9eeca106725 443 /** @defgroup USART_LL_EC_LINBREAK_DETECT LIN Break Detection Length
Kojto 122:f9eeca106725 444 * @{
Kojto 122:f9eeca106725 445 */
AnnaBridge 145:64910690c574 446 #define LL_USART_LINBREAK_DETECT_10B 0x00000000U /*!< 10-bit break detection method selected */
Kojto 122:f9eeca106725 447 #define LL_USART_LINBREAK_DETECT_11B USART_CR2_LBDL /*!< 11-bit break detection method selected */
Kojto 122:f9eeca106725 448 /**
Kojto 122:f9eeca106725 449 * @}
Kojto 122:f9eeca106725 450 */
Kojto 122:f9eeca106725 451
Kojto 122:f9eeca106725 452 /** @defgroup USART_LL_EC_DE_POLARITY Driver Enable Polarity
Kojto 122:f9eeca106725 453 * @{
Kojto 122:f9eeca106725 454 */
AnnaBridge 145:64910690c574 455 #define LL_USART_DE_POLARITY_HIGH 0x00000000U /*!< DE signal is active high */
Kojto 122:f9eeca106725 456 #define LL_USART_DE_POLARITY_LOW USART_CR3_DEP /*!< DE signal is active low */
Kojto 122:f9eeca106725 457 /**
Kojto 122:f9eeca106725 458 * @}
Kojto 122:f9eeca106725 459 */
Kojto 122:f9eeca106725 460
Kojto 122:f9eeca106725 461 /** @defgroup USART_LL_EC_DMA_REG_DATA DMA Register Data
Kojto 122:f9eeca106725 462 * @{
Kojto 122:f9eeca106725 463 */
AnnaBridge 145:64910690c574 464 #define LL_USART_DMA_REG_DATA_TRANSMIT 0x00000000U /*!< Get address of data register used for transmission */
AnnaBridge 145:64910690c574 465 #define LL_USART_DMA_REG_DATA_RECEIVE 0x00000001U /*!< Get address of data register used for reception */
Kojto 122:f9eeca106725 466 /**
Kojto 122:f9eeca106725 467 * @}
Kojto 122:f9eeca106725 468 */
Kojto 122:f9eeca106725 469
Kojto 122:f9eeca106725 470 /**
Kojto 122:f9eeca106725 471 * @}
Kojto 122:f9eeca106725 472 */
Kojto 122:f9eeca106725 473
Kojto 122:f9eeca106725 474 /* Exported macro ------------------------------------------------------------*/
Kojto 122:f9eeca106725 475 /** @defgroup USART_LL_Exported_Macros USART Exported Macros
Kojto 122:f9eeca106725 476 * @{
Kojto 122:f9eeca106725 477 */
Kojto 122:f9eeca106725 478
Kojto 122:f9eeca106725 479 /** @defgroup USART_LL_EM_WRITE_READ Common Write and read registers Macros
Kojto 122:f9eeca106725 480 * @{
Kojto 122:f9eeca106725 481 */
Kojto 122:f9eeca106725 482
Kojto 122:f9eeca106725 483 /**
Kojto 122:f9eeca106725 484 * @brief Write a value in USART register
Kojto 122:f9eeca106725 485 * @param __INSTANCE__ USART Instance
Kojto 122:f9eeca106725 486 * @param __REG__ Register to be written
Kojto 122:f9eeca106725 487 * @param __VALUE__ Value to be written in the register
Kojto 122:f9eeca106725 488 * @retval None
Kojto 122:f9eeca106725 489 */
Kojto 122:f9eeca106725 490 #define LL_USART_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__))
Kojto 122:f9eeca106725 491
Kojto 122:f9eeca106725 492 /**
Kojto 122:f9eeca106725 493 * @brief Read a value in USART register
Kojto 122:f9eeca106725 494 * @param __INSTANCE__ USART Instance
Kojto 122:f9eeca106725 495 * @param __REG__ Register to be read
Kojto 122:f9eeca106725 496 * @retval Register value
Kojto 122:f9eeca106725 497 */
Kojto 122:f9eeca106725 498 #define LL_USART_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__)
Kojto 122:f9eeca106725 499 /**
Kojto 122:f9eeca106725 500 * @}
Kojto 122:f9eeca106725 501 */
Kojto 122:f9eeca106725 502
Kojto 122:f9eeca106725 503 /** @defgroup USART_LL_EM_Exported_Macros_Helper Exported_Macros_Helper
Kojto 122:f9eeca106725 504 * @{
Kojto 122:f9eeca106725 505 */
Kojto 122:f9eeca106725 506
Kojto 122:f9eeca106725 507 /**
Kojto 122:f9eeca106725 508 * @brief Compute USARTDIV value according to Peripheral Clock and
Kojto 122:f9eeca106725 509 * expected Baud Rate in 8 bits sampling mode (32 bits value of USARTDIV is returned)
Kojto 122:f9eeca106725 510 * @param __PERIPHCLK__ Peripheral Clock frequency used for USART instance
Kojto 122:f9eeca106725 511 * @param __BAUDRATE__ Baud rate value to achieve
Kojto 122:f9eeca106725 512 * @retval USARTDIV value to be used for BRR register filling in OverSampling_8 case
Kojto 122:f9eeca106725 513 */
Kojto 122:f9eeca106725 514 #define __LL_USART_DIV_SAMPLING8(__PERIPHCLK__, __BAUDRATE__) ((((__PERIPHCLK__)*2) + ((__BAUDRATE__)/2))/(__BAUDRATE__))
Kojto 122:f9eeca106725 515
Kojto 122:f9eeca106725 516 /**
Kojto 122:f9eeca106725 517 * @brief Compute USARTDIV value according to Peripheral Clock and
Kojto 122:f9eeca106725 518 * expected Baud Rate in 16 bits sampling mode (32 bits value of USARTDIV is returned)
Kojto 122:f9eeca106725 519 * @param __PERIPHCLK__ Peripheral Clock frequency used for USART instance
Kojto 122:f9eeca106725 520 * @param __BAUDRATE__ Baud rate value to achieve
Kojto 122:f9eeca106725 521 * @retval USARTDIV value to be used for BRR register filling in OverSampling_16 case
Kojto 122:f9eeca106725 522 */
Kojto 122:f9eeca106725 523 #define __LL_USART_DIV_SAMPLING16(__PERIPHCLK__, __BAUDRATE__) (((__PERIPHCLK__) + ((__BAUDRATE__)/2))/(__BAUDRATE__))
Kojto 122:f9eeca106725 524
Kojto 122:f9eeca106725 525 /**
Kojto 122:f9eeca106725 526 * @}
Kojto 122:f9eeca106725 527 */
Kojto 122:f9eeca106725 528
Kojto 122:f9eeca106725 529 /**
Kojto 122:f9eeca106725 530 * @}
Kojto 122:f9eeca106725 531 */
Kojto 122:f9eeca106725 532
Kojto 122:f9eeca106725 533 /* Exported functions --------------------------------------------------------*/
Kojto 122:f9eeca106725 534
Kojto 122:f9eeca106725 535 /** @defgroup USART_LL_Exported_Functions USART Exported Functions
Kojto 122:f9eeca106725 536 * @{
Kojto 122:f9eeca106725 537 */
Kojto 122:f9eeca106725 538
Kojto 122:f9eeca106725 539 /** @defgroup USART_LL_EF_Configuration Configuration functions
Kojto 122:f9eeca106725 540 * @{
Kojto 122:f9eeca106725 541 */
Kojto 122:f9eeca106725 542
Kojto 122:f9eeca106725 543 /**
Kojto 122:f9eeca106725 544 * @brief USART Enable
Kojto 122:f9eeca106725 545 * @rmtoll CR1 UE LL_USART_Enable
Kojto 122:f9eeca106725 546 * @param USARTx USART Instance
Kojto 122:f9eeca106725 547 * @retval None
Kojto 122:f9eeca106725 548 */
Kojto 122:f9eeca106725 549 __STATIC_INLINE void LL_USART_Enable(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 550 {
Kojto 122:f9eeca106725 551 SET_BIT(USARTx->CR1, USART_CR1_UE);
Kojto 122:f9eeca106725 552 }
Kojto 122:f9eeca106725 553
Kojto 122:f9eeca106725 554 /**
Kojto 122:f9eeca106725 555 * @brief USART Disable (all USART prescalers and outputs are disabled)
Kojto 122:f9eeca106725 556 * @note When USART is disabled, USART prescalers and outputs are stopped immediately,
Kojto 122:f9eeca106725 557 * and current operations are discarded. The configuration of the USART is kept, but all the status
Kojto 122:f9eeca106725 558 * flags, in the USARTx_ISR are set to their default values.
Kojto 122:f9eeca106725 559 * @rmtoll CR1 UE LL_USART_Disable
Kojto 122:f9eeca106725 560 * @param USARTx USART Instance
Kojto 122:f9eeca106725 561 * @retval None
Kojto 122:f9eeca106725 562 */
Kojto 122:f9eeca106725 563 __STATIC_INLINE void LL_USART_Disable(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 564 {
Kojto 122:f9eeca106725 565 CLEAR_BIT(USARTx->CR1, USART_CR1_UE);
Kojto 122:f9eeca106725 566 }
Kojto 122:f9eeca106725 567
Kojto 122:f9eeca106725 568 /**
Kojto 122:f9eeca106725 569 * @brief Indicate if USART is enabled
Kojto 122:f9eeca106725 570 * @rmtoll CR1 UE LL_USART_IsEnabled
Kojto 122:f9eeca106725 571 * @param USARTx USART Instance
Kojto 122:f9eeca106725 572 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 573 */
Kojto 122:f9eeca106725 574 __STATIC_INLINE uint32_t LL_USART_IsEnabled(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 575 {
Kojto 122:f9eeca106725 576 return (READ_BIT(USARTx->CR1, USART_CR1_UE) == (USART_CR1_UE));
Kojto 122:f9eeca106725 577 }
Kojto 122:f9eeca106725 578
Kojto 122:f9eeca106725 579 /**
Kojto 122:f9eeca106725 580 * @brief USART enabled in STOP Mode.
Kojto 122:f9eeca106725 581 * @note When this function is enabled, USART is able to wake up the MCU from Stop mode, provided that
Kojto 122:f9eeca106725 582 * USART clock selection is HSI or LSE in RCC.
Kojto 122:f9eeca106725 583 * @note Macro @ref IS_UART_WAKEUP_FROMSTOP_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 584 * Wake-up from Stop mode feature is supported by the USARTx instance.
Kojto 122:f9eeca106725 585 * @rmtoll CR1 UESM LL_USART_EnableInStopMode
Kojto 122:f9eeca106725 586 * @param USARTx USART Instance
Kojto 122:f9eeca106725 587 * @retval None
Kojto 122:f9eeca106725 588 */
Kojto 122:f9eeca106725 589 __STATIC_INLINE void LL_USART_EnableInStopMode(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 590 {
Kojto 122:f9eeca106725 591 SET_BIT(USARTx->CR1, USART_CR1_UESM);
Kojto 122:f9eeca106725 592 }
Kojto 122:f9eeca106725 593
Kojto 122:f9eeca106725 594 /**
Kojto 122:f9eeca106725 595 * @brief USART disabled in STOP Mode.
Kojto 122:f9eeca106725 596 * @note When this function is disabled, USART is not able to wake up the MCU from Stop mode
Kojto 122:f9eeca106725 597 * @note Macro @ref IS_UART_WAKEUP_FROMSTOP_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 598 * Wake-up from Stop mode feature is supported by the USARTx instance.
Kojto 122:f9eeca106725 599 * @rmtoll CR1 UESM LL_USART_DisableInStopMode
Kojto 122:f9eeca106725 600 * @param USARTx USART Instance
Kojto 122:f9eeca106725 601 * @retval None
Kojto 122:f9eeca106725 602 */
Kojto 122:f9eeca106725 603 __STATIC_INLINE void LL_USART_DisableInStopMode(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 604 {
Kojto 122:f9eeca106725 605 CLEAR_BIT(USARTx->CR1, USART_CR1_UESM);
Kojto 122:f9eeca106725 606 }
Kojto 122:f9eeca106725 607
Kojto 122:f9eeca106725 608 /**
Kojto 122:f9eeca106725 609 * @brief Indicate if USART is enabled in STOP Mode (able to wake up MCU from Stop mode or not)
Kojto 122:f9eeca106725 610 * @note Macro @ref IS_UART_WAKEUP_FROMSTOP_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 611 * Wake-up from Stop mode feature is supported by the USARTx instance.
Kojto 122:f9eeca106725 612 * @rmtoll CR1 UESM LL_USART_IsEnabledInStopMode
Kojto 122:f9eeca106725 613 * @param USARTx USART Instance
Kojto 122:f9eeca106725 614 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 615 */
Kojto 122:f9eeca106725 616 __STATIC_INLINE uint32_t LL_USART_IsEnabledInStopMode(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 617 {
Kojto 122:f9eeca106725 618 return (READ_BIT(USARTx->CR1, USART_CR1_UESM) == (USART_CR1_UESM));
Kojto 122:f9eeca106725 619 }
Kojto 122:f9eeca106725 620
Kojto 122:f9eeca106725 621 /**
Kojto 122:f9eeca106725 622 * @brief Receiver Enable (Receiver is enabled and begins searching for a start bit)
Kojto 122:f9eeca106725 623 * @rmtoll CR1 RE LL_USART_EnableDirectionRx
Kojto 122:f9eeca106725 624 * @param USARTx USART Instance
Kojto 122:f9eeca106725 625 * @retval None
Kojto 122:f9eeca106725 626 */
Kojto 122:f9eeca106725 627 __STATIC_INLINE void LL_USART_EnableDirectionRx(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 628 {
Kojto 122:f9eeca106725 629 SET_BIT(USARTx->CR1, USART_CR1_RE);
Kojto 122:f9eeca106725 630 }
Kojto 122:f9eeca106725 631
Kojto 122:f9eeca106725 632 /**
Kojto 122:f9eeca106725 633 * @brief Receiver Disable
Kojto 122:f9eeca106725 634 * @rmtoll CR1 RE LL_USART_DisableDirectionRx
Kojto 122:f9eeca106725 635 * @param USARTx USART Instance
Kojto 122:f9eeca106725 636 * @retval None
Kojto 122:f9eeca106725 637 */
Kojto 122:f9eeca106725 638 __STATIC_INLINE void LL_USART_DisableDirectionRx(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 639 {
Kojto 122:f9eeca106725 640 CLEAR_BIT(USARTx->CR1, USART_CR1_RE);
Kojto 122:f9eeca106725 641 }
Kojto 122:f9eeca106725 642
Kojto 122:f9eeca106725 643 /**
Kojto 122:f9eeca106725 644 * @brief Transmitter Enable
Kojto 122:f9eeca106725 645 * @rmtoll CR1 TE LL_USART_EnableDirectionTx
Kojto 122:f9eeca106725 646 * @param USARTx USART Instance
Kojto 122:f9eeca106725 647 * @retval None
Kojto 122:f9eeca106725 648 */
Kojto 122:f9eeca106725 649 __STATIC_INLINE void LL_USART_EnableDirectionTx(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 650 {
Kojto 122:f9eeca106725 651 SET_BIT(USARTx->CR1, USART_CR1_TE);
Kojto 122:f9eeca106725 652 }
Kojto 122:f9eeca106725 653
Kojto 122:f9eeca106725 654 /**
Kojto 122:f9eeca106725 655 * @brief Transmitter Disable
Kojto 122:f9eeca106725 656 * @rmtoll CR1 TE LL_USART_DisableDirectionTx
Kojto 122:f9eeca106725 657 * @param USARTx USART Instance
Kojto 122:f9eeca106725 658 * @retval None
Kojto 122:f9eeca106725 659 */
Kojto 122:f9eeca106725 660 __STATIC_INLINE void LL_USART_DisableDirectionTx(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 661 {
Kojto 122:f9eeca106725 662 CLEAR_BIT(USARTx->CR1, USART_CR1_TE);
Kojto 122:f9eeca106725 663 }
Kojto 122:f9eeca106725 664
Kojto 122:f9eeca106725 665 /**
Kojto 122:f9eeca106725 666 * @brief Configure simultaneously enabled/disabled states
Kojto 122:f9eeca106725 667 * of Transmitter and Receiver
Kojto 122:f9eeca106725 668 * @rmtoll CR1 RE LL_USART_SetTransferDirection\n
Kojto 122:f9eeca106725 669 * CR1 TE LL_USART_SetTransferDirection
Kojto 122:f9eeca106725 670 * @param USARTx USART Instance
Kojto 122:f9eeca106725 671 * @param TransferDirection This parameter can be one of the following values:
Kojto 122:f9eeca106725 672 * @arg @ref LL_USART_DIRECTION_NONE
Kojto 122:f9eeca106725 673 * @arg @ref LL_USART_DIRECTION_RX
Kojto 122:f9eeca106725 674 * @arg @ref LL_USART_DIRECTION_TX
Kojto 122:f9eeca106725 675 * @arg @ref LL_USART_DIRECTION_TX_RX
Kojto 122:f9eeca106725 676 * @retval None
Kojto 122:f9eeca106725 677 */
Kojto 122:f9eeca106725 678 __STATIC_INLINE void LL_USART_SetTransferDirection(USART_TypeDef *USARTx, uint32_t TransferDirection)
Kojto 122:f9eeca106725 679 {
Kojto 122:f9eeca106725 680 MODIFY_REG(USARTx->CR1, USART_CR1_RE | USART_CR1_TE, TransferDirection);
Kojto 122:f9eeca106725 681 }
Kojto 122:f9eeca106725 682
Kojto 122:f9eeca106725 683 /**
Kojto 122:f9eeca106725 684 * @brief Return enabled/disabled states of Transmitter and Receiver
Kojto 122:f9eeca106725 685 * @rmtoll CR1 RE LL_USART_GetTransferDirection\n
Kojto 122:f9eeca106725 686 * CR1 TE LL_USART_GetTransferDirection
Kojto 122:f9eeca106725 687 * @param USARTx USART Instance
Kojto 122:f9eeca106725 688 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 689 * @arg @ref LL_USART_DIRECTION_NONE
Kojto 122:f9eeca106725 690 * @arg @ref LL_USART_DIRECTION_RX
Kojto 122:f9eeca106725 691 * @arg @ref LL_USART_DIRECTION_TX
Kojto 122:f9eeca106725 692 * @arg @ref LL_USART_DIRECTION_TX_RX
Kojto 122:f9eeca106725 693 */
Kojto 122:f9eeca106725 694 __STATIC_INLINE uint32_t LL_USART_GetTransferDirection(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 695 {
Kojto 122:f9eeca106725 696 return (uint32_t)(READ_BIT(USARTx->CR1, USART_CR1_RE | USART_CR1_TE));
Kojto 122:f9eeca106725 697 }
Kojto 122:f9eeca106725 698
Kojto 122:f9eeca106725 699 /**
Kojto 122:f9eeca106725 700 * @brief Configure Parity (enabled/disabled and parity mode if enabled).
Kojto 122:f9eeca106725 701 * @note This function selects if hardware parity control (generation and detection) is enabled or disabled.
Kojto 122:f9eeca106725 702 * When the parity control is enabled (Odd or Even), computed parity bit is inserted at the MSB position
Kojto 122:f9eeca106725 703 * (9th or 8th bit depending on data width) and parity is checked on the received data.
Kojto 122:f9eeca106725 704 * @rmtoll CR1 PS LL_USART_SetParity\n
Kojto 122:f9eeca106725 705 * CR1 PCE LL_USART_SetParity
Kojto 122:f9eeca106725 706 * @param USARTx USART Instance
Kojto 122:f9eeca106725 707 * @param Parity This parameter can be one of the following values:
Kojto 122:f9eeca106725 708 * @arg @ref LL_USART_PARITY_NONE
Kojto 122:f9eeca106725 709 * @arg @ref LL_USART_PARITY_EVEN
Kojto 122:f9eeca106725 710 * @arg @ref LL_USART_PARITY_ODD
Kojto 122:f9eeca106725 711 * @retval None
Kojto 122:f9eeca106725 712 */
Kojto 122:f9eeca106725 713 __STATIC_INLINE void LL_USART_SetParity(USART_TypeDef *USARTx, uint32_t Parity)
Kojto 122:f9eeca106725 714 {
Kojto 122:f9eeca106725 715 MODIFY_REG(USARTx->CR1, USART_CR1_PS | USART_CR1_PCE, Parity);
Kojto 122:f9eeca106725 716 }
Kojto 122:f9eeca106725 717
Kojto 122:f9eeca106725 718 /**
Kojto 122:f9eeca106725 719 * @brief Return Parity configuration (enabled/disabled and parity mode if enabled)
Kojto 122:f9eeca106725 720 * @rmtoll CR1 PS LL_USART_GetParity\n
Kojto 122:f9eeca106725 721 * CR1 PCE LL_USART_GetParity
Kojto 122:f9eeca106725 722 * @param USARTx USART Instance
Kojto 122:f9eeca106725 723 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 724 * @arg @ref LL_USART_PARITY_NONE
Kojto 122:f9eeca106725 725 * @arg @ref LL_USART_PARITY_EVEN
Kojto 122:f9eeca106725 726 * @arg @ref LL_USART_PARITY_ODD
Kojto 122:f9eeca106725 727 */
Kojto 122:f9eeca106725 728 __STATIC_INLINE uint32_t LL_USART_GetParity(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 729 {
Kojto 122:f9eeca106725 730 return (uint32_t)(READ_BIT(USARTx->CR1, USART_CR1_PS | USART_CR1_PCE));
Kojto 122:f9eeca106725 731 }
Kojto 122:f9eeca106725 732
Kojto 122:f9eeca106725 733 /**
Kojto 122:f9eeca106725 734 * @brief Set Receiver Wake Up method from Mute mode.
Kojto 122:f9eeca106725 735 * @rmtoll CR1 WAKE LL_USART_SetWakeUpMethod
Kojto 122:f9eeca106725 736 * @param USARTx USART Instance
Kojto 122:f9eeca106725 737 * @param Method This parameter can be one of the following values:
Kojto 122:f9eeca106725 738 * @arg @ref LL_USART_WAKEUP_IDLELINE
Kojto 122:f9eeca106725 739 * @arg @ref LL_USART_WAKEUP_ADDRESSMARK
Kojto 122:f9eeca106725 740 * @retval None
Kojto 122:f9eeca106725 741 */
Kojto 122:f9eeca106725 742 __STATIC_INLINE void LL_USART_SetWakeUpMethod(USART_TypeDef *USARTx, uint32_t Method)
Kojto 122:f9eeca106725 743 {
Kojto 122:f9eeca106725 744 MODIFY_REG(USARTx->CR1, USART_CR1_WAKE, Method);
Kojto 122:f9eeca106725 745 }
Kojto 122:f9eeca106725 746
Kojto 122:f9eeca106725 747 /**
Kojto 122:f9eeca106725 748 * @brief Return Receiver Wake Up method from Mute mode
Kojto 122:f9eeca106725 749 * @rmtoll CR1 WAKE LL_USART_GetWakeUpMethod
Kojto 122:f9eeca106725 750 * @param USARTx USART Instance
Kojto 122:f9eeca106725 751 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 752 * @arg @ref LL_USART_WAKEUP_IDLELINE
Kojto 122:f9eeca106725 753 * @arg @ref LL_USART_WAKEUP_ADDRESSMARK
Kojto 122:f9eeca106725 754 */
Kojto 122:f9eeca106725 755 __STATIC_INLINE uint32_t LL_USART_GetWakeUpMethod(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 756 {
Kojto 122:f9eeca106725 757 return (uint32_t)(READ_BIT(USARTx->CR1, USART_CR1_WAKE));
Kojto 122:f9eeca106725 758 }
Kojto 122:f9eeca106725 759
Kojto 122:f9eeca106725 760 /**
Kojto 122:f9eeca106725 761 * @brief Set Word length (i.e. nb of data bits, excluding start and stop bits)
Kojto 122:f9eeca106725 762 * @rmtoll CR1 M0 LL_USART_SetDataWidth\n
Kojto 122:f9eeca106725 763 * CR1 M1 LL_USART_SetDataWidth
Kojto 122:f9eeca106725 764 * @param USARTx USART Instance
Kojto 122:f9eeca106725 765 * @param DataWidth This parameter can be one of the following values:
Kojto 122:f9eeca106725 766 * @arg @ref LL_USART_DATAWIDTH_7B
Kojto 122:f9eeca106725 767 * @arg @ref LL_USART_DATAWIDTH_8B
Kojto 122:f9eeca106725 768 * @arg @ref LL_USART_DATAWIDTH_9B
Kojto 122:f9eeca106725 769 * @retval None
Kojto 122:f9eeca106725 770 */
Kojto 122:f9eeca106725 771 __STATIC_INLINE void LL_USART_SetDataWidth(USART_TypeDef *USARTx, uint32_t DataWidth)
Kojto 122:f9eeca106725 772 {
Kojto 122:f9eeca106725 773 MODIFY_REG(USARTx->CR1, USART_CR1_M, DataWidth);
Kojto 122:f9eeca106725 774 }
Kojto 122:f9eeca106725 775
Kojto 122:f9eeca106725 776 /**
Kojto 122:f9eeca106725 777 * @brief Return Word length (i.e. nb of data bits, excluding start and stop bits)
Kojto 122:f9eeca106725 778 * @rmtoll CR1 M0 LL_USART_GetDataWidth\n
Kojto 122:f9eeca106725 779 * CR1 M1 LL_USART_GetDataWidth
Kojto 122:f9eeca106725 780 * @param USARTx USART Instance
Kojto 122:f9eeca106725 781 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 782 * @arg @ref LL_USART_DATAWIDTH_7B
Kojto 122:f9eeca106725 783 * @arg @ref LL_USART_DATAWIDTH_8B
Kojto 122:f9eeca106725 784 * @arg @ref LL_USART_DATAWIDTH_9B
Kojto 122:f9eeca106725 785 */
Kojto 122:f9eeca106725 786 __STATIC_INLINE uint32_t LL_USART_GetDataWidth(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 787 {
Kojto 122:f9eeca106725 788 return (uint32_t)(READ_BIT(USARTx->CR1, USART_CR1_M));
Kojto 122:f9eeca106725 789 }
Kojto 122:f9eeca106725 790
Kojto 122:f9eeca106725 791 /**
Kojto 122:f9eeca106725 792 * @brief Allow switch between Mute Mode and Active mode
Kojto 122:f9eeca106725 793 * @rmtoll CR1 MME LL_USART_EnableMuteMode
Kojto 122:f9eeca106725 794 * @param USARTx USART Instance
Kojto 122:f9eeca106725 795 * @retval None
Kojto 122:f9eeca106725 796 */
Kojto 122:f9eeca106725 797 __STATIC_INLINE void LL_USART_EnableMuteMode(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 798 {
Kojto 122:f9eeca106725 799 SET_BIT(USARTx->CR1, USART_CR1_MME);
Kojto 122:f9eeca106725 800 }
Kojto 122:f9eeca106725 801
Kojto 122:f9eeca106725 802 /**
Kojto 122:f9eeca106725 803 * @brief Prevent Mute Mode use. Set Receiver in active mode permanently.
Kojto 122:f9eeca106725 804 * @rmtoll CR1 MME LL_USART_DisableMuteMode
Kojto 122:f9eeca106725 805 * @param USARTx USART Instance
Kojto 122:f9eeca106725 806 * @retval None
Kojto 122:f9eeca106725 807 */
Kojto 122:f9eeca106725 808 __STATIC_INLINE void LL_USART_DisableMuteMode(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 809 {
Kojto 122:f9eeca106725 810 CLEAR_BIT(USARTx->CR1, USART_CR1_MME);
Kojto 122:f9eeca106725 811 }
Kojto 122:f9eeca106725 812
Kojto 122:f9eeca106725 813 /**
Kojto 122:f9eeca106725 814 * @brief Indicate if switch between Mute Mode and Active mode is allowed
Kojto 122:f9eeca106725 815 * @rmtoll CR1 MME LL_USART_IsEnabledMuteMode
Kojto 122:f9eeca106725 816 * @param USARTx USART Instance
Kojto 122:f9eeca106725 817 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 818 */
Kojto 122:f9eeca106725 819 __STATIC_INLINE uint32_t LL_USART_IsEnabledMuteMode(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 820 {
Kojto 122:f9eeca106725 821 return (READ_BIT(USARTx->CR1, USART_CR1_MME) == (USART_CR1_MME));
Kojto 122:f9eeca106725 822 }
Kojto 122:f9eeca106725 823
Kojto 122:f9eeca106725 824 /**
Kojto 122:f9eeca106725 825 * @brief Set Oversampling to 8-bit or 16-bit mode
Kojto 122:f9eeca106725 826 * @rmtoll CR1 OVER8 LL_USART_SetOverSampling
Kojto 122:f9eeca106725 827 * @param USARTx USART Instance
Kojto 122:f9eeca106725 828 * @param OverSampling This parameter can be one of the following values:
Kojto 122:f9eeca106725 829 * @arg @ref LL_USART_OVERSAMPLING_16
Kojto 122:f9eeca106725 830 * @arg @ref LL_USART_OVERSAMPLING_8
Kojto 122:f9eeca106725 831 * @retval None
Kojto 122:f9eeca106725 832 */
Kojto 122:f9eeca106725 833 __STATIC_INLINE void LL_USART_SetOverSampling(USART_TypeDef *USARTx, uint32_t OverSampling)
Kojto 122:f9eeca106725 834 {
Kojto 122:f9eeca106725 835 MODIFY_REG(USARTx->CR1, USART_CR1_OVER8, OverSampling);
Kojto 122:f9eeca106725 836 }
Kojto 122:f9eeca106725 837
Kojto 122:f9eeca106725 838 /**
Kojto 122:f9eeca106725 839 * @brief Return Oversampling mode
Kojto 122:f9eeca106725 840 * @rmtoll CR1 OVER8 LL_USART_GetOverSampling
Kojto 122:f9eeca106725 841 * @param USARTx USART Instance
Kojto 122:f9eeca106725 842 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 843 * @arg @ref LL_USART_OVERSAMPLING_16
Kojto 122:f9eeca106725 844 * @arg @ref LL_USART_OVERSAMPLING_8
Kojto 122:f9eeca106725 845 */
Kojto 122:f9eeca106725 846 __STATIC_INLINE uint32_t LL_USART_GetOverSampling(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 847 {
Kojto 122:f9eeca106725 848 return (uint32_t)(READ_BIT(USARTx->CR1, USART_CR1_OVER8));
Kojto 122:f9eeca106725 849 }
Kojto 122:f9eeca106725 850
Kojto 122:f9eeca106725 851 /**
Kojto 122:f9eeca106725 852 * @brief Configure if Clock pulse of the last data bit is output to the SCLK pin or not
Kojto 122:f9eeca106725 853 * @note Macro @ref IS_USART_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 854 * Synchronous mode is supported by the USARTx instance.
Kojto 122:f9eeca106725 855 * @rmtoll CR2 LBCL LL_USART_SetLastClkPulseOutput
Kojto 122:f9eeca106725 856 * @param USARTx USART Instance
Kojto 122:f9eeca106725 857 * @param LastBitClockPulse This parameter can be one of the following values:
Kojto 122:f9eeca106725 858 * @arg @ref LL_USART_LASTCLKPULSE_NO_OUTPUT
Kojto 122:f9eeca106725 859 * @arg @ref LL_USART_LASTCLKPULSE_OUTPUT
Kojto 122:f9eeca106725 860 * @retval None
Kojto 122:f9eeca106725 861 */
Kojto 122:f9eeca106725 862 __STATIC_INLINE void LL_USART_SetLastClkPulseOutput(USART_TypeDef *USARTx, uint32_t LastBitClockPulse)
Kojto 122:f9eeca106725 863 {
Kojto 122:f9eeca106725 864 MODIFY_REG(USARTx->CR2, USART_CR2_LBCL, LastBitClockPulse);
Kojto 122:f9eeca106725 865 }
Kojto 122:f9eeca106725 866
Kojto 122:f9eeca106725 867 /**
Kojto 122:f9eeca106725 868 * @brief Retrieve Clock pulse of the last data bit output configuration
Kojto 122:f9eeca106725 869 * (Last bit Clock pulse output to the SCLK pin or not)
Kojto 122:f9eeca106725 870 * @note Macro @ref IS_USART_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 871 * Synchronous mode is supported by the USARTx instance.
Kojto 122:f9eeca106725 872 * @rmtoll CR2 LBCL LL_USART_GetLastClkPulseOutput
Kojto 122:f9eeca106725 873 * @param USARTx USART Instance
Kojto 122:f9eeca106725 874 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 875 * @arg @ref LL_USART_LASTCLKPULSE_NO_OUTPUT
Kojto 122:f9eeca106725 876 * @arg @ref LL_USART_LASTCLKPULSE_OUTPUT
Kojto 122:f9eeca106725 877 */
Kojto 122:f9eeca106725 878 __STATIC_INLINE uint32_t LL_USART_GetLastClkPulseOutput(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 879 {
Kojto 122:f9eeca106725 880 return (uint32_t)(READ_BIT(USARTx->CR2, USART_CR2_LBCL));
Kojto 122:f9eeca106725 881 }
Kojto 122:f9eeca106725 882
Kojto 122:f9eeca106725 883 /**
Kojto 122:f9eeca106725 884 * @brief Select the phase of the clock output on the SCLK pin in synchronous mode
Kojto 122:f9eeca106725 885 * @note Macro @ref IS_USART_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 886 * Synchronous mode is supported by the USARTx instance.
Kojto 122:f9eeca106725 887 * @rmtoll CR2 CPHA LL_USART_SetClockPhase
Kojto 122:f9eeca106725 888 * @param USARTx USART Instance
Kojto 122:f9eeca106725 889 * @param ClockPhase This parameter can be one of the following values:
Kojto 122:f9eeca106725 890 * @arg @ref LL_USART_PHASE_1EDGE
Kojto 122:f9eeca106725 891 * @arg @ref LL_USART_PHASE_2EDGE
Kojto 122:f9eeca106725 892 * @retval None
Kojto 122:f9eeca106725 893 */
Kojto 122:f9eeca106725 894 __STATIC_INLINE void LL_USART_SetClockPhase(USART_TypeDef *USARTx, uint32_t ClockPhase)
Kojto 122:f9eeca106725 895 {
Kojto 122:f9eeca106725 896 MODIFY_REG(USARTx->CR2, USART_CR2_CPHA, ClockPhase);
Kojto 122:f9eeca106725 897 }
Kojto 122:f9eeca106725 898
Kojto 122:f9eeca106725 899 /**
Kojto 122:f9eeca106725 900 * @brief Return phase of the clock output on the SCLK pin in synchronous mode
Kojto 122:f9eeca106725 901 * @note Macro @ref IS_USART_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 902 * Synchronous mode is supported by the USARTx instance.
Kojto 122:f9eeca106725 903 * @rmtoll CR2 CPHA LL_USART_GetClockPhase
Kojto 122:f9eeca106725 904 * @param USARTx USART Instance
Kojto 122:f9eeca106725 905 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 906 * @arg @ref LL_USART_PHASE_1EDGE
Kojto 122:f9eeca106725 907 * @arg @ref LL_USART_PHASE_2EDGE
Kojto 122:f9eeca106725 908 */
Kojto 122:f9eeca106725 909 __STATIC_INLINE uint32_t LL_USART_GetClockPhase(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 910 {
Kojto 122:f9eeca106725 911 return (uint32_t)(READ_BIT(USARTx->CR2, USART_CR2_CPHA));
Kojto 122:f9eeca106725 912 }
Kojto 122:f9eeca106725 913
Kojto 122:f9eeca106725 914 /**
Kojto 122:f9eeca106725 915 * @brief Select the polarity of the clock output on the SCLK pin in synchronous mode
Kojto 122:f9eeca106725 916 * @note Macro @ref IS_USART_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 917 * Synchronous mode is supported by the USARTx instance.
Kojto 122:f9eeca106725 918 * @rmtoll CR2 CPOL LL_USART_SetClockPolarity
Kojto 122:f9eeca106725 919 * @param USARTx USART Instance
Kojto 122:f9eeca106725 920 * @param ClockPolarity This parameter can be one of the following values:
Kojto 122:f9eeca106725 921 * @arg @ref LL_USART_POLARITY_LOW
Kojto 122:f9eeca106725 922 * @arg @ref LL_USART_POLARITY_HIGH
Kojto 122:f9eeca106725 923 * @retval None
Kojto 122:f9eeca106725 924 */
Kojto 122:f9eeca106725 925 __STATIC_INLINE void LL_USART_SetClockPolarity(USART_TypeDef *USARTx, uint32_t ClockPolarity)
Kojto 122:f9eeca106725 926 {
Kojto 122:f9eeca106725 927 MODIFY_REG(USARTx->CR2, USART_CR2_CPOL, ClockPolarity);
Kojto 122:f9eeca106725 928 }
Kojto 122:f9eeca106725 929
Kojto 122:f9eeca106725 930 /**
Kojto 122:f9eeca106725 931 * @brief Return polarity of the clock output on the SCLK pin in synchronous mode
Kojto 122:f9eeca106725 932 * @note Macro @ref IS_USART_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 933 * Synchronous mode is supported by the USARTx instance.
Kojto 122:f9eeca106725 934 * @rmtoll CR2 CPOL LL_USART_GetClockPolarity
Kojto 122:f9eeca106725 935 * @param USARTx USART Instance
Kojto 122:f9eeca106725 936 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 937 * @arg @ref LL_USART_POLARITY_LOW
Kojto 122:f9eeca106725 938 * @arg @ref LL_USART_POLARITY_HIGH
Kojto 122:f9eeca106725 939 */
Kojto 122:f9eeca106725 940 __STATIC_INLINE uint32_t LL_USART_GetClockPolarity(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 941 {
Kojto 122:f9eeca106725 942 return (uint32_t)(READ_BIT(USARTx->CR2, USART_CR2_CPOL));
Kojto 122:f9eeca106725 943 }
Kojto 122:f9eeca106725 944
Kojto 122:f9eeca106725 945 /**
Kojto 122:f9eeca106725 946 * @brief Configure Clock signal format (Phase Polarity and choice about output of last bit clock pulse)
Kojto 122:f9eeca106725 947 * @note Macro @ref IS_USART_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 948 * Synchronous mode is supported by the USARTx instance.
Kojto 122:f9eeca106725 949 * @note Call of this function is equivalent to following function call sequence :
Kojto 122:f9eeca106725 950 * - Clock Phase configuration using @ref LL_USART_SetClockPhase() function
Kojto 122:f9eeca106725 951 * - Clock Polarity configuration using @ref LL_USART_SetClockPolarity() function
Kojto 122:f9eeca106725 952 * - Output of Last bit Clock pulse configuration using @ref LL_USART_SetLastClkPulseOutput() function
Kojto 122:f9eeca106725 953 * @rmtoll CR2 CPHA LL_USART_ConfigClock\n
Kojto 122:f9eeca106725 954 * CR2 CPOL LL_USART_ConfigClock\n
Kojto 122:f9eeca106725 955 * CR2 LBCL LL_USART_ConfigClock
Kojto 122:f9eeca106725 956 * @param USARTx USART Instance
Kojto 122:f9eeca106725 957 * @param Phase This parameter can be one of the following values:
Kojto 122:f9eeca106725 958 * @arg @ref LL_USART_PHASE_1EDGE
Kojto 122:f9eeca106725 959 * @arg @ref LL_USART_PHASE_2EDGE
Kojto 122:f9eeca106725 960 * @param Polarity This parameter can be one of the following values:
Kojto 122:f9eeca106725 961 * @arg @ref LL_USART_POLARITY_LOW
Kojto 122:f9eeca106725 962 * @arg @ref LL_USART_POLARITY_HIGH
Kojto 122:f9eeca106725 963 * @param LBCPOutput This parameter can be one of the following values:
Kojto 122:f9eeca106725 964 * @arg @ref LL_USART_LASTCLKPULSE_NO_OUTPUT
Kojto 122:f9eeca106725 965 * @arg @ref LL_USART_LASTCLKPULSE_OUTPUT
Kojto 122:f9eeca106725 966 * @retval None
Kojto 122:f9eeca106725 967 */
Kojto 122:f9eeca106725 968 __STATIC_INLINE void LL_USART_ConfigClock(USART_TypeDef *USARTx, uint32_t Phase, uint32_t Polarity, uint32_t LBCPOutput)
Kojto 122:f9eeca106725 969 {
Kojto 122:f9eeca106725 970 MODIFY_REG(USARTx->CR2, USART_CR2_CPHA | USART_CR2_CPOL | USART_CR2_LBCL, Phase | Polarity | LBCPOutput);
Kojto 122:f9eeca106725 971 }
Kojto 122:f9eeca106725 972
Kojto 122:f9eeca106725 973 /**
Kojto 122:f9eeca106725 974 * @brief Enable Clock output on SCLK pin
Kojto 122:f9eeca106725 975 * @note Macro @ref IS_USART_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 976 * Synchronous mode is supported by the USARTx instance.
Kojto 122:f9eeca106725 977 * @rmtoll CR2 CLKEN LL_USART_EnableSCLKOutput
Kojto 122:f9eeca106725 978 * @param USARTx USART Instance
Kojto 122:f9eeca106725 979 * @retval None
Kojto 122:f9eeca106725 980 */
Kojto 122:f9eeca106725 981 __STATIC_INLINE void LL_USART_EnableSCLKOutput(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 982 {
Kojto 122:f9eeca106725 983 SET_BIT(USARTx->CR2, USART_CR2_CLKEN);
Kojto 122:f9eeca106725 984 }
Kojto 122:f9eeca106725 985
Kojto 122:f9eeca106725 986 /**
Kojto 122:f9eeca106725 987 * @brief Disable Clock output on SCLK pin
Kojto 122:f9eeca106725 988 * @note Macro @ref IS_USART_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 989 * Synchronous mode is supported by the USARTx instance.
Kojto 122:f9eeca106725 990 * @rmtoll CR2 CLKEN LL_USART_DisableSCLKOutput
Kojto 122:f9eeca106725 991 * @param USARTx USART Instance
Kojto 122:f9eeca106725 992 * @retval None
Kojto 122:f9eeca106725 993 */
Kojto 122:f9eeca106725 994 __STATIC_INLINE void LL_USART_DisableSCLKOutput(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 995 {
Kojto 122:f9eeca106725 996 CLEAR_BIT(USARTx->CR2, USART_CR2_CLKEN);
Kojto 122:f9eeca106725 997 }
Kojto 122:f9eeca106725 998
Kojto 122:f9eeca106725 999 /**
Kojto 122:f9eeca106725 1000 * @brief Indicate if Clock output on SCLK pin is enabled
Kojto 122:f9eeca106725 1001 * @note Macro @ref IS_USART_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 1002 * Synchronous mode is supported by the USARTx instance.
Kojto 122:f9eeca106725 1003 * @rmtoll CR2 CLKEN LL_USART_IsEnabledSCLKOutput
Kojto 122:f9eeca106725 1004 * @param USARTx USART Instance
Kojto 122:f9eeca106725 1005 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 1006 */
Kojto 122:f9eeca106725 1007 __STATIC_INLINE uint32_t LL_USART_IsEnabledSCLKOutput(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 1008 {
Kojto 122:f9eeca106725 1009 return (READ_BIT(USARTx->CR2, USART_CR2_CLKEN) == (USART_CR2_CLKEN));
Kojto 122:f9eeca106725 1010 }
Kojto 122:f9eeca106725 1011
Kojto 122:f9eeca106725 1012 /**
Kojto 122:f9eeca106725 1013 * @brief Set the length of the stop bits
Kojto 122:f9eeca106725 1014 * @rmtoll CR2 STOP LL_USART_SetStopBitsLength
Kojto 122:f9eeca106725 1015 * @param USARTx USART Instance
Kojto 122:f9eeca106725 1016 * @param StopBits This parameter can be one of the following values:
Kojto 122:f9eeca106725 1017 * @arg @ref LL_USART_STOPBITS_0_5
Kojto 122:f9eeca106725 1018 * @arg @ref LL_USART_STOPBITS_1
Kojto 122:f9eeca106725 1019 * @arg @ref LL_USART_STOPBITS_1_5
Kojto 122:f9eeca106725 1020 * @arg @ref LL_USART_STOPBITS_2
Kojto 122:f9eeca106725 1021 * @retval None
Kojto 122:f9eeca106725 1022 */
Kojto 122:f9eeca106725 1023 __STATIC_INLINE void LL_USART_SetStopBitsLength(USART_TypeDef *USARTx, uint32_t StopBits)
Kojto 122:f9eeca106725 1024 {
Kojto 122:f9eeca106725 1025 MODIFY_REG(USARTx->CR2, USART_CR2_STOP, StopBits);
Kojto 122:f9eeca106725 1026 }
Kojto 122:f9eeca106725 1027
Kojto 122:f9eeca106725 1028 /**
Kojto 122:f9eeca106725 1029 * @brief Retrieve the length of the stop bits
Kojto 122:f9eeca106725 1030 * @rmtoll CR2 STOP LL_USART_GetStopBitsLength
Kojto 122:f9eeca106725 1031 * @param USARTx USART Instance
Kojto 122:f9eeca106725 1032 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 1033 * @arg @ref LL_USART_STOPBITS_0_5
Kojto 122:f9eeca106725 1034 * @arg @ref LL_USART_STOPBITS_1
Kojto 122:f9eeca106725 1035 * @arg @ref LL_USART_STOPBITS_1_5
Kojto 122:f9eeca106725 1036 * @arg @ref LL_USART_STOPBITS_2
Kojto 122:f9eeca106725 1037 */
Kojto 122:f9eeca106725 1038 __STATIC_INLINE uint32_t LL_USART_GetStopBitsLength(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 1039 {
Kojto 122:f9eeca106725 1040 return (uint32_t)(READ_BIT(USARTx->CR2, USART_CR2_STOP));
Kojto 122:f9eeca106725 1041 }
Kojto 122:f9eeca106725 1042
Kojto 122:f9eeca106725 1043 /**
Kojto 122:f9eeca106725 1044 * @brief Configure Character frame format (Datawidth, Parity control, Stop Bits)
Kojto 122:f9eeca106725 1045 * @note Call of this function is equivalent to following function call sequence :
Kojto 122:f9eeca106725 1046 * - Data Width configuration using @ref LL_USART_SetDataWidth() function
Kojto 122:f9eeca106725 1047 * - Parity Control and mode configuration using @ref LL_USART_SetParity() function
Kojto 122:f9eeca106725 1048 * - Stop bits configuration using @ref LL_USART_SetStopBitsLength() function
Kojto 122:f9eeca106725 1049 * @rmtoll CR1 PS LL_USART_ConfigCharacter\n
Kojto 122:f9eeca106725 1050 * CR1 PCE LL_USART_ConfigCharacter\n
Kojto 122:f9eeca106725 1051 * CR1 M0 LL_USART_ConfigCharacter\n
Kojto 122:f9eeca106725 1052 * CR1 M1 LL_USART_ConfigCharacter\n
Kojto 122:f9eeca106725 1053 * CR2 STOP LL_USART_ConfigCharacter
Kojto 122:f9eeca106725 1054 * @param USARTx USART Instance
Kojto 122:f9eeca106725 1055 * @param DataWidth This parameter can be one of the following values:
Kojto 122:f9eeca106725 1056 * @arg @ref LL_USART_DATAWIDTH_7B
Kojto 122:f9eeca106725 1057 * @arg @ref LL_USART_DATAWIDTH_8B
Kojto 122:f9eeca106725 1058 * @arg @ref LL_USART_DATAWIDTH_9B
Kojto 122:f9eeca106725 1059 * @param Parity This parameter can be one of the following values:
Kojto 122:f9eeca106725 1060 * @arg @ref LL_USART_PARITY_NONE
Kojto 122:f9eeca106725 1061 * @arg @ref LL_USART_PARITY_EVEN
Kojto 122:f9eeca106725 1062 * @arg @ref LL_USART_PARITY_ODD
Kojto 122:f9eeca106725 1063 * @param StopBits This parameter can be one of the following values:
Kojto 122:f9eeca106725 1064 * @arg @ref LL_USART_STOPBITS_0_5
Kojto 122:f9eeca106725 1065 * @arg @ref LL_USART_STOPBITS_1
Kojto 122:f9eeca106725 1066 * @arg @ref LL_USART_STOPBITS_1_5
Kojto 122:f9eeca106725 1067 * @arg @ref LL_USART_STOPBITS_2
Kojto 122:f9eeca106725 1068 * @retval None
Kojto 122:f9eeca106725 1069 */
Kojto 122:f9eeca106725 1070 __STATIC_INLINE void LL_USART_ConfigCharacter(USART_TypeDef *USARTx, uint32_t DataWidth, uint32_t Parity,
Kojto 122:f9eeca106725 1071 uint32_t StopBits)
Kojto 122:f9eeca106725 1072 {
Kojto 122:f9eeca106725 1073 MODIFY_REG(USARTx->CR1, USART_CR1_PS | USART_CR1_PCE | USART_CR1_M, Parity | DataWidth);
Kojto 122:f9eeca106725 1074 MODIFY_REG(USARTx->CR2, USART_CR2_STOP, StopBits);
Kojto 122:f9eeca106725 1075 }
Kojto 122:f9eeca106725 1076
Kojto 122:f9eeca106725 1077 /**
Kojto 122:f9eeca106725 1078 * @brief Configure TX/RX pins swapping setting.
Kojto 122:f9eeca106725 1079 * @rmtoll CR2 SWAP LL_USART_SetTXRXSwap
Kojto 122:f9eeca106725 1080 * @param USARTx USART Instance
Kojto 122:f9eeca106725 1081 * @param SwapConfig This parameter can be one of the following values:
Kojto 122:f9eeca106725 1082 * @arg @ref LL_USART_TXRX_STANDARD
Kojto 122:f9eeca106725 1083 * @arg @ref LL_USART_TXRX_SWAPPED
Kojto 122:f9eeca106725 1084 * @retval None
Kojto 122:f9eeca106725 1085 */
Kojto 122:f9eeca106725 1086 __STATIC_INLINE void LL_USART_SetTXRXSwap(USART_TypeDef *USARTx, uint32_t SwapConfig)
Kojto 122:f9eeca106725 1087 {
Kojto 122:f9eeca106725 1088 MODIFY_REG(USARTx->CR2, USART_CR2_SWAP, SwapConfig);
Kojto 122:f9eeca106725 1089 }
Kojto 122:f9eeca106725 1090
Kojto 122:f9eeca106725 1091 /**
Kojto 122:f9eeca106725 1092 * @brief Retrieve TX/RX pins swapping configuration.
Kojto 122:f9eeca106725 1093 * @rmtoll CR2 SWAP LL_USART_GetTXRXSwap
Kojto 122:f9eeca106725 1094 * @param USARTx USART Instance
Kojto 122:f9eeca106725 1095 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 1096 * @arg @ref LL_USART_TXRX_STANDARD
Kojto 122:f9eeca106725 1097 * @arg @ref LL_USART_TXRX_SWAPPED
Kojto 122:f9eeca106725 1098 */
Kojto 122:f9eeca106725 1099 __STATIC_INLINE uint32_t LL_USART_GetTXRXSwap(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 1100 {
Kojto 122:f9eeca106725 1101 return (uint32_t)(READ_BIT(USARTx->CR2, USART_CR2_SWAP));
Kojto 122:f9eeca106725 1102 }
Kojto 122:f9eeca106725 1103
Kojto 122:f9eeca106725 1104 /**
Kojto 122:f9eeca106725 1105 * @brief Configure RX pin active level logic
Kojto 122:f9eeca106725 1106 * @rmtoll CR2 RXINV LL_USART_SetRXPinLevel
Kojto 122:f9eeca106725 1107 * @param USARTx USART Instance
Kojto 122:f9eeca106725 1108 * @param PinInvMethod This parameter can be one of the following values:
Kojto 122:f9eeca106725 1109 * @arg @ref LL_USART_RXPIN_LEVEL_STANDARD
Kojto 122:f9eeca106725 1110 * @arg @ref LL_USART_RXPIN_LEVEL_INVERTED
Kojto 122:f9eeca106725 1111 * @retval None
Kojto 122:f9eeca106725 1112 */
Kojto 122:f9eeca106725 1113 __STATIC_INLINE void LL_USART_SetRXPinLevel(USART_TypeDef *USARTx, uint32_t PinInvMethod)
Kojto 122:f9eeca106725 1114 {
Kojto 122:f9eeca106725 1115 MODIFY_REG(USARTx->CR2, USART_CR2_RXINV, PinInvMethod);
Kojto 122:f9eeca106725 1116 }
Kojto 122:f9eeca106725 1117
Kojto 122:f9eeca106725 1118 /**
Kojto 122:f9eeca106725 1119 * @brief Retrieve RX pin active level logic configuration
Kojto 122:f9eeca106725 1120 * @rmtoll CR2 RXINV LL_USART_GetRXPinLevel
Kojto 122:f9eeca106725 1121 * @param USARTx USART Instance
Kojto 122:f9eeca106725 1122 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 1123 * @arg @ref LL_USART_RXPIN_LEVEL_STANDARD
Kojto 122:f9eeca106725 1124 * @arg @ref LL_USART_RXPIN_LEVEL_INVERTED
Kojto 122:f9eeca106725 1125 */
Kojto 122:f9eeca106725 1126 __STATIC_INLINE uint32_t LL_USART_GetRXPinLevel(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 1127 {
Kojto 122:f9eeca106725 1128 return (uint32_t)(READ_BIT(USARTx->CR2, USART_CR2_RXINV));
Kojto 122:f9eeca106725 1129 }
Kojto 122:f9eeca106725 1130
Kojto 122:f9eeca106725 1131 /**
Kojto 122:f9eeca106725 1132 * @brief Configure TX pin active level logic
Kojto 122:f9eeca106725 1133 * @rmtoll CR2 TXINV LL_USART_SetTXPinLevel
Kojto 122:f9eeca106725 1134 * @param USARTx USART Instance
Kojto 122:f9eeca106725 1135 * @param PinInvMethod This parameter can be one of the following values:
Kojto 122:f9eeca106725 1136 * @arg @ref LL_USART_TXPIN_LEVEL_STANDARD
Kojto 122:f9eeca106725 1137 * @arg @ref LL_USART_TXPIN_LEVEL_INVERTED
Kojto 122:f9eeca106725 1138 * @retval None
Kojto 122:f9eeca106725 1139 */
Kojto 122:f9eeca106725 1140 __STATIC_INLINE void LL_USART_SetTXPinLevel(USART_TypeDef *USARTx, uint32_t PinInvMethod)
Kojto 122:f9eeca106725 1141 {
Kojto 122:f9eeca106725 1142 MODIFY_REG(USARTx->CR2, USART_CR2_TXINV, PinInvMethod);
Kojto 122:f9eeca106725 1143 }
Kojto 122:f9eeca106725 1144
Kojto 122:f9eeca106725 1145 /**
Kojto 122:f9eeca106725 1146 * @brief Retrieve TX pin active level logic configuration
Kojto 122:f9eeca106725 1147 * @rmtoll CR2 TXINV LL_USART_GetTXPinLevel
Kojto 122:f9eeca106725 1148 * @param USARTx USART Instance
Kojto 122:f9eeca106725 1149 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 1150 * @arg @ref LL_USART_TXPIN_LEVEL_STANDARD
Kojto 122:f9eeca106725 1151 * @arg @ref LL_USART_TXPIN_LEVEL_INVERTED
Kojto 122:f9eeca106725 1152 */
Kojto 122:f9eeca106725 1153 __STATIC_INLINE uint32_t LL_USART_GetTXPinLevel(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 1154 {
Kojto 122:f9eeca106725 1155 return (uint32_t)(READ_BIT(USARTx->CR2, USART_CR2_TXINV));
Kojto 122:f9eeca106725 1156 }
Kojto 122:f9eeca106725 1157
Kojto 122:f9eeca106725 1158 /**
Kojto 122:f9eeca106725 1159 * @brief Configure Binary data logic.
Kojto 122:f9eeca106725 1160 * @note Allow to define how Logical data from the data register are send/received :
Kojto 122:f9eeca106725 1161 * either in positive/direct logic (1=H, 0=L) or in negative/inverse logic (1=L, 0=H)
Kojto 122:f9eeca106725 1162 * @rmtoll CR2 DATAINV LL_USART_SetBinaryDataLogic
Kojto 122:f9eeca106725 1163 * @param USARTx USART Instance
Kojto 122:f9eeca106725 1164 * @param DataLogic This parameter can be one of the following values:
Kojto 122:f9eeca106725 1165 * @arg @ref LL_USART_BINARY_LOGIC_POSITIVE
Kojto 122:f9eeca106725 1166 * @arg @ref LL_USART_BINARY_LOGIC_NEGATIVE
Kojto 122:f9eeca106725 1167 * @retval None
Kojto 122:f9eeca106725 1168 */
Kojto 122:f9eeca106725 1169 __STATIC_INLINE void LL_USART_SetBinaryDataLogic(USART_TypeDef *USARTx, uint32_t DataLogic)
Kojto 122:f9eeca106725 1170 {
Kojto 122:f9eeca106725 1171 MODIFY_REG(USARTx->CR2, USART_CR2_DATAINV, DataLogic);
Kojto 122:f9eeca106725 1172 }
Kojto 122:f9eeca106725 1173
Kojto 122:f9eeca106725 1174 /**
Kojto 122:f9eeca106725 1175 * @brief Retrieve Binary data configuration
Kojto 122:f9eeca106725 1176 * @rmtoll CR2 DATAINV LL_USART_GetBinaryDataLogic
Kojto 122:f9eeca106725 1177 * @param USARTx USART Instance
Kojto 122:f9eeca106725 1178 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 1179 * @arg @ref LL_USART_BINARY_LOGIC_POSITIVE
Kojto 122:f9eeca106725 1180 * @arg @ref LL_USART_BINARY_LOGIC_NEGATIVE
Kojto 122:f9eeca106725 1181 */
Kojto 122:f9eeca106725 1182 __STATIC_INLINE uint32_t LL_USART_GetBinaryDataLogic(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 1183 {
Kojto 122:f9eeca106725 1184 return (uint32_t)(READ_BIT(USARTx->CR2, USART_CR2_DATAINV));
Kojto 122:f9eeca106725 1185 }
Kojto 122:f9eeca106725 1186
Kojto 122:f9eeca106725 1187 /**
Kojto 122:f9eeca106725 1188 * @brief Configure transfer bit order (either Less or Most Significant Bit First)
Kojto 122:f9eeca106725 1189 * @note MSB First means data is transmitted/received with the MSB first, following the start bit.
Kojto 122:f9eeca106725 1190 * LSB First means data is transmitted/received with data bit 0 first, following the start bit.
Kojto 122:f9eeca106725 1191 * @rmtoll CR2 MSBFIRST LL_USART_SetTransferBitOrder
Kojto 122:f9eeca106725 1192 * @param USARTx USART Instance
Kojto 122:f9eeca106725 1193 * @param BitOrder This parameter can be one of the following values:
Kojto 122:f9eeca106725 1194 * @arg @ref LL_USART_BITORDER_LSBFIRST
Kojto 122:f9eeca106725 1195 * @arg @ref LL_USART_BITORDER_MSBFIRST
Kojto 122:f9eeca106725 1196 * @retval None
Kojto 122:f9eeca106725 1197 */
Kojto 122:f9eeca106725 1198 __STATIC_INLINE void LL_USART_SetTransferBitOrder(USART_TypeDef *USARTx, uint32_t BitOrder)
Kojto 122:f9eeca106725 1199 {
Kojto 122:f9eeca106725 1200 MODIFY_REG(USARTx->CR2, USART_CR2_MSBFIRST, BitOrder);
Kojto 122:f9eeca106725 1201 }
Kojto 122:f9eeca106725 1202
Kojto 122:f9eeca106725 1203 /**
Kojto 122:f9eeca106725 1204 * @brief Return transfer bit order (either Less or Most Significant Bit First)
Kojto 122:f9eeca106725 1205 * @note MSB First means data is transmitted/received with the MSB first, following the start bit.
Kojto 122:f9eeca106725 1206 * LSB First means data is transmitted/received with data bit 0 first, following the start bit.
Kojto 122:f9eeca106725 1207 * @rmtoll CR2 MSBFIRST LL_USART_GetTransferBitOrder
Kojto 122:f9eeca106725 1208 * @param USARTx USART Instance
Kojto 122:f9eeca106725 1209 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 1210 * @arg @ref LL_USART_BITORDER_LSBFIRST
Kojto 122:f9eeca106725 1211 * @arg @ref LL_USART_BITORDER_MSBFIRST
Kojto 122:f9eeca106725 1212 */
Kojto 122:f9eeca106725 1213 __STATIC_INLINE uint32_t LL_USART_GetTransferBitOrder(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 1214 {
Kojto 122:f9eeca106725 1215 return (uint32_t)(READ_BIT(USARTx->CR2, USART_CR2_MSBFIRST));
Kojto 122:f9eeca106725 1216 }
Kojto 122:f9eeca106725 1217
Kojto 122:f9eeca106725 1218 /**
Kojto 122:f9eeca106725 1219 * @brief Enable Auto Baud-Rate Detection
Kojto 122:f9eeca106725 1220 * @note Macro @ref IS_USART_AUTOBAUDRATE_DETECTION_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 1221 * Auto Baud Rate detection feature is supported by the USARTx instance.
Kojto 122:f9eeca106725 1222 * @rmtoll CR2 ABREN LL_USART_EnableAutoBaudRate
Kojto 122:f9eeca106725 1223 * @param USARTx USART Instance
Kojto 122:f9eeca106725 1224 * @retval None
Kojto 122:f9eeca106725 1225 */
Kojto 122:f9eeca106725 1226 __STATIC_INLINE void LL_USART_EnableAutoBaudRate(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 1227 {
Kojto 122:f9eeca106725 1228 SET_BIT(USARTx->CR2, USART_CR2_ABREN);
Kojto 122:f9eeca106725 1229 }
Kojto 122:f9eeca106725 1230
Kojto 122:f9eeca106725 1231 /**
Kojto 122:f9eeca106725 1232 * @brief Disable Auto Baud-Rate Detection
Kojto 122:f9eeca106725 1233 * @note Macro @ref IS_USART_AUTOBAUDRATE_DETECTION_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 1234 * Auto Baud Rate detection feature is supported by the USARTx instance.
Kojto 122:f9eeca106725 1235 * @rmtoll CR2 ABREN LL_USART_DisableAutoBaudRate
Kojto 122:f9eeca106725 1236 * @param USARTx USART Instance
Kojto 122:f9eeca106725 1237 * @retval None
Kojto 122:f9eeca106725 1238 */
Kojto 122:f9eeca106725 1239 __STATIC_INLINE void LL_USART_DisableAutoBaudRate(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 1240 {
Kojto 122:f9eeca106725 1241 CLEAR_BIT(USARTx->CR2, USART_CR2_ABREN);
Kojto 122:f9eeca106725 1242 }
Kojto 122:f9eeca106725 1243
Kojto 122:f9eeca106725 1244 /**
Kojto 122:f9eeca106725 1245 * @brief Indicate if Auto Baud-Rate Detection mechanism is enabled
Kojto 122:f9eeca106725 1246 * @note Macro @ref IS_USART_AUTOBAUDRATE_DETECTION_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 1247 * Auto Baud Rate detection feature is supported by the USARTx instance.
Kojto 122:f9eeca106725 1248 * @rmtoll CR2 ABREN LL_USART_IsEnabledAutoBaud
Kojto 122:f9eeca106725 1249 * @param USARTx USART Instance
Kojto 122:f9eeca106725 1250 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 1251 */
Kojto 122:f9eeca106725 1252 __STATIC_INLINE uint32_t LL_USART_IsEnabledAutoBaud(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 1253 {
Kojto 122:f9eeca106725 1254 return (READ_BIT(USARTx->CR2, USART_CR2_ABREN) == (USART_CR2_ABREN));
Kojto 122:f9eeca106725 1255 }
Kojto 122:f9eeca106725 1256
Kojto 122:f9eeca106725 1257 /**
Kojto 122:f9eeca106725 1258 * @brief Set Auto Baud-Rate mode bits
Kojto 122:f9eeca106725 1259 * @note Macro @ref IS_USART_AUTOBAUDRATE_DETECTION_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 1260 * Auto Baud Rate detection feature is supported by the USARTx instance.
Kojto 122:f9eeca106725 1261 * @rmtoll CR2 ABRMODE LL_USART_SetAutoBaudRateMode
Kojto 122:f9eeca106725 1262 * @param USARTx USART Instance
Kojto 122:f9eeca106725 1263 * @param AutoBaudRateMode This parameter can be one of the following values:
Kojto 122:f9eeca106725 1264 * @arg @ref LL_USART_AUTOBAUD_DETECT_ON_STARTBIT
Kojto 122:f9eeca106725 1265 * @arg @ref LL_USART_AUTOBAUD_DETECT_ON_FALLINGEDGE
Kojto 122:f9eeca106725 1266 * @arg @ref LL_USART_AUTOBAUD_DETECT_ON_7F_FRAME
Kojto 122:f9eeca106725 1267 * @arg @ref LL_USART_AUTOBAUD_DETECT_ON_55_FRAME
Kojto 122:f9eeca106725 1268 * @retval None
Kojto 122:f9eeca106725 1269 */
Kojto 122:f9eeca106725 1270 __STATIC_INLINE void LL_USART_SetAutoBaudRateMode(USART_TypeDef *USARTx, uint32_t AutoBaudRateMode)
Kojto 122:f9eeca106725 1271 {
Kojto 122:f9eeca106725 1272 MODIFY_REG(USARTx->CR2, USART_CR2_ABRMODE, AutoBaudRateMode);
Kojto 122:f9eeca106725 1273 }
Kojto 122:f9eeca106725 1274
Kojto 122:f9eeca106725 1275 /**
Kojto 122:f9eeca106725 1276 * @brief Return Auto Baud-Rate mode
Kojto 122:f9eeca106725 1277 * @note Macro @ref IS_USART_AUTOBAUDRATE_DETECTION_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 1278 * Auto Baud Rate detection feature is supported by the USARTx instance.
Kojto 122:f9eeca106725 1279 * @rmtoll CR2 ABRMODE LL_USART_GetAutoBaudRateMode
Kojto 122:f9eeca106725 1280 * @param USARTx USART Instance
Kojto 122:f9eeca106725 1281 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 1282 * @arg @ref LL_USART_AUTOBAUD_DETECT_ON_STARTBIT
Kojto 122:f9eeca106725 1283 * @arg @ref LL_USART_AUTOBAUD_DETECT_ON_FALLINGEDGE
Kojto 122:f9eeca106725 1284 * @arg @ref LL_USART_AUTOBAUD_DETECT_ON_7F_FRAME
Kojto 122:f9eeca106725 1285 * @arg @ref LL_USART_AUTOBAUD_DETECT_ON_55_FRAME
Kojto 122:f9eeca106725 1286 */
Kojto 122:f9eeca106725 1287 __STATIC_INLINE uint32_t LL_USART_GetAutoBaudRateMode(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 1288 {
Kojto 122:f9eeca106725 1289 return (uint32_t)(READ_BIT(USARTx->CR2, USART_CR2_ABRMODE));
Kojto 122:f9eeca106725 1290 }
Kojto 122:f9eeca106725 1291
Kojto 122:f9eeca106725 1292 /**
Kojto 122:f9eeca106725 1293 * @brief Enable Receiver Timeout
Kojto 122:f9eeca106725 1294 * @rmtoll CR2 RTOEN LL_USART_EnableRxTimeout
Kojto 122:f9eeca106725 1295 * @param USARTx USART Instance
Kojto 122:f9eeca106725 1296 * @retval None
Kojto 122:f9eeca106725 1297 */
Kojto 122:f9eeca106725 1298 __STATIC_INLINE void LL_USART_EnableRxTimeout(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 1299 {
Kojto 122:f9eeca106725 1300 SET_BIT(USARTx->CR2, USART_CR2_RTOEN);
Kojto 122:f9eeca106725 1301 }
Kojto 122:f9eeca106725 1302
Kojto 122:f9eeca106725 1303 /**
Kojto 122:f9eeca106725 1304 * @brief Disable Receiver Timeout
Kojto 122:f9eeca106725 1305 * @rmtoll CR2 RTOEN LL_USART_DisableRxTimeout
Kojto 122:f9eeca106725 1306 * @param USARTx USART Instance
Kojto 122:f9eeca106725 1307 * @retval None
Kojto 122:f9eeca106725 1308 */
Kojto 122:f9eeca106725 1309 __STATIC_INLINE void LL_USART_DisableRxTimeout(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 1310 {
Kojto 122:f9eeca106725 1311 CLEAR_BIT(USARTx->CR2, USART_CR2_RTOEN);
Kojto 122:f9eeca106725 1312 }
Kojto 122:f9eeca106725 1313
Kojto 122:f9eeca106725 1314 /**
Kojto 122:f9eeca106725 1315 * @brief Indicate if Receiver Timeout feature is enabled
Kojto 122:f9eeca106725 1316 * @rmtoll CR2 RTOEN LL_USART_IsEnabledRxTimeout
Kojto 122:f9eeca106725 1317 * @param USARTx USART Instance
Kojto 122:f9eeca106725 1318 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 1319 */
Kojto 122:f9eeca106725 1320 __STATIC_INLINE uint32_t LL_USART_IsEnabledRxTimeout(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 1321 {
Kojto 122:f9eeca106725 1322 return (READ_BIT(USARTx->CR2, USART_CR2_RTOEN) == (USART_CR2_RTOEN));
Kojto 122:f9eeca106725 1323 }
Kojto 122:f9eeca106725 1324
Kojto 122:f9eeca106725 1325 /**
Kojto 122:f9eeca106725 1326 * @brief Set Address of the USART node.
Kojto 122:f9eeca106725 1327 * @note This is used in multiprocessor communication during Mute mode or Stop mode,
Kojto 122:f9eeca106725 1328 * for wake up with address mark detection.
Kojto 122:f9eeca106725 1329 * @note 4bits address node is used when 4-bit Address Detection is selected in ADDM7.
Kojto 122:f9eeca106725 1330 * (b7-b4 should be set to 0)
Kojto 122:f9eeca106725 1331 * 8bits address node is used when 7-bit Address Detection is selected in ADDM7.
Kojto 122:f9eeca106725 1332 * (This is used in multiprocessor communication during Mute mode or Stop mode,
Kojto 122:f9eeca106725 1333 * for wake up with 7-bit address mark detection.
Kojto 122:f9eeca106725 1334 * The MSB of the character sent by the transmitter should be equal to 1.
Kojto 122:f9eeca106725 1335 * It may also be used for character detection during normal reception,
Kojto 122:f9eeca106725 1336 * Mute mode inactive (for example, end of block detection in ModBus protocol).
Kojto 122:f9eeca106725 1337 * In this case, the whole received character (8-bit) is compared to the ADD[7:0]
Kojto 122:f9eeca106725 1338 * value and CMF flag is set on match)
Kojto 122:f9eeca106725 1339 * @rmtoll CR2 ADD LL_USART_ConfigNodeAddress\n
Kojto 122:f9eeca106725 1340 * CR2 ADDM7 LL_USART_ConfigNodeAddress
Kojto 122:f9eeca106725 1341 * @param USARTx USART Instance
Kojto 122:f9eeca106725 1342 * @param AddressLen This parameter can be one of the following values:
Kojto 122:f9eeca106725 1343 * @arg @ref LL_USART_ADDRESS_DETECT_4B
Kojto 122:f9eeca106725 1344 * @arg @ref LL_USART_ADDRESS_DETECT_7B
Kojto 122:f9eeca106725 1345 * @param NodeAddress 4 or 7 bit Address of the USART node.
Kojto 122:f9eeca106725 1346 * @retval None
Kojto 122:f9eeca106725 1347 */
Kojto 122:f9eeca106725 1348 __STATIC_INLINE void LL_USART_ConfigNodeAddress(USART_TypeDef *USARTx, uint32_t AddressLen, uint32_t NodeAddress)
Kojto 122:f9eeca106725 1349 {
Kojto 122:f9eeca106725 1350 MODIFY_REG(USARTx->CR2, USART_CR2_ADD | USART_CR2_ADDM7,
AnnaBridge 145:64910690c574 1351 (uint32_t)(AddressLen | (NodeAddress << USART_CR2_ADD_Pos)));
Kojto 122:f9eeca106725 1352 }
Kojto 122:f9eeca106725 1353
Kojto 122:f9eeca106725 1354 /**
Kojto 122:f9eeca106725 1355 * @brief Return 8 bit Address of the USART node as set in ADD field of CR2.
Kojto 122:f9eeca106725 1356 * @note If 4-bit Address Detection is selected in ADDM7,
Kojto 122:f9eeca106725 1357 * only 4bits (b3-b0) of returned value are relevant (b31-b4 are not relevant)
Kojto 122:f9eeca106725 1358 * If 7-bit Address Detection is selected in ADDM7,
Kojto 122:f9eeca106725 1359 * only 8bits (b7-b0) of returned value are relevant (b31-b8 are not relevant)
Kojto 122:f9eeca106725 1360 * @rmtoll CR2 ADD LL_USART_GetNodeAddress
Kojto 122:f9eeca106725 1361 * @param USARTx USART Instance
Kojto 122:f9eeca106725 1362 * @retval Address of the USART node (Value between Min_Data=0 and Max_Data=255)
Kojto 122:f9eeca106725 1363 */
Kojto 122:f9eeca106725 1364 __STATIC_INLINE uint32_t LL_USART_GetNodeAddress(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 1365 {
AnnaBridge 145:64910690c574 1366 return (uint32_t)(READ_BIT(USARTx->CR2, USART_CR2_ADD) >> USART_CR2_ADD_Pos);
Kojto 122:f9eeca106725 1367 }
Kojto 122:f9eeca106725 1368
Kojto 122:f9eeca106725 1369 /**
Kojto 122:f9eeca106725 1370 * @brief Return Length of Node Address used in Address Detection mode (7-bit or 4-bit)
Kojto 122:f9eeca106725 1371 * @rmtoll CR2 ADDM7 LL_USART_GetNodeAddressLen
Kojto 122:f9eeca106725 1372 * @param USARTx USART Instance
Kojto 122:f9eeca106725 1373 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 1374 * @arg @ref LL_USART_ADDRESS_DETECT_4B
Kojto 122:f9eeca106725 1375 * @arg @ref LL_USART_ADDRESS_DETECT_7B
Kojto 122:f9eeca106725 1376 */
Kojto 122:f9eeca106725 1377 __STATIC_INLINE uint32_t LL_USART_GetNodeAddressLen(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 1378 {
Kojto 122:f9eeca106725 1379 return (uint32_t)(READ_BIT(USARTx->CR2, USART_CR2_ADDM7));
Kojto 122:f9eeca106725 1380 }
Kojto 122:f9eeca106725 1381
Kojto 122:f9eeca106725 1382 /**
Kojto 122:f9eeca106725 1383 * @brief Enable RTS HW Flow Control
Kojto 122:f9eeca106725 1384 * @note Macro @ref IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 1385 * Hardware Flow control feature is supported by the USARTx instance.
Kojto 122:f9eeca106725 1386 * @rmtoll CR3 RTSE LL_USART_EnableRTSHWFlowCtrl
Kojto 122:f9eeca106725 1387 * @param USARTx USART Instance
Kojto 122:f9eeca106725 1388 * @retval None
Kojto 122:f9eeca106725 1389 */
Kojto 122:f9eeca106725 1390 __STATIC_INLINE void LL_USART_EnableRTSHWFlowCtrl(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 1391 {
Kojto 122:f9eeca106725 1392 SET_BIT(USARTx->CR3, USART_CR3_RTSE);
Kojto 122:f9eeca106725 1393 }
Kojto 122:f9eeca106725 1394
Kojto 122:f9eeca106725 1395 /**
Kojto 122:f9eeca106725 1396 * @brief Disable RTS HW Flow Control
Kojto 122:f9eeca106725 1397 * @note Macro @ref IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 1398 * Hardware Flow control feature is supported by the USARTx instance.
Kojto 122:f9eeca106725 1399 * @rmtoll CR3 RTSE LL_USART_DisableRTSHWFlowCtrl
Kojto 122:f9eeca106725 1400 * @param USARTx USART Instance
Kojto 122:f9eeca106725 1401 * @retval None
Kojto 122:f9eeca106725 1402 */
Kojto 122:f9eeca106725 1403 __STATIC_INLINE void LL_USART_DisableRTSHWFlowCtrl(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 1404 {
Kojto 122:f9eeca106725 1405 CLEAR_BIT(USARTx->CR3, USART_CR3_RTSE);
Kojto 122:f9eeca106725 1406 }
Kojto 122:f9eeca106725 1407
Kojto 122:f9eeca106725 1408 /**
Kojto 122:f9eeca106725 1409 * @brief Enable CTS HW Flow Control
Kojto 122:f9eeca106725 1410 * @note Macro @ref IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 1411 * Hardware Flow control feature is supported by the USARTx instance.
Kojto 122:f9eeca106725 1412 * @rmtoll CR3 CTSE LL_USART_EnableCTSHWFlowCtrl
Kojto 122:f9eeca106725 1413 * @param USARTx USART Instance
Kojto 122:f9eeca106725 1414 * @retval None
Kojto 122:f9eeca106725 1415 */
Kojto 122:f9eeca106725 1416 __STATIC_INLINE void LL_USART_EnableCTSHWFlowCtrl(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 1417 {
Kojto 122:f9eeca106725 1418 SET_BIT(USARTx->CR3, USART_CR3_CTSE);
Kojto 122:f9eeca106725 1419 }
Kojto 122:f9eeca106725 1420
Kojto 122:f9eeca106725 1421 /**
Kojto 122:f9eeca106725 1422 * @brief Disable CTS HW Flow Control
Kojto 122:f9eeca106725 1423 * @note Macro @ref IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 1424 * Hardware Flow control feature is supported by the USARTx instance.
Kojto 122:f9eeca106725 1425 * @rmtoll CR3 CTSE LL_USART_DisableCTSHWFlowCtrl
Kojto 122:f9eeca106725 1426 * @param USARTx USART Instance
Kojto 122:f9eeca106725 1427 * @retval None
Kojto 122:f9eeca106725 1428 */
Kojto 122:f9eeca106725 1429 __STATIC_INLINE void LL_USART_DisableCTSHWFlowCtrl(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 1430 {
Kojto 122:f9eeca106725 1431 CLEAR_BIT(USARTx->CR3, USART_CR3_CTSE);
Kojto 122:f9eeca106725 1432 }
Kojto 122:f9eeca106725 1433
Kojto 122:f9eeca106725 1434 /**
Kojto 122:f9eeca106725 1435 * @brief Configure HW Flow Control mode (both CTS and RTS)
Kojto 122:f9eeca106725 1436 * @note Macro @ref IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 1437 * Hardware Flow control feature is supported by the USARTx instance.
Kojto 122:f9eeca106725 1438 * @rmtoll CR3 RTSE LL_USART_SetHWFlowCtrl\n
Kojto 122:f9eeca106725 1439 * CR3 CTSE LL_USART_SetHWFlowCtrl
Kojto 122:f9eeca106725 1440 * @param USARTx USART Instance
Kojto 122:f9eeca106725 1441 * @param HardwareFlowControl This parameter can be one of the following values:
Kojto 122:f9eeca106725 1442 * @arg @ref LL_USART_HWCONTROL_NONE
Kojto 122:f9eeca106725 1443 * @arg @ref LL_USART_HWCONTROL_RTS
Kojto 122:f9eeca106725 1444 * @arg @ref LL_USART_HWCONTROL_CTS
Kojto 122:f9eeca106725 1445 * @arg @ref LL_USART_HWCONTROL_RTS_CTS
Kojto 122:f9eeca106725 1446 * @retval None
Kojto 122:f9eeca106725 1447 */
Kojto 122:f9eeca106725 1448 __STATIC_INLINE void LL_USART_SetHWFlowCtrl(USART_TypeDef *USARTx, uint32_t HardwareFlowControl)
Kojto 122:f9eeca106725 1449 {
Kojto 122:f9eeca106725 1450 MODIFY_REG(USARTx->CR3, USART_CR3_RTSE | USART_CR3_CTSE, HardwareFlowControl);
Kojto 122:f9eeca106725 1451 }
Kojto 122:f9eeca106725 1452
Kojto 122:f9eeca106725 1453 /**
Kojto 122:f9eeca106725 1454 * @brief Return HW Flow Control configuration (both CTS and RTS)
Kojto 122:f9eeca106725 1455 * @note Macro @ref IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 1456 * Hardware Flow control feature is supported by the USARTx instance.
Kojto 122:f9eeca106725 1457 * @rmtoll CR3 RTSE LL_USART_GetHWFlowCtrl\n
Kojto 122:f9eeca106725 1458 * CR3 CTSE LL_USART_GetHWFlowCtrl
Kojto 122:f9eeca106725 1459 * @param USARTx USART Instance
Kojto 122:f9eeca106725 1460 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 1461 * @arg @ref LL_USART_HWCONTROL_NONE
Kojto 122:f9eeca106725 1462 * @arg @ref LL_USART_HWCONTROL_RTS
Kojto 122:f9eeca106725 1463 * @arg @ref LL_USART_HWCONTROL_CTS
Kojto 122:f9eeca106725 1464 * @arg @ref LL_USART_HWCONTROL_RTS_CTS
Kojto 122:f9eeca106725 1465 */
Kojto 122:f9eeca106725 1466 __STATIC_INLINE uint32_t LL_USART_GetHWFlowCtrl(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 1467 {
Kojto 122:f9eeca106725 1468 return (uint32_t)(READ_BIT(USARTx->CR3, USART_CR3_RTSE | USART_CR3_CTSE));
Kojto 122:f9eeca106725 1469 }
Kojto 122:f9eeca106725 1470
Kojto 122:f9eeca106725 1471 /**
Kojto 122:f9eeca106725 1472 * @brief Enable One bit sampling method
Kojto 122:f9eeca106725 1473 * @rmtoll CR3 ONEBIT LL_USART_EnableOneBitSamp
Kojto 122:f9eeca106725 1474 * @param USARTx USART Instance
Kojto 122:f9eeca106725 1475 * @retval None
Kojto 122:f9eeca106725 1476 */
Kojto 122:f9eeca106725 1477 __STATIC_INLINE void LL_USART_EnableOneBitSamp(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 1478 {
Kojto 122:f9eeca106725 1479 SET_BIT(USARTx->CR3, USART_CR3_ONEBIT);
Kojto 122:f9eeca106725 1480 }
Kojto 122:f9eeca106725 1481
Kojto 122:f9eeca106725 1482 /**
Kojto 122:f9eeca106725 1483 * @brief Disable One bit sampling method
Kojto 122:f9eeca106725 1484 * @rmtoll CR3 ONEBIT LL_USART_DisableOneBitSamp
Kojto 122:f9eeca106725 1485 * @param USARTx USART Instance
Kojto 122:f9eeca106725 1486 * @retval None
Kojto 122:f9eeca106725 1487 */
Kojto 122:f9eeca106725 1488 __STATIC_INLINE void LL_USART_DisableOneBitSamp(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 1489 {
Kojto 122:f9eeca106725 1490 CLEAR_BIT(USARTx->CR3, USART_CR3_ONEBIT);
Kojto 122:f9eeca106725 1491 }
Kojto 122:f9eeca106725 1492
Kojto 122:f9eeca106725 1493 /**
Kojto 122:f9eeca106725 1494 * @brief Indicate if One bit sampling method is enabled
Kojto 122:f9eeca106725 1495 * @rmtoll CR3 ONEBIT LL_USART_IsEnabledOneBitSamp
Kojto 122:f9eeca106725 1496 * @param USARTx USART Instance
Kojto 122:f9eeca106725 1497 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 1498 */
Kojto 122:f9eeca106725 1499 __STATIC_INLINE uint32_t LL_USART_IsEnabledOneBitSamp(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 1500 {
Kojto 122:f9eeca106725 1501 return (READ_BIT(USARTx->CR3, USART_CR3_ONEBIT) == (USART_CR3_ONEBIT));
Kojto 122:f9eeca106725 1502 }
Kojto 122:f9eeca106725 1503
Kojto 122:f9eeca106725 1504 /**
Kojto 122:f9eeca106725 1505 * @brief Enable Overrun detection
Kojto 122:f9eeca106725 1506 * @rmtoll CR3 OVRDIS LL_USART_EnableOverrunDetect
Kojto 122:f9eeca106725 1507 * @param USARTx USART Instance
Kojto 122:f9eeca106725 1508 * @retval None
Kojto 122:f9eeca106725 1509 */
Kojto 122:f9eeca106725 1510 __STATIC_INLINE void LL_USART_EnableOverrunDetect(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 1511 {
Kojto 122:f9eeca106725 1512 CLEAR_BIT(USARTx->CR3, USART_CR3_OVRDIS);
Kojto 122:f9eeca106725 1513 }
Kojto 122:f9eeca106725 1514
Kojto 122:f9eeca106725 1515 /**
Kojto 122:f9eeca106725 1516 * @brief Disable Overrun detection
Kojto 122:f9eeca106725 1517 * @rmtoll CR3 OVRDIS LL_USART_DisableOverrunDetect
Kojto 122:f9eeca106725 1518 * @param USARTx USART Instance
Kojto 122:f9eeca106725 1519 * @retval None
Kojto 122:f9eeca106725 1520 */
Kojto 122:f9eeca106725 1521 __STATIC_INLINE void LL_USART_DisableOverrunDetect(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 1522 {
Kojto 122:f9eeca106725 1523 SET_BIT(USARTx->CR3, USART_CR3_OVRDIS);
Kojto 122:f9eeca106725 1524 }
Kojto 122:f9eeca106725 1525
Kojto 122:f9eeca106725 1526 /**
Kojto 122:f9eeca106725 1527 * @brief Indicate if Overrun detection is enabled
Kojto 122:f9eeca106725 1528 * @rmtoll CR3 OVRDIS LL_USART_IsEnabledOverrunDetect
Kojto 122:f9eeca106725 1529 * @param USARTx USART Instance
Kojto 122:f9eeca106725 1530 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 1531 */
Kojto 122:f9eeca106725 1532 __STATIC_INLINE uint32_t LL_USART_IsEnabledOverrunDetect(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 1533 {
Kojto 122:f9eeca106725 1534 return (READ_BIT(USARTx->CR3, USART_CR3_OVRDIS) != USART_CR3_OVRDIS);
Kojto 122:f9eeca106725 1535 }
Kojto 122:f9eeca106725 1536
Kojto 122:f9eeca106725 1537 /**
Kojto 122:f9eeca106725 1538 * @brief Select event type for Wake UP Interrupt Flag (WUS[1:0] bits)
Kojto 122:f9eeca106725 1539 * @note Macro @ref IS_UART_WAKEUP_FROMSTOP_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 1540 * Wake-up from Stop mode feature is supported by the USARTx instance.
Kojto 122:f9eeca106725 1541 * @rmtoll CR3 WUS LL_USART_SetWKUPType
Kojto 122:f9eeca106725 1542 * @param USARTx USART Instance
Kojto 122:f9eeca106725 1543 * @param Type This parameter can be one of the following values:
Kojto 122:f9eeca106725 1544 * @arg @ref LL_USART_WAKEUP_ON_ADDRESS
Kojto 122:f9eeca106725 1545 * @arg @ref LL_USART_WAKEUP_ON_STARTBIT
Kojto 122:f9eeca106725 1546 * @arg @ref LL_USART_WAKEUP_ON_RXNE
Kojto 122:f9eeca106725 1547 * @retval None
Kojto 122:f9eeca106725 1548 */
Kojto 122:f9eeca106725 1549 __STATIC_INLINE void LL_USART_SetWKUPType(USART_TypeDef *USARTx, uint32_t Type)
Kojto 122:f9eeca106725 1550 {
Kojto 122:f9eeca106725 1551 MODIFY_REG(USARTx->CR3, USART_CR3_WUS, Type);
Kojto 122:f9eeca106725 1552 }
Kojto 122:f9eeca106725 1553
Kojto 122:f9eeca106725 1554 /**
Kojto 122:f9eeca106725 1555 * @brief Return event type for Wake UP Interrupt Flag (WUS[1:0] bits)
Kojto 122:f9eeca106725 1556 * @note Macro @ref IS_UART_WAKEUP_FROMSTOP_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 1557 * Wake-up from Stop mode feature is supported by the USARTx instance.
Kojto 122:f9eeca106725 1558 * @rmtoll CR3 WUS LL_USART_GetWKUPType
Kojto 122:f9eeca106725 1559 * @param USARTx USART Instance
Kojto 122:f9eeca106725 1560 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 1561 * @arg @ref LL_USART_WAKEUP_ON_ADDRESS
Kojto 122:f9eeca106725 1562 * @arg @ref LL_USART_WAKEUP_ON_STARTBIT
Kojto 122:f9eeca106725 1563 * @arg @ref LL_USART_WAKEUP_ON_RXNE
Kojto 122:f9eeca106725 1564 */
Kojto 122:f9eeca106725 1565 __STATIC_INLINE uint32_t LL_USART_GetWKUPType(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 1566 {
Kojto 122:f9eeca106725 1567 return (uint32_t)(READ_BIT(USARTx->CR3, USART_CR3_WUS));
Kojto 122:f9eeca106725 1568 }
Kojto 122:f9eeca106725 1569
Kojto 122:f9eeca106725 1570 /**
Kojto 122:f9eeca106725 1571 * @brief Configure USART BRR register for achieving expected Baud Rate value.
Kojto 122:f9eeca106725 1572 * @note Compute and set USARTDIV value in BRR Register (full BRR content)
Kojto 122:f9eeca106725 1573 * according to used Peripheral Clock, Oversampling mode, and expected Baud Rate values
Kojto 122:f9eeca106725 1574 * @note Peripheral clock and Baud rate values provided as function parameters should be valid
Kojto 122:f9eeca106725 1575 * (Baud rate value != 0)
AnnaBridge 145:64910690c574 1576 * @note In case of oversampling by 16 and 8, BRR content must be greater than or equal to 16d.
Kojto 122:f9eeca106725 1577 * @rmtoll BRR BRR LL_USART_SetBaudRate
Kojto 122:f9eeca106725 1578 * @param USARTx USART Instance
Kojto 122:f9eeca106725 1579 * @param PeriphClk Peripheral Clock
Kojto 122:f9eeca106725 1580 * @param OverSampling This parameter can be one of the following values:
Kojto 122:f9eeca106725 1581 * @arg @ref LL_USART_OVERSAMPLING_16
Kojto 122:f9eeca106725 1582 * @arg @ref LL_USART_OVERSAMPLING_8
Kojto 122:f9eeca106725 1583 * @param BaudRate Baud Rate
Kojto 122:f9eeca106725 1584 * @retval None
Kojto 122:f9eeca106725 1585 */
Kojto 122:f9eeca106725 1586 __STATIC_INLINE void LL_USART_SetBaudRate(USART_TypeDef *USARTx, uint32_t PeriphClk, uint32_t OverSampling,
Kojto 122:f9eeca106725 1587 uint32_t BaudRate)
Kojto 122:f9eeca106725 1588 {
Kojto 122:f9eeca106725 1589 register uint32_t usartdiv = 0x0U;
Kojto 122:f9eeca106725 1590 register uint32_t brrtemp = 0x0U;
Kojto 122:f9eeca106725 1591
Kojto 122:f9eeca106725 1592 if (OverSampling == LL_USART_OVERSAMPLING_8)
Kojto 122:f9eeca106725 1593 {
Kojto 122:f9eeca106725 1594 usartdiv = (uint16_t)(__LL_USART_DIV_SAMPLING8(PeriphClk, BaudRate));
Kojto 122:f9eeca106725 1595 brrtemp = usartdiv & 0xFFF0U;
Kojto 122:f9eeca106725 1596 brrtemp |= (uint16_t)((usartdiv & (uint16_t)0x000FU) >> 1U);
Kojto 122:f9eeca106725 1597 USARTx->BRR = brrtemp;
Kojto 122:f9eeca106725 1598 }
Kojto 122:f9eeca106725 1599 else
Kojto 122:f9eeca106725 1600 {
Kojto 122:f9eeca106725 1601 USARTx->BRR = (uint16_t)(__LL_USART_DIV_SAMPLING16(PeriphClk, BaudRate));
Kojto 122:f9eeca106725 1602 }
Kojto 122:f9eeca106725 1603 }
Kojto 122:f9eeca106725 1604
Kojto 122:f9eeca106725 1605 /**
Kojto 122:f9eeca106725 1606 * @brief Return current Baud Rate value, according to USARTDIV present in BRR register
Kojto 122:f9eeca106725 1607 * (full BRR content), and to used Peripheral Clock and Oversampling mode values
Kojto 122:f9eeca106725 1608 * @note In case of non-initialized or invalid value stored in BRR register, value 0 will be returned.
AnnaBridge 145:64910690c574 1609 * @note In case of oversampling by 16 and 8, BRR content must be greater than or equal to 16d.
Kojto 122:f9eeca106725 1610 * @rmtoll BRR BRR LL_USART_GetBaudRate
Kojto 122:f9eeca106725 1611 * @param USARTx USART Instance
Kojto 122:f9eeca106725 1612 * @param PeriphClk Peripheral Clock
Kojto 122:f9eeca106725 1613 * @param OverSampling This parameter can be one of the following values:
Kojto 122:f9eeca106725 1614 * @arg @ref LL_USART_OVERSAMPLING_16
Kojto 122:f9eeca106725 1615 * @arg @ref LL_USART_OVERSAMPLING_8
Kojto 122:f9eeca106725 1616 * @retval Baud Rate
Kojto 122:f9eeca106725 1617 */
Kojto 122:f9eeca106725 1618 __STATIC_INLINE uint32_t LL_USART_GetBaudRate(USART_TypeDef *USARTx, uint32_t PeriphClk, uint32_t OverSampling)
Kojto 122:f9eeca106725 1619 {
Kojto 122:f9eeca106725 1620 register uint32_t usartdiv = 0x0U;
Kojto 122:f9eeca106725 1621 register uint32_t brrresult = 0x0U;
Kojto 122:f9eeca106725 1622
Kojto 122:f9eeca106725 1623 usartdiv = USARTx->BRR;
Kojto 122:f9eeca106725 1624
Kojto 122:f9eeca106725 1625 if (OverSampling == LL_USART_OVERSAMPLING_8)
Kojto 122:f9eeca106725 1626 {
Kojto 122:f9eeca106725 1627 if ((usartdiv & 0xFFF7U) != 0U)
Kojto 122:f9eeca106725 1628 {
Kojto 122:f9eeca106725 1629 usartdiv = (uint16_t)((usartdiv & 0xFFF0U) | ((usartdiv & 0x0007U) << 1U)) ;
Kojto 122:f9eeca106725 1630 brrresult = (PeriphClk * 2U) / usartdiv;
Kojto 122:f9eeca106725 1631 }
Kojto 122:f9eeca106725 1632 }
Kojto 122:f9eeca106725 1633 else
Kojto 122:f9eeca106725 1634 {
Kojto 122:f9eeca106725 1635 if ((usartdiv & 0xFFFFU) != 0U)
Kojto 122:f9eeca106725 1636 {
Kojto 122:f9eeca106725 1637 brrresult = PeriphClk / usartdiv;
Kojto 122:f9eeca106725 1638 }
Kojto 122:f9eeca106725 1639 }
Kojto 122:f9eeca106725 1640 return (brrresult);
Kojto 122:f9eeca106725 1641 }
Kojto 122:f9eeca106725 1642
Kojto 122:f9eeca106725 1643 /**
Kojto 122:f9eeca106725 1644 * @brief Set Receiver Time Out Value (expressed in nb of bits duration)
Kojto 122:f9eeca106725 1645 * @rmtoll RTOR RTO LL_USART_SetRxTimeout
Kojto 122:f9eeca106725 1646 * @param USARTx USART Instance
Kojto 122:f9eeca106725 1647 * @param Timeout Value between Min_Data=0x00 and Max_Data=0x00FFFFFF
Kojto 122:f9eeca106725 1648 * @retval None
Kojto 122:f9eeca106725 1649 */
Kojto 122:f9eeca106725 1650 __STATIC_INLINE void LL_USART_SetRxTimeout(USART_TypeDef *USARTx, uint32_t Timeout)
Kojto 122:f9eeca106725 1651 {
Kojto 122:f9eeca106725 1652 MODIFY_REG(USARTx->RTOR, USART_RTOR_RTO, Timeout);
Kojto 122:f9eeca106725 1653 }
Kojto 122:f9eeca106725 1654
Kojto 122:f9eeca106725 1655 /**
Kojto 122:f9eeca106725 1656 * @brief Get Receiver Time Out Value (expressed in nb of bits duration)
Kojto 122:f9eeca106725 1657 * @rmtoll RTOR RTO LL_USART_GetRxTimeout
Kojto 122:f9eeca106725 1658 * @param USARTx USART Instance
Kojto 122:f9eeca106725 1659 * @retval Value between Min_Data=0x00 and Max_Data=0x00FFFFFF
Kojto 122:f9eeca106725 1660 */
Kojto 122:f9eeca106725 1661 __STATIC_INLINE uint32_t LL_USART_GetRxTimeout(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 1662 {
Kojto 122:f9eeca106725 1663 return (uint32_t)(READ_BIT(USARTx->RTOR, USART_RTOR_RTO));
Kojto 122:f9eeca106725 1664 }
Kojto 122:f9eeca106725 1665
Kojto 122:f9eeca106725 1666 /**
Kojto 122:f9eeca106725 1667 * @brief Set Block Length value in reception
Kojto 122:f9eeca106725 1668 * @rmtoll RTOR BLEN LL_USART_SetBlockLength
Kojto 122:f9eeca106725 1669 * @param USARTx USART Instance
Kojto 122:f9eeca106725 1670 * @param BlockLength Value between Min_Data=0x00 and Max_Data=0xFF
Kojto 122:f9eeca106725 1671 * @retval None
Kojto 122:f9eeca106725 1672 */
Kojto 122:f9eeca106725 1673 __STATIC_INLINE void LL_USART_SetBlockLength(USART_TypeDef *USARTx, uint32_t BlockLength)
Kojto 122:f9eeca106725 1674 {
AnnaBridge 145:64910690c574 1675 MODIFY_REG(USARTx->RTOR, USART_RTOR_BLEN, BlockLength << USART_RTOR_BLEN_Pos);
Kojto 122:f9eeca106725 1676 }
Kojto 122:f9eeca106725 1677
Kojto 122:f9eeca106725 1678 /**
Kojto 122:f9eeca106725 1679 * @brief Get Block Length value in reception
Kojto 122:f9eeca106725 1680 * @rmtoll RTOR BLEN LL_USART_GetBlockLength
Kojto 122:f9eeca106725 1681 * @param USARTx USART Instance
Kojto 122:f9eeca106725 1682 * @retval Value between Min_Data=0x00 and Max_Data=0xFF
Kojto 122:f9eeca106725 1683 */
Kojto 122:f9eeca106725 1684 __STATIC_INLINE uint32_t LL_USART_GetBlockLength(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 1685 {
AnnaBridge 145:64910690c574 1686 return (uint32_t)(READ_BIT(USARTx->RTOR, USART_RTOR_BLEN) >> USART_RTOR_BLEN_Pos);
Kojto 122:f9eeca106725 1687 }
Kojto 122:f9eeca106725 1688
Kojto 122:f9eeca106725 1689 /**
Kojto 122:f9eeca106725 1690 * @}
Kojto 122:f9eeca106725 1691 */
Kojto 122:f9eeca106725 1692
Kojto 122:f9eeca106725 1693 /** @defgroup USART_LL_EF_Configuration_IRDA Configuration functions related to Irda feature
Kojto 122:f9eeca106725 1694 * @{
Kojto 122:f9eeca106725 1695 */
Kojto 122:f9eeca106725 1696
Kojto 122:f9eeca106725 1697 /**
Kojto 122:f9eeca106725 1698 * @brief Enable IrDA mode
Kojto 122:f9eeca106725 1699 * @note Macro @ref IS_IRDA_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 1700 * IrDA feature is supported by the USARTx instance.
Kojto 122:f9eeca106725 1701 * @rmtoll CR3 IREN LL_USART_EnableIrda
Kojto 122:f9eeca106725 1702 * @param USARTx USART Instance
Kojto 122:f9eeca106725 1703 * @retval None
Kojto 122:f9eeca106725 1704 */
Kojto 122:f9eeca106725 1705 __STATIC_INLINE void LL_USART_EnableIrda(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 1706 {
Kojto 122:f9eeca106725 1707 SET_BIT(USARTx->CR3, USART_CR3_IREN);
Kojto 122:f9eeca106725 1708 }
Kojto 122:f9eeca106725 1709
Kojto 122:f9eeca106725 1710 /**
Kojto 122:f9eeca106725 1711 * @brief Disable IrDA mode
Kojto 122:f9eeca106725 1712 * @note Macro @ref IS_IRDA_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 1713 * IrDA feature is supported by the USARTx instance.
Kojto 122:f9eeca106725 1714 * @rmtoll CR3 IREN LL_USART_DisableIrda
Kojto 122:f9eeca106725 1715 * @param USARTx USART Instance
Kojto 122:f9eeca106725 1716 * @retval None
Kojto 122:f9eeca106725 1717 */
Kojto 122:f9eeca106725 1718 __STATIC_INLINE void LL_USART_DisableIrda(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 1719 {
Kojto 122:f9eeca106725 1720 CLEAR_BIT(USARTx->CR3, USART_CR3_IREN);
Kojto 122:f9eeca106725 1721 }
Kojto 122:f9eeca106725 1722
Kojto 122:f9eeca106725 1723 /**
Kojto 122:f9eeca106725 1724 * @brief Indicate if IrDA mode is enabled
Kojto 122:f9eeca106725 1725 * @note Macro @ref IS_IRDA_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 1726 * IrDA feature is supported by the USARTx instance.
Kojto 122:f9eeca106725 1727 * @rmtoll CR3 IREN LL_USART_IsEnabledIrda
Kojto 122:f9eeca106725 1728 * @param USARTx USART Instance
Kojto 122:f9eeca106725 1729 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 1730 */
Kojto 122:f9eeca106725 1731 __STATIC_INLINE uint32_t LL_USART_IsEnabledIrda(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 1732 {
Kojto 122:f9eeca106725 1733 return (READ_BIT(USARTx->CR3, USART_CR3_IREN) == (USART_CR3_IREN));
Kojto 122:f9eeca106725 1734 }
Kojto 122:f9eeca106725 1735
Kojto 122:f9eeca106725 1736 /**
Kojto 122:f9eeca106725 1737 * @brief Configure IrDA Power Mode (Normal or Low Power)
Kojto 122:f9eeca106725 1738 * @note Macro @ref IS_IRDA_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 1739 * IrDA feature is supported by the USARTx instance.
Kojto 122:f9eeca106725 1740 * @rmtoll CR3 IRLP LL_USART_SetIrdaPowerMode
Kojto 122:f9eeca106725 1741 * @param USARTx USART Instance
Kojto 122:f9eeca106725 1742 * @param PowerMode This parameter can be one of the following values:
Kojto 122:f9eeca106725 1743 * @arg @ref LL_USART_IRDA_POWER_NORMAL
Kojto 122:f9eeca106725 1744 * @arg @ref LL_USART_IRDA_POWER_LOW
Kojto 122:f9eeca106725 1745 * @retval None
Kojto 122:f9eeca106725 1746 */
Kojto 122:f9eeca106725 1747 __STATIC_INLINE void LL_USART_SetIrdaPowerMode(USART_TypeDef *USARTx, uint32_t PowerMode)
Kojto 122:f9eeca106725 1748 {
Kojto 122:f9eeca106725 1749 MODIFY_REG(USARTx->CR3, USART_CR3_IRLP, PowerMode);
Kojto 122:f9eeca106725 1750 }
Kojto 122:f9eeca106725 1751
Kojto 122:f9eeca106725 1752 /**
Kojto 122:f9eeca106725 1753 * @brief Retrieve IrDA Power Mode configuration (Normal or Low Power)
Kojto 122:f9eeca106725 1754 * @note Macro @ref IS_IRDA_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 1755 * IrDA feature is supported by the USARTx instance.
Kojto 122:f9eeca106725 1756 * @rmtoll CR3 IRLP LL_USART_GetIrdaPowerMode
Kojto 122:f9eeca106725 1757 * @param USARTx USART Instance
Kojto 122:f9eeca106725 1758 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 1759 * @arg @ref LL_USART_IRDA_POWER_NORMAL
Kojto 122:f9eeca106725 1760 * @arg @ref LL_USART_PHASE_2EDGE
Kojto 122:f9eeca106725 1761 */
Kojto 122:f9eeca106725 1762 __STATIC_INLINE uint32_t LL_USART_GetIrdaPowerMode(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 1763 {
Kojto 122:f9eeca106725 1764 return (uint32_t)(READ_BIT(USARTx->CR3, USART_CR3_IRLP));
Kojto 122:f9eeca106725 1765 }
Kojto 122:f9eeca106725 1766
Kojto 122:f9eeca106725 1767 /**
Kojto 122:f9eeca106725 1768 * @brief Set Irda prescaler value, used for dividing the USART clock source
Kojto 122:f9eeca106725 1769 * to achieve the Irda Low Power frequency (8 bits value)
Kojto 122:f9eeca106725 1770 * @note Macro @ref IS_IRDA_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 1771 * IrDA feature is supported by the USARTx instance.
Kojto 122:f9eeca106725 1772 * @rmtoll GTPR PSC LL_USART_SetIrdaPrescaler
Kojto 122:f9eeca106725 1773 * @param USARTx USART Instance
Kojto 122:f9eeca106725 1774 * @param PrescalerValue Value between Min_Data=0x00 and Max_Data=0xFF
Kojto 122:f9eeca106725 1775 * @retval None
Kojto 122:f9eeca106725 1776 */
Kojto 122:f9eeca106725 1777 __STATIC_INLINE void LL_USART_SetIrdaPrescaler(USART_TypeDef *USARTx, uint32_t PrescalerValue)
Kojto 122:f9eeca106725 1778 {
Kojto 122:f9eeca106725 1779 MODIFY_REG(USARTx->GTPR, USART_GTPR_PSC, PrescalerValue);
Kojto 122:f9eeca106725 1780 }
Kojto 122:f9eeca106725 1781
Kojto 122:f9eeca106725 1782 /**
Kojto 122:f9eeca106725 1783 * @brief Return Irda prescaler value, used for dividing the USART clock source
Kojto 122:f9eeca106725 1784 * to achieve the Irda Low Power frequency (8 bits value)
Kojto 122:f9eeca106725 1785 * @note Macro @ref IS_IRDA_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 1786 * IrDA feature is supported by the USARTx instance.
Kojto 122:f9eeca106725 1787 * @rmtoll GTPR PSC LL_USART_GetIrdaPrescaler
Kojto 122:f9eeca106725 1788 * @param USARTx USART Instance
Kojto 122:f9eeca106725 1789 * @retval Irda prescaler value (Value between Min_Data=0x00 and Max_Data=0xFF)
Kojto 122:f9eeca106725 1790 */
Kojto 122:f9eeca106725 1791 __STATIC_INLINE uint32_t LL_USART_GetIrdaPrescaler(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 1792 {
Kojto 122:f9eeca106725 1793 return (uint32_t)(READ_BIT(USARTx->GTPR, USART_GTPR_PSC));
Kojto 122:f9eeca106725 1794 }
Kojto 122:f9eeca106725 1795
Kojto 122:f9eeca106725 1796 /**
Kojto 122:f9eeca106725 1797 * @}
Kojto 122:f9eeca106725 1798 */
Kojto 122:f9eeca106725 1799
Kojto 122:f9eeca106725 1800 /** @defgroup USART_LL_EF_Configuration_Smartcard Configuration functions related to Smartcard feature
Kojto 122:f9eeca106725 1801 * @{
Kojto 122:f9eeca106725 1802 */
Kojto 122:f9eeca106725 1803
Kojto 122:f9eeca106725 1804 /**
Kojto 122:f9eeca106725 1805 * @brief Enable Smartcard NACK transmission
Kojto 122:f9eeca106725 1806 * @note Macro @ref IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 1807 * Smartcard feature is supported by the USARTx instance.
Kojto 122:f9eeca106725 1808 * @rmtoll CR3 NACK LL_USART_EnableSmartcardNACK
Kojto 122:f9eeca106725 1809 * @param USARTx USART Instance
Kojto 122:f9eeca106725 1810 * @retval None
Kojto 122:f9eeca106725 1811 */
Kojto 122:f9eeca106725 1812 __STATIC_INLINE void LL_USART_EnableSmartcardNACK(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 1813 {
Kojto 122:f9eeca106725 1814 SET_BIT(USARTx->CR3, USART_CR3_NACK);
Kojto 122:f9eeca106725 1815 }
Kojto 122:f9eeca106725 1816
Kojto 122:f9eeca106725 1817 /**
Kojto 122:f9eeca106725 1818 * @brief Disable Smartcard NACK transmission
Kojto 122:f9eeca106725 1819 * @note Macro @ref IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 1820 * Smartcard feature is supported by the USARTx instance.
Kojto 122:f9eeca106725 1821 * @rmtoll CR3 NACK LL_USART_DisableSmartcardNACK
Kojto 122:f9eeca106725 1822 * @param USARTx USART Instance
Kojto 122:f9eeca106725 1823 * @retval None
Kojto 122:f9eeca106725 1824 */
Kojto 122:f9eeca106725 1825 __STATIC_INLINE void LL_USART_DisableSmartcardNACK(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 1826 {
Kojto 122:f9eeca106725 1827 CLEAR_BIT(USARTx->CR3, USART_CR3_NACK);
Kojto 122:f9eeca106725 1828 }
Kojto 122:f9eeca106725 1829
Kojto 122:f9eeca106725 1830 /**
Kojto 122:f9eeca106725 1831 * @brief Indicate if Smartcard NACK transmission is enabled
Kojto 122:f9eeca106725 1832 * @note Macro @ref IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 1833 * Smartcard feature is supported by the USARTx instance.
Kojto 122:f9eeca106725 1834 * @rmtoll CR3 NACK LL_USART_IsEnabledSmartcardNACK
Kojto 122:f9eeca106725 1835 * @param USARTx USART Instance
Kojto 122:f9eeca106725 1836 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 1837 */
Kojto 122:f9eeca106725 1838 __STATIC_INLINE uint32_t LL_USART_IsEnabledSmartcardNACK(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 1839 {
Kojto 122:f9eeca106725 1840 return (READ_BIT(USARTx->CR3, USART_CR3_NACK) == (USART_CR3_NACK));
Kojto 122:f9eeca106725 1841 }
Kojto 122:f9eeca106725 1842
Kojto 122:f9eeca106725 1843 /**
Kojto 122:f9eeca106725 1844 * @brief Enable Smartcard mode
Kojto 122:f9eeca106725 1845 * @note Macro @ref IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 1846 * Smartcard feature is supported by the USARTx instance.
Kojto 122:f9eeca106725 1847 * @rmtoll CR3 SCEN LL_USART_EnableSmartcard
Kojto 122:f9eeca106725 1848 * @param USARTx USART Instance
Kojto 122:f9eeca106725 1849 * @retval None
Kojto 122:f9eeca106725 1850 */
Kojto 122:f9eeca106725 1851 __STATIC_INLINE void LL_USART_EnableSmartcard(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 1852 {
Kojto 122:f9eeca106725 1853 SET_BIT(USARTx->CR3, USART_CR3_SCEN);
Kojto 122:f9eeca106725 1854 }
Kojto 122:f9eeca106725 1855
Kojto 122:f9eeca106725 1856 /**
Kojto 122:f9eeca106725 1857 * @brief Disable Smartcard mode
Kojto 122:f9eeca106725 1858 * @note Macro @ref IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 1859 * Smartcard feature is supported by the USARTx instance.
Kojto 122:f9eeca106725 1860 * @rmtoll CR3 SCEN LL_USART_DisableSmartcard
Kojto 122:f9eeca106725 1861 * @param USARTx USART Instance
Kojto 122:f9eeca106725 1862 * @retval None
Kojto 122:f9eeca106725 1863 */
Kojto 122:f9eeca106725 1864 __STATIC_INLINE void LL_USART_DisableSmartcard(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 1865 {
Kojto 122:f9eeca106725 1866 CLEAR_BIT(USARTx->CR3, USART_CR3_SCEN);
Kojto 122:f9eeca106725 1867 }
Kojto 122:f9eeca106725 1868
Kojto 122:f9eeca106725 1869 /**
Kojto 122:f9eeca106725 1870 * @brief Indicate if Smartcard mode is enabled
Kojto 122:f9eeca106725 1871 * @note Macro @ref IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 1872 * Smartcard feature is supported by the USARTx instance.
Kojto 122:f9eeca106725 1873 * @rmtoll CR3 SCEN LL_USART_IsEnabledSmartcard
Kojto 122:f9eeca106725 1874 * @param USARTx USART Instance
Kojto 122:f9eeca106725 1875 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 1876 */
Kojto 122:f9eeca106725 1877 __STATIC_INLINE uint32_t LL_USART_IsEnabledSmartcard(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 1878 {
Kojto 122:f9eeca106725 1879 return (READ_BIT(USARTx->CR3, USART_CR3_SCEN) == (USART_CR3_SCEN));
Kojto 122:f9eeca106725 1880 }
Kojto 122:f9eeca106725 1881
Kojto 122:f9eeca106725 1882 /**
Kojto 122:f9eeca106725 1883 * @brief Set Smartcard Auto-Retry Count value (SCARCNT[2:0] bits)
Kojto 122:f9eeca106725 1884 * @note Macro @ref IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 1885 * Smartcard feature is supported by the USARTx instance.
Kojto 122:f9eeca106725 1886 * @note This bit-field specifies the number of retries in transmit and receive, in Smartcard mode.
Kojto 122:f9eeca106725 1887 * In transmission mode, it specifies the number of automatic retransmission retries, before
Kojto 122:f9eeca106725 1888 * generating a transmission error (FE bit set).
Kojto 122:f9eeca106725 1889 * In reception mode, it specifies the number or erroneous reception trials, before generating a
Kojto 122:f9eeca106725 1890 * reception error (RXNE and PE bits set)
Kojto 122:f9eeca106725 1891 * @rmtoll CR3 SCARCNT LL_USART_SetSmartcardAutoRetryCount
Kojto 122:f9eeca106725 1892 * @param USARTx USART Instance
Kojto 122:f9eeca106725 1893 * @param AutoRetryCount Value between Min_Data=0 and Max_Data=7
Kojto 122:f9eeca106725 1894 * @retval None
Kojto 122:f9eeca106725 1895 */
Kojto 122:f9eeca106725 1896 __STATIC_INLINE void LL_USART_SetSmartcardAutoRetryCount(USART_TypeDef *USARTx, uint32_t AutoRetryCount)
Kojto 122:f9eeca106725 1897 {
AnnaBridge 145:64910690c574 1898 MODIFY_REG(USARTx->CR3, USART_CR3_SCARCNT, AutoRetryCount << USART_CR3_SCARCNT_Pos);
Kojto 122:f9eeca106725 1899 }
Kojto 122:f9eeca106725 1900
Kojto 122:f9eeca106725 1901 /**
Kojto 122:f9eeca106725 1902 * @brief Return Smartcard Auto-Retry Count value (SCARCNT[2:0] bits)
Kojto 122:f9eeca106725 1903 * @note Macro @ref IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 1904 * Smartcard feature is supported by the USARTx instance.
Kojto 122:f9eeca106725 1905 * @rmtoll CR3 SCARCNT LL_USART_GetSmartcardAutoRetryCount
Kojto 122:f9eeca106725 1906 * @param USARTx USART Instance
Kojto 122:f9eeca106725 1907 * @retval Smartcard Auto-Retry Count value (Value between Min_Data=0 and Max_Data=7)
Kojto 122:f9eeca106725 1908 */
Kojto 122:f9eeca106725 1909 __STATIC_INLINE uint32_t LL_USART_GetSmartcardAutoRetryCount(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 1910 {
AnnaBridge 145:64910690c574 1911 return (uint32_t)(READ_BIT(USARTx->CR3, USART_CR3_SCARCNT) >> USART_CR3_SCARCNT_Pos);
Kojto 122:f9eeca106725 1912 }
Kojto 122:f9eeca106725 1913
Kojto 122:f9eeca106725 1914 /**
Kojto 122:f9eeca106725 1915 * @brief Set Smartcard prescaler value, used for dividing the USART clock
Kojto 122:f9eeca106725 1916 * source to provide the SMARTCARD Clock (5 bits value)
Kojto 122:f9eeca106725 1917 * @note Macro @ref IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 1918 * Smartcard feature is supported by the USARTx instance.
Kojto 122:f9eeca106725 1919 * @rmtoll GTPR PSC LL_USART_SetSmartcardPrescaler
Kojto 122:f9eeca106725 1920 * @param USARTx USART Instance
Kojto 122:f9eeca106725 1921 * @param PrescalerValue Value between Min_Data=0 and Max_Data=31
Kojto 122:f9eeca106725 1922 * @retval None
Kojto 122:f9eeca106725 1923 */
Kojto 122:f9eeca106725 1924 __STATIC_INLINE void LL_USART_SetSmartcardPrescaler(USART_TypeDef *USARTx, uint32_t PrescalerValue)
Kojto 122:f9eeca106725 1925 {
Kojto 122:f9eeca106725 1926 MODIFY_REG(USARTx->GTPR, USART_GTPR_PSC, PrescalerValue);
Kojto 122:f9eeca106725 1927 }
Kojto 122:f9eeca106725 1928
Kojto 122:f9eeca106725 1929 /**
Kojto 122:f9eeca106725 1930 * @brief Return Smartcard prescaler value, used for dividing the USART clock
Kojto 122:f9eeca106725 1931 * source to provide the SMARTCARD Clock (5 bits value)
Kojto 122:f9eeca106725 1932 * @note Macro @ref IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 1933 * Smartcard feature is supported by the USARTx instance.
Kojto 122:f9eeca106725 1934 * @rmtoll GTPR PSC LL_USART_GetSmartcardPrescaler
Kojto 122:f9eeca106725 1935 * @param USARTx USART Instance
Kojto 122:f9eeca106725 1936 * @retval Smartcard prescaler value (Value between Min_Data=0 and Max_Data=31)
Kojto 122:f9eeca106725 1937 */
Kojto 122:f9eeca106725 1938 __STATIC_INLINE uint32_t LL_USART_GetSmartcardPrescaler(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 1939 {
Kojto 122:f9eeca106725 1940 return (uint32_t)(READ_BIT(USARTx->GTPR, USART_GTPR_PSC));
Kojto 122:f9eeca106725 1941 }
Kojto 122:f9eeca106725 1942
Kojto 122:f9eeca106725 1943 /**
Kojto 122:f9eeca106725 1944 * @brief Set Smartcard Guard time value, expressed in nb of baud clocks periods
Kojto 122:f9eeca106725 1945 * (GT[7:0] bits : Guard time value)
Kojto 122:f9eeca106725 1946 * @note Macro @ref IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 1947 * Smartcard feature is supported by the USARTx instance.
Kojto 122:f9eeca106725 1948 * @rmtoll GTPR GT LL_USART_SetSmartcardGuardTime
Kojto 122:f9eeca106725 1949 * @param USARTx USART Instance
Kojto 122:f9eeca106725 1950 * @param GuardTime Value between Min_Data=0x00 and Max_Data=0xFF
Kojto 122:f9eeca106725 1951 * @retval None
Kojto 122:f9eeca106725 1952 */
Kojto 122:f9eeca106725 1953 __STATIC_INLINE void LL_USART_SetSmartcardGuardTime(USART_TypeDef *USARTx, uint32_t GuardTime)
Kojto 122:f9eeca106725 1954 {
AnnaBridge 145:64910690c574 1955 MODIFY_REG(USARTx->GTPR, USART_GTPR_GT, GuardTime << USART_GTPR_GT_Pos);
Kojto 122:f9eeca106725 1956 }
Kojto 122:f9eeca106725 1957
Kojto 122:f9eeca106725 1958 /**
Kojto 122:f9eeca106725 1959 * @brief Return Smartcard Guard time value, expressed in nb of baud clocks periods
Kojto 122:f9eeca106725 1960 * (GT[7:0] bits : Guard time value)
Kojto 122:f9eeca106725 1961 * @note Macro @ref IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 1962 * Smartcard feature is supported by the USARTx instance.
Kojto 122:f9eeca106725 1963 * @rmtoll GTPR GT LL_USART_GetSmartcardGuardTime
Kojto 122:f9eeca106725 1964 * @param USARTx USART Instance
Kojto 122:f9eeca106725 1965 * @retval Smartcard Guard time value (Value between Min_Data=0x00 and Max_Data=0xFF)
Kojto 122:f9eeca106725 1966 */
Kojto 122:f9eeca106725 1967 __STATIC_INLINE uint32_t LL_USART_GetSmartcardGuardTime(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 1968 {
AnnaBridge 145:64910690c574 1969 return (uint32_t)(READ_BIT(USARTx->GTPR, USART_GTPR_GT) >> USART_GTPR_GT_Pos);
Kojto 122:f9eeca106725 1970 }
Kojto 122:f9eeca106725 1971
Kojto 122:f9eeca106725 1972 /**
Kojto 122:f9eeca106725 1973 * @}
Kojto 122:f9eeca106725 1974 */
Kojto 122:f9eeca106725 1975
Kojto 122:f9eeca106725 1976 /** @defgroup USART_LL_EF_Configuration_HalfDuplex Configuration functions related to Half Duplex feature
Kojto 122:f9eeca106725 1977 * @{
Kojto 122:f9eeca106725 1978 */
Kojto 122:f9eeca106725 1979
Kojto 122:f9eeca106725 1980 /**
Kojto 122:f9eeca106725 1981 * @brief Enable Single Wire Half-Duplex mode
Kojto 122:f9eeca106725 1982 * @note Macro @ref IS_UART_HALFDUPLEX_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 1983 * Half-Duplex mode is supported by the USARTx instance.
Kojto 122:f9eeca106725 1984 * @rmtoll CR3 HDSEL LL_USART_EnableHalfDuplex
Kojto 122:f9eeca106725 1985 * @param USARTx USART Instance
Kojto 122:f9eeca106725 1986 * @retval None
Kojto 122:f9eeca106725 1987 */
Kojto 122:f9eeca106725 1988 __STATIC_INLINE void LL_USART_EnableHalfDuplex(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 1989 {
Kojto 122:f9eeca106725 1990 SET_BIT(USARTx->CR3, USART_CR3_HDSEL);
Kojto 122:f9eeca106725 1991 }
Kojto 122:f9eeca106725 1992
Kojto 122:f9eeca106725 1993 /**
Kojto 122:f9eeca106725 1994 * @brief Disable Single Wire Half-Duplex mode
Kojto 122:f9eeca106725 1995 * @note Macro @ref IS_UART_HALFDUPLEX_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 1996 * Half-Duplex mode is supported by the USARTx instance.
Kojto 122:f9eeca106725 1997 * @rmtoll CR3 HDSEL LL_USART_DisableHalfDuplex
Kojto 122:f9eeca106725 1998 * @param USARTx USART Instance
Kojto 122:f9eeca106725 1999 * @retval None
Kojto 122:f9eeca106725 2000 */
Kojto 122:f9eeca106725 2001 __STATIC_INLINE void LL_USART_DisableHalfDuplex(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 2002 {
Kojto 122:f9eeca106725 2003 CLEAR_BIT(USARTx->CR3, USART_CR3_HDSEL);
Kojto 122:f9eeca106725 2004 }
Kojto 122:f9eeca106725 2005
Kojto 122:f9eeca106725 2006 /**
Kojto 122:f9eeca106725 2007 * @brief Indicate if Single Wire Half-Duplex mode is enabled
Kojto 122:f9eeca106725 2008 * @note Macro @ref IS_UART_HALFDUPLEX_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 2009 * Half-Duplex mode is supported by the USARTx instance.
Kojto 122:f9eeca106725 2010 * @rmtoll CR3 HDSEL LL_USART_IsEnabledHalfDuplex
Kojto 122:f9eeca106725 2011 * @param USARTx USART Instance
Kojto 122:f9eeca106725 2012 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 2013 */
Kojto 122:f9eeca106725 2014 __STATIC_INLINE uint32_t LL_USART_IsEnabledHalfDuplex(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 2015 {
Kojto 122:f9eeca106725 2016 return (READ_BIT(USARTx->CR3, USART_CR3_HDSEL) == (USART_CR3_HDSEL));
Kojto 122:f9eeca106725 2017 }
Kojto 122:f9eeca106725 2018
Kojto 122:f9eeca106725 2019 /**
Kojto 122:f9eeca106725 2020 * @}
Kojto 122:f9eeca106725 2021 */
Kojto 122:f9eeca106725 2022
Kojto 122:f9eeca106725 2023 /** @defgroup USART_LL_EF_Configuration_LIN Configuration functions related to LIN feature
Kojto 122:f9eeca106725 2024 * @{
Kojto 122:f9eeca106725 2025 */
Kojto 122:f9eeca106725 2026
Kojto 122:f9eeca106725 2027 /**
Kojto 122:f9eeca106725 2028 * @brief Set LIN Break Detection Length
Kojto 122:f9eeca106725 2029 * @note Macro @ref IS_UART_LIN_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 2030 * LIN feature is supported by the USARTx instance.
Kojto 122:f9eeca106725 2031 * @rmtoll CR2 LBDL LL_USART_SetLINBrkDetectionLen
Kojto 122:f9eeca106725 2032 * @param USARTx USART Instance
Kojto 122:f9eeca106725 2033 * @param LINBDLength This parameter can be one of the following values:
Kojto 122:f9eeca106725 2034 * @arg @ref LL_USART_LINBREAK_DETECT_10B
Kojto 122:f9eeca106725 2035 * @arg @ref LL_USART_LINBREAK_DETECT_11B
Kojto 122:f9eeca106725 2036 * @retval None
Kojto 122:f9eeca106725 2037 */
Kojto 122:f9eeca106725 2038 __STATIC_INLINE void LL_USART_SetLINBrkDetectionLen(USART_TypeDef *USARTx, uint32_t LINBDLength)
Kojto 122:f9eeca106725 2039 {
Kojto 122:f9eeca106725 2040 MODIFY_REG(USARTx->CR2, USART_CR2_LBDL, LINBDLength);
Kojto 122:f9eeca106725 2041 }
Kojto 122:f9eeca106725 2042
Kojto 122:f9eeca106725 2043 /**
Kojto 122:f9eeca106725 2044 * @brief Return LIN Break Detection Length
Kojto 122:f9eeca106725 2045 * @note Macro @ref IS_UART_LIN_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 2046 * LIN feature is supported by the USARTx instance.
Kojto 122:f9eeca106725 2047 * @rmtoll CR2 LBDL LL_USART_GetLINBrkDetectionLen
Kojto 122:f9eeca106725 2048 * @param USARTx USART Instance
Kojto 122:f9eeca106725 2049 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 2050 * @arg @ref LL_USART_LINBREAK_DETECT_10B
Kojto 122:f9eeca106725 2051 * @arg @ref LL_USART_LINBREAK_DETECT_11B
Kojto 122:f9eeca106725 2052 */
Kojto 122:f9eeca106725 2053 __STATIC_INLINE uint32_t LL_USART_GetLINBrkDetectionLen(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 2054 {
Kojto 122:f9eeca106725 2055 return (uint32_t)(READ_BIT(USARTx->CR2, USART_CR2_LBDL));
Kojto 122:f9eeca106725 2056 }
Kojto 122:f9eeca106725 2057
Kojto 122:f9eeca106725 2058 /**
Kojto 122:f9eeca106725 2059 * @brief Enable LIN mode
Kojto 122:f9eeca106725 2060 * @note Macro @ref IS_UART_LIN_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 2061 * LIN feature is supported by the USARTx instance.
Kojto 122:f9eeca106725 2062 * @rmtoll CR2 LINEN LL_USART_EnableLIN
Kojto 122:f9eeca106725 2063 * @param USARTx USART Instance
Kojto 122:f9eeca106725 2064 * @retval None
Kojto 122:f9eeca106725 2065 */
Kojto 122:f9eeca106725 2066 __STATIC_INLINE void LL_USART_EnableLIN(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 2067 {
Kojto 122:f9eeca106725 2068 SET_BIT(USARTx->CR2, USART_CR2_LINEN);
Kojto 122:f9eeca106725 2069 }
Kojto 122:f9eeca106725 2070
Kojto 122:f9eeca106725 2071 /**
Kojto 122:f9eeca106725 2072 * @brief Disable LIN mode
Kojto 122:f9eeca106725 2073 * @note Macro @ref IS_UART_LIN_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 2074 * LIN feature is supported by the USARTx instance.
Kojto 122:f9eeca106725 2075 * @rmtoll CR2 LINEN LL_USART_DisableLIN
Kojto 122:f9eeca106725 2076 * @param USARTx USART Instance
Kojto 122:f9eeca106725 2077 * @retval None
Kojto 122:f9eeca106725 2078 */
Kojto 122:f9eeca106725 2079 __STATIC_INLINE void LL_USART_DisableLIN(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 2080 {
Kojto 122:f9eeca106725 2081 CLEAR_BIT(USARTx->CR2, USART_CR2_LINEN);
Kojto 122:f9eeca106725 2082 }
Kojto 122:f9eeca106725 2083
Kojto 122:f9eeca106725 2084 /**
Kojto 122:f9eeca106725 2085 * @brief Indicate if LIN mode is enabled
Kojto 122:f9eeca106725 2086 * @note Macro @ref IS_UART_LIN_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 2087 * LIN feature is supported by the USARTx instance.
Kojto 122:f9eeca106725 2088 * @rmtoll CR2 LINEN LL_USART_IsEnabledLIN
Kojto 122:f9eeca106725 2089 * @param USARTx USART Instance
Kojto 122:f9eeca106725 2090 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 2091 */
Kojto 122:f9eeca106725 2092 __STATIC_INLINE uint32_t LL_USART_IsEnabledLIN(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 2093 {
Kojto 122:f9eeca106725 2094 return (READ_BIT(USARTx->CR2, USART_CR2_LINEN) == (USART_CR2_LINEN));
Kojto 122:f9eeca106725 2095 }
Kojto 122:f9eeca106725 2096
Kojto 122:f9eeca106725 2097 /**
Kojto 122:f9eeca106725 2098 * @}
Kojto 122:f9eeca106725 2099 */
Kojto 122:f9eeca106725 2100
Kojto 122:f9eeca106725 2101 /** @defgroup USART_LL_EF_Configuration_DE Configuration functions related to Driver Enable feature
Kojto 122:f9eeca106725 2102 * @{
Kojto 122:f9eeca106725 2103 */
Kojto 122:f9eeca106725 2104
Kojto 122:f9eeca106725 2105 /**
Kojto 122:f9eeca106725 2106 * @brief Set DEDT (Driver Enable De-Assertion Time), Time value expressed on 5 bits ([4:0] bits).
Kojto 122:f9eeca106725 2107 * @note Macro @ref IS_UART_DRIVER_ENABLE_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 2108 * Driver Enable feature is supported by the USARTx instance.
Kojto 122:f9eeca106725 2109 * @rmtoll CR1 DEDT LL_USART_SetDEDeassertionTime
Kojto 122:f9eeca106725 2110 * @param USARTx USART Instance
Kojto 122:f9eeca106725 2111 * @param Time Value between Min_Data=0 and Max_Data=31
Kojto 122:f9eeca106725 2112 * @retval None
Kojto 122:f9eeca106725 2113 */
Kojto 122:f9eeca106725 2114 __STATIC_INLINE void LL_USART_SetDEDeassertionTime(USART_TypeDef *USARTx, uint32_t Time)
Kojto 122:f9eeca106725 2115 {
AnnaBridge 145:64910690c574 2116 MODIFY_REG(USARTx->CR1, USART_CR1_DEDT, Time << USART_CR1_DEDT_Pos);
Kojto 122:f9eeca106725 2117 }
Kojto 122:f9eeca106725 2118
Kojto 122:f9eeca106725 2119 /**
Kojto 122:f9eeca106725 2120 * @brief Return DEDT (Driver Enable De-Assertion Time)
Kojto 122:f9eeca106725 2121 * @note Macro @ref IS_UART_DRIVER_ENABLE_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 2122 * Driver Enable feature is supported by the USARTx instance.
Kojto 122:f9eeca106725 2123 * @rmtoll CR1 DEDT LL_USART_GetDEDeassertionTime
Kojto 122:f9eeca106725 2124 * @param USARTx USART Instance
Kojto 122:f9eeca106725 2125 * @retval Time value expressed on 5 bits ([4:0] bits) : Value between Min_Data=0 and Max_Data=31
Kojto 122:f9eeca106725 2126 */
Kojto 122:f9eeca106725 2127 __STATIC_INLINE uint32_t LL_USART_GetDEDeassertionTime(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 2128 {
AnnaBridge 145:64910690c574 2129 return (uint32_t)(READ_BIT(USARTx->CR1, USART_CR1_DEDT) >> USART_CR1_DEDT_Pos);
Kojto 122:f9eeca106725 2130 }
Kojto 122:f9eeca106725 2131
Kojto 122:f9eeca106725 2132 /**
Kojto 122:f9eeca106725 2133 * @brief Set DEAT (Driver Enable Assertion Time), Time value expressed on 5 bits ([4:0] bits).
Kojto 122:f9eeca106725 2134 * @note Macro @ref IS_UART_DRIVER_ENABLE_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 2135 * Driver Enable feature is supported by the USARTx instance.
Kojto 122:f9eeca106725 2136 * @rmtoll CR1 DEAT LL_USART_SetDEAssertionTime
Kojto 122:f9eeca106725 2137 * @param USARTx USART Instance
Kojto 122:f9eeca106725 2138 * @param Time Value between Min_Data=0 and Max_Data=31
Kojto 122:f9eeca106725 2139 * @retval None
Kojto 122:f9eeca106725 2140 */
Kojto 122:f9eeca106725 2141 __STATIC_INLINE void LL_USART_SetDEAssertionTime(USART_TypeDef *USARTx, uint32_t Time)
Kojto 122:f9eeca106725 2142 {
AnnaBridge 145:64910690c574 2143 MODIFY_REG(USARTx->CR1, USART_CR1_DEAT, Time << USART_CR1_DEAT_Pos);
Kojto 122:f9eeca106725 2144 }
Kojto 122:f9eeca106725 2145
Kojto 122:f9eeca106725 2146 /**
Kojto 122:f9eeca106725 2147 * @brief Return DEAT (Driver Enable Assertion Time)
Kojto 122:f9eeca106725 2148 * @note Macro @ref IS_UART_DRIVER_ENABLE_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 2149 * Driver Enable feature is supported by the USARTx instance.
Kojto 122:f9eeca106725 2150 * @rmtoll CR1 DEAT LL_USART_GetDEAssertionTime
Kojto 122:f9eeca106725 2151 * @param USARTx USART Instance
Kojto 122:f9eeca106725 2152 * @retval Time value expressed on 5 bits ([4:0] bits) : Value between Min_Data=0 and Max_Data=31
Kojto 122:f9eeca106725 2153 */
Kojto 122:f9eeca106725 2154 __STATIC_INLINE uint32_t LL_USART_GetDEAssertionTime(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 2155 {
AnnaBridge 145:64910690c574 2156 return (uint32_t)(READ_BIT(USARTx->CR1, USART_CR1_DEAT) >> USART_CR1_DEAT_Pos);
Kojto 122:f9eeca106725 2157 }
Kojto 122:f9eeca106725 2158
Kojto 122:f9eeca106725 2159 /**
Kojto 122:f9eeca106725 2160 * @brief Enable Driver Enable (DE) Mode
Kojto 122:f9eeca106725 2161 * @note Macro @ref IS_UART_DRIVER_ENABLE_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 2162 * Driver Enable feature is supported by the USARTx instance.
Kojto 122:f9eeca106725 2163 * @rmtoll CR3 DEM LL_USART_EnableDEMode
Kojto 122:f9eeca106725 2164 * @param USARTx USART Instance
Kojto 122:f9eeca106725 2165 * @retval None
Kojto 122:f9eeca106725 2166 */
Kojto 122:f9eeca106725 2167 __STATIC_INLINE void LL_USART_EnableDEMode(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 2168 {
Kojto 122:f9eeca106725 2169 SET_BIT(USARTx->CR3, USART_CR3_DEM);
Kojto 122:f9eeca106725 2170 }
Kojto 122:f9eeca106725 2171
Kojto 122:f9eeca106725 2172 /**
Kojto 122:f9eeca106725 2173 * @brief Disable Driver Enable (DE) Mode
Kojto 122:f9eeca106725 2174 * @note Macro @ref IS_UART_DRIVER_ENABLE_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 2175 * Driver Enable feature is supported by the USARTx instance.
Kojto 122:f9eeca106725 2176 * @rmtoll CR3 DEM LL_USART_DisableDEMode
Kojto 122:f9eeca106725 2177 * @param USARTx USART Instance
Kojto 122:f9eeca106725 2178 * @retval None
Kojto 122:f9eeca106725 2179 */
Kojto 122:f9eeca106725 2180 __STATIC_INLINE void LL_USART_DisableDEMode(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 2181 {
Kojto 122:f9eeca106725 2182 CLEAR_BIT(USARTx->CR3, USART_CR3_DEM);
Kojto 122:f9eeca106725 2183 }
Kojto 122:f9eeca106725 2184
Kojto 122:f9eeca106725 2185 /**
Kojto 122:f9eeca106725 2186 * @brief Indicate if Driver Enable (DE) Mode is enabled
Kojto 122:f9eeca106725 2187 * @note Macro @ref IS_UART_DRIVER_ENABLE_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 2188 * Driver Enable feature is supported by the USARTx instance.
Kojto 122:f9eeca106725 2189 * @rmtoll CR3 DEM LL_USART_IsEnabledDEMode
Kojto 122:f9eeca106725 2190 * @param USARTx USART Instance
Kojto 122:f9eeca106725 2191 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 2192 */
Kojto 122:f9eeca106725 2193 __STATIC_INLINE uint32_t LL_USART_IsEnabledDEMode(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 2194 {
Kojto 122:f9eeca106725 2195 return (READ_BIT(USARTx->CR3, USART_CR3_DEM) == (USART_CR3_DEM));
Kojto 122:f9eeca106725 2196 }
Kojto 122:f9eeca106725 2197
Kojto 122:f9eeca106725 2198 /**
Kojto 122:f9eeca106725 2199 * @brief Select Driver Enable Polarity
Kojto 122:f9eeca106725 2200 * @note Macro @ref IS_UART_DRIVER_ENABLE_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 2201 * Driver Enable feature is supported by the USARTx instance.
Kojto 122:f9eeca106725 2202 * @rmtoll CR3 DEP LL_USART_SetDESignalPolarity
Kojto 122:f9eeca106725 2203 * @param USARTx USART Instance
Kojto 122:f9eeca106725 2204 * @param Polarity This parameter can be one of the following values:
Kojto 122:f9eeca106725 2205 * @arg @ref LL_USART_DE_POLARITY_HIGH
Kojto 122:f9eeca106725 2206 * @arg @ref LL_USART_DE_POLARITY_LOW
Kojto 122:f9eeca106725 2207 * @retval None
Kojto 122:f9eeca106725 2208 */
Kojto 122:f9eeca106725 2209 __STATIC_INLINE void LL_USART_SetDESignalPolarity(USART_TypeDef *USARTx, uint32_t Polarity)
Kojto 122:f9eeca106725 2210 {
Kojto 122:f9eeca106725 2211 MODIFY_REG(USARTx->CR3, USART_CR3_DEP, Polarity);
Kojto 122:f9eeca106725 2212 }
Kojto 122:f9eeca106725 2213
Kojto 122:f9eeca106725 2214 /**
Kojto 122:f9eeca106725 2215 * @brief Return Driver Enable Polarity
Kojto 122:f9eeca106725 2216 * @note Macro @ref IS_UART_DRIVER_ENABLE_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 2217 * Driver Enable feature is supported by the USARTx instance.
Kojto 122:f9eeca106725 2218 * @rmtoll CR3 DEP LL_USART_GetDESignalPolarity
Kojto 122:f9eeca106725 2219 * @param USARTx USART Instance
Kojto 122:f9eeca106725 2220 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 2221 * @arg @ref LL_USART_DE_POLARITY_HIGH
Kojto 122:f9eeca106725 2222 * @arg @ref LL_USART_DE_POLARITY_LOW
Kojto 122:f9eeca106725 2223 */
Kojto 122:f9eeca106725 2224 __STATIC_INLINE uint32_t LL_USART_GetDESignalPolarity(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 2225 {
Kojto 122:f9eeca106725 2226 return (uint32_t)(READ_BIT(USARTx->CR3, USART_CR3_DEP));
Kojto 122:f9eeca106725 2227 }
Kojto 122:f9eeca106725 2228
Kojto 122:f9eeca106725 2229 /**
Kojto 122:f9eeca106725 2230 * @}
Kojto 122:f9eeca106725 2231 */
Kojto 122:f9eeca106725 2232
Kojto 122:f9eeca106725 2233 /** @defgroup USART_LL_EF_AdvancedConfiguration Advanced Configurations services
Kojto 122:f9eeca106725 2234 * @{
Kojto 122:f9eeca106725 2235 */
Kojto 122:f9eeca106725 2236
Kojto 122:f9eeca106725 2237 /**
Kojto 122:f9eeca106725 2238 * @brief Perform basic configuration of USART for enabling use in Asynchronous Mode (UART)
Kojto 122:f9eeca106725 2239 * @note In UART mode, the following bits must be kept cleared:
Kojto 122:f9eeca106725 2240 * - LINEN bit in the USART_CR2 register,
Kojto 122:f9eeca106725 2241 * - CLKEN bit in the USART_CR2 register,
Kojto 122:f9eeca106725 2242 * - SCEN bit in the USART_CR3 register,
Kojto 122:f9eeca106725 2243 * - IREN bit in the USART_CR3 register,
Kojto 122:f9eeca106725 2244 * - HDSEL bit in the USART_CR3 register.
Kojto 122:f9eeca106725 2245 * @note Call of this function is equivalent to following function call sequence :
Kojto 122:f9eeca106725 2246 * - Clear LINEN in CR2 using @ref LL_USART_DisableLIN() function
Kojto 122:f9eeca106725 2247 * - Clear CLKEN in CR2 using @ref LL_USART_DisableSCLKOutput() function
Kojto 122:f9eeca106725 2248 * - Clear SCEN in CR3 using @ref LL_USART_DisableSmartcard() function
Kojto 122:f9eeca106725 2249 * - Clear IREN in CR3 using @ref LL_USART_DisableIrda() function
Kojto 122:f9eeca106725 2250 * - Clear HDSEL in CR3 using @ref LL_USART_DisableHalfDuplex() function
Kojto 122:f9eeca106725 2251 * @note Other remaining configurations items related to Asynchronous Mode
Kojto 122:f9eeca106725 2252 * (as Baud Rate, Word length, Parity, ...) should be set using
Kojto 122:f9eeca106725 2253 * dedicated functions
Kojto 122:f9eeca106725 2254 * @rmtoll CR2 LINEN LL_USART_ConfigAsyncMode\n
Kojto 122:f9eeca106725 2255 * CR2 CLKEN LL_USART_ConfigAsyncMode\n
Kojto 122:f9eeca106725 2256 * CR3 SCEN LL_USART_ConfigAsyncMode\n
Kojto 122:f9eeca106725 2257 * CR3 IREN LL_USART_ConfigAsyncMode\n
Kojto 122:f9eeca106725 2258 * CR3 HDSEL LL_USART_ConfigAsyncMode
Kojto 122:f9eeca106725 2259 * @param USARTx USART Instance
Kojto 122:f9eeca106725 2260 * @retval None
Kojto 122:f9eeca106725 2261 */
Kojto 122:f9eeca106725 2262 __STATIC_INLINE void LL_USART_ConfigAsyncMode(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 2263 {
Kojto 122:f9eeca106725 2264 /* In Asynchronous mode, the following bits must be kept cleared:
Kojto 122:f9eeca106725 2265 - LINEN, CLKEN bits in the USART_CR2 register,
Kojto 122:f9eeca106725 2266 - SCEN, IREN and HDSEL bits in the USART_CR3 register.*/
Kojto 122:f9eeca106725 2267 CLEAR_BIT(USARTx->CR2, (USART_CR2_LINEN | USART_CR2_CLKEN));
Kojto 122:f9eeca106725 2268 CLEAR_BIT(USARTx->CR3, (USART_CR3_SCEN | USART_CR3_IREN | USART_CR3_HDSEL));
Kojto 122:f9eeca106725 2269 }
Kojto 122:f9eeca106725 2270
Kojto 122:f9eeca106725 2271 /**
Kojto 122:f9eeca106725 2272 * @brief Perform basic configuration of USART for enabling use in Synchronous Mode
Kojto 122:f9eeca106725 2273 * @note In Synchronous mode, the following bits must be kept cleared:
Kojto 122:f9eeca106725 2274 * - LINEN bit in the USART_CR2 register,
Kojto 122:f9eeca106725 2275 * - SCEN bit in the USART_CR3 register,
Kojto 122:f9eeca106725 2276 * - IREN bit in the USART_CR3 register,
Kojto 122:f9eeca106725 2277 * - HDSEL bit in the USART_CR3 register.
Kojto 122:f9eeca106725 2278 * This function also sets the USART in Synchronous mode.
Kojto 122:f9eeca106725 2279 * @note Macro @ref IS_USART_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 2280 * Synchronous mode is supported by the USARTx instance.
Kojto 122:f9eeca106725 2281 * @note Call of this function is equivalent to following function call sequence :
Kojto 122:f9eeca106725 2282 * - Clear LINEN in CR2 using @ref LL_USART_DisableLIN() function
Kojto 122:f9eeca106725 2283 * - Clear IREN in CR3 using @ref LL_USART_DisableIrda() function
Kojto 122:f9eeca106725 2284 * - Clear SCEN in CR3 using @ref LL_USART_DisableSmartcard() function
Kojto 122:f9eeca106725 2285 * - Clear HDSEL in CR3 using @ref LL_USART_DisableHalfDuplex() function
Kojto 122:f9eeca106725 2286 * - Set CLKEN in CR2 using @ref LL_USART_EnableSCLKOutput() function
Kojto 122:f9eeca106725 2287 * @note Other remaining configurations items related to Synchronous Mode
Kojto 122:f9eeca106725 2288 * (as Baud Rate, Word length, Parity, Clock Polarity, ...) should be set using
Kojto 122:f9eeca106725 2289 * dedicated functions
Kojto 122:f9eeca106725 2290 * @rmtoll CR2 LINEN LL_USART_ConfigSyncMode\n
Kojto 122:f9eeca106725 2291 * CR2 CLKEN LL_USART_ConfigSyncMode\n
Kojto 122:f9eeca106725 2292 * CR3 SCEN LL_USART_ConfigSyncMode\n
Kojto 122:f9eeca106725 2293 * CR3 IREN LL_USART_ConfigSyncMode\n
Kojto 122:f9eeca106725 2294 * CR3 HDSEL LL_USART_ConfigSyncMode
Kojto 122:f9eeca106725 2295 * @param USARTx USART Instance
Kojto 122:f9eeca106725 2296 * @retval None
Kojto 122:f9eeca106725 2297 */
Kojto 122:f9eeca106725 2298 __STATIC_INLINE void LL_USART_ConfigSyncMode(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 2299 {
Kojto 122:f9eeca106725 2300 /* In Synchronous mode, the following bits must be kept cleared:
Kojto 122:f9eeca106725 2301 - LINEN bit in the USART_CR2 register,
Kojto 122:f9eeca106725 2302 - SCEN, IREN and HDSEL bits in the USART_CR3 register.*/
Kojto 122:f9eeca106725 2303 CLEAR_BIT(USARTx->CR2, (USART_CR2_LINEN));
Kojto 122:f9eeca106725 2304 CLEAR_BIT(USARTx->CR3, (USART_CR3_SCEN | USART_CR3_IREN | USART_CR3_HDSEL));
Kojto 122:f9eeca106725 2305 /* set the UART/USART in Synchronous mode */
Kojto 122:f9eeca106725 2306 SET_BIT(USARTx->CR2, USART_CR2_CLKEN);
Kojto 122:f9eeca106725 2307 }
Kojto 122:f9eeca106725 2308
Kojto 122:f9eeca106725 2309 /**
Kojto 122:f9eeca106725 2310 * @brief Perform basic configuration of USART for enabling use in LIN Mode
Kojto 122:f9eeca106725 2311 * @note In LIN mode, the following bits must be kept cleared:
Kojto 122:f9eeca106725 2312 * - STOP and CLKEN bits in the USART_CR2 register,
Kojto 122:f9eeca106725 2313 * - SCEN bit in the USART_CR3 register,
Kojto 122:f9eeca106725 2314 * - IREN bit in the USART_CR3 register,
Kojto 122:f9eeca106725 2315 * - HDSEL bit in the USART_CR3 register.
Kojto 122:f9eeca106725 2316 * This function also set the UART/USART in LIN mode.
Kojto 122:f9eeca106725 2317 * @note Macro @ref IS_UART_LIN_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 2318 * LIN feature is supported by the USARTx instance.
Kojto 122:f9eeca106725 2319 * @note Call of this function is equivalent to following function call sequence :
Kojto 122:f9eeca106725 2320 * - Clear CLKEN in CR2 using @ref LL_USART_DisableSCLKOutput() function
Kojto 122:f9eeca106725 2321 * - Clear STOP in CR2 using @ref LL_USART_SetStopBitsLength() function
Kojto 122:f9eeca106725 2322 * - Clear SCEN in CR3 using @ref LL_USART_DisableSmartcard() function
Kojto 122:f9eeca106725 2323 * - Clear IREN in CR3 using @ref LL_USART_DisableIrda() function
Kojto 122:f9eeca106725 2324 * - Clear HDSEL in CR3 using @ref LL_USART_DisableHalfDuplex() function
Kojto 122:f9eeca106725 2325 * - Set LINEN in CR2 using @ref LL_USART_EnableLIN() function
Kojto 122:f9eeca106725 2326 * @note Other remaining configurations items related to LIN Mode
Kojto 122:f9eeca106725 2327 * (as Baud Rate, Word length, LIN Break Detection Length, ...) should be set using
Kojto 122:f9eeca106725 2328 * dedicated functions
Kojto 122:f9eeca106725 2329 * @rmtoll CR2 CLKEN LL_USART_ConfigLINMode\n
Kojto 122:f9eeca106725 2330 * CR2 STOP LL_USART_ConfigLINMode\n
Kojto 122:f9eeca106725 2331 * CR2 LINEN LL_USART_ConfigLINMode\n
Kojto 122:f9eeca106725 2332 * CR3 IREN LL_USART_ConfigLINMode\n
Kojto 122:f9eeca106725 2333 * CR3 SCEN LL_USART_ConfigLINMode\n
Kojto 122:f9eeca106725 2334 * CR3 HDSEL LL_USART_ConfigLINMode
Kojto 122:f9eeca106725 2335 * @param USARTx USART Instance
Kojto 122:f9eeca106725 2336 * @retval None
Kojto 122:f9eeca106725 2337 */
Kojto 122:f9eeca106725 2338 __STATIC_INLINE void LL_USART_ConfigLINMode(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 2339 {
Kojto 122:f9eeca106725 2340 /* In LIN mode, the following bits must be kept cleared:
Kojto 122:f9eeca106725 2341 - STOP and CLKEN bits in the USART_CR2 register,
Kojto 122:f9eeca106725 2342 - IREN, SCEN and HDSEL bits in the USART_CR3 register.*/
Kojto 122:f9eeca106725 2343 CLEAR_BIT(USARTx->CR2, (USART_CR2_CLKEN | USART_CR2_STOP));
Kojto 122:f9eeca106725 2344 CLEAR_BIT(USARTx->CR3, (USART_CR3_IREN | USART_CR3_SCEN | USART_CR3_HDSEL));
Kojto 122:f9eeca106725 2345 /* Set the UART/USART in LIN mode */
Kojto 122:f9eeca106725 2346 SET_BIT(USARTx->CR2, USART_CR2_LINEN);
Kojto 122:f9eeca106725 2347 }
Kojto 122:f9eeca106725 2348
Kojto 122:f9eeca106725 2349 /**
Kojto 122:f9eeca106725 2350 * @brief Perform basic configuration of USART for enabling use in Half Duplex Mode
Kojto 122:f9eeca106725 2351 * @note In Half Duplex mode, the following bits must be kept cleared:
Kojto 122:f9eeca106725 2352 * - LINEN bit in the USART_CR2 register,
Kojto 122:f9eeca106725 2353 * - CLKEN bit in the USART_CR2 register,
Kojto 122:f9eeca106725 2354 * - SCEN bit in the USART_CR3 register,
Kojto 122:f9eeca106725 2355 * - IREN bit in the USART_CR3 register,
Kojto 122:f9eeca106725 2356 * This function also sets the UART/USART in Half Duplex mode.
Kojto 122:f9eeca106725 2357 * @note Macro @ref IS_UART_HALFDUPLEX_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 2358 * Half-Duplex mode is supported by the USARTx instance.
Kojto 122:f9eeca106725 2359 * @note Call of this function is equivalent to following function call sequence :
Kojto 122:f9eeca106725 2360 * - Clear LINEN in CR2 using @ref LL_USART_DisableLIN() function
Kojto 122:f9eeca106725 2361 * - Clear CLKEN in CR2 using @ref LL_USART_DisableSCLKOutput() function
Kojto 122:f9eeca106725 2362 * - Clear SCEN in CR3 using @ref LL_USART_DisableSmartcard() function
Kojto 122:f9eeca106725 2363 * - Clear IREN in CR3 using @ref LL_USART_DisableIrda() function
Kojto 122:f9eeca106725 2364 * - Set HDSEL in CR3 using @ref LL_USART_EnableHalfDuplex() function
Kojto 122:f9eeca106725 2365 * @note Other remaining configurations items related to Half Duplex Mode
Kojto 122:f9eeca106725 2366 * (as Baud Rate, Word length, Parity, ...) should be set using
Kojto 122:f9eeca106725 2367 * dedicated functions
Kojto 122:f9eeca106725 2368 * @rmtoll CR2 LINEN LL_USART_ConfigHalfDuplexMode\n
Kojto 122:f9eeca106725 2369 * CR2 CLKEN LL_USART_ConfigHalfDuplexMode\n
Kojto 122:f9eeca106725 2370 * CR3 HDSEL LL_USART_ConfigHalfDuplexMode\n
Kojto 122:f9eeca106725 2371 * CR3 SCEN LL_USART_ConfigHalfDuplexMode\n
Kojto 122:f9eeca106725 2372 * CR3 IREN LL_USART_ConfigHalfDuplexMode
Kojto 122:f9eeca106725 2373 * @param USARTx USART Instance
Kojto 122:f9eeca106725 2374 * @retval None
Kojto 122:f9eeca106725 2375 */
Kojto 122:f9eeca106725 2376 __STATIC_INLINE void LL_USART_ConfigHalfDuplexMode(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 2377 {
Kojto 122:f9eeca106725 2378 /* In Half Duplex mode, the following bits must be kept cleared:
Kojto 122:f9eeca106725 2379 - LINEN and CLKEN bits in the USART_CR2 register,
Kojto 122:f9eeca106725 2380 - SCEN and IREN bits in the USART_CR3 register.*/
Kojto 122:f9eeca106725 2381 CLEAR_BIT(USARTx->CR2, (USART_CR2_LINEN | USART_CR2_CLKEN));
Kojto 122:f9eeca106725 2382 CLEAR_BIT(USARTx->CR3, (USART_CR3_SCEN | USART_CR3_IREN));
Kojto 122:f9eeca106725 2383 /* set the UART/USART in Half Duplex mode */
Kojto 122:f9eeca106725 2384 SET_BIT(USARTx->CR3, USART_CR3_HDSEL);
Kojto 122:f9eeca106725 2385 }
Kojto 122:f9eeca106725 2386
Kojto 122:f9eeca106725 2387 /**
Kojto 122:f9eeca106725 2388 * @brief Perform basic configuration of USART for enabling use in Smartcard Mode
Kojto 122:f9eeca106725 2389 * @note In Smartcard mode, the following bits must be kept cleared:
Kojto 122:f9eeca106725 2390 * - LINEN bit in the USART_CR2 register,
Kojto 122:f9eeca106725 2391 * - IREN bit in the USART_CR3 register,
Kojto 122:f9eeca106725 2392 * - HDSEL bit in the USART_CR3 register.
Kojto 122:f9eeca106725 2393 * This function also configures Stop bits to 1.5 bits and
Kojto 122:f9eeca106725 2394 * sets the USART in Smartcard mode (SCEN bit).
Kojto 122:f9eeca106725 2395 * Clock Output is also enabled (CLKEN).
Kojto 122:f9eeca106725 2396 * @note Macro @ref IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 2397 * Smartcard feature is supported by the USARTx instance.
Kojto 122:f9eeca106725 2398 * @note Call of this function is equivalent to following function call sequence :
Kojto 122:f9eeca106725 2399 * - Clear LINEN in CR2 using @ref LL_USART_DisableLIN() function
Kojto 122:f9eeca106725 2400 * - Clear IREN in CR3 using @ref LL_USART_DisableIrda() function
Kojto 122:f9eeca106725 2401 * - Clear HDSEL in CR3 using @ref LL_USART_DisableHalfDuplex() function
Kojto 122:f9eeca106725 2402 * - Configure STOP in CR2 using @ref LL_USART_SetStopBitsLength() function
Kojto 122:f9eeca106725 2403 * - Set CLKEN in CR2 using @ref LL_USART_EnableSCLKOutput() function
Kojto 122:f9eeca106725 2404 * - Set SCEN in CR3 using @ref LL_USART_EnableSmartcard() function
Kojto 122:f9eeca106725 2405 * @note Other remaining configurations items related to Smartcard Mode
Kojto 122:f9eeca106725 2406 * (as Baud Rate, Word length, Parity, ...) should be set using
Kojto 122:f9eeca106725 2407 * dedicated functions
Kojto 122:f9eeca106725 2408 * @rmtoll CR2 LINEN LL_USART_ConfigSmartcardMode\n
Kojto 122:f9eeca106725 2409 * CR2 STOP LL_USART_ConfigSmartcardMode\n
Kojto 122:f9eeca106725 2410 * CR2 CLKEN LL_USART_ConfigSmartcardMode\n
Kojto 122:f9eeca106725 2411 * CR3 HDSEL LL_USART_ConfigSmartcardMode\n
Kojto 122:f9eeca106725 2412 * CR3 SCEN LL_USART_ConfigSmartcardMode
Kojto 122:f9eeca106725 2413 * @param USARTx USART Instance
Kojto 122:f9eeca106725 2414 * @retval None
Kojto 122:f9eeca106725 2415 */
Kojto 122:f9eeca106725 2416 __STATIC_INLINE void LL_USART_ConfigSmartcardMode(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 2417 {
Kojto 122:f9eeca106725 2418 /* In Smartcard mode, the following bits must be kept cleared:
Kojto 122:f9eeca106725 2419 - LINEN bit in the USART_CR2 register,
Kojto 122:f9eeca106725 2420 - IREN and HDSEL bits in the USART_CR3 register.*/
Kojto 122:f9eeca106725 2421 CLEAR_BIT(USARTx->CR2, (USART_CR2_LINEN));
Kojto 122:f9eeca106725 2422 CLEAR_BIT(USARTx->CR3, (USART_CR3_IREN | USART_CR3_HDSEL));
Kojto 122:f9eeca106725 2423 /* Configure Stop bits to 1.5 bits */
Kojto 122:f9eeca106725 2424 /* Synchronous mode is activated by default */
Kojto 122:f9eeca106725 2425 SET_BIT(USARTx->CR2, (USART_CR2_STOP_0 | USART_CR2_STOP_1 | USART_CR2_CLKEN));
Kojto 122:f9eeca106725 2426 /* set the UART/USART in Smartcard mode */
Kojto 122:f9eeca106725 2427 SET_BIT(USARTx->CR3, USART_CR3_SCEN);
Kojto 122:f9eeca106725 2428 }
Kojto 122:f9eeca106725 2429
Kojto 122:f9eeca106725 2430 /**
Kojto 122:f9eeca106725 2431 * @brief Perform basic configuration of USART for enabling use in Irda Mode
Kojto 122:f9eeca106725 2432 * @note In IRDA mode, the following bits must be kept cleared:
Kojto 122:f9eeca106725 2433 * - LINEN bit in the USART_CR2 register,
Kojto 122:f9eeca106725 2434 * - STOP and CLKEN bits in the USART_CR2 register,
Kojto 122:f9eeca106725 2435 * - SCEN bit in the USART_CR3 register,
Kojto 122:f9eeca106725 2436 * - HDSEL bit in the USART_CR3 register.
Kojto 122:f9eeca106725 2437 * This function also sets the UART/USART in IRDA mode (IREN bit).
Kojto 122:f9eeca106725 2438 * @note Macro @ref IS_IRDA_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 2439 * IrDA feature is supported by the USARTx instance.
Kojto 122:f9eeca106725 2440 * @note Call of this function is equivalent to following function call sequence :
Kojto 122:f9eeca106725 2441 * - Clear LINEN in CR2 using @ref LL_USART_DisableLIN() function
Kojto 122:f9eeca106725 2442 * - Clear CLKEN in CR2 using @ref LL_USART_DisableSCLKOutput() function
Kojto 122:f9eeca106725 2443 * - Clear SCEN in CR3 using @ref LL_USART_DisableSmartcard() function
Kojto 122:f9eeca106725 2444 * - Clear HDSEL in CR3 using @ref LL_USART_DisableHalfDuplex() function
Kojto 122:f9eeca106725 2445 * - Configure STOP in CR2 using @ref LL_USART_SetStopBitsLength() function
Kojto 122:f9eeca106725 2446 * - Set IREN in CR3 using @ref LL_USART_EnableIrda() function
Kojto 122:f9eeca106725 2447 * @note Other remaining configurations items related to Irda Mode
Kojto 122:f9eeca106725 2448 * (as Baud Rate, Word length, Power mode, ...) should be set using
Kojto 122:f9eeca106725 2449 * dedicated functions
Kojto 122:f9eeca106725 2450 * @rmtoll CR2 LINEN LL_USART_ConfigIrdaMode\n
Kojto 122:f9eeca106725 2451 * CR2 CLKEN LL_USART_ConfigIrdaMode\n
Kojto 122:f9eeca106725 2452 * CR2 STOP LL_USART_ConfigIrdaMode\n
Kojto 122:f9eeca106725 2453 * CR3 SCEN LL_USART_ConfigIrdaMode\n
Kojto 122:f9eeca106725 2454 * CR3 HDSEL LL_USART_ConfigIrdaMode\n
Kojto 122:f9eeca106725 2455 * CR3 IREN LL_USART_ConfigIrdaMode
Kojto 122:f9eeca106725 2456 * @param USARTx USART Instance
Kojto 122:f9eeca106725 2457 * @retval None
Kojto 122:f9eeca106725 2458 */
Kojto 122:f9eeca106725 2459 __STATIC_INLINE void LL_USART_ConfigIrdaMode(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 2460 {
Kojto 122:f9eeca106725 2461 /* In IRDA mode, the following bits must be kept cleared:
Kojto 122:f9eeca106725 2462 - LINEN, STOP and CLKEN bits in the USART_CR2 register,
Kojto 122:f9eeca106725 2463 - SCEN and HDSEL bits in the USART_CR3 register.*/
Kojto 122:f9eeca106725 2464 CLEAR_BIT(USARTx->CR2, (USART_CR2_LINEN | USART_CR2_CLKEN | USART_CR2_STOP));
Kojto 122:f9eeca106725 2465 CLEAR_BIT(USARTx->CR3, (USART_CR3_SCEN | USART_CR3_HDSEL));
Kojto 122:f9eeca106725 2466 /* set the UART/USART in IRDA mode */
Kojto 122:f9eeca106725 2467 SET_BIT(USARTx->CR3, USART_CR3_IREN);
Kojto 122:f9eeca106725 2468 }
Kojto 122:f9eeca106725 2469
Kojto 122:f9eeca106725 2470 /**
Kojto 122:f9eeca106725 2471 * @brief Perform basic configuration of USART for enabling use in Multi processor Mode
Kojto 122:f9eeca106725 2472 * (several USARTs connected in a network, one of the USARTs can be the master,
Kojto 122:f9eeca106725 2473 * its TX output connected to the RX inputs of the other slaves USARTs).
Kojto 122:f9eeca106725 2474 * @note In MultiProcessor mode, the following bits must be kept cleared:
Kojto 122:f9eeca106725 2475 * - LINEN bit in the USART_CR2 register,
Kojto 122:f9eeca106725 2476 * - CLKEN bit in the USART_CR2 register,
Kojto 122:f9eeca106725 2477 * - SCEN bit in the USART_CR3 register,
Kojto 122:f9eeca106725 2478 * - IREN bit in the USART_CR3 register,
Kojto 122:f9eeca106725 2479 * - HDSEL bit in the USART_CR3 register.
Kojto 122:f9eeca106725 2480 * @note Call of this function is equivalent to following function call sequence :
Kojto 122:f9eeca106725 2481 * - Clear LINEN in CR2 using @ref LL_USART_DisableLIN() function
Kojto 122:f9eeca106725 2482 * - Clear CLKEN in CR2 using @ref LL_USART_DisableSCLKOutput() function
Kojto 122:f9eeca106725 2483 * - Clear SCEN in CR3 using @ref LL_USART_DisableSmartcard() function
Kojto 122:f9eeca106725 2484 * - Clear IREN in CR3 using @ref LL_USART_DisableIrda() function
Kojto 122:f9eeca106725 2485 * - Clear HDSEL in CR3 using @ref LL_USART_DisableHalfDuplex() function
Kojto 122:f9eeca106725 2486 * @note Other remaining configurations items related to Multi processor Mode
Kojto 122:f9eeca106725 2487 * (as Baud Rate, Wake Up Method, Node address, ...) should be set using
Kojto 122:f9eeca106725 2488 * dedicated functions
Kojto 122:f9eeca106725 2489 * @rmtoll CR2 LINEN LL_USART_ConfigMultiProcessMode\n
Kojto 122:f9eeca106725 2490 * CR2 CLKEN LL_USART_ConfigMultiProcessMode\n
Kojto 122:f9eeca106725 2491 * CR3 SCEN LL_USART_ConfigMultiProcessMode\n
Kojto 122:f9eeca106725 2492 * CR3 HDSEL LL_USART_ConfigMultiProcessMode\n
Kojto 122:f9eeca106725 2493 * CR3 IREN LL_USART_ConfigMultiProcessMode
Kojto 122:f9eeca106725 2494 * @param USARTx USART Instance
Kojto 122:f9eeca106725 2495 * @retval None
Kojto 122:f9eeca106725 2496 */
Kojto 122:f9eeca106725 2497 __STATIC_INLINE void LL_USART_ConfigMultiProcessMode(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 2498 {
Kojto 122:f9eeca106725 2499 /* In Multi Processor mode, the following bits must be kept cleared:
Kojto 122:f9eeca106725 2500 - LINEN and CLKEN bits in the USART_CR2 register,
Kojto 122:f9eeca106725 2501 - IREN, SCEN and HDSEL bits in the USART_CR3 register.*/
Kojto 122:f9eeca106725 2502 CLEAR_BIT(USARTx->CR2, (USART_CR2_LINEN | USART_CR2_CLKEN));
Kojto 122:f9eeca106725 2503 CLEAR_BIT(USARTx->CR3, (USART_CR3_SCEN | USART_CR3_HDSEL | USART_CR3_IREN));
Kojto 122:f9eeca106725 2504 }
Kojto 122:f9eeca106725 2505
Kojto 122:f9eeca106725 2506 /**
Kojto 122:f9eeca106725 2507 * @}
Kojto 122:f9eeca106725 2508 */
Kojto 122:f9eeca106725 2509
Kojto 122:f9eeca106725 2510 /** @defgroup USART_LL_EF_FLAG_Management FLAG_Management
Kojto 122:f9eeca106725 2511 * @{
Kojto 122:f9eeca106725 2512 */
Kojto 122:f9eeca106725 2513
Kojto 122:f9eeca106725 2514 /**
Kojto 122:f9eeca106725 2515 * @brief Check if the USART Parity Error Flag is set or not
Kojto 122:f9eeca106725 2516 * @rmtoll ISR PE LL_USART_IsActiveFlag_PE
Kojto 122:f9eeca106725 2517 * @param USARTx USART Instance
Kojto 122:f9eeca106725 2518 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 2519 */
Kojto 122:f9eeca106725 2520 __STATIC_INLINE uint32_t LL_USART_IsActiveFlag_PE(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 2521 {
Kojto 122:f9eeca106725 2522 return (READ_BIT(USARTx->ISR, USART_ISR_PE) == (USART_ISR_PE));
Kojto 122:f9eeca106725 2523 }
Kojto 122:f9eeca106725 2524
Kojto 122:f9eeca106725 2525 /**
Kojto 122:f9eeca106725 2526 * @brief Check if the USART Framing Error Flag is set or not
Kojto 122:f9eeca106725 2527 * @rmtoll ISR FE LL_USART_IsActiveFlag_FE
Kojto 122:f9eeca106725 2528 * @param USARTx USART Instance
Kojto 122:f9eeca106725 2529 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 2530 */
Kojto 122:f9eeca106725 2531 __STATIC_INLINE uint32_t LL_USART_IsActiveFlag_FE(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 2532 {
Kojto 122:f9eeca106725 2533 return (READ_BIT(USARTx->ISR, USART_ISR_FE) == (USART_ISR_FE));
Kojto 122:f9eeca106725 2534 }
Kojto 122:f9eeca106725 2535
Kojto 122:f9eeca106725 2536 /**
Kojto 122:f9eeca106725 2537 * @brief Check if the USART Noise error detected Flag is set or not
Kojto 122:f9eeca106725 2538 * @rmtoll ISR NF LL_USART_IsActiveFlag_NE
Kojto 122:f9eeca106725 2539 * @param USARTx USART Instance
Kojto 122:f9eeca106725 2540 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 2541 */
Kojto 122:f9eeca106725 2542 __STATIC_INLINE uint32_t LL_USART_IsActiveFlag_NE(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 2543 {
Kojto 122:f9eeca106725 2544 return (READ_BIT(USARTx->ISR, USART_ISR_NE) == (USART_ISR_NE));
Kojto 122:f9eeca106725 2545 }
Kojto 122:f9eeca106725 2546
Kojto 122:f9eeca106725 2547 /**
Kojto 122:f9eeca106725 2548 * @brief Check if the USART OverRun Error Flag is set or not
Kojto 122:f9eeca106725 2549 * @rmtoll ISR ORE LL_USART_IsActiveFlag_ORE
Kojto 122:f9eeca106725 2550 * @param USARTx USART Instance
Kojto 122:f9eeca106725 2551 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 2552 */
Kojto 122:f9eeca106725 2553 __STATIC_INLINE uint32_t LL_USART_IsActiveFlag_ORE(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 2554 {
Kojto 122:f9eeca106725 2555 return (READ_BIT(USARTx->ISR, USART_ISR_ORE) == (USART_ISR_ORE));
Kojto 122:f9eeca106725 2556 }
Kojto 122:f9eeca106725 2557
Kojto 122:f9eeca106725 2558 /**
Kojto 122:f9eeca106725 2559 * @brief Check if the USART IDLE line detected Flag is set or not
Kojto 122:f9eeca106725 2560 * @rmtoll ISR IDLE LL_USART_IsActiveFlag_IDLE
Kojto 122:f9eeca106725 2561 * @param USARTx USART Instance
Kojto 122:f9eeca106725 2562 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 2563 */
Kojto 122:f9eeca106725 2564 __STATIC_INLINE uint32_t LL_USART_IsActiveFlag_IDLE(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 2565 {
Kojto 122:f9eeca106725 2566 return (READ_BIT(USARTx->ISR, USART_ISR_IDLE) == (USART_ISR_IDLE));
Kojto 122:f9eeca106725 2567 }
Kojto 122:f9eeca106725 2568
Kojto 122:f9eeca106725 2569 /**
Kojto 122:f9eeca106725 2570 * @brief Check if the USART Read Data Register Not Empty Flag is set or not
Kojto 122:f9eeca106725 2571 * @rmtoll ISR RXNE LL_USART_IsActiveFlag_RXNE
Kojto 122:f9eeca106725 2572 * @param USARTx USART Instance
Kojto 122:f9eeca106725 2573 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 2574 */
Kojto 122:f9eeca106725 2575 __STATIC_INLINE uint32_t LL_USART_IsActiveFlag_RXNE(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 2576 {
Kojto 122:f9eeca106725 2577 return (READ_BIT(USARTx->ISR, USART_ISR_RXNE) == (USART_ISR_RXNE));
Kojto 122:f9eeca106725 2578 }
Kojto 122:f9eeca106725 2579
Kojto 122:f9eeca106725 2580 /**
Kojto 122:f9eeca106725 2581 * @brief Check if the USART Transmission Complete Flag is set or not
Kojto 122:f9eeca106725 2582 * @rmtoll ISR TC LL_USART_IsActiveFlag_TC
Kojto 122:f9eeca106725 2583 * @param USARTx USART Instance
Kojto 122:f9eeca106725 2584 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 2585 */
Kojto 122:f9eeca106725 2586 __STATIC_INLINE uint32_t LL_USART_IsActiveFlag_TC(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 2587 {
Kojto 122:f9eeca106725 2588 return (READ_BIT(USARTx->ISR, USART_ISR_TC) == (USART_ISR_TC));
Kojto 122:f9eeca106725 2589 }
Kojto 122:f9eeca106725 2590
Kojto 122:f9eeca106725 2591 /**
Kojto 122:f9eeca106725 2592 * @brief Check if the USART Transmit Data Register Empty Flag is set or not
Kojto 122:f9eeca106725 2593 * @rmtoll ISR TXE LL_USART_IsActiveFlag_TXE
Kojto 122:f9eeca106725 2594 * @param USARTx USART Instance
Kojto 122:f9eeca106725 2595 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 2596 */
Kojto 122:f9eeca106725 2597 __STATIC_INLINE uint32_t LL_USART_IsActiveFlag_TXE(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 2598 {
Kojto 122:f9eeca106725 2599 return (READ_BIT(USARTx->ISR, USART_ISR_TXE) == (USART_ISR_TXE));
Kojto 122:f9eeca106725 2600 }
Kojto 122:f9eeca106725 2601
Kojto 122:f9eeca106725 2602 /**
Kojto 122:f9eeca106725 2603 * @brief Check if the USART LIN Break Detection Flag is set or not
Kojto 122:f9eeca106725 2604 * @note Macro @ref IS_UART_LIN_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 2605 * LIN feature is supported by the USARTx instance.
Kojto 122:f9eeca106725 2606 * @rmtoll ISR LBDF LL_USART_IsActiveFlag_LBD
Kojto 122:f9eeca106725 2607 * @param USARTx USART Instance
Kojto 122:f9eeca106725 2608 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 2609 */
Kojto 122:f9eeca106725 2610 __STATIC_INLINE uint32_t LL_USART_IsActiveFlag_LBD(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 2611 {
Kojto 122:f9eeca106725 2612 return (READ_BIT(USARTx->ISR, USART_ISR_LBDF) == (USART_ISR_LBDF));
Kojto 122:f9eeca106725 2613 }
Kojto 122:f9eeca106725 2614
Kojto 122:f9eeca106725 2615 /**
Kojto 122:f9eeca106725 2616 * @brief Check if the USART CTS interrupt Flag is set or not
Kojto 122:f9eeca106725 2617 * @note Macro @ref IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 2618 * Hardware Flow control feature is supported by the USARTx instance.
Kojto 122:f9eeca106725 2619 * @rmtoll ISR CTSIF LL_USART_IsActiveFlag_nCTS
Kojto 122:f9eeca106725 2620 * @param USARTx USART Instance
Kojto 122:f9eeca106725 2621 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 2622 */
Kojto 122:f9eeca106725 2623 __STATIC_INLINE uint32_t LL_USART_IsActiveFlag_nCTS(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 2624 {
Kojto 122:f9eeca106725 2625 return (READ_BIT(USARTx->ISR, USART_ISR_CTSIF) == (USART_ISR_CTSIF));
Kojto 122:f9eeca106725 2626 }
Kojto 122:f9eeca106725 2627
Kojto 122:f9eeca106725 2628 /**
Kojto 122:f9eeca106725 2629 * @brief Check if the USART CTS Flag is set or not
Kojto 122:f9eeca106725 2630 * @note Macro @ref IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 2631 * Hardware Flow control feature is supported by the USARTx instance.
Kojto 122:f9eeca106725 2632 * @rmtoll ISR CTS LL_USART_IsActiveFlag_CTS
Kojto 122:f9eeca106725 2633 * @param USARTx USART Instance
Kojto 122:f9eeca106725 2634 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 2635 */
Kojto 122:f9eeca106725 2636 __STATIC_INLINE uint32_t LL_USART_IsActiveFlag_CTS(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 2637 {
Kojto 122:f9eeca106725 2638 return (READ_BIT(USARTx->ISR, USART_ISR_CTS) == (USART_ISR_CTS));
Kojto 122:f9eeca106725 2639 }
Kojto 122:f9eeca106725 2640
Kojto 122:f9eeca106725 2641 /**
Kojto 122:f9eeca106725 2642 * @brief Check if the USART Receiver Time Out Flag is set or not
Kojto 122:f9eeca106725 2643 * @rmtoll ISR RTOF LL_USART_IsActiveFlag_RTO
Kojto 122:f9eeca106725 2644 * @param USARTx USART Instance
Kojto 122:f9eeca106725 2645 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 2646 */
Kojto 122:f9eeca106725 2647 __STATIC_INLINE uint32_t LL_USART_IsActiveFlag_RTO(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 2648 {
Kojto 122:f9eeca106725 2649 return (READ_BIT(USARTx->ISR, USART_ISR_RTOF) == (USART_ISR_RTOF));
Kojto 122:f9eeca106725 2650 }
Kojto 122:f9eeca106725 2651
Kojto 122:f9eeca106725 2652 /**
Kojto 122:f9eeca106725 2653 * @brief Check if the USART End Of Block Flag is set or not
Kojto 122:f9eeca106725 2654 * @note Macro @ref IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 2655 * Smartcard feature is supported by the USARTx instance.
Kojto 122:f9eeca106725 2656 * @rmtoll ISR EOBF LL_USART_IsActiveFlag_EOB
Kojto 122:f9eeca106725 2657 * @param USARTx USART Instance
Kojto 122:f9eeca106725 2658 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 2659 */
Kojto 122:f9eeca106725 2660 __STATIC_INLINE uint32_t LL_USART_IsActiveFlag_EOB(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 2661 {
Kojto 122:f9eeca106725 2662 return (READ_BIT(USARTx->ISR, USART_ISR_EOBF) == (USART_ISR_EOBF));
Kojto 122:f9eeca106725 2663 }
Kojto 122:f9eeca106725 2664
Kojto 122:f9eeca106725 2665 /**
Kojto 122:f9eeca106725 2666 * @brief Check if the USART Auto-Baud Rate Error Flag is set or not
Kojto 122:f9eeca106725 2667 * @note Macro @ref IS_USART_AUTOBAUDRATE_DETECTION_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 2668 * Auto Baud Rate detection feature is supported by the USARTx instance.
Kojto 122:f9eeca106725 2669 * @rmtoll ISR ABRE LL_USART_IsActiveFlag_ABRE
Kojto 122:f9eeca106725 2670 * @param USARTx USART Instance
Kojto 122:f9eeca106725 2671 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 2672 */
Kojto 122:f9eeca106725 2673 __STATIC_INLINE uint32_t LL_USART_IsActiveFlag_ABRE(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 2674 {
Kojto 122:f9eeca106725 2675 return (READ_BIT(USARTx->ISR, USART_ISR_ABRE) == (USART_ISR_ABRE));
Kojto 122:f9eeca106725 2676 }
Kojto 122:f9eeca106725 2677
Kojto 122:f9eeca106725 2678 /**
Kojto 122:f9eeca106725 2679 * @brief Check if the USART Auto-Baud Rate Flag is set or not
Kojto 122:f9eeca106725 2680 * @note Macro @ref IS_USART_AUTOBAUDRATE_DETECTION_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 2681 * Auto Baud Rate detection feature is supported by the USARTx instance.
Kojto 122:f9eeca106725 2682 * @rmtoll ISR ABRF LL_USART_IsActiveFlag_ABR
Kojto 122:f9eeca106725 2683 * @param USARTx USART Instance
Kojto 122:f9eeca106725 2684 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 2685 */
Kojto 122:f9eeca106725 2686 __STATIC_INLINE uint32_t LL_USART_IsActiveFlag_ABR(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 2687 {
Kojto 122:f9eeca106725 2688 return (READ_BIT(USARTx->ISR, USART_ISR_ABRF) == (USART_ISR_ABRF));
Kojto 122:f9eeca106725 2689 }
Kojto 122:f9eeca106725 2690
Kojto 122:f9eeca106725 2691 /**
Kojto 122:f9eeca106725 2692 * @brief Check if the USART Busy Flag is set or not
Kojto 122:f9eeca106725 2693 * @rmtoll ISR BUSY LL_USART_IsActiveFlag_BUSY
Kojto 122:f9eeca106725 2694 * @param USARTx USART Instance
Kojto 122:f9eeca106725 2695 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 2696 */
Kojto 122:f9eeca106725 2697 __STATIC_INLINE uint32_t LL_USART_IsActiveFlag_BUSY(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 2698 {
Kojto 122:f9eeca106725 2699 return (READ_BIT(USARTx->ISR, USART_ISR_BUSY) == (USART_ISR_BUSY));
Kojto 122:f9eeca106725 2700 }
Kojto 122:f9eeca106725 2701
Kojto 122:f9eeca106725 2702 /**
Kojto 122:f9eeca106725 2703 * @brief Check if the USART Character Match Flag is set or not
Kojto 122:f9eeca106725 2704 * @rmtoll ISR CMF LL_USART_IsActiveFlag_CM
Kojto 122:f9eeca106725 2705 * @param USARTx USART Instance
Kojto 122:f9eeca106725 2706 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 2707 */
Kojto 122:f9eeca106725 2708 __STATIC_INLINE uint32_t LL_USART_IsActiveFlag_CM(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 2709 {
Kojto 122:f9eeca106725 2710 return (READ_BIT(USARTx->ISR, USART_ISR_CMF) == (USART_ISR_CMF));
Kojto 122:f9eeca106725 2711 }
Kojto 122:f9eeca106725 2712
Kojto 122:f9eeca106725 2713 /**
Kojto 122:f9eeca106725 2714 * @brief Check if the USART Send Break Flag is set or not
Kojto 122:f9eeca106725 2715 * @rmtoll ISR SBKF LL_USART_IsActiveFlag_SBK
Kojto 122:f9eeca106725 2716 * @param USARTx USART Instance
Kojto 122:f9eeca106725 2717 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 2718 */
Kojto 122:f9eeca106725 2719 __STATIC_INLINE uint32_t LL_USART_IsActiveFlag_SBK(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 2720 {
Kojto 122:f9eeca106725 2721 return (READ_BIT(USARTx->ISR, USART_ISR_SBKF) == (USART_ISR_SBKF));
Kojto 122:f9eeca106725 2722 }
Kojto 122:f9eeca106725 2723
Kojto 122:f9eeca106725 2724 /**
Kojto 122:f9eeca106725 2725 * @brief Check if the USART Receive Wake Up from mute mode Flag is set or not
Kojto 122:f9eeca106725 2726 * @rmtoll ISR RWU LL_USART_IsActiveFlag_RWU
Kojto 122:f9eeca106725 2727 * @param USARTx USART Instance
Kojto 122:f9eeca106725 2728 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 2729 */
Kojto 122:f9eeca106725 2730 __STATIC_INLINE uint32_t LL_USART_IsActiveFlag_RWU(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 2731 {
Kojto 122:f9eeca106725 2732 return (READ_BIT(USARTx->ISR, USART_ISR_RWU) == (USART_ISR_RWU));
Kojto 122:f9eeca106725 2733 }
Kojto 122:f9eeca106725 2734
Kojto 122:f9eeca106725 2735 /**
Kojto 122:f9eeca106725 2736 * @brief Check if the USART Wake Up from stop mode Flag is set or not
Kojto 122:f9eeca106725 2737 * @note Macro @ref IS_UART_WAKEUP_FROMSTOP_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 2738 * Wake-up from Stop mode feature is supported by the USARTx instance.
Kojto 122:f9eeca106725 2739 * @rmtoll ISR WUF LL_USART_IsActiveFlag_WKUP
Kojto 122:f9eeca106725 2740 * @param USARTx USART Instance
Kojto 122:f9eeca106725 2741 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 2742 */
Kojto 122:f9eeca106725 2743 __STATIC_INLINE uint32_t LL_USART_IsActiveFlag_WKUP(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 2744 {
Kojto 122:f9eeca106725 2745 return (READ_BIT(USARTx->ISR, USART_ISR_WUF) == (USART_ISR_WUF));
Kojto 122:f9eeca106725 2746 }
Kojto 122:f9eeca106725 2747
Kojto 122:f9eeca106725 2748 /**
Kojto 122:f9eeca106725 2749 * @brief Check if the USART Transmit Enable Acknowledge Flag is set or not
Kojto 122:f9eeca106725 2750 * @rmtoll ISR TEACK LL_USART_IsActiveFlag_TEACK
Kojto 122:f9eeca106725 2751 * @param USARTx USART Instance
Kojto 122:f9eeca106725 2752 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 2753 */
Kojto 122:f9eeca106725 2754 __STATIC_INLINE uint32_t LL_USART_IsActiveFlag_TEACK(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 2755 {
Kojto 122:f9eeca106725 2756 return (READ_BIT(USARTx->ISR, USART_ISR_TEACK) == (USART_ISR_TEACK));
Kojto 122:f9eeca106725 2757 }
Kojto 122:f9eeca106725 2758
Kojto 122:f9eeca106725 2759 /**
Kojto 122:f9eeca106725 2760 * @brief Check if the USART Receive Enable Acknowledge Flag is set or not
Kojto 122:f9eeca106725 2761 * @rmtoll ISR REACK LL_USART_IsActiveFlag_REACK
Kojto 122:f9eeca106725 2762 * @param USARTx USART Instance
Kojto 122:f9eeca106725 2763 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 2764 */
Kojto 122:f9eeca106725 2765 __STATIC_INLINE uint32_t LL_USART_IsActiveFlag_REACK(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 2766 {
Kojto 122:f9eeca106725 2767 return (READ_BIT(USARTx->ISR, USART_ISR_REACK) == (USART_ISR_REACK));
Kojto 122:f9eeca106725 2768 }
Kojto 122:f9eeca106725 2769
Kojto 122:f9eeca106725 2770 #if defined(USART_TCBGT_SUPPORT)
Kojto 122:f9eeca106725 2771 /* Function available only on devices supporting Transmit Complete before Guard Time feature */
Kojto 122:f9eeca106725 2772 /**
Kojto 122:f9eeca106725 2773 * @brief Check if the Smartcard Transmission Complete Before Guard Time Flag is set or not
Kojto 122:f9eeca106725 2774 * @rmtoll ISR TCBGT LL_USART_IsActiveFlag_TCBGT
Kojto 122:f9eeca106725 2775 * @param USARTx USART Instance
Kojto 122:f9eeca106725 2776 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 2777 */
Kojto 122:f9eeca106725 2778 __STATIC_INLINE uint32_t LL_USART_IsActiveFlag_TCBGT(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 2779 {
Kojto 122:f9eeca106725 2780 return (READ_BIT(USARTx->ISR, USART_ISR_TCBGT) == (USART_ISR_TCBGT));
Kojto 122:f9eeca106725 2781 }
Kojto 122:f9eeca106725 2782 #endif
Kojto 122:f9eeca106725 2783
Kojto 122:f9eeca106725 2784 /**
Kojto 122:f9eeca106725 2785 * @brief Clear Parity Error Flag
Kojto 122:f9eeca106725 2786 * @rmtoll ICR PECF LL_USART_ClearFlag_PE
Kojto 122:f9eeca106725 2787 * @param USARTx USART Instance
Kojto 122:f9eeca106725 2788 * @retval None
Kojto 122:f9eeca106725 2789 */
Kojto 122:f9eeca106725 2790 __STATIC_INLINE void LL_USART_ClearFlag_PE(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 2791 {
Kojto 122:f9eeca106725 2792 WRITE_REG(USARTx->ICR, USART_ICR_PECF);
Kojto 122:f9eeca106725 2793 }
Kojto 122:f9eeca106725 2794
Kojto 122:f9eeca106725 2795 /**
Kojto 122:f9eeca106725 2796 * @brief Clear Framing Error Flag
Kojto 122:f9eeca106725 2797 * @rmtoll ICR FECF LL_USART_ClearFlag_FE
Kojto 122:f9eeca106725 2798 * @param USARTx USART Instance
Kojto 122:f9eeca106725 2799 * @retval None
Kojto 122:f9eeca106725 2800 */
Kojto 122:f9eeca106725 2801 __STATIC_INLINE void LL_USART_ClearFlag_FE(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 2802 {
Kojto 122:f9eeca106725 2803 WRITE_REG(USARTx->ICR, USART_ICR_FECF);
Kojto 122:f9eeca106725 2804 }
Kojto 122:f9eeca106725 2805
Kojto 122:f9eeca106725 2806 /**
Kojto 122:f9eeca106725 2807 * @brief Clear Noise detected Flag
Kojto 122:f9eeca106725 2808 * @rmtoll ICR NCF LL_USART_ClearFlag_NE
Kojto 122:f9eeca106725 2809 * @param USARTx USART Instance
Kojto 122:f9eeca106725 2810 * @retval None
Kojto 122:f9eeca106725 2811 */
Kojto 122:f9eeca106725 2812 __STATIC_INLINE void LL_USART_ClearFlag_NE(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 2813 {
Kojto 122:f9eeca106725 2814 WRITE_REG(USARTx->ICR, USART_ICR_NCF);
Kojto 122:f9eeca106725 2815 }
Kojto 122:f9eeca106725 2816
Kojto 122:f9eeca106725 2817 /**
Kojto 122:f9eeca106725 2818 * @brief Clear OverRun Error Flag
Kojto 122:f9eeca106725 2819 * @rmtoll ICR ORECF LL_USART_ClearFlag_ORE
Kojto 122:f9eeca106725 2820 * @param USARTx USART Instance
Kojto 122:f9eeca106725 2821 * @retval None
Kojto 122:f9eeca106725 2822 */
Kojto 122:f9eeca106725 2823 __STATIC_INLINE void LL_USART_ClearFlag_ORE(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 2824 {
Kojto 122:f9eeca106725 2825 WRITE_REG(USARTx->ICR, USART_ICR_ORECF);
Kojto 122:f9eeca106725 2826 }
Kojto 122:f9eeca106725 2827
Kojto 122:f9eeca106725 2828 /**
Kojto 122:f9eeca106725 2829 * @brief Clear IDLE line detected Flag
Kojto 122:f9eeca106725 2830 * @rmtoll ICR IDLECF LL_USART_ClearFlag_IDLE
Kojto 122:f9eeca106725 2831 * @param USARTx USART Instance
Kojto 122:f9eeca106725 2832 * @retval None
Kojto 122:f9eeca106725 2833 */
Kojto 122:f9eeca106725 2834 __STATIC_INLINE void LL_USART_ClearFlag_IDLE(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 2835 {
Kojto 122:f9eeca106725 2836 WRITE_REG(USARTx->ICR, USART_ICR_IDLECF);
Kojto 122:f9eeca106725 2837 }
Kojto 122:f9eeca106725 2838
Kojto 122:f9eeca106725 2839 /**
Kojto 122:f9eeca106725 2840 * @brief Clear Transmission Complete Flag
Kojto 122:f9eeca106725 2841 * @rmtoll ICR TCCF LL_USART_ClearFlag_TC
Kojto 122:f9eeca106725 2842 * @param USARTx USART Instance
Kojto 122:f9eeca106725 2843 * @retval None
Kojto 122:f9eeca106725 2844 */
Kojto 122:f9eeca106725 2845 __STATIC_INLINE void LL_USART_ClearFlag_TC(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 2846 {
Kojto 122:f9eeca106725 2847 WRITE_REG(USARTx->ICR, USART_ICR_TCCF);
Kojto 122:f9eeca106725 2848 }
Kojto 122:f9eeca106725 2849
Kojto 122:f9eeca106725 2850 #if defined(USART_TCBGT_SUPPORT)
Kojto 122:f9eeca106725 2851 /* Function available only on devices supporting Transmit Complete before Guard Time feature */
Kojto 122:f9eeca106725 2852 /**
Kojto 122:f9eeca106725 2853 * @brief Clear Smartcard Transmission Complete Before Guard Time Flag
Kojto 122:f9eeca106725 2854 * @rmtoll ICR TCBGTCF LL_USART_ClearFlag_TCBGT
Kojto 122:f9eeca106725 2855 * @param USARTx USART Instance
Kojto 122:f9eeca106725 2856 * @retval None
Kojto 122:f9eeca106725 2857 */
Kojto 122:f9eeca106725 2858 __STATIC_INLINE void LL_USART_ClearFlag_TCBGT(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 2859 {
Kojto 122:f9eeca106725 2860 WRITE_REG(USARTx->ICR, USART_ICR_TCBGTCF);
Kojto 122:f9eeca106725 2861 }
Kojto 122:f9eeca106725 2862 #endif
Kojto 122:f9eeca106725 2863
Kojto 122:f9eeca106725 2864 /**
Kojto 122:f9eeca106725 2865 * @brief Clear LIN Break Detection Flag
Kojto 122:f9eeca106725 2866 * @note Macro @ref IS_UART_LIN_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 2867 * LIN feature is supported by the USARTx instance.
Kojto 122:f9eeca106725 2868 * @rmtoll ICR LBDCF LL_USART_ClearFlag_LBD
Kojto 122:f9eeca106725 2869 * @param USARTx USART Instance
Kojto 122:f9eeca106725 2870 * @retval None
Kojto 122:f9eeca106725 2871 */
Kojto 122:f9eeca106725 2872 __STATIC_INLINE void LL_USART_ClearFlag_LBD(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 2873 {
Kojto 122:f9eeca106725 2874 WRITE_REG(USARTx->ICR, USART_ICR_LBDCF);
Kojto 122:f9eeca106725 2875 }
Kojto 122:f9eeca106725 2876
Kojto 122:f9eeca106725 2877 /**
Kojto 122:f9eeca106725 2878 * @brief Clear CTS Interrupt Flag
Kojto 122:f9eeca106725 2879 * @note Macro @ref IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 2880 * Hardware Flow control feature is supported by the USARTx instance.
Kojto 122:f9eeca106725 2881 * @rmtoll ICR CTSCF LL_USART_ClearFlag_nCTS
Kojto 122:f9eeca106725 2882 * @param USARTx USART Instance
Kojto 122:f9eeca106725 2883 * @retval None
Kojto 122:f9eeca106725 2884 */
Kojto 122:f9eeca106725 2885 __STATIC_INLINE void LL_USART_ClearFlag_nCTS(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 2886 {
Kojto 122:f9eeca106725 2887 WRITE_REG(USARTx->ICR, USART_ICR_CTSCF);
Kojto 122:f9eeca106725 2888 }
Kojto 122:f9eeca106725 2889
Kojto 122:f9eeca106725 2890 /**
Kojto 122:f9eeca106725 2891 * @brief Clear Receiver Time Out Flag
Kojto 122:f9eeca106725 2892 * @rmtoll ICR RTOCF LL_USART_ClearFlag_RTO
Kojto 122:f9eeca106725 2893 * @param USARTx USART Instance
Kojto 122:f9eeca106725 2894 * @retval None
Kojto 122:f9eeca106725 2895 */
Kojto 122:f9eeca106725 2896 __STATIC_INLINE void LL_USART_ClearFlag_RTO(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 2897 {
Kojto 122:f9eeca106725 2898 WRITE_REG(USARTx->ICR, USART_ICR_RTOCF);
Kojto 122:f9eeca106725 2899 }
Kojto 122:f9eeca106725 2900
Kojto 122:f9eeca106725 2901 /**
Kojto 122:f9eeca106725 2902 * @brief Clear End Of Block Flag
Kojto 122:f9eeca106725 2903 * @note Macro @ref IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 2904 * Smartcard feature is supported by the USARTx instance.
Kojto 122:f9eeca106725 2905 * @rmtoll ICR EOBCF LL_USART_ClearFlag_EOB
Kojto 122:f9eeca106725 2906 * @param USARTx USART Instance
Kojto 122:f9eeca106725 2907 * @retval None
Kojto 122:f9eeca106725 2908 */
Kojto 122:f9eeca106725 2909 __STATIC_INLINE void LL_USART_ClearFlag_EOB(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 2910 {
Kojto 122:f9eeca106725 2911 WRITE_REG(USARTx->ICR, USART_ICR_EOBCF);
Kojto 122:f9eeca106725 2912 }
Kojto 122:f9eeca106725 2913
Kojto 122:f9eeca106725 2914 /**
Kojto 122:f9eeca106725 2915 * @brief Clear Character Match Flag
Kojto 122:f9eeca106725 2916 * @rmtoll ICR CMCF LL_USART_ClearFlag_CM
Kojto 122:f9eeca106725 2917 * @param USARTx USART Instance
Kojto 122:f9eeca106725 2918 * @retval None
Kojto 122:f9eeca106725 2919 */
Kojto 122:f9eeca106725 2920 __STATIC_INLINE void LL_USART_ClearFlag_CM(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 2921 {
Kojto 122:f9eeca106725 2922 WRITE_REG(USARTx->ICR, USART_ICR_CMCF);
Kojto 122:f9eeca106725 2923 }
Kojto 122:f9eeca106725 2924
Kojto 122:f9eeca106725 2925 /**
Kojto 122:f9eeca106725 2926 * @brief Clear Wake Up from stop mode Flag
Kojto 122:f9eeca106725 2927 * @note Macro @ref IS_UART_WAKEUP_FROMSTOP_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 2928 * Wake-up from Stop mode feature is supported by the USARTx instance.
Kojto 122:f9eeca106725 2929 * @rmtoll ICR WUCF LL_USART_ClearFlag_WKUP
Kojto 122:f9eeca106725 2930 * @param USARTx USART Instance
Kojto 122:f9eeca106725 2931 * @retval None
Kojto 122:f9eeca106725 2932 */
Kojto 122:f9eeca106725 2933 __STATIC_INLINE void LL_USART_ClearFlag_WKUP(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 2934 {
Kojto 122:f9eeca106725 2935 WRITE_REG(USARTx->ICR, USART_ICR_WUCF);
Kojto 122:f9eeca106725 2936 }
Kojto 122:f9eeca106725 2937
Kojto 122:f9eeca106725 2938 /**
Kojto 122:f9eeca106725 2939 * @}
Kojto 122:f9eeca106725 2940 */
Kojto 122:f9eeca106725 2941
Kojto 122:f9eeca106725 2942 /** @defgroup USART_LL_EF_IT_Management IT_Management
Kojto 122:f9eeca106725 2943 * @{
Kojto 122:f9eeca106725 2944 */
Kojto 122:f9eeca106725 2945
Kojto 122:f9eeca106725 2946 /**
Kojto 122:f9eeca106725 2947 * @brief Enable IDLE Interrupt
Kojto 122:f9eeca106725 2948 * @rmtoll CR1 IDLEIE LL_USART_EnableIT_IDLE
Kojto 122:f9eeca106725 2949 * @param USARTx USART Instance
Kojto 122:f9eeca106725 2950 * @retval None
Kojto 122:f9eeca106725 2951 */
Kojto 122:f9eeca106725 2952 __STATIC_INLINE void LL_USART_EnableIT_IDLE(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 2953 {
Kojto 122:f9eeca106725 2954 SET_BIT(USARTx->CR1, USART_CR1_IDLEIE);
Kojto 122:f9eeca106725 2955 }
Kojto 122:f9eeca106725 2956
Kojto 122:f9eeca106725 2957 /**
Kojto 122:f9eeca106725 2958 * @brief Enable RX Not Empty Interrupt
Kojto 122:f9eeca106725 2959 * @rmtoll CR1 RXNEIE LL_USART_EnableIT_RXNE
Kojto 122:f9eeca106725 2960 * @param USARTx USART Instance
Kojto 122:f9eeca106725 2961 * @retval None
Kojto 122:f9eeca106725 2962 */
Kojto 122:f9eeca106725 2963 __STATIC_INLINE void LL_USART_EnableIT_RXNE(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 2964 {
Kojto 122:f9eeca106725 2965 SET_BIT(USARTx->CR1, USART_CR1_RXNEIE);
Kojto 122:f9eeca106725 2966 }
Kojto 122:f9eeca106725 2967
Kojto 122:f9eeca106725 2968 /**
Kojto 122:f9eeca106725 2969 * @brief Enable Transmission Complete Interrupt
Kojto 122:f9eeca106725 2970 * @rmtoll CR1 TCIE LL_USART_EnableIT_TC
Kojto 122:f9eeca106725 2971 * @param USARTx USART Instance
Kojto 122:f9eeca106725 2972 * @retval None
Kojto 122:f9eeca106725 2973 */
Kojto 122:f9eeca106725 2974 __STATIC_INLINE void LL_USART_EnableIT_TC(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 2975 {
Kojto 122:f9eeca106725 2976 SET_BIT(USARTx->CR1, USART_CR1_TCIE);
Kojto 122:f9eeca106725 2977 }
Kojto 122:f9eeca106725 2978
Kojto 122:f9eeca106725 2979 /**
Kojto 122:f9eeca106725 2980 * @brief Enable TX Empty Interrupt
Kojto 122:f9eeca106725 2981 * @rmtoll CR1 TXEIE LL_USART_EnableIT_TXE
Kojto 122:f9eeca106725 2982 * @param USARTx USART Instance
Kojto 122:f9eeca106725 2983 * @retval None
Kojto 122:f9eeca106725 2984 */
Kojto 122:f9eeca106725 2985 __STATIC_INLINE void LL_USART_EnableIT_TXE(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 2986 {
Kojto 122:f9eeca106725 2987 SET_BIT(USARTx->CR1, USART_CR1_TXEIE);
Kojto 122:f9eeca106725 2988 }
Kojto 122:f9eeca106725 2989
Kojto 122:f9eeca106725 2990 /**
Kojto 122:f9eeca106725 2991 * @brief Enable Parity Error Interrupt
Kojto 122:f9eeca106725 2992 * @rmtoll CR1 PEIE LL_USART_EnableIT_PE
Kojto 122:f9eeca106725 2993 * @param USARTx USART Instance
Kojto 122:f9eeca106725 2994 * @retval None
Kojto 122:f9eeca106725 2995 */
Kojto 122:f9eeca106725 2996 __STATIC_INLINE void LL_USART_EnableIT_PE(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 2997 {
Kojto 122:f9eeca106725 2998 SET_BIT(USARTx->CR1, USART_CR1_PEIE);
Kojto 122:f9eeca106725 2999 }
Kojto 122:f9eeca106725 3000
Kojto 122:f9eeca106725 3001 /**
Kojto 122:f9eeca106725 3002 * @brief Enable Character Match Interrupt
Kojto 122:f9eeca106725 3003 * @rmtoll CR1 CMIE LL_USART_EnableIT_CM
Kojto 122:f9eeca106725 3004 * @param USARTx USART Instance
Kojto 122:f9eeca106725 3005 * @retval None
Kojto 122:f9eeca106725 3006 */
Kojto 122:f9eeca106725 3007 __STATIC_INLINE void LL_USART_EnableIT_CM(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 3008 {
Kojto 122:f9eeca106725 3009 SET_BIT(USARTx->CR1, USART_CR1_CMIE);
Kojto 122:f9eeca106725 3010 }
Kojto 122:f9eeca106725 3011
Kojto 122:f9eeca106725 3012 /**
Kojto 122:f9eeca106725 3013 * @brief Enable Receiver Timeout Interrupt
Kojto 122:f9eeca106725 3014 * @rmtoll CR1 RTOIE LL_USART_EnableIT_RTO
Kojto 122:f9eeca106725 3015 * @param USARTx USART Instance
Kojto 122:f9eeca106725 3016 * @retval None
Kojto 122:f9eeca106725 3017 */
Kojto 122:f9eeca106725 3018 __STATIC_INLINE void LL_USART_EnableIT_RTO(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 3019 {
Kojto 122:f9eeca106725 3020 SET_BIT(USARTx->CR1, USART_CR1_RTOIE);
Kojto 122:f9eeca106725 3021 }
Kojto 122:f9eeca106725 3022
Kojto 122:f9eeca106725 3023 /**
Kojto 122:f9eeca106725 3024 * @brief Enable End Of Block Interrupt
Kojto 122:f9eeca106725 3025 * @note Macro @ref IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 3026 * Smartcard feature is supported by the USARTx instance.
Kojto 122:f9eeca106725 3027 * @rmtoll CR1 EOBIE LL_USART_EnableIT_EOB
Kojto 122:f9eeca106725 3028 * @param USARTx USART Instance
Kojto 122:f9eeca106725 3029 * @retval None
Kojto 122:f9eeca106725 3030 */
Kojto 122:f9eeca106725 3031 __STATIC_INLINE void LL_USART_EnableIT_EOB(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 3032 {
Kojto 122:f9eeca106725 3033 SET_BIT(USARTx->CR1, USART_CR1_EOBIE);
Kojto 122:f9eeca106725 3034 }
Kojto 122:f9eeca106725 3035
Kojto 122:f9eeca106725 3036 /**
Kojto 122:f9eeca106725 3037 * @brief Enable LIN Break Detection Interrupt
Kojto 122:f9eeca106725 3038 * @note Macro @ref IS_UART_LIN_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 3039 * LIN feature is supported by the USARTx instance.
Kojto 122:f9eeca106725 3040 * @rmtoll CR2 LBDIE LL_USART_EnableIT_LBD
Kojto 122:f9eeca106725 3041 * @param USARTx USART Instance
Kojto 122:f9eeca106725 3042 * @retval None
Kojto 122:f9eeca106725 3043 */
Kojto 122:f9eeca106725 3044 __STATIC_INLINE void LL_USART_EnableIT_LBD(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 3045 {
Kojto 122:f9eeca106725 3046 SET_BIT(USARTx->CR2, USART_CR2_LBDIE);
Kojto 122:f9eeca106725 3047 }
Kojto 122:f9eeca106725 3048
Kojto 122:f9eeca106725 3049 /**
Kojto 122:f9eeca106725 3050 * @brief Enable Error Interrupt
Kojto 122:f9eeca106725 3051 * @note When set, Error Interrupt Enable Bit is enabling interrupt generation in case of a framing
Kojto 122:f9eeca106725 3052 * error, overrun error or noise flag (FE=1 or ORE=1 or NF=1 in the USARTx_ISR register).
Kojto 122:f9eeca106725 3053 * 0: Interrupt is inhibited
Kojto 122:f9eeca106725 3054 * 1: An interrupt is generated when FE=1 or ORE=1 or NF=1 in the USARTx_ISR register.
Kojto 122:f9eeca106725 3055 * @rmtoll CR3 EIE LL_USART_EnableIT_ERROR
Kojto 122:f9eeca106725 3056 * @param USARTx USART Instance
Kojto 122:f9eeca106725 3057 * @retval None
Kojto 122:f9eeca106725 3058 */
Kojto 122:f9eeca106725 3059 __STATIC_INLINE void LL_USART_EnableIT_ERROR(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 3060 {
Kojto 122:f9eeca106725 3061 SET_BIT(USARTx->CR3, USART_CR3_EIE);
Kojto 122:f9eeca106725 3062 }
Kojto 122:f9eeca106725 3063
Kojto 122:f9eeca106725 3064 /**
Kojto 122:f9eeca106725 3065 * @brief Enable CTS Interrupt
Kojto 122:f9eeca106725 3066 * @note Macro @ref IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 3067 * Hardware Flow control feature is supported by the USARTx instance.
Kojto 122:f9eeca106725 3068 * @rmtoll CR3 CTSIE LL_USART_EnableIT_CTS
Kojto 122:f9eeca106725 3069 * @param USARTx USART Instance
Kojto 122:f9eeca106725 3070 * @retval None
Kojto 122:f9eeca106725 3071 */
Kojto 122:f9eeca106725 3072 __STATIC_INLINE void LL_USART_EnableIT_CTS(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 3073 {
Kojto 122:f9eeca106725 3074 SET_BIT(USARTx->CR3, USART_CR3_CTSIE);
Kojto 122:f9eeca106725 3075 }
Kojto 122:f9eeca106725 3076
Kojto 122:f9eeca106725 3077 /**
Kojto 122:f9eeca106725 3078 * @brief Enable Wake Up from Stop Mode Interrupt
Kojto 122:f9eeca106725 3079 * @note Macro @ref IS_UART_WAKEUP_FROMSTOP_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 3080 * Wake-up from Stop mode feature is supported by the USARTx instance.
Kojto 122:f9eeca106725 3081 * @rmtoll CR3 WUFIE LL_USART_EnableIT_WKUP
Kojto 122:f9eeca106725 3082 * @param USARTx USART Instance
Kojto 122:f9eeca106725 3083 * @retval None
Kojto 122:f9eeca106725 3084 */
Kojto 122:f9eeca106725 3085 __STATIC_INLINE void LL_USART_EnableIT_WKUP(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 3086 {
Kojto 122:f9eeca106725 3087 SET_BIT(USARTx->CR3, USART_CR3_WUFIE);
Kojto 122:f9eeca106725 3088 }
Kojto 122:f9eeca106725 3089
Kojto 122:f9eeca106725 3090 #if defined(USART_TCBGT_SUPPORT)
Kojto 122:f9eeca106725 3091 /* Function available only on devices supporting Transmit Complete before Guard Time feature */
Kojto 122:f9eeca106725 3092 /**
Kojto 122:f9eeca106725 3093 * @brief Enable Smartcard Transmission Complete Before Guard Time Interrupt
Kojto 122:f9eeca106725 3094 * @note Macro @ref IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 3095 * Smartcard feature is supported by the USARTx instance.
Kojto 122:f9eeca106725 3096 * @rmtoll CR3 TCBGTIE LL_USART_EnableIT_TCBGT
Kojto 122:f9eeca106725 3097 * @param USARTx USART Instance
Kojto 122:f9eeca106725 3098 * @retval None
Kojto 122:f9eeca106725 3099 */
Kojto 122:f9eeca106725 3100 __STATIC_INLINE void LL_USART_EnableIT_TCBGT(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 3101 {
Kojto 122:f9eeca106725 3102 SET_BIT(USARTx->CR3, USART_CR3_TCBGTIE);
Kojto 122:f9eeca106725 3103 }
Kojto 122:f9eeca106725 3104 #endif
Kojto 122:f9eeca106725 3105
Kojto 122:f9eeca106725 3106 /**
Kojto 122:f9eeca106725 3107 * @brief Disable IDLE Interrupt
Kojto 122:f9eeca106725 3108 * @rmtoll CR1 IDLEIE LL_USART_DisableIT_IDLE
Kojto 122:f9eeca106725 3109 * @param USARTx USART Instance
Kojto 122:f9eeca106725 3110 * @retval None
Kojto 122:f9eeca106725 3111 */
Kojto 122:f9eeca106725 3112 __STATIC_INLINE void LL_USART_DisableIT_IDLE(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 3113 {
Kojto 122:f9eeca106725 3114 CLEAR_BIT(USARTx->CR1, USART_CR1_IDLEIE);
Kojto 122:f9eeca106725 3115 }
Kojto 122:f9eeca106725 3116
Kojto 122:f9eeca106725 3117 /**
Kojto 122:f9eeca106725 3118 * @brief Disable RX Not Empty Interrupt
Kojto 122:f9eeca106725 3119 * @rmtoll CR1 RXNEIE LL_USART_DisableIT_RXNE
Kojto 122:f9eeca106725 3120 * @param USARTx USART Instance
Kojto 122:f9eeca106725 3121 * @retval None
Kojto 122:f9eeca106725 3122 */
Kojto 122:f9eeca106725 3123 __STATIC_INLINE void LL_USART_DisableIT_RXNE(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 3124 {
Kojto 122:f9eeca106725 3125 CLEAR_BIT(USARTx->CR1, USART_CR1_RXNEIE);
Kojto 122:f9eeca106725 3126 }
Kojto 122:f9eeca106725 3127
Kojto 122:f9eeca106725 3128 /**
Kojto 122:f9eeca106725 3129 * @brief Disable Transmission Complete Interrupt
Kojto 122:f9eeca106725 3130 * @rmtoll CR1 TCIE LL_USART_DisableIT_TC
Kojto 122:f9eeca106725 3131 * @param USARTx USART Instance
Kojto 122:f9eeca106725 3132 * @retval None
Kojto 122:f9eeca106725 3133 */
Kojto 122:f9eeca106725 3134 __STATIC_INLINE void LL_USART_DisableIT_TC(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 3135 {
Kojto 122:f9eeca106725 3136 CLEAR_BIT(USARTx->CR1, USART_CR1_TCIE);
Kojto 122:f9eeca106725 3137 }
Kojto 122:f9eeca106725 3138
Kojto 122:f9eeca106725 3139 /**
Kojto 122:f9eeca106725 3140 * @brief Disable TX Empty Interrupt
Kojto 122:f9eeca106725 3141 * @rmtoll CR1 TXEIE LL_USART_DisableIT_TXE
Kojto 122:f9eeca106725 3142 * @param USARTx USART Instance
Kojto 122:f9eeca106725 3143 * @retval None
Kojto 122:f9eeca106725 3144 */
Kojto 122:f9eeca106725 3145 __STATIC_INLINE void LL_USART_DisableIT_TXE(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 3146 {
Kojto 122:f9eeca106725 3147 CLEAR_BIT(USARTx->CR1, USART_CR1_TXEIE);
Kojto 122:f9eeca106725 3148 }
Kojto 122:f9eeca106725 3149
Kojto 122:f9eeca106725 3150 /**
Kojto 122:f9eeca106725 3151 * @brief Disable Parity Error Interrupt
Kojto 122:f9eeca106725 3152 * @rmtoll CR1 PEIE LL_USART_DisableIT_PE
Kojto 122:f9eeca106725 3153 * @param USARTx USART Instance
Kojto 122:f9eeca106725 3154 * @retval None
Kojto 122:f9eeca106725 3155 */
Kojto 122:f9eeca106725 3156 __STATIC_INLINE void LL_USART_DisableIT_PE(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 3157 {
Kojto 122:f9eeca106725 3158 CLEAR_BIT(USARTx->CR1, USART_CR1_PEIE);
Kojto 122:f9eeca106725 3159 }
Kojto 122:f9eeca106725 3160
Kojto 122:f9eeca106725 3161 /**
Kojto 122:f9eeca106725 3162 * @brief Disable Character Match Interrupt
Kojto 122:f9eeca106725 3163 * @rmtoll CR1 CMIE LL_USART_DisableIT_CM
Kojto 122:f9eeca106725 3164 * @param USARTx USART Instance
Kojto 122:f9eeca106725 3165 * @retval None
Kojto 122:f9eeca106725 3166 */
Kojto 122:f9eeca106725 3167 __STATIC_INLINE void LL_USART_DisableIT_CM(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 3168 {
Kojto 122:f9eeca106725 3169 CLEAR_BIT(USARTx->CR1, USART_CR1_CMIE);
Kojto 122:f9eeca106725 3170 }
Kojto 122:f9eeca106725 3171
Kojto 122:f9eeca106725 3172 /**
Kojto 122:f9eeca106725 3173 * @brief Disable Receiver Timeout Interrupt
Kojto 122:f9eeca106725 3174 * @rmtoll CR1 RTOIE LL_USART_DisableIT_RTO
Kojto 122:f9eeca106725 3175 * @param USARTx USART Instance
Kojto 122:f9eeca106725 3176 * @retval None
Kojto 122:f9eeca106725 3177 */
Kojto 122:f9eeca106725 3178 __STATIC_INLINE void LL_USART_DisableIT_RTO(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 3179 {
Kojto 122:f9eeca106725 3180 CLEAR_BIT(USARTx->CR1, USART_CR1_RTOIE);
Kojto 122:f9eeca106725 3181 }
Kojto 122:f9eeca106725 3182
Kojto 122:f9eeca106725 3183 /**
Kojto 122:f9eeca106725 3184 * @brief Disable End Of Block Interrupt
Kojto 122:f9eeca106725 3185 * @note Macro @ref IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 3186 * Smartcard feature is supported by the USARTx instance.
Kojto 122:f9eeca106725 3187 * @rmtoll CR1 EOBIE LL_USART_DisableIT_EOB
Kojto 122:f9eeca106725 3188 * @param USARTx USART Instance
Kojto 122:f9eeca106725 3189 * @retval None
Kojto 122:f9eeca106725 3190 */
Kojto 122:f9eeca106725 3191 __STATIC_INLINE void LL_USART_DisableIT_EOB(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 3192 {
Kojto 122:f9eeca106725 3193 CLEAR_BIT(USARTx->CR1, USART_CR1_EOBIE);
Kojto 122:f9eeca106725 3194 }
Kojto 122:f9eeca106725 3195
Kojto 122:f9eeca106725 3196 /**
Kojto 122:f9eeca106725 3197 * @brief Disable LIN Break Detection Interrupt
Kojto 122:f9eeca106725 3198 * @note Macro @ref IS_UART_LIN_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 3199 * LIN feature is supported by the USARTx instance.
Kojto 122:f9eeca106725 3200 * @rmtoll CR2 LBDIE LL_USART_DisableIT_LBD
Kojto 122:f9eeca106725 3201 * @param USARTx USART Instance
Kojto 122:f9eeca106725 3202 * @retval None
Kojto 122:f9eeca106725 3203 */
Kojto 122:f9eeca106725 3204 __STATIC_INLINE void LL_USART_DisableIT_LBD(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 3205 {
Kojto 122:f9eeca106725 3206 CLEAR_BIT(USARTx->CR2, USART_CR2_LBDIE);
Kojto 122:f9eeca106725 3207 }
Kojto 122:f9eeca106725 3208
Kojto 122:f9eeca106725 3209 /**
Kojto 122:f9eeca106725 3210 * @brief Disable Error Interrupt
Kojto 122:f9eeca106725 3211 * @note When set, Error Interrupt Enable Bit is enabling interrupt generation in case of a framing
Kojto 122:f9eeca106725 3212 * error, overrun error or noise flag (FE=1 or ORE=1 or NF=1 in the USARTx_ISR register).
Kojto 122:f9eeca106725 3213 * 0: Interrupt is inhibited
Kojto 122:f9eeca106725 3214 * 1: An interrupt is generated when FE=1 or ORE=1 or NF=1 in the USARTx_ISR register.
Kojto 122:f9eeca106725 3215 * @rmtoll CR3 EIE LL_USART_DisableIT_ERROR
Kojto 122:f9eeca106725 3216 * @param USARTx USART Instance
Kojto 122:f9eeca106725 3217 * @retval None
Kojto 122:f9eeca106725 3218 */
Kojto 122:f9eeca106725 3219 __STATIC_INLINE void LL_USART_DisableIT_ERROR(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 3220 {
Kojto 122:f9eeca106725 3221 CLEAR_BIT(USARTx->CR3, USART_CR3_EIE);
Kojto 122:f9eeca106725 3222 }
Kojto 122:f9eeca106725 3223
Kojto 122:f9eeca106725 3224 /**
Kojto 122:f9eeca106725 3225 * @brief Disable CTS Interrupt
Kojto 122:f9eeca106725 3226 * @note Macro @ref IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 3227 * Hardware Flow control feature is supported by the USARTx instance.
Kojto 122:f9eeca106725 3228 * @rmtoll CR3 CTSIE LL_USART_DisableIT_CTS
Kojto 122:f9eeca106725 3229 * @param USARTx USART Instance
Kojto 122:f9eeca106725 3230 * @retval None
Kojto 122:f9eeca106725 3231 */
Kojto 122:f9eeca106725 3232 __STATIC_INLINE void LL_USART_DisableIT_CTS(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 3233 {
Kojto 122:f9eeca106725 3234 CLEAR_BIT(USARTx->CR3, USART_CR3_CTSIE);
Kojto 122:f9eeca106725 3235 }
Kojto 122:f9eeca106725 3236
Kojto 122:f9eeca106725 3237 /**
Kojto 122:f9eeca106725 3238 * @brief Disable Wake Up from Stop Mode Interrupt
Kojto 122:f9eeca106725 3239 * @note Macro @ref IS_UART_WAKEUP_FROMSTOP_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 3240 * Wake-up from Stop mode feature is supported by the USARTx instance.
Kojto 122:f9eeca106725 3241 * @rmtoll CR3 WUFIE LL_USART_DisableIT_WKUP
Kojto 122:f9eeca106725 3242 * @param USARTx USART Instance
Kojto 122:f9eeca106725 3243 * @retval None
Kojto 122:f9eeca106725 3244 */
Kojto 122:f9eeca106725 3245 __STATIC_INLINE void LL_USART_DisableIT_WKUP(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 3246 {
Kojto 122:f9eeca106725 3247 CLEAR_BIT(USARTx->CR3, USART_CR3_WUFIE);
Kojto 122:f9eeca106725 3248 }
Kojto 122:f9eeca106725 3249
Kojto 122:f9eeca106725 3250 #if defined(USART_TCBGT_SUPPORT)
Kojto 122:f9eeca106725 3251 /* Function available only on devices supporting Transmit Complete before Guard Time feature */
Kojto 122:f9eeca106725 3252 /**
Kojto 122:f9eeca106725 3253 * @brief Disable Smartcard Transmission Complete Before Guard Time Interrupt
Kojto 122:f9eeca106725 3254 * @note Macro @ref IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 3255 * Smartcard feature is supported by the USARTx instance.
Kojto 122:f9eeca106725 3256 * @rmtoll CR3 TCBGTIE LL_USART_DisableIT_TCBGT
Kojto 122:f9eeca106725 3257 * @param USARTx USART Instance
Kojto 122:f9eeca106725 3258 * @retval None
Kojto 122:f9eeca106725 3259 */
Kojto 122:f9eeca106725 3260 __STATIC_INLINE void LL_USART_DisableIT_TCBGT(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 3261 {
Kojto 122:f9eeca106725 3262 CLEAR_BIT(USARTx->CR3, USART_CR3_TCBGTIE);
Kojto 122:f9eeca106725 3263 }
Kojto 122:f9eeca106725 3264 #endif
Kojto 122:f9eeca106725 3265
Kojto 122:f9eeca106725 3266 /**
Kojto 122:f9eeca106725 3267 * @brief Check if the USART IDLE Interrupt source is enabled or disabled.
Kojto 122:f9eeca106725 3268 * @rmtoll CR1 IDLEIE LL_USART_IsEnabledIT_IDLE
Kojto 122:f9eeca106725 3269 * @param USARTx USART Instance
Kojto 122:f9eeca106725 3270 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 3271 */
Kojto 122:f9eeca106725 3272 __STATIC_INLINE uint32_t LL_USART_IsEnabledIT_IDLE(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 3273 {
Kojto 122:f9eeca106725 3274 return (READ_BIT(USARTx->CR1, USART_CR1_IDLEIE) == (USART_CR1_IDLEIE));
Kojto 122:f9eeca106725 3275 }
Kojto 122:f9eeca106725 3276
Kojto 122:f9eeca106725 3277 /**
Kojto 122:f9eeca106725 3278 * @brief Check if the USART RX Not Empty Interrupt is enabled or disabled.
Kojto 122:f9eeca106725 3279 * @rmtoll CR1 RXNEIE LL_USART_IsEnabledIT_RXNE
Kojto 122:f9eeca106725 3280 * @param USARTx USART Instance
Kojto 122:f9eeca106725 3281 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 3282 */
Kojto 122:f9eeca106725 3283 __STATIC_INLINE uint32_t LL_USART_IsEnabledIT_RXNE(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 3284 {
Kojto 122:f9eeca106725 3285 return (READ_BIT(USARTx->CR1, USART_CR1_RXNEIE) == (USART_CR1_RXNEIE));
Kojto 122:f9eeca106725 3286 }
Kojto 122:f9eeca106725 3287
Kojto 122:f9eeca106725 3288 /**
Kojto 122:f9eeca106725 3289 * @brief Check if the USART Transmission Complete Interrupt is enabled or disabled.
Kojto 122:f9eeca106725 3290 * @rmtoll CR1 TCIE LL_USART_IsEnabledIT_TC
Kojto 122:f9eeca106725 3291 * @param USARTx USART Instance
Kojto 122:f9eeca106725 3292 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 3293 */
Kojto 122:f9eeca106725 3294 __STATIC_INLINE uint32_t LL_USART_IsEnabledIT_TC(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 3295 {
Kojto 122:f9eeca106725 3296 return (READ_BIT(USARTx->CR1, USART_CR1_TCIE) == (USART_CR1_TCIE));
Kojto 122:f9eeca106725 3297 }
Kojto 122:f9eeca106725 3298
Kojto 122:f9eeca106725 3299 /**
Kojto 122:f9eeca106725 3300 * @brief Check if the USART TX Empty Interrupt is enabled or disabled.
Kojto 122:f9eeca106725 3301 * @rmtoll CR1 TXEIE LL_USART_IsEnabledIT_TXE
Kojto 122:f9eeca106725 3302 * @param USARTx USART Instance
Kojto 122:f9eeca106725 3303 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 3304 */
Kojto 122:f9eeca106725 3305 __STATIC_INLINE uint32_t LL_USART_IsEnabledIT_TXE(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 3306 {
Kojto 122:f9eeca106725 3307 return (READ_BIT(USARTx->CR1, USART_CR1_TXEIE) == (USART_CR1_TXEIE));
Kojto 122:f9eeca106725 3308 }
Kojto 122:f9eeca106725 3309
Kojto 122:f9eeca106725 3310 /**
Kojto 122:f9eeca106725 3311 * @brief Check if the USART Parity Error Interrupt is enabled or disabled.
Kojto 122:f9eeca106725 3312 * @rmtoll CR1 PEIE LL_USART_IsEnabledIT_PE
Kojto 122:f9eeca106725 3313 * @param USARTx USART Instance
Kojto 122:f9eeca106725 3314 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 3315 */
Kojto 122:f9eeca106725 3316 __STATIC_INLINE uint32_t LL_USART_IsEnabledIT_PE(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 3317 {
Kojto 122:f9eeca106725 3318 return (READ_BIT(USARTx->CR1, USART_CR1_PEIE) == (USART_CR1_PEIE));
Kojto 122:f9eeca106725 3319 }
Kojto 122:f9eeca106725 3320
Kojto 122:f9eeca106725 3321 /**
Kojto 122:f9eeca106725 3322 * @brief Check if the USART Character Match Interrupt is enabled or disabled.
Kojto 122:f9eeca106725 3323 * @rmtoll CR1 CMIE LL_USART_IsEnabledIT_CM
Kojto 122:f9eeca106725 3324 * @param USARTx USART Instance
Kojto 122:f9eeca106725 3325 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 3326 */
Kojto 122:f9eeca106725 3327 __STATIC_INLINE uint32_t LL_USART_IsEnabledIT_CM(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 3328 {
Kojto 122:f9eeca106725 3329 return (READ_BIT(USARTx->CR1, USART_CR1_CMIE) == (USART_CR1_CMIE));
Kojto 122:f9eeca106725 3330 }
Kojto 122:f9eeca106725 3331
Kojto 122:f9eeca106725 3332 /**
Kojto 122:f9eeca106725 3333 * @brief Check if the USART Receiver Timeout Interrupt is enabled or disabled.
Kojto 122:f9eeca106725 3334 * @rmtoll CR1 RTOIE LL_USART_IsEnabledIT_RTO
Kojto 122:f9eeca106725 3335 * @param USARTx USART Instance
Kojto 122:f9eeca106725 3336 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 3337 */
Kojto 122:f9eeca106725 3338 __STATIC_INLINE uint32_t LL_USART_IsEnabledIT_RTO(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 3339 {
Kojto 122:f9eeca106725 3340 return (READ_BIT(USARTx->CR1, USART_CR1_RTOIE) == (USART_CR1_RTOIE));
Kojto 122:f9eeca106725 3341 }
Kojto 122:f9eeca106725 3342
Kojto 122:f9eeca106725 3343 /**
Kojto 122:f9eeca106725 3344 * @brief Check if the USART End Of Block Interrupt is enabled or disabled.
Kojto 122:f9eeca106725 3345 * @note Macro @ref IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 3346 * Smartcard feature is supported by the USARTx instance.
Kojto 122:f9eeca106725 3347 * @rmtoll CR1 EOBIE LL_USART_IsEnabledIT_EOB
Kojto 122:f9eeca106725 3348 * @param USARTx USART Instance
Kojto 122:f9eeca106725 3349 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 3350 */
Kojto 122:f9eeca106725 3351 __STATIC_INLINE uint32_t LL_USART_IsEnabledIT_EOB(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 3352 {
Kojto 122:f9eeca106725 3353 return (READ_BIT(USARTx->CR1, USART_CR1_EOBIE) == (USART_CR1_EOBIE));
Kojto 122:f9eeca106725 3354 }
Kojto 122:f9eeca106725 3355
Kojto 122:f9eeca106725 3356 /**
Kojto 122:f9eeca106725 3357 * @brief Check if the USART LIN Break Detection Interrupt is enabled or disabled.
Kojto 122:f9eeca106725 3358 * @note Macro @ref IS_UART_LIN_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 3359 * LIN feature is supported by the USARTx instance.
Kojto 122:f9eeca106725 3360 * @rmtoll CR2 LBDIE LL_USART_IsEnabledIT_LBD
Kojto 122:f9eeca106725 3361 * @param USARTx USART Instance
Kojto 122:f9eeca106725 3362 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 3363 */
Kojto 122:f9eeca106725 3364 __STATIC_INLINE uint32_t LL_USART_IsEnabledIT_LBD(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 3365 {
Kojto 122:f9eeca106725 3366 return (READ_BIT(USARTx->CR2, USART_CR2_LBDIE) == (USART_CR2_LBDIE));
Kojto 122:f9eeca106725 3367 }
Kojto 122:f9eeca106725 3368
Kojto 122:f9eeca106725 3369 /**
Kojto 122:f9eeca106725 3370 * @brief Check if the USART Error Interrupt is enabled or disabled.
Kojto 122:f9eeca106725 3371 * @rmtoll CR3 EIE LL_USART_IsEnabledIT_ERROR
Kojto 122:f9eeca106725 3372 * @param USARTx USART Instance
Kojto 122:f9eeca106725 3373 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 3374 */
Kojto 122:f9eeca106725 3375 __STATIC_INLINE uint32_t LL_USART_IsEnabledIT_ERROR(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 3376 {
Kojto 122:f9eeca106725 3377 return (READ_BIT(USARTx->CR3, USART_CR3_EIE) == (USART_CR3_EIE));
Kojto 122:f9eeca106725 3378 }
Kojto 122:f9eeca106725 3379
Kojto 122:f9eeca106725 3380 /**
Kojto 122:f9eeca106725 3381 * @brief Check if the USART CTS Interrupt is enabled or disabled.
Kojto 122:f9eeca106725 3382 * @note Macro @ref IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 3383 * Hardware Flow control feature is supported by the USARTx instance.
Kojto 122:f9eeca106725 3384 * @rmtoll CR3 CTSIE LL_USART_IsEnabledIT_CTS
Kojto 122:f9eeca106725 3385 * @param USARTx USART Instance
Kojto 122:f9eeca106725 3386 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 3387 */
Kojto 122:f9eeca106725 3388 __STATIC_INLINE uint32_t LL_USART_IsEnabledIT_CTS(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 3389 {
Kojto 122:f9eeca106725 3390 return (READ_BIT(USARTx->CR3, USART_CR3_CTSIE) == (USART_CR3_CTSIE));
Kojto 122:f9eeca106725 3391 }
Kojto 122:f9eeca106725 3392
Kojto 122:f9eeca106725 3393 /**
Kojto 122:f9eeca106725 3394 * @brief Check if the USART Wake Up from Stop Mode Interrupt is enabled or disabled.
Kojto 122:f9eeca106725 3395 * @note Macro @ref IS_UART_WAKEUP_FROMSTOP_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 3396 * Wake-up from Stop mode feature is supported by the USARTx instance.
Kojto 122:f9eeca106725 3397 * @rmtoll CR3 WUFIE LL_USART_IsEnabledIT_WKUP
Kojto 122:f9eeca106725 3398 * @param USARTx USART Instance
Kojto 122:f9eeca106725 3399 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 3400 */
Kojto 122:f9eeca106725 3401 __STATIC_INLINE uint32_t LL_USART_IsEnabledIT_WKUP(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 3402 {
Kojto 122:f9eeca106725 3403 return (READ_BIT(USARTx->CR3, USART_CR3_WUFIE) == (USART_CR3_WUFIE));
Kojto 122:f9eeca106725 3404 }
Kojto 122:f9eeca106725 3405
Kojto 122:f9eeca106725 3406 #if defined(USART_TCBGT_SUPPORT)
Kojto 122:f9eeca106725 3407 /* Function available only on devices supporting Transmit Complete before Guard Time feature */
Kojto 122:f9eeca106725 3408 /**
Kojto 122:f9eeca106725 3409 * @brief Check if the Smartcard Transmission Complete Before Guard Time Interrupt is enabled or disabled.
Kojto 122:f9eeca106725 3410 * @note Macro @ref IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 3411 * Smartcard feature is supported by the USARTx instance.
Kojto 122:f9eeca106725 3412 * @rmtoll CR3 TCBGTIE LL_USART_IsEnabledIT_TCBGT
Kojto 122:f9eeca106725 3413 * @param USARTx USART Instance
Kojto 122:f9eeca106725 3414 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 3415 */
Kojto 122:f9eeca106725 3416 __STATIC_INLINE uint32_t LL_USART_IsEnabledIT_TCBGT(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 3417 {
Kojto 122:f9eeca106725 3418 return (READ_BIT(USARTx->CR3, USART_CR3_TCBGTIE) == (USART_CR3_TCBGTIE));
Kojto 122:f9eeca106725 3419 }
Kojto 122:f9eeca106725 3420 #endif
Kojto 122:f9eeca106725 3421
Kojto 122:f9eeca106725 3422 /**
Kojto 122:f9eeca106725 3423 * @}
Kojto 122:f9eeca106725 3424 */
Kojto 122:f9eeca106725 3425
Kojto 122:f9eeca106725 3426 /** @defgroup USART_LL_EF_DMA_Management DMA_Management
Kojto 122:f9eeca106725 3427 * @{
Kojto 122:f9eeca106725 3428 */
Kojto 122:f9eeca106725 3429
Kojto 122:f9eeca106725 3430 /**
Kojto 122:f9eeca106725 3431 * @brief Enable DMA Mode for reception
Kojto 122:f9eeca106725 3432 * @rmtoll CR3 DMAR LL_USART_EnableDMAReq_RX
Kojto 122:f9eeca106725 3433 * @param USARTx USART Instance
Kojto 122:f9eeca106725 3434 * @retval None
Kojto 122:f9eeca106725 3435 */
Kojto 122:f9eeca106725 3436 __STATIC_INLINE void LL_USART_EnableDMAReq_RX(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 3437 {
Kojto 122:f9eeca106725 3438 SET_BIT(USARTx->CR3, USART_CR3_DMAR);
Kojto 122:f9eeca106725 3439 }
Kojto 122:f9eeca106725 3440
Kojto 122:f9eeca106725 3441 /**
Kojto 122:f9eeca106725 3442 * @brief Disable DMA Mode for reception
Kojto 122:f9eeca106725 3443 * @rmtoll CR3 DMAR LL_USART_DisableDMAReq_RX
Kojto 122:f9eeca106725 3444 * @param USARTx USART Instance
Kojto 122:f9eeca106725 3445 * @retval None
Kojto 122:f9eeca106725 3446 */
Kojto 122:f9eeca106725 3447 __STATIC_INLINE void LL_USART_DisableDMAReq_RX(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 3448 {
Kojto 122:f9eeca106725 3449 CLEAR_BIT(USARTx->CR3, USART_CR3_DMAR);
Kojto 122:f9eeca106725 3450 }
Kojto 122:f9eeca106725 3451
Kojto 122:f9eeca106725 3452 /**
Kojto 122:f9eeca106725 3453 * @brief Check if DMA Mode is enabled for reception
Kojto 122:f9eeca106725 3454 * @rmtoll CR3 DMAR LL_USART_IsEnabledDMAReq_RX
Kojto 122:f9eeca106725 3455 * @param USARTx USART Instance
Kojto 122:f9eeca106725 3456 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 3457 */
Kojto 122:f9eeca106725 3458 __STATIC_INLINE uint32_t LL_USART_IsEnabledDMAReq_RX(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 3459 {
Kojto 122:f9eeca106725 3460 return (READ_BIT(USARTx->CR3, USART_CR3_DMAR) == (USART_CR3_DMAR));
Kojto 122:f9eeca106725 3461 }
Kojto 122:f9eeca106725 3462
Kojto 122:f9eeca106725 3463 /**
Kojto 122:f9eeca106725 3464 * @brief Enable DMA Mode for transmission
Kojto 122:f9eeca106725 3465 * @rmtoll CR3 DMAT LL_USART_EnableDMAReq_TX
Kojto 122:f9eeca106725 3466 * @param USARTx USART Instance
Kojto 122:f9eeca106725 3467 * @retval None
Kojto 122:f9eeca106725 3468 */
Kojto 122:f9eeca106725 3469 __STATIC_INLINE void LL_USART_EnableDMAReq_TX(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 3470 {
Kojto 122:f9eeca106725 3471 SET_BIT(USARTx->CR3, USART_CR3_DMAT);
Kojto 122:f9eeca106725 3472 }
Kojto 122:f9eeca106725 3473
Kojto 122:f9eeca106725 3474 /**
Kojto 122:f9eeca106725 3475 * @brief Disable DMA Mode for transmission
Kojto 122:f9eeca106725 3476 * @rmtoll CR3 DMAT LL_USART_DisableDMAReq_TX
Kojto 122:f9eeca106725 3477 * @param USARTx USART Instance
Kojto 122:f9eeca106725 3478 * @retval None
Kojto 122:f9eeca106725 3479 */
Kojto 122:f9eeca106725 3480 __STATIC_INLINE void LL_USART_DisableDMAReq_TX(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 3481 {
Kojto 122:f9eeca106725 3482 CLEAR_BIT(USARTx->CR3, USART_CR3_DMAT);
Kojto 122:f9eeca106725 3483 }
Kojto 122:f9eeca106725 3484
Kojto 122:f9eeca106725 3485 /**
Kojto 122:f9eeca106725 3486 * @brief Check if DMA Mode is enabled for transmission
Kojto 122:f9eeca106725 3487 * @rmtoll CR3 DMAT LL_USART_IsEnabledDMAReq_TX
Kojto 122:f9eeca106725 3488 * @param USARTx USART Instance
Kojto 122:f9eeca106725 3489 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 3490 */
Kojto 122:f9eeca106725 3491 __STATIC_INLINE uint32_t LL_USART_IsEnabledDMAReq_TX(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 3492 {
Kojto 122:f9eeca106725 3493 return (READ_BIT(USARTx->CR3, USART_CR3_DMAT) == (USART_CR3_DMAT));
Kojto 122:f9eeca106725 3494 }
Kojto 122:f9eeca106725 3495
Kojto 122:f9eeca106725 3496 /**
Kojto 122:f9eeca106725 3497 * @brief Enable DMA Disabling on Reception Error
Kojto 122:f9eeca106725 3498 * @rmtoll CR3 DDRE LL_USART_EnableDMADeactOnRxErr
Kojto 122:f9eeca106725 3499 * @param USARTx USART Instance
Kojto 122:f9eeca106725 3500 * @retval None
Kojto 122:f9eeca106725 3501 */
Kojto 122:f9eeca106725 3502 __STATIC_INLINE void LL_USART_EnableDMADeactOnRxErr(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 3503 {
Kojto 122:f9eeca106725 3504 SET_BIT(USARTx->CR3, USART_CR3_DDRE);
Kojto 122:f9eeca106725 3505 }
Kojto 122:f9eeca106725 3506
Kojto 122:f9eeca106725 3507 /**
Kojto 122:f9eeca106725 3508 * @brief Disable DMA Disabling on Reception Error
Kojto 122:f9eeca106725 3509 * @rmtoll CR3 DDRE LL_USART_DisableDMADeactOnRxErr
Kojto 122:f9eeca106725 3510 * @param USARTx USART Instance
Kojto 122:f9eeca106725 3511 * @retval None
Kojto 122:f9eeca106725 3512 */
Kojto 122:f9eeca106725 3513 __STATIC_INLINE void LL_USART_DisableDMADeactOnRxErr(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 3514 {
Kojto 122:f9eeca106725 3515 CLEAR_BIT(USARTx->CR3, USART_CR3_DDRE);
Kojto 122:f9eeca106725 3516 }
Kojto 122:f9eeca106725 3517
Kojto 122:f9eeca106725 3518 /**
Kojto 122:f9eeca106725 3519 * @brief Indicate if DMA Disabling on Reception Error is disabled
Kojto 122:f9eeca106725 3520 * @rmtoll CR3 DDRE LL_USART_IsEnabledDMADeactOnRxErr
Kojto 122:f9eeca106725 3521 * @param USARTx USART Instance
Kojto 122:f9eeca106725 3522 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 3523 */
Kojto 122:f9eeca106725 3524 __STATIC_INLINE uint32_t LL_USART_IsEnabledDMADeactOnRxErr(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 3525 {
Kojto 122:f9eeca106725 3526 return (READ_BIT(USARTx->CR3, USART_CR3_DDRE) == (USART_CR3_DDRE));
Kojto 122:f9eeca106725 3527 }
Kojto 122:f9eeca106725 3528
Kojto 122:f9eeca106725 3529 /**
Kojto 122:f9eeca106725 3530 * @brief Get the data register address used for DMA transfer
Kojto 122:f9eeca106725 3531 * @rmtoll RDR RDR LL_USART_DMA_GetRegAddr\n
Kojto 122:f9eeca106725 3532 * @rmtoll TDR TDR LL_USART_DMA_GetRegAddr
Kojto 122:f9eeca106725 3533 * @param USARTx USART Instance
Kojto 122:f9eeca106725 3534 * @param Direction This parameter can be one of the following values:
Kojto 122:f9eeca106725 3535 * @arg @ref LL_USART_DMA_REG_DATA_TRANSMIT
Kojto 122:f9eeca106725 3536 * @arg @ref LL_USART_DMA_REG_DATA_RECEIVE
Kojto 122:f9eeca106725 3537 * @retval Address of data register
Kojto 122:f9eeca106725 3538 */
Kojto 122:f9eeca106725 3539 __STATIC_INLINE uint32_t LL_USART_DMA_GetRegAddr(USART_TypeDef *USARTx, uint32_t Direction)
Kojto 122:f9eeca106725 3540 {
Kojto 122:f9eeca106725 3541 register uint32_t data_reg_addr = 0U;
Kojto 122:f9eeca106725 3542
Kojto 122:f9eeca106725 3543 if (Direction == LL_USART_DMA_REG_DATA_TRANSMIT)
Kojto 122:f9eeca106725 3544 {
Kojto 122:f9eeca106725 3545 /* return address of TDR register */
Kojto 122:f9eeca106725 3546 data_reg_addr = (uint32_t) &(USARTx->TDR);
Kojto 122:f9eeca106725 3547 }
Kojto 122:f9eeca106725 3548 else
Kojto 122:f9eeca106725 3549 {
Kojto 122:f9eeca106725 3550 /* return address of RDR register */
Kojto 122:f9eeca106725 3551 data_reg_addr = (uint32_t) &(USARTx->RDR);
Kojto 122:f9eeca106725 3552 }
Kojto 122:f9eeca106725 3553
Kojto 122:f9eeca106725 3554 return data_reg_addr;
Kojto 122:f9eeca106725 3555 }
Kojto 122:f9eeca106725 3556
Kojto 122:f9eeca106725 3557 /**
Kojto 122:f9eeca106725 3558 * @}
Kojto 122:f9eeca106725 3559 */
Kojto 122:f9eeca106725 3560
Kojto 122:f9eeca106725 3561 /** @defgroup USART_LL_EF_Data_Management Data_Management
Kojto 122:f9eeca106725 3562 * @{
Kojto 122:f9eeca106725 3563 */
Kojto 122:f9eeca106725 3564
Kojto 122:f9eeca106725 3565 /**
Kojto 122:f9eeca106725 3566 * @brief Read Receiver Data register (Receive Data value, 8 bits)
Kojto 122:f9eeca106725 3567 * @rmtoll RDR RDR LL_USART_ReceiveData8
Kojto 122:f9eeca106725 3568 * @param USARTx USART Instance
Kojto 122:f9eeca106725 3569 * @retval Value between Min_Data=0x00 and Max_Data=0xFF
Kojto 122:f9eeca106725 3570 */
Kojto 122:f9eeca106725 3571 __STATIC_INLINE uint8_t LL_USART_ReceiveData8(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 3572 {
Kojto 122:f9eeca106725 3573 return (uint8_t)(READ_BIT(USARTx->RDR, USART_RDR_RDR));
Kojto 122:f9eeca106725 3574 }
Kojto 122:f9eeca106725 3575
Kojto 122:f9eeca106725 3576 /**
Kojto 122:f9eeca106725 3577 * @brief Read Receiver Data register (Receive Data value, 9 bits)
Kojto 122:f9eeca106725 3578 * @rmtoll RDR RDR LL_USART_ReceiveData9
Kojto 122:f9eeca106725 3579 * @param USARTx USART Instance
Kojto 122:f9eeca106725 3580 * @retval Value between Min_Data=0x00 and Max_Data=0x1FF
Kojto 122:f9eeca106725 3581 */
Kojto 122:f9eeca106725 3582 __STATIC_INLINE uint16_t LL_USART_ReceiveData9(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 3583 {
Kojto 122:f9eeca106725 3584 return (uint16_t)(READ_BIT(USARTx->RDR, USART_RDR_RDR));
Kojto 122:f9eeca106725 3585 }
Kojto 122:f9eeca106725 3586
Kojto 122:f9eeca106725 3587 /**
Kojto 122:f9eeca106725 3588 * @brief Write in Transmitter Data Register (Transmit Data value, 8 bits)
Kojto 122:f9eeca106725 3589 * @rmtoll TDR TDR LL_USART_TransmitData8
Kojto 122:f9eeca106725 3590 * @param USARTx USART Instance
Kojto 122:f9eeca106725 3591 * @param Value between Min_Data=0x00 and Max_Data=0xFF
Kojto 122:f9eeca106725 3592 * @retval None
Kojto 122:f9eeca106725 3593 */
Kojto 122:f9eeca106725 3594 __STATIC_INLINE void LL_USART_TransmitData8(USART_TypeDef *USARTx, uint8_t Value)
Kojto 122:f9eeca106725 3595 {
Kojto 122:f9eeca106725 3596 USARTx->TDR = Value;
Kojto 122:f9eeca106725 3597 }
Kojto 122:f9eeca106725 3598
Kojto 122:f9eeca106725 3599 /**
Kojto 122:f9eeca106725 3600 * @brief Write in Transmitter Data Register (Transmit Data value, 9 bits)
Kojto 122:f9eeca106725 3601 * @rmtoll TDR TDR LL_USART_TransmitData9
Kojto 122:f9eeca106725 3602 * @param USARTx USART Instance
Kojto 122:f9eeca106725 3603 * @param Value between Min_Data=0x00 and Max_Data=0x1FF
Kojto 122:f9eeca106725 3604 * @retval None
Kojto 122:f9eeca106725 3605 */
Kojto 122:f9eeca106725 3606 __STATIC_INLINE void LL_USART_TransmitData9(USART_TypeDef *USARTx, uint16_t Value)
Kojto 122:f9eeca106725 3607 {
Kojto 122:f9eeca106725 3608 USARTx->TDR = Value & 0x1FFU;
Kojto 122:f9eeca106725 3609 }
Kojto 122:f9eeca106725 3610
Kojto 122:f9eeca106725 3611 /**
Kojto 122:f9eeca106725 3612 * @}
Kojto 122:f9eeca106725 3613 */
Kojto 122:f9eeca106725 3614
Kojto 122:f9eeca106725 3615 /** @defgroup USART_LL_EF_Execution Execution
Kojto 122:f9eeca106725 3616 * @{
Kojto 122:f9eeca106725 3617 */
Kojto 122:f9eeca106725 3618
Kojto 122:f9eeca106725 3619 /**
Kojto 122:f9eeca106725 3620 * @brief Request an Automatic Baud Rate measurement on next received data frame
Kojto 122:f9eeca106725 3621 * @note Macro @ref IS_USART_AUTOBAUDRATE_DETECTION_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 3622 * Auto Baud Rate detection feature is supported by the USARTx instance.
Kojto 122:f9eeca106725 3623 * @rmtoll RQR ABRRQ LL_USART_RequestAutoBaudRate
Kojto 122:f9eeca106725 3624 * @param USARTx USART Instance
Kojto 122:f9eeca106725 3625 * @retval None
Kojto 122:f9eeca106725 3626 */
Kojto 122:f9eeca106725 3627 __STATIC_INLINE void LL_USART_RequestAutoBaudRate(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 3628 {
Kojto 122:f9eeca106725 3629 SET_BIT(USARTx->RQR, USART_RQR_ABRRQ);
Kojto 122:f9eeca106725 3630 }
Kojto 122:f9eeca106725 3631
Kojto 122:f9eeca106725 3632 /**
Kojto 122:f9eeca106725 3633 * @brief Request Break sending
Kojto 122:f9eeca106725 3634 * @rmtoll RQR SBKRQ LL_USART_RequestBreakSending
Kojto 122:f9eeca106725 3635 * @param USARTx USART Instance
Kojto 122:f9eeca106725 3636 * @retval None
Kojto 122:f9eeca106725 3637 */
Kojto 122:f9eeca106725 3638 __STATIC_INLINE void LL_USART_RequestBreakSending(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 3639 {
Kojto 122:f9eeca106725 3640 SET_BIT(USARTx->RQR, USART_RQR_SBKRQ);
Kojto 122:f9eeca106725 3641 }
Kojto 122:f9eeca106725 3642
Kojto 122:f9eeca106725 3643 /**
Kojto 122:f9eeca106725 3644 * @brief Put USART in mute mode and set the RWU flag
Kojto 122:f9eeca106725 3645 * @rmtoll RQR MMRQ LL_USART_RequestEnterMuteMode
Kojto 122:f9eeca106725 3646 * @param USARTx USART Instance
Kojto 122:f9eeca106725 3647 * @retval None
Kojto 122:f9eeca106725 3648 */
Kojto 122:f9eeca106725 3649 __STATIC_INLINE void LL_USART_RequestEnterMuteMode(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 3650 {
Kojto 122:f9eeca106725 3651 SET_BIT(USARTx->RQR, USART_RQR_MMRQ);
Kojto 122:f9eeca106725 3652 }
Kojto 122:f9eeca106725 3653
Kojto 122:f9eeca106725 3654 /**
Kojto 122:f9eeca106725 3655 * @brief Request a Receive Data flush
Kojto 122:f9eeca106725 3656 * @rmtoll RQR RXFRQ LL_USART_RequestRxDataFlush
Kojto 122:f9eeca106725 3657 * @param USARTx USART Instance
Kojto 122:f9eeca106725 3658 * @retval None
Kojto 122:f9eeca106725 3659 */
Kojto 122:f9eeca106725 3660 __STATIC_INLINE void LL_USART_RequestRxDataFlush(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 3661 {
Kojto 122:f9eeca106725 3662 SET_BIT(USARTx->RQR, USART_RQR_RXFRQ);
Kojto 122:f9eeca106725 3663 }
Kojto 122:f9eeca106725 3664
Kojto 122:f9eeca106725 3665 /**
Kojto 122:f9eeca106725 3666 * @brief Request a Transmit data flush
Kojto 122:f9eeca106725 3667 * @note Macro @ref IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not
Kojto 122:f9eeca106725 3668 * Smartcard feature is supported by the USARTx instance.
Kojto 122:f9eeca106725 3669 * @rmtoll RQR TXFRQ LL_USART_RequestTxDataFlush
Kojto 122:f9eeca106725 3670 * @param USARTx USART Instance
Kojto 122:f9eeca106725 3671 * @retval None
Kojto 122:f9eeca106725 3672 */
Kojto 122:f9eeca106725 3673 __STATIC_INLINE void LL_USART_RequestTxDataFlush(USART_TypeDef *USARTx)
Kojto 122:f9eeca106725 3674 {
Kojto 122:f9eeca106725 3675 SET_BIT(USARTx->RQR, USART_RQR_TXFRQ);
Kojto 122:f9eeca106725 3676 }
Kojto 122:f9eeca106725 3677
Kojto 122:f9eeca106725 3678 /**
Kojto 122:f9eeca106725 3679 * @}
Kojto 122:f9eeca106725 3680 */
Kojto 122:f9eeca106725 3681
Kojto 122:f9eeca106725 3682 #if defined(USE_FULL_LL_DRIVER)
Kojto 122:f9eeca106725 3683 /** @defgroup USART_LL_EF_Init Initialization and de-initialization functions
Kojto 122:f9eeca106725 3684 * @{
Kojto 122:f9eeca106725 3685 */
Kojto 122:f9eeca106725 3686 ErrorStatus LL_USART_DeInit(USART_TypeDef *USARTx);
Kojto 122:f9eeca106725 3687 ErrorStatus LL_USART_Init(USART_TypeDef *USARTx, LL_USART_InitTypeDef *USART_InitStruct);
Kojto 122:f9eeca106725 3688 void LL_USART_StructInit(LL_USART_InitTypeDef *USART_InitStruct);
Kojto 122:f9eeca106725 3689 ErrorStatus LL_USART_ClockInit(USART_TypeDef *USARTx, LL_USART_ClockInitTypeDef *USART_ClockInitStruct);
Kojto 122:f9eeca106725 3690 void LL_USART_ClockStructInit(LL_USART_ClockInitTypeDef *USART_ClockInitStruct);
Kojto 122:f9eeca106725 3691 /**
Kojto 122:f9eeca106725 3692 * @}
Kojto 122:f9eeca106725 3693 */
Kojto 122:f9eeca106725 3694 #endif /* USE_FULL_LL_DRIVER */
Kojto 122:f9eeca106725 3695
Kojto 122:f9eeca106725 3696 /**
Kojto 122:f9eeca106725 3697 * @}
Kojto 122:f9eeca106725 3698 */
Kojto 122:f9eeca106725 3699
Kojto 122:f9eeca106725 3700 /**
Kojto 122:f9eeca106725 3701 * @}
Kojto 122:f9eeca106725 3702 */
Kojto 122:f9eeca106725 3703
Kojto 122:f9eeca106725 3704 #endif /* USART1 || USART2 || USART3 || UART4 || UART5 */
Kojto 122:f9eeca106725 3705
Kojto 122:f9eeca106725 3706 /**
Kojto 122:f9eeca106725 3707 * @}
Kojto 122:f9eeca106725 3708 */
Kojto 122:f9eeca106725 3709
Kojto 122:f9eeca106725 3710 #ifdef __cplusplus
Kojto 122:f9eeca106725 3711 }
Kojto 122:f9eeca106725 3712 #endif
Kojto 122:f9eeca106725 3713
Kojto 122:f9eeca106725 3714 #endif /* __STM32L4xx_LL_USART_H */
Kojto 122:f9eeca106725 3715
Kojto 122:f9eeca106725 3716 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/