STM32L443xx HAL User Manual
|
00001 /** 00002 ****************************************************************************** 00003 * @file stm32l4xx_ll_lpuart.h 00004 * @author MCD Application Team 00005 * @brief Header file of LPUART LL module. 00006 ****************************************************************************** 00007 * @attention 00008 * 00009 * Copyright (c) 2017 STMicroelectronics. 00010 * All rights reserved. 00011 * 00012 * This software is licensed under terms that can be found in the LICENSE file 00013 * in the root directory of this software component. 00014 * If no LICENSE file comes with this software, it is provided AS-IS. 00015 * 00016 ****************************************************************************** 00017 */ 00018 00019 /* Define to prevent recursive inclusion -------------------------------------*/ 00020 #ifndef STM32L4xx_LL_LPUART_H 00021 #define STM32L4xx_LL_LPUART_H 00022 00023 #ifdef __cplusplus 00024 extern "C" { 00025 #endif 00026 00027 /* Includes ------------------------------------------------------------------*/ 00028 #include "stm32l4xx.h" 00029 00030 /** @addtogroup STM32L4xx_LL_Driver 00031 * @{ 00032 */ 00033 00034 #if defined (LPUART1) 00035 00036 /** @defgroup LPUART_LL LPUART 00037 * @{ 00038 */ 00039 00040 /* Private types -------------------------------------------------------------*/ 00041 /* Private variables ---------------------------------------------------------*/ 00042 #if defined(USART_PRESC_PRESCALER) 00043 /** @defgroup LPUART_LL_Private_Variables LPUART Private Variables 00044 * @{ 00045 */ 00046 /* Array used to get the LPUART prescaler division decimal values versus @ref LPUART_LL_EC_PRESCALER values */ 00047 static const uint16_t LPUART_PRESCALER_TAB[] = 00048 { 00049 (uint16_t)1, 00050 (uint16_t)2, 00051 (uint16_t)4, 00052 (uint16_t)6, 00053 (uint16_t)8, 00054 (uint16_t)10, 00055 (uint16_t)12, 00056 (uint16_t)16, 00057 (uint16_t)32, 00058 (uint16_t)64, 00059 (uint16_t)128, 00060 (uint16_t)256 00061 }; 00062 /** 00063 * @} 00064 */ 00065 #endif /* USART_PRESC_PRESCALER */ 00066 00067 /* Private constants ---------------------------------------------------------*/ 00068 /** @defgroup LPUART_LL_Private_Constants LPUART Private Constants 00069 * @{ 00070 */ 00071 /* Defines used in Baud Rate related macros and corresponding register setting computation */ 00072 #define LPUART_LPUARTDIV_FREQ_MUL 256U 00073 #define LPUART_BRR_MASK 0x000FFFFFU 00074 #define LPUART_BRR_MIN_VALUE 0x00000300U 00075 /** 00076 * @} 00077 */ 00078 00079 00080 /* Private macros ------------------------------------------------------------*/ 00081 #if defined(USE_FULL_LL_DRIVER) 00082 /** @defgroup LPUART_LL_Private_Macros LPUART Private Macros 00083 * @{ 00084 */ 00085 /** 00086 * @} 00087 */ 00088 #endif /*USE_FULL_LL_DRIVER*/ 00089 00090 /* Exported types ------------------------------------------------------------*/ 00091 #if defined(USE_FULL_LL_DRIVER) 00092 /** @defgroup LPUART_LL_ES_INIT LPUART Exported Init structures 00093 * @{ 00094 */ 00095 00096 /** 00097 * @brief LL LPUART Init Structure definition 00098 */ 00099 typedef struct 00100 { 00101 #if defined(USART_PRESC_PRESCALER) 00102 uint32_t PrescalerValue; /*!< Specifies the Prescaler to compute the communication baud rate. 00103 This parameter can be a value of @ref LPUART_LL_EC_PRESCALER. 00104 00105 This feature can be modified afterwards using unitary 00106 function @ref LL_LPUART_SetPrescaler().*/ 00107 00108 #endif /* USART_PRESC_PRESCALER */ 00109 uint32_t BaudRate; /*!< This field defines expected LPUART communication baud rate. 00110 00111 This feature can be modified afterwards using unitary 00112 function @ref LL_LPUART_SetBaudRate().*/ 00113 00114 uint32_t DataWidth; /*!< Specifies the number of data bits transmitted or received in a frame. 00115 This parameter can be a value of @ref LPUART_LL_EC_DATAWIDTH. 00116 00117 This feature can be modified afterwards using unitary 00118 function @ref LL_LPUART_SetDataWidth().*/ 00119 00120 uint32_t StopBits; /*!< Specifies the number of stop bits transmitted. 00121 This parameter can be a value of @ref LPUART_LL_EC_STOPBITS. 00122 00123 This feature can be modified afterwards using unitary 00124 function @ref LL_LPUART_SetStopBitsLength().*/ 00125 00126 uint32_t Parity; /*!< Specifies the parity mode. 00127 This parameter can be a value of @ref LPUART_LL_EC_PARITY. 00128 00129 This feature can be modified afterwards using unitary 00130 function @ref LL_LPUART_SetParity().*/ 00131 00132 uint32_t TransferDirection; /*!< Specifies whether the Receive and/or Transmit mode is enabled or disabled. 00133 This parameter can be a value of @ref LPUART_LL_EC_DIRECTION. 00134 00135 This feature can be modified afterwards using unitary 00136 function @ref LL_LPUART_SetTransferDirection().*/ 00137 00138 uint32_t HardwareFlowControl; /*!< Specifies whether the hardware flow control mode is enabled or disabled. 00139 This parameter can be a value of @ref LPUART_LL_EC_HWCONTROL. 00140 00141 This feature can be modified afterwards using unitary 00142 function @ref LL_LPUART_SetHWFlowCtrl().*/ 00143 00144 } LL_LPUART_InitTypeDef; 00145 00146 /** 00147 * @} 00148 */ 00149 #endif /* USE_FULL_LL_DRIVER */ 00150 00151 /* Exported constants --------------------------------------------------------*/ 00152 /** @defgroup LPUART_LL_Exported_Constants LPUART Exported Constants 00153 * @{ 00154 */ 00155 00156 /** @defgroup LPUART_LL_EC_CLEAR_FLAG Clear Flags Defines 00157 * @brief Flags defines which can be used with LL_LPUART_WriteReg function 00158 * @{ 00159 */ 00160 #define LL_LPUART_ICR_PECF USART_ICR_PECF /*!< Parity error clear flag */ 00161 #define LL_LPUART_ICR_FECF USART_ICR_FECF /*!< Framing error clear flag */ 00162 #define LL_LPUART_ICR_NCF USART_ICR_NECF /*!< Noise error detected clear flag */ 00163 #define LL_LPUART_ICR_ORECF USART_ICR_ORECF /*!< Overrun error clear flag */ 00164 #define LL_LPUART_ICR_IDLECF USART_ICR_IDLECF /*!< Idle line detected clear flag */ 00165 #define LL_LPUART_ICR_TCCF USART_ICR_TCCF /*!< Transmission complete clear flag */ 00166 #define LL_LPUART_ICR_CTSCF USART_ICR_CTSCF /*!< CTS clear flag */ 00167 #define LL_LPUART_ICR_CMCF USART_ICR_CMCF /*!< Character match clear flag */ 00168 #define LL_LPUART_ICR_WUCF USART_ICR_WUCF /*!< Wakeup from Stop mode clear flag */ 00169 /** 00170 * @} 00171 */ 00172 00173 /** @defgroup LPUART_LL_EC_GET_FLAG Get Flags Defines 00174 * @brief Flags defines which can be used with LL_LPUART_ReadReg function 00175 * @{ 00176 */ 00177 #define LL_LPUART_ISR_PE USART_ISR_PE /*!< Parity error flag */ 00178 #define LL_LPUART_ISR_FE USART_ISR_FE /*!< Framing error flag */ 00179 #define LL_LPUART_ISR_NE USART_ISR_NE /*!< Noise detected flag */ 00180 #define LL_LPUART_ISR_ORE USART_ISR_ORE /*!< Overrun error flag */ 00181 #define LL_LPUART_ISR_IDLE USART_ISR_IDLE /*!< Idle line detected flag */ 00182 #if defined(USART_CR1_FIFOEN) 00183 #define LL_LPUART_ISR_RXNE_RXFNE USART_ISR_RXNE_RXFNE /*!< Read data register or RX FIFO not empty flag */ 00184 #else 00185 #define LL_LPUART_ISR_RXNE USART_ISR_RXNE /*!< Read data register not empty flag */ 00186 #endif /* USART_CR1_FIFOEN */ 00187 #define LL_LPUART_ISR_TC USART_ISR_TC /*!< Transmission complete flag */ 00188 #if defined(USART_CR1_FIFOEN) 00189 #define LL_LPUART_ISR_TXE_TXFNF USART_ISR_TXE_TXFNF /*!< Transmit data register empty or TX FIFO Not Full flag*/ 00190 #else 00191 #define LL_LPUART_ISR_TXE USART_ISR_TXE /*!< Transmit data register empty flag */ 00192 #endif /* USART_CR1_FIFOEN */ 00193 #define LL_LPUART_ISR_CTSIF USART_ISR_CTSIF /*!< CTS interrupt flag */ 00194 #define LL_LPUART_ISR_CTS USART_ISR_CTS /*!< CTS flag */ 00195 #define LL_LPUART_ISR_BUSY USART_ISR_BUSY /*!< Busy flag */ 00196 #define LL_LPUART_ISR_CMF USART_ISR_CMF /*!< Character match flag */ 00197 #define LL_LPUART_ISR_SBKF USART_ISR_SBKF /*!< Send break flag */ 00198 #define LL_LPUART_ISR_RWU USART_ISR_RWU /*!< Receiver wakeup from Mute mode flag */ 00199 #define LL_LPUART_ISR_WUF USART_ISR_WUF /*!< Wakeup from Stop mode flag */ 00200 #define LL_LPUART_ISR_TEACK USART_ISR_TEACK /*!< Transmit enable acknowledge flag */ 00201 #define LL_LPUART_ISR_REACK USART_ISR_REACK /*!< Receive enable acknowledge flag */ 00202 #if defined(USART_CR1_FIFOEN) 00203 #define LL_LPUART_ISR_TXFE USART_ISR_TXFE /*!< TX FIFO empty flag */ 00204 #define LL_LPUART_ISR_RXFF USART_ISR_RXFF /*!< RX FIFO full flag */ 00205 #define LL_LPUART_ISR_RXFT USART_ISR_RXFT /*!< RX FIFO threshold flag */ 00206 #define LL_LPUART_ISR_TXFT USART_ISR_TXFT /*!< TX FIFO threshold flag */ 00207 #endif /* USART_CR1_FIFOEN */ 00208 /** 00209 * @} 00210 */ 00211 00212 /** @defgroup LPUART_LL_EC_IT IT Defines 00213 * @brief IT defines which can be used with LL_LPUART_ReadReg and LL_LPUART_WriteReg functions 00214 * @{ 00215 */ 00216 #define LL_LPUART_CR1_IDLEIE USART_CR1_IDLEIE /*!< IDLE interrupt enable */ 00217 #if defined(USART_CR1_FIFOEN) 00218 #define LL_LPUART_CR1_RXNEIE_RXFNEIE USART_CR1_RXNEIE_RXFNEIE /*!< Read data register and RXFIFO not empty 00219 interrupt enable */ 00220 #else 00221 #define LL_LPUART_CR1_RXNEIE USART_CR1_RXNEIE /*!< Read data register not empty interrupt enable */ 00222 #endif /* USART_CR1_FIFOEN */ 00223 #define LL_LPUART_CR1_TCIE USART_CR1_TCIE /*!< Transmission complete interrupt enable */ 00224 #if defined(USART_CR1_FIFOEN) 00225 #define LL_LPUART_CR1_TXEIE_TXFNFIE USART_CR1_TXEIE_TXFNFIE /*!< Transmit data register empty and TX FIFO 00226 not full interrupt enable */ 00227 #else 00228 #define LL_LPUART_CR1_TXEIE USART_CR1_TXEIE /*!< Transmit data register empty interrupt enable */ 00229 #endif /* USART_CR1_FIFOEN */ 00230 #define LL_LPUART_CR1_PEIE USART_CR1_PEIE /*!< Parity error */ 00231 #define LL_LPUART_CR1_CMIE USART_CR1_CMIE /*!< Character match interrupt enable */ 00232 #if defined(USART_CR1_FIFOEN) 00233 #define LL_LPUART_CR1_TXFEIE USART_CR1_TXFEIE /*!< TX FIFO empty interrupt enable */ 00234 #define LL_LPUART_CR1_RXFFIE USART_CR1_RXFFIE /*!< RX FIFO full interrupt enable */ 00235 #endif /* USART_CR1_FIFOEN */ 00236 #define LL_LPUART_CR3_EIE USART_CR3_EIE /*!< Error interrupt enable */ 00237 #define LL_LPUART_CR3_CTSIE USART_CR3_CTSIE /*!< CTS interrupt enable */ 00238 #define LL_LPUART_CR3_WUFIE USART_CR3_WUFIE /*!< Wakeup from Stop mode interrupt enable */ 00239 #if defined(USART_CR1_FIFOEN) 00240 #define LL_LPUART_CR3_TXFTIE USART_CR3_TXFTIE /*!< TX FIFO threshold interrupt enable */ 00241 #define LL_LPUART_CR3_RXFTIE USART_CR3_RXFTIE /*!< RX FIFO threshold interrupt enable */ 00242 #endif /* USART_CR1_FIFOEN */ 00243 /** 00244 * @} 00245 */ 00246 #if defined(USART_CR1_FIFOEN) 00247 00248 /** @defgroup LPUART_LL_EC_FIFOTHRESHOLD FIFO Threshold 00249 * @{ 00250 */ 00251 #define LL_LPUART_FIFOTHRESHOLD_1_8 0x00000000U /*!< FIFO reaches 1/8 of its depth */ 00252 #define LL_LPUART_FIFOTHRESHOLD_1_4 0x00000001U /*!< FIFO reaches 1/4 of its depth */ 00253 #define LL_LPUART_FIFOTHRESHOLD_1_2 0x00000002U /*!< FIFO reaches 1/2 of its depth */ 00254 #define LL_LPUART_FIFOTHRESHOLD_3_4 0x00000003U /*!< FIFO reaches 3/4 of its depth */ 00255 #define LL_LPUART_FIFOTHRESHOLD_7_8 0x00000004U /*!< FIFO reaches 7/8 of its depth */ 00256 #define LL_LPUART_FIFOTHRESHOLD_8_8 0x00000005U /*!< FIFO becomes empty for TX and full for RX */ 00257 /** 00258 * @} 00259 */ 00260 #endif /* USART_CR1_FIFOEN */ 00261 00262 /** @defgroup LPUART_LL_EC_DIRECTION Direction 00263 * @{ 00264 */ 00265 #define LL_LPUART_DIRECTION_NONE 0x00000000U /*!< Transmitter and Receiver are disabled */ 00266 #define LL_LPUART_DIRECTION_RX USART_CR1_RE /*!< Transmitter is disabled and Receiver is enabled */ 00267 #define LL_LPUART_DIRECTION_TX USART_CR1_TE /*!< Transmitter is enabled and Receiver is disabled */ 00268 #define LL_LPUART_DIRECTION_TX_RX (USART_CR1_TE |USART_CR1_RE) /*!< Transmitter and Receiver are enabled */ 00269 /** 00270 * @} 00271 */ 00272 00273 /** @defgroup LPUART_LL_EC_PARITY Parity Control 00274 * @{ 00275 */ 00276 #define LL_LPUART_PARITY_NONE 0x00000000U /*!< Parity control disabled */ 00277 #define LL_LPUART_PARITY_EVEN USART_CR1_PCE /*!< Parity control enabled and Even Parity is selected */ 00278 #define LL_LPUART_PARITY_ODD (USART_CR1_PCE | USART_CR1_PS) /*!< Parity control enabled and Odd Parity is selected */ 00279 /** 00280 * @} 00281 */ 00282 00283 /** @defgroup LPUART_LL_EC_WAKEUP Wakeup 00284 * @{ 00285 */ 00286 #define LL_LPUART_WAKEUP_IDLELINE 0x00000000U /*!< LPUART wake up from Mute mode on Idle Line */ 00287 #define LL_LPUART_WAKEUP_ADDRESSMARK USART_CR1_WAKE /*!< LPUART wake up from Mute mode on Address Mark */ 00288 /** 00289 * @} 00290 */ 00291 00292 /** @defgroup LPUART_LL_EC_DATAWIDTH Datawidth 00293 * @{ 00294 */ 00295 #define LL_LPUART_DATAWIDTH_7B USART_CR1_M1 /*!< 7 bits word length : Start bit, 7 data bits, n stop bits */ 00296 #define LL_LPUART_DATAWIDTH_8B 0x00000000U /*!< 8 bits word length : Start bit, 8 data bits, n stop bits */ 00297 #define LL_LPUART_DATAWIDTH_9B USART_CR1_M0 /*!< 9 bits word length : Start bit, 9 data bits, n stop bits */ 00298 /** 00299 * @} 00300 */ 00301 #if defined(USART_PRESC_PRESCALER) 00302 00303 /** @defgroup LPUART_LL_EC_PRESCALER Clock Source Prescaler 00304 * @{ 00305 */ 00306 #define LL_LPUART_PRESCALER_DIV1 0x00000000U /*!< Input clock not divided */ 00307 #define LL_LPUART_PRESCALER_DIV2 (USART_PRESC_PRESCALER_0) /*!< Input clock divided by 2 */ 00308 #define LL_LPUART_PRESCALER_DIV4 (USART_PRESC_PRESCALER_1) /*!< Input clock divided by 4 */ 00309 #define LL_LPUART_PRESCALER_DIV6 (USART_PRESC_PRESCALER_1 |\ 00310 USART_PRESC_PRESCALER_0) /*!< Input clock divided by 6 */ 00311 #define LL_LPUART_PRESCALER_DIV8 (USART_PRESC_PRESCALER_2) /*!< Input clock divided by 8 */ 00312 #define LL_LPUART_PRESCALER_DIV10 (USART_PRESC_PRESCALER_2 |\ 00313 USART_PRESC_PRESCALER_0) /*!< Input clock divided by 10 */ 00314 #define LL_LPUART_PRESCALER_DIV12 (USART_PRESC_PRESCALER_2 |\ 00315 USART_PRESC_PRESCALER_1) /*!< Input clock divided by 12 */ 00316 #define LL_LPUART_PRESCALER_DIV16 (USART_PRESC_PRESCALER_2 |\ 00317 USART_PRESC_PRESCALER_1 |\ 00318 USART_PRESC_PRESCALER_0) /*!< Input clock divided by 16 */ 00319 #define LL_LPUART_PRESCALER_DIV32 (USART_PRESC_PRESCALER_3) /*!< Input clock divided by 32 */ 00320 #define LL_LPUART_PRESCALER_DIV64 (USART_PRESC_PRESCALER_3 |\ 00321 USART_PRESC_PRESCALER_0) /*!< Input clock divided by 64 */ 00322 #define LL_LPUART_PRESCALER_DIV128 (USART_PRESC_PRESCALER_3 |\ 00323 USART_PRESC_PRESCALER_1) /*!< Input clock divided by 128 */ 00324 #define LL_LPUART_PRESCALER_DIV256 (USART_PRESC_PRESCALER_3 |\ 00325 USART_PRESC_PRESCALER_1 |\ 00326 USART_PRESC_PRESCALER_0) /*!< Input clock divided by 256 */ 00327 /** 00328 * @} 00329 */ 00330 #endif /* USART_PRESC_PRESCALER */ 00331 00332 /** @defgroup LPUART_LL_EC_STOPBITS Stop Bits 00333 * @{ 00334 */ 00335 #define LL_LPUART_STOPBITS_1 0x00000000U /*!< 1 stop bit */ 00336 #define LL_LPUART_STOPBITS_2 USART_CR2_STOP_1 /*!< 2 stop bits */ 00337 /** 00338 * @} 00339 */ 00340 00341 /** @defgroup LPUART_LL_EC_TXRX TX RX Pins Swap 00342 * @{ 00343 */ 00344 #define LL_LPUART_TXRX_STANDARD 0x00000000U /*!< TX/RX pins are used as defined in standard pinout */ 00345 #define LL_LPUART_TXRX_SWAPPED (USART_CR2_SWAP) /*!< TX and RX pins functions are swapped. */ 00346 /** 00347 * @} 00348 */ 00349 00350 /** @defgroup LPUART_LL_EC_RXPIN_LEVEL RX Pin Active Level Inversion 00351 * @{ 00352 */ 00353 #define LL_LPUART_RXPIN_LEVEL_STANDARD 0x00000000U /*!< RX pin signal works using the standard logic levels */ 00354 #define LL_LPUART_RXPIN_LEVEL_INVERTED (USART_CR2_RXINV) /*!< RX pin signal values are inverted. */ 00355 /** 00356 * @} 00357 */ 00358 00359 /** @defgroup LPUART_LL_EC_TXPIN_LEVEL TX Pin Active Level Inversion 00360 * @{ 00361 */ 00362 #define LL_LPUART_TXPIN_LEVEL_STANDARD 0x00000000U /*!< TX pin signal works using the standard logic levels */ 00363 #define LL_LPUART_TXPIN_LEVEL_INVERTED (USART_CR2_TXINV) /*!< TX pin signal values are inverted. */ 00364 /** 00365 * @} 00366 */ 00367 00368 /** @defgroup LPUART_LL_EC_BINARY_LOGIC Binary Data Inversion 00369 * @{ 00370 */ 00371 #define LL_LPUART_BINARY_LOGIC_POSITIVE 0x00000000U /*!< Logical data from the data register are send/received 00372 in positive/direct logic. (1=H, 0=L) */ 00373 #define LL_LPUART_BINARY_LOGIC_NEGATIVE USART_CR2_DATAINV /*!< Logical data from the data register are send/received 00374 in negative/inverse logic. (1=L, 0=H). 00375 The parity bit is also inverted. */ 00376 /** 00377 * @} 00378 */ 00379 00380 /** @defgroup LPUART_LL_EC_BITORDER Bit Order 00381 * @{ 00382 */ 00383 #define LL_LPUART_BITORDER_LSBFIRST 0x00000000U /*!< data is transmitted/received with data bit 0 first, 00384 following the start bit */ 00385 #define LL_LPUART_BITORDER_MSBFIRST USART_CR2_MSBFIRST /*!< data is transmitted/received with the MSB first, 00386 following the start bit */ 00387 /** 00388 * @} 00389 */ 00390 00391 /** @defgroup LPUART_LL_EC_ADDRESS_DETECT Address Length Detection 00392 * @{ 00393 */ 00394 #define LL_LPUART_ADDRESS_DETECT_4B 0x00000000U /*!< 4-bit address detection method selected */ 00395 #define LL_LPUART_ADDRESS_DETECT_7B USART_CR2_ADDM7 /*!< 7-bit address detection (in 8-bit data mode) method selected */ 00396 /** 00397 * @} 00398 */ 00399 00400 /** @defgroup LPUART_LL_EC_HWCONTROL Hardware Control 00401 * @{ 00402 */ 00403 #define LL_LPUART_HWCONTROL_NONE 0x00000000U /*!< CTS and RTS hardware flow control disabled */ 00404 #define LL_LPUART_HWCONTROL_RTS USART_CR3_RTSE /*!< RTS output enabled, data is only requested 00405 when there is space in the receive buffer */ 00406 #define LL_LPUART_HWCONTROL_CTS USART_CR3_CTSE /*!< CTS mode enabled, data is only transmitted 00407 when the nCTS input is asserted (tied to 0)*/ 00408 #define LL_LPUART_HWCONTROL_RTS_CTS (USART_CR3_RTSE | USART_CR3_CTSE) /*!< CTS and RTS hardware flow control enabled */ 00409 /** 00410 * @} 00411 */ 00412 00413 /** @defgroup LPUART_LL_EC_WAKEUP_ON Wakeup Activation 00414 * @{ 00415 */ 00416 #define LL_LPUART_WAKEUP_ON_ADDRESS 0x00000000U /*!< Wake up active on address match */ 00417 #define LL_LPUART_WAKEUP_ON_STARTBIT USART_CR3_WUS_1 /*!< Wake up active on Start bit detection */ 00418 #define LL_LPUART_WAKEUP_ON_RXNE (USART_CR3_WUS_0 | USART_CR3_WUS_1) /*!< Wake up active on RXNE */ 00419 /** 00420 * @} 00421 */ 00422 00423 /** @defgroup LPUART_LL_EC_DE_POLARITY Driver Enable Polarity 00424 * @{ 00425 */ 00426 #define LL_LPUART_DE_POLARITY_HIGH 0x00000000U /*!< DE signal is active high */ 00427 #define LL_LPUART_DE_POLARITY_LOW USART_CR3_DEP /*!< DE signal is active low */ 00428 /** 00429 * @} 00430 */ 00431 00432 /** @defgroup LPUART_LL_EC_DMA_REG_DATA DMA Register Data 00433 * @{ 00434 */ 00435 #define LL_LPUART_DMA_REG_DATA_TRANSMIT 0x00000000U /*!< Get address of data register used for transmission */ 00436 #define LL_LPUART_DMA_REG_DATA_RECEIVE 0x00000001U /*!< Get address of data register used for reception */ 00437 /** 00438 * @} 00439 */ 00440 00441 /** 00442 * @} 00443 */ 00444 00445 /* Exported macro ------------------------------------------------------------*/ 00446 /** @defgroup LPUART_LL_Exported_Macros LPUART Exported Macros 00447 * @{ 00448 */ 00449 00450 /** @defgroup LPUART_LL_EM_WRITE_READ Common Write and read registers Macros 00451 * @{ 00452 */ 00453 00454 /** 00455 * @brief Write a value in LPUART register 00456 * @param __INSTANCE__ LPUART Instance 00457 * @param __REG__ Register to be written 00458 * @param __VALUE__ Value to be written in the register 00459 * @retval None 00460 */ 00461 #define LL_LPUART_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__)) 00462 00463 /** 00464 * @brief Read a value in LPUART register 00465 * @param __INSTANCE__ LPUART Instance 00466 * @param __REG__ Register to be read 00467 * @retval Register value 00468 */ 00469 #define LL_LPUART_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__) 00470 /** 00471 * @} 00472 */ 00473 00474 /** @defgroup LPUART_LL_EM_Exported_Macros_Helper Helper Macros 00475 * @{ 00476 */ 00477 00478 /** 00479 * @brief Compute LPUARTDIV value according to Peripheral Clock and 00480 * expected Baud Rate (20-bit value of LPUARTDIV is returned) 00481 * @param __PERIPHCLK__ Peripheral Clock frequency used for LPUART Instance 00482 @if USART_PRESC_PRESCALER 00483 * @param __PRESCALER__ This parameter can be one of the following values: 00484 * @arg @ref LL_LPUART_PRESCALER_DIV1 00485 * @arg @ref LL_LPUART_PRESCALER_DIV2 00486 * @arg @ref LL_LPUART_PRESCALER_DIV4 00487 * @arg @ref LL_LPUART_PRESCALER_DIV6 00488 * @arg @ref LL_LPUART_PRESCALER_DIV8 00489 * @arg @ref LL_LPUART_PRESCALER_DIV10 00490 * @arg @ref LL_LPUART_PRESCALER_DIV12 00491 * @arg @ref LL_LPUART_PRESCALER_DIV16 00492 * @arg @ref LL_LPUART_PRESCALER_DIV32 00493 * @arg @ref LL_LPUART_PRESCALER_DIV64 00494 * @arg @ref LL_LPUART_PRESCALER_DIV128 00495 * @arg @ref LL_LPUART_PRESCALER_DIV256 00496 @endif 00497 * @param __BAUDRATE__ Baud Rate value to achieve 00498 * @retval LPUARTDIV value to be used for BRR register filling 00499 */ 00500 #if defined(USART_PRESC_PRESCALER) 00501 #define __LL_LPUART_DIV(__PERIPHCLK__, __PRESCALER__, __BAUDRATE__) (uint32_t)\ 00502 ((((((uint64_t)(__PERIPHCLK__)/(uint64_t)(LPUART_PRESCALER_TAB[(uint16_t)(__PRESCALER__)]))\ 00503 * LPUART_LPUARTDIV_FREQ_MUL) + (uint32_t)((__BAUDRATE__)/2U))/(__BAUDRATE__)) & LPUART_BRR_MASK) 00504 #else 00505 #define __LL_LPUART_DIV(__PERIPHCLK__, __BAUDRATE__) (uint32_t)(((((uint64_t)(__PERIPHCLK__)*LPUART_LPUARTDIV_FREQ_MUL) + (uint32_t)((__BAUDRATE__)/2U))/(__BAUDRATE__))\ 00506 & LPUART_BRR_MASK) 00507 #endif /* USART_PRESC_PRESCALER */ 00508 00509 /** 00510 * @} 00511 */ 00512 00513 /** 00514 * @} 00515 */ 00516 00517 /* Exported functions --------------------------------------------------------*/ 00518 /** @defgroup LPUART_LL_Exported_Functions LPUART Exported Functions 00519 * @{ 00520 */ 00521 00522 /** @defgroup LPUART_LL_EF_Configuration Configuration functions 00523 * @{ 00524 */ 00525 00526 /** 00527 * @brief LPUART Enable 00528 * @rmtoll CR1 UE LL_LPUART_Enable 00529 * @param LPUARTx LPUART Instance 00530 * @retval None 00531 */ 00532 __STATIC_INLINE void LL_LPUART_Enable(USART_TypeDef *LPUARTx) 00533 { 00534 SET_BIT(LPUARTx->CR1, USART_CR1_UE); 00535 } 00536 00537 /** 00538 * @brief LPUART Disable 00539 * @note When LPUART is disabled, LPUART prescalers and outputs are stopped immediately, 00540 * and current operations are discarded. The configuration of the LPUART is kept, but all the status 00541 * flags, in the LPUARTx_ISR are set to their default values. 00542 * @note In order to go into low-power mode without generating errors on the line, 00543 * the TE bit must be reset before and the software must wait 00544 * for the TC bit in the LPUART_ISR to be set before resetting the UE bit. 00545 * The DMA requests are also reset when UE = 0 so the DMA channel must 00546 * be disabled before resetting the UE bit. 00547 * @rmtoll CR1 UE LL_LPUART_Disable 00548 * @param LPUARTx LPUART Instance 00549 * @retval None 00550 */ 00551 __STATIC_INLINE void LL_LPUART_Disable(USART_TypeDef *LPUARTx) 00552 { 00553 CLEAR_BIT(LPUARTx->CR1, USART_CR1_UE); 00554 } 00555 00556 /** 00557 * @brief Indicate if LPUART is enabled 00558 * @rmtoll CR1 UE LL_LPUART_IsEnabled 00559 * @param LPUARTx LPUART Instance 00560 * @retval State of bit (1 or 0). 00561 */ 00562 __STATIC_INLINE uint32_t LL_LPUART_IsEnabled(USART_TypeDef *LPUARTx) 00563 { 00564 return ((READ_BIT(LPUARTx->CR1, USART_CR1_UE) == (USART_CR1_UE)) ? 1UL : 0UL); 00565 } 00566 00567 #if defined(USART_CR1_FIFOEN) 00568 /** 00569 * @brief FIFO Mode Enable 00570 * @rmtoll CR1 FIFOEN LL_LPUART_EnableFIFO 00571 * @param LPUARTx LPUART Instance 00572 * @retval None 00573 */ 00574 __STATIC_INLINE void LL_LPUART_EnableFIFO(USART_TypeDef *LPUARTx) 00575 { 00576 SET_BIT(LPUARTx->CR1, USART_CR1_FIFOEN); 00577 } 00578 00579 /** 00580 * @brief FIFO Mode Disable 00581 * @rmtoll CR1 FIFOEN LL_LPUART_DisableFIFO 00582 * @param LPUARTx LPUART Instance 00583 * @retval None 00584 */ 00585 __STATIC_INLINE void LL_LPUART_DisableFIFO(USART_TypeDef *LPUARTx) 00586 { 00587 CLEAR_BIT(LPUARTx->CR1, USART_CR1_FIFOEN); 00588 } 00589 00590 /** 00591 * @brief Indicate if FIFO Mode is enabled 00592 * @rmtoll CR1 FIFOEN LL_LPUART_IsEnabledFIFO 00593 * @param LPUARTx LPUART Instance 00594 * @retval State of bit (1 or 0). 00595 */ 00596 __STATIC_INLINE uint32_t LL_LPUART_IsEnabledFIFO(USART_TypeDef *LPUARTx) 00597 { 00598 return ((READ_BIT(LPUARTx->CR1, USART_CR1_FIFOEN) == (USART_CR1_FIFOEN)) ? 1UL : 0UL); 00599 } 00600 00601 /** 00602 * @brief Configure TX FIFO Threshold 00603 * @rmtoll CR3 TXFTCFG LL_LPUART_SetTXFIFOThreshold 00604 * @param LPUARTx LPUART Instance 00605 * @param Threshold This parameter can be one of the following values: 00606 * @arg @ref LL_LPUART_FIFOTHRESHOLD_1_8 00607 * @arg @ref LL_LPUART_FIFOTHRESHOLD_1_4 00608 * @arg @ref LL_LPUART_FIFOTHRESHOLD_1_2 00609 * @arg @ref LL_LPUART_FIFOTHRESHOLD_3_4 00610 * @arg @ref LL_LPUART_FIFOTHRESHOLD_7_8 00611 * @arg @ref LL_LPUART_FIFOTHRESHOLD_8_8 00612 * @retval None 00613 */ 00614 __STATIC_INLINE void LL_LPUART_SetTXFIFOThreshold(USART_TypeDef *LPUARTx, uint32_t Threshold) 00615 { 00616 ATOMIC_MODIFY_REG(LPUARTx->CR3, USART_CR3_TXFTCFG, Threshold << USART_CR3_TXFTCFG_Pos); 00617 } 00618 00619 /** 00620 * @brief Return TX FIFO Threshold Configuration 00621 * @rmtoll CR3 TXFTCFG LL_LPUART_GetTXFIFOThreshold 00622 * @param LPUARTx LPUART Instance 00623 * @retval Returned value can be one of the following values: 00624 * @arg @ref LL_LPUART_FIFOTHRESHOLD_1_8 00625 * @arg @ref LL_LPUART_FIFOTHRESHOLD_1_4 00626 * @arg @ref LL_LPUART_FIFOTHRESHOLD_1_2 00627 * @arg @ref LL_LPUART_FIFOTHRESHOLD_3_4 00628 * @arg @ref LL_LPUART_FIFOTHRESHOLD_7_8 00629 * @arg @ref LL_LPUART_FIFOTHRESHOLD_8_8 00630 */ 00631 __STATIC_INLINE uint32_t LL_LPUART_GetTXFIFOThreshold(USART_TypeDef *LPUARTx) 00632 { 00633 return (uint32_t)(READ_BIT(LPUARTx->CR3, USART_CR3_TXFTCFG) >> USART_CR3_TXFTCFG_Pos); 00634 } 00635 00636 /** 00637 * @brief Configure RX FIFO Threshold 00638 * @rmtoll CR3 RXFTCFG LL_LPUART_SetRXFIFOThreshold 00639 * @param LPUARTx LPUART Instance 00640 * @param Threshold This parameter can be one of the following values: 00641 * @arg @ref LL_LPUART_FIFOTHRESHOLD_1_8 00642 * @arg @ref LL_LPUART_FIFOTHRESHOLD_1_4 00643 * @arg @ref LL_LPUART_FIFOTHRESHOLD_1_2 00644 * @arg @ref LL_LPUART_FIFOTHRESHOLD_3_4 00645 * @arg @ref LL_LPUART_FIFOTHRESHOLD_7_8 00646 * @arg @ref LL_LPUART_FIFOTHRESHOLD_8_8 00647 * @retval None 00648 */ 00649 __STATIC_INLINE void LL_LPUART_SetRXFIFOThreshold(USART_TypeDef *LPUARTx, uint32_t Threshold) 00650 { 00651 ATOMIC_MODIFY_REG(LPUARTx->CR3, USART_CR3_RXFTCFG, Threshold << USART_CR3_RXFTCFG_Pos); 00652 } 00653 00654 /** 00655 * @brief Return RX FIFO Threshold Configuration 00656 * @rmtoll CR3 RXFTCFG LL_LPUART_GetRXFIFOThreshold 00657 * @param LPUARTx LPUART Instance 00658 * @retval Returned value can be one of the following values: 00659 * @arg @ref LL_LPUART_FIFOTHRESHOLD_1_8 00660 * @arg @ref LL_LPUART_FIFOTHRESHOLD_1_4 00661 * @arg @ref LL_LPUART_FIFOTHRESHOLD_1_2 00662 * @arg @ref LL_LPUART_FIFOTHRESHOLD_3_4 00663 * @arg @ref LL_LPUART_FIFOTHRESHOLD_7_8 00664 * @arg @ref LL_LPUART_FIFOTHRESHOLD_8_8 00665 */ 00666 __STATIC_INLINE uint32_t LL_LPUART_GetRXFIFOThreshold(USART_TypeDef *LPUARTx) 00667 { 00668 return (uint32_t)(READ_BIT(LPUARTx->CR3, USART_CR3_RXFTCFG) >> USART_CR3_RXFTCFG_Pos); 00669 } 00670 00671 /** 00672 * @brief Configure TX and RX FIFOs Threshold 00673 * @rmtoll CR3 TXFTCFG LL_LPUART_ConfigFIFOsThreshold\n 00674 * CR3 RXFTCFG LL_LPUART_ConfigFIFOsThreshold 00675 * @param LPUARTx LPUART Instance 00676 * @param TXThreshold This parameter can be one of the following values: 00677 * @arg @ref LL_LPUART_FIFOTHRESHOLD_1_8 00678 * @arg @ref LL_LPUART_FIFOTHRESHOLD_1_4 00679 * @arg @ref LL_LPUART_FIFOTHRESHOLD_1_2 00680 * @arg @ref LL_LPUART_FIFOTHRESHOLD_3_4 00681 * @arg @ref LL_LPUART_FIFOTHRESHOLD_7_8 00682 * @arg @ref LL_LPUART_FIFOTHRESHOLD_8_8 00683 * @param RXThreshold This parameter can be one of the following values: 00684 * @arg @ref LL_LPUART_FIFOTHRESHOLD_1_8 00685 * @arg @ref LL_LPUART_FIFOTHRESHOLD_1_4 00686 * @arg @ref LL_LPUART_FIFOTHRESHOLD_1_2 00687 * @arg @ref LL_LPUART_FIFOTHRESHOLD_3_4 00688 * @arg @ref LL_LPUART_FIFOTHRESHOLD_7_8 00689 * @arg @ref LL_LPUART_FIFOTHRESHOLD_8_8 00690 * @retval None 00691 */ 00692 __STATIC_INLINE void LL_LPUART_ConfigFIFOsThreshold(USART_TypeDef *LPUARTx, uint32_t TXThreshold, uint32_t RXThreshold) 00693 { 00694 ATOMIC_MODIFY_REG(LPUARTx->CR3, USART_CR3_TXFTCFG | USART_CR3_RXFTCFG, (TXThreshold << USART_CR3_TXFTCFG_Pos) | \ 00695 (RXThreshold << USART_CR3_RXFTCFG_Pos)); 00696 } 00697 #endif /* USART_CR1_FIFOEN */ 00698 00699 /** 00700 * @brief LPUART enabled in STOP Mode 00701 * @note When this function is enabled, LPUART is able to wake up the MCU from Stop mode, provided that 00702 * LPUART clock selection is HSI or LSE in RCC. 00703 * @rmtoll CR1 UESM LL_LPUART_EnableInStopMode 00704 * @param LPUARTx LPUART Instance 00705 * @retval None 00706 */ 00707 __STATIC_INLINE void LL_LPUART_EnableInStopMode(USART_TypeDef *LPUARTx) 00708 { 00709 ATOMIC_SET_BIT(LPUARTx->CR1, USART_CR1_UESM); 00710 } 00711 00712 /** 00713 * @brief LPUART disabled in STOP Mode 00714 * @note When this function is disabled, LPUART is not able to wake up the MCU from Stop mode 00715 * @rmtoll CR1 UESM LL_LPUART_DisableInStopMode 00716 * @param LPUARTx LPUART Instance 00717 * @retval None 00718 */ 00719 __STATIC_INLINE void LL_LPUART_DisableInStopMode(USART_TypeDef *LPUARTx) 00720 { 00721 ATOMIC_CLEAR_BIT(LPUARTx->CR1, USART_CR1_UESM); 00722 } 00723 00724 /** 00725 * @brief Indicate if LPUART is enabled in STOP Mode 00726 * (able to wake up MCU from Stop mode or not) 00727 * @rmtoll CR1 UESM LL_LPUART_IsEnabledInStopMode 00728 * @param LPUARTx LPUART Instance 00729 * @retval State of bit (1 or 0). 00730 */ 00731 __STATIC_INLINE uint32_t LL_LPUART_IsEnabledInStopMode(USART_TypeDef *LPUARTx) 00732 { 00733 return ((READ_BIT(LPUARTx->CR1, USART_CR1_UESM) == (USART_CR1_UESM)) ? 1UL : 0UL); 00734 } 00735 00736 #if defined(USART_CR3_UCESM) 00737 /** 00738 * @brief LPUART Clock enabled in STOP Mode 00739 * @note When this function is called, LPUART Clock is enabled while in STOP mode 00740 * @rmtoll CR3 UCESM LL_LPUART_EnableClockInStopMode 00741 * @param LPUARTx LPUART Instance 00742 * @retval None 00743 */ 00744 __STATIC_INLINE void LL_LPUART_EnableClockInStopMode(USART_TypeDef *LPUARTx) 00745 { 00746 ATOMIC_SET_BIT(LPUARTx->CR3, USART_CR3_UCESM); 00747 } 00748 00749 /** 00750 * @brief LPUART clock disabled in STOP Mode 00751 * @note When this function is called, LPUART Clock is disabled while in STOP mode 00752 * @rmtoll CR3 UCESM LL_LPUART_DisableClockInStopMode 00753 * @param LPUARTx LPUART Instance 00754 * @retval None 00755 */ 00756 __STATIC_INLINE void LL_LPUART_DisableClockInStopMode(USART_TypeDef *LPUARTx) 00757 { 00758 ATOMIC_CLEAR_BIT(LPUARTx->CR3, USART_CR3_UCESM); 00759 } 00760 00761 /** 00762 * @brief Indicate if LPUART clock is enabled in STOP Mode 00763 * @rmtoll CR3 UCESM LL_LPUART_IsClockEnabledInStopMode 00764 * @param LPUARTx LPUART Instance 00765 * @retval State of bit (1 or 0). 00766 */ 00767 __STATIC_INLINE uint32_t LL_LPUART_IsClockEnabledInStopMode(USART_TypeDef *LPUARTx) 00768 { 00769 return ((READ_BIT(LPUARTx->CR3, USART_CR3_UCESM) == (USART_CR3_UCESM)) ? 1UL : 0UL); 00770 } 00771 00772 #endif /* USART_CR3_UCESM */ 00773 /** 00774 * @brief Receiver Enable (Receiver is enabled and begins searching for a start bit) 00775 * @rmtoll CR1 RE LL_LPUART_EnableDirectionRx 00776 * @param LPUARTx LPUART Instance 00777 * @retval None 00778 */ 00779 __STATIC_INLINE void LL_LPUART_EnableDirectionRx(USART_TypeDef *LPUARTx) 00780 { 00781 ATOMIC_SET_BIT(LPUARTx->CR1, USART_CR1_RE); 00782 } 00783 00784 /** 00785 * @brief Receiver Disable 00786 * @rmtoll CR1 RE LL_LPUART_DisableDirectionRx 00787 * @param LPUARTx LPUART Instance 00788 * @retval None 00789 */ 00790 __STATIC_INLINE void LL_LPUART_DisableDirectionRx(USART_TypeDef *LPUARTx) 00791 { 00792 ATOMIC_CLEAR_BIT(LPUARTx->CR1, USART_CR1_RE); 00793 } 00794 00795 /** 00796 * @brief Transmitter Enable 00797 * @rmtoll CR1 TE LL_LPUART_EnableDirectionTx 00798 * @param LPUARTx LPUART Instance 00799 * @retval None 00800 */ 00801 __STATIC_INLINE void LL_LPUART_EnableDirectionTx(USART_TypeDef *LPUARTx) 00802 { 00803 ATOMIC_SET_BIT(LPUARTx->CR1, USART_CR1_TE); 00804 } 00805 00806 /** 00807 * @brief Transmitter Disable 00808 * @rmtoll CR1 TE LL_LPUART_DisableDirectionTx 00809 * @param LPUARTx LPUART Instance 00810 * @retval None 00811 */ 00812 __STATIC_INLINE void LL_LPUART_DisableDirectionTx(USART_TypeDef *LPUARTx) 00813 { 00814 ATOMIC_CLEAR_BIT(LPUARTx->CR1, USART_CR1_TE); 00815 } 00816 00817 /** 00818 * @brief Configure simultaneously enabled/disabled states 00819 * of Transmitter and Receiver 00820 * @rmtoll CR1 RE LL_LPUART_SetTransferDirection\n 00821 * CR1 TE LL_LPUART_SetTransferDirection 00822 * @param LPUARTx LPUART Instance 00823 * @param TransferDirection This parameter can be one of the following values: 00824 * @arg @ref LL_LPUART_DIRECTION_NONE 00825 * @arg @ref LL_LPUART_DIRECTION_RX 00826 * @arg @ref LL_LPUART_DIRECTION_TX 00827 * @arg @ref LL_LPUART_DIRECTION_TX_RX 00828 * @retval None 00829 */ 00830 __STATIC_INLINE void LL_LPUART_SetTransferDirection(USART_TypeDef *LPUARTx, uint32_t TransferDirection) 00831 { 00832 ATOMIC_MODIFY_REG(LPUARTx->CR1, USART_CR1_RE | USART_CR1_TE, TransferDirection); 00833 } 00834 00835 /** 00836 * @brief Return enabled/disabled states of Transmitter and Receiver 00837 * @rmtoll CR1 RE LL_LPUART_GetTransferDirection\n 00838 * CR1 TE LL_LPUART_GetTransferDirection 00839 * @param LPUARTx LPUART Instance 00840 * @retval Returned value can be one of the following values: 00841 * @arg @ref LL_LPUART_DIRECTION_NONE 00842 * @arg @ref LL_LPUART_DIRECTION_RX 00843 * @arg @ref LL_LPUART_DIRECTION_TX 00844 * @arg @ref LL_LPUART_DIRECTION_TX_RX 00845 */ 00846 __STATIC_INLINE uint32_t LL_LPUART_GetTransferDirection(USART_TypeDef *LPUARTx) 00847 { 00848 return (uint32_t)(READ_BIT(LPUARTx->CR1, USART_CR1_RE | USART_CR1_TE)); 00849 } 00850 00851 /** 00852 * @brief Configure Parity (enabled/disabled and parity mode if enabled) 00853 * @note This function selects if hardware parity control (generation and detection) is enabled or disabled. 00854 * When the parity control is enabled (Odd or Even), computed parity bit is inserted at the MSB position 00855 * (depending on data width) and parity is checked on the received data. 00856 * @rmtoll CR1 PS LL_LPUART_SetParity\n 00857 * CR1 PCE LL_LPUART_SetParity 00858 * @param LPUARTx LPUART Instance 00859 * @param Parity This parameter can be one of the following values: 00860 * @arg @ref LL_LPUART_PARITY_NONE 00861 * @arg @ref LL_LPUART_PARITY_EVEN 00862 * @arg @ref LL_LPUART_PARITY_ODD 00863 * @retval None 00864 */ 00865 __STATIC_INLINE void LL_LPUART_SetParity(USART_TypeDef *LPUARTx, uint32_t Parity) 00866 { 00867 MODIFY_REG(LPUARTx->CR1, USART_CR1_PS | USART_CR1_PCE, Parity); 00868 } 00869 00870 /** 00871 * @brief Return Parity configuration (enabled/disabled and parity mode if enabled) 00872 * @rmtoll CR1 PS LL_LPUART_GetParity\n 00873 * CR1 PCE LL_LPUART_GetParity 00874 * @param LPUARTx LPUART Instance 00875 * @retval Returned value can be one of the following values: 00876 * @arg @ref LL_LPUART_PARITY_NONE 00877 * @arg @ref LL_LPUART_PARITY_EVEN 00878 * @arg @ref LL_LPUART_PARITY_ODD 00879 */ 00880 __STATIC_INLINE uint32_t LL_LPUART_GetParity(USART_TypeDef *LPUARTx) 00881 { 00882 return (uint32_t)(READ_BIT(LPUARTx->CR1, USART_CR1_PS | USART_CR1_PCE)); 00883 } 00884 00885 /** 00886 * @brief Set Receiver Wake Up method from Mute mode. 00887 * @rmtoll CR1 WAKE LL_LPUART_SetWakeUpMethod 00888 * @param LPUARTx LPUART Instance 00889 * @param Method This parameter can be one of the following values: 00890 * @arg @ref LL_LPUART_WAKEUP_IDLELINE 00891 * @arg @ref LL_LPUART_WAKEUP_ADDRESSMARK 00892 * @retval None 00893 */ 00894 __STATIC_INLINE void LL_LPUART_SetWakeUpMethod(USART_TypeDef *LPUARTx, uint32_t Method) 00895 { 00896 MODIFY_REG(LPUARTx->CR1, USART_CR1_WAKE, Method); 00897 } 00898 00899 /** 00900 * @brief Return Receiver Wake Up method from Mute mode 00901 * @rmtoll CR1 WAKE LL_LPUART_GetWakeUpMethod 00902 * @param LPUARTx LPUART Instance 00903 * @retval Returned value can be one of the following values: 00904 * @arg @ref LL_LPUART_WAKEUP_IDLELINE 00905 * @arg @ref LL_LPUART_WAKEUP_ADDRESSMARK 00906 */ 00907 __STATIC_INLINE uint32_t LL_LPUART_GetWakeUpMethod(USART_TypeDef *LPUARTx) 00908 { 00909 return (uint32_t)(READ_BIT(LPUARTx->CR1, USART_CR1_WAKE)); 00910 } 00911 00912 /** 00913 * @brief Set Word length (nb of data bits, excluding start and stop bits) 00914 * @rmtoll CR1 M LL_LPUART_SetDataWidth 00915 * @param LPUARTx LPUART Instance 00916 * @param DataWidth This parameter can be one of the following values: 00917 * @arg @ref LL_LPUART_DATAWIDTH_7B 00918 * @arg @ref LL_LPUART_DATAWIDTH_8B 00919 * @arg @ref LL_LPUART_DATAWIDTH_9B 00920 * @retval None 00921 */ 00922 __STATIC_INLINE void LL_LPUART_SetDataWidth(USART_TypeDef *LPUARTx, uint32_t DataWidth) 00923 { 00924 MODIFY_REG(LPUARTx->CR1, USART_CR1_M, DataWidth); 00925 } 00926 00927 /** 00928 * @brief Return Word length (i.e. nb of data bits, excluding start and stop bits) 00929 * @rmtoll CR1 M LL_LPUART_GetDataWidth 00930 * @param LPUARTx LPUART Instance 00931 * @retval Returned value can be one of the following values: 00932 * @arg @ref LL_LPUART_DATAWIDTH_7B 00933 * @arg @ref LL_LPUART_DATAWIDTH_8B 00934 * @arg @ref LL_LPUART_DATAWIDTH_9B 00935 */ 00936 __STATIC_INLINE uint32_t LL_LPUART_GetDataWidth(USART_TypeDef *LPUARTx) 00937 { 00938 return (uint32_t)(READ_BIT(LPUARTx->CR1, USART_CR1_M)); 00939 } 00940 00941 /** 00942 * @brief Allow switch between Mute Mode and Active mode 00943 * @rmtoll CR1 MME LL_LPUART_EnableMuteMode 00944 * @param LPUARTx LPUART Instance 00945 * @retval None 00946 */ 00947 __STATIC_INLINE void LL_LPUART_EnableMuteMode(USART_TypeDef *LPUARTx) 00948 { 00949 ATOMIC_SET_BIT(LPUARTx->CR1, USART_CR1_MME); 00950 } 00951 00952 /** 00953 * @brief Prevent Mute Mode use. Set Receiver in active mode permanently. 00954 * @rmtoll CR1 MME LL_LPUART_DisableMuteMode 00955 * @param LPUARTx LPUART Instance 00956 * @retval None 00957 */ 00958 __STATIC_INLINE void LL_LPUART_DisableMuteMode(USART_TypeDef *LPUARTx) 00959 { 00960 ATOMIC_CLEAR_BIT(LPUARTx->CR1, USART_CR1_MME); 00961 } 00962 00963 /** 00964 * @brief Indicate if switch between Mute Mode and Active mode is allowed 00965 * @rmtoll CR1 MME LL_LPUART_IsEnabledMuteMode 00966 * @param LPUARTx LPUART Instance 00967 * @retval State of bit (1 or 0). 00968 */ 00969 __STATIC_INLINE uint32_t LL_LPUART_IsEnabledMuteMode(USART_TypeDef *LPUARTx) 00970 { 00971 return ((READ_BIT(LPUARTx->CR1, USART_CR1_MME) == (USART_CR1_MME)) ? 1UL : 0UL); 00972 } 00973 00974 #if defined(USART_PRESC_PRESCALER) 00975 /** 00976 * @brief Configure Clock source prescaler for baudrate generator and oversampling 00977 * @rmtoll PRESC PRESCALER LL_LPUART_SetPrescaler 00978 * @param LPUARTx LPUART Instance 00979 * @param PrescalerValue This parameter can be one of the following values: 00980 * @arg @ref LL_LPUART_PRESCALER_DIV1 00981 * @arg @ref LL_LPUART_PRESCALER_DIV2 00982 * @arg @ref LL_LPUART_PRESCALER_DIV4 00983 * @arg @ref LL_LPUART_PRESCALER_DIV6 00984 * @arg @ref LL_LPUART_PRESCALER_DIV8 00985 * @arg @ref LL_LPUART_PRESCALER_DIV10 00986 * @arg @ref LL_LPUART_PRESCALER_DIV12 00987 * @arg @ref LL_LPUART_PRESCALER_DIV16 00988 * @arg @ref LL_LPUART_PRESCALER_DIV32 00989 * @arg @ref LL_LPUART_PRESCALER_DIV64 00990 * @arg @ref LL_LPUART_PRESCALER_DIV128 00991 * @arg @ref LL_LPUART_PRESCALER_DIV256 00992 * @retval None 00993 */ 00994 __STATIC_INLINE void LL_LPUART_SetPrescaler(USART_TypeDef *LPUARTx, uint32_t PrescalerValue) 00995 { 00996 MODIFY_REG(LPUARTx->PRESC, USART_PRESC_PRESCALER, (uint16_t)PrescalerValue); 00997 } 00998 00999 /** 01000 * @brief Retrieve the Clock source prescaler for baudrate generator and oversampling 01001 * @rmtoll PRESC PRESCALER LL_LPUART_GetPrescaler 01002 * @param LPUARTx LPUART Instance 01003 * @retval Returned value can be one of the following values: 01004 * @arg @ref LL_LPUART_PRESCALER_DIV1 01005 * @arg @ref LL_LPUART_PRESCALER_DIV2 01006 * @arg @ref LL_LPUART_PRESCALER_DIV4 01007 * @arg @ref LL_LPUART_PRESCALER_DIV6 01008 * @arg @ref LL_LPUART_PRESCALER_DIV8 01009 * @arg @ref LL_LPUART_PRESCALER_DIV10 01010 * @arg @ref LL_LPUART_PRESCALER_DIV12 01011 * @arg @ref LL_LPUART_PRESCALER_DIV16 01012 * @arg @ref LL_LPUART_PRESCALER_DIV32 01013 * @arg @ref LL_LPUART_PRESCALER_DIV64 01014 * @arg @ref LL_LPUART_PRESCALER_DIV128 01015 * @arg @ref LL_LPUART_PRESCALER_DIV256 01016 */ 01017 __STATIC_INLINE uint32_t LL_LPUART_GetPrescaler(USART_TypeDef *LPUARTx) 01018 { 01019 return (uint32_t)(READ_BIT(LPUARTx->PRESC, USART_PRESC_PRESCALER)); 01020 } 01021 #endif /* USART_PRESC_PRESCALER */ 01022 01023 /** 01024 * @brief Set the length of the stop bits 01025 * @rmtoll CR2 STOP LL_LPUART_SetStopBitsLength 01026 * @param LPUARTx LPUART Instance 01027 * @param StopBits This parameter can be one of the following values: 01028 * @arg @ref LL_LPUART_STOPBITS_1 01029 * @arg @ref LL_LPUART_STOPBITS_2 01030 * @retval None 01031 */ 01032 __STATIC_INLINE void LL_LPUART_SetStopBitsLength(USART_TypeDef *LPUARTx, uint32_t StopBits) 01033 { 01034 MODIFY_REG(LPUARTx->CR2, USART_CR2_STOP, StopBits); 01035 } 01036 01037 /** 01038 * @brief Retrieve the length of the stop bits 01039 * @rmtoll CR2 STOP LL_LPUART_GetStopBitsLength 01040 * @param LPUARTx LPUART Instance 01041 * @retval Returned value can be one of the following values: 01042 * @arg @ref LL_LPUART_STOPBITS_1 01043 * @arg @ref LL_LPUART_STOPBITS_2 01044 */ 01045 __STATIC_INLINE uint32_t LL_LPUART_GetStopBitsLength(USART_TypeDef *LPUARTx) 01046 { 01047 return (uint32_t)(READ_BIT(LPUARTx->CR2, USART_CR2_STOP)); 01048 } 01049 01050 /** 01051 * @brief Configure Character frame format (Datawidth, Parity control, Stop Bits) 01052 * @note Call of this function is equivalent to following function call sequence : 01053 * - Data Width configuration using @ref LL_LPUART_SetDataWidth() function 01054 * - Parity Control and mode configuration using @ref LL_LPUART_SetParity() function 01055 * - Stop bits configuration using @ref LL_LPUART_SetStopBitsLength() function 01056 * @rmtoll CR1 PS LL_LPUART_ConfigCharacter\n 01057 * CR1 PCE LL_LPUART_ConfigCharacter\n 01058 * CR1 M LL_LPUART_ConfigCharacter\n 01059 * CR2 STOP LL_LPUART_ConfigCharacter 01060 * @param LPUARTx LPUART Instance 01061 * @param DataWidth This parameter can be one of the following values: 01062 * @arg @ref LL_LPUART_DATAWIDTH_7B 01063 * @arg @ref LL_LPUART_DATAWIDTH_8B 01064 * @arg @ref LL_LPUART_DATAWIDTH_9B 01065 * @param Parity This parameter can be one of the following values: 01066 * @arg @ref LL_LPUART_PARITY_NONE 01067 * @arg @ref LL_LPUART_PARITY_EVEN 01068 * @arg @ref LL_LPUART_PARITY_ODD 01069 * @param StopBits This parameter can be one of the following values: 01070 * @arg @ref LL_LPUART_STOPBITS_1 01071 * @arg @ref LL_LPUART_STOPBITS_2 01072 * @retval None 01073 */ 01074 __STATIC_INLINE void LL_LPUART_ConfigCharacter(USART_TypeDef *LPUARTx, uint32_t DataWidth, uint32_t Parity, 01075 uint32_t StopBits) 01076 { 01077 MODIFY_REG(LPUARTx->CR1, USART_CR1_PS | USART_CR1_PCE | USART_CR1_M, Parity | DataWidth); 01078 MODIFY_REG(LPUARTx->CR2, USART_CR2_STOP, StopBits); 01079 } 01080 01081 /** 01082 * @brief Configure TX/RX pins swapping setting. 01083 * @rmtoll CR2 SWAP LL_LPUART_SetTXRXSwap 01084 * @param LPUARTx LPUART Instance 01085 * @param SwapConfig This parameter can be one of the following values: 01086 * @arg @ref LL_LPUART_TXRX_STANDARD 01087 * @arg @ref LL_LPUART_TXRX_SWAPPED 01088 * @retval None 01089 */ 01090 __STATIC_INLINE void LL_LPUART_SetTXRXSwap(USART_TypeDef *LPUARTx, uint32_t SwapConfig) 01091 { 01092 MODIFY_REG(LPUARTx->CR2, USART_CR2_SWAP, SwapConfig); 01093 } 01094 01095 /** 01096 * @brief Retrieve TX/RX pins swapping configuration. 01097 * @rmtoll CR2 SWAP LL_LPUART_GetTXRXSwap 01098 * @param LPUARTx LPUART Instance 01099 * @retval Returned value can be one of the following values: 01100 * @arg @ref LL_LPUART_TXRX_STANDARD 01101 * @arg @ref LL_LPUART_TXRX_SWAPPED 01102 */ 01103 __STATIC_INLINE uint32_t LL_LPUART_GetTXRXSwap(USART_TypeDef *LPUARTx) 01104 { 01105 return (uint32_t)(READ_BIT(LPUARTx->CR2, USART_CR2_SWAP)); 01106 } 01107 01108 /** 01109 * @brief Configure RX pin active level logic 01110 * @rmtoll CR2 RXINV LL_LPUART_SetRXPinLevel 01111 * @param LPUARTx LPUART Instance 01112 * @param PinInvMethod This parameter can be one of the following values: 01113 * @arg @ref LL_LPUART_RXPIN_LEVEL_STANDARD 01114 * @arg @ref LL_LPUART_RXPIN_LEVEL_INVERTED 01115 * @retval None 01116 */ 01117 __STATIC_INLINE void LL_LPUART_SetRXPinLevel(USART_TypeDef *LPUARTx, uint32_t PinInvMethod) 01118 { 01119 MODIFY_REG(LPUARTx->CR2, USART_CR2_RXINV, PinInvMethod); 01120 } 01121 01122 /** 01123 * @brief Retrieve RX pin active level logic configuration 01124 * @rmtoll CR2 RXINV LL_LPUART_GetRXPinLevel 01125 * @param LPUARTx LPUART Instance 01126 * @retval Returned value can be one of the following values: 01127 * @arg @ref LL_LPUART_RXPIN_LEVEL_STANDARD 01128 * @arg @ref LL_LPUART_RXPIN_LEVEL_INVERTED 01129 */ 01130 __STATIC_INLINE uint32_t LL_LPUART_GetRXPinLevel(USART_TypeDef *LPUARTx) 01131 { 01132 return (uint32_t)(READ_BIT(LPUARTx->CR2, USART_CR2_RXINV)); 01133 } 01134 01135 /** 01136 * @brief Configure TX pin active level logic 01137 * @rmtoll CR2 TXINV LL_LPUART_SetTXPinLevel 01138 * @param LPUARTx LPUART Instance 01139 * @param PinInvMethod This parameter can be one of the following values: 01140 * @arg @ref LL_LPUART_TXPIN_LEVEL_STANDARD 01141 * @arg @ref LL_LPUART_TXPIN_LEVEL_INVERTED 01142 * @retval None 01143 */ 01144 __STATIC_INLINE void LL_LPUART_SetTXPinLevel(USART_TypeDef *LPUARTx, uint32_t PinInvMethod) 01145 { 01146 MODIFY_REG(LPUARTx->CR2, USART_CR2_TXINV, PinInvMethod); 01147 } 01148 01149 /** 01150 * @brief Retrieve TX pin active level logic configuration 01151 * @rmtoll CR2 TXINV LL_LPUART_GetTXPinLevel 01152 * @param LPUARTx LPUART Instance 01153 * @retval Returned value can be one of the following values: 01154 * @arg @ref LL_LPUART_TXPIN_LEVEL_STANDARD 01155 * @arg @ref LL_LPUART_TXPIN_LEVEL_INVERTED 01156 */ 01157 __STATIC_INLINE uint32_t LL_LPUART_GetTXPinLevel(USART_TypeDef *LPUARTx) 01158 { 01159 return (uint32_t)(READ_BIT(LPUARTx->CR2, USART_CR2_TXINV)); 01160 } 01161 01162 /** 01163 * @brief Configure Binary data logic. 01164 * 01165 * @note Allow to define how Logical data from the data register are send/received : 01166 * either in positive/direct logic (1=H, 0=L) or in negative/inverse logic (1=L, 0=H) 01167 * @rmtoll CR2 DATAINV LL_LPUART_SetBinaryDataLogic 01168 * @param LPUARTx LPUART Instance 01169 * @param DataLogic This parameter can be one of the following values: 01170 * @arg @ref LL_LPUART_BINARY_LOGIC_POSITIVE 01171 * @arg @ref LL_LPUART_BINARY_LOGIC_NEGATIVE 01172 * @retval None 01173 */ 01174 __STATIC_INLINE void LL_LPUART_SetBinaryDataLogic(USART_TypeDef *LPUARTx, uint32_t DataLogic) 01175 { 01176 MODIFY_REG(LPUARTx->CR2, USART_CR2_DATAINV, DataLogic); 01177 } 01178 01179 /** 01180 * @brief Retrieve Binary data configuration 01181 * @rmtoll CR2 DATAINV LL_LPUART_GetBinaryDataLogic 01182 * @param LPUARTx LPUART Instance 01183 * @retval Returned value can be one of the following values: 01184 * @arg @ref LL_LPUART_BINARY_LOGIC_POSITIVE 01185 * @arg @ref LL_LPUART_BINARY_LOGIC_NEGATIVE 01186 */ 01187 __STATIC_INLINE uint32_t LL_LPUART_GetBinaryDataLogic(USART_TypeDef *LPUARTx) 01188 { 01189 return (uint32_t)(READ_BIT(LPUARTx->CR2, USART_CR2_DATAINV)); 01190 } 01191 01192 /** 01193 * @brief Configure transfer bit order (either Less or Most Significant Bit First) 01194 * @note MSB First means data is transmitted/received with the MSB first, following the start bit. 01195 * LSB First means data is transmitted/received with data bit 0 first, following the start bit. 01196 * @rmtoll CR2 MSBFIRST LL_LPUART_SetTransferBitOrder 01197 * @param LPUARTx LPUART Instance 01198 * @param BitOrder This parameter can be one of the following values: 01199 * @arg @ref LL_LPUART_BITORDER_LSBFIRST 01200 * @arg @ref LL_LPUART_BITORDER_MSBFIRST 01201 * @retval None 01202 */ 01203 __STATIC_INLINE void LL_LPUART_SetTransferBitOrder(USART_TypeDef *LPUARTx, uint32_t BitOrder) 01204 { 01205 MODIFY_REG(LPUARTx->CR2, USART_CR2_MSBFIRST, BitOrder); 01206 } 01207 01208 /** 01209 * @brief Return transfer bit order (either Less or Most Significant Bit First) 01210 * @note MSB First means data is transmitted/received with the MSB first, following the start bit. 01211 * LSB First means data is transmitted/received with data bit 0 first, following the start bit. 01212 * @rmtoll CR2 MSBFIRST LL_LPUART_GetTransferBitOrder 01213 * @param LPUARTx LPUART Instance 01214 * @retval Returned value can be one of the following values: 01215 * @arg @ref LL_LPUART_BITORDER_LSBFIRST 01216 * @arg @ref LL_LPUART_BITORDER_MSBFIRST 01217 */ 01218 __STATIC_INLINE uint32_t LL_LPUART_GetTransferBitOrder(USART_TypeDef *LPUARTx) 01219 { 01220 return (uint32_t)(READ_BIT(LPUARTx->CR2, USART_CR2_MSBFIRST)); 01221 } 01222 01223 /** 01224 * @brief Set Address of the LPUART node. 01225 * @note This is used in multiprocessor communication during Mute mode or Stop mode, 01226 * for wake up with address mark detection. 01227 * @note 4bits address node is used when 4-bit Address Detection is selected in ADDM7. 01228 * (b7-b4 should be set to 0) 01229 * 8bits address node is used when 7-bit Address Detection is selected in ADDM7. 01230 * (This is used in multiprocessor communication during Mute mode or Stop mode, 01231 * for wake up with 7-bit address mark detection. 01232 * The MSB of the character sent by the transmitter should be equal to 1. 01233 * It may also be used for character detection during normal reception, 01234 * Mute mode inactive (for example, end of block detection in ModBus protocol). 01235 * In this case, the whole received character (8-bit) is compared to the ADD[7:0] 01236 * value and CMF flag is set on match) 01237 * @rmtoll CR2 ADD LL_LPUART_ConfigNodeAddress\n 01238 * CR2 ADDM7 LL_LPUART_ConfigNodeAddress 01239 * @param LPUARTx LPUART Instance 01240 * @param AddressLen This parameter can be one of the following values: 01241 * @arg @ref LL_LPUART_ADDRESS_DETECT_4B 01242 * @arg @ref LL_LPUART_ADDRESS_DETECT_7B 01243 * @param NodeAddress 4 or 7 bit Address of the LPUART node. 01244 * @retval None 01245 */ 01246 __STATIC_INLINE void LL_LPUART_ConfigNodeAddress(USART_TypeDef *LPUARTx, uint32_t AddressLen, uint32_t NodeAddress) 01247 { 01248 MODIFY_REG(LPUARTx->CR2, USART_CR2_ADD | USART_CR2_ADDM7, 01249 (uint32_t)(AddressLen | (NodeAddress << USART_CR2_ADD_Pos))); 01250 } 01251 01252 /** 01253 * @brief Return 8 bit Address of the LPUART node as set in ADD field of CR2. 01254 * @note If 4-bit Address Detection is selected in ADDM7, 01255 * only 4bits (b3-b0) of returned value are relevant (b31-b4 are not relevant) 01256 * If 7-bit Address Detection is selected in ADDM7, 01257 * only 8bits (b7-b0) of returned value are relevant (b31-b8 are not relevant) 01258 * @rmtoll CR2 ADD LL_LPUART_GetNodeAddress 01259 * @param LPUARTx LPUART Instance 01260 * @retval Address of the LPUART node (Value between Min_Data=0 and Max_Data=255) 01261 */ 01262 __STATIC_INLINE uint32_t LL_LPUART_GetNodeAddress(USART_TypeDef *LPUARTx) 01263 { 01264 return (uint32_t)(READ_BIT(LPUARTx->CR2, USART_CR2_ADD) >> USART_CR2_ADD_Pos); 01265 } 01266 01267 /** 01268 * @brief Return Length of Node Address used in Address Detection mode (7-bit or 4-bit) 01269 * @rmtoll CR2 ADDM7 LL_LPUART_GetNodeAddressLen 01270 * @param LPUARTx LPUART Instance 01271 * @retval Returned value can be one of the following values: 01272 * @arg @ref LL_LPUART_ADDRESS_DETECT_4B 01273 * @arg @ref LL_LPUART_ADDRESS_DETECT_7B 01274 */ 01275 __STATIC_INLINE uint32_t LL_LPUART_GetNodeAddressLen(USART_TypeDef *LPUARTx) 01276 { 01277 return (uint32_t)(READ_BIT(LPUARTx->CR2, USART_CR2_ADDM7)); 01278 } 01279 01280 /** 01281 * @brief Enable RTS HW Flow Control 01282 * @rmtoll CR3 RTSE LL_LPUART_EnableRTSHWFlowCtrl 01283 * @param LPUARTx LPUART Instance 01284 * @retval None 01285 */ 01286 __STATIC_INLINE void LL_LPUART_EnableRTSHWFlowCtrl(USART_TypeDef *LPUARTx) 01287 { 01288 SET_BIT(LPUARTx->CR3, USART_CR3_RTSE); 01289 } 01290 01291 /** 01292 * @brief Disable RTS HW Flow Control 01293 * @rmtoll CR3 RTSE LL_LPUART_DisableRTSHWFlowCtrl 01294 * @param LPUARTx LPUART Instance 01295 * @retval None 01296 */ 01297 __STATIC_INLINE void LL_LPUART_DisableRTSHWFlowCtrl(USART_TypeDef *LPUARTx) 01298 { 01299 CLEAR_BIT(LPUARTx->CR3, USART_CR3_RTSE); 01300 } 01301 01302 /** 01303 * @brief Enable CTS HW Flow Control 01304 * @rmtoll CR3 CTSE LL_LPUART_EnableCTSHWFlowCtrl 01305 * @param LPUARTx LPUART Instance 01306 * @retval None 01307 */ 01308 __STATIC_INLINE void LL_LPUART_EnableCTSHWFlowCtrl(USART_TypeDef *LPUARTx) 01309 { 01310 SET_BIT(LPUARTx->CR3, USART_CR3_CTSE); 01311 } 01312 01313 /** 01314 * @brief Disable CTS HW Flow Control 01315 * @rmtoll CR3 CTSE LL_LPUART_DisableCTSHWFlowCtrl 01316 * @param LPUARTx LPUART Instance 01317 * @retval None 01318 */ 01319 __STATIC_INLINE void LL_LPUART_DisableCTSHWFlowCtrl(USART_TypeDef *LPUARTx) 01320 { 01321 CLEAR_BIT(LPUARTx->CR3, USART_CR3_CTSE); 01322 } 01323 01324 /** 01325 * @brief Configure HW Flow Control mode (both CTS and RTS) 01326 * @rmtoll CR3 RTSE LL_LPUART_SetHWFlowCtrl\n 01327 * CR3 CTSE LL_LPUART_SetHWFlowCtrl 01328 * @param LPUARTx LPUART Instance 01329 * @param HardwareFlowControl This parameter can be one of the following values: 01330 * @arg @ref LL_LPUART_HWCONTROL_NONE 01331 * @arg @ref LL_LPUART_HWCONTROL_RTS 01332 * @arg @ref LL_LPUART_HWCONTROL_CTS 01333 * @arg @ref LL_LPUART_HWCONTROL_RTS_CTS 01334 * @retval None 01335 */ 01336 __STATIC_INLINE void LL_LPUART_SetHWFlowCtrl(USART_TypeDef *LPUARTx, uint32_t HardwareFlowControl) 01337 { 01338 MODIFY_REG(LPUARTx->CR3, USART_CR3_RTSE | USART_CR3_CTSE, HardwareFlowControl); 01339 } 01340 01341 /** 01342 * @brief Return HW Flow Control configuration (both CTS and RTS) 01343 * @rmtoll CR3 RTSE LL_LPUART_GetHWFlowCtrl\n 01344 * CR3 CTSE LL_LPUART_GetHWFlowCtrl 01345 * @param LPUARTx LPUART Instance 01346 * @retval Returned value can be one of the following values: 01347 * @arg @ref LL_LPUART_HWCONTROL_NONE 01348 * @arg @ref LL_LPUART_HWCONTROL_RTS 01349 * @arg @ref LL_LPUART_HWCONTROL_CTS 01350 * @arg @ref LL_LPUART_HWCONTROL_RTS_CTS 01351 */ 01352 __STATIC_INLINE uint32_t LL_LPUART_GetHWFlowCtrl(USART_TypeDef *LPUARTx) 01353 { 01354 return (uint32_t)(READ_BIT(LPUARTx->CR3, USART_CR3_RTSE | USART_CR3_CTSE)); 01355 } 01356 01357 /** 01358 * @brief Enable Overrun detection 01359 * @rmtoll CR3 OVRDIS LL_LPUART_EnableOverrunDetect 01360 * @param LPUARTx LPUART Instance 01361 * @retval None 01362 */ 01363 __STATIC_INLINE void LL_LPUART_EnableOverrunDetect(USART_TypeDef *LPUARTx) 01364 { 01365 CLEAR_BIT(LPUARTx->CR3, USART_CR3_OVRDIS); 01366 } 01367 01368 /** 01369 * @brief Disable Overrun detection 01370 * @rmtoll CR3 OVRDIS LL_LPUART_DisableOverrunDetect 01371 * @param LPUARTx LPUART Instance 01372 * @retval None 01373 */ 01374 __STATIC_INLINE void LL_LPUART_DisableOverrunDetect(USART_TypeDef *LPUARTx) 01375 { 01376 SET_BIT(LPUARTx->CR3, USART_CR3_OVRDIS); 01377 } 01378 01379 /** 01380 * @brief Indicate if Overrun detection is enabled 01381 * @rmtoll CR3 OVRDIS LL_LPUART_IsEnabledOverrunDetect 01382 * @param LPUARTx LPUART Instance 01383 * @retval State of bit (1 or 0). 01384 */ 01385 __STATIC_INLINE uint32_t LL_LPUART_IsEnabledOverrunDetect(USART_TypeDef *LPUARTx) 01386 { 01387 return ((READ_BIT(LPUARTx->CR3, USART_CR3_OVRDIS) != USART_CR3_OVRDIS) ? 1UL : 0UL); 01388 } 01389 01390 /** 01391 * @brief Select event type for Wake UP Interrupt Flag (WUS[1:0] bits) 01392 * @rmtoll CR3 WUS LL_LPUART_SetWKUPType 01393 * @param LPUARTx LPUART Instance 01394 * @param Type This parameter can be one of the following values: 01395 * @arg @ref LL_LPUART_WAKEUP_ON_ADDRESS 01396 * @arg @ref LL_LPUART_WAKEUP_ON_STARTBIT 01397 * @arg @ref LL_LPUART_WAKEUP_ON_RXNE 01398 * @retval None 01399 */ 01400 __STATIC_INLINE void LL_LPUART_SetWKUPType(USART_TypeDef *LPUARTx, uint32_t Type) 01401 { 01402 MODIFY_REG(LPUARTx->CR3, USART_CR3_WUS, Type); 01403 } 01404 01405 /** 01406 * @brief Return event type for Wake UP Interrupt Flag (WUS[1:0] bits) 01407 * @rmtoll CR3 WUS LL_LPUART_GetWKUPType 01408 * @param LPUARTx LPUART Instance 01409 * @retval Returned value can be one of the following values: 01410 * @arg @ref LL_LPUART_WAKEUP_ON_ADDRESS 01411 * @arg @ref LL_LPUART_WAKEUP_ON_STARTBIT 01412 * @arg @ref LL_LPUART_WAKEUP_ON_RXNE 01413 */ 01414 __STATIC_INLINE uint32_t LL_LPUART_GetWKUPType(USART_TypeDef *LPUARTx) 01415 { 01416 return (uint32_t)(READ_BIT(LPUARTx->CR3, USART_CR3_WUS)); 01417 } 01418 01419 /** 01420 * @brief Configure LPUART BRR register for achieving expected Baud Rate value. 01421 * 01422 * @note Compute and set LPUARTDIV value in BRR Register (full BRR content) 01423 * according to used Peripheral Clock and expected Baud Rate values 01424 * @note Peripheral clock and Baud Rate values provided as function parameters should be valid 01425 * (Baud rate value != 0). 01426 * @note Provided that LPUARTx_BRR must be > = 0x300 and LPUART_BRR is 20-bit, 01427 * a care should be taken when generating high baud rates using high PeriphClk 01428 * values. PeriphClk must be in the range [3 x BaudRate, 4096 x BaudRate]. 01429 * @rmtoll BRR BRR LL_LPUART_SetBaudRate 01430 * @param LPUARTx LPUART Instance 01431 * @param PeriphClk Peripheral Clock 01432 @if USART_PRESC_PRESCALER 01433 * @param PrescalerValue This parameter can be one of the following values: 01434 * @arg @ref LL_LPUART_PRESCALER_DIV1 01435 * @arg @ref LL_LPUART_PRESCALER_DIV2 01436 * @arg @ref LL_LPUART_PRESCALER_DIV4 01437 * @arg @ref LL_LPUART_PRESCALER_DIV6 01438 * @arg @ref LL_LPUART_PRESCALER_DIV8 01439 * @arg @ref LL_LPUART_PRESCALER_DIV10 01440 * @arg @ref LL_LPUART_PRESCALER_DIV12 01441 * @arg @ref LL_LPUART_PRESCALER_DIV16 01442 * @arg @ref LL_LPUART_PRESCALER_DIV32 01443 * @arg @ref LL_LPUART_PRESCALER_DIV64 01444 * @arg @ref LL_LPUART_PRESCALER_DIV128 01445 * @arg @ref LL_LPUART_PRESCALER_DIV256 01446 @endif 01447 * @param BaudRate Baud Rate 01448 * @retval None 01449 */ 01450 #if defined(USART_PRESC_PRESCALER) 01451 __STATIC_INLINE void LL_LPUART_SetBaudRate(USART_TypeDef *LPUARTx, uint32_t PeriphClk, uint32_t PrescalerValue, 01452 uint32_t BaudRate) 01453 #else 01454 __STATIC_INLINE void LL_LPUART_SetBaudRate(USART_TypeDef *LPUARTx, uint32_t PeriphClk, uint32_t BaudRate) 01455 #endif /* USART_PRESC_PRESCALER */ 01456 { 01457 #if defined(USART_PRESC_PRESCALER) 01458 if (BaudRate != 0U) 01459 { 01460 LPUARTx->BRR = __LL_LPUART_DIV(PeriphClk, PrescalerValue, BaudRate); 01461 } 01462 #else 01463 if (BaudRate != 0U) 01464 { 01465 LPUARTx->BRR = __LL_LPUART_DIV(PeriphClk, BaudRate); 01466 } 01467 #endif /* USART_PRESC_PRESCALER */ 01468 } 01469 01470 /** 01471 * @brief Return current Baud Rate value, according to LPUARTDIV present in BRR register 01472 * (full BRR content), and to used Peripheral Clock values 01473 * @note In case of non-initialized or invalid value stored in BRR register, value 0 will be returned. 01474 * @rmtoll BRR BRR LL_LPUART_GetBaudRate 01475 * @param LPUARTx LPUART Instance 01476 * @param PeriphClk Peripheral Clock 01477 @if USART_PRESC_PRESCALER 01478 * @param PrescalerValue This parameter can be one of the following values: 01479 * @arg @ref LL_LPUART_PRESCALER_DIV1 01480 * @arg @ref LL_LPUART_PRESCALER_DIV2 01481 * @arg @ref LL_LPUART_PRESCALER_DIV4 01482 * @arg @ref LL_LPUART_PRESCALER_DIV6 01483 * @arg @ref LL_LPUART_PRESCALER_DIV8 01484 * @arg @ref LL_LPUART_PRESCALER_DIV10 01485 * @arg @ref LL_LPUART_PRESCALER_DIV12 01486 * @arg @ref LL_LPUART_PRESCALER_DIV16 01487 * @arg @ref LL_LPUART_PRESCALER_DIV32 01488 * @arg @ref LL_LPUART_PRESCALER_DIV64 01489 * @arg @ref LL_LPUART_PRESCALER_DIV128 01490 * @arg @ref LL_LPUART_PRESCALER_DIV256 01491 @endif 01492 * @retval Baud Rate 01493 */ 01494 #if defined(USART_PRESC_PRESCALER) 01495 __STATIC_INLINE uint32_t LL_LPUART_GetBaudRate(USART_TypeDef *LPUARTx, uint32_t PeriphClk, uint32_t PrescalerValue) 01496 #else 01497 __STATIC_INLINE uint32_t LL_LPUART_GetBaudRate(USART_TypeDef *LPUARTx, uint32_t PeriphClk) 01498 #endif /* USART_PRESC_PRESCALER */ 01499 { 01500 uint32_t lpuartdiv; 01501 uint32_t brrresult; 01502 #if defined(USART_PRESC_PRESCALER) 01503 uint32_t periphclkpresc = (uint32_t)(PeriphClk / (LPUART_PRESCALER_TAB[(uint16_t)PrescalerValue])); 01504 #endif /* USART_PRESC_PRESCALER */ 01505 01506 lpuartdiv = LPUARTx->BRR & LPUART_BRR_MASK; 01507 01508 if (lpuartdiv >= LPUART_BRR_MIN_VALUE) 01509 { 01510 #if defined(USART_PRESC_PRESCALER) 01511 brrresult = (uint32_t)(((uint64_t)(periphclkpresc) * LPUART_LPUARTDIV_FREQ_MUL) / lpuartdiv); 01512 #else 01513 brrresult = (uint32_t)(((uint64_t)(PeriphClk) * LPUART_LPUARTDIV_FREQ_MUL) / lpuartdiv); 01514 #endif /* USART_PRESC_PRESCALER */ 01515 } 01516 else 01517 { 01518 brrresult = 0x0UL; 01519 } 01520 01521 return (brrresult); 01522 } 01523 01524 /** 01525 * @} 01526 */ 01527 01528 /** @defgroup LPUART_LL_EF_Configuration_HalfDuplex Configuration functions related to Half Duplex feature 01529 * @{ 01530 */ 01531 01532 /** 01533 * @brief Enable Single Wire Half-Duplex mode 01534 * @rmtoll CR3 HDSEL LL_LPUART_EnableHalfDuplex 01535 * @param LPUARTx LPUART Instance 01536 * @retval None 01537 */ 01538 __STATIC_INLINE void LL_LPUART_EnableHalfDuplex(USART_TypeDef *LPUARTx) 01539 { 01540 SET_BIT(LPUARTx->CR3, USART_CR3_HDSEL); 01541 } 01542 01543 /** 01544 * @brief Disable Single Wire Half-Duplex mode 01545 * @rmtoll CR3 HDSEL LL_LPUART_DisableHalfDuplex 01546 * @param LPUARTx LPUART Instance 01547 * @retval None 01548 */ 01549 __STATIC_INLINE void LL_LPUART_DisableHalfDuplex(USART_TypeDef *LPUARTx) 01550 { 01551 CLEAR_BIT(LPUARTx->CR3, USART_CR3_HDSEL); 01552 } 01553 01554 /** 01555 * @brief Indicate if Single Wire Half-Duplex mode is enabled 01556 * @rmtoll CR3 HDSEL LL_LPUART_IsEnabledHalfDuplex 01557 * @param LPUARTx LPUART Instance 01558 * @retval State of bit (1 or 0). 01559 */ 01560 __STATIC_INLINE uint32_t LL_LPUART_IsEnabledHalfDuplex(USART_TypeDef *LPUARTx) 01561 { 01562 return ((READ_BIT(LPUARTx->CR3, USART_CR3_HDSEL) == (USART_CR3_HDSEL)) ? 1UL : 0UL); 01563 } 01564 01565 /** 01566 * @} 01567 */ 01568 01569 /** @defgroup LPUART_LL_EF_Configuration_DE Configuration functions related to Driver Enable feature 01570 * @{ 01571 */ 01572 01573 /** 01574 * @brief Set DEDT (Driver Enable De-Assertion Time), Time value expressed on 5 bits ([4:0] bits). 01575 * @rmtoll CR1 DEDT LL_LPUART_SetDEDeassertionTime 01576 * @param LPUARTx LPUART Instance 01577 * @param Time Value between Min_Data=0 and Max_Data=31 01578 * @retval None 01579 */ 01580 __STATIC_INLINE void LL_LPUART_SetDEDeassertionTime(USART_TypeDef *LPUARTx, uint32_t Time) 01581 { 01582 MODIFY_REG(LPUARTx->CR1, USART_CR1_DEDT, Time << USART_CR1_DEDT_Pos); 01583 } 01584 01585 /** 01586 * @brief Return DEDT (Driver Enable De-Assertion Time) 01587 * @rmtoll CR1 DEDT LL_LPUART_GetDEDeassertionTime 01588 * @param LPUARTx LPUART Instance 01589 * @retval Time value expressed on 5 bits ([4:0] bits) : c 01590 */ 01591 __STATIC_INLINE uint32_t LL_LPUART_GetDEDeassertionTime(USART_TypeDef *LPUARTx) 01592 { 01593 return (uint32_t)(READ_BIT(LPUARTx->CR1, USART_CR1_DEDT) >> USART_CR1_DEDT_Pos); 01594 } 01595 01596 /** 01597 * @brief Set DEAT (Driver Enable Assertion Time), Time value expressed on 5 bits ([4:0] bits). 01598 * @rmtoll CR1 DEAT LL_LPUART_SetDEAssertionTime 01599 * @param LPUARTx LPUART Instance 01600 * @param Time Value between Min_Data=0 and Max_Data=31 01601 * @retval None 01602 */ 01603 __STATIC_INLINE void LL_LPUART_SetDEAssertionTime(USART_TypeDef *LPUARTx, uint32_t Time) 01604 { 01605 MODIFY_REG(LPUARTx->CR1, USART_CR1_DEAT, Time << USART_CR1_DEAT_Pos); 01606 } 01607 01608 /** 01609 * @brief Return DEAT (Driver Enable Assertion Time) 01610 * @rmtoll CR1 DEAT LL_LPUART_GetDEAssertionTime 01611 * @param LPUARTx LPUART Instance 01612 * @retval Time value expressed on 5 bits ([4:0] bits) : Time Value between Min_Data=0 and Max_Data=31 01613 */ 01614 __STATIC_INLINE uint32_t LL_LPUART_GetDEAssertionTime(USART_TypeDef *LPUARTx) 01615 { 01616 return (uint32_t)(READ_BIT(LPUARTx->CR1, USART_CR1_DEAT) >> USART_CR1_DEAT_Pos); 01617 } 01618 01619 /** 01620 * @brief Enable Driver Enable (DE) Mode 01621 * @rmtoll CR3 DEM LL_LPUART_EnableDEMode 01622 * @param LPUARTx LPUART Instance 01623 * @retval None 01624 */ 01625 __STATIC_INLINE void LL_LPUART_EnableDEMode(USART_TypeDef *LPUARTx) 01626 { 01627 SET_BIT(LPUARTx->CR3, USART_CR3_DEM); 01628 } 01629 01630 /** 01631 * @brief Disable Driver Enable (DE) Mode 01632 * @rmtoll CR3 DEM LL_LPUART_DisableDEMode 01633 * @param LPUARTx LPUART Instance 01634 * @retval None 01635 */ 01636 __STATIC_INLINE void LL_LPUART_DisableDEMode(USART_TypeDef *LPUARTx) 01637 { 01638 CLEAR_BIT(LPUARTx->CR3, USART_CR3_DEM); 01639 } 01640 01641 /** 01642 * @brief Indicate if Driver Enable (DE) Mode is enabled 01643 * @rmtoll CR3 DEM LL_LPUART_IsEnabledDEMode 01644 * @param LPUARTx LPUART Instance 01645 * @retval State of bit (1 or 0). 01646 */ 01647 __STATIC_INLINE uint32_t LL_LPUART_IsEnabledDEMode(USART_TypeDef *LPUARTx) 01648 { 01649 return ((READ_BIT(LPUARTx->CR3, USART_CR3_DEM) == (USART_CR3_DEM)) ? 1UL : 0UL); 01650 } 01651 01652 /** 01653 * @brief Select Driver Enable Polarity 01654 * @rmtoll CR3 DEP LL_LPUART_SetDESignalPolarity 01655 * @param LPUARTx LPUART Instance 01656 * @param Polarity This parameter can be one of the following values: 01657 * @arg @ref LL_LPUART_DE_POLARITY_HIGH 01658 * @arg @ref LL_LPUART_DE_POLARITY_LOW 01659 * @retval None 01660 */ 01661 __STATIC_INLINE void LL_LPUART_SetDESignalPolarity(USART_TypeDef *LPUARTx, uint32_t Polarity) 01662 { 01663 MODIFY_REG(LPUARTx->CR3, USART_CR3_DEP, Polarity); 01664 } 01665 01666 /** 01667 * @brief Return Driver Enable Polarity 01668 * @rmtoll CR3 DEP LL_LPUART_GetDESignalPolarity 01669 * @param LPUARTx LPUART Instance 01670 * @retval Returned value can be one of the following values: 01671 * @arg @ref LL_LPUART_DE_POLARITY_HIGH 01672 * @arg @ref LL_LPUART_DE_POLARITY_LOW 01673 */ 01674 __STATIC_INLINE uint32_t LL_LPUART_GetDESignalPolarity(USART_TypeDef *LPUARTx) 01675 { 01676 return (uint32_t)(READ_BIT(LPUARTx->CR3, USART_CR3_DEP)); 01677 } 01678 01679 /** 01680 * @} 01681 */ 01682 01683 /** @defgroup LPUART_LL_EF_FLAG_Management FLAG_Management 01684 * @{ 01685 */ 01686 01687 /** 01688 * @brief Check if the LPUART Parity Error Flag is set or not 01689 * @rmtoll ISR PE LL_LPUART_IsActiveFlag_PE 01690 * @param LPUARTx LPUART Instance 01691 * @retval State of bit (1 or 0). 01692 */ 01693 __STATIC_INLINE uint32_t LL_LPUART_IsActiveFlag_PE(USART_TypeDef *LPUARTx) 01694 { 01695 return ((READ_BIT(LPUARTx->ISR, USART_ISR_PE) == (USART_ISR_PE)) ? 1UL : 0UL); 01696 } 01697 01698 /** 01699 * @brief Check if the LPUART Framing Error Flag is set or not 01700 * @rmtoll ISR FE LL_LPUART_IsActiveFlag_FE 01701 * @param LPUARTx LPUART Instance 01702 * @retval State of bit (1 or 0). 01703 */ 01704 __STATIC_INLINE uint32_t LL_LPUART_IsActiveFlag_FE(USART_TypeDef *LPUARTx) 01705 { 01706 return ((READ_BIT(LPUARTx->ISR, USART_ISR_FE) == (USART_ISR_FE)) ? 1UL : 0UL); 01707 } 01708 01709 /** 01710 * @brief Check if the LPUART Noise error detected Flag is set or not 01711 * @rmtoll ISR NE LL_LPUART_IsActiveFlag_NE 01712 * @param LPUARTx LPUART Instance 01713 * @retval State of bit (1 or 0). 01714 */ 01715 __STATIC_INLINE uint32_t LL_LPUART_IsActiveFlag_NE(USART_TypeDef *LPUARTx) 01716 { 01717 return ((READ_BIT(LPUARTx->ISR, USART_ISR_NE) == (USART_ISR_NE)) ? 1UL : 0UL); 01718 } 01719 01720 /** 01721 * @brief Check if the LPUART OverRun Error Flag is set or not 01722 * @rmtoll ISR ORE LL_LPUART_IsActiveFlag_ORE 01723 * @param LPUARTx LPUART Instance 01724 * @retval State of bit (1 or 0). 01725 */ 01726 __STATIC_INLINE uint32_t LL_LPUART_IsActiveFlag_ORE(USART_TypeDef *LPUARTx) 01727 { 01728 return ((READ_BIT(LPUARTx->ISR, USART_ISR_ORE) == (USART_ISR_ORE)) ? 1UL : 0UL); 01729 } 01730 01731 /** 01732 * @brief Check if the LPUART IDLE line detected Flag is set or not 01733 * @rmtoll ISR IDLE LL_LPUART_IsActiveFlag_IDLE 01734 * @param LPUARTx LPUART Instance 01735 * @retval State of bit (1 or 0). 01736 */ 01737 __STATIC_INLINE uint32_t LL_LPUART_IsActiveFlag_IDLE(USART_TypeDef *LPUARTx) 01738 { 01739 return ((READ_BIT(LPUARTx->ISR, USART_ISR_IDLE) == (USART_ISR_IDLE)) ? 1UL : 0UL); 01740 } 01741 01742 #if defined(USART_CR1_FIFOEN) 01743 /* Legacy define */ 01744 #define LL_LPUART_IsActiveFlag_RXNE LL_LPUART_IsActiveFlag_RXNE_RXFNE 01745 01746 /** 01747 * @brief Check if the LPUART Read Data Register or LPUART RX FIFO Not Empty Flag is set or not 01748 * @rmtoll ISR RXNE_RXFNE LL_LPUART_IsActiveFlag_RXNE_RXFNE 01749 * @param LPUARTx LPUART Instance 01750 * @retval State of bit (1 or 0). 01751 */ 01752 __STATIC_INLINE uint32_t LL_LPUART_IsActiveFlag_RXNE_RXFNE(USART_TypeDef *LPUARTx) 01753 { 01754 return ((READ_BIT(LPUARTx->ISR, USART_ISR_RXNE_RXFNE) == (USART_ISR_RXNE_RXFNE)) ? 1UL : 0UL); 01755 } 01756 #else 01757 /** 01758 * @brief Check if the LPUART Read Data Register Not Empty Flag is set or not 01759 * @rmtoll ISR RXNE LL_LPUART_IsActiveFlag_RXNE 01760 * @param LPUARTx LPUART Instance 01761 * @retval State of bit (1 or 0). 01762 */ 01763 __STATIC_INLINE uint32_t LL_LPUART_IsActiveFlag_RXNE(USART_TypeDef *LPUARTx) 01764 { 01765 return ((READ_BIT(LPUARTx->ISR, USART_ISR_RXNE) == (USART_ISR_RXNE)) ? 1UL : 0UL); 01766 } 01767 #endif /* USART_CR1_FIFOEN */ 01768 01769 /** 01770 * @brief Check if the LPUART Transmission Complete Flag is set or not 01771 * @rmtoll ISR TC LL_LPUART_IsActiveFlag_TC 01772 * @param LPUARTx LPUART Instance 01773 * @retval State of bit (1 or 0). 01774 */ 01775 __STATIC_INLINE uint32_t LL_LPUART_IsActiveFlag_TC(USART_TypeDef *LPUARTx) 01776 { 01777 return ((READ_BIT(LPUARTx->ISR, USART_ISR_TC) == (USART_ISR_TC)) ? 1UL : 0UL); 01778 } 01779 01780 #if defined(USART_CR1_FIFOEN) 01781 /* Legacy define */ 01782 #define LL_LPUART_IsActiveFlag_TXE LL_LPUART_IsActiveFlag_TXE_TXFNF 01783 01784 /** 01785 * @brief Check if the LPUART Transmit Data Register Empty or LPUART TX FIFO Not Full Flag is set or not 01786 * @rmtoll ISR TXE_TXFNF LL_LPUART_IsActiveFlag_TXE_TXFNF 01787 * @param LPUARTx LPUART Instance 01788 * @retval State of bit (1 or 0). 01789 */ 01790 __STATIC_INLINE uint32_t LL_LPUART_IsActiveFlag_TXE_TXFNF(USART_TypeDef *LPUARTx) 01791 { 01792 return ((READ_BIT(LPUARTx->ISR, USART_ISR_TXE_TXFNF) == (USART_ISR_TXE_TXFNF)) ? 1UL : 0UL); 01793 } 01794 #else 01795 /** 01796 * @brief Check if the LPUART Transmit Data Register Empty Flag is set or not 01797 * @rmtoll ISR TXE LL_LPUART_IsActiveFlag_TXE 01798 * @param LPUARTx LPUART Instance 01799 * @retval State of bit (1 or 0). 01800 */ 01801 __STATIC_INLINE uint32_t LL_LPUART_IsActiveFlag_TXE(USART_TypeDef *LPUARTx) 01802 { 01803 return ((READ_BIT(LPUARTx->ISR, USART_ISR_TXE) == (USART_ISR_TXE)) ? 1UL : 0UL); 01804 } 01805 #endif /* USART_CR1_FIFOEN */ 01806 01807 /** 01808 * @brief Check if the LPUART CTS interrupt Flag is set or not 01809 * @rmtoll ISR CTSIF LL_LPUART_IsActiveFlag_nCTS 01810 * @param LPUARTx LPUART Instance 01811 * @retval State of bit (1 or 0). 01812 */ 01813 __STATIC_INLINE uint32_t LL_LPUART_IsActiveFlag_nCTS(USART_TypeDef *LPUARTx) 01814 { 01815 return ((READ_BIT(LPUARTx->ISR, USART_ISR_CTSIF) == (USART_ISR_CTSIF)) ? 1UL : 0UL); 01816 } 01817 01818 /** 01819 * @brief Check if the LPUART CTS Flag is set or not 01820 * @rmtoll ISR CTS LL_LPUART_IsActiveFlag_CTS 01821 * @param LPUARTx LPUART Instance 01822 * @retval State of bit (1 or 0). 01823 */ 01824 __STATIC_INLINE uint32_t LL_LPUART_IsActiveFlag_CTS(USART_TypeDef *LPUARTx) 01825 { 01826 return ((READ_BIT(LPUARTx->ISR, USART_ISR_CTS) == (USART_ISR_CTS)) ? 1UL : 0UL); 01827 } 01828 01829 /** 01830 * @brief Check if the LPUART Busy Flag is set or not 01831 * @rmtoll ISR BUSY LL_LPUART_IsActiveFlag_BUSY 01832 * @param LPUARTx LPUART Instance 01833 * @retval State of bit (1 or 0). 01834 */ 01835 __STATIC_INLINE uint32_t LL_LPUART_IsActiveFlag_BUSY(USART_TypeDef *LPUARTx) 01836 { 01837 return ((READ_BIT(LPUARTx->ISR, USART_ISR_BUSY) == (USART_ISR_BUSY)) ? 1UL : 0UL); 01838 } 01839 01840 /** 01841 * @brief Check if the LPUART Character Match Flag is set or not 01842 * @rmtoll ISR CMF LL_LPUART_IsActiveFlag_CM 01843 * @param LPUARTx LPUART Instance 01844 * @retval State of bit (1 or 0). 01845 */ 01846 __STATIC_INLINE uint32_t LL_LPUART_IsActiveFlag_CM(USART_TypeDef *LPUARTx) 01847 { 01848 return ((READ_BIT(LPUARTx->ISR, USART_ISR_CMF) == (USART_ISR_CMF)) ? 1UL : 0UL); 01849 } 01850 01851 /** 01852 * @brief Check if the LPUART Send Break Flag is set or not 01853 * @rmtoll ISR SBKF LL_LPUART_IsActiveFlag_SBK 01854 * @param LPUARTx LPUART Instance 01855 * @retval State of bit (1 or 0). 01856 */ 01857 __STATIC_INLINE uint32_t LL_LPUART_IsActiveFlag_SBK(USART_TypeDef *LPUARTx) 01858 { 01859 return ((READ_BIT(LPUARTx->ISR, USART_ISR_SBKF) == (USART_ISR_SBKF)) ? 1UL : 0UL); 01860 } 01861 01862 /** 01863 * @brief Check if the LPUART Receive Wake Up from mute mode Flag is set or not 01864 * @rmtoll ISR RWU LL_LPUART_IsActiveFlag_RWU 01865 * @param LPUARTx LPUART Instance 01866 * @retval State of bit (1 or 0). 01867 */ 01868 __STATIC_INLINE uint32_t LL_LPUART_IsActiveFlag_RWU(USART_TypeDef *LPUARTx) 01869 { 01870 return ((READ_BIT(LPUARTx->ISR, USART_ISR_RWU) == (USART_ISR_RWU)) ? 1UL : 0UL); 01871 } 01872 01873 /** 01874 * @brief Check if the LPUART Wake Up from stop mode Flag is set or not 01875 * @rmtoll ISR WUF LL_LPUART_IsActiveFlag_WKUP 01876 * @param LPUARTx LPUART Instance 01877 * @retval State of bit (1 or 0). 01878 */ 01879 __STATIC_INLINE uint32_t LL_LPUART_IsActiveFlag_WKUP(USART_TypeDef *LPUARTx) 01880 { 01881 return ((READ_BIT(LPUARTx->ISR, USART_ISR_WUF) == (USART_ISR_WUF)) ? 1UL : 0UL); 01882 } 01883 01884 /** 01885 * @brief Check if the LPUART Transmit Enable Acknowledge Flag is set or not 01886 * @rmtoll ISR TEACK LL_LPUART_IsActiveFlag_TEACK 01887 * @param LPUARTx LPUART Instance 01888 * @retval State of bit (1 or 0). 01889 */ 01890 __STATIC_INLINE uint32_t LL_LPUART_IsActiveFlag_TEACK(USART_TypeDef *LPUARTx) 01891 { 01892 return ((READ_BIT(LPUARTx->ISR, USART_ISR_TEACK) == (USART_ISR_TEACK)) ? 1UL : 0UL); 01893 } 01894 01895 /** 01896 * @brief Check if the LPUART Receive Enable Acknowledge Flag is set or not 01897 * @rmtoll ISR REACK LL_LPUART_IsActiveFlag_REACK 01898 * @param LPUARTx LPUART Instance 01899 * @retval State of bit (1 or 0). 01900 */ 01901 __STATIC_INLINE uint32_t LL_LPUART_IsActiveFlag_REACK(USART_TypeDef *LPUARTx) 01902 { 01903 return ((READ_BIT(LPUARTx->ISR, USART_ISR_REACK) == (USART_ISR_REACK)) ? 1UL : 0UL); 01904 } 01905 01906 #if defined(USART_CR1_FIFOEN) 01907 /** 01908 * @brief Check if the LPUART TX FIFO Empty Flag is set or not 01909 * @rmtoll ISR TXFE LL_LPUART_IsActiveFlag_TXFE 01910 * @param LPUARTx LPUART Instance 01911 * @retval State of bit (1 or 0). 01912 */ 01913 __STATIC_INLINE uint32_t LL_LPUART_IsActiveFlag_TXFE(USART_TypeDef *LPUARTx) 01914 { 01915 return ((READ_BIT(LPUARTx->ISR, USART_ISR_TXFE) == (USART_ISR_TXFE)) ? 1UL : 0UL); 01916 } 01917 01918 /** 01919 * @brief Check if the LPUART RX FIFO Full Flag is set or not 01920 * @rmtoll ISR RXFF LL_LPUART_IsActiveFlag_RXFF 01921 * @param LPUARTx LPUART Instance 01922 * @retval State of bit (1 or 0). 01923 */ 01924 __STATIC_INLINE uint32_t LL_LPUART_IsActiveFlag_RXFF(USART_TypeDef *LPUARTx) 01925 { 01926 return ((READ_BIT(LPUARTx->ISR, USART_ISR_RXFF) == (USART_ISR_RXFF)) ? 1UL : 0UL); 01927 } 01928 01929 /** 01930 * @brief Check if the LPUART TX FIFO Threshold Flag is set or not 01931 * @rmtoll ISR TXFT LL_LPUART_IsActiveFlag_TXFT 01932 * @param LPUARTx LPUART Instance 01933 * @retval State of bit (1 or 0). 01934 */ 01935 __STATIC_INLINE uint32_t LL_LPUART_IsActiveFlag_TXFT(USART_TypeDef *LPUARTx) 01936 { 01937 return ((READ_BIT(LPUARTx->ISR, USART_ISR_TXFT) == (USART_ISR_TXFT)) ? 1UL : 0UL); 01938 } 01939 01940 /** 01941 * @brief Check if the LPUART RX FIFO Threshold Flag is set or not 01942 * @rmtoll ISR RXFT LL_LPUART_IsActiveFlag_RXFT 01943 * @param LPUARTx LPUART Instance 01944 * @retval State of bit (1 or 0). 01945 */ 01946 __STATIC_INLINE uint32_t LL_LPUART_IsActiveFlag_RXFT(USART_TypeDef *LPUARTx) 01947 { 01948 return ((READ_BIT(LPUARTx->ISR, USART_ISR_RXFT) == (USART_ISR_RXFT)) ? 1UL : 0UL); 01949 } 01950 #endif /* USART_CR1_FIFOEN */ 01951 01952 /** 01953 * @brief Clear Parity Error Flag 01954 * @rmtoll ICR PECF LL_LPUART_ClearFlag_PE 01955 * @param LPUARTx LPUART Instance 01956 * @retval None 01957 */ 01958 __STATIC_INLINE void LL_LPUART_ClearFlag_PE(USART_TypeDef *LPUARTx) 01959 { 01960 WRITE_REG(LPUARTx->ICR, USART_ICR_PECF); 01961 } 01962 01963 /** 01964 * @brief Clear Framing Error Flag 01965 * @rmtoll ICR FECF LL_LPUART_ClearFlag_FE 01966 * @param LPUARTx LPUART Instance 01967 * @retval None 01968 */ 01969 __STATIC_INLINE void LL_LPUART_ClearFlag_FE(USART_TypeDef *LPUARTx) 01970 { 01971 WRITE_REG(LPUARTx->ICR, USART_ICR_FECF); 01972 } 01973 01974 /** 01975 * @brief Clear Noise detected Flag 01976 * @rmtoll ICR NECF LL_LPUART_ClearFlag_NE 01977 * @param LPUARTx LPUART Instance 01978 * @retval None 01979 */ 01980 __STATIC_INLINE void LL_LPUART_ClearFlag_NE(USART_TypeDef *LPUARTx) 01981 { 01982 WRITE_REG(LPUARTx->ICR, USART_ICR_NECF); 01983 } 01984 01985 /** 01986 * @brief Clear OverRun Error Flag 01987 * @rmtoll ICR ORECF LL_LPUART_ClearFlag_ORE 01988 * @param LPUARTx LPUART Instance 01989 * @retval None 01990 */ 01991 __STATIC_INLINE void LL_LPUART_ClearFlag_ORE(USART_TypeDef *LPUARTx) 01992 { 01993 WRITE_REG(LPUARTx->ICR, USART_ICR_ORECF); 01994 } 01995 01996 /** 01997 * @brief Clear IDLE line detected Flag 01998 * @rmtoll ICR IDLECF LL_LPUART_ClearFlag_IDLE 01999 * @param LPUARTx LPUART Instance 02000 * @retval None 02001 */ 02002 __STATIC_INLINE void LL_LPUART_ClearFlag_IDLE(USART_TypeDef *LPUARTx) 02003 { 02004 WRITE_REG(LPUARTx->ICR, USART_ICR_IDLECF); 02005 } 02006 02007 /** 02008 * @brief Clear Transmission Complete Flag 02009 * @rmtoll ICR TCCF LL_LPUART_ClearFlag_TC 02010 * @param LPUARTx LPUART Instance 02011 * @retval None 02012 */ 02013 __STATIC_INLINE void LL_LPUART_ClearFlag_TC(USART_TypeDef *LPUARTx) 02014 { 02015 WRITE_REG(LPUARTx->ICR, USART_ICR_TCCF); 02016 } 02017 02018 /** 02019 * @brief Clear CTS Interrupt Flag 02020 * @rmtoll ICR CTSCF LL_LPUART_ClearFlag_nCTS 02021 * @param LPUARTx LPUART Instance 02022 * @retval None 02023 */ 02024 __STATIC_INLINE void LL_LPUART_ClearFlag_nCTS(USART_TypeDef *LPUARTx) 02025 { 02026 WRITE_REG(LPUARTx->ICR, USART_ICR_CTSCF); 02027 } 02028 02029 /** 02030 * @brief Clear Character Match Flag 02031 * @rmtoll ICR CMCF LL_LPUART_ClearFlag_CM 02032 * @param LPUARTx LPUART Instance 02033 * @retval None 02034 */ 02035 __STATIC_INLINE void LL_LPUART_ClearFlag_CM(USART_TypeDef *LPUARTx) 02036 { 02037 WRITE_REG(LPUARTx->ICR, USART_ICR_CMCF); 02038 } 02039 02040 /** 02041 * @brief Clear Wake Up from stop mode Flag 02042 * @rmtoll ICR WUCF LL_LPUART_ClearFlag_WKUP 02043 * @param LPUARTx LPUART Instance 02044 * @retval None 02045 */ 02046 __STATIC_INLINE void LL_LPUART_ClearFlag_WKUP(USART_TypeDef *LPUARTx) 02047 { 02048 WRITE_REG(LPUARTx->ICR, USART_ICR_WUCF); 02049 } 02050 02051 /** 02052 * @} 02053 */ 02054 02055 /** @defgroup LPUART_LL_EF_IT_Management IT_Management 02056 * @{ 02057 */ 02058 02059 /** 02060 * @brief Enable IDLE Interrupt 02061 * @rmtoll CR1 IDLEIE LL_LPUART_EnableIT_IDLE 02062 * @param LPUARTx LPUART Instance 02063 * @retval None 02064 */ 02065 __STATIC_INLINE void LL_LPUART_EnableIT_IDLE(USART_TypeDef *LPUARTx) 02066 { 02067 ATOMIC_SET_BIT(LPUARTx->CR1, USART_CR1_IDLEIE); 02068 } 02069 02070 #if defined(USART_CR1_FIFOEN) 02071 /* Legacy define */ 02072 #define LL_LPUART_EnableIT_RXNE LL_LPUART_EnableIT_RXNE_RXFNE 02073 02074 /** 02075 * @brief Enable RX Not Empty and RX FIFO Not Empty Interrupt 02076 * @rmtoll CR1 RXNEIE_RXFNEIE LL_LPUART_EnableIT_RXNE_RXFNE 02077 * @param LPUARTx LPUART Instance 02078 * @retval None 02079 */ 02080 __STATIC_INLINE void LL_LPUART_EnableIT_RXNE_RXFNE(USART_TypeDef *LPUARTx) 02081 { 02082 ATOMIC_SET_BIT(LPUARTx->CR1, USART_CR1_RXNEIE_RXFNEIE); 02083 } 02084 #else 02085 02086 /** 02087 * @brief Enable RX Not Empty Interrupt 02088 * @rmtoll CR1 RXNEIE LL_LPUART_EnableIT_RXNE 02089 * @param LPUARTx LPUART Instance 02090 * @retval None 02091 */ 02092 __STATIC_INLINE void LL_LPUART_EnableIT_RXNE(USART_TypeDef *LPUARTx) 02093 { 02094 ATOMIC_SET_BIT(LPUARTx->CR1, USART_CR1_RXNEIE); 02095 } 02096 #endif /* USART_CR1_FIFOEN */ 02097 02098 /** 02099 * @brief Enable Transmission Complete Interrupt 02100 * @rmtoll CR1 TCIE LL_LPUART_EnableIT_TC 02101 * @param LPUARTx LPUART Instance 02102 * @retval None 02103 */ 02104 __STATIC_INLINE void LL_LPUART_EnableIT_TC(USART_TypeDef *LPUARTx) 02105 { 02106 ATOMIC_SET_BIT(LPUARTx->CR1, USART_CR1_TCIE); 02107 } 02108 02109 #if defined(USART_CR1_FIFOEN) 02110 /* Legacy define */ 02111 #define LL_LPUART_EnableIT_TXE LL_LPUART_EnableIT_TXE_TXFNF 02112 02113 /** 02114 * @brief Enable TX Empty and TX FIFO Not Full Interrupt 02115 * @rmtoll CR1 TXEIE_TXFNFIE LL_LPUART_EnableIT_TXE_TXFNF 02116 * @param LPUARTx LPUART Instance 02117 * @retval None 02118 */ 02119 __STATIC_INLINE void LL_LPUART_EnableIT_TXE_TXFNF(USART_TypeDef *LPUARTx) 02120 { 02121 ATOMIC_SET_BIT(LPUARTx->CR1, USART_CR1_TXEIE_TXFNFIE); 02122 } 02123 #else 02124 02125 /** 02126 * @brief Enable TX Empty Interrupt 02127 * @rmtoll CR1 TXEIE LL_LPUART_EnableIT_TXE 02128 * @param LPUARTx LPUART Instance 02129 * @retval None 02130 */ 02131 __STATIC_INLINE void LL_LPUART_EnableIT_TXE(USART_TypeDef *LPUARTx) 02132 { 02133 ATOMIC_SET_BIT(LPUARTx->CR1, USART_CR1_TXEIE); 02134 } 02135 #endif /* USART_CR1_FIFOEN */ 02136 02137 /** 02138 * @brief Enable Parity Error Interrupt 02139 * @rmtoll CR1 PEIE LL_LPUART_EnableIT_PE 02140 * @param LPUARTx LPUART Instance 02141 * @retval None 02142 */ 02143 __STATIC_INLINE void LL_LPUART_EnableIT_PE(USART_TypeDef *LPUARTx) 02144 { 02145 ATOMIC_SET_BIT(LPUARTx->CR1, USART_CR1_PEIE); 02146 } 02147 02148 /** 02149 * @brief Enable Character Match Interrupt 02150 * @rmtoll CR1 CMIE LL_LPUART_EnableIT_CM 02151 * @param LPUARTx LPUART Instance 02152 * @retval None 02153 */ 02154 __STATIC_INLINE void LL_LPUART_EnableIT_CM(USART_TypeDef *LPUARTx) 02155 { 02156 ATOMIC_SET_BIT(LPUARTx->CR1, USART_CR1_CMIE); 02157 } 02158 02159 #if defined(USART_CR1_FIFOEN) 02160 /** 02161 * @brief Enable TX FIFO Empty Interrupt 02162 * @rmtoll CR1 TXFEIE LL_LPUART_EnableIT_TXFE 02163 * @param LPUARTx LPUART Instance 02164 * @retval None 02165 */ 02166 __STATIC_INLINE void LL_LPUART_EnableIT_TXFE(USART_TypeDef *LPUARTx) 02167 { 02168 ATOMIC_SET_BIT(LPUARTx->CR1, USART_CR1_TXFEIE); 02169 } 02170 02171 /** 02172 * @brief Enable RX FIFO Full Interrupt 02173 * @rmtoll CR1 RXFFIE LL_LPUART_EnableIT_RXFF 02174 * @param LPUARTx LPUART Instance 02175 * @retval None 02176 */ 02177 __STATIC_INLINE void LL_LPUART_EnableIT_RXFF(USART_TypeDef *LPUARTx) 02178 { 02179 ATOMIC_SET_BIT(LPUARTx->CR1, USART_CR1_RXFFIE); 02180 } 02181 #endif /* USART_CR1_FIFOEN */ 02182 02183 /** 02184 * @brief Enable Error Interrupt 02185 * @note When set, Error Interrupt Enable Bit is enabling interrupt generation in case of a framing 02186 * error, overrun error or noise flag (FE=1 or ORE=1 or NF=1 in the LPUARTx_ISR register). 02187 * - 0: Interrupt is inhibited 02188 * - 1: An interrupt is generated when FE=1 or ORE=1 or NF=1 in the LPUARTx_ISR register. 02189 * @rmtoll CR3 EIE LL_LPUART_EnableIT_ERROR 02190 * @param LPUARTx LPUART Instance 02191 * @retval None 02192 */ 02193 __STATIC_INLINE void LL_LPUART_EnableIT_ERROR(USART_TypeDef *LPUARTx) 02194 { 02195 ATOMIC_SET_BIT(LPUARTx->CR3, USART_CR3_EIE); 02196 } 02197 02198 /** 02199 * @brief Enable CTS Interrupt 02200 * @rmtoll CR3 CTSIE LL_LPUART_EnableIT_CTS 02201 * @param LPUARTx LPUART Instance 02202 * @retval None 02203 */ 02204 __STATIC_INLINE void LL_LPUART_EnableIT_CTS(USART_TypeDef *LPUARTx) 02205 { 02206 ATOMIC_SET_BIT(LPUARTx->CR3, USART_CR3_CTSIE); 02207 } 02208 02209 /** 02210 * @brief Enable Wake Up from Stop Mode Interrupt 02211 * @rmtoll CR3 WUFIE LL_LPUART_EnableIT_WKUP 02212 * @param LPUARTx LPUART Instance 02213 * @retval None 02214 */ 02215 __STATIC_INLINE void LL_LPUART_EnableIT_WKUP(USART_TypeDef *LPUARTx) 02216 { 02217 ATOMIC_SET_BIT(LPUARTx->CR3, USART_CR3_WUFIE); 02218 } 02219 02220 #if defined(USART_CR1_FIFOEN) 02221 /** 02222 * @brief Enable TX FIFO Threshold Interrupt 02223 * @rmtoll CR3 TXFTIE LL_LPUART_EnableIT_TXFT 02224 * @param LPUARTx LPUART Instance 02225 * @retval None 02226 */ 02227 __STATIC_INLINE void LL_LPUART_EnableIT_TXFT(USART_TypeDef *LPUARTx) 02228 { 02229 ATOMIC_SET_BIT(LPUARTx->CR3, USART_CR3_TXFTIE); 02230 } 02231 02232 /** 02233 * @brief Enable RX FIFO Threshold Interrupt 02234 * @rmtoll CR3 RXFTIE LL_LPUART_EnableIT_RXFT 02235 * @param LPUARTx LPUART Instance 02236 * @retval None 02237 */ 02238 __STATIC_INLINE void LL_LPUART_EnableIT_RXFT(USART_TypeDef *LPUARTx) 02239 { 02240 ATOMIC_SET_BIT(LPUARTx->CR3, USART_CR3_RXFTIE); 02241 } 02242 #endif /* USART_CR1_FIFOEN */ 02243 02244 /** 02245 * @brief Disable IDLE Interrupt 02246 * @rmtoll CR1 IDLEIE LL_LPUART_DisableIT_IDLE 02247 * @param LPUARTx LPUART Instance 02248 * @retval None 02249 */ 02250 __STATIC_INLINE void LL_LPUART_DisableIT_IDLE(USART_TypeDef *LPUARTx) 02251 { 02252 ATOMIC_CLEAR_BIT(LPUARTx->CR1, USART_CR1_IDLEIE); 02253 } 02254 02255 #if defined(USART_CR1_FIFOEN) 02256 /* Legacy define */ 02257 #define LL_LPUART_DisableIT_RXNE LL_LPUART_DisableIT_RXNE_RXFNE 02258 02259 /** 02260 * @brief Disable RX Not Empty and RX FIFO Not Empty Interrupt 02261 * @rmtoll CR1 RXNEIE_RXFNEIE LL_LPUART_DisableIT_RXNE_RXFNE 02262 * @param LPUARTx LPUART Instance 02263 * @retval None 02264 */ 02265 __STATIC_INLINE void LL_LPUART_DisableIT_RXNE_RXFNE(USART_TypeDef *LPUARTx) 02266 { 02267 ATOMIC_CLEAR_BIT(LPUARTx->CR1, USART_CR1_RXNEIE_RXFNEIE); 02268 } 02269 #else 02270 02271 /** 02272 * @brief Disable RX Not Empty Interrupt 02273 * @rmtoll CR1 RXNEIE LL_LPUART_DisableIT_RXNE 02274 * @param LPUARTx LPUART Instance 02275 * @retval None 02276 */ 02277 __STATIC_INLINE void LL_LPUART_DisableIT_RXNE(USART_TypeDef *LPUARTx) 02278 { 02279 ATOMIC_CLEAR_BIT(LPUARTx->CR1, USART_CR1_RXNEIE); 02280 } 02281 #endif /* USART_CR1_FIFOEN */ 02282 02283 /** 02284 * @brief Disable Transmission Complete Interrupt 02285 * @rmtoll CR1 TCIE LL_LPUART_DisableIT_TC 02286 * @param LPUARTx LPUART Instance 02287 * @retval None 02288 */ 02289 __STATIC_INLINE void LL_LPUART_DisableIT_TC(USART_TypeDef *LPUARTx) 02290 { 02291 ATOMIC_CLEAR_BIT(LPUARTx->CR1, USART_CR1_TCIE); 02292 } 02293 02294 #if defined(USART_CR1_FIFOEN) 02295 /* Legacy define */ 02296 #define LL_LPUART_DisableIT_TXE LL_LPUART_DisableIT_TXE_TXFNF 02297 02298 /** 02299 * @brief Disable TX Empty and TX FIFO Not Full Interrupt 02300 * @rmtoll CR1 TXEIE_TXFNFIE LL_LPUART_DisableIT_TXE_TXFNF 02301 * @param LPUARTx LPUART Instance 02302 * @retval None 02303 */ 02304 __STATIC_INLINE void LL_LPUART_DisableIT_TXE_TXFNF(USART_TypeDef *LPUARTx) 02305 { 02306 ATOMIC_CLEAR_BIT(LPUARTx->CR1, USART_CR1_TXEIE_TXFNFIE); 02307 } 02308 #else 02309 02310 /** 02311 * @brief Disable TX Empty Interrupt 02312 * @rmtoll CR1 TXEIE LL_LPUART_DisableIT_TXE 02313 * @param LPUARTx LPUART Instance 02314 * @retval None 02315 */ 02316 __STATIC_INLINE void LL_LPUART_DisableIT_TXE(USART_TypeDef *LPUARTx) 02317 { 02318 ATOMIC_CLEAR_BIT(LPUARTx->CR1, USART_CR1_TXEIE); 02319 } 02320 #endif /* USART_CR1_FIFOEN */ 02321 02322 /** 02323 * @brief Disable Parity Error Interrupt 02324 * @rmtoll CR1 PEIE LL_LPUART_DisableIT_PE 02325 * @param LPUARTx LPUART Instance 02326 * @retval None 02327 */ 02328 __STATIC_INLINE void LL_LPUART_DisableIT_PE(USART_TypeDef *LPUARTx) 02329 { 02330 ATOMIC_CLEAR_BIT(LPUARTx->CR1, USART_CR1_PEIE); 02331 } 02332 02333 /** 02334 * @brief Disable Character Match Interrupt 02335 * @rmtoll CR1 CMIE LL_LPUART_DisableIT_CM 02336 * @param LPUARTx LPUART Instance 02337 * @retval None 02338 */ 02339 __STATIC_INLINE void LL_LPUART_DisableIT_CM(USART_TypeDef *LPUARTx) 02340 { 02341 ATOMIC_CLEAR_BIT(LPUARTx->CR1, USART_CR1_CMIE); 02342 } 02343 02344 #if defined(USART_CR1_FIFOEN) 02345 /** 02346 * @brief Disable TX FIFO Empty Interrupt 02347 * @rmtoll CR1 TXFEIE LL_LPUART_DisableIT_TXFE 02348 * @param LPUARTx LPUART Instance 02349 * @retval None 02350 */ 02351 __STATIC_INLINE void LL_LPUART_DisableIT_TXFE(USART_TypeDef *LPUARTx) 02352 { 02353 ATOMIC_CLEAR_BIT(LPUARTx->CR1, USART_CR1_TXFEIE); 02354 } 02355 02356 /** 02357 * @brief Disable RX FIFO Full Interrupt 02358 * @rmtoll CR1 RXFFIE LL_LPUART_DisableIT_RXFF 02359 * @param LPUARTx LPUART Instance 02360 * @retval None 02361 */ 02362 __STATIC_INLINE void LL_LPUART_DisableIT_RXFF(USART_TypeDef *LPUARTx) 02363 { 02364 ATOMIC_CLEAR_BIT(LPUARTx->CR1, USART_CR1_RXFFIE); 02365 } 02366 #endif /* USART_CR1_FIFOEN */ 02367 02368 /** 02369 * @brief Disable Error Interrupt 02370 * @note When set, Error Interrupt Enable Bit is enabling interrupt generation in case of a framing 02371 * error, overrun error or noise flag (FE=1 or ORE=1 or NF=1 in the LPUARTx_ISR register). 02372 * - 0: Interrupt is inhibited 02373 * - 1: An interrupt is generated when FE=1 or ORE=1 or NF=1 in the LPUARTx_ISR register. 02374 * @rmtoll CR3 EIE LL_LPUART_DisableIT_ERROR 02375 * @param LPUARTx LPUART Instance 02376 * @retval None 02377 */ 02378 __STATIC_INLINE void LL_LPUART_DisableIT_ERROR(USART_TypeDef *LPUARTx) 02379 { 02380 ATOMIC_CLEAR_BIT(LPUARTx->CR3, USART_CR3_EIE); 02381 } 02382 02383 /** 02384 * @brief Disable CTS Interrupt 02385 * @rmtoll CR3 CTSIE LL_LPUART_DisableIT_CTS 02386 * @param LPUARTx LPUART Instance 02387 * @retval None 02388 */ 02389 __STATIC_INLINE void LL_LPUART_DisableIT_CTS(USART_TypeDef *LPUARTx) 02390 { 02391 ATOMIC_CLEAR_BIT(LPUARTx->CR3, USART_CR3_CTSIE); 02392 } 02393 02394 /** 02395 * @brief Disable Wake Up from Stop Mode Interrupt 02396 * @rmtoll CR3 WUFIE LL_LPUART_DisableIT_WKUP 02397 * @param LPUARTx LPUART Instance 02398 * @retval None 02399 */ 02400 __STATIC_INLINE void LL_LPUART_DisableIT_WKUP(USART_TypeDef *LPUARTx) 02401 { 02402 ATOMIC_CLEAR_BIT(LPUARTx->CR3, USART_CR3_WUFIE); 02403 } 02404 02405 #if defined(USART_CR1_FIFOEN) 02406 /** 02407 * @brief Disable TX FIFO Threshold Interrupt 02408 * @rmtoll CR3 TXFTIE LL_LPUART_DisableIT_TXFT 02409 * @param LPUARTx LPUART Instance 02410 * @retval None 02411 */ 02412 __STATIC_INLINE void LL_LPUART_DisableIT_TXFT(USART_TypeDef *LPUARTx) 02413 { 02414 ATOMIC_CLEAR_BIT(LPUARTx->CR3, USART_CR3_TXFTIE); 02415 } 02416 02417 /** 02418 * @brief Disable RX FIFO Threshold Interrupt 02419 * @rmtoll CR3 RXFTIE LL_LPUART_DisableIT_RXFT 02420 * @param LPUARTx LPUART Instance 02421 * @retval None 02422 */ 02423 __STATIC_INLINE void LL_LPUART_DisableIT_RXFT(USART_TypeDef *LPUARTx) 02424 { 02425 ATOMIC_CLEAR_BIT(LPUARTx->CR3, USART_CR3_RXFTIE); 02426 } 02427 #endif /* USART_CR1_FIFOEN */ 02428 02429 /** 02430 * @brief Check if the LPUART IDLE Interrupt source is enabled or disabled. 02431 * @rmtoll CR1 IDLEIE LL_LPUART_IsEnabledIT_IDLE 02432 * @param LPUARTx LPUART Instance 02433 * @retval State of bit (1 or 0). 02434 */ 02435 __STATIC_INLINE uint32_t LL_LPUART_IsEnabledIT_IDLE(USART_TypeDef *LPUARTx) 02436 { 02437 return ((READ_BIT(LPUARTx->CR1, USART_CR1_IDLEIE) == (USART_CR1_IDLEIE)) ? 1UL : 0UL); 02438 } 02439 02440 #if defined(USART_CR1_FIFOEN) 02441 /* Legacy define */ 02442 #define LL_LPUART_IsEnabledIT_RXNE LL_LPUART_IsEnabledIT_RXNE_RXFNE 02443 02444 /** 02445 * @brief Check if the LPUART RX Not Empty and LPUART RX FIFO Not Empty Interrupt is enabled or disabled. 02446 * @rmtoll CR1 RXNEIE_RXFNEIE LL_LPUART_IsEnabledIT_RXNE_RXFNE 02447 * @param LPUARTx LPUART Instance 02448 * @retval State of bit (1 or 0). 02449 */ 02450 __STATIC_INLINE uint32_t LL_LPUART_IsEnabledIT_RXNE_RXFNE(USART_TypeDef *LPUARTx) 02451 { 02452 return ((READ_BIT(LPUARTx->CR1, USART_CR1_RXNEIE_RXFNEIE) == (USART_CR1_RXNEIE_RXFNEIE)) ? 1UL : 0UL); 02453 } 02454 #else 02455 02456 /** 02457 * @brief Check if the LPUART RX Not Empty Interrupt is enabled or disabled. 02458 * @rmtoll CR1 RXNEIE LL_LPUART_IsEnabledIT_RXNE 02459 * @param LPUARTx LPUART Instance 02460 * @retval State of bit (1 or 0). 02461 */ 02462 __STATIC_INLINE uint32_t LL_LPUART_IsEnabledIT_RXNE(USART_TypeDef *LPUARTx) 02463 { 02464 return ((READ_BIT(LPUARTx->CR1, USART_CR1_RXNEIE) == (USART_CR1_RXNEIE)) ? 1UL : 0UL); 02465 } 02466 #endif /* USART_CR1_FIFOEN */ 02467 02468 /** 02469 * @brief Check if the LPUART Transmission Complete Interrupt is enabled or disabled. 02470 * @rmtoll CR1 TCIE LL_LPUART_IsEnabledIT_TC 02471 * @param LPUARTx LPUART Instance 02472 * @retval State of bit (1 or 0). 02473 */ 02474 __STATIC_INLINE uint32_t LL_LPUART_IsEnabledIT_TC(USART_TypeDef *LPUARTx) 02475 { 02476 return ((READ_BIT(LPUARTx->CR1, USART_CR1_TCIE) == (USART_CR1_TCIE)) ? 1UL : 0UL); 02477 } 02478 02479 #if defined(USART_CR1_FIFOEN) 02480 /* Legacy define */ 02481 #define LL_LPUART_IsEnabledIT_TXE LL_LPUART_IsEnabledIT_TXE_TXFNF 02482 02483 /** 02484 * @brief Check if the LPUART TX Empty and LPUART TX FIFO Not Full Interrupt is enabled or disabled 02485 * @rmtoll CR1 TXEIE_TXFNFIE LL_LPUART_IsEnabledIT_TXE_TXFNF 02486 * @param LPUARTx LPUART Instance 02487 * @retval State of bit (1 or 0). 02488 */ 02489 __STATIC_INLINE uint32_t LL_LPUART_IsEnabledIT_TXE_TXFNF(USART_TypeDef *LPUARTx) 02490 { 02491 return ((READ_BIT(LPUARTx->CR1, USART_CR1_TXEIE_TXFNFIE) == (USART_CR1_TXEIE_TXFNFIE)) ? 1UL : 0UL); 02492 } 02493 #else 02494 02495 /** 02496 * @brief Check if the LPUART TX Empty Interrupt is enabled or disabled. 02497 * @rmtoll CR1 TXEIE LL_LPUART_IsEnabledIT_TXE 02498 * @param LPUARTx LPUART Instance 02499 * @retval State of bit (1 or 0). 02500 */ 02501 __STATIC_INLINE uint32_t LL_LPUART_IsEnabledIT_TXE(USART_TypeDef *LPUARTx) 02502 { 02503 return ((READ_BIT(LPUARTx->CR1, USART_CR1_TXEIE) == (USART_CR1_TXEIE)) ? 1UL : 0UL); 02504 } 02505 #endif /* USART_CR1_FIFOEN */ 02506 02507 /** 02508 * @brief Check if the LPUART Parity Error Interrupt is enabled or disabled. 02509 * @rmtoll CR1 PEIE LL_LPUART_IsEnabledIT_PE 02510 * @param LPUARTx LPUART Instance 02511 * @retval State of bit (1 or 0). 02512 */ 02513 __STATIC_INLINE uint32_t LL_LPUART_IsEnabledIT_PE(USART_TypeDef *LPUARTx) 02514 { 02515 return ((READ_BIT(LPUARTx->CR1, USART_CR1_PEIE) == (USART_CR1_PEIE)) ? 1UL : 0UL); 02516 } 02517 02518 /** 02519 * @brief Check if the LPUART Character Match Interrupt is enabled or disabled. 02520 * @rmtoll CR1 CMIE LL_LPUART_IsEnabledIT_CM 02521 * @param LPUARTx LPUART Instance 02522 * @retval State of bit (1 or 0). 02523 */ 02524 __STATIC_INLINE uint32_t LL_LPUART_IsEnabledIT_CM(USART_TypeDef *LPUARTx) 02525 { 02526 return ((READ_BIT(LPUARTx->CR1, USART_CR1_CMIE) == (USART_CR1_CMIE)) ? 1UL : 0UL); 02527 } 02528 02529 #if defined(USART_CR1_FIFOEN) 02530 /** 02531 * @brief Check if the LPUART TX FIFO Empty Interrupt is enabled or disabled 02532 * @rmtoll CR1 TXFEIE LL_LPUART_IsEnabledIT_TXFE 02533 * @param LPUARTx LPUART Instance 02534 * @retval State of bit (1 or 0). 02535 */ 02536 __STATIC_INLINE uint32_t LL_LPUART_IsEnabledIT_TXFE(USART_TypeDef *LPUARTx) 02537 { 02538 return ((READ_BIT(LPUARTx->CR1, USART_CR1_TXFEIE) == (USART_CR1_TXFEIE)) ? 1UL : 0UL); 02539 } 02540 02541 /** 02542 * @brief Check if the LPUART RX FIFO Full Interrupt is enabled or disabled 02543 * @rmtoll CR1 RXFFIE LL_LPUART_IsEnabledIT_RXFF 02544 * @param LPUARTx LPUART Instance 02545 * @retval State of bit (1 or 0). 02546 */ 02547 __STATIC_INLINE uint32_t LL_LPUART_IsEnabledIT_RXFF(USART_TypeDef *LPUARTx) 02548 { 02549 return ((READ_BIT(LPUARTx->CR1, USART_CR1_RXFFIE) == (USART_CR1_RXFFIE)) ? 1UL : 0UL); 02550 } 02551 #endif /* USART_CR1_FIFOEN */ 02552 02553 /** 02554 * @brief Check if the LPUART Error Interrupt is enabled or disabled. 02555 * @rmtoll CR3 EIE LL_LPUART_IsEnabledIT_ERROR 02556 * @param LPUARTx LPUART Instance 02557 * @retval State of bit (1 or 0). 02558 */ 02559 __STATIC_INLINE uint32_t LL_LPUART_IsEnabledIT_ERROR(USART_TypeDef *LPUARTx) 02560 { 02561 return ((READ_BIT(LPUARTx->CR3, USART_CR3_EIE) == (USART_CR3_EIE)) ? 1UL : 0UL); 02562 } 02563 02564 /** 02565 * @brief Check if the LPUART CTS Interrupt is enabled or disabled. 02566 * @rmtoll CR3 CTSIE LL_LPUART_IsEnabledIT_CTS 02567 * @param LPUARTx LPUART Instance 02568 * @retval State of bit (1 or 0). 02569 */ 02570 __STATIC_INLINE uint32_t LL_LPUART_IsEnabledIT_CTS(USART_TypeDef *LPUARTx) 02571 { 02572 return ((READ_BIT(LPUARTx->CR3, USART_CR3_CTSIE) == (USART_CR3_CTSIE)) ? 1UL : 0UL); 02573 } 02574 02575 /** 02576 * @brief Check if the LPUART Wake Up from Stop Mode Interrupt is enabled or disabled. 02577 * @rmtoll CR3 WUFIE LL_LPUART_IsEnabledIT_WKUP 02578 * @param LPUARTx LPUART Instance 02579 * @retval State of bit (1 or 0). 02580 */ 02581 __STATIC_INLINE uint32_t LL_LPUART_IsEnabledIT_WKUP(USART_TypeDef *LPUARTx) 02582 { 02583 return ((READ_BIT(LPUARTx->CR3, USART_CR3_WUFIE) == (USART_CR3_WUFIE)) ? 1UL : 0UL); 02584 } 02585 02586 #if defined(USART_CR1_FIFOEN) 02587 /** 02588 * @brief Check if LPUART TX FIFO Threshold Interrupt is enabled or disabled 02589 * @rmtoll CR3 TXFTIE LL_LPUART_IsEnabledIT_TXFT 02590 * @param LPUARTx LPUART Instance 02591 * @retval State of bit (1 or 0). 02592 */ 02593 __STATIC_INLINE uint32_t LL_LPUART_IsEnabledIT_TXFT(USART_TypeDef *LPUARTx) 02594 { 02595 return ((READ_BIT(LPUARTx->CR3, USART_CR3_TXFTIE) == (USART_CR3_TXFTIE)) ? 1UL : 0UL); 02596 } 02597 02598 /** 02599 * @brief Check if LPUART RX FIFO Threshold Interrupt is enabled or disabled 02600 * @rmtoll CR3 RXFTIE LL_LPUART_IsEnabledIT_RXFT 02601 * @param LPUARTx LPUART Instance 02602 * @retval State of bit (1 or 0). 02603 */ 02604 __STATIC_INLINE uint32_t LL_LPUART_IsEnabledIT_RXFT(USART_TypeDef *LPUARTx) 02605 { 02606 return ((READ_BIT(LPUARTx->CR3, USART_CR3_RXFTIE) == (USART_CR3_RXFTIE)) ? 1UL : 0UL); 02607 } 02608 #endif /* USART_CR1_FIFOEN */ 02609 02610 /** 02611 * @} 02612 */ 02613 02614 /** @defgroup LPUART_LL_EF_DMA_Management DMA_Management 02615 * @{ 02616 */ 02617 02618 /** 02619 * @brief Enable DMA Mode for reception 02620 * @rmtoll CR3 DMAR LL_LPUART_EnableDMAReq_RX 02621 * @param LPUARTx LPUART Instance 02622 * @retval None 02623 */ 02624 __STATIC_INLINE void LL_LPUART_EnableDMAReq_RX(USART_TypeDef *LPUARTx) 02625 { 02626 ATOMIC_SET_BIT(LPUARTx->CR3, USART_CR3_DMAR); 02627 } 02628 02629 /** 02630 * @brief Disable DMA Mode for reception 02631 * @rmtoll CR3 DMAR LL_LPUART_DisableDMAReq_RX 02632 * @param LPUARTx LPUART Instance 02633 * @retval None 02634 */ 02635 __STATIC_INLINE void LL_LPUART_DisableDMAReq_RX(USART_TypeDef *LPUARTx) 02636 { 02637 ATOMIC_CLEAR_BIT(LPUARTx->CR3, USART_CR3_DMAR); 02638 } 02639 02640 /** 02641 * @brief Check if DMA Mode is enabled for reception 02642 * @rmtoll CR3 DMAR LL_LPUART_IsEnabledDMAReq_RX 02643 * @param LPUARTx LPUART Instance 02644 * @retval State of bit (1 or 0). 02645 */ 02646 __STATIC_INLINE uint32_t LL_LPUART_IsEnabledDMAReq_RX(USART_TypeDef *LPUARTx) 02647 { 02648 return ((READ_BIT(LPUARTx->CR3, USART_CR3_DMAR) == (USART_CR3_DMAR)) ? 1UL : 0UL); 02649 } 02650 02651 /** 02652 * @brief Enable DMA Mode for transmission 02653 * @rmtoll CR3 DMAT LL_LPUART_EnableDMAReq_TX 02654 * @param LPUARTx LPUART Instance 02655 * @retval None 02656 */ 02657 __STATIC_INLINE void LL_LPUART_EnableDMAReq_TX(USART_TypeDef *LPUARTx) 02658 { 02659 ATOMIC_SET_BIT(LPUARTx->CR3, USART_CR3_DMAT); 02660 } 02661 02662 /** 02663 * @brief Disable DMA Mode for transmission 02664 * @rmtoll CR3 DMAT LL_LPUART_DisableDMAReq_TX 02665 * @param LPUARTx LPUART Instance 02666 * @retval None 02667 */ 02668 __STATIC_INLINE void LL_LPUART_DisableDMAReq_TX(USART_TypeDef *LPUARTx) 02669 { 02670 ATOMIC_CLEAR_BIT(LPUARTx->CR3, USART_CR3_DMAT); 02671 } 02672 02673 /** 02674 * @brief Check if DMA Mode is enabled for transmission 02675 * @rmtoll CR3 DMAT LL_LPUART_IsEnabledDMAReq_TX 02676 * @param LPUARTx LPUART Instance 02677 * @retval State of bit (1 or 0). 02678 */ 02679 __STATIC_INLINE uint32_t LL_LPUART_IsEnabledDMAReq_TX(USART_TypeDef *LPUARTx) 02680 { 02681 return ((READ_BIT(LPUARTx->CR3, USART_CR3_DMAT) == (USART_CR3_DMAT)) ? 1UL : 0UL); 02682 } 02683 02684 /** 02685 * @brief Enable DMA Disabling on Reception Error 02686 * @rmtoll CR3 DDRE LL_LPUART_EnableDMADeactOnRxErr 02687 * @param LPUARTx LPUART Instance 02688 * @retval None 02689 */ 02690 __STATIC_INLINE void LL_LPUART_EnableDMADeactOnRxErr(USART_TypeDef *LPUARTx) 02691 { 02692 SET_BIT(LPUARTx->CR3, USART_CR3_DDRE); 02693 } 02694 02695 /** 02696 * @brief Disable DMA Disabling on Reception Error 02697 * @rmtoll CR3 DDRE LL_LPUART_DisableDMADeactOnRxErr 02698 * @param LPUARTx LPUART Instance 02699 * @retval None 02700 */ 02701 __STATIC_INLINE void LL_LPUART_DisableDMADeactOnRxErr(USART_TypeDef *LPUARTx) 02702 { 02703 CLEAR_BIT(LPUARTx->CR3, USART_CR3_DDRE); 02704 } 02705 02706 /** 02707 * @brief Indicate if DMA Disabling on Reception Error is disabled 02708 * @rmtoll CR3 DDRE LL_LPUART_IsEnabledDMADeactOnRxErr 02709 * @param LPUARTx LPUART Instance 02710 * @retval State of bit (1 or 0). 02711 */ 02712 __STATIC_INLINE uint32_t LL_LPUART_IsEnabledDMADeactOnRxErr(USART_TypeDef *LPUARTx) 02713 { 02714 return ((READ_BIT(LPUARTx->CR3, USART_CR3_DDRE) == (USART_CR3_DDRE)) ? 1UL : 0UL); 02715 } 02716 02717 /** 02718 * @brief Get the LPUART data register address used for DMA transfer 02719 * @rmtoll RDR RDR LL_LPUART_DMA_GetRegAddr\n 02720 * @rmtoll TDR TDR LL_LPUART_DMA_GetRegAddr 02721 * @param LPUARTx LPUART Instance 02722 * @param Direction This parameter can be one of the following values: 02723 * @arg @ref LL_LPUART_DMA_REG_DATA_TRANSMIT 02724 * @arg @ref LL_LPUART_DMA_REG_DATA_RECEIVE 02725 * @retval Address of data register 02726 */ 02727 __STATIC_INLINE uint32_t LL_LPUART_DMA_GetRegAddr(USART_TypeDef *LPUARTx, uint32_t Direction) 02728 { 02729 uint32_t data_reg_addr; 02730 02731 if (Direction == LL_LPUART_DMA_REG_DATA_TRANSMIT) 02732 { 02733 /* return address of TDR register */ 02734 data_reg_addr = (uint32_t) &(LPUARTx->TDR); 02735 } 02736 else 02737 { 02738 /* return address of RDR register */ 02739 data_reg_addr = (uint32_t) &(LPUARTx->RDR); 02740 } 02741 02742 return data_reg_addr; 02743 } 02744 02745 /** 02746 * @} 02747 */ 02748 02749 /** @defgroup LPUART_LL_EF_Data_Management Data_Management 02750 * @{ 02751 */ 02752 02753 /** 02754 * @brief Read Receiver Data register (Receive Data value, 8 bits) 02755 * @rmtoll RDR RDR LL_LPUART_ReceiveData8 02756 * @param LPUARTx LPUART Instance 02757 * @retval Time Value between Min_Data=0x00 and Max_Data=0xFF 02758 */ 02759 __STATIC_INLINE uint8_t LL_LPUART_ReceiveData8(USART_TypeDef *LPUARTx) 02760 { 02761 return (uint8_t)(READ_BIT(LPUARTx->RDR, USART_RDR_RDR) & 0xFFU); 02762 } 02763 02764 /** 02765 * @brief Read Receiver Data register (Receive Data value, 9 bits) 02766 * @rmtoll RDR RDR LL_LPUART_ReceiveData9 02767 * @param LPUARTx LPUART Instance 02768 * @retval Time Value between Min_Data=0x00 and Max_Data=0x1FF 02769 */ 02770 __STATIC_INLINE uint16_t LL_LPUART_ReceiveData9(USART_TypeDef *LPUARTx) 02771 { 02772 return (uint16_t)(READ_BIT(LPUARTx->RDR, USART_RDR_RDR)); 02773 } 02774 02775 /** 02776 * @brief Write in Transmitter Data Register (Transmit Data value, 8 bits) 02777 * @rmtoll TDR TDR LL_LPUART_TransmitData8 02778 * @param LPUARTx LPUART Instance 02779 * @param Value between Min_Data=0x00 and Max_Data=0xFF 02780 * @retval None 02781 */ 02782 __STATIC_INLINE void LL_LPUART_TransmitData8(USART_TypeDef *LPUARTx, uint8_t Value) 02783 { 02784 LPUARTx->TDR = Value; 02785 } 02786 02787 /** 02788 * @brief Write in Transmitter Data Register (Transmit Data value, 9 bits) 02789 * @rmtoll TDR TDR LL_LPUART_TransmitData9 02790 * @param LPUARTx LPUART Instance 02791 * @param Value between Min_Data=0x00 and Max_Data=0x1FF 02792 * @retval None 02793 */ 02794 __STATIC_INLINE void LL_LPUART_TransmitData9(USART_TypeDef *LPUARTx, uint16_t Value) 02795 { 02796 LPUARTx->TDR = Value & 0x1FFUL; 02797 } 02798 02799 /** 02800 * @} 02801 */ 02802 02803 /** @defgroup LPUART_LL_EF_Execution Execution 02804 * @{ 02805 */ 02806 02807 /** 02808 * @brief Request Break sending 02809 * @rmtoll RQR SBKRQ LL_LPUART_RequestBreakSending 02810 * @param LPUARTx LPUART Instance 02811 * @retval None 02812 */ 02813 __STATIC_INLINE void LL_LPUART_RequestBreakSending(USART_TypeDef *LPUARTx) 02814 { 02815 SET_BIT(LPUARTx->RQR, (uint16_t)USART_RQR_SBKRQ); 02816 } 02817 02818 /** 02819 * @brief Put LPUART in mute mode and set the RWU flag 02820 * @rmtoll RQR MMRQ LL_LPUART_RequestEnterMuteMode 02821 * @param LPUARTx LPUART Instance 02822 * @retval None 02823 */ 02824 __STATIC_INLINE void LL_LPUART_RequestEnterMuteMode(USART_TypeDef *LPUARTx) 02825 { 02826 SET_BIT(LPUARTx->RQR, (uint16_t)USART_RQR_MMRQ); 02827 } 02828 02829 /** 02830 @if USART_CR1_FIFOEN 02831 * @brief Request a Receive Data and FIFO flush 02832 * @note Allows to discard the received data without reading them, and avoid an overrun 02833 * condition. 02834 @else 02835 * @brief Request a Receive Data flush 02836 @endif 02837 * @rmtoll RQR RXFRQ LL_LPUART_RequestRxDataFlush 02838 * @param LPUARTx LPUART Instance 02839 * @retval None 02840 */ 02841 __STATIC_INLINE void LL_LPUART_RequestRxDataFlush(USART_TypeDef *LPUARTx) 02842 { 02843 SET_BIT(LPUARTx->RQR, (uint16_t)USART_RQR_RXFRQ); 02844 } 02845 02846 /** 02847 * @} 02848 */ 02849 02850 #if defined(USE_FULL_LL_DRIVER) 02851 /** @defgroup LPUART_LL_EF_Init Initialization and de-initialization functions 02852 * @{ 02853 */ 02854 ErrorStatus LL_LPUART_DeInit(USART_TypeDef *LPUARTx); 02855 ErrorStatus LL_LPUART_Init(USART_TypeDef *LPUARTx, LL_LPUART_InitTypeDef *LPUART_InitStruct); 02856 void LL_LPUART_StructInit(LL_LPUART_InitTypeDef *LPUART_InitStruct); 02857 /** 02858 * @} 02859 */ 02860 #endif /* USE_FULL_LL_DRIVER */ 02861 02862 /** 02863 * @} 02864 */ 02865 02866 /** 02867 * @} 02868 */ 02869 02870 #endif /* LPUART1 */ 02871 02872 /** 02873 * @} 02874 */ 02875 02876 #ifdef __cplusplus 02877 } 02878 #endif 02879 02880 #endif /* STM32L4xx_LL_LPUART_H */ 02881