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:
<>
Date:
Wed Apr 12 16:07:08 2017 +0100
Revision:
140:97feb9bacc10
Parent:
128:9bcdf88f62b0
Child:
145:64910690c574
Release 140 of the mbed library

Ports for Upcoming Targets

3841: Add nRf52840 target https://github.com/ARMmbed/mbed-os/pull/3841
3992: Introducing UBLOX_C030 platform. https://github.com/ARMmbed/mbed-os/pull/3992

Fixes and Changes

3951: [NUCLEO_F303ZE] Correct ARDUINO pin https://github.com/ARMmbed/mbed-os/pull/3951
4021: Fixing a macro to detect when RTOS was in use for the NRF52840_DK https://github.com/ARMmbed/mbed-os/pull/4021
3979: KW24D: Add missing SPI defines and Arduino connector definitions https://github.com/ARMmbed/mbed-os/pull/3979
3990: UBLOX_C027: construct a ticker-based wait, rather than calling wait_ms(), in the https://github.com/ARMmbed/mbed-os/pull/3990
4003: Fixed OBOE in async serial tx for NRF52 target, fixes #4002 https://github.com/ARMmbed/mbed-os/pull/4003
4012: STM32: Correct I2C master error handling https://github.com/ARMmbed/mbed-os/pull/4012
4020: NUCLEO_L011K4 remove unsupported tool chain files https://github.com/ARMmbed/mbed-os/pull/4020
4065: K66F: Move bss section to m_data_2 Section https://github.com/ARMmbed/mbed-os/pull/4065
4014: Issue 3763: Reduce heap allocation in the GCC linker file https://github.com/ARMmbed/mbed-os/pull/4014
4030: [STM32L0] reduce IAR heap and stack size for small targets https://github.com/ARMmbed/mbed-os/pull/4030
4109: NUCLEO_L476RG : minor serial pin update https://github.com/ARMmbed/mbed-os/pull/4109
3982: Ticker - kl25z bugfix for handling events in the past https://github.com/ARMmbed/mbed-os/pull/3982

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