mbed library sources. Supersedes mbed-src.

Dependents:   Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more

Committer:
AnnaBridge
Date:
Wed Feb 20 22:31:08 2019 +0000
Revision:
189:f392fc9709a3
Parent:
186:707f6e361f3e
mbed library release version 165

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Kojto 158:b23ee177fd68 1 /**
Kojto 158:b23ee177fd68 2 ******************************************************************************
Kojto 158:b23ee177fd68 3 * @file stm32l0xx_ll_lpuart.h
Kojto 158:b23ee177fd68 4 * @author MCD Application Team
Kojto 158:b23ee177fd68 5 * @brief Header file of LPUART LL module.
Kojto 158:b23ee177fd68 6 ******************************************************************************
Kojto 158:b23ee177fd68 7 * @attention
Kojto 158:b23ee177fd68 8 *
Kojto 158:b23ee177fd68 9 * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
Kojto 158:b23ee177fd68 10 *
Kojto 158:b23ee177fd68 11 * Redistribution and use in source and binary forms, with or without modification,
Kojto 158:b23ee177fd68 12 * are permitted provided that the following conditions are met:
Kojto 158:b23ee177fd68 13 * 1. Redistributions of source code must retain the above copyright notice,
Kojto 158:b23ee177fd68 14 * this list of conditions and the following disclaimer.
Kojto 158:b23ee177fd68 15 * 2. Redistributions in binary form must reproduce the above copyright notice,
Kojto 158:b23ee177fd68 16 * this list of conditions and the following disclaimer in the documentation
Kojto 158:b23ee177fd68 17 * and/or other materials provided with the distribution.
Kojto 158:b23ee177fd68 18 * 3. Neither the name of STMicroelectronics nor the names of its contributors
Kojto 158:b23ee177fd68 19 * may be used to endorse or promote products derived from this software
Kojto 158:b23ee177fd68 20 * without specific prior written permission.
Kojto 158:b23ee177fd68 21 *
Kojto 158:b23ee177fd68 22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
Kojto 158:b23ee177fd68 23 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Kojto 158:b23ee177fd68 24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Kojto 158:b23ee177fd68 25 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
Kojto 158:b23ee177fd68 26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Kojto 158:b23ee177fd68 27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
Kojto 158:b23ee177fd68 28 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
Kojto 158:b23ee177fd68 29 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
Kojto 158:b23ee177fd68 30 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Kojto 158:b23ee177fd68 31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Kojto 158:b23ee177fd68 32 *
Kojto 158:b23ee177fd68 33 ******************************************************************************
Kojto 158:b23ee177fd68 34 */
Kojto 158:b23ee177fd68 35
Kojto 158:b23ee177fd68 36 /* Define to prevent recursive inclusion -------------------------------------*/
Kojto 158:b23ee177fd68 37 #ifndef __STM32L0xx_LL_LPUART_H
Kojto 158:b23ee177fd68 38 #define __STM32L0xx_LL_LPUART_H
Kojto 158:b23ee177fd68 39
Kojto 158:b23ee177fd68 40 #ifdef __cplusplus
Kojto 158:b23ee177fd68 41 extern "C" {
Kojto 158:b23ee177fd68 42 #endif
Kojto 158:b23ee177fd68 43
Kojto 158:b23ee177fd68 44 /* Includes ------------------------------------------------------------------*/
Kojto 158:b23ee177fd68 45 #include "stm32l0xx.h"
Kojto 158:b23ee177fd68 46
Kojto 158:b23ee177fd68 47 /** @addtogroup STM32L0xx_LL_Driver
Kojto 158:b23ee177fd68 48 * @{
Kojto 158:b23ee177fd68 49 */
Kojto 158:b23ee177fd68 50
Kojto 158:b23ee177fd68 51 #if defined (LPUART1)
Kojto 158:b23ee177fd68 52
Kojto 158:b23ee177fd68 53 /** @defgroup LPUART_LL LPUART
Kojto 158:b23ee177fd68 54 * @{
Kojto 158:b23ee177fd68 55 */
Kojto 158:b23ee177fd68 56
Kojto 158:b23ee177fd68 57 /* Private types -------------------------------------------------------------*/
Kojto 158:b23ee177fd68 58 /* Private variables ---------------------------------------------------------*/
Kojto 158:b23ee177fd68 59
Kojto 158:b23ee177fd68 60 /* Private constants ---------------------------------------------------------*/
Kojto 158:b23ee177fd68 61 /** @defgroup LPUART_LL_Private_Constants LPUART Private Constants
Kojto 158:b23ee177fd68 62 * @{
Kojto 158:b23ee177fd68 63 */
Kojto 158:b23ee177fd68 64
Kojto 158:b23ee177fd68 65 /* Defines used for the bit position in the register and perform offsets*/
Kojto 158:b23ee177fd68 66 #define LPUART_POSITION_CR1_DEDT (uint32_t)16U
Kojto 158:b23ee177fd68 67 #define LPUART_POSITION_CR1_DEAT (uint32_t)21U
Kojto 158:b23ee177fd68 68 #define LPUART_POSITION_CR2_ADD (uint32_t)24U
Kojto 158:b23ee177fd68 69
Kojto 158:b23ee177fd68 70 /* Defines used in Baud Rate related macros and corresponding register setting computation */
Kojto 158:b23ee177fd68 71 #define LPUART_LPUARTDIV_FREQ_MUL (uint32_t)(256U)
Kojto 158:b23ee177fd68 72 #define LPUART_BRR_MASK (uint32_t)(0x000FFFFFU)
Kojto 158:b23ee177fd68 73 #define LPUART_BRR_MIN_VALUE (uint32_t)(0x00000300U)
Kojto 158:b23ee177fd68 74 /**
Kojto 158:b23ee177fd68 75 * @}
Kojto 158:b23ee177fd68 76 */
Kojto 158:b23ee177fd68 77
Kojto 158:b23ee177fd68 78
Kojto 158:b23ee177fd68 79 /* Private macros ------------------------------------------------------------*/
Kojto 158:b23ee177fd68 80 #if defined(USE_FULL_LL_DRIVER)
Kojto 158:b23ee177fd68 81 /** @defgroup LPUART_LL_Private_Macros LPUART Private Macros
Kojto 158:b23ee177fd68 82 * @{
Kojto 158:b23ee177fd68 83 */
Kojto 158:b23ee177fd68 84 /**
Kojto 158:b23ee177fd68 85 * @}
Kojto 158:b23ee177fd68 86 */
Kojto 158:b23ee177fd68 87 #endif /*USE_FULL_LL_DRIVER*/
Kojto 158:b23ee177fd68 88
Kojto 158:b23ee177fd68 89 /* Exported types ------------------------------------------------------------*/
Kojto 158:b23ee177fd68 90 #if defined(USE_FULL_LL_DRIVER)
Kojto 158:b23ee177fd68 91 /** @defgroup LPUART_LL_ES_INIT LPUART Exported Init structures
Kojto 158:b23ee177fd68 92 * @{
Kojto 158:b23ee177fd68 93 */
Kojto 158:b23ee177fd68 94
Kojto 158:b23ee177fd68 95 /**
Kojto 158:b23ee177fd68 96 * @brief LL LPUART Init Structure definition
Kojto 158:b23ee177fd68 97 */
Kojto 158:b23ee177fd68 98 typedef struct
Kojto 158:b23ee177fd68 99 {
Kojto 158:b23ee177fd68 100 uint32_t BaudRate; /*!< This field defines expected LPUART communication baud rate.
Kojto 158:b23ee177fd68 101
Kojto 158:b23ee177fd68 102 This feature can be modified afterwards using unitary function @ref LL_LPUART_SetBaudRate().*/
Kojto 158:b23ee177fd68 103
Kojto 158:b23ee177fd68 104 uint32_t DataWidth; /*!< Specifies the number of data bits transmitted or received in a frame.
Kojto 158:b23ee177fd68 105 This parameter can be a value of @ref LPUART_LL_EC_DATAWIDTH.
Kojto 158:b23ee177fd68 106
Kojto 158:b23ee177fd68 107 This feature can be modified afterwards using unitary function @ref LL_LPUART_SetDataWidth().*/
Kojto 158:b23ee177fd68 108
Kojto 158:b23ee177fd68 109 uint32_t StopBits; /*!< Specifies the number of stop bits transmitted.
Kojto 158:b23ee177fd68 110 This parameter can be a value of @ref LPUART_LL_EC_STOPBITS.
Kojto 158:b23ee177fd68 111
Kojto 158:b23ee177fd68 112 This feature can be modified afterwards using unitary function @ref LL_LPUART_SetStopBitsLength().*/
Kojto 158:b23ee177fd68 113
Kojto 158:b23ee177fd68 114 uint32_t Parity; /*!< Specifies the parity mode.
Kojto 158:b23ee177fd68 115 This parameter can be a value of @ref LPUART_LL_EC_PARITY.
Kojto 158:b23ee177fd68 116
Kojto 158:b23ee177fd68 117 This feature can be modified afterwards using unitary function @ref LL_LPUART_SetParity().*/
Kojto 158:b23ee177fd68 118
Kojto 158:b23ee177fd68 119 uint32_t TransferDirection; /*!< Specifies whether the Receive and/or Transmit mode is enabled or disabled.
Kojto 158:b23ee177fd68 120 This parameter can be a value of @ref LPUART_LL_EC_DIRECTION.
Kojto 158:b23ee177fd68 121
Kojto 158:b23ee177fd68 122 This feature can be modified afterwards using unitary function @ref LL_LPUART_SetTransferDirection().*/
Kojto 158:b23ee177fd68 123
Kojto 158:b23ee177fd68 124 uint32_t HardwareFlowControl; /*!< Specifies whether the hardware flow control mode is enabled or disabled.
Kojto 158:b23ee177fd68 125 This parameter can be a value of @ref LPUART_LL_EC_HWCONTROL.
Kojto 158:b23ee177fd68 126
Kojto 158:b23ee177fd68 127 This feature can be modified afterwards using unitary function @ref LL_LPUART_SetHWFlowCtrl().*/
Kojto 158:b23ee177fd68 128
Kojto 158:b23ee177fd68 129 } LL_LPUART_InitTypeDef;
Kojto 158:b23ee177fd68 130
Kojto 158:b23ee177fd68 131 /**
Kojto 158:b23ee177fd68 132 * @}
Kojto 158:b23ee177fd68 133 */
Kojto 158:b23ee177fd68 134 #endif /* USE_FULL_LL_DRIVER */
Kojto 158:b23ee177fd68 135
Kojto 158:b23ee177fd68 136 /* Exported constants --------------------------------------------------------*/
Kojto 158:b23ee177fd68 137 /** @defgroup LPUART_LL_Exported_Constants LPUART Exported Constants
Kojto 158:b23ee177fd68 138 * @{
Kojto 158:b23ee177fd68 139 */
Kojto 158:b23ee177fd68 140
Kojto 158:b23ee177fd68 141 /** @defgroup LPUART_LL_EC_CLEAR_FLAG Clear Flags Defines
Kojto 158:b23ee177fd68 142 * @brief Flags defines which can be used with LL_LPUART_WriteReg function
Kojto 158:b23ee177fd68 143 * @{
Kojto 158:b23ee177fd68 144 */
Kojto 158:b23ee177fd68 145 #define LL_LPUART_ICR_PECF USART_ICR_PECF /*!< Parity error flag */
Kojto 158:b23ee177fd68 146 #define LL_LPUART_ICR_FECF USART_ICR_FECF /*!< Framing error flag */
Kojto 158:b23ee177fd68 147 #define LL_LPUART_ICR_NCF USART_ICR_NCF /*!< Noise detected flag */
Kojto 158:b23ee177fd68 148 #define LL_LPUART_ICR_ORECF USART_ICR_ORECF /*!< Overrun error flag */
Kojto 158:b23ee177fd68 149 #define LL_LPUART_ICR_IDLECF USART_ICR_IDLECF /*!< Idle line detected flag */
Kojto 158:b23ee177fd68 150 #define LL_LPUART_ICR_TCCF USART_ICR_TCCF /*!< Transmission complete flag */
Kojto 158:b23ee177fd68 151 #define LL_LPUART_ICR_CTSCF USART_ICR_CTSCF /*!< CTS flag */
Kojto 158:b23ee177fd68 152 #define LL_LPUART_ICR_CMCF USART_ICR_CMCF /*!< Character match flag */
Kojto 158:b23ee177fd68 153 #define LL_LPUART_ICR_WUCF USART_ICR_WUCF /*!< Wakeup from Stop mode flag */
Kojto 158:b23ee177fd68 154 /**
Kojto 158:b23ee177fd68 155 * @}
Kojto 158:b23ee177fd68 156 */
Kojto 158:b23ee177fd68 157
Kojto 158:b23ee177fd68 158 /** @defgroup LPUART_LL_EC_GET_FLAG Get Flags Defines
Kojto 158:b23ee177fd68 159 * @brief Flags defines which can be used with LL_LPUART_ReadReg function
Kojto 158:b23ee177fd68 160 * @{
Kojto 158:b23ee177fd68 161 */
Kojto 158:b23ee177fd68 162 #define LL_LPUART_ISR_PE USART_ISR_PE /*!< Parity error flag */
Kojto 158:b23ee177fd68 163 #define LL_LPUART_ISR_FE USART_ISR_FE /*!< Framing error flag */
Kojto 158:b23ee177fd68 164 #define LL_LPUART_ISR_NE USART_ISR_NE /*!< Noise detected flag */
Kojto 158:b23ee177fd68 165 #define LL_LPUART_ISR_ORE USART_ISR_ORE /*!< Overrun error flag */
Kojto 158:b23ee177fd68 166 #define LL_LPUART_ISR_IDLE USART_ISR_IDLE /*!< Idle line detected flag */
Kojto 158:b23ee177fd68 167 #define LL_LPUART_ISR_RXNE USART_ISR_RXNE /*!< Read data register not empty flag */
Kojto 158:b23ee177fd68 168 #define LL_LPUART_ISR_TC USART_ISR_TC /*!< Transmission complete flag */
Kojto 158:b23ee177fd68 169 #define LL_LPUART_ISR_TXE USART_ISR_TXE /*!< Transmit data register empty flag */
Kojto 158:b23ee177fd68 170 #define LL_LPUART_ISR_CTSIF USART_ISR_CTSIF /*!< CTS interrupt flag */
Kojto 158:b23ee177fd68 171 #define LL_LPUART_ISR_CTS USART_ISR_CTS /*!< CTS flag */
Kojto 158:b23ee177fd68 172 #define LL_LPUART_ISR_BUSY USART_ISR_BUSY /*!< Busy flag */
Kojto 158:b23ee177fd68 173 #define LL_LPUART_ISR_CMF USART_ISR_CMF /*!< Character match flag */
Kojto 158:b23ee177fd68 174 #define LL_LPUART_ISR_SBKF USART_ISR_SBKF /*!< Send break flag */
Kojto 158:b23ee177fd68 175 #define LL_LPUART_ISR_RWU USART_ISR_RWU /*!< Receiver wakeup from Mute mode flag */
Kojto 158:b23ee177fd68 176 #define LL_LPUART_ISR_WUF USART_ISR_WUF /*!< Wakeup from Stop mode flag */
Kojto 158:b23ee177fd68 177 #define LL_LPUART_ISR_TEACK USART_ISR_TEACK /*!< Transmit enable acknowledge flag */
Kojto 158:b23ee177fd68 178 #define LL_LPUART_ISR_REACK USART_ISR_REACK /*!< Receive enable acknowledge flag */
Kojto 158:b23ee177fd68 179 /**
Kojto 158:b23ee177fd68 180 * @}
Kojto 158:b23ee177fd68 181 */
Kojto 158:b23ee177fd68 182
Kojto 158:b23ee177fd68 183 /** @defgroup LPUART_LL_EC_IT IT Defines
Kojto 158:b23ee177fd68 184 * @brief IT defines which can be used with LL_LPUART_ReadReg and LL_LPUART_WriteReg functions
Kojto 158:b23ee177fd68 185 * @{
Kojto 158:b23ee177fd68 186 */
Kojto 158:b23ee177fd68 187 #define LL_LPUART_CR1_IDLEIE USART_CR1_IDLEIE /*!< IDLE interrupt enable */
Kojto 158:b23ee177fd68 188 #define LL_LPUART_CR1_RXNEIE USART_CR1_RXNEIE /*!< Read data register not empty interrupt enable */
Kojto 158:b23ee177fd68 189 #define LL_LPUART_CR1_TCIE USART_CR1_TCIE /*!< Transmission complete interrupt enable */
Kojto 158:b23ee177fd68 190 #define LL_LPUART_CR1_TXEIE USART_CR1_TXEIE /*!< Transmit data register empty interrupt enable */
Kojto 158:b23ee177fd68 191 #define LL_LPUART_CR1_PEIE USART_CR1_PEIE /*!< Parity error */
Kojto 158:b23ee177fd68 192 #define LL_LPUART_CR1_CMIE USART_CR1_CMIE /*!< Character match interrupt enable */
Kojto 158:b23ee177fd68 193 #define LL_LPUART_CR3_EIE USART_CR3_EIE /*!< Error interrupt enable */
Kojto 158:b23ee177fd68 194 #define LL_LPUART_CR3_CTSIE USART_CR3_CTSIE /*!< CTS interrupt enable */
Kojto 158:b23ee177fd68 195 #define LL_LPUART_CR3_WUFIE USART_CR3_WUFIE /*!< Wakeup from Stop mode interrupt enable */
Kojto 158:b23ee177fd68 196 /**
Kojto 158:b23ee177fd68 197 * @}
Kojto 158:b23ee177fd68 198 */
Kojto 158:b23ee177fd68 199
Kojto 158:b23ee177fd68 200 /** @defgroup LPUART_LL_EC_DIRECTION Direction
Kojto 158:b23ee177fd68 201 * @{
Kojto 158:b23ee177fd68 202 */
Kojto 158:b23ee177fd68 203 #define LL_LPUART_DIRECTION_NONE (uint32_t)0x00000000U /*!< Transmitter and Receiver are disabled */
Kojto 158:b23ee177fd68 204 #define LL_LPUART_DIRECTION_RX USART_CR1_RE /*!< Transmitter is disabled and Receiver is enabled */
Kojto 158:b23ee177fd68 205 #define LL_LPUART_DIRECTION_TX USART_CR1_TE /*!< Transmitter is enabled and Receiver is disabled */
Kojto 158:b23ee177fd68 206 #define LL_LPUART_DIRECTION_TX_RX (USART_CR1_TE |USART_CR1_RE) /*!< Transmitter and Receiver are enabled */
Kojto 158:b23ee177fd68 207 /**
Kojto 158:b23ee177fd68 208 * @}
Kojto 158:b23ee177fd68 209 */
Kojto 158:b23ee177fd68 210
Kojto 158:b23ee177fd68 211 /** @defgroup LPUART_LL_EC_PARITY Parity Control
Kojto 158:b23ee177fd68 212 * @{
Kojto 158:b23ee177fd68 213 */
Kojto 158:b23ee177fd68 214 #define LL_LPUART_PARITY_NONE (uint32_t)0x00000000U /*!< Parity control disabled */
Kojto 158:b23ee177fd68 215 #define LL_LPUART_PARITY_EVEN USART_CR1_PCE /*!< Parity control enabled and Even Parity is selected */
Kojto 158:b23ee177fd68 216 #define LL_LPUART_PARITY_ODD (USART_CR1_PCE | USART_CR1_PS) /*!< Parity control enabled and Odd Parity is selected */
Kojto 158:b23ee177fd68 217 /**
Kojto 158:b23ee177fd68 218 * @}
Kojto 158:b23ee177fd68 219 */
Kojto 158:b23ee177fd68 220
Kojto 158:b23ee177fd68 221 /** @defgroup LPUART_LL_EC_WAKEUP Wakeup
Kojto 158:b23ee177fd68 222 * @{
Kojto 158:b23ee177fd68 223 */
Kojto 158:b23ee177fd68 224 #define LL_LPUART_WAKEUP_IDLELINE (uint32_t)0x00000000U /*!< LPUART wake up from Mute mode on Idle Line */
Kojto 158:b23ee177fd68 225 #define LL_LPUART_WAKEUP_ADDRESSMARK USART_CR1_WAKE /*!< LPUART wake up from Mute mode on Address Mark */
Kojto 158:b23ee177fd68 226 /**
Kojto 158:b23ee177fd68 227 * @}
Kojto 158:b23ee177fd68 228 */
Kojto 158:b23ee177fd68 229
Kojto 158:b23ee177fd68 230 /** @defgroup LPUART_LL_EC_DATAWIDTH Datawidth
Kojto 158:b23ee177fd68 231 * @{
Kojto 158:b23ee177fd68 232 */
Kojto 158:b23ee177fd68 233 #define LL_LPUART_DATAWIDTH_7B USART_CR1_M1 /*!< 7 bits word length : Start bit, 7 data bits, n stop bits */
Kojto 158:b23ee177fd68 234 #define LL_LPUART_DATAWIDTH_8B (uint32_t)0x00000000U /*!< 8 bits word length : Start bit, 8 data bits, n stop bits */
Kojto 158:b23ee177fd68 235 #define LL_LPUART_DATAWIDTH_9B USART_CR1_M0 /*!< 9 bits word length : Start bit, 9 data bits, n stop bits */
Kojto 158:b23ee177fd68 236 /**
Kojto 158:b23ee177fd68 237 * @}
Kojto 158:b23ee177fd68 238 */
Kojto 158:b23ee177fd68 239
Kojto 158:b23ee177fd68 240 /** @defgroup LPUART_LL_EC_STOPBITS Stop Bits
Kojto 158:b23ee177fd68 241 * @{
Kojto 158:b23ee177fd68 242 */
Kojto 158:b23ee177fd68 243 #define LL_LPUART_STOPBITS_1 (uint32_t)0x00000000U /*!< 1 stop bit */
Kojto 158:b23ee177fd68 244 #define LL_LPUART_STOPBITS_2 USART_CR2_STOP_1 /*!< 2 stop bits */
Kojto 158:b23ee177fd68 245 /**
Kojto 158:b23ee177fd68 246 * @}
Kojto 158:b23ee177fd68 247 */
Kojto 158:b23ee177fd68 248
Kojto 158:b23ee177fd68 249 /** @defgroup LPUART_LL_EC_TXRX TX RX Pins Swap
Kojto 158:b23ee177fd68 250 * @{
Kojto 158:b23ee177fd68 251 */
Kojto 158:b23ee177fd68 252 #define LL_LPUART_TXRX_STANDARD (uint32_t)0x00000000U /*!< TX/RX pins are used as defined in standard pinout */
Kojto 158:b23ee177fd68 253 #define LL_LPUART_TXRX_SWAPPED (USART_CR2_SWAP) /*!< TX and RX pins functions are swapped. */
Kojto 158:b23ee177fd68 254 /**
Kojto 158:b23ee177fd68 255 * @}
Kojto 158:b23ee177fd68 256 */
Kojto 158:b23ee177fd68 257
Kojto 158:b23ee177fd68 258 /** @defgroup LPUART_LL_EC_RXPIN_LEVEL RX Pin Active Level Inversion
Kojto 158:b23ee177fd68 259 * @{
Kojto 158:b23ee177fd68 260 */
Kojto 158:b23ee177fd68 261 #define LL_LPUART_RXPIN_LEVEL_STANDARD (uint32_t)0x00000000U /*!< RX pin signal works using the standard logic levels */
Kojto 158:b23ee177fd68 262 #define LL_LPUART_RXPIN_LEVEL_INVERTED (USART_CR2_RXINV) /*!< RX pin signal values are inverted. */
Kojto 158:b23ee177fd68 263 /**
Kojto 158:b23ee177fd68 264 * @}
Kojto 158:b23ee177fd68 265 */
Kojto 158:b23ee177fd68 266
Kojto 158:b23ee177fd68 267 /** @defgroup LPUART_LL_EC_TXPIN_LEVEL TX Pin Active Level Inversion
Kojto 158:b23ee177fd68 268 * @{
Kojto 158:b23ee177fd68 269 */
Kojto 158:b23ee177fd68 270 #define LL_LPUART_TXPIN_LEVEL_STANDARD (uint32_t)0x00000000U /*!< TX pin signal works using the standard logic levels */
Kojto 158:b23ee177fd68 271 #define LL_LPUART_TXPIN_LEVEL_INVERTED (USART_CR2_TXINV) /*!< TX pin signal values are inverted. */
Kojto 158:b23ee177fd68 272 /**
Kojto 158:b23ee177fd68 273 * @}
Kojto 158:b23ee177fd68 274 */
Kojto 158:b23ee177fd68 275
Kojto 158:b23ee177fd68 276 /** @defgroup LPUART_LL_EC_BINARY_LOGIC Binary Data Inversion
Kojto 158:b23ee177fd68 277 * @{
Kojto 158:b23ee177fd68 278 */
Kojto 158:b23ee177fd68 279 #define LL_LPUART_BINARY_LOGIC_POSITIVE (uint32_t)0x00000000U /*!< Logical data from the data register are send/received in positive/direct logic. (1=H, 0=L) */
Kojto 158:b23ee177fd68 280 #define LL_LPUART_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 158:b23ee177fd68 281 /**
Kojto 158:b23ee177fd68 282 * @}
Kojto 158:b23ee177fd68 283 */
Kojto 158:b23ee177fd68 284
Kojto 158:b23ee177fd68 285 /** @defgroup LPUART_LL_EC_BITORDER Bit Order
Kojto 158:b23ee177fd68 286 * @{
Kojto 158:b23ee177fd68 287 */
Kojto 158:b23ee177fd68 288 #define LL_LPUART_BITORDER_LSBFIRST (uint32_t)0x00000000U /*!< data is transmitted/received with data bit 0 first, following the start bit */
Kojto 158:b23ee177fd68 289 #define LL_LPUART_BITORDER_MSBFIRST USART_CR2_MSBFIRST /*!< data is transmitted/received with the MSB first, following the start bit */
Kojto 158:b23ee177fd68 290 /**
Kojto 158:b23ee177fd68 291 * @}
Kojto 158:b23ee177fd68 292 */
Kojto 158:b23ee177fd68 293
Kojto 158:b23ee177fd68 294 /** @defgroup LPUART_LL_EC_ADDRESS_DETECT Address Length Detection
Kojto 158:b23ee177fd68 295 * @{
Kojto 158:b23ee177fd68 296 */
Kojto 158:b23ee177fd68 297 #define LL_LPUART_ADDRESS_DETECT_4B (uint32_t)0x00000000U /*!< 4-bit address detection method selected */
Kojto 158:b23ee177fd68 298 #define LL_LPUART_ADDRESS_DETECT_7B USART_CR2_ADDM7 /*!< 7-bit address detection (in 8-bit data mode) method selected */
Kojto 158:b23ee177fd68 299 /**
Kojto 158:b23ee177fd68 300 * @}
Kojto 158:b23ee177fd68 301 */
Kojto 158:b23ee177fd68 302
Kojto 158:b23ee177fd68 303 /** @defgroup LPUART_LL_EC_HWCONTROL Hardware Control
Kojto 158:b23ee177fd68 304 * @{
Kojto 158:b23ee177fd68 305 */
Kojto 158:b23ee177fd68 306 #define LL_LPUART_HWCONTROL_NONE (uint32_t)0x00000000U /*!< CTS and RTS hardware flow control disabled */
Kojto 158:b23ee177fd68 307 #define LL_LPUART_HWCONTROL_RTS USART_CR3_RTSE /*!< RTS output enabled, data is only requested when there is space in the receive buffer */
Kojto 158:b23ee177fd68 308 #define LL_LPUART_HWCONTROL_CTS USART_CR3_CTSE /*!< CTS mode enabled, data is only transmitted when the nCTS input is asserted (tied to 0) */
Kojto 158:b23ee177fd68 309 #define LL_LPUART_HWCONTROL_RTS_CTS (USART_CR3_RTSE | USART_CR3_CTSE) /*!< CTS and RTS hardware flow control enabled */
Kojto 158:b23ee177fd68 310 /**
Kojto 158:b23ee177fd68 311 * @}
Kojto 158:b23ee177fd68 312 */
Kojto 158:b23ee177fd68 313
Kojto 158:b23ee177fd68 314 /** @defgroup LPUART_LL_EC_WAKEUP_ON Wakeup Activation
Kojto 158:b23ee177fd68 315 * @{
Kojto 158:b23ee177fd68 316 */
Kojto 158:b23ee177fd68 317 #define LL_LPUART_WAKEUP_ON_ADDRESS (uint32_t)0x00000000U /*!< Wake up active on address match */
Kojto 158:b23ee177fd68 318 #define LL_LPUART_WAKEUP_ON_STARTBIT USART_CR3_WUS_1 /*!< Wake up active on Start bit detection */
Kojto 158:b23ee177fd68 319 #define LL_LPUART_WAKEUP_ON_RXNE (USART_CR3_WUS_0 | USART_CR3_WUS_1) /*!< Wake up active on RXNE */
Kojto 158:b23ee177fd68 320 /**
Kojto 158:b23ee177fd68 321 * @}
Kojto 158:b23ee177fd68 322 */
Kojto 158:b23ee177fd68 323
Kojto 158:b23ee177fd68 324 /** @defgroup LPUART_LL_EC_DE_POLARITY Driver Enable Polarity
Kojto 158:b23ee177fd68 325 * @{
Kojto 158:b23ee177fd68 326 */
Kojto 158:b23ee177fd68 327 #define LL_LPUART_DE_POLARITY_HIGH (uint32_t)0x00000000U /*!< DE signal is active high */
Kojto 158:b23ee177fd68 328 #define LL_LPUART_DE_POLARITY_LOW USART_CR3_DEP /*!< DE signal is active low */
Kojto 158:b23ee177fd68 329 /**
Kojto 158:b23ee177fd68 330 * @}
Kojto 158:b23ee177fd68 331 */
Kojto 158:b23ee177fd68 332
Kojto 158:b23ee177fd68 333 /** @defgroup LPUART_LL_EC_DMA_REG_DATA DMA Register Data
Kojto 158:b23ee177fd68 334 * @{
Kojto 158:b23ee177fd68 335 */
Kojto 158:b23ee177fd68 336 #define LL_LPUART_DMA_REG_DATA_TRANSMIT (uint32_t)0U /*!< Get address of data register used for transmission */
Kojto 158:b23ee177fd68 337 #define LL_LPUART_DMA_REG_DATA_RECEIVE (uint32_t)1U /*!< Get address of data register used for reception */
Kojto 158:b23ee177fd68 338 /**
Kojto 158:b23ee177fd68 339 * @}
Kojto 158:b23ee177fd68 340 */
Kojto 158:b23ee177fd68 341
Kojto 158:b23ee177fd68 342 /**
Kojto 158:b23ee177fd68 343 * @}
Kojto 158:b23ee177fd68 344 */
Kojto 158:b23ee177fd68 345
Kojto 158:b23ee177fd68 346 /* Exported macro ------------------------------------------------------------*/
Kojto 158:b23ee177fd68 347 /** @defgroup LPUART_LL_Exported_Macros LPUART Exported Macros
Kojto 158:b23ee177fd68 348 * @{
Kojto 158:b23ee177fd68 349 */
Kojto 158:b23ee177fd68 350
Kojto 158:b23ee177fd68 351 /** @defgroup LPUART_LL_EM_WRITE_READ Common Write and read registers Macros
Kojto 158:b23ee177fd68 352 * @{
Kojto 158:b23ee177fd68 353 */
Kojto 158:b23ee177fd68 354
Kojto 158:b23ee177fd68 355 /**
Kojto 158:b23ee177fd68 356 * @brief Write a value in LPUART register
Kojto 158:b23ee177fd68 357 * @param __INSTANCE__ LPUART Instance
Kojto 158:b23ee177fd68 358 * @param __REG__ Register to be written
Kojto 158:b23ee177fd68 359 * @param __VALUE__ Value to be written in the register
Kojto 158:b23ee177fd68 360 * @retval None
Kojto 158:b23ee177fd68 361 */
Kojto 158:b23ee177fd68 362 #define LL_LPUART_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__))
Kojto 158:b23ee177fd68 363
Kojto 158:b23ee177fd68 364 /**
Kojto 158:b23ee177fd68 365 * @brief Read a value in LPUART register
Kojto 158:b23ee177fd68 366 * @param __INSTANCE__ LPUART Instance
Kojto 158:b23ee177fd68 367 * @param __REG__ Register to be read
Kojto 158:b23ee177fd68 368 * @retval Register value
Kojto 158:b23ee177fd68 369 */
Kojto 158:b23ee177fd68 370 #define LL_LPUART_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__)
Kojto 158:b23ee177fd68 371 /**
Kojto 158:b23ee177fd68 372 * @}
Kojto 158:b23ee177fd68 373 */
Kojto 158:b23ee177fd68 374
Kojto 158:b23ee177fd68 375 /** @defgroup LPUART_LL_EM_Exported_Macros_Helper Helper Macros
Kojto 158:b23ee177fd68 376 * @{
Kojto 158:b23ee177fd68 377 */
Kojto 158:b23ee177fd68 378
Kojto 158:b23ee177fd68 379 /**
Kojto 158:b23ee177fd68 380 * @brief Compute LPUARTDIV value according to Peripheral Clock and
Kojto 158:b23ee177fd68 381 * expected Baud Rate (20-bit value of LPUARTDIV is returned)
Kojto 158:b23ee177fd68 382 * @param __PERIPHCLK__ Peripheral Clock frequency used for LPUART Instance
Kojto 158:b23ee177fd68 383 * @param __BAUDRATE__ Baud Rate value to achieve
Kojto 158:b23ee177fd68 384 * @retval LPUARTDIV value to be used for BRR register filling
Kojto 158:b23ee177fd68 385 */
Kojto 158:b23ee177fd68 386 #define __LL_LPUART_DIV(__PERIPHCLK__, __BAUDRATE__) (((((uint64_t)(__PERIPHCLK__)*LPUART_LPUARTDIV_FREQ_MUL) + ((__BAUDRATE__)/2))/(__BAUDRATE__)) & LPUART_BRR_MASK)
Kojto 158:b23ee177fd68 387
Kojto 158:b23ee177fd68 388 /**
Kojto 158:b23ee177fd68 389 * @}
Kojto 158:b23ee177fd68 390 */
Kojto 158:b23ee177fd68 391
Kojto 158:b23ee177fd68 392 /**
Kojto 158:b23ee177fd68 393 * @}
Kojto 158:b23ee177fd68 394 */
Kojto 158:b23ee177fd68 395
Kojto 158:b23ee177fd68 396 /* Exported functions --------------------------------------------------------*/
Kojto 158:b23ee177fd68 397 /** @defgroup LPUART_LL_Exported_Functions LPUART Exported Functions
Kojto 158:b23ee177fd68 398 * @{
Kojto 158:b23ee177fd68 399 */
Kojto 158:b23ee177fd68 400
Kojto 158:b23ee177fd68 401 /** @defgroup LPUART_LL_EF_Configuration Configuration functions
Kojto 158:b23ee177fd68 402 * @{
Kojto 158:b23ee177fd68 403 */
Kojto 158:b23ee177fd68 404
Kojto 158:b23ee177fd68 405 /**
Kojto 158:b23ee177fd68 406 * @brief LPUART Enable
Kojto 158:b23ee177fd68 407 * @rmtoll CR1 UE LL_LPUART_Enable
Kojto 158:b23ee177fd68 408 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 409 * @retval None
Kojto 158:b23ee177fd68 410 */
Kojto 158:b23ee177fd68 411 __STATIC_INLINE void LL_LPUART_Enable(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 412 {
Kojto 158:b23ee177fd68 413 SET_BIT(LPUARTx->CR1, USART_CR1_UE);
Kojto 158:b23ee177fd68 414 }
Kojto 158:b23ee177fd68 415
Kojto 158:b23ee177fd68 416 /**
Kojto 158:b23ee177fd68 417 * @brief LPUART Disable
Kojto 158:b23ee177fd68 418 * @note When LPUART is disabled, LPUART prescalers and outputs are stopped immediately,
Kojto 158:b23ee177fd68 419 * and current operations are discarded. The configuration of the LPUART is kept, but all the status
Kojto 158:b23ee177fd68 420 * flags, in the LPUARTx_ISR are set to their default values.
Kojto 158:b23ee177fd68 421 * @note In order to go into low-power mode without generating errors on the line,
Kojto 158:b23ee177fd68 422 * the TE bit must be reset before and the software must wait
Kojto 158:b23ee177fd68 423 * for the TC bit in the LPUART_ISR to be set before resetting the UE bit.
Kojto 158:b23ee177fd68 424 * The DMA requests are also reset when UE = 0 so the DMA channel must
Kojto 158:b23ee177fd68 425 * be disabled before resetting the UE bit.
Kojto 158:b23ee177fd68 426 * @rmtoll CR1 UE LL_LPUART_Disable
Kojto 158:b23ee177fd68 427 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 428 * @retval None
Kojto 158:b23ee177fd68 429 */
Kojto 158:b23ee177fd68 430 __STATIC_INLINE void LL_LPUART_Disable(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 431 {
Kojto 158:b23ee177fd68 432 CLEAR_BIT(LPUARTx->CR1, USART_CR1_UE);
Kojto 158:b23ee177fd68 433 }
Kojto 158:b23ee177fd68 434
Kojto 158:b23ee177fd68 435 /**
Kojto 158:b23ee177fd68 436 * @brief Indicate if LPUART is enabled
Kojto 158:b23ee177fd68 437 * @rmtoll CR1 UE LL_LPUART_IsEnabled
Kojto 158:b23ee177fd68 438 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 439 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 440 */
Kojto 158:b23ee177fd68 441 __STATIC_INLINE uint32_t LL_LPUART_IsEnabled(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 442 {
Kojto 158:b23ee177fd68 443 return (READ_BIT(LPUARTx->CR1, USART_CR1_UE) == (USART_CR1_UE));
Kojto 158:b23ee177fd68 444 }
Kojto 158:b23ee177fd68 445
Kojto 158:b23ee177fd68 446 /**
Kojto 158:b23ee177fd68 447 * @brief LPUART enabled in STOP Mode
Kojto 158:b23ee177fd68 448 * @note When this function is enabled, LPUART is able to wake up the MCU from Stop mode, provided that
Kojto 158:b23ee177fd68 449 * LPUART clock selection is HSI or LSE in RCC.
Kojto 158:b23ee177fd68 450 * @rmtoll CR1 UESM LL_LPUART_EnableInStopMode
Kojto 158:b23ee177fd68 451 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 452 * @retval None
Kojto 158:b23ee177fd68 453 */
Kojto 158:b23ee177fd68 454 __STATIC_INLINE void LL_LPUART_EnableInStopMode(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 455 {
Kojto 158:b23ee177fd68 456 SET_BIT(LPUARTx->CR1, USART_CR1_UESM);
Kojto 158:b23ee177fd68 457 }
Kojto 158:b23ee177fd68 458
Kojto 158:b23ee177fd68 459 /**
Kojto 158:b23ee177fd68 460 * @brief LPUART disabled in STOP Mode
Kojto 158:b23ee177fd68 461 * @note When this function is disabled, LPUART is not able to wake up the MCU from Stop mode
Kojto 158:b23ee177fd68 462 * @rmtoll CR1 UESM LL_LPUART_DisableInStopMode
Kojto 158:b23ee177fd68 463 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 464 * @retval None
Kojto 158:b23ee177fd68 465 */
Kojto 158:b23ee177fd68 466 __STATIC_INLINE void LL_LPUART_DisableInStopMode(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 467 {
Kojto 158:b23ee177fd68 468 CLEAR_BIT(LPUARTx->CR1, USART_CR1_UESM);
Kojto 158:b23ee177fd68 469 }
Kojto 158:b23ee177fd68 470
Kojto 158:b23ee177fd68 471 /**
Kojto 158:b23ee177fd68 472 * @brief Indicate if LPUART is enabled in STOP Mode
Kojto 158:b23ee177fd68 473 * (able to wake up MCU from Stop mode or not)
Kojto 158:b23ee177fd68 474 * @rmtoll CR1 UESM LL_LPUART_IsEnabledInStopMode
Kojto 158:b23ee177fd68 475 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 476 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 477 */
Kojto 158:b23ee177fd68 478 __STATIC_INLINE uint32_t LL_LPUART_IsEnabledInStopMode(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 479 {
Kojto 158:b23ee177fd68 480 return (READ_BIT(LPUARTx->CR1, USART_CR1_UESM) == (USART_CR1_UESM));
Kojto 158:b23ee177fd68 481 }
Kojto 158:b23ee177fd68 482
Kojto 158:b23ee177fd68 483 /**
Kojto 158:b23ee177fd68 484 * @brief Receiver Enable (Receiver is enabled and begins searching for a start bit)
Kojto 158:b23ee177fd68 485 * @rmtoll CR1 RE LL_LPUART_EnableDirectionRx
Kojto 158:b23ee177fd68 486 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 487 * @retval None
Kojto 158:b23ee177fd68 488 */
Kojto 158:b23ee177fd68 489 __STATIC_INLINE void LL_LPUART_EnableDirectionRx(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 490 {
Kojto 158:b23ee177fd68 491 SET_BIT(LPUARTx->CR1, USART_CR1_RE);
Kojto 158:b23ee177fd68 492 }
Kojto 158:b23ee177fd68 493
Kojto 158:b23ee177fd68 494 /**
Kojto 158:b23ee177fd68 495 * @brief Receiver Disable
Kojto 158:b23ee177fd68 496 * @rmtoll CR1 RE LL_LPUART_DisableDirectionRx
Kojto 158:b23ee177fd68 497 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 498 * @retval None
Kojto 158:b23ee177fd68 499 */
Kojto 158:b23ee177fd68 500 __STATIC_INLINE void LL_LPUART_DisableDirectionRx(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 501 {
Kojto 158:b23ee177fd68 502 CLEAR_BIT(LPUARTx->CR1, USART_CR1_RE);
Kojto 158:b23ee177fd68 503 }
Kojto 158:b23ee177fd68 504
Kojto 158:b23ee177fd68 505 /**
Kojto 158:b23ee177fd68 506 * @brief Transmitter Enable
Kojto 158:b23ee177fd68 507 * @rmtoll CR1 TE LL_LPUART_EnableDirectionTx
Kojto 158:b23ee177fd68 508 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 509 * @retval None
Kojto 158:b23ee177fd68 510 */
Kojto 158:b23ee177fd68 511 __STATIC_INLINE void LL_LPUART_EnableDirectionTx(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 512 {
Kojto 158:b23ee177fd68 513 SET_BIT(LPUARTx->CR1, USART_CR1_TE);
Kojto 158:b23ee177fd68 514 }
Kojto 158:b23ee177fd68 515
Kojto 158:b23ee177fd68 516 /**
Kojto 158:b23ee177fd68 517 * @brief Transmitter Disable
Kojto 158:b23ee177fd68 518 * @rmtoll CR1 TE LL_LPUART_DisableDirectionTx
Kojto 158:b23ee177fd68 519 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 520 * @retval None
Kojto 158:b23ee177fd68 521 */
Kojto 158:b23ee177fd68 522 __STATIC_INLINE void LL_LPUART_DisableDirectionTx(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 523 {
Kojto 158:b23ee177fd68 524 CLEAR_BIT(LPUARTx->CR1, USART_CR1_TE);
Kojto 158:b23ee177fd68 525 }
Kojto 158:b23ee177fd68 526
Kojto 158:b23ee177fd68 527 /**
Kojto 158:b23ee177fd68 528 * @brief Configure simultaneously enabled/disabled states
Kojto 158:b23ee177fd68 529 * of Transmitter and Receiver
Kojto 158:b23ee177fd68 530 * @rmtoll CR1 RE LL_LPUART_SetTransferDirection\n
Kojto 158:b23ee177fd68 531 * CR1 TE LL_LPUART_SetTransferDirection
Kojto 158:b23ee177fd68 532 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 533 * @param TransferDirection This parameter can be one of the following values:
Kojto 158:b23ee177fd68 534 * @arg @ref LL_LPUART_DIRECTION_NONE
Kojto 158:b23ee177fd68 535 * @arg @ref LL_LPUART_DIRECTION_RX
Kojto 158:b23ee177fd68 536 * @arg @ref LL_LPUART_DIRECTION_TX
Kojto 158:b23ee177fd68 537 * @arg @ref LL_LPUART_DIRECTION_TX_RX
Kojto 158:b23ee177fd68 538 * @retval None
Kojto 158:b23ee177fd68 539 */
Kojto 158:b23ee177fd68 540 __STATIC_INLINE void LL_LPUART_SetTransferDirection(USART_TypeDef *LPUARTx, uint32_t TransferDirection)
Kojto 158:b23ee177fd68 541 {
Kojto 158:b23ee177fd68 542 MODIFY_REG(LPUARTx->CR1, USART_CR1_RE | USART_CR1_TE, TransferDirection);
Kojto 158:b23ee177fd68 543 }
Kojto 158:b23ee177fd68 544
Kojto 158:b23ee177fd68 545 /**
Kojto 158:b23ee177fd68 546 * @brief Return enabled/disabled states of Transmitter and Receiver
Kojto 158:b23ee177fd68 547 * @rmtoll CR1 RE LL_LPUART_GetTransferDirection\n
Kojto 158:b23ee177fd68 548 * CR1 TE LL_LPUART_GetTransferDirection
Kojto 158:b23ee177fd68 549 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 550 * @retval Returned value can be one of the following values:
Kojto 158:b23ee177fd68 551 * @arg @ref LL_LPUART_DIRECTION_NONE
Kojto 158:b23ee177fd68 552 * @arg @ref LL_LPUART_DIRECTION_RX
Kojto 158:b23ee177fd68 553 * @arg @ref LL_LPUART_DIRECTION_TX
Kojto 158:b23ee177fd68 554 * @arg @ref LL_LPUART_DIRECTION_TX_RX
Kojto 158:b23ee177fd68 555 */
Kojto 158:b23ee177fd68 556 __STATIC_INLINE uint32_t LL_LPUART_GetTransferDirection(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 557 {
Kojto 158:b23ee177fd68 558 return (uint32_t)(READ_BIT(LPUARTx->CR1, USART_CR1_RE | USART_CR1_TE));
Kojto 158:b23ee177fd68 559 }
Kojto 158:b23ee177fd68 560
Kojto 158:b23ee177fd68 561 /**
Kojto 158:b23ee177fd68 562 * @brief Configure Parity (enabled/disabled and parity mode if enabled)
Kojto 158:b23ee177fd68 563 * @note This function selects if hardware parity control (generation and detection) is enabled or disabled.
Kojto 158:b23ee177fd68 564 * When the parity control is enabled (Odd or Even), computed parity bit is inserted at the MSB position
Kojto 158:b23ee177fd68 565 * (depending on data width) and parity is checked on the received data.
Kojto 158:b23ee177fd68 566 * @rmtoll CR1 PS LL_LPUART_SetParity\n
Kojto 158:b23ee177fd68 567 * CR1 PCE LL_LPUART_SetParity
Kojto 158:b23ee177fd68 568 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 569 * @param Parity This parameter can be one of the following values:
Kojto 158:b23ee177fd68 570 * @arg @ref LL_LPUART_PARITY_NONE
Kojto 158:b23ee177fd68 571 * @arg @ref LL_LPUART_PARITY_EVEN
Kojto 158:b23ee177fd68 572 * @arg @ref LL_LPUART_PARITY_ODD
Kojto 158:b23ee177fd68 573 * @retval None
Kojto 158:b23ee177fd68 574 */
Kojto 158:b23ee177fd68 575 __STATIC_INLINE void LL_LPUART_SetParity(USART_TypeDef *LPUARTx, uint32_t Parity)
Kojto 158:b23ee177fd68 576 {
Kojto 158:b23ee177fd68 577 MODIFY_REG(LPUARTx->CR1, USART_CR1_PS | USART_CR1_PCE, Parity);
Kojto 158:b23ee177fd68 578 }
Kojto 158:b23ee177fd68 579
Kojto 158:b23ee177fd68 580 /**
Kojto 158:b23ee177fd68 581 * @brief Return Parity configuration (enabled/disabled and parity mode if enabled)
Kojto 158:b23ee177fd68 582 * @rmtoll CR1 PS LL_LPUART_GetParity\n
Kojto 158:b23ee177fd68 583 * CR1 PCE LL_LPUART_GetParity
Kojto 158:b23ee177fd68 584 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 585 * @retval Returned value can be one of the following values:
Kojto 158:b23ee177fd68 586 * @arg @ref LL_LPUART_PARITY_NONE
Kojto 158:b23ee177fd68 587 * @arg @ref LL_LPUART_PARITY_EVEN
Kojto 158:b23ee177fd68 588 * @arg @ref LL_LPUART_PARITY_ODD
Kojto 158:b23ee177fd68 589 */
Kojto 158:b23ee177fd68 590 __STATIC_INLINE uint32_t LL_LPUART_GetParity(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 591 {
Kojto 158:b23ee177fd68 592 return (uint32_t)(READ_BIT(LPUARTx->CR1, USART_CR1_PS | USART_CR1_PCE));
Kojto 158:b23ee177fd68 593 }
Kojto 158:b23ee177fd68 594
Kojto 158:b23ee177fd68 595 /**
Kojto 158:b23ee177fd68 596 * @brief Set Receiver Wake Up method from Mute mode.
Kojto 158:b23ee177fd68 597 * @rmtoll CR1 WAKE LL_LPUART_SetWakeUpMethod
Kojto 158:b23ee177fd68 598 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 599 * @param Method This parameter can be one of the following values:
Kojto 158:b23ee177fd68 600 * @arg @ref LL_LPUART_WAKEUP_IDLELINE
Kojto 158:b23ee177fd68 601 * @arg @ref LL_LPUART_WAKEUP_ADDRESSMARK
Kojto 158:b23ee177fd68 602 * @retval None
Kojto 158:b23ee177fd68 603 */
Kojto 158:b23ee177fd68 604 __STATIC_INLINE void LL_LPUART_SetWakeUpMethod(USART_TypeDef *LPUARTx, uint32_t Method)
Kojto 158:b23ee177fd68 605 {
Kojto 158:b23ee177fd68 606 MODIFY_REG(LPUARTx->CR1, USART_CR1_WAKE, Method);
Kojto 158:b23ee177fd68 607 }
Kojto 158:b23ee177fd68 608
Kojto 158:b23ee177fd68 609 /**
Kojto 158:b23ee177fd68 610 * @brief Return Receiver Wake Up method from Mute mode
Kojto 158:b23ee177fd68 611 * @rmtoll CR1 WAKE LL_LPUART_GetWakeUpMethod
Kojto 158:b23ee177fd68 612 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 613 * @retval Returned value can be one of the following values:
Kojto 158:b23ee177fd68 614 * @arg @ref LL_LPUART_WAKEUP_IDLELINE
Kojto 158:b23ee177fd68 615 * @arg @ref LL_LPUART_WAKEUP_ADDRESSMARK
Kojto 158:b23ee177fd68 616 */
Kojto 158:b23ee177fd68 617 __STATIC_INLINE uint32_t LL_LPUART_GetWakeUpMethod(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 618 {
Kojto 158:b23ee177fd68 619 return (uint32_t)(READ_BIT(LPUARTx->CR1, USART_CR1_WAKE));
Kojto 158:b23ee177fd68 620 }
Kojto 158:b23ee177fd68 621
Kojto 158:b23ee177fd68 622 /**
Kojto 158:b23ee177fd68 623 * @brief Set Word length (nb of data bits, excluding start and stop bits)
Kojto 158:b23ee177fd68 624 * @rmtoll CR1 M LL_LPUART_SetDataWidth
Kojto 158:b23ee177fd68 625 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 626 * @param DataWidth This parameter can be one of the following values:
Kojto 158:b23ee177fd68 627 * @arg @ref LL_LPUART_DATAWIDTH_7B
Kojto 158:b23ee177fd68 628 * @arg @ref LL_LPUART_DATAWIDTH_8B
Kojto 158:b23ee177fd68 629 * @arg @ref LL_LPUART_DATAWIDTH_9B
Kojto 158:b23ee177fd68 630 * @retval None
Kojto 158:b23ee177fd68 631 */
Kojto 158:b23ee177fd68 632 __STATIC_INLINE void LL_LPUART_SetDataWidth(USART_TypeDef *LPUARTx, uint32_t DataWidth)
Kojto 158:b23ee177fd68 633 {
Kojto 158:b23ee177fd68 634 MODIFY_REG(LPUARTx->CR1, USART_CR1_M, DataWidth);
Kojto 158:b23ee177fd68 635 }
Kojto 158:b23ee177fd68 636
Kojto 158:b23ee177fd68 637 /**
Kojto 158:b23ee177fd68 638 * @brief Return Word length (i.e. nb of data bits, excluding start and stop bits)
Kojto 158:b23ee177fd68 639 * @rmtoll CR1 M LL_LPUART_GetDataWidth
Kojto 158:b23ee177fd68 640 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 641 * @retval Returned value can be one of the following values:
Kojto 158:b23ee177fd68 642 * @arg @ref LL_LPUART_DATAWIDTH_7B
Kojto 158:b23ee177fd68 643 * @arg @ref LL_LPUART_DATAWIDTH_8B
Kojto 158:b23ee177fd68 644 * @arg @ref LL_LPUART_DATAWIDTH_9B
Kojto 158:b23ee177fd68 645 */
Kojto 158:b23ee177fd68 646 __STATIC_INLINE uint32_t LL_LPUART_GetDataWidth(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 647 {
Kojto 158:b23ee177fd68 648 return (uint32_t)(READ_BIT(LPUARTx->CR1, USART_CR1_M));
Kojto 158:b23ee177fd68 649 }
Kojto 158:b23ee177fd68 650
Kojto 158:b23ee177fd68 651 /**
Kojto 158:b23ee177fd68 652 * @brief Allow switch between Mute Mode and Active mode
Kojto 158:b23ee177fd68 653 * @rmtoll CR1 MME LL_LPUART_EnableMuteMode
Kojto 158:b23ee177fd68 654 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 655 * @retval None
Kojto 158:b23ee177fd68 656 */
Kojto 158:b23ee177fd68 657 __STATIC_INLINE void LL_LPUART_EnableMuteMode(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 658 {
Kojto 158:b23ee177fd68 659 SET_BIT(LPUARTx->CR1, USART_CR1_MME);
Kojto 158:b23ee177fd68 660 }
Kojto 158:b23ee177fd68 661
Kojto 158:b23ee177fd68 662 /**
Kojto 158:b23ee177fd68 663 * @brief Prevent Mute Mode use. Set Receiver in active mode permanently.
Kojto 158:b23ee177fd68 664 * @rmtoll CR1 MME LL_LPUART_DisableMuteMode
Kojto 158:b23ee177fd68 665 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 666 * @retval None
Kojto 158:b23ee177fd68 667 */
Kojto 158:b23ee177fd68 668 __STATIC_INLINE void LL_LPUART_DisableMuteMode(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 669 {
Kojto 158:b23ee177fd68 670 CLEAR_BIT(LPUARTx->CR1, USART_CR1_MME);
Kojto 158:b23ee177fd68 671 }
Kojto 158:b23ee177fd68 672
Kojto 158:b23ee177fd68 673 /**
Kojto 158:b23ee177fd68 674 * @brief Indicate if switch between Mute Mode and Active mode is allowed
Kojto 158:b23ee177fd68 675 * @rmtoll CR1 MME LL_LPUART_IsEnabledMuteMode
Kojto 158:b23ee177fd68 676 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 677 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 678 */
Kojto 158:b23ee177fd68 679 __STATIC_INLINE uint32_t LL_LPUART_IsEnabledMuteMode(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 680 {
Kojto 158:b23ee177fd68 681 return (READ_BIT(LPUARTx->CR1, USART_CR1_MME) == (USART_CR1_MME));
Kojto 158:b23ee177fd68 682 }
Kojto 158:b23ee177fd68 683
Kojto 158:b23ee177fd68 684 /**
Kojto 158:b23ee177fd68 685 * @brief Set the length of the stop bits
Kojto 158:b23ee177fd68 686 * @rmtoll CR2 STOP LL_LPUART_SetStopBitsLength
Kojto 158:b23ee177fd68 687 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 688 * @param StopBits This parameter can be one of the following values:
Kojto 158:b23ee177fd68 689 * @arg @ref LL_LPUART_STOPBITS_1
Kojto 158:b23ee177fd68 690 * @arg @ref LL_LPUART_STOPBITS_2
Kojto 158:b23ee177fd68 691 * @retval None
Kojto 158:b23ee177fd68 692 */
Kojto 158:b23ee177fd68 693 __STATIC_INLINE void LL_LPUART_SetStopBitsLength(USART_TypeDef *LPUARTx, uint32_t StopBits)
Kojto 158:b23ee177fd68 694 {
Kojto 158:b23ee177fd68 695 MODIFY_REG(LPUARTx->CR2, USART_CR2_STOP, StopBits);
Kojto 158:b23ee177fd68 696 }
Kojto 158:b23ee177fd68 697
Kojto 158:b23ee177fd68 698 /**
Kojto 158:b23ee177fd68 699 * @brief Retrieve the length of the stop bits
Kojto 158:b23ee177fd68 700 * @rmtoll CR2 STOP LL_LPUART_GetStopBitsLength
Kojto 158:b23ee177fd68 701 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 702 * @retval Returned value can be one of the following values:
Kojto 158:b23ee177fd68 703 * @arg @ref LL_LPUART_STOPBITS_1
Kojto 158:b23ee177fd68 704 * @arg @ref LL_LPUART_STOPBITS_2
Kojto 158:b23ee177fd68 705 */
Kojto 158:b23ee177fd68 706 __STATIC_INLINE uint32_t LL_LPUART_GetStopBitsLength(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 707 {
Kojto 158:b23ee177fd68 708 return (uint32_t)(READ_BIT(LPUARTx->CR2, USART_CR2_STOP));
Kojto 158:b23ee177fd68 709 }
Kojto 158:b23ee177fd68 710
Kojto 158:b23ee177fd68 711 /**
Kojto 158:b23ee177fd68 712 * @brief Configure Character frame format (Datawidth, Parity control, Stop Bits)
Kojto 158:b23ee177fd68 713 * @note Call of this function is equivalent to following function call sequence :
Kojto 158:b23ee177fd68 714 * - Data Width configuration using @ref LL_LPUART_SetDataWidth() function
Kojto 158:b23ee177fd68 715 * - Parity Control and mode configuration using @ref LL_LPUART_SetParity() function
Kojto 158:b23ee177fd68 716 * - Stop bits configuration using @ref LL_LPUART_SetStopBitsLength() function
Kojto 158:b23ee177fd68 717 * @rmtoll CR1 PS LL_LPUART_ConfigCharacter\n
Kojto 158:b23ee177fd68 718 * CR1 PCE LL_LPUART_ConfigCharacter\n
Kojto 158:b23ee177fd68 719 * CR1 M LL_LPUART_ConfigCharacter\n
Kojto 158:b23ee177fd68 720 * CR2 STOP LL_LPUART_ConfigCharacter
Kojto 158:b23ee177fd68 721 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 722 * @param DataWidth This parameter can be one of the following values:
Kojto 158:b23ee177fd68 723 * @arg @ref LL_LPUART_DATAWIDTH_7B
Kojto 158:b23ee177fd68 724 * @arg @ref LL_LPUART_DATAWIDTH_8B
Kojto 158:b23ee177fd68 725 * @arg @ref LL_LPUART_DATAWIDTH_9B
Kojto 158:b23ee177fd68 726 * @param Parity This parameter can be one of the following values:
Kojto 158:b23ee177fd68 727 * @arg @ref LL_LPUART_PARITY_NONE
Kojto 158:b23ee177fd68 728 * @arg @ref LL_LPUART_PARITY_EVEN
Kojto 158:b23ee177fd68 729 * @arg @ref LL_LPUART_PARITY_ODD
Kojto 158:b23ee177fd68 730 * @param StopBits This parameter can be one of the following values:
Kojto 158:b23ee177fd68 731 * @arg @ref LL_LPUART_STOPBITS_1
Kojto 158:b23ee177fd68 732 * @arg @ref LL_LPUART_STOPBITS_2
Kojto 158:b23ee177fd68 733 * @retval None
Kojto 158:b23ee177fd68 734 */
Kojto 158:b23ee177fd68 735 __STATIC_INLINE void LL_LPUART_ConfigCharacter(USART_TypeDef *LPUARTx, uint32_t DataWidth, uint32_t Parity,
Kojto 158:b23ee177fd68 736 uint32_t StopBits)
Kojto 158:b23ee177fd68 737 {
Kojto 158:b23ee177fd68 738 MODIFY_REG(LPUARTx->CR1, USART_CR1_PS | USART_CR1_PCE | USART_CR1_M, Parity | DataWidth);
Kojto 158:b23ee177fd68 739 MODIFY_REG(LPUARTx->CR2, USART_CR2_STOP, StopBits);
Kojto 158:b23ee177fd68 740 }
Kojto 158:b23ee177fd68 741
Kojto 158:b23ee177fd68 742 /**
Kojto 158:b23ee177fd68 743 * @brief Configure TX/RX pins swapping setting.
Kojto 158:b23ee177fd68 744 * @rmtoll CR2 SWAP LL_LPUART_SetTXRXSwap
Kojto 158:b23ee177fd68 745 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 746 * @param SwapConfig This parameter can be one of the following values:
Kojto 158:b23ee177fd68 747 * @arg @ref LL_LPUART_TXRX_STANDARD
Kojto 158:b23ee177fd68 748 * @arg @ref LL_LPUART_TXRX_SWAPPED
Kojto 158:b23ee177fd68 749 * @retval None
Kojto 158:b23ee177fd68 750 */
Kojto 158:b23ee177fd68 751 __STATIC_INLINE void LL_LPUART_SetTXRXSwap(USART_TypeDef *LPUARTx, uint32_t SwapConfig)
Kojto 158:b23ee177fd68 752 {
Kojto 158:b23ee177fd68 753 MODIFY_REG(LPUARTx->CR2, USART_CR2_SWAP, SwapConfig);
Kojto 158:b23ee177fd68 754 }
Kojto 158:b23ee177fd68 755
Kojto 158:b23ee177fd68 756 /**
Kojto 158:b23ee177fd68 757 * @brief Retrieve TX/RX pins swapping configuration.
Kojto 158:b23ee177fd68 758 * @rmtoll CR2 SWAP LL_LPUART_GetTXRXSwap
Kojto 158:b23ee177fd68 759 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 760 * @retval Returned value can be one of the following values:
Kojto 158:b23ee177fd68 761 * @arg @ref LL_LPUART_TXRX_STANDARD
Kojto 158:b23ee177fd68 762 * @arg @ref LL_LPUART_TXRX_SWAPPED
Kojto 158:b23ee177fd68 763 */
Kojto 158:b23ee177fd68 764 __STATIC_INLINE uint32_t LL_LPUART_GetTXRXSwap(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 765 {
Kojto 158:b23ee177fd68 766 return (uint32_t)(READ_BIT(LPUARTx->CR2, USART_CR2_SWAP));
Kojto 158:b23ee177fd68 767 }
Kojto 158:b23ee177fd68 768
Kojto 158:b23ee177fd68 769 /**
Kojto 158:b23ee177fd68 770 * @brief Configure RX pin active level logic
Kojto 158:b23ee177fd68 771 * @rmtoll CR2 RXINV LL_LPUART_SetRXPinLevel
Kojto 158:b23ee177fd68 772 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 773 * @param PinInvMethod This parameter can be one of the following values:
Kojto 158:b23ee177fd68 774 * @arg @ref LL_LPUART_RXPIN_LEVEL_STANDARD
Kojto 158:b23ee177fd68 775 * @arg @ref LL_LPUART_RXPIN_LEVEL_INVERTED
Kojto 158:b23ee177fd68 776 * @retval None
Kojto 158:b23ee177fd68 777 */
Kojto 158:b23ee177fd68 778 __STATIC_INLINE void LL_LPUART_SetRXPinLevel(USART_TypeDef *LPUARTx, uint32_t PinInvMethod)
Kojto 158:b23ee177fd68 779 {
Kojto 158:b23ee177fd68 780 MODIFY_REG(LPUARTx->CR2, USART_CR2_RXINV, PinInvMethod);
Kojto 158:b23ee177fd68 781 }
Kojto 158:b23ee177fd68 782
Kojto 158:b23ee177fd68 783 /**
Kojto 158:b23ee177fd68 784 * @brief Retrieve RX pin active level logic configuration
Kojto 158:b23ee177fd68 785 * @rmtoll CR2 RXINV LL_LPUART_GetRXPinLevel
Kojto 158:b23ee177fd68 786 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 787 * @retval Returned value can be one of the following values:
Kojto 158:b23ee177fd68 788 * @arg @ref LL_LPUART_RXPIN_LEVEL_STANDARD
Kojto 158:b23ee177fd68 789 * @arg @ref LL_LPUART_RXPIN_LEVEL_INVERTED
Kojto 158:b23ee177fd68 790 */
Kojto 158:b23ee177fd68 791 __STATIC_INLINE uint32_t LL_LPUART_GetRXPinLevel(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 792 {
Kojto 158:b23ee177fd68 793 return (uint32_t)(READ_BIT(LPUARTx->CR2, USART_CR2_RXINV));
Kojto 158:b23ee177fd68 794 }
Kojto 158:b23ee177fd68 795
Kojto 158:b23ee177fd68 796 /**
Kojto 158:b23ee177fd68 797 * @brief Configure TX pin active level logic
Kojto 158:b23ee177fd68 798 * @rmtoll CR2 TXINV LL_LPUART_SetTXPinLevel
Kojto 158:b23ee177fd68 799 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 800 * @param PinInvMethod This parameter can be one of the following values:
Kojto 158:b23ee177fd68 801 * @arg @ref LL_LPUART_TXPIN_LEVEL_STANDARD
Kojto 158:b23ee177fd68 802 * @arg @ref LL_LPUART_TXPIN_LEVEL_INVERTED
Kojto 158:b23ee177fd68 803 * @retval None
Kojto 158:b23ee177fd68 804 */
Kojto 158:b23ee177fd68 805 __STATIC_INLINE void LL_LPUART_SetTXPinLevel(USART_TypeDef *LPUARTx, uint32_t PinInvMethod)
Kojto 158:b23ee177fd68 806 {
Kojto 158:b23ee177fd68 807 MODIFY_REG(LPUARTx->CR2, USART_CR2_TXINV, PinInvMethod);
Kojto 158:b23ee177fd68 808 }
Kojto 158:b23ee177fd68 809
Kojto 158:b23ee177fd68 810 /**
Kojto 158:b23ee177fd68 811 * @brief Retrieve TX pin active level logic configuration
Kojto 158:b23ee177fd68 812 * @rmtoll CR2 TXINV LL_LPUART_GetTXPinLevel
Kojto 158:b23ee177fd68 813 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 814 * @retval Returned value can be one of the following values:
Kojto 158:b23ee177fd68 815 * @arg @ref LL_LPUART_TXPIN_LEVEL_STANDARD
Kojto 158:b23ee177fd68 816 * @arg @ref LL_LPUART_TXPIN_LEVEL_INVERTED
Kojto 158:b23ee177fd68 817 */
Kojto 158:b23ee177fd68 818 __STATIC_INLINE uint32_t LL_LPUART_GetTXPinLevel(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 819 {
Kojto 158:b23ee177fd68 820 return (uint32_t)(READ_BIT(LPUARTx->CR2, USART_CR2_TXINV));
Kojto 158:b23ee177fd68 821 }
Kojto 158:b23ee177fd68 822
Kojto 158:b23ee177fd68 823 /**
Kojto 158:b23ee177fd68 824 * @brief Configure Binary data logic.
Kojto 158:b23ee177fd68 825 *
Kojto 158:b23ee177fd68 826 * @note Allow to define how Logical data from the data register are send/received :
Kojto 158:b23ee177fd68 827 * either in positive/direct logic (1=H, 0=L) or in negative/inverse logic (1=L, 0=H)
Kojto 158:b23ee177fd68 828 * @rmtoll CR2 DATAINV LL_LPUART_SetBinaryDataLogic
Kojto 158:b23ee177fd68 829 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 830 * @param DataLogic This parameter can be one of the following values:
Kojto 158:b23ee177fd68 831 * @arg @ref LL_LPUART_BINARY_LOGIC_POSITIVE
Kojto 158:b23ee177fd68 832 * @arg @ref LL_LPUART_BINARY_LOGIC_NEGATIVE
Kojto 158:b23ee177fd68 833 * @retval None
Kojto 158:b23ee177fd68 834 */
Kojto 158:b23ee177fd68 835 __STATIC_INLINE void LL_LPUART_SetBinaryDataLogic(USART_TypeDef *LPUARTx, uint32_t DataLogic)
Kojto 158:b23ee177fd68 836 {
Kojto 158:b23ee177fd68 837 MODIFY_REG(LPUARTx->CR2, USART_CR2_DATAINV, DataLogic);
Kojto 158:b23ee177fd68 838 }
Kojto 158:b23ee177fd68 839
Kojto 158:b23ee177fd68 840 /**
Kojto 158:b23ee177fd68 841 * @brief Retrieve Binary data configuration
Kojto 158:b23ee177fd68 842 * @rmtoll CR2 DATAINV LL_LPUART_GetBinaryDataLogic
Kojto 158:b23ee177fd68 843 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 844 * @retval Returned value can be one of the following values:
Kojto 158:b23ee177fd68 845 * @arg @ref LL_LPUART_BINARY_LOGIC_POSITIVE
Kojto 158:b23ee177fd68 846 * @arg @ref LL_LPUART_BINARY_LOGIC_NEGATIVE
Kojto 158:b23ee177fd68 847 */
Kojto 158:b23ee177fd68 848 __STATIC_INLINE uint32_t LL_LPUART_GetBinaryDataLogic(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 849 {
Kojto 158:b23ee177fd68 850 return (uint32_t)(READ_BIT(LPUARTx->CR2, USART_CR2_DATAINV));
Kojto 158:b23ee177fd68 851 }
Kojto 158:b23ee177fd68 852
Kojto 158:b23ee177fd68 853 /**
Kojto 158:b23ee177fd68 854 * @brief Configure transfer bit order (either Less or Most Significant Bit First)
Kojto 158:b23ee177fd68 855 * @note MSB First means data is transmitted/received with the MSB first, following the start bit.
Kojto 158:b23ee177fd68 856 * LSB First means data is transmitted/received with data bit 0 first, following the start bit.
Kojto 158:b23ee177fd68 857 * @rmtoll CR2 MSBFIRST LL_LPUART_SetTransferBitOrder
Kojto 158:b23ee177fd68 858 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 859 * @param BitOrder This parameter can be one of the following values:
Kojto 158:b23ee177fd68 860 * @arg @ref LL_LPUART_BITORDER_LSBFIRST
Kojto 158:b23ee177fd68 861 * @arg @ref LL_LPUART_BITORDER_MSBFIRST
Kojto 158:b23ee177fd68 862 * @retval None
Kojto 158:b23ee177fd68 863 */
Kojto 158:b23ee177fd68 864 __STATIC_INLINE void LL_LPUART_SetTransferBitOrder(USART_TypeDef *LPUARTx, uint32_t BitOrder)
Kojto 158:b23ee177fd68 865 {
Kojto 158:b23ee177fd68 866 MODIFY_REG(LPUARTx->CR2, USART_CR2_MSBFIRST, BitOrder);
Kojto 158:b23ee177fd68 867 }
Kojto 158:b23ee177fd68 868
Kojto 158:b23ee177fd68 869 /**
Kojto 158:b23ee177fd68 870 * @brief Return transfer bit order (either Less or Most Significant Bit First)
Kojto 158:b23ee177fd68 871 * @note MSB First means data is transmitted/received with the MSB first, following the start bit.
Kojto 158:b23ee177fd68 872 * LSB First means data is transmitted/received with data bit 0 first, following the start bit.
Kojto 158:b23ee177fd68 873 * @rmtoll CR2 MSBFIRST LL_LPUART_GetTransferBitOrder
Kojto 158:b23ee177fd68 874 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 875 * @retval Returned value can be one of the following values:
Kojto 158:b23ee177fd68 876 * @arg @ref LL_LPUART_BITORDER_LSBFIRST
Kojto 158:b23ee177fd68 877 * @arg @ref LL_LPUART_BITORDER_MSBFIRST
Kojto 158:b23ee177fd68 878 */
Kojto 158:b23ee177fd68 879 __STATIC_INLINE uint32_t LL_LPUART_GetTransferBitOrder(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 880 {
Kojto 158:b23ee177fd68 881 return (uint32_t)(READ_BIT(LPUARTx->CR2, USART_CR2_MSBFIRST));
Kojto 158:b23ee177fd68 882 }
Kojto 158:b23ee177fd68 883
Kojto 158:b23ee177fd68 884 /**
Kojto 158:b23ee177fd68 885 * @brief Set Address of the LPUART node.
Kojto 158:b23ee177fd68 886 * @note This is used in multiprocessor communication during Mute mode or Stop mode,
Kojto 158:b23ee177fd68 887 * for wake up with address mark detection.
Kojto 158:b23ee177fd68 888 * @note 4bits address node is used when 4-bit Address Detection is selected in ADDM7.
Kojto 158:b23ee177fd68 889 * (b7-b4 should be set to 0)
Kojto 158:b23ee177fd68 890 * 8bits address node is used when 7-bit Address Detection is selected in ADDM7.
Kojto 158:b23ee177fd68 891 * (This is used in multiprocessor communication during Mute mode or Stop mode,
Kojto 158:b23ee177fd68 892 * for wake up with 7-bit address mark detection.
Kojto 158:b23ee177fd68 893 * The MSB of the character sent by the transmitter should be equal to 1.
Kojto 158:b23ee177fd68 894 * It may also be used for character detection during normal reception,
Kojto 158:b23ee177fd68 895 * Mute mode inactive (for example, end of block detection in ModBus protocol).
Kojto 158:b23ee177fd68 896 * In this case, the whole received character (8-bit) is compared to the ADD[7:0]
Kojto 158:b23ee177fd68 897 * value and CMF flag is set on match)
Kojto 158:b23ee177fd68 898 * @rmtoll CR2 ADD LL_LPUART_ConfigNodeAddress\n
Kojto 158:b23ee177fd68 899 * CR2 ADDM7 LL_LPUART_ConfigNodeAddress
Kojto 158:b23ee177fd68 900 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 901 * @param AddressLen This parameter can be one of the following values:
Kojto 158:b23ee177fd68 902 * @arg @ref LL_LPUART_ADDRESS_DETECT_4B
Kojto 158:b23ee177fd68 903 * @arg @ref LL_LPUART_ADDRESS_DETECT_7B
Kojto 158:b23ee177fd68 904 * @param NodeAddress 4 or 7 bit Address of the LPUART node.
Kojto 158:b23ee177fd68 905 * @retval None
Kojto 158:b23ee177fd68 906 */
Kojto 158:b23ee177fd68 907 __STATIC_INLINE void LL_LPUART_ConfigNodeAddress(USART_TypeDef *LPUARTx, uint32_t AddressLen, uint32_t NodeAddress)
Kojto 158:b23ee177fd68 908 {
Kojto 158:b23ee177fd68 909 MODIFY_REG(LPUARTx->CR2, USART_CR2_ADD | USART_CR2_ADDM7,
Kojto 158:b23ee177fd68 910 (uint32_t)(AddressLen | (NodeAddress << LPUART_POSITION_CR2_ADD)));
Kojto 158:b23ee177fd68 911 }
Kojto 158:b23ee177fd68 912
Kojto 158:b23ee177fd68 913 /**
Kojto 158:b23ee177fd68 914 * @brief Return 8 bit Address of the LPUART node as set in ADD field of CR2.
Kojto 158:b23ee177fd68 915 * @note If 4-bit Address Detection is selected in ADDM7,
Kojto 158:b23ee177fd68 916 * only 4bits (b3-b0) of returned value are relevant (b31-b4 are not relevant)
Kojto 158:b23ee177fd68 917 * If 7-bit Address Detection is selected in ADDM7,
Kojto 158:b23ee177fd68 918 * only 8bits (b7-b0) of returned value are relevant (b31-b8 are not relevant)
Kojto 158:b23ee177fd68 919 * @rmtoll CR2 ADD LL_LPUART_GetNodeAddress
Kojto 158:b23ee177fd68 920 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 921 * @retval Address of the LPUART node (Value between Min_Data=0 and Max_Data=255)
Kojto 158:b23ee177fd68 922 */
Kojto 158:b23ee177fd68 923 __STATIC_INLINE uint32_t LL_LPUART_GetNodeAddress(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 924 {
Kojto 158:b23ee177fd68 925 return (uint32_t)(READ_BIT(LPUARTx->CR2, USART_CR2_ADD) >> LPUART_POSITION_CR2_ADD);
Kojto 158:b23ee177fd68 926 }
Kojto 158:b23ee177fd68 927
Kojto 158:b23ee177fd68 928 /**
Kojto 158:b23ee177fd68 929 * @brief Return Length of Node Address used in Address Detection mode (7-bit or 4-bit)
Kojto 158:b23ee177fd68 930 * @rmtoll CR2 ADDM7 LL_LPUART_GetNodeAddressLen
Kojto 158:b23ee177fd68 931 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 932 * @retval Returned value can be one of the following values:
Kojto 158:b23ee177fd68 933 * @arg @ref LL_LPUART_ADDRESS_DETECT_4B
Kojto 158:b23ee177fd68 934 * @arg @ref LL_LPUART_ADDRESS_DETECT_7B
Kojto 158:b23ee177fd68 935 */
Kojto 158:b23ee177fd68 936 __STATIC_INLINE uint32_t LL_LPUART_GetNodeAddressLen(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 937 {
Kojto 158:b23ee177fd68 938 return (uint32_t)(READ_BIT(LPUARTx->CR2, USART_CR2_ADDM7));
Kojto 158:b23ee177fd68 939 }
Kojto 158:b23ee177fd68 940
Kojto 158:b23ee177fd68 941 /**
Kojto 158:b23ee177fd68 942 * @brief Enable RTS HW Flow Control
Kojto 158:b23ee177fd68 943 * @rmtoll CR3 RTSE LL_LPUART_EnableRTSHWFlowCtrl
Kojto 158:b23ee177fd68 944 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 945 * @retval None
Kojto 158:b23ee177fd68 946 */
Kojto 158:b23ee177fd68 947 __STATIC_INLINE void LL_LPUART_EnableRTSHWFlowCtrl(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 948 {
Kojto 158:b23ee177fd68 949 SET_BIT(LPUARTx->CR3, USART_CR3_RTSE);
Kojto 158:b23ee177fd68 950 }
Kojto 158:b23ee177fd68 951
Kojto 158:b23ee177fd68 952 /**
Kojto 158:b23ee177fd68 953 * @brief Disable RTS HW Flow Control
Kojto 158:b23ee177fd68 954 * @rmtoll CR3 RTSE LL_LPUART_DisableRTSHWFlowCtrl
Kojto 158:b23ee177fd68 955 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 956 * @retval None
Kojto 158:b23ee177fd68 957 */
Kojto 158:b23ee177fd68 958 __STATIC_INLINE void LL_LPUART_DisableRTSHWFlowCtrl(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 959 {
Kojto 158:b23ee177fd68 960 CLEAR_BIT(LPUARTx->CR3, USART_CR3_RTSE);
Kojto 158:b23ee177fd68 961 }
Kojto 158:b23ee177fd68 962
Kojto 158:b23ee177fd68 963 /**
Kojto 158:b23ee177fd68 964 * @brief Enable CTS HW Flow Control
Kojto 158:b23ee177fd68 965 * @rmtoll CR3 CTSE LL_LPUART_EnableCTSHWFlowCtrl
Kojto 158:b23ee177fd68 966 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 967 * @retval None
Kojto 158:b23ee177fd68 968 */
Kojto 158:b23ee177fd68 969 __STATIC_INLINE void LL_LPUART_EnableCTSHWFlowCtrl(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 970 {
Kojto 158:b23ee177fd68 971 SET_BIT(LPUARTx->CR3, USART_CR3_CTSE);
Kojto 158:b23ee177fd68 972 }
Kojto 158:b23ee177fd68 973
Kojto 158:b23ee177fd68 974 /**
Kojto 158:b23ee177fd68 975 * @brief Disable CTS HW Flow Control
Kojto 158:b23ee177fd68 976 * @rmtoll CR3 CTSE LL_LPUART_DisableCTSHWFlowCtrl
Kojto 158:b23ee177fd68 977 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 978 * @retval None
Kojto 158:b23ee177fd68 979 */
Kojto 158:b23ee177fd68 980 __STATIC_INLINE void LL_LPUART_DisableCTSHWFlowCtrl(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 981 {
Kojto 158:b23ee177fd68 982 CLEAR_BIT(LPUARTx->CR3, USART_CR3_CTSE);
Kojto 158:b23ee177fd68 983 }
Kojto 158:b23ee177fd68 984
Kojto 158:b23ee177fd68 985 /**
Kojto 158:b23ee177fd68 986 * @brief Configure HW Flow Control mode (both CTS and RTS)
Kojto 158:b23ee177fd68 987 * @rmtoll CR3 RTSE LL_LPUART_SetHWFlowCtrl\n
Kojto 158:b23ee177fd68 988 * CR3 CTSE LL_LPUART_SetHWFlowCtrl
Kojto 158:b23ee177fd68 989 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 990 * @param HardwareFlowControl This parameter can be one of the following values:
Kojto 158:b23ee177fd68 991 * @arg @ref LL_LPUART_HWCONTROL_NONE
Kojto 158:b23ee177fd68 992 * @arg @ref LL_LPUART_HWCONTROL_RTS
Kojto 158:b23ee177fd68 993 * @arg @ref LL_LPUART_HWCONTROL_CTS
Kojto 158:b23ee177fd68 994 * @arg @ref LL_LPUART_HWCONTROL_RTS_CTS
Kojto 158:b23ee177fd68 995 * @retval None
Kojto 158:b23ee177fd68 996 */
Kojto 158:b23ee177fd68 997 __STATIC_INLINE void LL_LPUART_SetHWFlowCtrl(USART_TypeDef *LPUARTx, uint32_t HardwareFlowControl)
Kojto 158:b23ee177fd68 998 {
Kojto 158:b23ee177fd68 999 MODIFY_REG(LPUARTx->CR3, USART_CR3_RTSE | USART_CR3_CTSE, HardwareFlowControl);
Kojto 158:b23ee177fd68 1000 }
Kojto 158:b23ee177fd68 1001
Kojto 158:b23ee177fd68 1002 /**
Kojto 158:b23ee177fd68 1003 * @brief Return HW Flow Control configuration (both CTS and RTS)
Kojto 158:b23ee177fd68 1004 * @rmtoll CR3 RTSE LL_LPUART_GetHWFlowCtrl\n
Kojto 158:b23ee177fd68 1005 * CR3 CTSE LL_LPUART_GetHWFlowCtrl
Kojto 158:b23ee177fd68 1006 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 1007 * @retval Returned value can be one of the following values:
Kojto 158:b23ee177fd68 1008 * @arg @ref LL_LPUART_HWCONTROL_NONE
Kojto 158:b23ee177fd68 1009 * @arg @ref LL_LPUART_HWCONTROL_RTS
Kojto 158:b23ee177fd68 1010 * @arg @ref LL_LPUART_HWCONTROL_CTS
Kojto 158:b23ee177fd68 1011 * @arg @ref LL_LPUART_HWCONTROL_RTS_CTS
Kojto 158:b23ee177fd68 1012 */
Kojto 158:b23ee177fd68 1013 __STATIC_INLINE uint32_t LL_LPUART_GetHWFlowCtrl(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 1014 {
Kojto 158:b23ee177fd68 1015 return (uint32_t)(READ_BIT(LPUARTx->CR3, USART_CR3_RTSE | USART_CR3_CTSE));
Kojto 158:b23ee177fd68 1016 }
Kojto 158:b23ee177fd68 1017
Kojto 158:b23ee177fd68 1018 /**
Kojto 158:b23ee177fd68 1019 * @brief Enable Overrun detection
Kojto 158:b23ee177fd68 1020 * @rmtoll CR3 OVRDIS LL_LPUART_EnableOverrunDetect
Kojto 158:b23ee177fd68 1021 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 1022 * @retval None
Kojto 158:b23ee177fd68 1023 */
Kojto 158:b23ee177fd68 1024 __STATIC_INLINE void LL_LPUART_EnableOverrunDetect(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 1025 {
Kojto 158:b23ee177fd68 1026 CLEAR_BIT(LPUARTx->CR3, USART_CR3_OVRDIS);
Kojto 158:b23ee177fd68 1027 }
Kojto 158:b23ee177fd68 1028
Kojto 158:b23ee177fd68 1029 /**
Kojto 158:b23ee177fd68 1030 * @brief Disable Overrun detection
Kojto 158:b23ee177fd68 1031 * @rmtoll CR3 OVRDIS LL_LPUART_DisableOverrunDetect
Kojto 158:b23ee177fd68 1032 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 1033 * @retval None
Kojto 158:b23ee177fd68 1034 */
Kojto 158:b23ee177fd68 1035 __STATIC_INLINE void LL_LPUART_DisableOverrunDetect(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 1036 {
Kojto 158:b23ee177fd68 1037 SET_BIT(LPUARTx->CR3, USART_CR3_OVRDIS);
Kojto 158:b23ee177fd68 1038 }
Kojto 158:b23ee177fd68 1039
Kojto 158:b23ee177fd68 1040 /**
Kojto 158:b23ee177fd68 1041 * @brief Indicate if Overrun detection is enabled
Kojto 158:b23ee177fd68 1042 * @rmtoll CR3 OVRDIS LL_LPUART_IsEnabledOverrunDetect
Kojto 158:b23ee177fd68 1043 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 1044 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 1045 */
Kojto 158:b23ee177fd68 1046 __STATIC_INLINE uint32_t LL_LPUART_IsEnabledOverrunDetect(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 1047 {
Kojto 158:b23ee177fd68 1048 return (READ_BIT(LPUARTx->CR3, USART_CR3_OVRDIS) != USART_CR3_OVRDIS);
Kojto 158:b23ee177fd68 1049 }
Kojto 158:b23ee177fd68 1050
Kojto 158:b23ee177fd68 1051 /**
Kojto 158:b23ee177fd68 1052 * @brief Select event type for Wake UP Interrupt Flag (WUS[1:0] bits)
Kojto 158:b23ee177fd68 1053 * @rmtoll CR3 WUS LL_LPUART_SetWKUPType
Kojto 158:b23ee177fd68 1054 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 1055 * @param Type This parameter can be one of the following values:
Kojto 158:b23ee177fd68 1056 * @arg @ref LL_LPUART_WAKEUP_ON_ADDRESS
Kojto 158:b23ee177fd68 1057 * @arg @ref LL_LPUART_WAKEUP_ON_STARTBIT
Kojto 158:b23ee177fd68 1058 * @arg @ref LL_LPUART_WAKEUP_ON_RXNE
Kojto 158:b23ee177fd68 1059 * @retval None
Kojto 158:b23ee177fd68 1060 */
Kojto 158:b23ee177fd68 1061 __STATIC_INLINE void LL_LPUART_SetWKUPType(USART_TypeDef *LPUARTx, uint32_t Type)
Kojto 158:b23ee177fd68 1062 {
Kojto 158:b23ee177fd68 1063 MODIFY_REG(LPUARTx->CR3, USART_CR3_WUS, Type);
Kojto 158:b23ee177fd68 1064 }
Kojto 158:b23ee177fd68 1065
Kojto 158:b23ee177fd68 1066 /**
Kojto 158:b23ee177fd68 1067 * @brief Return event type for Wake UP Interrupt Flag (WUS[1:0] bits)
Kojto 158:b23ee177fd68 1068 * @rmtoll CR3 WUS LL_LPUART_GetWKUPType
Kojto 158:b23ee177fd68 1069 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 1070 * @retval Returned value can be one of the following values:
Kojto 158:b23ee177fd68 1071 * @arg @ref LL_LPUART_WAKEUP_ON_ADDRESS
Kojto 158:b23ee177fd68 1072 * @arg @ref LL_LPUART_WAKEUP_ON_STARTBIT
Kojto 158:b23ee177fd68 1073 * @arg @ref LL_LPUART_WAKEUP_ON_RXNE
Kojto 158:b23ee177fd68 1074 */
Kojto 158:b23ee177fd68 1075 __STATIC_INLINE uint32_t LL_LPUART_GetWKUPType(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 1076 {
Kojto 158:b23ee177fd68 1077 return (uint32_t)(READ_BIT(LPUARTx->CR3, USART_CR3_WUS));
Kojto 158:b23ee177fd68 1078 }
Kojto 158:b23ee177fd68 1079
Kojto 158:b23ee177fd68 1080 /**
Kojto 158:b23ee177fd68 1081 * @brief Configure LPUART BRR register for achieving expected Baud Rate value.
Kojto 158:b23ee177fd68 1082 *
Kojto 158:b23ee177fd68 1083 * @note Compute and set LPUARTDIV value in BRR Register (full BRR content)
Kojto 158:b23ee177fd68 1084 * according to used Peripheral Clock and expected Baud Rate values
Kojto 158:b23ee177fd68 1085 * @note Peripheral clock and Baud Rate values provided as function parameters should be valid
Kojto 158:b23ee177fd68 1086 * (Baud rate value != 0).
Kojto 158:b23ee177fd68 1087 * @note Provided that LPUARTx_BRR must be > = 0x300 and LPUART_BRR is 20-bit,
Kojto 158:b23ee177fd68 1088 * a care should be taken when generating high baud rates using high PeriphClk
Kojto 158:b23ee177fd68 1089 * values. PeriphClk must be in the range [3 x BaudRate, 4096 x BaudRate].
Kojto 158:b23ee177fd68 1090 * @rmtoll BRR BRR LL_LPUART_SetBaudRate
Kojto 158:b23ee177fd68 1091 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 1092 * @param PeriphClk Peripheral Clock
Kojto 158:b23ee177fd68 1093 * @param BaudRate Baud Rate
Kojto 158:b23ee177fd68 1094 * @retval None
Kojto 158:b23ee177fd68 1095 */
Kojto 158:b23ee177fd68 1096 __STATIC_INLINE void LL_LPUART_SetBaudRate(USART_TypeDef *LPUARTx, uint32_t PeriphClk, uint32_t BaudRate)
Kojto 158:b23ee177fd68 1097 {
Kojto 158:b23ee177fd68 1098 LPUARTx->BRR = __LL_LPUART_DIV(PeriphClk, BaudRate);
Kojto 158:b23ee177fd68 1099 }
Kojto 158:b23ee177fd68 1100
Kojto 158:b23ee177fd68 1101 /**
Kojto 158:b23ee177fd68 1102 * @brief Return current Baud Rate value, according to LPUARTDIV present in BRR register
Kojto 158:b23ee177fd68 1103 * (full BRR content), and to used Peripheral Clock values
Kojto 158:b23ee177fd68 1104 * @note In case of non-initialized or invalid value stored in BRR register, value 0 will be returned.
Kojto 158:b23ee177fd68 1105 * @rmtoll BRR BRR LL_LPUART_GetBaudRate
Kojto 158:b23ee177fd68 1106 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 1107 * @param PeriphClk Peripheral Clock
Kojto 158:b23ee177fd68 1108 * @retval Baud Rate
Kojto 158:b23ee177fd68 1109 */
Kojto 158:b23ee177fd68 1110 __STATIC_INLINE uint32_t LL_LPUART_GetBaudRate(USART_TypeDef *LPUARTx, uint32_t PeriphClk)
Kojto 158:b23ee177fd68 1111 {
Kojto 158:b23ee177fd68 1112 register uint32_t lpuartdiv = 0x0U;
Kojto 158:b23ee177fd68 1113 register uint32_t brrresult = 0x0U;
Kojto 158:b23ee177fd68 1114
Kojto 158:b23ee177fd68 1115 lpuartdiv = LPUARTx->BRR & LPUART_BRR_MASK;
Kojto 158:b23ee177fd68 1116
Kojto 158:b23ee177fd68 1117 if (lpuartdiv >= LPUART_BRR_MIN_VALUE)
Kojto 158:b23ee177fd68 1118 {
Kojto 158:b23ee177fd68 1119 brrresult = (uint32_t)(((uint64_t)(PeriphClk) * LPUART_LPUARTDIV_FREQ_MUL) / lpuartdiv);
Kojto 158:b23ee177fd68 1120 }
Kojto 158:b23ee177fd68 1121
Kojto 158:b23ee177fd68 1122 return (brrresult);
Kojto 158:b23ee177fd68 1123 }
Kojto 158:b23ee177fd68 1124
Kojto 158:b23ee177fd68 1125 /**
Kojto 158:b23ee177fd68 1126 * @}
Kojto 158:b23ee177fd68 1127 */
Kojto 158:b23ee177fd68 1128
Kojto 158:b23ee177fd68 1129 /** @defgroup LPUART_LL_EF_Configuration_HalfDuplex Configuration functions related to Half Duplex feature
Kojto 158:b23ee177fd68 1130 * @{
Kojto 158:b23ee177fd68 1131 */
Kojto 158:b23ee177fd68 1132
Kojto 158:b23ee177fd68 1133 /**
Kojto 158:b23ee177fd68 1134 * @brief Enable Single Wire Half-Duplex mode
Kojto 158:b23ee177fd68 1135 * @rmtoll CR3 HDSEL LL_LPUART_EnableHalfDuplex
Kojto 158:b23ee177fd68 1136 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 1137 * @retval None
Kojto 158:b23ee177fd68 1138 */
Kojto 158:b23ee177fd68 1139 __STATIC_INLINE void LL_LPUART_EnableHalfDuplex(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 1140 {
Kojto 158:b23ee177fd68 1141 SET_BIT(LPUARTx->CR3, USART_CR3_HDSEL);
Kojto 158:b23ee177fd68 1142 }
Kojto 158:b23ee177fd68 1143
Kojto 158:b23ee177fd68 1144 /**
Kojto 158:b23ee177fd68 1145 * @brief Disable Single Wire Half-Duplex mode
Kojto 158:b23ee177fd68 1146 * @rmtoll CR3 HDSEL LL_LPUART_DisableHalfDuplex
Kojto 158:b23ee177fd68 1147 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 1148 * @retval None
Kojto 158:b23ee177fd68 1149 */
Kojto 158:b23ee177fd68 1150 __STATIC_INLINE void LL_LPUART_DisableHalfDuplex(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 1151 {
Kojto 158:b23ee177fd68 1152 CLEAR_BIT(LPUARTx->CR3, USART_CR3_HDSEL);
Kojto 158:b23ee177fd68 1153 }
Kojto 158:b23ee177fd68 1154
Kojto 158:b23ee177fd68 1155 /**
Kojto 158:b23ee177fd68 1156 * @brief Indicate if Single Wire Half-Duplex mode is enabled
Kojto 158:b23ee177fd68 1157 * @rmtoll CR3 HDSEL LL_LPUART_IsEnabledHalfDuplex
Kojto 158:b23ee177fd68 1158 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 1159 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 1160 */
Kojto 158:b23ee177fd68 1161 __STATIC_INLINE uint32_t LL_LPUART_IsEnabledHalfDuplex(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 1162 {
Kojto 158:b23ee177fd68 1163 return (READ_BIT(LPUARTx->CR3, USART_CR3_HDSEL) == (USART_CR3_HDSEL));
Kojto 158:b23ee177fd68 1164 }
Kojto 158:b23ee177fd68 1165
Kojto 158:b23ee177fd68 1166 /**
Kojto 158:b23ee177fd68 1167 * @}
Kojto 158:b23ee177fd68 1168 */
Kojto 158:b23ee177fd68 1169
Kojto 158:b23ee177fd68 1170 /** @defgroup LPUART_LL_EF_Configuration_DE Configuration functions related to Driver Enable feature
Kojto 158:b23ee177fd68 1171 * @{
Kojto 158:b23ee177fd68 1172 */
Kojto 158:b23ee177fd68 1173
Kojto 158:b23ee177fd68 1174 /**
Kojto 158:b23ee177fd68 1175 * @brief Set DEDT (Driver Enable De-Assertion Time), Time value expressed on 5 bits ([4:0] bits).
Kojto 158:b23ee177fd68 1176 * @rmtoll CR1 DEDT LL_LPUART_SetDEDeassertionTime
Kojto 158:b23ee177fd68 1177 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 1178 * @param Time Value between Min_Data=0 and Max_Data=31
Kojto 158:b23ee177fd68 1179 * @retval None
Kojto 158:b23ee177fd68 1180 */
Kojto 158:b23ee177fd68 1181 __STATIC_INLINE void LL_LPUART_SetDEDeassertionTime(USART_TypeDef *LPUARTx, uint32_t Time)
Kojto 158:b23ee177fd68 1182 {
Kojto 158:b23ee177fd68 1183 MODIFY_REG(LPUARTx->CR1, USART_CR1_DEDT, Time << LPUART_POSITION_CR1_DEDT);
Kojto 158:b23ee177fd68 1184 }
Kojto 158:b23ee177fd68 1185
Kojto 158:b23ee177fd68 1186 /**
Kojto 158:b23ee177fd68 1187 * @brief Return DEDT (Driver Enable De-Assertion Time)
Kojto 158:b23ee177fd68 1188 * @rmtoll CR1 DEDT LL_LPUART_GetDEDeassertionTime
Kojto 158:b23ee177fd68 1189 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 1190 * @retval Time value expressed on 5 bits ([4:0] bits) : c
Kojto 158:b23ee177fd68 1191 */
Kojto 158:b23ee177fd68 1192 __STATIC_INLINE uint32_t LL_LPUART_GetDEDeassertionTime(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 1193 {
Kojto 158:b23ee177fd68 1194 return (uint32_t)(READ_BIT(LPUARTx->CR1, USART_CR1_DEDT) >> LPUART_POSITION_CR1_DEDT);
Kojto 158:b23ee177fd68 1195 }
Kojto 158:b23ee177fd68 1196
Kojto 158:b23ee177fd68 1197 /**
Kojto 158:b23ee177fd68 1198 * @brief Set DEAT (Driver Enable Assertion Time), Time value expressed on 5 bits ([4:0] bits).
Kojto 158:b23ee177fd68 1199 * @rmtoll CR1 DEAT LL_LPUART_SetDEAssertionTime
Kojto 158:b23ee177fd68 1200 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 1201 * @param Time Value between Min_Data=0 and Max_Data=31
Kojto 158:b23ee177fd68 1202 * @retval None
Kojto 158:b23ee177fd68 1203 */
Kojto 158:b23ee177fd68 1204 __STATIC_INLINE void LL_LPUART_SetDEAssertionTime(USART_TypeDef *LPUARTx, uint32_t Time)
Kojto 158:b23ee177fd68 1205 {
Kojto 158:b23ee177fd68 1206 MODIFY_REG(LPUARTx->CR1, USART_CR1_DEAT, Time << LPUART_POSITION_CR1_DEAT);
Kojto 158:b23ee177fd68 1207 }
Kojto 158:b23ee177fd68 1208
Kojto 158:b23ee177fd68 1209 /**
Kojto 158:b23ee177fd68 1210 * @brief Return DEAT (Driver Enable Assertion Time)
Kojto 158:b23ee177fd68 1211 * @rmtoll CR1 DEAT LL_LPUART_GetDEAssertionTime
Kojto 158:b23ee177fd68 1212 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 1213 * @retval Time value expressed on 5 bits ([4:0] bits) : Time Value between Min_Data=0 and Max_Data=31
Kojto 158:b23ee177fd68 1214 */
Kojto 158:b23ee177fd68 1215 __STATIC_INLINE uint32_t LL_LPUART_GetDEAssertionTime(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 1216 {
Kojto 158:b23ee177fd68 1217 return (uint32_t)(READ_BIT(LPUARTx->CR1, USART_CR1_DEAT) >> LPUART_POSITION_CR1_DEAT);
Kojto 158:b23ee177fd68 1218 }
Kojto 158:b23ee177fd68 1219
Kojto 158:b23ee177fd68 1220 /**
Kojto 158:b23ee177fd68 1221 * @brief Enable Driver Enable (DE) Mode
Kojto 158:b23ee177fd68 1222 * @rmtoll CR3 DEM LL_LPUART_EnableDEMode
Kojto 158:b23ee177fd68 1223 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 1224 * @retval None
Kojto 158:b23ee177fd68 1225 */
Kojto 158:b23ee177fd68 1226 __STATIC_INLINE void LL_LPUART_EnableDEMode(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 1227 {
Kojto 158:b23ee177fd68 1228 SET_BIT(LPUARTx->CR3, USART_CR3_DEM);
Kojto 158:b23ee177fd68 1229 }
Kojto 158:b23ee177fd68 1230
Kojto 158:b23ee177fd68 1231 /**
Kojto 158:b23ee177fd68 1232 * @brief Disable Driver Enable (DE) Mode
Kojto 158:b23ee177fd68 1233 * @rmtoll CR3 DEM LL_LPUART_DisableDEMode
Kojto 158:b23ee177fd68 1234 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 1235 * @retval None
Kojto 158:b23ee177fd68 1236 */
Kojto 158:b23ee177fd68 1237 __STATIC_INLINE void LL_LPUART_DisableDEMode(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 1238 {
Kojto 158:b23ee177fd68 1239 CLEAR_BIT(LPUARTx->CR3, USART_CR3_DEM);
Kojto 158:b23ee177fd68 1240 }
Kojto 158:b23ee177fd68 1241
Kojto 158:b23ee177fd68 1242 /**
Kojto 158:b23ee177fd68 1243 * @brief Indicate if Driver Enable (DE) Mode is enabled
Kojto 158:b23ee177fd68 1244 * @rmtoll CR3 DEM LL_LPUART_IsEnabledDEMode
Kojto 158:b23ee177fd68 1245 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 1246 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 1247 */
Kojto 158:b23ee177fd68 1248 __STATIC_INLINE uint32_t LL_LPUART_IsEnabledDEMode(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 1249 {
Kojto 158:b23ee177fd68 1250 return (READ_BIT(LPUARTx->CR3, USART_CR3_DEM) == (USART_CR3_DEM));
Kojto 158:b23ee177fd68 1251 }
Kojto 158:b23ee177fd68 1252
Kojto 158:b23ee177fd68 1253 /**
Kojto 158:b23ee177fd68 1254 * @brief Select Driver Enable Polarity
Kojto 158:b23ee177fd68 1255 * @rmtoll CR3 DEP LL_LPUART_SetDESignalPolarity
Kojto 158:b23ee177fd68 1256 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 1257 * @param Polarity This parameter can be one of the following values:
Kojto 158:b23ee177fd68 1258 * @arg @ref LL_LPUART_DE_POLARITY_HIGH
Kojto 158:b23ee177fd68 1259 * @arg @ref LL_LPUART_DE_POLARITY_LOW
Kojto 158:b23ee177fd68 1260 * @retval None
Kojto 158:b23ee177fd68 1261 */
Kojto 158:b23ee177fd68 1262 __STATIC_INLINE void LL_LPUART_SetDESignalPolarity(USART_TypeDef *LPUARTx, uint32_t Polarity)
Kojto 158:b23ee177fd68 1263 {
Kojto 158:b23ee177fd68 1264 MODIFY_REG(LPUARTx->CR3, USART_CR3_DEP, Polarity);
Kojto 158:b23ee177fd68 1265 }
Kojto 158:b23ee177fd68 1266
Kojto 158:b23ee177fd68 1267 /**
Kojto 158:b23ee177fd68 1268 * @brief Return Driver Enable Polarity
Kojto 158:b23ee177fd68 1269 * @rmtoll CR3 DEP LL_LPUART_GetDESignalPolarity
Kojto 158:b23ee177fd68 1270 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 1271 * @retval Returned value can be one of the following values:
Kojto 158:b23ee177fd68 1272 * @arg @ref LL_LPUART_DE_POLARITY_HIGH
Kojto 158:b23ee177fd68 1273 * @arg @ref LL_LPUART_DE_POLARITY_LOW
Kojto 158:b23ee177fd68 1274 */
Kojto 158:b23ee177fd68 1275 __STATIC_INLINE uint32_t LL_LPUART_GetDESignalPolarity(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 1276 {
Kojto 158:b23ee177fd68 1277 return (uint32_t)(READ_BIT(LPUARTx->CR3, USART_CR3_DEP));
Kojto 158:b23ee177fd68 1278 }
Kojto 158:b23ee177fd68 1279
Kojto 158:b23ee177fd68 1280 /**
Kojto 158:b23ee177fd68 1281 * @}
Kojto 158:b23ee177fd68 1282 */
Kojto 158:b23ee177fd68 1283
Kojto 158:b23ee177fd68 1284 /** @defgroup LPUART_LL_EF_FLAG_Management FLAG_Management
Kojto 158:b23ee177fd68 1285 * @{
Kojto 158:b23ee177fd68 1286 */
Kojto 158:b23ee177fd68 1287
Kojto 158:b23ee177fd68 1288 /**
Kojto 158:b23ee177fd68 1289 * @brief Check if the LPUART Parity Error Flag is set or not
Kojto 158:b23ee177fd68 1290 * @rmtoll ISR PE LL_LPUART_IsActiveFlag_PE
Kojto 158:b23ee177fd68 1291 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 1292 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 1293 */
Kojto 158:b23ee177fd68 1294 __STATIC_INLINE uint32_t LL_LPUART_IsActiveFlag_PE(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 1295 {
Kojto 158:b23ee177fd68 1296 return (READ_BIT(LPUARTx->ISR, USART_ISR_PE) == (USART_ISR_PE));
Kojto 158:b23ee177fd68 1297 }
Kojto 158:b23ee177fd68 1298
Kojto 158:b23ee177fd68 1299 /**
Kojto 158:b23ee177fd68 1300 * @brief Check if the LPUART Framing Error Flag is set or not
Kojto 158:b23ee177fd68 1301 * @rmtoll ISR FE LL_LPUART_IsActiveFlag_FE
Kojto 158:b23ee177fd68 1302 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 1303 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 1304 */
Kojto 158:b23ee177fd68 1305 __STATIC_INLINE uint32_t LL_LPUART_IsActiveFlag_FE(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 1306 {
Kojto 158:b23ee177fd68 1307 return (READ_BIT(LPUARTx->ISR, USART_ISR_FE) == (USART_ISR_FE));
Kojto 158:b23ee177fd68 1308 }
Kojto 158:b23ee177fd68 1309
Kojto 158:b23ee177fd68 1310 /**
Kojto 158:b23ee177fd68 1311 * @brief Check if the LPUART Noise detected Flag is set or not
Kojto 158:b23ee177fd68 1312 * @rmtoll ISR NE LL_LPUART_IsActiveFlag_NE
Kojto 158:b23ee177fd68 1313 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 1314 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 1315 */
Kojto 158:b23ee177fd68 1316 __STATIC_INLINE uint32_t LL_LPUART_IsActiveFlag_NE(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 1317 {
Kojto 158:b23ee177fd68 1318 return (READ_BIT(LPUARTx->ISR, USART_ISR_NE) == (USART_ISR_NE));
Kojto 158:b23ee177fd68 1319 }
Kojto 158:b23ee177fd68 1320
Kojto 158:b23ee177fd68 1321 /**
Kojto 158:b23ee177fd68 1322 * @brief Check if the LPUART OverRun Error Flag is set or not
Kojto 158:b23ee177fd68 1323 * @rmtoll ISR ORE LL_LPUART_IsActiveFlag_ORE
Kojto 158:b23ee177fd68 1324 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 1325 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 1326 */
Kojto 158:b23ee177fd68 1327 __STATIC_INLINE uint32_t LL_LPUART_IsActiveFlag_ORE(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 1328 {
Kojto 158:b23ee177fd68 1329 return (READ_BIT(LPUARTx->ISR, USART_ISR_ORE) == (USART_ISR_ORE));
Kojto 158:b23ee177fd68 1330 }
Kojto 158:b23ee177fd68 1331
Kojto 158:b23ee177fd68 1332 /**
Kojto 158:b23ee177fd68 1333 * @brief Check if the LPUART IDLE line detected Flag is set or not
Kojto 158:b23ee177fd68 1334 * @rmtoll ISR IDLE LL_LPUART_IsActiveFlag_IDLE
Kojto 158:b23ee177fd68 1335 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 1336 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 1337 */
Kojto 158:b23ee177fd68 1338 __STATIC_INLINE uint32_t LL_LPUART_IsActiveFlag_IDLE(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 1339 {
Kojto 158:b23ee177fd68 1340 return (READ_BIT(LPUARTx->ISR, USART_ISR_IDLE) == (USART_ISR_IDLE));
Kojto 158:b23ee177fd68 1341 }
Kojto 158:b23ee177fd68 1342
Kojto 158:b23ee177fd68 1343 /**
Kojto 158:b23ee177fd68 1344 * @brief Check if the LPUART Read Data Register Not Empty Flag is set or not
Kojto 158:b23ee177fd68 1345 * @rmtoll ISR RXNE LL_LPUART_IsActiveFlag_RXNE
Kojto 158:b23ee177fd68 1346 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 1347 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 1348 */
Kojto 158:b23ee177fd68 1349 __STATIC_INLINE uint32_t LL_LPUART_IsActiveFlag_RXNE(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 1350 {
Kojto 158:b23ee177fd68 1351 return (READ_BIT(LPUARTx->ISR, USART_ISR_RXNE) == (USART_ISR_RXNE));
Kojto 158:b23ee177fd68 1352 }
Kojto 158:b23ee177fd68 1353
Kojto 158:b23ee177fd68 1354 /**
Kojto 158:b23ee177fd68 1355 * @brief Check if the LPUART Transmission Complete Flag is set or not
Kojto 158:b23ee177fd68 1356 * @rmtoll ISR TC LL_LPUART_IsActiveFlag_TC
Kojto 158:b23ee177fd68 1357 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 1358 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 1359 */
Kojto 158:b23ee177fd68 1360 __STATIC_INLINE uint32_t LL_LPUART_IsActiveFlag_TC(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 1361 {
Kojto 158:b23ee177fd68 1362 return (READ_BIT(LPUARTx->ISR, USART_ISR_TC) == (USART_ISR_TC));
Kojto 158:b23ee177fd68 1363 }
Kojto 158:b23ee177fd68 1364
Kojto 158:b23ee177fd68 1365 /**
Kojto 158:b23ee177fd68 1366 * @brief Check if the LPUART Transmit Data Register Empty Flag is set or not
Kojto 158:b23ee177fd68 1367 * @rmtoll ISR TXE LL_LPUART_IsActiveFlag_TXE
Kojto 158:b23ee177fd68 1368 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 1369 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 1370 */
Kojto 158:b23ee177fd68 1371 __STATIC_INLINE uint32_t LL_LPUART_IsActiveFlag_TXE(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 1372 {
Kojto 158:b23ee177fd68 1373 return (READ_BIT(LPUARTx->ISR, USART_ISR_TXE) == (USART_ISR_TXE));
Kojto 158:b23ee177fd68 1374 }
Kojto 158:b23ee177fd68 1375
Kojto 158:b23ee177fd68 1376 /**
Kojto 158:b23ee177fd68 1377 * @brief Check if the LPUART CTS interrupt Flag is set or not
Kojto 158:b23ee177fd68 1378 * @rmtoll ISR CTSIF LL_LPUART_IsActiveFlag_nCTS
Kojto 158:b23ee177fd68 1379 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 1380 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 1381 */
Kojto 158:b23ee177fd68 1382 __STATIC_INLINE uint32_t LL_LPUART_IsActiveFlag_nCTS(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 1383 {
Kojto 158:b23ee177fd68 1384 return (READ_BIT(LPUARTx->ISR, USART_ISR_CTSIF) == (USART_ISR_CTSIF));
Kojto 158:b23ee177fd68 1385 }
Kojto 158:b23ee177fd68 1386
Kojto 158:b23ee177fd68 1387 /**
Kojto 158:b23ee177fd68 1388 * @brief Check if the LPUART CTS Flag is set or not
Kojto 158:b23ee177fd68 1389 * @rmtoll ISR CTS LL_LPUART_IsActiveFlag_CTS
Kojto 158:b23ee177fd68 1390 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 1391 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 1392 */
Kojto 158:b23ee177fd68 1393 __STATIC_INLINE uint32_t LL_LPUART_IsActiveFlag_CTS(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 1394 {
Kojto 158:b23ee177fd68 1395 return (READ_BIT(LPUARTx->ISR, USART_ISR_CTS) == (USART_ISR_CTS));
Kojto 158:b23ee177fd68 1396 }
Kojto 158:b23ee177fd68 1397
Kojto 158:b23ee177fd68 1398 /**
Kojto 158:b23ee177fd68 1399 * @brief Check if the LPUART Busy Flag is set or not
Kojto 158:b23ee177fd68 1400 * @rmtoll ISR BUSY LL_LPUART_IsActiveFlag_BUSY
Kojto 158:b23ee177fd68 1401 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 1402 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 1403 */
Kojto 158:b23ee177fd68 1404 __STATIC_INLINE uint32_t LL_LPUART_IsActiveFlag_BUSY(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 1405 {
Kojto 158:b23ee177fd68 1406 return (READ_BIT(LPUARTx->ISR, USART_ISR_BUSY) == (USART_ISR_BUSY));
Kojto 158:b23ee177fd68 1407 }
Kojto 158:b23ee177fd68 1408
Kojto 158:b23ee177fd68 1409 /**
Kojto 158:b23ee177fd68 1410 * @brief Check if the LPUART Character Match Flag is set or not
Kojto 158:b23ee177fd68 1411 * @rmtoll ISR CMF LL_LPUART_IsActiveFlag_CM
Kojto 158:b23ee177fd68 1412 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 1413 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 1414 */
Kojto 158:b23ee177fd68 1415 __STATIC_INLINE uint32_t LL_LPUART_IsActiveFlag_CM(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 1416 {
Kojto 158:b23ee177fd68 1417 return (READ_BIT(LPUARTx->ISR, USART_ISR_CMF) == (USART_ISR_CMF));
Kojto 158:b23ee177fd68 1418 }
Kojto 158:b23ee177fd68 1419
Kojto 158:b23ee177fd68 1420 /**
Kojto 158:b23ee177fd68 1421 * @brief Check if the LPUART Send Break Flag is set or not
Kojto 158:b23ee177fd68 1422 * @rmtoll ISR SBKF LL_LPUART_IsActiveFlag_SBK
Kojto 158:b23ee177fd68 1423 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 1424 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 1425 */
Kojto 158:b23ee177fd68 1426 __STATIC_INLINE uint32_t LL_LPUART_IsActiveFlag_SBK(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 1427 {
Kojto 158:b23ee177fd68 1428 return (READ_BIT(LPUARTx->ISR, USART_ISR_SBKF) == (USART_ISR_SBKF));
Kojto 158:b23ee177fd68 1429 }
Kojto 158:b23ee177fd68 1430
Kojto 158:b23ee177fd68 1431 /**
Kojto 158:b23ee177fd68 1432 * @brief Check if the LPUART Receive Wake Up from mute mode Flag is set or not
Kojto 158:b23ee177fd68 1433 * @rmtoll ISR RWU LL_LPUART_IsActiveFlag_RWU
Kojto 158:b23ee177fd68 1434 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 1435 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 1436 */
Kojto 158:b23ee177fd68 1437 __STATIC_INLINE uint32_t LL_LPUART_IsActiveFlag_RWU(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 1438 {
Kojto 158:b23ee177fd68 1439 return (READ_BIT(LPUARTx->ISR, USART_ISR_RWU) == (USART_ISR_RWU));
Kojto 158:b23ee177fd68 1440 }
Kojto 158:b23ee177fd68 1441
Kojto 158:b23ee177fd68 1442 /**
Kojto 158:b23ee177fd68 1443 * @brief Check if the LPUART Wake Up from stop mode Flag is set or not
Kojto 158:b23ee177fd68 1444 * @rmtoll ISR WUF LL_LPUART_IsActiveFlag_WKUP
Kojto 158:b23ee177fd68 1445 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 1446 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 1447 */
Kojto 158:b23ee177fd68 1448 __STATIC_INLINE uint32_t LL_LPUART_IsActiveFlag_WKUP(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 1449 {
Kojto 158:b23ee177fd68 1450 return (READ_BIT(LPUARTx->ISR, USART_ISR_WUF) == (USART_ISR_WUF));
Kojto 158:b23ee177fd68 1451 }
Kojto 158:b23ee177fd68 1452
Kojto 158:b23ee177fd68 1453 /**
Kojto 158:b23ee177fd68 1454 * @brief Check if the LPUART Transmit Enable Acknowledge Flag is set or not
Kojto 158:b23ee177fd68 1455 * @rmtoll ISR TEACK LL_LPUART_IsActiveFlag_TEACK
Kojto 158:b23ee177fd68 1456 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 1457 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 1458 */
Kojto 158:b23ee177fd68 1459 __STATIC_INLINE uint32_t LL_LPUART_IsActiveFlag_TEACK(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 1460 {
Kojto 158:b23ee177fd68 1461 return (READ_BIT(LPUARTx->ISR, USART_ISR_TEACK) == (USART_ISR_TEACK));
Kojto 158:b23ee177fd68 1462 }
Kojto 158:b23ee177fd68 1463
Kojto 158:b23ee177fd68 1464 /**
Kojto 158:b23ee177fd68 1465 * @brief Check if the LPUART Receive Enable Acknowledge Flag is set or not
Kojto 158:b23ee177fd68 1466 * @rmtoll ISR REACK LL_LPUART_IsActiveFlag_REACK
Kojto 158:b23ee177fd68 1467 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 1468 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 1469 */
Kojto 158:b23ee177fd68 1470 __STATIC_INLINE uint32_t LL_LPUART_IsActiveFlag_REACK(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 1471 {
Kojto 158:b23ee177fd68 1472 return (READ_BIT(LPUARTx->ISR, USART_ISR_REACK) == (USART_ISR_REACK));
Kojto 158:b23ee177fd68 1473 }
Kojto 158:b23ee177fd68 1474
Kojto 158:b23ee177fd68 1475 /**
Kojto 158:b23ee177fd68 1476 * @brief Clear Parity Error Flag
Kojto 158:b23ee177fd68 1477 * @rmtoll ICR PECF LL_LPUART_ClearFlag_PE
Kojto 158:b23ee177fd68 1478 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 1479 * @retval None
Kojto 158:b23ee177fd68 1480 */
Kojto 158:b23ee177fd68 1481 __STATIC_INLINE void LL_LPUART_ClearFlag_PE(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 1482 {
Kojto 158:b23ee177fd68 1483 WRITE_REG(LPUARTx->ICR, USART_ICR_PECF);
Kojto 158:b23ee177fd68 1484 }
Kojto 158:b23ee177fd68 1485
Kojto 158:b23ee177fd68 1486 /**
Kojto 158:b23ee177fd68 1487 * @brief Clear Framing Error Flag
Kojto 158:b23ee177fd68 1488 * @rmtoll ICR FECF LL_LPUART_ClearFlag_FE
Kojto 158:b23ee177fd68 1489 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 1490 * @retval None
Kojto 158:b23ee177fd68 1491 */
Kojto 158:b23ee177fd68 1492 __STATIC_INLINE void LL_LPUART_ClearFlag_FE(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 1493 {
Kojto 158:b23ee177fd68 1494 WRITE_REG(LPUARTx->ICR, USART_ICR_FECF);
Kojto 158:b23ee177fd68 1495 }
Kojto 158:b23ee177fd68 1496
Kojto 158:b23ee177fd68 1497 /**
Kojto 158:b23ee177fd68 1498 * @brief Clear Noise detected Flag
Kojto 158:b23ee177fd68 1499 * @rmtoll ICR NCF LL_LPUART_ClearFlag_NE
Kojto 158:b23ee177fd68 1500 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 1501 * @retval None
Kojto 158:b23ee177fd68 1502 */
Kojto 158:b23ee177fd68 1503 __STATIC_INLINE void LL_LPUART_ClearFlag_NE(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 1504 {
Kojto 158:b23ee177fd68 1505 WRITE_REG(LPUARTx->ICR, USART_ICR_NCF);
Kojto 158:b23ee177fd68 1506 }
Kojto 158:b23ee177fd68 1507
Kojto 158:b23ee177fd68 1508 /**
Kojto 158:b23ee177fd68 1509 * @brief Clear OverRun Error Flag
Kojto 158:b23ee177fd68 1510 * @rmtoll ICR ORECF LL_LPUART_ClearFlag_ORE
Kojto 158:b23ee177fd68 1511 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 1512 * @retval None
Kojto 158:b23ee177fd68 1513 */
Kojto 158:b23ee177fd68 1514 __STATIC_INLINE void LL_LPUART_ClearFlag_ORE(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 1515 {
Kojto 158:b23ee177fd68 1516 WRITE_REG(LPUARTx->ICR, USART_ICR_ORECF);
Kojto 158:b23ee177fd68 1517 }
Kojto 158:b23ee177fd68 1518
Kojto 158:b23ee177fd68 1519 /**
Kojto 158:b23ee177fd68 1520 * @brief Clear IDLE line detected Flag
Kojto 158:b23ee177fd68 1521 * @rmtoll ICR IDLECF LL_LPUART_ClearFlag_IDLE
Kojto 158:b23ee177fd68 1522 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 1523 * @retval None
Kojto 158:b23ee177fd68 1524 */
Kojto 158:b23ee177fd68 1525 __STATIC_INLINE void LL_LPUART_ClearFlag_IDLE(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 1526 {
Kojto 158:b23ee177fd68 1527 WRITE_REG(LPUARTx->ICR, USART_ICR_IDLECF);
Kojto 158:b23ee177fd68 1528 }
Kojto 158:b23ee177fd68 1529
Kojto 158:b23ee177fd68 1530 /**
Kojto 158:b23ee177fd68 1531 * @brief Clear Transmission Complete Flag
Kojto 158:b23ee177fd68 1532 * @rmtoll ICR TCCF LL_LPUART_ClearFlag_TC
Kojto 158:b23ee177fd68 1533 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 1534 * @retval None
Kojto 158:b23ee177fd68 1535 */
Kojto 158:b23ee177fd68 1536 __STATIC_INLINE void LL_LPUART_ClearFlag_TC(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 1537 {
Kojto 158:b23ee177fd68 1538 WRITE_REG(LPUARTx->ICR, USART_ICR_TCCF);
Kojto 158:b23ee177fd68 1539 }
Kojto 158:b23ee177fd68 1540
Kojto 158:b23ee177fd68 1541 /**
Kojto 158:b23ee177fd68 1542 * @brief Clear CTS Interrupt Flag
Kojto 158:b23ee177fd68 1543 * @rmtoll ICR CTSCF LL_LPUART_ClearFlag_nCTS
Kojto 158:b23ee177fd68 1544 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 1545 * @retval None
Kojto 158:b23ee177fd68 1546 */
Kojto 158:b23ee177fd68 1547 __STATIC_INLINE void LL_LPUART_ClearFlag_nCTS(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 1548 {
Kojto 158:b23ee177fd68 1549 WRITE_REG(LPUARTx->ICR, USART_ICR_CTSCF);
Kojto 158:b23ee177fd68 1550 }
Kojto 158:b23ee177fd68 1551
Kojto 158:b23ee177fd68 1552 /**
Kojto 158:b23ee177fd68 1553 * @brief Clear Character Match Flag
Kojto 158:b23ee177fd68 1554 * @rmtoll ICR CMCF LL_LPUART_ClearFlag_CM
Kojto 158:b23ee177fd68 1555 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 1556 * @retval None
Kojto 158:b23ee177fd68 1557 */
Kojto 158:b23ee177fd68 1558 __STATIC_INLINE void LL_LPUART_ClearFlag_CM(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 1559 {
Kojto 158:b23ee177fd68 1560 WRITE_REG(LPUARTx->ICR, USART_ICR_CMCF);
Kojto 158:b23ee177fd68 1561 }
Kojto 158:b23ee177fd68 1562
Kojto 158:b23ee177fd68 1563 /**
Kojto 158:b23ee177fd68 1564 * @brief Clear Wake Up from stop mode Flag
Kojto 158:b23ee177fd68 1565 * @rmtoll ICR WUCF LL_LPUART_ClearFlag_WKUP
Kojto 158:b23ee177fd68 1566 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 1567 * @retval None
Kojto 158:b23ee177fd68 1568 */
Kojto 158:b23ee177fd68 1569 __STATIC_INLINE void LL_LPUART_ClearFlag_WKUP(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 1570 {
Kojto 158:b23ee177fd68 1571 WRITE_REG(LPUARTx->ICR, USART_ICR_WUCF);
Kojto 158:b23ee177fd68 1572 }
Kojto 158:b23ee177fd68 1573
Kojto 158:b23ee177fd68 1574 /**
Kojto 158:b23ee177fd68 1575 * @}
Kojto 158:b23ee177fd68 1576 */
Kojto 158:b23ee177fd68 1577
Kojto 158:b23ee177fd68 1578 /** @defgroup LPUART_LL_EF_IT_Management IT_Management
Kojto 158:b23ee177fd68 1579 * @{
Kojto 158:b23ee177fd68 1580 */
Kojto 158:b23ee177fd68 1581
Kojto 158:b23ee177fd68 1582 /**
Kojto 158:b23ee177fd68 1583 * @brief Enable IDLE Interrupt
Kojto 158:b23ee177fd68 1584 * @rmtoll CR1 IDLEIE LL_LPUART_EnableIT_IDLE
Kojto 158:b23ee177fd68 1585 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 1586 * @retval None
Kojto 158:b23ee177fd68 1587 */
Kojto 158:b23ee177fd68 1588 __STATIC_INLINE void LL_LPUART_EnableIT_IDLE(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 1589 {
Kojto 158:b23ee177fd68 1590 SET_BIT(LPUARTx->CR1, USART_CR1_IDLEIE);
Kojto 158:b23ee177fd68 1591 }
Kojto 158:b23ee177fd68 1592
Kojto 158:b23ee177fd68 1593 /**
Kojto 158:b23ee177fd68 1594 * @brief Enable RX Not Empty Interrupt
Kojto 158:b23ee177fd68 1595 * @rmtoll CR1 RXNEIE LL_LPUART_EnableIT_RXNE
Kojto 158:b23ee177fd68 1596 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 1597 * @retval None
Kojto 158:b23ee177fd68 1598 */
Kojto 158:b23ee177fd68 1599 __STATIC_INLINE void LL_LPUART_EnableIT_RXNE(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 1600 {
Kojto 158:b23ee177fd68 1601 SET_BIT(LPUARTx->CR1, USART_CR1_RXNEIE);
Kojto 158:b23ee177fd68 1602 }
Kojto 158:b23ee177fd68 1603
Kojto 158:b23ee177fd68 1604 /**
Kojto 158:b23ee177fd68 1605 * @brief Enable Transmission Complete Interrupt
Kojto 158:b23ee177fd68 1606 * @rmtoll CR1 TCIE LL_LPUART_EnableIT_TC
Kojto 158:b23ee177fd68 1607 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 1608 * @retval None
Kojto 158:b23ee177fd68 1609 */
Kojto 158:b23ee177fd68 1610 __STATIC_INLINE void LL_LPUART_EnableIT_TC(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 1611 {
Kojto 158:b23ee177fd68 1612 SET_BIT(LPUARTx->CR1, USART_CR1_TCIE);
Kojto 158:b23ee177fd68 1613 }
Kojto 158:b23ee177fd68 1614
Kojto 158:b23ee177fd68 1615 /**
Kojto 158:b23ee177fd68 1616 * @brief Enable TX Empty Interrupt
Kojto 158:b23ee177fd68 1617 * @rmtoll CR1 TXEIE LL_LPUART_EnableIT_TXE
Kojto 158:b23ee177fd68 1618 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 1619 * @retval None
Kojto 158:b23ee177fd68 1620 */
Kojto 158:b23ee177fd68 1621 __STATIC_INLINE void LL_LPUART_EnableIT_TXE(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 1622 {
Kojto 158:b23ee177fd68 1623 SET_BIT(LPUARTx->CR1, USART_CR1_TXEIE);
Kojto 158:b23ee177fd68 1624 }
Kojto 158:b23ee177fd68 1625
Kojto 158:b23ee177fd68 1626 /**
Kojto 158:b23ee177fd68 1627 * @brief Enable Parity Error Interrupt
Kojto 158:b23ee177fd68 1628 * @rmtoll CR1 PEIE LL_LPUART_EnableIT_PE
Kojto 158:b23ee177fd68 1629 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 1630 * @retval None
Kojto 158:b23ee177fd68 1631 */
Kojto 158:b23ee177fd68 1632 __STATIC_INLINE void LL_LPUART_EnableIT_PE(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 1633 {
Kojto 158:b23ee177fd68 1634 SET_BIT(LPUARTx->CR1, USART_CR1_PEIE);
Kojto 158:b23ee177fd68 1635 }
Kojto 158:b23ee177fd68 1636
Kojto 158:b23ee177fd68 1637 /**
Kojto 158:b23ee177fd68 1638 * @brief Enable Character Match Interrupt
Kojto 158:b23ee177fd68 1639 * @rmtoll CR1 CMIE LL_LPUART_EnableIT_CM
Kojto 158:b23ee177fd68 1640 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 1641 * @retval None
Kojto 158:b23ee177fd68 1642 */
Kojto 158:b23ee177fd68 1643 __STATIC_INLINE void LL_LPUART_EnableIT_CM(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 1644 {
Kojto 158:b23ee177fd68 1645 SET_BIT(LPUARTx->CR1, USART_CR1_CMIE);
Kojto 158:b23ee177fd68 1646 }
Kojto 158:b23ee177fd68 1647
Kojto 158:b23ee177fd68 1648 /**
Kojto 158:b23ee177fd68 1649 * @brief Enable Error Interrupt
Kojto 158:b23ee177fd68 1650 * @note When set, Error Interrupt Enable Bit is enabling interrupt generation in case of a framing
Kojto 158:b23ee177fd68 1651 * error, overrun error or noise flag (FE=1 or ORE=1 or NF=1 in the LPUARTx_ISR register).
Kojto 158:b23ee177fd68 1652 * - 0: Interrupt is inhibited
Kojto 158:b23ee177fd68 1653 * - 1: An interrupt is generated when FE=1 or ORE=1 or NF=1 in the LPUARTx_ISR register.
Kojto 158:b23ee177fd68 1654 * @rmtoll CR3 EIE LL_LPUART_EnableIT_ERROR
Kojto 158:b23ee177fd68 1655 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 1656 * @retval None
Kojto 158:b23ee177fd68 1657 */
Kojto 158:b23ee177fd68 1658 __STATIC_INLINE void LL_LPUART_EnableIT_ERROR(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 1659 {
Kojto 158:b23ee177fd68 1660 SET_BIT(LPUARTx->CR3, USART_CR3_EIE);
Kojto 158:b23ee177fd68 1661 }
Kojto 158:b23ee177fd68 1662
Kojto 158:b23ee177fd68 1663 /**
Kojto 158:b23ee177fd68 1664 * @brief Enable CTS Interrupt
Kojto 158:b23ee177fd68 1665 * @rmtoll CR3 CTSIE LL_LPUART_EnableIT_CTS
Kojto 158:b23ee177fd68 1666 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 1667 * @retval None
Kojto 158:b23ee177fd68 1668 */
Kojto 158:b23ee177fd68 1669 __STATIC_INLINE void LL_LPUART_EnableIT_CTS(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 1670 {
Kojto 158:b23ee177fd68 1671 SET_BIT(LPUARTx->CR3, USART_CR3_CTSIE);
Kojto 158:b23ee177fd68 1672 }
Kojto 158:b23ee177fd68 1673
Kojto 158:b23ee177fd68 1674 /**
Kojto 158:b23ee177fd68 1675 * @brief Enable Wake Up from Stop Mode Interrupt
Kojto 158:b23ee177fd68 1676 * @rmtoll CR3 WUFIE LL_LPUART_EnableIT_WKUP
Kojto 158:b23ee177fd68 1677 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 1678 * @retval None
Kojto 158:b23ee177fd68 1679 */
Kojto 158:b23ee177fd68 1680 __STATIC_INLINE void LL_LPUART_EnableIT_WKUP(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 1681 {
Kojto 158:b23ee177fd68 1682 SET_BIT(LPUARTx->CR3, USART_CR3_WUFIE);
Kojto 158:b23ee177fd68 1683 }
Kojto 158:b23ee177fd68 1684
Kojto 158:b23ee177fd68 1685 /**
Kojto 158:b23ee177fd68 1686 * @brief Disable IDLE Interrupt
Kojto 158:b23ee177fd68 1687 * @rmtoll CR1 IDLEIE LL_LPUART_DisableIT_IDLE
Kojto 158:b23ee177fd68 1688 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 1689 * @retval None
Kojto 158:b23ee177fd68 1690 */
Kojto 158:b23ee177fd68 1691 __STATIC_INLINE void LL_LPUART_DisableIT_IDLE(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 1692 {
Kojto 158:b23ee177fd68 1693 CLEAR_BIT(LPUARTx->CR1, USART_CR1_IDLEIE);
Kojto 158:b23ee177fd68 1694 }
Kojto 158:b23ee177fd68 1695
Kojto 158:b23ee177fd68 1696 /**
Kojto 158:b23ee177fd68 1697 * @brief Disable RX Not Empty Interrupt
Kojto 158:b23ee177fd68 1698 * @rmtoll CR1 RXNEIE LL_LPUART_DisableIT_RXNE
Kojto 158:b23ee177fd68 1699 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 1700 * @retval None
Kojto 158:b23ee177fd68 1701 */
Kojto 158:b23ee177fd68 1702 __STATIC_INLINE void LL_LPUART_DisableIT_RXNE(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 1703 {
Kojto 158:b23ee177fd68 1704 CLEAR_BIT(LPUARTx->CR1, USART_CR1_RXNEIE);
Kojto 158:b23ee177fd68 1705 }
Kojto 158:b23ee177fd68 1706
Kojto 158:b23ee177fd68 1707 /**
Kojto 158:b23ee177fd68 1708 * @brief Disable Transmission Complete Interrupt
Kojto 158:b23ee177fd68 1709 * @rmtoll CR1 TCIE LL_LPUART_DisableIT_TC
Kojto 158:b23ee177fd68 1710 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 1711 * @retval None
Kojto 158:b23ee177fd68 1712 */
Kojto 158:b23ee177fd68 1713 __STATIC_INLINE void LL_LPUART_DisableIT_TC(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 1714 {
Kojto 158:b23ee177fd68 1715 CLEAR_BIT(LPUARTx->CR1, USART_CR1_TCIE);
Kojto 158:b23ee177fd68 1716 }
Kojto 158:b23ee177fd68 1717
Kojto 158:b23ee177fd68 1718 /**
Kojto 158:b23ee177fd68 1719 * @brief Disable TX Empty Interrupt
Kojto 158:b23ee177fd68 1720 * @rmtoll CR1 TXEIE LL_LPUART_DisableIT_TXE
Kojto 158:b23ee177fd68 1721 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 1722 * @retval None
Kojto 158:b23ee177fd68 1723 */
Kojto 158:b23ee177fd68 1724 __STATIC_INLINE void LL_LPUART_DisableIT_TXE(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 1725 {
Kojto 158:b23ee177fd68 1726 CLEAR_BIT(LPUARTx->CR1, USART_CR1_TXEIE);
Kojto 158:b23ee177fd68 1727 }
Kojto 158:b23ee177fd68 1728
Kojto 158:b23ee177fd68 1729 /**
Kojto 158:b23ee177fd68 1730 * @brief Disable Parity Error Interrupt
Kojto 158:b23ee177fd68 1731 * @rmtoll CR1 PEIE LL_LPUART_DisableIT_PE
Kojto 158:b23ee177fd68 1732 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 1733 * @retval None
Kojto 158:b23ee177fd68 1734 */
Kojto 158:b23ee177fd68 1735 __STATIC_INLINE void LL_LPUART_DisableIT_PE(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 1736 {
Kojto 158:b23ee177fd68 1737 CLEAR_BIT(LPUARTx->CR1, USART_CR1_PEIE);
Kojto 158:b23ee177fd68 1738 }
Kojto 158:b23ee177fd68 1739
Kojto 158:b23ee177fd68 1740 /**
Kojto 158:b23ee177fd68 1741 * @brief Disable Character Match Interrupt
Kojto 158:b23ee177fd68 1742 * @rmtoll CR1 CMIE LL_LPUART_DisableIT_CM
Kojto 158:b23ee177fd68 1743 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 1744 * @retval None
Kojto 158:b23ee177fd68 1745 */
Kojto 158:b23ee177fd68 1746 __STATIC_INLINE void LL_LPUART_DisableIT_CM(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 1747 {
Kojto 158:b23ee177fd68 1748 CLEAR_BIT(LPUARTx->CR1, USART_CR1_CMIE);
Kojto 158:b23ee177fd68 1749 }
Kojto 158:b23ee177fd68 1750
Kojto 158:b23ee177fd68 1751 /**
Kojto 158:b23ee177fd68 1752 * @brief Disable Error Interrupt
Kojto 158:b23ee177fd68 1753 * @note When set, Error Interrupt Enable Bit is enabling interrupt generation in case of a framing
Kojto 158:b23ee177fd68 1754 * error, overrun error or noise flag (FE=1 or ORE=1 or NF=1 in the LPUARTx_ISR register).
Kojto 158:b23ee177fd68 1755 * - 0: Interrupt is inhibited
Kojto 158:b23ee177fd68 1756 * - 1: An interrupt is generated when FE=1 or ORE=1 or NF=1 in the LPUARTx_ISR register.
Kojto 158:b23ee177fd68 1757 * @rmtoll CR3 EIE LL_LPUART_DisableIT_ERROR
Kojto 158:b23ee177fd68 1758 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 1759 * @retval None
Kojto 158:b23ee177fd68 1760 */
Kojto 158:b23ee177fd68 1761 __STATIC_INLINE void LL_LPUART_DisableIT_ERROR(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 1762 {
Kojto 158:b23ee177fd68 1763 CLEAR_BIT(LPUARTx->CR3, USART_CR3_EIE);
Kojto 158:b23ee177fd68 1764 }
Kojto 158:b23ee177fd68 1765
Kojto 158:b23ee177fd68 1766 /**
Kojto 158:b23ee177fd68 1767 * @brief Disable CTS Interrupt
Kojto 158:b23ee177fd68 1768 * @rmtoll CR3 CTSIE LL_LPUART_DisableIT_CTS
Kojto 158:b23ee177fd68 1769 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 1770 * @retval None
Kojto 158:b23ee177fd68 1771 */
Kojto 158:b23ee177fd68 1772 __STATIC_INLINE void LL_LPUART_DisableIT_CTS(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 1773 {
Kojto 158:b23ee177fd68 1774 CLEAR_BIT(LPUARTx->CR3, USART_CR3_CTSIE);
Kojto 158:b23ee177fd68 1775 }
Kojto 158:b23ee177fd68 1776
Kojto 158:b23ee177fd68 1777 /**
Kojto 158:b23ee177fd68 1778 * @brief Disable Wake Up from Stop Mode Interrupt
Kojto 158:b23ee177fd68 1779 * @rmtoll CR3 WUFIE LL_LPUART_DisableIT_WKUP
Kojto 158:b23ee177fd68 1780 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 1781 * @retval None
Kojto 158:b23ee177fd68 1782 */
Kojto 158:b23ee177fd68 1783 __STATIC_INLINE void LL_LPUART_DisableIT_WKUP(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 1784 {
Kojto 158:b23ee177fd68 1785 CLEAR_BIT(LPUARTx->CR3, USART_CR3_WUFIE);
Kojto 158:b23ee177fd68 1786 }
Kojto 158:b23ee177fd68 1787
Kojto 158:b23ee177fd68 1788 /**
Kojto 158:b23ee177fd68 1789 * @brief Check if the LPUART IDLE Interrupt source is enabled or disabled.
Kojto 158:b23ee177fd68 1790 * @rmtoll CR1 IDLEIE LL_LPUART_IsEnabledIT_IDLE
Kojto 158:b23ee177fd68 1791 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 1792 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 1793 */
Kojto 158:b23ee177fd68 1794 __STATIC_INLINE uint32_t LL_LPUART_IsEnabledIT_IDLE(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 1795 {
Kojto 158:b23ee177fd68 1796 return (READ_BIT(LPUARTx->CR1, USART_CR1_IDLEIE) == (USART_CR1_IDLEIE));
Kojto 158:b23ee177fd68 1797 }
Kojto 158:b23ee177fd68 1798
Kojto 158:b23ee177fd68 1799 /**
Kojto 158:b23ee177fd68 1800 * @brief Check if the LPUART RX Not Empty Interrupt is enabled or disabled.
Kojto 158:b23ee177fd68 1801 * @rmtoll CR1 RXNEIE LL_LPUART_IsEnabledIT_RXNE
Kojto 158:b23ee177fd68 1802 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 1803 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 1804 */
Kojto 158:b23ee177fd68 1805 __STATIC_INLINE uint32_t LL_LPUART_IsEnabledIT_RXNE(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 1806 {
Kojto 158:b23ee177fd68 1807 return (READ_BIT(LPUARTx->CR1, USART_CR1_RXNEIE) == (USART_CR1_RXNEIE));
Kojto 158:b23ee177fd68 1808 }
Kojto 158:b23ee177fd68 1809
Kojto 158:b23ee177fd68 1810 /**
Kojto 158:b23ee177fd68 1811 * @brief Check if the LPUART Transmission Complete Interrupt is enabled or disabled.
Kojto 158:b23ee177fd68 1812 * @rmtoll CR1 TCIE LL_LPUART_IsEnabledIT_TC
Kojto 158:b23ee177fd68 1813 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 1814 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 1815 */
Kojto 158:b23ee177fd68 1816 __STATIC_INLINE uint32_t LL_LPUART_IsEnabledIT_TC(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 1817 {
Kojto 158:b23ee177fd68 1818 return (READ_BIT(LPUARTx->CR1, USART_CR1_TCIE) == (USART_CR1_TCIE));
Kojto 158:b23ee177fd68 1819 }
Kojto 158:b23ee177fd68 1820
Kojto 158:b23ee177fd68 1821 /**
Kojto 158:b23ee177fd68 1822 * @brief Check if the LPUART TX Empty Interrupt is enabled or disabled.
Kojto 158:b23ee177fd68 1823 * @rmtoll CR1 TXEIE LL_LPUART_IsEnabledIT_TXE
Kojto 158:b23ee177fd68 1824 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 1825 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 1826 */
Kojto 158:b23ee177fd68 1827 __STATIC_INLINE uint32_t LL_LPUART_IsEnabledIT_TXE(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 1828 {
Kojto 158:b23ee177fd68 1829 return (READ_BIT(LPUARTx->CR1, USART_CR1_TXEIE) == (USART_CR1_TXEIE));
Kojto 158:b23ee177fd68 1830 }
Kojto 158:b23ee177fd68 1831
Kojto 158:b23ee177fd68 1832 /**
Kojto 158:b23ee177fd68 1833 * @brief Check if the LPUART Parity Error Interrupt is enabled or disabled.
Kojto 158:b23ee177fd68 1834 * @rmtoll CR1 PEIE LL_LPUART_IsEnabledIT_PE
Kojto 158:b23ee177fd68 1835 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 1836 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 1837 */
Kojto 158:b23ee177fd68 1838 __STATIC_INLINE uint32_t LL_LPUART_IsEnabledIT_PE(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 1839 {
Kojto 158:b23ee177fd68 1840 return (READ_BIT(LPUARTx->CR1, USART_CR1_PEIE) == (USART_CR1_PEIE));
Kojto 158:b23ee177fd68 1841 }
Kojto 158:b23ee177fd68 1842
Kojto 158:b23ee177fd68 1843 /**
Kojto 158:b23ee177fd68 1844 * @brief Check if the LPUART Character Match Interrupt is enabled or disabled.
Kojto 158:b23ee177fd68 1845 * @rmtoll CR1 CMIE LL_LPUART_IsEnabledIT_CM
Kojto 158:b23ee177fd68 1846 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 1847 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 1848 */
Kojto 158:b23ee177fd68 1849 __STATIC_INLINE uint32_t LL_LPUART_IsEnabledIT_CM(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 1850 {
Kojto 158:b23ee177fd68 1851 return (READ_BIT(LPUARTx->CR1, USART_CR1_CMIE) == (USART_CR1_CMIE));
Kojto 158:b23ee177fd68 1852 }
Kojto 158:b23ee177fd68 1853
Kojto 158:b23ee177fd68 1854 /**
Kojto 158:b23ee177fd68 1855 * @brief Check if the LPUART Error Interrupt is enabled or disabled.
Kojto 158:b23ee177fd68 1856 * @rmtoll CR3 EIE LL_LPUART_IsEnabledIT_ERROR
Kojto 158:b23ee177fd68 1857 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 1858 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 1859 */
Kojto 158:b23ee177fd68 1860 __STATIC_INLINE uint32_t LL_LPUART_IsEnabledIT_ERROR(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 1861 {
Kojto 158:b23ee177fd68 1862 return (READ_BIT(LPUARTx->CR3, USART_CR3_EIE) == (USART_CR3_EIE));
Kojto 158:b23ee177fd68 1863 }
Kojto 158:b23ee177fd68 1864
Kojto 158:b23ee177fd68 1865 /**
Kojto 158:b23ee177fd68 1866 * @brief Check if the LPUART CTS Interrupt is enabled or disabled.
Kojto 158:b23ee177fd68 1867 * @rmtoll CR3 CTSIE LL_LPUART_IsEnabledIT_CTS
Kojto 158:b23ee177fd68 1868 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 1869 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 1870 */
Kojto 158:b23ee177fd68 1871 __STATIC_INLINE uint32_t LL_LPUART_IsEnabledIT_CTS(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 1872 {
Kojto 158:b23ee177fd68 1873 return (READ_BIT(LPUARTx->CR3, USART_CR3_CTSIE) == (USART_CR3_CTSIE));
Kojto 158:b23ee177fd68 1874 }
Kojto 158:b23ee177fd68 1875
Kojto 158:b23ee177fd68 1876 /**
Kojto 158:b23ee177fd68 1877 * @brief Check if the LPUART Wake Up from Stop Mode Interrupt is enabled or disabled.
Kojto 158:b23ee177fd68 1878 * @rmtoll CR3 WUFIE LL_LPUART_IsEnabledIT_WKUP
Kojto 158:b23ee177fd68 1879 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 1880 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 1881 */
Kojto 158:b23ee177fd68 1882 __STATIC_INLINE uint32_t LL_LPUART_IsEnabledIT_WKUP(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 1883 {
Kojto 158:b23ee177fd68 1884 return (READ_BIT(LPUARTx->CR3, USART_CR3_WUFIE) == (USART_CR3_WUFIE));
Kojto 158:b23ee177fd68 1885 }
Kojto 158:b23ee177fd68 1886
Kojto 158:b23ee177fd68 1887 /**
Kojto 158:b23ee177fd68 1888 * @}
Kojto 158:b23ee177fd68 1889 */
Kojto 158:b23ee177fd68 1890
Kojto 158:b23ee177fd68 1891 /** @defgroup LPUART_LL_EF_DMA_Management DMA_Management
Kojto 158:b23ee177fd68 1892 * @{
Kojto 158:b23ee177fd68 1893 */
Kojto 158:b23ee177fd68 1894
Kojto 158:b23ee177fd68 1895 /**
Kojto 158:b23ee177fd68 1896 * @brief Enable DMA Mode for reception
Kojto 158:b23ee177fd68 1897 * @rmtoll CR3 DMAR LL_LPUART_EnableDMAReq_RX
Kojto 158:b23ee177fd68 1898 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 1899 * @retval None
Kojto 158:b23ee177fd68 1900 */
Kojto 158:b23ee177fd68 1901 __STATIC_INLINE void LL_LPUART_EnableDMAReq_RX(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 1902 {
Kojto 158:b23ee177fd68 1903 SET_BIT(LPUARTx->CR3, USART_CR3_DMAR);
Kojto 158:b23ee177fd68 1904 }
Kojto 158:b23ee177fd68 1905
Kojto 158:b23ee177fd68 1906 /**
Kojto 158:b23ee177fd68 1907 * @brief Disable DMA Mode for reception
Kojto 158:b23ee177fd68 1908 * @rmtoll CR3 DMAR LL_LPUART_DisableDMAReq_RX
Kojto 158:b23ee177fd68 1909 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 1910 * @retval None
Kojto 158:b23ee177fd68 1911 */
Kojto 158:b23ee177fd68 1912 __STATIC_INLINE void LL_LPUART_DisableDMAReq_RX(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 1913 {
Kojto 158:b23ee177fd68 1914 CLEAR_BIT(LPUARTx->CR3, USART_CR3_DMAR);
Kojto 158:b23ee177fd68 1915 }
Kojto 158:b23ee177fd68 1916
Kojto 158:b23ee177fd68 1917 /**
Kojto 158:b23ee177fd68 1918 * @brief Check if DMA Mode is enabled for reception
Kojto 158:b23ee177fd68 1919 * @rmtoll CR3 DMAR LL_LPUART_IsEnabledDMAReq_RX
Kojto 158:b23ee177fd68 1920 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 1921 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 1922 */
Kojto 158:b23ee177fd68 1923 __STATIC_INLINE uint32_t LL_LPUART_IsEnabledDMAReq_RX(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 1924 {
Kojto 158:b23ee177fd68 1925 return (READ_BIT(LPUARTx->CR3, USART_CR3_DMAR) == (USART_CR3_DMAR));
Kojto 158:b23ee177fd68 1926 }
Kojto 158:b23ee177fd68 1927
Kojto 158:b23ee177fd68 1928 /**
Kojto 158:b23ee177fd68 1929 * @brief Enable DMA Mode for transmission
Kojto 158:b23ee177fd68 1930 * @rmtoll CR3 DMAT LL_LPUART_EnableDMAReq_TX
Kojto 158:b23ee177fd68 1931 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 1932 * @retval None
Kojto 158:b23ee177fd68 1933 */
Kojto 158:b23ee177fd68 1934 __STATIC_INLINE void LL_LPUART_EnableDMAReq_TX(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 1935 {
Kojto 158:b23ee177fd68 1936 SET_BIT(LPUARTx->CR3, USART_CR3_DMAT);
Kojto 158:b23ee177fd68 1937 }
Kojto 158:b23ee177fd68 1938
Kojto 158:b23ee177fd68 1939 /**
Kojto 158:b23ee177fd68 1940 * @brief Disable DMA Mode for transmission
Kojto 158:b23ee177fd68 1941 * @rmtoll CR3 DMAT LL_LPUART_DisableDMAReq_TX
Kojto 158:b23ee177fd68 1942 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 1943 * @retval None
Kojto 158:b23ee177fd68 1944 */
Kojto 158:b23ee177fd68 1945 __STATIC_INLINE void LL_LPUART_DisableDMAReq_TX(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 1946 {
Kojto 158:b23ee177fd68 1947 CLEAR_BIT(LPUARTx->CR3, USART_CR3_DMAT);
Kojto 158:b23ee177fd68 1948 }
Kojto 158:b23ee177fd68 1949
Kojto 158:b23ee177fd68 1950 /**
Kojto 158:b23ee177fd68 1951 * @brief Check if DMA Mode is enabled for transmission
Kojto 158:b23ee177fd68 1952 * @rmtoll CR3 DMAT LL_LPUART_IsEnabledDMAReq_TX
Kojto 158:b23ee177fd68 1953 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 1954 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 1955 */
Kojto 158:b23ee177fd68 1956 __STATIC_INLINE uint32_t LL_LPUART_IsEnabledDMAReq_TX(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 1957 {
Kojto 158:b23ee177fd68 1958 return (READ_BIT(LPUARTx->CR3, USART_CR3_DMAT) == (USART_CR3_DMAT));
Kojto 158:b23ee177fd68 1959 }
Kojto 158:b23ee177fd68 1960
Kojto 158:b23ee177fd68 1961 /**
Kojto 158:b23ee177fd68 1962 * @brief Enable DMA Disabling on Reception Error
Kojto 158:b23ee177fd68 1963 * @rmtoll CR3 DDRE LL_LPUART_EnableDMADeactOnRxErr
Kojto 158:b23ee177fd68 1964 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 1965 * @retval None
Kojto 158:b23ee177fd68 1966 */
Kojto 158:b23ee177fd68 1967 __STATIC_INLINE void LL_LPUART_EnableDMADeactOnRxErr(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 1968 {
Kojto 158:b23ee177fd68 1969 SET_BIT(LPUARTx->CR3, USART_CR3_DDRE);
Kojto 158:b23ee177fd68 1970 }
Kojto 158:b23ee177fd68 1971
Kojto 158:b23ee177fd68 1972 /**
Kojto 158:b23ee177fd68 1973 * @brief Disable DMA Disabling on Reception Error
Kojto 158:b23ee177fd68 1974 * @rmtoll CR3 DDRE LL_LPUART_DisableDMADeactOnRxErr
Kojto 158:b23ee177fd68 1975 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 1976 * @retval None
Kojto 158:b23ee177fd68 1977 */
Kojto 158:b23ee177fd68 1978 __STATIC_INLINE void LL_LPUART_DisableDMADeactOnRxErr(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 1979 {
Kojto 158:b23ee177fd68 1980 CLEAR_BIT(LPUARTx->CR3, USART_CR3_DDRE);
Kojto 158:b23ee177fd68 1981 }
Kojto 158:b23ee177fd68 1982
Kojto 158:b23ee177fd68 1983 /**
Kojto 158:b23ee177fd68 1984 * @brief Indicate if DMA Disabling on Reception Error is disabled
Kojto 158:b23ee177fd68 1985 * @rmtoll CR3 DDRE LL_LPUART_IsEnabledDMADeactOnRxErr
Kojto 158:b23ee177fd68 1986 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 1987 * @retval State of bit (1 or 0).
Kojto 158:b23ee177fd68 1988 */
Kojto 158:b23ee177fd68 1989 __STATIC_INLINE uint32_t LL_LPUART_IsEnabledDMADeactOnRxErr(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 1990 {
Kojto 158:b23ee177fd68 1991 return (READ_BIT(LPUARTx->CR3, USART_CR3_DDRE) == (USART_CR3_DDRE));
Kojto 158:b23ee177fd68 1992 }
Kojto 158:b23ee177fd68 1993
Kojto 158:b23ee177fd68 1994 /**
Kojto 158:b23ee177fd68 1995 * @brief Get the LPUART data register address used for DMA transfer
Kojto 158:b23ee177fd68 1996 * @rmtoll RDR RDR LL_LPUART_DMA_GetRegAddr\n
Kojto 158:b23ee177fd68 1997 * @rmtoll TDR TDR LL_LPUART_DMA_GetRegAddr
Kojto 158:b23ee177fd68 1998 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 1999 * @param Direction This parameter can be one of the following values:
Kojto 158:b23ee177fd68 2000 * @arg @ref LL_LPUART_DMA_REG_DATA_TRANSMIT
Kojto 158:b23ee177fd68 2001 * @arg @ref LL_LPUART_DMA_REG_DATA_RECEIVE
Kojto 158:b23ee177fd68 2002 * @retval Address of data register
Kojto 158:b23ee177fd68 2003 */
Kojto 158:b23ee177fd68 2004 __STATIC_INLINE uint32_t LL_LPUART_DMA_GetRegAddr(USART_TypeDef *LPUARTx, uint32_t Direction)
Kojto 158:b23ee177fd68 2005 {
Kojto 158:b23ee177fd68 2006 register uint32_t data_reg_addr = 0U;
Kojto 158:b23ee177fd68 2007
Kojto 158:b23ee177fd68 2008 if (Direction == LL_LPUART_DMA_REG_DATA_TRANSMIT)
Kojto 158:b23ee177fd68 2009 {
Kojto 158:b23ee177fd68 2010 /* return address of TDR register */
Kojto 158:b23ee177fd68 2011 data_reg_addr = (uint32_t) &(LPUARTx->TDR);
Kojto 158:b23ee177fd68 2012 }
Kojto 158:b23ee177fd68 2013 else
Kojto 158:b23ee177fd68 2014 {
Kojto 158:b23ee177fd68 2015 /* return address of RDR register */
Kojto 158:b23ee177fd68 2016 data_reg_addr = (uint32_t) &(LPUARTx->RDR);
Kojto 158:b23ee177fd68 2017 }
Kojto 158:b23ee177fd68 2018
Kojto 158:b23ee177fd68 2019 return data_reg_addr;
Kojto 158:b23ee177fd68 2020 }
Kojto 158:b23ee177fd68 2021
Kojto 158:b23ee177fd68 2022 /**
Kojto 158:b23ee177fd68 2023 * @}
Kojto 158:b23ee177fd68 2024 */
Kojto 158:b23ee177fd68 2025
Kojto 158:b23ee177fd68 2026 /** @defgroup LPUART_LL_EF_Data_Management Data_Management
Kojto 158:b23ee177fd68 2027 * @{
Kojto 158:b23ee177fd68 2028 */
Kojto 158:b23ee177fd68 2029
Kojto 158:b23ee177fd68 2030 /**
Kojto 158:b23ee177fd68 2031 * @brief Read Receiver Data register (Receive Data value, 8 bits)
Kojto 158:b23ee177fd68 2032 * @rmtoll RDR RDR LL_LPUART_ReceiveData8
Kojto 158:b23ee177fd68 2033 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 2034 * @retval Time Value between Min_Data=0x00 and Max_Data=0xFF
Kojto 158:b23ee177fd68 2035 */
Kojto 158:b23ee177fd68 2036 __STATIC_INLINE uint8_t LL_LPUART_ReceiveData8(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 2037 {
Kojto 158:b23ee177fd68 2038 return (uint8_t)(READ_BIT(LPUARTx->RDR, USART_RDR_RDR));
Kojto 158:b23ee177fd68 2039 }
Kojto 158:b23ee177fd68 2040
Kojto 158:b23ee177fd68 2041 /**
Kojto 158:b23ee177fd68 2042 * @brief Read Receiver Data register (Receive Data value, 9 bits)
Kojto 158:b23ee177fd68 2043 * @rmtoll RDR RDR LL_LPUART_ReceiveData9
Kojto 158:b23ee177fd68 2044 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 2045 * @retval Time Value between Min_Data=0x00 and Max_Data=0x1FF
Kojto 158:b23ee177fd68 2046 */
Kojto 158:b23ee177fd68 2047 __STATIC_INLINE uint16_t LL_LPUART_ReceiveData9(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 2048 {
Kojto 158:b23ee177fd68 2049 return (uint16_t)(READ_BIT(LPUARTx->RDR, USART_RDR_RDR));
Kojto 158:b23ee177fd68 2050 }
Kojto 158:b23ee177fd68 2051
Kojto 158:b23ee177fd68 2052 /**
Kojto 158:b23ee177fd68 2053 * @brief Write in Transmitter Data Register (Transmit Data value, 8 bits)
Kojto 158:b23ee177fd68 2054 * @rmtoll TDR TDR LL_LPUART_TransmitData8
Kojto 158:b23ee177fd68 2055 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 2056 * @param Value between Min_Data=0x00 and Max_Data=0xFF
Kojto 158:b23ee177fd68 2057 * @retval None
Kojto 158:b23ee177fd68 2058 */
Kojto 158:b23ee177fd68 2059 __STATIC_INLINE void LL_LPUART_TransmitData8(USART_TypeDef *LPUARTx, uint8_t Value)
Kojto 158:b23ee177fd68 2060 {
Kojto 158:b23ee177fd68 2061 LPUARTx->TDR = Value;
Kojto 158:b23ee177fd68 2062 }
Kojto 158:b23ee177fd68 2063
Kojto 158:b23ee177fd68 2064 /**
Kojto 158:b23ee177fd68 2065 * @brief Write in Transmitter Data Register (Transmit Data value, 9 bits)
Kojto 158:b23ee177fd68 2066 * @rmtoll TDR TDR LL_LPUART_TransmitData9
Kojto 158:b23ee177fd68 2067 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 2068 * @param Value between Min_Data=0x00 and Max_Data=0x1FF
Kojto 158:b23ee177fd68 2069 * @retval None
Kojto 158:b23ee177fd68 2070 */
Kojto 158:b23ee177fd68 2071 __STATIC_INLINE void LL_LPUART_TransmitData9(USART_TypeDef *LPUARTx, uint16_t Value)
Kojto 158:b23ee177fd68 2072 {
Kojto 158:b23ee177fd68 2073 LPUARTx->TDR = Value & 0x1FFU;
Kojto 158:b23ee177fd68 2074 }
Kojto 158:b23ee177fd68 2075
Kojto 158:b23ee177fd68 2076 /**
Kojto 158:b23ee177fd68 2077 * @}
Kojto 158:b23ee177fd68 2078 */
Kojto 158:b23ee177fd68 2079
Kojto 158:b23ee177fd68 2080 /** @defgroup LPUART_LL_EF_Execution Execution
Kojto 158:b23ee177fd68 2081 * @{
Kojto 158:b23ee177fd68 2082 */
Kojto 158:b23ee177fd68 2083
Kojto 158:b23ee177fd68 2084 /**
Kojto 158:b23ee177fd68 2085 * @brief Request Break sending
Kojto 158:b23ee177fd68 2086 * @rmtoll RQR SBKRQ LL_LPUART_RequestBreakSending
Kojto 158:b23ee177fd68 2087 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 2088 * @retval None
Kojto 158:b23ee177fd68 2089 */
Kojto 158:b23ee177fd68 2090 __STATIC_INLINE void LL_LPUART_RequestBreakSending(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 2091 {
Kojto 158:b23ee177fd68 2092 SET_BIT(LPUARTx->RQR, USART_RQR_SBKRQ);
Kojto 158:b23ee177fd68 2093 }
Kojto 158:b23ee177fd68 2094
Kojto 158:b23ee177fd68 2095 /**
Kojto 158:b23ee177fd68 2096 * @brief Put LPUART in mute mode and set the RWU flag
Kojto 158:b23ee177fd68 2097 * @rmtoll RQR MMRQ LL_LPUART_RequestEnterMuteMode
Kojto 158:b23ee177fd68 2098 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 2099 * @retval None
Kojto 158:b23ee177fd68 2100 */
Kojto 158:b23ee177fd68 2101 __STATIC_INLINE void LL_LPUART_RequestEnterMuteMode(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 2102 {
Kojto 158:b23ee177fd68 2103 SET_BIT(LPUARTx->RQR, USART_RQR_MMRQ);
Kojto 158:b23ee177fd68 2104 }
Kojto 158:b23ee177fd68 2105
Kojto 158:b23ee177fd68 2106 /**
Kojto 158:b23ee177fd68 2107 * @brief Request a Receive Data flush
Kojto 158:b23ee177fd68 2108 * @rmtoll RQR RXFRQ LL_LPUART_RequestRxDataFlush
Kojto 158:b23ee177fd68 2109 * @param LPUARTx LPUART Instance
Kojto 158:b23ee177fd68 2110 * @retval None
Kojto 158:b23ee177fd68 2111 */
Kojto 158:b23ee177fd68 2112 __STATIC_INLINE void LL_LPUART_RequestRxDataFlush(USART_TypeDef *LPUARTx)
Kojto 158:b23ee177fd68 2113 {
Kojto 158:b23ee177fd68 2114 SET_BIT(LPUARTx->RQR, USART_RQR_RXFRQ);
Kojto 158:b23ee177fd68 2115 }
Kojto 158:b23ee177fd68 2116
Kojto 158:b23ee177fd68 2117 /**
Kojto 158:b23ee177fd68 2118 * @}
Kojto 158:b23ee177fd68 2119 */
Kojto 158:b23ee177fd68 2120
Kojto 158:b23ee177fd68 2121 #if defined(USE_FULL_LL_DRIVER)
Kojto 158:b23ee177fd68 2122 /** @defgroup LPUART_LL_EF_Init Initialization and de-initialization functions
Kojto 158:b23ee177fd68 2123 * @{
Kojto 158:b23ee177fd68 2124 */
Kojto 158:b23ee177fd68 2125 ErrorStatus LL_LPUART_DeInit(USART_TypeDef *LPUARTx);
Kojto 158:b23ee177fd68 2126 ErrorStatus LL_LPUART_Init(USART_TypeDef *LPUARTx, LL_LPUART_InitTypeDef *LPUART_InitStruct);
Kojto 158:b23ee177fd68 2127 void LL_LPUART_StructInit(LL_LPUART_InitTypeDef *LPUART_InitStruct);
Kojto 158:b23ee177fd68 2128 /**
Kojto 158:b23ee177fd68 2129 * @}
Kojto 158:b23ee177fd68 2130 */
Kojto 158:b23ee177fd68 2131 #endif /* USE_FULL_LL_DRIVER */
Kojto 158:b23ee177fd68 2132
Kojto 158:b23ee177fd68 2133 /**
Kojto 158:b23ee177fd68 2134 * @}
Kojto 158:b23ee177fd68 2135 */
Kojto 158:b23ee177fd68 2136
Kojto 158:b23ee177fd68 2137 /**
Kojto 158:b23ee177fd68 2138 * @}
Kojto 158:b23ee177fd68 2139 */
Kojto 158:b23ee177fd68 2140
Kojto 158:b23ee177fd68 2141 #endif /* LPUART1 */
Kojto 158:b23ee177fd68 2142
Kojto 158:b23ee177fd68 2143 /**
Kojto 158:b23ee177fd68 2144 * @}
Kojto 158:b23ee177fd68 2145 */
Kojto 158:b23ee177fd68 2146
Kojto 158:b23ee177fd68 2147 #ifdef __cplusplus
Kojto 158:b23ee177fd68 2148 }
Kojto 158:b23ee177fd68 2149 #endif
Kojto 158:b23ee177fd68 2150
Kojto 158:b23ee177fd68 2151 #endif /* __STM32L0xx_LL_LPUART_H */
Kojto 158:b23ee177fd68 2152
Kojto 158:b23ee177fd68 2153 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/