STM32L4xx_HAL_Driver  1.14.0

Functions

__STATIC_INLINE void LL_USART_Enable (USART_TypeDef *USARTx)
 USART Enable CR1 UE LL_USART_Enable. More...
 
__STATIC_INLINE void LL_USART_Disable (USART_TypeDef *USARTx)
 USART Disable (all USART prescalers and outputs are disabled) More...
 
__STATIC_INLINE uint32_t LL_USART_IsEnabled (USART_TypeDef *USARTx)
 Indicate if USART is enabled CR1 UE LL_USART_IsEnabled. More...
 
__STATIC_INLINE void LL_USART_EnableFIFO (USART_TypeDef *USARTx)
 FIFO Mode Enable. More...
 
__STATIC_INLINE void LL_USART_DisableFIFO (USART_TypeDef *USARTx)
 FIFO Mode Disable. More...
 
__STATIC_INLINE uint32_t LL_USART_IsEnabledFIFO (USART_TypeDef *USARTx)
 Indicate if FIFO Mode is enabled. More...
 
__STATIC_INLINE void LL_USART_SetTXFIFOThreshold (USART_TypeDef *USARTx, uint32_t Threshold)
 Configure TX FIFO Threshold. More...
 
__STATIC_INLINE uint32_t LL_USART_GetTXFIFOThreshold (USART_TypeDef *USARTx)
 Return TX FIFO Threshold Configuration. More...
 
__STATIC_INLINE void LL_USART_SetRXFIFOThreshold (USART_TypeDef *USARTx, uint32_t Threshold)
 Configure RX FIFO Threshold. More...
 
__STATIC_INLINE uint32_t LL_USART_GetRXFIFOThreshold (USART_TypeDef *USARTx)
 Return RX FIFO Threshold Configuration. More...
 
__STATIC_INLINE void LL_USART_ConfigFIFOsThreshold (USART_TypeDef *USARTx, uint32_t TXThreshold, uint32_t RXThreshold)
 Configure TX and RX FIFOs Threshold. More...
 
__STATIC_INLINE void LL_USART_EnableInStopMode (USART_TypeDef *USARTx)
 USART enabled in STOP Mode. More...
 
__STATIC_INLINE void LL_USART_DisableInStopMode (USART_TypeDef *USARTx)
 USART disabled in STOP Mode. More...
 
__STATIC_INLINE uint32_t LL_USART_IsEnabledInStopMode (USART_TypeDef *USARTx)
 Indicate if USART is enabled in STOP Mode (able to wake up MCU from Stop mode or not) More...
 
__STATIC_INLINE void LL_USART_EnableClockInStopMode (USART_TypeDef *USARTx)
 USART Clock enabled in STOP Mode. More...
 
__STATIC_INLINE void LL_USART_DisableClockInStopMode (USART_TypeDef *USARTx)
 USART clock disabled in STOP Mode. More...
 
__STATIC_INLINE uint32_t LL_USART_IsClockEnabledInStopMode (USART_TypeDef *USARTx)
 Indicate if USART clock is enabled in STOP Mode CR3 UCESM LL_USART_IsClockEnabledInStopMode. More...
 
__STATIC_INLINE void LL_USART_EnableDirectionRx (USART_TypeDef *USARTx)
 Receiver Enable (Receiver is enabled and begins searching for a start bit) CR1 RE LL_USART_EnableDirectionRx. More...
 
__STATIC_INLINE void LL_USART_DisableDirectionRx (USART_TypeDef *USARTx)
 Receiver Disable CR1 RE LL_USART_DisableDirectionRx. More...
 
__STATIC_INLINE void LL_USART_EnableDirectionTx (USART_TypeDef *USARTx)
 Transmitter Enable CR1 TE LL_USART_EnableDirectionTx. More...
 
__STATIC_INLINE void LL_USART_DisableDirectionTx (USART_TypeDef *USARTx)
 Transmitter Disable CR1 TE LL_USART_DisableDirectionTx. More...
 
__STATIC_INLINE void LL_USART_SetTransferDirection (USART_TypeDef *USARTx, uint32_t TransferDirection)
 Configure simultaneously enabled/disabled states of Transmitter and Receiver CR1 RE LL_USART_SetTransferDirection
CR1 TE LL_USART_SetTransferDirection. More...
 
__STATIC_INLINE uint32_t LL_USART_GetTransferDirection (USART_TypeDef *USARTx)
 Return enabled/disabled states of Transmitter and Receiver CR1 RE LL_USART_GetTransferDirection
CR1 TE LL_USART_GetTransferDirection. More...
 
__STATIC_INLINE void LL_USART_SetParity (USART_TypeDef *USARTx, uint32_t Parity)
 Configure Parity (enabled/disabled and parity mode if enabled). More...
 
__STATIC_INLINE uint32_t LL_USART_GetParity (USART_TypeDef *USARTx)
 Return Parity configuration (enabled/disabled and parity mode if enabled) CR1 PS LL_USART_GetParity
CR1 PCE LL_USART_GetParity. More...
 
__STATIC_INLINE void LL_USART_SetWakeUpMethod (USART_TypeDef *USARTx, uint32_t Method)
 Set Receiver Wake Up method from Mute mode. CR1 WAKE LL_USART_SetWakeUpMethod. More...
 
__STATIC_INLINE uint32_t LL_USART_GetWakeUpMethod (USART_TypeDef *USARTx)
 Return Receiver Wake Up method from Mute mode CR1 WAKE LL_USART_GetWakeUpMethod. More...
 
__STATIC_INLINE void LL_USART_SetDataWidth (USART_TypeDef *USARTx, uint32_t DataWidth)
 Set Word length (i.e. nb of data bits, excluding start and stop bits) CR1 M0 LL_USART_SetDataWidth
CR1 M1 LL_USART_SetDataWidth. More...
 
__STATIC_INLINE uint32_t LL_USART_GetDataWidth (USART_TypeDef *USARTx)
 Return Word length (i.e. nb of data bits, excluding start and stop bits) CR1 M0 LL_USART_GetDataWidth
CR1 M1 LL_USART_GetDataWidth. More...
 
__STATIC_INLINE void LL_USART_EnableMuteMode (USART_TypeDef *USARTx)
 Allow switch between Mute Mode and Active mode CR1 MME LL_USART_EnableMuteMode. More...
 
__STATIC_INLINE void LL_USART_DisableMuteMode (USART_TypeDef *USARTx)
 Prevent Mute Mode use. Set Receiver in active mode permanently. CR1 MME LL_USART_DisableMuteMode. More...
 
__STATIC_INLINE uint32_t LL_USART_IsEnabledMuteMode (USART_TypeDef *USARTx)
 Indicate if switch between Mute Mode and Active mode is allowed CR1 MME LL_USART_IsEnabledMuteMode. More...
 
__STATIC_INLINE void LL_USART_SetOverSampling (USART_TypeDef *USARTx, uint32_t OverSampling)
 Set Oversampling to 8-bit or 16-bit mode CR1 OVER8 LL_USART_SetOverSampling. More...
 
__STATIC_INLINE uint32_t LL_USART_GetOverSampling (USART_TypeDef *USARTx)
 Return Oversampling mode CR1 OVER8 LL_USART_GetOverSampling. More...
 
__STATIC_INLINE void LL_USART_SetLastClkPulseOutput (USART_TypeDef *USARTx, uint32_t LastBitClockPulse)
 Configure if Clock pulse of the last data bit is output to the SCLK pin or not. More...
 
__STATIC_INLINE uint32_t LL_USART_GetLastClkPulseOutput (USART_TypeDef *USARTx)
 Retrieve Clock pulse of the last data bit output configuration (Last bit Clock pulse output to the SCLK pin or not) More...
 
__STATIC_INLINE void LL_USART_SetClockPhase (USART_TypeDef *USARTx, uint32_t ClockPhase)
 Select the phase of the clock output on the SCLK pin in synchronous mode. More...
 
__STATIC_INLINE uint32_t LL_USART_GetClockPhase (USART_TypeDef *USARTx)
 Return phase of the clock output on the SCLK pin in synchronous mode. More...
 
__STATIC_INLINE void LL_USART_SetClockPolarity (USART_TypeDef *USARTx, uint32_t ClockPolarity)
 Select the polarity of the clock output on the SCLK pin in synchronous mode. More...
 
__STATIC_INLINE uint32_t LL_USART_GetClockPolarity (USART_TypeDef *USARTx)
 Return polarity of the clock output on the SCLK pin in synchronous mode. More...
 
__STATIC_INLINE void LL_USART_ConfigClock (USART_TypeDef *USARTx, uint32_t Phase, uint32_t Polarity, uint32_t LBCPOutput)
 Configure Clock signal format (Phase Polarity and choice about output of last bit clock pulse) More...
 
__STATIC_INLINE void LL_USART_SetPrescaler (USART_TypeDef *USARTx, uint32_t PrescalerValue)
 Configure Clock source prescaler for baudrate generator and oversampling. More...
 
__STATIC_INLINE uint32_t LL_USART_GetPrescaler (USART_TypeDef *USARTx)
 Retrieve the Clock source prescaler for baudrate generator and oversampling. More...
 
__STATIC_INLINE void LL_USART_EnableSCLKOutput (USART_TypeDef *USARTx)
 Enable Clock output on SCLK pin. More...
 
__STATIC_INLINE void LL_USART_DisableSCLKOutput (USART_TypeDef *USARTx)
 Disable Clock output on SCLK pin. More...
 
__STATIC_INLINE uint32_t LL_USART_IsEnabledSCLKOutput (USART_TypeDef *USARTx)
 Indicate if Clock output on SCLK pin is enabled. More...
 
__STATIC_INLINE void LL_USART_SetStopBitsLength (USART_TypeDef *USARTx, uint32_t StopBits)
 Set the length of the stop bits CR2 STOP LL_USART_SetStopBitsLength. More...
 
__STATIC_INLINE uint32_t LL_USART_GetStopBitsLength (USART_TypeDef *USARTx)
 Retrieve the length of the stop bits CR2 STOP LL_USART_GetStopBitsLength. More...
 
__STATIC_INLINE void LL_USART_ConfigCharacter (USART_TypeDef *USARTx, uint32_t DataWidth, uint32_t Parity, uint32_t StopBits)
 Configure Character frame format (Datawidth, Parity control, Stop Bits) More...
 
__STATIC_INLINE void LL_USART_SetTXRXSwap (USART_TypeDef *USARTx, uint32_t SwapConfig)
 Configure TX/RX pins swapping setting. CR2 SWAP LL_USART_SetTXRXSwap. More...
 
__STATIC_INLINE uint32_t LL_USART_GetTXRXSwap (USART_TypeDef *USARTx)
 Retrieve TX/RX pins swapping configuration. CR2 SWAP LL_USART_GetTXRXSwap. More...
 
__STATIC_INLINE void LL_USART_SetRXPinLevel (USART_TypeDef *USARTx, uint32_t PinInvMethod)
 Configure RX pin active level logic CR2 RXINV LL_USART_SetRXPinLevel. More...
 
__STATIC_INLINE uint32_t LL_USART_GetRXPinLevel (USART_TypeDef *USARTx)
 Retrieve RX pin active level logic configuration CR2 RXINV LL_USART_GetRXPinLevel. More...
 
__STATIC_INLINE void LL_USART_SetTXPinLevel (USART_TypeDef *USARTx, uint32_t PinInvMethod)
 Configure TX pin active level logic CR2 TXINV LL_USART_SetTXPinLevel. More...
 
__STATIC_INLINE uint32_t LL_USART_GetTXPinLevel (USART_TypeDef *USARTx)
 Retrieve TX pin active level logic configuration CR2 TXINV LL_USART_GetTXPinLevel. More...
 
__STATIC_INLINE void LL_USART_SetBinaryDataLogic (USART_TypeDef *USARTx, uint32_t DataLogic)
 Configure Binary data logic. More...
 
__STATIC_INLINE uint32_t LL_USART_GetBinaryDataLogic (USART_TypeDef *USARTx)
 Retrieve Binary data configuration CR2 DATAINV LL_USART_GetBinaryDataLogic. More...
 
__STATIC_INLINE void LL_USART_SetTransferBitOrder (USART_TypeDef *USARTx, uint32_t BitOrder)
 Configure transfer bit order (either Less or Most Significant Bit First) More...
 
__STATIC_INLINE uint32_t LL_USART_GetTransferBitOrder (USART_TypeDef *USARTx)
 Return transfer bit order (either Less or Most Significant Bit First) More...
 
__STATIC_INLINE void LL_USART_EnableAutoBaudRate (USART_TypeDef *USARTx)
 Enable Auto Baud-Rate Detection. More...
 
__STATIC_INLINE void LL_USART_DisableAutoBaudRate (USART_TypeDef *USARTx)
 Disable Auto Baud-Rate Detection. More...
 
__STATIC_INLINE uint32_t LL_USART_IsEnabledAutoBaud (USART_TypeDef *USARTx)
 Indicate if Auto Baud-Rate Detection mechanism is enabled. More...
 
__STATIC_INLINE void LL_USART_SetAutoBaudRateMode (USART_TypeDef *USARTx, uint32_t AutoBaudRateMode)
 Set Auto Baud-Rate mode bits. More...
 
__STATIC_INLINE uint32_t LL_USART_GetAutoBaudRateMode (USART_TypeDef *USARTx)
 Return Auto Baud-Rate mode. More...
 
__STATIC_INLINE void LL_USART_EnableRxTimeout (USART_TypeDef *USARTx)
 Enable Receiver Timeout CR2 RTOEN LL_USART_EnableRxTimeout. More...
 
__STATIC_INLINE void LL_USART_DisableRxTimeout (USART_TypeDef *USARTx)
 Disable Receiver Timeout CR2 RTOEN LL_USART_DisableRxTimeout. More...
 
__STATIC_INLINE uint32_t LL_USART_IsEnabledRxTimeout (USART_TypeDef *USARTx)
 Indicate if Receiver Timeout feature is enabled CR2 RTOEN LL_USART_IsEnabledRxTimeout. More...
 
__STATIC_INLINE void LL_USART_ConfigNodeAddress (USART_TypeDef *USARTx, uint32_t AddressLen, uint32_t NodeAddress)
 Set Address of the USART node. More...
 
__STATIC_INLINE uint32_t LL_USART_GetNodeAddress (USART_TypeDef *USARTx)
 Return 8 bit Address of the USART node as set in ADD field of CR2. More...
 
__STATIC_INLINE uint32_t LL_USART_GetNodeAddressLen (USART_TypeDef *USARTx)
 Return Length of Node Address used in Address Detection mode (7-bit or 4-bit) CR2 ADDM7 LL_USART_GetNodeAddressLen. More...
 
__STATIC_INLINE void LL_USART_EnableRTSHWFlowCtrl (USART_TypeDef *USARTx)
 Enable RTS HW Flow Control. More...
 
__STATIC_INLINE void LL_USART_DisableRTSHWFlowCtrl (USART_TypeDef *USARTx)
 Disable RTS HW Flow Control. More...
 
__STATIC_INLINE void LL_USART_EnableCTSHWFlowCtrl (USART_TypeDef *USARTx)
 Enable CTS HW Flow Control. More...
 
__STATIC_INLINE void LL_USART_DisableCTSHWFlowCtrl (USART_TypeDef *USARTx)
 Disable CTS HW Flow Control. More...
 
__STATIC_INLINE void LL_USART_SetHWFlowCtrl (USART_TypeDef *USARTx, uint32_t HardwareFlowControl)
 Configure HW Flow Control mode (both CTS and RTS) More...
 
__STATIC_INLINE uint32_t LL_USART_GetHWFlowCtrl (USART_TypeDef *USARTx)
 Return HW Flow Control configuration (both CTS and RTS) More...
 
__STATIC_INLINE void LL_USART_EnableOneBitSamp (USART_TypeDef *USARTx)
 Enable One bit sampling method CR3 ONEBIT LL_USART_EnableOneBitSamp. More...
 
__STATIC_INLINE void LL_USART_DisableOneBitSamp (USART_TypeDef *USARTx)
 Disable One bit sampling method CR3 ONEBIT LL_USART_DisableOneBitSamp. More...
 
__STATIC_INLINE uint32_t LL_USART_IsEnabledOneBitSamp (USART_TypeDef *USARTx)
 Indicate if One bit sampling method is enabled CR3 ONEBIT LL_USART_IsEnabledOneBitSamp. More...
 
__STATIC_INLINE void LL_USART_EnableOverrunDetect (USART_TypeDef *USARTx)
 Enable Overrun detection CR3 OVRDIS LL_USART_EnableOverrunDetect. More...
 
__STATIC_INLINE void LL_USART_DisableOverrunDetect (USART_TypeDef *USARTx)
 Disable Overrun detection CR3 OVRDIS LL_USART_DisableOverrunDetect. More...
 
__STATIC_INLINE uint32_t LL_USART_IsEnabledOverrunDetect (USART_TypeDef *USARTx)
 Indicate if Overrun detection is enabled CR3 OVRDIS LL_USART_IsEnabledOverrunDetect. More...
 
__STATIC_INLINE void LL_USART_SetWKUPType (USART_TypeDef *USARTx, uint32_t Type)
 Select event type for Wake UP Interrupt Flag (WUS[1:0] bits) More...
 
__STATIC_INLINE uint32_t LL_USART_GetWKUPType (USART_TypeDef *USARTx)
 Return event type for Wake UP Interrupt Flag (WUS[1:0] bits) More...
 
__STATIC_INLINE void LL_USART_SetBaudRate (USART_TypeDef *USARTx, uint32_t PeriphClk, uint32_t PrescalerValue, uint32_t OverSampling, uint32_t BaudRate) __STATIC_INLINE void LL_USART_SetBaudRate(USART_TypeDef *USARTx
 Configure USART BRR register for achieving expected Baud Rate value. More...
 
 if (PrescalerValue > LL_USART_PRESCALER_DIV256)
 
else if (OverSampling==LL_USART_OVERSAMPLING_8) if(OverSampling
 
ErrorStatus LL_USART_Init (USART_TypeDef *USARTx, LL_USART_InitTypeDef *USART_InitStruct)
 Initialize USART registers according to the specified parameters in USART_InitStruct. More...
 
void LL_USART_StructInit (LL_USART_InitTypeDef *USART_InitStruct)
 Set each LL_USART_InitTypeDef field to default value. More...
 
ErrorStatus LL_USART_ClockInit (USART_TypeDef *USARTx, LL_USART_ClockInitTypeDef *USART_ClockInitStruct)
 Initialize USART Clock related settings according to the specified parameters in the USART_ClockInitStruct. More...
 
void LL_USART_ClockStructInit (LL_USART_ClockInitTypeDef *USART_ClockInitStruct)
 Set each field of a LL_USART_ClockInitTypeDef type structure to default value. More...
 

Variables

__STATIC_INLINE void uint32_t PeriphClk
 
__STATIC_INLINE void uint32_t uint32_t OverSampling
 
__STATIC_INLINE void uint32_t uint32_t uint32_t BaudRate
 
register uint32_t brrtemp
 

Detailed Description

Function Documentation

◆ if() [1/2]

if ( PrescalerValue  ,
LL_USART_PRESCALER_DIV256   
)

Definition at line 1984 of file stm32l4xx_ll_usart.h.

1985  {
1986  /* Do not overstep the size of USART_PRESCALER_TAB */
1987  }

◆ if() [2/2]

else if ( OverSampling  = =LL_USART_OVERSAMPLING_8)

◆ LL_USART_ClockInit()

ErrorStatus LL_USART_ClockInit ( USART_TypeDef *  USARTx,
LL_USART_ClockInitTypeDef USART_ClockInitStruct 
)

Initialize USART Clock related settings according to the specified parameters in the USART_ClockInitStruct.

Note
As some bits in USART configuration registers can only be written when the USART is disabled (USART_CR1_UE bit =0), USART Peripheral should be in disabled state prior calling this function. Otherwise, ERROR result will be returned.
Parameters
USARTxUSART Instance
USART_ClockInitStructpointer to a LL_USART_ClockInitTypeDef structure that contains the Clock configuration information for the specified USART peripheral.
Return values
AnErrorStatus enumeration value:
  • SUCCESS: USART registers related to Clock settings are initialized according to USART_ClockInitStruct content
  • ERROR: Problem occurred during USART Registers initialization

Definition at line 375 of file stm32l4xx_ll_usart.c.

376 {
377  ErrorStatus status = SUCCESS;
378 
379  /* Check USART Instance and Clock signal output parameters */
380  assert_param(IS_UART_INSTANCE(USARTx));
381  assert_param(IS_LL_USART_CLOCKOUTPUT(USART_ClockInitStruct->ClockOutput));
382 
383  /* USART needs to be in disabled state, in order to be able to configure some bits in
384  CRx registers */
385  if (LL_USART_IsEnabled(USARTx) == 0U)
386  {
387  /*---------------------------- USART CR2 Configuration -----------------------*/
388  /* If Clock signal has to be output */
389  if (USART_ClockInitStruct->ClockOutput == LL_USART_CLOCK_DISABLE)
390  {
391  /* Deactivate Clock signal delivery :
392  * - Disable Clock Output: USART_CR2_CLKEN cleared
393  */
395  }
396  else
397  {
398  /* Ensure USART instance is USART capable */
399  assert_param(IS_USART_INSTANCE(USARTx));
400 
401  /* Check clock related parameters */
402  assert_param(IS_LL_USART_CLOCKPOLARITY(USART_ClockInitStruct->ClockPolarity));
403  assert_param(IS_LL_USART_CLOCKPHASE(USART_ClockInitStruct->ClockPhase));
404  assert_param(IS_LL_USART_LASTBITCLKOUTPUT(USART_ClockInitStruct->LastBitClockPulse));
405 
406  /*---------------------------- USART CR2 Configuration -----------------------
407  * Configure USARTx CR2 (Clock signal related bits) with parameters:
408  * - Enable Clock Output: USART_CR2_CLKEN set
409  * - Clock Polarity: USART_CR2_CPOL bit according to USART_ClockInitStruct->ClockPolarity value
410  * - Clock Phase: USART_CR2_CPHA bit according to USART_ClockInitStruct->ClockPhase value
411  * - Last Bit Clock Pulse Output: USART_CR2_LBCL bit according to USART_ClockInitStruct->LastBitClockPulse value.
412  */
413  MODIFY_REG(USARTx->CR2,
414  USART_CR2_CLKEN | USART_CR2_CPHA | USART_CR2_CPOL | USART_CR2_LBCL,
415  USART_CR2_CLKEN | USART_ClockInitStruct->ClockPolarity |
416  USART_ClockInitStruct->ClockPhase | USART_ClockInitStruct->LastBitClockPulse);
417  }
418  }
419  /* Else (USART not in Disabled state => return ERROR */
420  else
421  {
422  status = ERROR;
423  }
424 
425  return (status);
426 }
__STATIC_INLINE void LL_USART_DisableSCLKOutput(USART_TypeDef *USARTx)
Disable Clock output on SCLK pin.
__STATIC_INLINE uint32_t LL_USART_IsEnabled(USART_TypeDef *USARTx)
Indicate if USART is enabled CR1 UE LL_USART_IsEnabled.
MODIFY_REG(hrtc->Instance->CR, RTC_CR_WUCKSEL,(uint32_t) WakeUpClock)
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))

◆ LL_USART_ClockStructInit()

void LL_USART_ClockStructInit ( LL_USART_ClockInitTypeDef USART_ClockInitStruct)

Set each field of a LL_USART_ClockInitTypeDef type structure to default value.

Parameters
USART_ClockInitStructpointer to a LL_USART_ClockInitTypeDef structure whose fields will be set to default values.
Return values
None

Definition at line 434 of file stm32l4xx_ll_usart.c.

435 {
436  /* Set LL_USART_ClockInitStruct fields with default values */
437  USART_ClockInitStruct->ClockOutput = LL_USART_CLOCK_DISABLE;
438  USART_ClockInitStruct->ClockPolarity = LL_USART_POLARITY_LOW; /* Not relevant when ClockOutput = LL_USART_CLOCK_DISABLE */
439  USART_ClockInitStruct->ClockPhase = LL_USART_PHASE_1EDGE; /* Not relevant when ClockOutput = LL_USART_CLOCK_DISABLE */
440  USART_ClockInitStruct->LastBitClockPulse = LL_USART_LASTCLKPULSE_NO_OUTPUT; /* Not relevant when ClockOutput = LL_USART_CLOCK_DISABLE */
441 }

◆ LL_USART_ConfigCharacter()

__STATIC_INLINE void LL_USART_ConfigCharacter ( USART_TypeDef *  USARTx,
uint32_t  DataWidth,
uint32_t  Parity,
uint32_t  StopBits 
)

Configure Character frame format (Datawidth, Parity control, Stop Bits)

Note
Call of this function is equivalent to following function call sequence :
  • Data Width configuration using LL_USART_SetDataWidth() function
  • Parity Control and mode configuration using LL_USART_SetParity() function
  • Stop bits configuration using LL_USART_SetStopBitsLength() function CR1 PS LL_USART_ConfigCharacter
    CR1 PCE LL_USART_ConfigCharacter
    CR1 M0 LL_USART_ConfigCharacter
    CR1 M1 LL_USART_ConfigCharacter
    CR2 STOP LL_USART_ConfigCharacter
Parameters
USARTxUSART Instance
DataWidthThis parameter can be one of the following values:
  • LL_USART_DATAWIDTH_7B
  • LL_USART_DATAWIDTH_8B
  • LL_USART_DATAWIDTH_9B
ParityThis parameter can be one of the following values:
  • LL_USART_PARITY_NONE
  • LL_USART_PARITY_EVEN
  • LL_USART_PARITY_ODD
StopBitsThis parameter can be one of the following values:
  • LL_USART_STOPBITS_0_5
  • LL_USART_STOPBITS_1
  • LL_USART_STOPBITS_1_5
  • LL_USART_STOPBITS_2
Return values
None

Definition at line 1440 of file stm32l4xx_ll_usart.h.

1442 {
1443  MODIFY_REG(USARTx->CR1, USART_CR1_PS | USART_CR1_PCE | USART_CR1_M, Parity | DataWidth);
1444  MODIFY_REG(USARTx->CR2, USART_CR2_STOP, StopBits);
1445 }
MODIFY_REG(hrtc->Instance->CR, RTC_CR_WUCKSEL,(uint32_t) WakeUpClock)

◆ LL_USART_ConfigClock()

__STATIC_INLINE void LL_USART_ConfigClock ( USART_TypeDef *  USARTx,
uint32_t  Phase,
uint32_t  Polarity,
uint32_t  LBCPOutput 
)

Configure Clock signal format (Phase Polarity and choice about output of last bit clock pulse)

Note
Macro IS_USART_INSTANCE(USARTx) can be used to check whether or not Synchronous mode is supported by the USARTx instance.
Call of this function is equivalent to following function call sequence :
Parameters
USARTxUSART Instance
PhaseThis parameter can be one of the following values:
  • LL_USART_PHASE_1EDGE
  • LL_USART_PHASE_2EDGE
PolarityThis parameter can be one of the following values:
  • LL_USART_POLARITY_LOW
  • LL_USART_POLARITY_HIGH
LBCPOutputThis parameter can be one of the following values:
  • LL_USART_LASTCLKPULSE_NO_OUTPUT
  • LL_USART_LASTCLKPULSE_OUTPUT
Return values
None

Definition at line 1285 of file stm32l4xx_ll_usart.h.

1286 {
1287  MODIFY_REG(USARTx->CR2, USART_CR2_CPHA | USART_CR2_CPOL | USART_CR2_LBCL, Phase | Polarity | LBCPOutput);
1288 }
MODIFY_REG(hrtc->Instance->CR, RTC_CR_WUCKSEL,(uint32_t) WakeUpClock)

◆ LL_USART_ConfigFIFOsThreshold()

__STATIC_INLINE void LL_USART_ConfigFIFOsThreshold ( USART_TypeDef *  USARTx,
uint32_t  TXThreshold,
uint32_t  RXThreshold 
)

Configure TX and RX FIFOs Threshold.

Note
Macro IS_UART_FIFO_INSTANCE(USARTx) can be used to check whether or not FIFO mode feature is supported by the USARTx instance. CR3 TXFTCFG LL_USART_ConfigFIFOsThreshold
CR3 RXFTCFG LL_USART_ConfigFIFOsThreshold
Parameters
USARTxUSART Instance
TXThresholdThis parameter can be one of the following values:
  • LL_USART_FIFOTHRESHOLD_1_8
  • LL_USART_FIFOTHRESHOLD_1_4
  • LL_USART_FIFOTHRESHOLD_1_2
  • LL_USART_FIFOTHRESHOLD_3_4
  • LL_USART_FIFOTHRESHOLD_7_8
  • LL_USART_FIFOTHRESHOLD_8_8
RXThresholdThis parameter can be one of the following values:
  • LL_USART_FIFOTHRESHOLD_1_8
  • LL_USART_FIFOTHRESHOLD_1_4
  • LL_USART_FIFOTHRESHOLD_1_2
  • LL_USART_FIFOTHRESHOLD_3_4
  • LL_USART_FIFOTHRESHOLD_7_8
  • LL_USART_FIFOTHRESHOLD_8_8
Return values
None

Definition at line 853 of file stm32l4xx_ll_usart.h.

854 {
855  MODIFY_REG(USARTx->CR3, USART_CR3_TXFTCFG | USART_CR3_RXFTCFG, (TXThreshold << USART_CR3_TXFTCFG_Pos) | (RXThreshold << USART_CR3_RXFTCFG_Pos));
856 }
MODIFY_REG(hrtc->Instance->CR, RTC_CR_WUCKSEL,(uint32_t) WakeUpClock)

◆ LL_USART_ConfigNodeAddress()

__STATIC_INLINE void LL_USART_ConfigNodeAddress ( USART_TypeDef *  USARTx,
uint32_t  AddressLen,
uint32_t  NodeAddress 
)

Set Address of the USART node.

Note
This is used in multiprocessor communication during Mute mode or Stop mode, for wake up with address mark detection.
4bits address node is used when 4-bit Address Detection is selected in ADDM7. (b7-b4 should be set to 0) 8bits address node is used when 7-bit Address Detection is selected in ADDM7. (This is used in multiprocessor communication during Mute mode or Stop mode, for wake up with 7-bit address mark detection. The MSB of the character sent by the transmitter should be equal to 1. It may also be used for character detection during normal reception, Mute mode inactive (for example, end of block detection in ModBus protocol). In this case, the whole received character (8-bit) is compared to the ADD[7:0] value and CMF flag is set on match) CR2 ADD LL_USART_ConfigNodeAddress
CR2 ADDM7 LL_USART_ConfigNodeAddress
Parameters
USARTxUSART Instance
AddressLenThis parameter can be one of the following values:
  • LL_USART_ADDRESS_DETECT_4B
  • LL_USART_ADDRESS_DETECT_7B
NodeAddress4 or 7 bit Address of the USART node.
Return values
None

Definition at line 1718 of file stm32l4xx_ll_usart.h.

1719 {
1720  MODIFY_REG(USARTx->CR2, USART_CR2_ADD | USART_CR2_ADDM7,
1721  (uint32_t)(AddressLen | (NodeAddress << USART_CR2_ADD_Pos)));
1722 }
MODIFY_REG(hrtc->Instance->CR, RTC_CR_WUCKSEL,(uint32_t) WakeUpClock)

◆ LL_USART_Disable()

__STATIC_INLINE void LL_USART_Disable ( USART_TypeDef *  USARTx)

USART Disable (all USART prescalers and outputs are disabled)

Note
When USART is disabled, USART prescalers and outputs are stopped immediately, and current operations are discarded. The configuration of the USART is kept, but all the status flags, in the USARTx_ISR are set to their default values. CR1 UE LL_USART_Disable
Parameters
USARTxUSART Instance
Return values
None

Definition at line 696 of file stm32l4xx_ll_usart.h.

697 {
698  CLEAR_BIT(USARTx->CR1, USART_CR1_UE);
699 }
CLEAR_BIT(hrtc->Instance->CR, RTC_CR_WUTE)

◆ LL_USART_DisableAutoBaudRate()

__STATIC_INLINE void LL_USART_DisableAutoBaudRate ( USART_TypeDef *  USARTx)

Disable Auto Baud-Rate Detection.

Note
Macro IS_USART_AUTOBAUDRATE_DETECTION_INSTANCE(USARTx) can be used to check whether or not Auto Baud Rate detection feature is supported by the USARTx instance. CR2 ABREN LL_USART_DisableAutoBaudRate
Parameters
USARTxUSART Instance
Return values
None

Definition at line 1609 of file stm32l4xx_ll_usart.h.

1610 {
1611  CLEAR_BIT(USARTx->CR2, USART_CR2_ABREN);
1612 }
CLEAR_BIT(hrtc->Instance->CR, RTC_CR_WUTE)

◆ LL_USART_DisableClockInStopMode()

__STATIC_INLINE void LL_USART_DisableClockInStopMode ( USART_TypeDef *  USARTx)

USART clock disabled in STOP Mode.

Note
When this function is called, USART Clock is disabled while in STOP mode CR3 UCESM LL_USART_DisableClockInStopMode
Parameters
USARTxUSART Instance
Return values
None

Definition at line 921 of file stm32l4xx_ll_usart.h.

922 {
923  CLEAR_BIT(USARTx->CR3, USART_CR3_UCESM);
924 }
CLEAR_BIT(hrtc->Instance->CR, RTC_CR_WUTE)

◆ LL_USART_DisableCTSHWFlowCtrl()

__STATIC_INLINE void LL_USART_DisableCTSHWFlowCtrl ( USART_TypeDef *  USARTx)

Disable CTS HW Flow Control.

Note
Macro IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not Hardware Flow control feature is supported by the USARTx instance. CR3 CTSE LL_USART_DisableCTSHWFlowCtrl
Parameters
USARTxUSART Instance
Return values
None

Definition at line 1799 of file stm32l4xx_ll_usart.h.

1800 {
1801  CLEAR_BIT(USARTx->CR3, USART_CR3_CTSE);
1802 }
CLEAR_BIT(hrtc->Instance->CR, RTC_CR_WUTE)

◆ LL_USART_DisableDirectionRx()

__STATIC_INLINE void LL_USART_DisableDirectionRx ( USART_TypeDef *  USARTx)

Receiver Disable CR1 RE LL_USART_DisableDirectionRx.

Parameters
USARTxUSART Instance
Return values
None

Definition at line 955 of file stm32l4xx_ll_usart.h.

956 {
957  CLEAR_BIT(USARTx->CR1, USART_CR1_RE);
958 }
CLEAR_BIT(hrtc->Instance->CR, RTC_CR_WUTE)

◆ LL_USART_DisableDirectionTx()

__STATIC_INLINE void LL_USART_DisableDirectionTx ( USART_TypeDef *  USARTx)

Transmitter Disable CR1 TE LL_USART_DisableDirectionTx.

Parameters
USARTxUSART Instance
Return values
None

Definition at line 977 of file stm32l4xx_ll_usart.h.

978 {
979  CLEAR_BIT(USARTx->CR1, USART_CR1_TE);
980 }
CLEAR_BIT(hrtc->Instance->CR, RTC_CR_WUTE)

◆ LL_USART_DisableFIFO()

__STATIC_INLINE void LL_USART_DisableFIFO ( USART_TypeDef *  USARTx)

FIFO Mode Disable.

Note
Macro IS_UART_FIFO_INSTANCE(USARTx) can be used to check whether or not FIFO mode feature is supported by the USARTx instance. CR1 FIFOEN LL_USART_DisableFIFO
Parameters
USARTxUSART Instance
Return values
None

Definition at line 734 of file stm32l4xx_ll_usart.h.

735 {
736  CLEAR_BIT(USARTx->CR1, USART_CR1_FIFOEN);
737 }
CLEAR_BIT(hrtc->Instance->CR, RTC_CR_WUTE)

◆ LL_USART_DisableInStopMode()

__STATIC_INLINE void LL_USART_DisableInStopMode ( USART_TypeDef *  USARTx)

USART disabled in STOP Mode.

Note
When this function is disabled, USART is not able to wake up the MCU from Stop mode
Macro IS_UART_WAKEUP_FROMSTOP_INSTANCE(USARTx) can be used to check whether or not Wake-up from Stop mode feature is supported by the USARTx instance. CR1 UESM LL_USART_DisableInStopMode
Parameters
USARTxUSART Instance
Return values
None

Definition at line 883 of file stm32l4xx_ll_usart.h.

884 {
885  CLEAR_BIT(USARTx->CR1, USART_CR1_UESM);
886 }
CLEAR_BIT(hrtc->Instance->CR, RTC_CR_WUTE)

◆ LL_USART_DisableMuteMode()

__STATIC_INLINE void LL_USART_DisableMuteMode ( USART_TypeDef *  USARTx)

Prevent Mute Mode use. Set Receiver in active mode permanently. CR1 MME LL_USART_DisableMuteMode.

Parameters
USARTxUSART Instance
Return values
None

Definition at line 1125 of file stm32l4xx_ll_usart.h.

1126 {
1127  CLEAR_BIT(USARTx->CR1, USART_CR1_MME);
1128 }
CLEAR_BIT(hrtc->Instance->CR, RTC_CR_WUTE)

◆ LL_USART_DisableOneBitSamp()

__STATIC_INLINE void LL_USART_DisableOneBitSamp ( USART_TypeDef *  USARTx)

Disable One bit sampling method CR3 ONEBIT LL_USART_DisableOneBitSamp.

Parameters
USARTxUSART Instance
Return values
None

Definition at line 1858 of file stm32l4xx_ll_usart.h.

1859 {
1860  CLEAR_BIT(USARTx->CR3, USART_CR3_ONEBIT);
1861 }
CLEAR_BIT(hrtc->Instance->CR, RTC_CR_WUTE)

◆ LL_USART_DisableOverrunDetect()

__STATIC_INLINE void LL_USART_DisableOverrunDetect ( USART_TypeDef *  USARTx)

Disable Overrun detection CR3 OVRDIS LL_USART_DisableOverrunDetect.

Parameters
USARTxUSART Instance
Return values
None

Definition at line 1891 of file stm32l4xx_ll_usart.h.

1892 {
1893  SET_BIT(USARTx->CR3, USART_CR3_OVRDIS);
1894 }

◆ LL_USART_DisableRTSHWFlowCtrl()

__STATIC_INLINE void LL_USART_DisableRTSHWFlowCtrl ( USART_TypeDef *  USARTx)

Disable RTS HW Flow Control.

Note
Macro IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not Hardware Flow control feature is supported by the USARTx instance. CR3 RTSE LL_USART_DisableRTSHWFlowCtrl
Parameters
USARTxUSART Instance
Return values
None

Definition at line 1773 of file stm32l4xx_ll_usart.h.

1774 {
1775  CLEAR_BIT(USARTx->CR3, USART_CR3_RTSE);
1776 }
CLEAR_BIT(hrtc->Instance->CR, RTC_CR_WUTE)

◆ LL_USART_DisableRxTimeout()

__STATIC_INLINE void LL_USART_DisableRxTimeout ( USART_TypeDef *  USARTx)

Disable Receiver Timeout CR2 RTOEN LL_USART_DisableRxTimeout.

Parameters
USARTxUSART Instance
Return values
None

Definition at line 1679 of file stm32l4xx_ll_usart.h.

1680 {
1681  CLEAR_BIT(USARTx->CR2, USART_CR2_RTOEN);
1682 }
CLEAR_BIT(hrtc->Instance->CR, RTC_CR_WUTE)

◆ LL_USART_DisableSCLKOutput()

__STATIC_INLINE void LL_USART_DisableSCLKOutput ( USART_TypeDef *  USARTx)

Disable Clock output on SCLK pin.

Note
Macro IS_USART_INSTANCE(USARTx) can be used to check whether or not Synchronous mode is supported by the USARTx instance. CR2 CLKEN LL_USART_DisableSCLKOutput
Parameters
USARTxUSART Instance
Return values
None

Definition at line 1364 of file stm32l4xx_ll_usart.h.

1365 {
1366  CLEAR_BIT(USARTx->CR2, USART_CR2_CLKEN);
1367 }
CLEAR_BIT(hrtc->Instance->CR, RTC_CR_WUTE)

◆ LL_USART_Enable()

__STATIC_INLINE void LL_USART_Enable ( USART_TypeDef *  USARTx)

USART Enable CR1 UE LL_USART_Enable.

Parameters
USARTxUSART Instance
Return values
None

Definition at line 682 of file stm32l4xx_ll_usart.h.

683 {
684  SET_BIT(USARTx->CR1, USART_CR1_UE);
685 }

◆ LL_USART_EnableAutoBaudRate()

__STATIC_INLINE void LL_USART_EnableAutoBaudRate ( USART_TypeDef *  USARTx)

Enable Auto Baud-Rate Detection.

Note
Macro IS_USART_AUTOBAUDRATE_DETECTION_INSTANCE(USARTx) can be used to check whether or not Auto Baud Rate detection feature is supported by the USARTx instance. CR2 ABREN LL_USART_EnableAutoBaudRate
Parameters
USARTxUSART Instance
Return values
None

Definition at line 1596 of file stm32l4xx_ll_usart.h.

1597 {
1598  SET_BIT(USARTx->CR2, USART_CR2_ABREN);
1599 }

◆ LL_USART_EnableClockInStopMode()

__STATIC_INLINE void LL_USART_EnableClockInStopMode ( USART_TypeDef *  USARTx)

USART Clock enabled in STOP Mode.

Note
When this function is called, USART Clock is enabled while in STOP mode CR3 UCESM LL_USART_EnableClockInStopMode
Parameters
USARTxUSART Instance
Return values
None

Definition at line 909 of file stm32l4xx_ll_usart.h.

910 {
911  SET_BIT(USARTx->CR3, USART_CR3_UCESM);
912 }

◆ LL_USART_EnableCTSHWFlowCtrl()

__STATIC_INLINE void LL_USART_EnableCTSHWFlowCtrl ( USART_TypeDef *  USARTx)

Enable CTS HW Flow Control.

Note
Macro IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not Hardware Flow control feature is supported by the USARTx instance. CR3 CTSE LL_USART_EnableCTSHWFlowCtrl
Parameters
USARTxUSART Instance
Return values
None

Definition at line 1786 of file stm32l4xx_ll_usart.h.

1787 {
1788  SET_BIT(USARTx->CR3, USART_CR3_CTSE);
1789 }

◆ LL_USART_EnableDirectionRx()

__STATIC_INLINE void LL_USART_EnableDirectionRx ( USART_TypeDef *  USARTx)

Receiver Enable (Receiver is enabled and begins searching for a start bit) CR1 RE LL_USART_EnableDirectionRx.

Parameters
USARTxUSART Instance
Return values
None

Definition at line 944 of file stm32l4xx_ll_usart.h.

945 {
946  SET_BIT(USARTx->CR1, USART_CR1_RE);
947 }

◆ LL_USART_EnableDirectionTx()

__STATIC_INLINE void LL_USART_EnableDirectionTx ( USART_TypeDef *  USARTx)

Transmitter Enable CR1 TE LL_USART_EnableDirectionTx.

Parameters
USARTxUSART Instance
Return values
None

Definition at line 966 of file stm32l4xx_ll_usart.h.

967 {
968  SET_BIT(USARTx->CR1, USART_CR1_TE);
969 }

◆ LL_USART_EnableFIFO()

__STATIC_INLINE void LL_USART_EnableFIFO ( USART_TypeDef *  USARTx)

FIFO Mode Enable.

Note
Macro IS_UART_FIFO_INSTANCE(USARTx) can be used to check whether or not FIFO mode feature is supported by the USARTx instance. CR1 FIFOEN LL_USART_EnableFIFO
Parameters
USARTxUSART Instance
Return values
None

Definition at line 721 of file stm32l4xx_ll_usart.h.

722 {
723  SET_BIT(USARTx->CR1, USART_CR1_FIFOEN);
724 }

◆ LL_USART_EnableInStopMode()

__STATIC_INLINE void LL_USART_EnableInStopMode ( USART_TypeDef *  USARTx)

USART enabled in STOP Mode.

Note
When this function is enabled, USART is able to wake up the MCU from Stop mode, provided that USART clock selection is HSI or LSE in RCC.
Macro IS_UART_WAKEUP_FROMSTOP_INSTANCE(USARTx) can be used to check whether or not Wake-up from Stop mode feature is supported by the USARTx instance. CR1 UESM LL_USART_EnableInStopMode
Parameters
USARTxUSART Instance
Return values
None

Definition at line 869 of file stm32l4xx_ll_usart.h.

870 {
871  SET_BIT(USARTx->CR1, USART_CR1_UESM);
872 }

◆ LL_USART_EnableMuteMode()

__STATIC_INLINE void LL_USART_EnableMuteMode ( USART_TypeDef *  USARTx)

Allow switch between Mute Mode and Active mode CR1 MME LL_USART_EnableMuteMode.

Parameters
USARTxUSART Instance
Return values
None

Definition at line 1114 of file stm32l4xx_ll_usart.h.

1115 {
1116  SET_BIT(USARTx->CR1, USART_CR1_MME);
1117 }

◆ LL_USART_EnableOneBitSamp()

__STATIC_INLINE void LL_USART_EnableOneBitSamp ( USART_TypeDef *  USARTx)

Enable One bit sampling method CR3 ONEBIT LL_USART_EnableOneBitSamp.

Parameters
USARTxUSART Instance
Return values
None

Definition at line 1847 of file stm32l4xx_ll_usart.h.

1848 {
1849  SET_BIT(USARTx->CR3, USART_CR3_ONEBIT);
1850 }

◆ LL_USART_EnableOverrunDetect()

__STATIC_INLINE void LL_USART_EnableOverrunDetect ( USART_TypeDef *  USARTx)

Enable Overrun detection CR3 OVRDIS LL_USART_EnableOverrunDetect.

Parameters
USARTxUSART Instance
Return values
None

Definition at line 1880 of file stm32l4xx_ll_usart.h.

1881 {
1882  CLEAR_BIT(USARTx->CR3, USART_CR3_OVRDIS);
1883 }
CLEAR_BIT(hrtc->Instance->CR, RTC_CR_WUTE)

◆ LL_USART_EnableRTSHWFlowCtrl()

__STATIC_INLINE void LL_USART_EnableRTSHWFlowCtrl ( USART_TypeDef *  USARTx)

Enable RTS HW Flow Control.

Note
Macro IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not Hardware Flow control feature is supported by the USARTx instance. CR3 RTSE LL_USART_EnableRTSHWFlowCtrl
Parameters
USARTxUSART Instance
Return values
None

Definition at line 1760 of file stm32l4xx_ll_usart.h.

1761 {
1762  SET_BIT(USARTx->CR3, USART_CR3_RTSE);
1763 }

◆ LL_USART_EnableRxTimeout()

__STATIC_INLINE void LL_USART_EnableRxTimeout ( USART_TypeDef *  USARTx)

Enable Receiver Timeout CR2 RTOEN LL_USART_EnableRxTimeout.

Parameters
USARTxUSART Instance
Return values
None

Definition at line 1668 of file stm32l4xx_ll_usart.h.

1669 {
1670  SET_BIT(USARTx->CR2, USART_CR2_RTOEN);
1671 }

◆ LL_USART_EnableSCLKOutput()

__STATIC_INLINE void LL_USART_EnableSCLKOutput ( USART_TypeDef *  USARTx)

Enable Clock output on SCLK pin.

Note
Macro IS_USART_INSTANCE(USARTx) can be used to check whether or not Synchronous mode is supported by the USARTx instance. CR2 CLKEN LL_USART_EnableSCLKOutput
Parameters
USARTxUSART Instance
Return values
None

Definition at line 1351 of file stm32l4xx_ll_usart.h.

1352 {
1353  SET_BIT(USARTx->CR2, USART_CR2_CLKEN);
1354 }

◆ LL_USART_GetAutoBaudRateMode()

__STATIC_INLINE uint32_t LL_USART_GetAutoBaudRateMode ( USART_TypeDef *  USARTx)

Return Auto Baud-Rate mode.

Note
Macro IS_USART_AUTOBAUDRATE_DETECTION_INSTANCE(USARTx) can be used to check whether or not Auto Baud Rate detection feature is supported by the USARTx instance. CR2 ABRMODE LL_USART_GetAutoBaudRateMode
Parameters
USARTxUSART Instance
Return values
Returnedvalue can be one of the following values:
  • LL_USART_AUTOBAUD_DETECT_ON_STARTBIT
  • LL_USART_AUTOBAUD_DETECT_ON_FALLINGEDGE
  • LL_USART_AUTOBAUD_DETECT_ON_7F_FRAME
  • LL_USART_AUTOBAUD_DETECT_ON_55_FRAME

Definition at line 1657 of file stm32l4xx_ll_usart.h.

1658 {
1659  return (uint32_t)(READ_BIT(USARTx->CR2, USART_CR2_ABRMODE));
1660 }

◆ LL_USART_GetBinaryDataLogic()

__STATIC_INLINE uint32_t LL_USART_GetBinaryDataLogic ( USART_TypeDef *  USARTx)

Retrieve Binary data configuration CR2 DATAINV LL_USART_GetBinaryDataLogic.

Parameters
USARTxUSART Instance
Return values
Returnedvalue can be one of the following values:
  • LL_USART_BINARY_LOGIC_POSITIVE
  • LL_USART_BINARY_LOGIC_NEGATIVE

Definition at line 1552 of file stm32l4xx_ll_usart.h.

1553 {
1554  return (uint32_t)(READ_BIT(USARTx->CR2, USART_CR2_DATAINV));
1555 }

◆ LL_USART_GetClockPhase()

__STATIC_INLINE uint32_t LL_USART_GetClockPhase ( USART_TypeDef *  USARTx)

Return phase of the clock output on the SCLK pin in synchronous mode.

Note
Macro IS_USART_INSTANCE(USARTx) can be used to check whether or not Synchronous mode is supported by the USARTx instance. CR2 CPHA LL_USART_GetClockPhase
Parameters
USARTxUSART Instance
Return values
Returnedvalue can be one of the following values:
  • LL_USART_PHASE_1EDGE
  • LL_USART_PHASE_2EDGE

Definition at line 1226 of file stm32l4xx_ll_usart.h.

1227 {
1228  return (uint32_t)(READ_BIT(USARTx->CR2, USART_CR2_CPHA));
1229 }

◆ LL_USART_GetClockPolarity()

__STATIC_INLINE uint32_t LL_USART_GetClockPolarity ( USART_TypeDef *  USARTx)

Return polarity of the clock output on the SCLK pin in synchronous mode.

Note
Macro IS_USART_INSTANCE(USARTx) can be used to check whether or not Synchronous mode is supported by the USARTx instance. CR2 CPOL LL_USART_GetClockPolarity
Parameters
USARTxUSART Instance
Return values
Returnedvalue can be one of the following values:
  • LL_USART_POLARITY_LOW
  • LL_USART_POLARITY_HIGH

Definition at line 1257 of file stm32l4xx_ll_usart.h.

1258 {
1259  return (uint32_t)(READ_BIT(USARTx->CR2, USART_CR2_CPOL));
1260 }

◆ LL_USART_GetDataWidth()

__STATIC_INLINE uint32_t LL_USART_GetDataWidth ( USART_TypeDef *  USARTx)

Return Word length (i.e. nb of data bits, excluding start and stop bits) CR1 M0 LL_USART_GetDataWidth
CR1 M1 LL_USART_GetDataWidth.

Parameters
USARTxUSART Instance
Return values
Returnedvalue can be one of the following values:
  • LL_USART_DATAWIDTH_7B
  • LL_USART_DATAWIDTH_8B
  • LL_USART_DATAWIDTH_9B

Definition at line 1103 of file stm32l4xx_ll_usart.h.

1104 {
1105  return (uint32_t)(READ_BIT(USARTx->CR1, USART_CR1_M));
1106 }

◆ LL_USART_GetHWFlowCtrl()

__STATIC_INLINE uint32_t LL_USART_GetHWFlowCtrl ( USART_TypeDef *  USARTx)

Return HW Flow Control configuration (both CTS and RTS)

Note
Macro IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not Hardware Flow control feature is supported by the USARTx instance. CR3 RTSE LL_USART_GetHWFlowCtrl
CR3 CTSE LL_USART_GetHWFlowCtrl
Parameters
USARTxUSART Instance
Return values
Returnedvalue can be one of the following values:
  • LL_USART_HWCONTROL_NONE
  • LL_USART_HWCONTROL_RTS
  • LL_USART_HWCONTROL_CTS
  • LL_USART_HWCONTROL_RTS_CTS

Definition at line 1836 of file stm32l4xx_ll_usart.h.

1837 {
1838  return (uint32_t)(READ_BIT(USARTx->CR3, USART_CR3_RTSE | USART_CR3_CTSE));
1839 }

◆ LL_USART_GetLastClkPulseOutput()

__STATIC_INLINE uint32_t LL_USART_GetLastClkPulseOutput ( USART_TypeDef *  USARTx)

Retrieve Clock pulse of the last data bit output configuration (Last bit Clock pulse output to the SCLK pin or not)

Note
Macro IS_USART_INSTANCE(USARTx) can be used to check whether or not Synchronous mode is supported by the USARTx instance. CR2 LBCL LL_USART_GetLastClkPulseOutput
Parameters
USARTxUSART Instance
Return values
Returnedvalue can be one of the following values:
  • LL_USART_LASTCLKPULSE_NO_OUTPUT
  • LL_USART_LASTCLKPULSE_OUTPUT

Definition at line 1195 of file stm32l4xx_ll_usart.h.

1196 {
1197  return (uint32_t)(READ_BIT(USARTx->CR2, USART_CR2_LBCL));
1198 }

◆ LL_USART_GetNodeAddress()

__STATIC_INLINE uint32_t LL_USART_GetNodeAddress ( USART_TypeDef *  USARTx)

Return 8 bit Address of the USART node as set in ADD field of CR2.

Note
If 4-bit Address Detection is selected in ADDM7, only 4bits (b3-b0) of returned value are relevant (b31-b4 are not relevant) If 7-bit Address Detection is selected in ADDM7, only 8bits (b7-b0) of returned value are relevant (b31-b8 are not relevant) CR2 ADD LL_USART_GetNodeAddress
Parameters
USARTxUSART Instance
Return values
Addressof the USART node (Value between Min_Data=0 and Max_Data=255)

Definition at line 1734 of file stm32l4xx_ll_usart.h.

1735 {
1736  return (uint32_t)(READ_BIT(USARTx->CR2, USART_CR2_ADD) >> USART_CR2_ADD_Pos);
1737 }

◆ LL_USART_GetNodeAddressLen()

__STATIC_INLINE uint32_t LL_USART_GetNodeAddressLen ( USART_TypeDef *  USARTx)

Return Length of Node Address used in Address Detection mode (7-bit or 4-bit) CR2 ADDM7 LL_USART_GetNodeAddressLen.

Parameters
USARTxUSART Instance
Return values
Returnedvalue can be one of the following values:
  • LL_USART_ADDRESS_DETECT_4B
  • LL_USART_ADDRESS_DETECT_7B

Definition at line 1747 of file stm32l4xx_ll_usart.h.

1748 {
1749  return (uint32_t)(READ_BIT(USARTx->CR2, USART_CR2_ADDM7));
1750 }

◆ LL_USART_GetOverSampling()

__STATIC_INLINE uint32_t LL_USART_GetOverSampling ( USART_TypeDef *  USARTx)

Return Oversampling mode CR1 OVER8 LL_USART_GetOverSampling.

Parameters
USARTxUSART Instance
Return values
Returnedvalue can be one of the following values:
  • LL_USART_OVERSAMPLING_16
  • LL_USART_OVERSAMPLING_8

Definition at line 1163 of file stm32l4xx_ll_usart.h.

1164 {
1165  return (uint32_t)(READ_BIT(USARTx->CR1, USART_CR1_OVER8));
1166 }

◆ LL_USART_GetParity()

__STATIC_INLINE uint32_t LL_USART_GetParity ( USART_TypeDef *  USARTx)

Return Parity configuration (enabled/disabled and parity mode if enabled) CR1 PS LL_USART_GetParity
CR1 PCE LL_USART_GetParity.

Parameters
USARTxUSART Instance
Return values
Returnedvalue can be one of the following values:
  • LL_USART_PARITY_NONE
  • LL_USART_PARITY_EVEN
  • LL_USART_PARITY_ODD

Definition at line 1045 of file stm32l4xx_ll_usart.h.

1046 {
1047  return (uint32_t)(READ_BIT(USARTx->CR1, USART_CR1_PS | USART_CR1_PCE));
1048 }

◆ LL_USART_GetPrescaler()

__STATIC_INLINE uint32_t LL_USART_GetPrescaler ( USART_TypeDef *  USARTx)

Retrieve the Clock source prescaler for baudrate generator and oversampling.

Note
Macro IS_UART_FIFO_INSTANCE(USARTx) can be used to check whether or not FIFO mode feature is supported by the USARTx instance. PRESC PRESCALER LL_USART_GetPrescaler
Parameters
USARTxUSART Instance
Return values
Returnedvalue can be one of the following values:
  • LL_USART_PRESCALER_DIV1
  • LL_USART_PRESCALER_DIV2
  • LL_USART_PRESCALER_DIV4
  • LL_USART_PRESCALER_DIV6
  • LL_USART_PRESCALER_DIV8
  • LL_USART_PRESCALER_DIV10
  • LL_USART_PRESCALER_DIV12
  • LL_USART_PRESCALER_DIV16
  • LL_USART_PRESCALER_DIV32
  • LL_USART_PRESCALER_DIV64
  • LL_USART_PRESCALER_DIV128
  • LL_USART_PRESCALER_DIV256

Definition at line 1337 of file stm32l4xx_ll_usart.h.

1338 {
1339  return (uint32_t)(READ_BIT(USARTx->PRESC, USART_PRESC_PRESCALER));
1340 }

◆ LL_USART_GetRXFIFOThreshold()

__STATIC_INLINE uint32_t LL_USART_GetRXFIFOThreshold ( USART_TypeDef *  USARTx)

Return RX FIFO Threshold Configuration.

Note
Macro IS_UART_FIFO_INSTANCE(USARTx) can be used to check whether or not FIFO mode feature is supported by the USARTx instance. CR3 RXFTCFG LL_USART_GetRXFIFOThreshold
Parameters
USARTxUSART Instance
Return values
Returnedvalue can be one of the following values:
  • LL_USART_FIFOTHRESHOLD_1_8
  • LL_USART_FIFOTHRESHOLD_1_4
  • LL_USART_FIFOTHRESHOLD_1_2
  • LL_USART_FIFOTHRESHOLD_3_4
  • LL_USART_FIFOTHRESHOLD_7_8
  • LL_USART_FIFOTHRESHOLD_8_8

Definition at line 825 of file stm32l4xx_ll_usart.h.

826 {
827  return (uint32_t)(READ_BIT(USARTx->CR3, USART_CR3_RXFTCFG) >> USART_CR3_RXFTCFG_Pos);
828 }

◆ LL_USART_GetRXPinLevel()

__STATIC_INLINE uint32_t LL_USART_GetRXPinLevel ( USART_TypeDef *  USARTx)

Retrieve RX pin active level logic configuration CR2 RXINV LL_USART_GetRXPinLevel.

Parameters
USARTxUSART Instance
Return values
Returnedvalue can be one of the following values:
  • LL_USART_RXPIN_LEVEL_STANDARD
  • LL_USART_RXPIN_LEVEL_INVERTED

Definition at line 1496 of file stm32l4xx_ll_usart.h.

1497 {
1498  return (uint32_t)(READ_BIT(USARTx->CR2, USART_CR2_RXINV));
1499 }

◆ LL_USART_GetStopBitsLength()

__STATIC_INLINE uint32_t LL_USART_GetStopBitsLength ( USART_TypeDef *  USARTx)

Retrieve the length of the stop bits CR2 STOP LL_USART_GetStopBitsLength.

Parameters
USARTxUSART Instance
Return values
Returnedvalue can be one of the following values:
  • LL_USART_STOPBITS_0_5
  • LL_USART_STOPBITS_1
  • LL_USART_STOPBITS_1_5
  • LL_USART_STOPBITS_2

Definition at line 1408 of file stm32l4xx_ll_usart.h.

1409 {
1410  return (uint32_t)(READ_BIT(USARTx->CR2, USART_CR2_STOP));
1411 }

◆ LL_USART_GetTransferBitOrder()

__STATIC_INLINE uint32_t LL_USART_GetTransferBitOrder ( USART_TypeDef *  USARTx)

Return transfer bit order (either Less or Most Significant Bit First)

Note
MSB First means data is transmitted/received with the MSB first, following the start bit. LSB First means data is transmitted/received with data bit 0 first, following the start bit. CR2 MSBFIRST LL_USART_GetTransferBitOrder
Parameters
USARTxUSART Instance
Return values
Returnedvalue can be one of the following values:
  • LL_USART_BITORDER_LSBFIRST
  • LL_USART_BITORDER_MSBFIRST

Definition at line 1583 of file stm32l4xx_ll_usart.h.

1584 {
1585  return (uint32_t)(READ_BIT(USARTx->CR2, USART_CR2_MSBFIRST));
1586 }

◆ LL_USART_GetTransferDirection()

__STATIC_INLINE uint32_t LL_USART_GetTransferDirection ( USART_TypeDef *  USARTx)

Return enabled/disabled states of Transmitter and Receiver CR1 RE LL_USART_GetTransferDirection
CR1 TE LL_USART_GetTransferDirection.

Parameters
USARTxUSART Instance
Return values
Returnedvalue can be one of the following values:
  • LL_USART_DIRECTION_NONE
  • LL_USART_DIRECTION_RX
  • LL_USART_DIRECTION_TX
  • LL_USART_DIRECTION_TX_RX

Definition at line 1011 of file stm32l4xx_ll_usart.h.

1012 {
1013  return (uint32_t)(READ_BIT(USARTx->CR1, USART_CR1_RE | USART_CR1_TE));
1014 }

◆ LL_USART_GetTXFIFOThreshold()

__STATIC_INLINE uint32_t LL_USART_GetTXFIFOThreshold ( USART_TypeDef *  USARTx)

Return TX FIFO Threshold Configuration.

Note
Macro IS_UART_FIFO_INSTANCE(USARTx) can be used to check whether or not FIFO mode feature is supported by the USARTx instance. CR3 TXFTCFG LL_USART_GetTXFIFOThreshold
Parameters
USARTxUSART Instance
Return values
Returnedvalue can be one of the following values:
  • LL_USART_FIFOTHRESHOLD_1_8
  • LL_USART_FIFOTHRESHOLD_1_4
  • LL_USART_FIFOTHRESHOLD_1_2
  • LL_USART_FIFOTHRESHOLD_3_4
  • LL_USART_FIFOTHRESHOLD_7_8
  • LL_USART_FIFOTHRESHOLD_8_8

Definition at line 786 of file stm32l4xx_ll_usart.h.

787 {
788  return (uint32_t)(READ_BIT(USARTx->CR3, USART_CR3_TXFTCFG) >> USART_CR3_TXFTCFG_Pos);
789 }

◆ LL_USART_GetTXPinLevel()

__STATIC_INLINE uint32_t LL_USART_GetTXPinLevel ( USART_TypeDef *  USARTx)

Retrieve TX pin active level logic configuration CR2 TXINV LL_USART_GetTXPinLevel.

Parameters
USARTxUSART Instance
Return values
Returnedvalue can be one of the following values:
  • LL_USART_TXPIN_LEVEL_STANDARD
  • LL_USART_TXPIN_LEVEL_INVERTED

Definition at line 1523 of file stm32l4xx_ll_usart.h.

1524 {
1525  return (uint32_t)(READ_BIT(USARTx->CR2, USART_CR2_TXINV));
1526 }

◆ LL_USART_GetTXRXSwap()

__STATIC_INLINE uint32_t LL_USART_GetTXRXSwap ( USART_TypeDef *  USARTx)

Retrieve TX/RX pins swapping configuration. CR2 SWAP LL_USART_GetTXRXSwap.

Parameters
USARTxUSART Instance
Return values
Returnedvalue can be one of the following values:
  • LL_USART_TXRX_STANDARD
  • LL_USART_TXRX_SWAPPED

Definition at line 1469 of file stm32l4xx_ll_usart.h.

1470 {
1471  return (uint32_t)(READ_BIT(USARTx->CR2, USART_CR2_SWAP));
1472 }

◆ LL_USART_GetWakeUpMethod()

__STATIC_INLINE uint32_t LL_USART_GetWakeUpMethod ( USART_TypeDef *  USARTx)

Return Receiver Wake Up method from Mute mode CR1 WAKE LL_USART_GetWakeUpMethod.

Parameters
USARTxUSART Instance
Return values
Returnedvalue can be one of the following values:
  • LL_USART_WAKEUP_IDLELINE
  • LL_USART_WAKEUP_ADDRESSMARK

Definition at line 1072 of file stm32l4xx_ll_usart.h.

1073 {
1074  return (uint32_t)(READ_BIT(USARTx->CR1, USART_CR1_WAKE));
1075 }

◆ LL_USART_GetWKUPType()

__STATIC_INLINE uint32_t LL_USART_GetWKUPType ( USART_TypeDef *  USARTx)

Return event type for Wake UP Interrupt Flag (WUS[1:0] bits)

Note
Macro IS_UART_WAKEUP_FROMSTOP_INSTANCE(USARTx) can be used to check whether or not Wake-up from Stop mode feature is supported by the USARTx instance. CR3 WUS LL_USART_GetWKUPType
Parameters
USARTxUSART Instance
Return values
Returnedvalue can be one of the following values:
  • LL_USART_WAKEUP_ON_ADDRESS
  • LL_USART_WAKEUP_ON_STARTBIT
  • LL_USART_WAKEUP_ON_RXNE

Definition at line 1935 of file stm32l4xx_ll_usart.h.

1936 {
1937  return (uint32_t)(READ_BIT(USARTx->CR3, USART_CR3_WUS));
1938 }

◆ LL_USART_Init()

ErrorStatus LL_USART_Init ( USART_TypeDef *  USARTx,
LL_USART_InitTypeDef USART_InitStruct 
)

Initialize USART registers according to the specified parameters in USART_InitStruct.

Note
As some bits in USART configuration registers can only be written when the USART is disabled (USART_CR1_UE bit =0), USART Peripheral should be in disabled state prior calling this function. Otherwise, ERROR result will be returned.
Baud rate value stored in USART_InitStruct BaudRate field, should be valid (different from 0).
Parameters
USARTxUSART Instance
USART_InitStructpointer to a LL_USART_InitTypeDef structure that contains the configuration information for the specified USART peripheral.
Return values
AnErrorStatus enumeration value:
  • SUCCESS: USART registers are initialized according to USART_InitStruct content
  • ERROR: Problem occurred during USART Registers initialization

Definition at line 220 of file stm32l4xx_ll_usart.c.

221 {
222  ErrorStatus status = ERROR;
223  uint32_t periphclk = LL_RCC_PERIPH_FREQUENCY_NO;
224 
225  /* Check the parameters */
226  assert_param(IS_UART_INSTANCE(USARTx));
227 #if defined(USART_PRESC_PRESCALER)
228  assert_param(IS_LL_USART_PRESCALER(USART_InitStruct->PrescalerValue));
229 #endif /* USART_PRESC_PRESCALER */
230  assert_param(IS_LL_USART_BAUDRATE(USART_InitStruct->BaudRate));
231  assert_param(IS_LL_USART_DATAWIDTH(USART_InitStruct->DataWidth));
232  assert_param(IS_LL_USART_STOPBITS(USART_InitStruct->StopBits));
233  assert_param(IS_LL_USART_PARITY(USART_InitStruct->Parity));
234  assert_param(IS_LL_USART_DIRECTION(USART_InitStruct->TransferDirection));
235  assert_param(IS_LL_USART_HWCONTROL(USART_InitStruct->HardwareFlowControl));
236  assert_param(IS_LL_USART_OVERSAMPLING(USART_InitStruct->OverSampling));
237 
238  /* USART needs to be in disabled state, in order to be able to configure some bits in
239  CRx registers */
240  if (LL_USART_IsEnabled(USARTx) == 0U)
241  {
242  /*---------------------------- USART CR1 Configuration ---------------------
243  * Configure USARTx CR1 (USART Word Length, Parity, Mode and Oversampling bits) with parameters:
244  * - DataWidth: USART_CR1_M bits according to USART_InitStruct->DataWidth value
245  * - Parity: USART_CR1_PCE, USART_CR1_PS bits according to USART_InitStruct->Parity value
246  * - TransferDirection: USART_CR1_TE, USART_CR1_RE bits according to USART_InitStruct->TransferDirection value
247  * - Oversampling: USART_CR1_OVER8 bit according to USART_InitStruct->OverSampling value.
248  */
249  MODIFY_REG(USARTx->CR1,
250  (USART_CR1_M | USART_CR1_PCE | USART_CR1_PS |
251  USART_CR1_TE | USART_CR1_RE | USART_CR1_OVER8),
252  (USART_InitStruct->DataWidth | USART_InitStruct->Parity |
253  USART_InitStruct->TransferDirection | USART_InitStruct->OverSampling));
254 
255  /*---------------------------- USART CR2 Configuration ---------------------
256  * Configure USARTx CR2 (Stop bits) with parameters:
257  * - Stop Bits: USART_CR2_STOP bits according to USART_InitStruct->StopBits value.
258  * - CLKEN, CPOL, CPHA and LBCL bits are to be configured using LL_USART_ClockInit().
259  */
260  LL_USART_SetStopBitsLength(USARTx, USART_InitStruct->StopBits);
261 
262  /*---------------------------- USART CR3 Configuration ---------------------
263  * Configure USARTx CR3 (Hardware Flow Control) with parameters:
264  * - HardwareFlowControl: USART_CR3_RTSE, USART_CR3_CTSE bits according to USART_InitStruct->HardwareFlowControl value.
265  */
266  LL_USART_SetHWFlowCtrl(USARTx, USART_InitStruct->HardwareFlowControl);
267 
268  /*---------------------------- USART BRR Configuration ---------------------
269  * Retrieve Clock frequency used for USART Peripheral
270  */
271  if (USARTx == USART1)
272  {
273  periphclk = LL_RCC_GetUSARTClockFreq(LL_RCC_USART1_CLKSOURCE);
274  }
275  else if (USARTx == USART2)
276  {
277  periphclk = LL_RCC_GetUSARTClockFreq(LL_RCC_USART2_CLKSOURCE);
278  }
279 #if defined(USART3)
280  else if (USARTx == USART3)
281  {
282  periphclk = LL_RCC_GetUSARTClockFreq(LL_RCC_USART3_CLKSOURCE);
283  }
284 #endif /* USART3 */
285 #if defined(UART4)
286  else if (USARTx == UART4)
287  {
288  periphclk = LL_RCC_GetUARTClockFreq(LL_RCC_UART4_CLKSOURCE);
289  }
290 #endif /* UART4 */
291 #if defined(UART5)
292  else if (USARTx == UART5)
293  {
294  periphclk = LL_RCC_GetUARTClockFreq(LL_RCC_UART5_CLKSOURCE);
295  }
296 #endif /* UART5 */
297  else
298  {
299  /* Nothing to do, as error code is already assigned to ERROR value */
300  }
301 
302  /* Configure the USART Baud Rate :
303  #if defined(USART_PRESC_PRESCALER)
304  - prescaler value is required
305  #endif
306  - valid baud rate value (different from 0) is required
307  - Peripheral clock as returned by RCC service, should be valid (different from 0).
308  */
309  if ((periphclk != LL_RCC_PERIPH_FREQUENCY_NO)
310  && (USART_InitStruct->BaudRate != 0U))
311  {
312  status = SUCCESS;
313  LL_USART_SetBaudRate(USARTx,
314  periphclk,
315 #if defined(USART_PRESC_PRESCALER)
316  USART_InitStruct->PrescalerValue,
317 #endif /* USART_PRESC_PRESCALER */
318  USART_InitStruct->OverSampling,
319  USART_InitStruct->BaudRate);
320 
321  /* Check BRR is greater than or equal to 16d */
322  assert_param(IS_LL_USART_BRR_MIN(USARTx->BRR));
323 
324  /* Check BRR is lower than or equal to 0xFFFF */
325  assert_param(IS_LL_USART_BRR_MAX(USARTx->BRR));
326  }
327 #if defined(USART_PRESC_PRESCALER)
328 
329  /*---------------------------- USART PRESC Configuration -----------------------
330  * Configure USARTx PRESC (Prescaler) with parameters:
331  * - PrescalerValue: USART_PRESC_PRESCALER bits according to USART_InitStruct->PrescalerValue value.
332  */
333  LL_USART_SetPrescaler(USARTx, USART_InitStruct->PrescalerValue);
334 #endif /* USART_PRESC_PRESCALER */
335  }
336  /* Endif (=> USART not in Disabled state => return ERROR) */
337 
338  return (status);
339 }
__STATIC_INLINE void LL_USART_SetPrescaler(USART_TypeDef *USARTx, uint32_t PrescalerValue)
Configure Clock source prescaler for baudrate generator and oversampling.
uint32_t LL_RCC_GetUARTClockFreq(uint32_t UARTxSource)
Return UARTx clock frequency.
__STATIC_INLINE void LL_USART_SetStopBitsLength(USART_TypeDef *USARTx, uint32_t StopBits)
Set the length of the stop bits CR2 STOP LL_USART_SetStopBitsLength.
uint32_t LL_RCC_GetUSARTClockFreq(uint32_t USARTxSource)
Return USARTx clock frequency.
__STATIC_INLINE uint32_t LL_USART_IsEnabled(USART_TypeDef *USARTx)
Indicate if USART is enabled CR1 UE LL_USART_IsEnabled.
__STATIC_INLINE void LL_USART_SetHWFlowCtrl(USART_TypeDef *USARTx, uint32_t HardwareFlowControl)
Configure HW Flow Control mode (both CTS and RTS)
__STATIC_INLINE void LL_USART_SetBaudRate(USART_TypeDef *USARTx, uint32_t PeriphClk, uint32_t PrescalerValue, uint32_t OverSampling, uint32_t BaudRate) __STATIC_INLINE void LL_USART_SetBaudRate(USART_TypeDef *USARTx
Configure USART BRR register for achieving expected Baud Rate value.
ADC handle Structure definition.
MODIFY_REG(hrtc->Instance->CR, RTC_CR_WUCKSEL,(uint32_t) WakeUpClock)
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))

◆ LL_USART_IsClockEnabledInStopMode()

__STATIC_INLINE uint32_t LL_USART_IsClockEnabledInStopMode ( USART_TypeDef *  USARTx)

Indicate if USART clock is enabled in STOP Mode CR3 UCESM LL_USART_IsClockEnabledInStopMode.

Parameters
USARTxUSART Instance
Return values
Stateof bit (1 or 0).

Definition at line 932 of file stm32l4xx_ll_usart.h.

933 {
934  return (READ_BIT(USARTx->CR3, USART_CR3_UCESM) == (USART_CR3_UCESM));
935 }

◆ LL_USART_IsEnabled()

__STATIC_INLINE uint32_t LL_USART_IsEnabled ( USART_TypeDef *  USARTx)

Indicate if USART is enabled CR1 UE LL_USART_IsEnabled.

Parameters
USARTxUSART Instance
Return values
Stateof bit (1 or 0).

Definition at line 707 of file stm32l4xx_ll_usart.h.

708 {
709  return ((READ_BIT(USARTx->CR1, USART_CR1_UE) == (USART_CR1_UE)) ? 1UL : 0UL);
710 }

◆ LL_USART_IsEnabledAutoBaud()

__STATIC_INLINE uint32_t LL_USART_IsEnabledAutoBaud ( USART_TypeDef *  USARTx)

Indicate if Auto Baud-Rate Detection mechanism is enabled.

Note
Macro IS_USART_AUTOBAUDRATE_DETECTION_INSTANCE(USARTx) can be used to check whether or not Auto Baud Rate detection feature is supported by the USARTx instance. CR2 ABREN LL_USART_IsEnabledAutoBaud
Parameters
USARTxUSART Instance
Return values
Stateof bit (1 or 0).

Definition at line 1622 of file stm32l4xx_ll_usart.h.

1623 {
1624  return ((READ_BIT(USARTx->CR2, USART_CR2_ABREN) == (USART_CR2_ABREN)) ? 1UL : 0UL);
1625 }

◆ LL_USART_IsEnabledFIFO()

__STATIC_INLINE uint32_t LL_USART_IsEnabledFIFO ( USART_TypeDef *  USARTx)

Indicate if FIFO Mode is enabled.

Note
Macro IS_UART_FIFO_INSTANCE(USARTx) can be used to check whether or not FIFO mode feature is supported by the USARTx instance. CR1 FIFOEN LL_USART_IsEnabledFIFO
Parameters
USARTxUSART Instance
Return values
Stateof bit (1 or 0).

Definition at line 747 of file stm32l4xx_ll_usart.h.

748 {
749  return ((READ_BIT(USARTx->CR1, USART_CR1_FIFOEN) == (USART_CR1_FIFOEN)) ? 1UL : 0UL);
750 }

◆ LL_USART_IsEnabledInStopMode()

__STATIC_INLINE uint32_t LL_USART_IsEnabledInStopMode ( USART_TypeDef *  USARTx)

Indicate if USART is enabled in STOP Mode (able to wake up MCU from Stop mode or not)

Note
Macro IS_UART_WAKEUP_FROMSTOP_INSTANCE(USARTx) can be used to check whether or not Wake-up from Stop mode feature is supported by the USARTx instance. CR1 UESM LL_USART_IsEnabledInStopMode
Parameters
USARTxUSART Instance
Return values
Stateof bit (1 or 0).

Definition at line 896 of file stm32l4xx_ll_usart.h.

897 {
898  return ((READ_BIT(USARTx->CR1, USART_CR1_UESM) == (USART_CR1_UESM)) ? 1UL : 0UL);
899 }

◆ LL_USART_IsEnabledMuteMode()

__STATIC_INLINE uint32_t LL_USART_IsEnabledMuteMode ( USART_TypeDef *  USARTx)

Indicate if switch between Mute Mode and Active mode is allowed CR1 MME LL_USART_IsEnabledMuteMode.

Parameters
USARTxUSART Instance
Return values
Stateof bit (1 or 0).

Definition at line 1136 of file stm32l4xx_ll_usart.h.

1137 {
1138  return ((READ_BIT(USARTx->CR1, USART_CR1_MME) == (USART_CR1_MME)) ? 1UL : 0UL);
1139 }

◆ LL_USART_IsEnabledOneBitSamp()

__STATIC_INLINE uint32_t LL_USART_IsEnabledOneBitSamp ( USART_TypeDef *  USARTx)

Indicate if One bit sampling method is enabled CR3 ONEBIT LL_USART_IsEnabledOneBitSamp.

Parameters
USARTxUSART Instance
Return values
Stateof bit (1 or 0).

Definition at line 1869 of file stm32l4xx_ll_usart.h.

1870 {
1871  return ((READ_BIT(USARTx->CR3, USART_CR3_ONEBIT) == (USART_CR3_ONEBIT)) ? 1UL : 0UL);
1872 }

◆ LL_USART_IsEnabledOverrunDetect()

__STATIC_INLINE uint32_t LL_USART_IsEnabledOverrunDetect ( USART_TypeDef *  USARTx)

Indicate if Overrun detection is enabled CR3 OVRDIS LL_USART_IsEnabledOverrunDetect.

Parameters
USARTxUSART Instance
Return values
Stateof bit (1 or 0).

Definition at line 1902 of file stm32l4xx_ll_usart.h.

1903 {
1904  return ((READ_BIT(USARTx->CR3, USART_CR3_OVRDIS) != USART_CR3_OVRDIS) ? 1UL : 0UL);
1905 }

◆ LL_USART_IsEnabledRxTimeout()

__STATIC_INLINE uint32_t LL_USART_IsEnabledRxTimeout ( USART_TypeDef *  USARTx)

Indicate if Receiver Timeout feature is enabled CR2 RTOEN LL_USART_IsEnabledRxTimeout.

Parameters
USARTxUSART Instance
Return values
Stateof bit (1 or 0).

Definition at line 1690 of file stm32l4xx_ll_usart.h.

1691 {
1692  return ((READ_BIT(USARTx->CR2, USART_CR2_RTOEN) == (USART_CR2_RTOEN)) ? 1UL : 0UL);
1693 }

◆ LL_USART_IsEnabledSCLKOutput()

__STATIC_INLINE uint32_t LL_USART_IsEnabledSCLKOutput ( USART_TypeDef *  USARTx)

Indicate if Clock output on SCLK pin is enabled.

Note
Macro IS_USART_INSTANCE(USARTx) can be used to check whether or not Synchronous mode is supported by the USARTx instance. CR2 CLKEN LL_USART_IsEnabledSCLKOutput
Parameters
USARTxUSART Instance
Return values
Stateof bit (1 or 0).

Definition at line 1377 of file stm32l4xx_ll_usart.h.

1378 {
1379  return ((READ_BIT(USARTx->CR2, USART_CR2_CLKEN) == (USART_CR2_CLKEN)) ? 1UL : 0UL);
1380 }

◆ LL_USART_SetAutoBaudRateMode()

__STATIC_INLINE void LL_USART_SetAutoBaudRateMode ( USART_TypeDef *  USARTx,
uint32_t  AutoBaudRateMode 
)

Set Auto Baud-Rate mode bits.

Note
Macro IS_USART_AUTOBAUDRATE_DETECTION_INSTANCE(USARTx) can be used to check whether or not Auto Baud Rate detection feature is supported by the USARTx instance. CR2 ABRMODE LL_USART_SetAutoBaudRateMode
Parameters
USARTxUSART Instance
AutoBaudRateModeThis parameter can be one of the following values:
  • LL_USART_AUTOBAUD_DETECT_ON_STARTBIT
  • LL_USART_AUTOBAUD_DETECT_ON_FALLINGEDGE
  • LL_USART_AUTOBAUD_DETECT_ON_7F_FRAME
  • LL_USART_AUTOBAUD_DETECT_ON_55_FRAME
Return values
None

Definition at line 1640 of file stm32l4xx_ll_usart.h.

1641 {
1642  MODIFY_REG(USARTx->CR2, USART_CR2_ABRMODE, AutoBaudRateMode);
1643 }
MODIFY_REG(hrtc->Instance->CR, RTC_CR_WUCKSEL,(uint32_t) WakeUpClock)

◆ LL_USART_SetBaudRate()

__STATIC_INLINE void LL_USART_SetBaudRate ( USART_TypeDef *  USARTx,
uint32_t  PeriphClk,
uint32_t  PrescalerValue,
uint32_t  OverSampling,
uint32_t  BaudRate 
)

Configure USART BRR register for achieving expected Baud Rate value.

Note
Compute and set USARTDIV value in BRR Register (full BRR content) according to used Peripheral Clock, Oversampling mode, and expected Baud Rate values
Peripheral clock and Baud rate values provided as function parameters should be valid (Baud rate value != 0)
In case of oversampling by 16 and 8, BRR content must be greater than or equal to 16d. BRR BRR LL_USART_SetBaudRate
Parameters
USARTxUSART Instance
PeriphClkPeripheral Clock
OverSamplingThis parameter can be one of the following values:
  • LL_USART_OVERSAMPLING_16
  • LL_USART_OVERSAMPLING_8
BaudRateBaud Rate
Return values
None

◆ LL_USART_SetBinaryDataLogic()

__STATIC_INLINE void LL_USART_SetBinaryDataLogic ( USART_TypeDef *  USARTx,
uint32_t  DataLogic 
)

Configure Binary data logic.

Note
Allow to define how Logical data from the data register are send/received : either in positive/direct logic (1=H, 0=L) or in negative/inverse logic (1=L, 0=H) CR2 DATAINV LL_USART_SetBinaryDataLogic
Parameters
USARTxUSART Instance
DataLogicThis parameter can be one of the following values:
  • LL_USART_BINARY_LOGIC_POSITIVE
  • LL_USART_BINARY_LOGIC_NEGATIVE
Return values
None

Definition at line 1539 of file stm32l4xx_ll_usart.h.

1540 {
1541  MODIFY_REG(USARTx->CR2, USART_CR2_DATAINV, DataLogic);
1542 }
MODIFY_REG(hrtc->Instance->CR, RTC_CR_WUCKSEL,(uint32_t) WakeUpClock)

◆ LL_USART_SetClockPhase()

__STATIC_INLINE void LL_USART_SetClockPhase ( USART_TypeDef *  USARTx,
uint32_t  ClockPhase 
)

Select the phase of the clock output on the SCLK pin in synchronous mode.

Note
Macro IS_USART_INSTANCE(USARTx) can be used to check whether or not Synchronous mode is supported by the USARTx instance. CR2 CPHA LL_USART_SetClockPhase
Parameters
USARTxUSART Instance
ClockPhaseThis parameter can be one of the following values:
  • LL_USART_PHASE_1EDGE
  • LL_USART_PHASE_2EDGE
Return values
None

Definition at line 1211 of file stm32l4xx_ll_usart.h.

1212 {
1213  MODIFY_REG(USARTx->CR2, USART_CR2_CPHA, ClockPhase);
1214 }
MODIFY_REG(hrtc->Instance->CR, RTC_CR_WUCKSEL,(uint32_t) WakeUpClock)

◆ LL_USART_SetClockPolarity()

__STATIC_INLINE void LL_USART_SetClockPolarity ( USART_TypeDef *  USARTx,
uint32_t  ClockPolarity 
)

Select the polarity of the clock output on the SCLK pin in synchronous mode.

Note
Macro IS_USART_INSTANCE(USARTx) can be used to check whether or not Synchronous mode is supported by the USARTx instance. CR2 CPOL LL_USART_SetClockPolarity
Parameters
USARTxUSART Instance
ClockPolarityThis parameter can be one of the following values:
  • LL_USART_POLARITY_LOW
  • LL_USART_POLARITY_HIGH
Return values
None

Definition at line 1242 of file stm32l4xx_ll_usart.h.

1243 {
1244  MODIFY_REG(USARTx->CR2, USART_CR2_CPOL, ClockPolarity);
1245 }
MODIFY_REG(hrtc->Instance->CR, RTC_CR_WUCKSEL,(uint32_t) WakeUpClock)

◆ LL_USART_SetDataWidth()

__STATIC_INLINE void LL_USART_SetDataWidth ( USART_TypeDef *  USARTx,
uint32_t  DataWidth 
)

Set Word length (i.e. nb of data bits, excluding start and stop bits) CR1 M0 LL_USART_SetDataWidth
CR1 M1 LL_USART_SetDataWidth.

Parameters
USARTxUSART Instance
DataWidthThis parameter can be one of the following values:
  • LL_USART_DATAWIDTH_7B
  • LL_USART_DATAWIDTH_8B
  • LL_USART_DATAWIDTH_9B
Return values
None

Definition at line 1088 of file stm32l4xx_ll_usart.h.

1089 {
1090  MODIFY_REG(USARTx->CR1, USART_CR1_M, DataWidth);
1091 }
MODIFY_REG(hrtc->Instance->CR, RTC_CR_WUCKSEL,(uint32_t) WakeUpClock)

◆ LL_USART_SetHWFlowCtrl()

__STATIC_INLINE void LL_USART_SetHWFlowCtrl ( USART_TypeDef *  USARTx,
uint32_t  HardwareFlowControl 
)

Configure HW Flow Control mode (both CTS and RTS)

Note
Macro IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not Hardware Flow control feature is supported by the USARTx instance. CR3 RTSE LL_USART_SetHWFlowCtrl
CR3 CTSE LL_USART_SetHWFlowCtrl
Parameters
USARTxUSART Instance
HardwareFlowControlThis parameter can be one of the following values:
  • LL_USART_HWCONTROL_NONE
  • LL_USART_HWCONTROL_RTS
  • LL_USART_HWCONTROL_CTS
  • LL_USART_HWCONTROL_RTS_CTS
Return values
None

Definition at line 1818 of file stm32l4xx_ll_usart.h.

1819 {
1820  MODIFY_REG(USARTx->CR3, USART_CR3_RTSE | USART_CR3_CTSE, HardwareFlowControl);
1821 }
MODIFY_REG(hrtc->Instance->CR, RTC_CR_WUCKSEL,(uint32_t) WakeUpClock)

◆ LL_USART_SetLastClkPulseOutput()

__STATIC_INLINE void LL_USART_SetLastClkPulseOutput ( USART_TypeDef *  USARTx,
uint32_t  LastBitClockPulse 
)

Configure if Clock pulse of the last data bit is output to the SCLK pin or not.

Note
Macro IS_USART_INSTANCE(USARTx) can be used to check whether or not Synchronous mode is supported by the USARTx instance. CR2 LBCL LL_USART_SetLastClkPulseOutput
Parameters
USARTxUSART Instance
LastBitClockPulseThis parameter can be one of the following values:
  • LL_USART_LASTCLKPULSE_NO_OUTPUT
  • LL_USART_LASTCLKPULSE_OUTPUT
Return values
None

Definition at line 1179 of file stm32l4xx_ll_usart.h.

1180 {
1181  MODIFY_REG(USARTx->CR2, USART_CR2_LBCL, LastBitClockPulse);
1182 }
MODIFY_REG(hrtc->Instance->CR, RTC_CR_WUCKSEL,(uint32_t) WakeUpClock)

◆ LL_USART_SetOverSampling()

__STATIC_INLINE void LL_USART_SetOverSampling ( USART_TypeDef *  USARTx,
uint32_t  OverSampling 
)

Set Oversampling to 8-bit or 16-bit mode CR1 OVER8 LL_USART_SetOverSampling.

Parameters
USARTxUSART Instance
OverSamplingThis parameter can be one of the following values:
  • LL_USART_OVERSAMPLING_16
  • LL_USART_OVERSAMPLING_8
Return values
None

Definition at line 1150 of file stm32l4xx_ll_usart.h.

1151 {
1152  MODIFY_REG(USARTx->CR1, USART_CR1_OVER8, OverSampling);
1153 }
__STATIC_INLINE void uint32_t uint32_t OverSampling
MODIFY_REG(hrtc->Instance->CR, RTC_CR_WUCKSEL,(uint32_t) WakeUpClock)

◆ LL_USART_SetParity()

__STATIC_INLINE void LL_USART_SetParity ( USART_TypeDef *  USARTx,
uint32_t  Parity 
)

Configure Parity (enabled/disabled and parity mode if enabled).

Note
This function selects if hardware parity control (generation and detection) is enabled or disabled. When the parity control is enabled (Odd or Even), computed parity bit is inserted at the MSB position (9th or 8th bit depending on data width) and parity is checked on the received data. CR1 PS LL_USART_SetParity
CR1 PCE LL_USART_SetParity
Parameters
USARTxUSART Instance
ParityThis parameter can be one of the following values:
  • LL_USART_PARITY_NONE
  • LL_USART_PARITY_EVEN
  • LL_USART_PARITY_ODD
Return values
None

Definition at line 1030 of file stm32l4xx_ll_usart.h.

1031 {
1032  MODIFY_REG(USARTx->CR1, USART_CR1_PS | USART_CR1_PCE, Parity);
1033 }
MODIFY_REG(hrtc->Instance->CR, RTC_CR_WUCKSEL,(uint32_t) WakeUpClock)

◆ LL_USART_SetPrescaler()

__STATIC_INLINE void LL_USART_SetPrescaler ( USART_TypeDef *  USARTx,
uint32_t  PrescalerValue 
)

Configure Clock source prescaler for baudrate generator and oversampling.

Note
Macro IS_UART_FIFO_INSTANCE(USARTx) can be used to check whether or not FIFO mode feature is supported by the USARTx instance. PRESC PRESCALER LL_USART_SetPrescaler
Parameters
USARTxUSART Instance
PrescalerValueThis parameter can be one of the following values:
  • LL_USART_PRESCALER_DIV1
  • LL_USART_PRESCALER_DIV2
  • LL_USART_PRESCALER_DIV4
  • LL_USART_PRESCALER_DIV6
  • LL_USART_PRESCALER_DIV8
  • LL_USART_PRESCALER_DIV10
  • LL_USART_PRESCALER_DIV12
  • LL_USART_PRESCALER_DIV16
  • LL_USART_PRESCALER_DIV32
  • LL_USART_PRESCALER_DIV64
  • LL_USART_PRESCALER_DIV128
  • LL_USART_PRESCALER_DIV256
Return values
None

Definition at line 1312 of file stm32l4xx_ll_usart.h.

1313 {
1314  MODIFY_REG(USARTx->PRESC, USART_PRESC_PRESCALER, (uint16_t)PrescalerValue);
1315 }
MODIFY_REG(hrtc->Instance->CR, RTC_CR_WUCKSEL,(uint32_t) WakeUpClock)

◆ LL_USART_SetRXFIFOThreshold()

__STATIC_INLINE void LL_USART_SetRXFIFOThreshold ( USART_TypeDef *  USARTx,
uint32_t  Threshold 
)

Configure RX FIFO Threshold.

Note
Macro IS_UART_FIFO_INSTANCE(USARTx) can be used to check whether or not FIFO mode feature is supported by the USARTx instance. CR3 RXFTCFG LL_USART_SetRXFIFOThreshold
Parameters
USARTxUSART Instance
ThresholdThis parameter can be one of the following values:
  • LL_USART_FIFOTHRESHOLD_1_8
  • LL_USART_FIFOTHRESHOLD_1_4
  • LL_USART_FIFOTHRESHOLD_1_2
  • LL_USART_FIFOTHRESHOLD_3_4
  • LL_USART_FIFOTHRESHOLD_7_8
  • LL_USART_FIFOTHRESHOLD_8_8
Return values
None

Definition at line 806 of file stm32l4xx_ll_usart.h.

807 {
808  MODIFY_REG(USARTx->CR3, USART_CR3_RXFTCFG, Threshold << USART_CR3_RXFTCFG_Pos);
809 }
MODIFY_REG(hrtc->Instance->CR, RTC_CR_WUCKSEL,(uint32_t) WakeUpClock)

◆ LL_USART_SetRXPinLevel()

__STATIC_INLINE void LL_USART_SetRXPinLevel ( USART_TypeDef *  USARTx,
uint32_t  PinInvMethod 
)

Configure RX pin active level logic CR2 RXINV LL_USART_SetRXPinLevel.

Parameters
USARTxUSART Instance
PinInvMethodThis parameter can be one of the following values:
  • LL_USART_RXPIN_LEVEL_STANDARD
  • LL_USART_RXPIN_LEVEL_INVERTED
Return values
None

Definition at line 1483 of file stm32l4xx_ll_usart.h.

1484 {
1485  MODIFY_REG(USARTx->CR2, USART_CR2_RXINV, PinInvMethod);
1486 }
MODIFY_REG(hrtc->Instance->CR, RTC_CR_WUCKSEL,(uint32_t) WakeUpClock)

◆ LL_USART_SetStopBitsLength()

__STATIC_INLINE void LL_USART_SetStopBitsLength ( USART_TypeDef *  USARTx,
uint32_t  StopBits 
)

Set the length of the stop bits CR2 STOP LL_USART_SetStopBitsLength.

Parameters
USARTxUSART Instance
StopBitsThis parameter can be one of the following values:
  • LL_USART_STOPBITS_0_5
  • LL_USART_STOPBITS_1
  • LL_USART_STOPBITS_1_5
  • LL_USART_STOPBITS_2
Return values
None

Definition at line 1393 of file stm32l4xx_ll_usart.h.

1394 {
1395  MODIFY_REG(USARTx->CR2, USART_CR2_STOP, StopBits);
1396 }
MODIFY_REG(hrtc->Instance->CR, RTC_CR_WUCKSEL,(uint32_t) WakeUpClock)

◆ LL_USART_SetTransferBitOrder()

__STATIC_INLINE void LL_USART_SetTransferBitOrder ( USART_TypeDef *  USARTx,
uint32_t  BitOrder 
)

Configure transfer bit order (either Less or Most Significant Bit First)

Note
MSB First means data is transmitted/received with the MSB first, following the start bit. LSB First means data is transmitted/received with data bit 0 first, following the start bit. CR2 MSBFIRST LL_USART_SetTransferBitOrder
Parameters
USARTxUSART Instance
BitOrderThis parameter can be one of the following values:
  • LL_USART_BITORDER_LSBFIRST
  • LL_USART_BITORDER_MSBFIRST
Return values
None

Definition at line 1568 of file stm32l4xx_ll_usart.h.

1569 {
1570  MODIFY_REG(USARTx->CR2, USART_CR2_MSBFIRST, BitOrder);
1571 }
MODIFY_REG(hrtc->Instance->CR, RTC_CR_WUCKSEL,(uint32_t) WakeUpClock)

◆ LL_USART_SetTransferDirection()

__STATIC_INLINE void LL_USART_SetTransferDirection ( USART_TypeDef *  USARTx,
uint32_t  TransferDirection 
)

Configure simultaneously enabled/disabled states of Transmitter and Receiver CR1 RE LL_USART_SetTransferDirection
CR1 TE LL_USART_SetTransferDirection.

Parameters
USARTxUSART Instance
TransferDirectionThis parameter can be one of the following values:
  • LL_USART_DIRECTION_NONE
  • LL_USART_DIRECTION_RX
  • LL_USART_DIRECTION_TX
  • LL_USART_DIRECTION_TX_RX
Return values
None

Definition at line 995 of file stm32l4xx_ll_usart.h.

996 {
997  MODIFY_REG(USARTx->CR1, USART_CR1_RE | USART_CR1_TE, TransferDirection);
998 }
MODIFY_REG(hrtc->Instance->CR, RTC_CR_WUCKSEL,(uint32_t) WakeUpClock)

◆ LL_USART_SetTXFIFOThreshold()

__STATIC_INLINE void LL_USART_SetTXFIFOThreshold ( USART_TypeDef *  USARTx,
uint32_t  Threshold 
)

Configure TX FIFO Threshold.

Note
Macro IS_UART_FIFO_INSTANCE(USARTx) can be used to check whether or not FIFO mode feature is supported by the USARTx instance. CR3 TXFTCFG LL_USART_SetTXFIFOThreshold
Parameters
USARTxUSART Instance
ThresholdThis parameter can be one of the following values:
  • LL_USART_FIFOTHRESHOLD_1_8
  • LL_USART_FIFOTHRESHOLD_1_4
  • LL_USART_FIFOTHRESHOLD_1_2
  • LL_USART_FIFOTHRESHOLD_3_4
  • LL_USART_FIFOTHRESHOLD_7_8
  • LL_USART_FIFOTHRESHOLD_8_8
Return values
None

Definition at line 767 of file stm32l4xx_ll_usart.h.

768 {
769  MODIFY_REG(USARTx->CR3, USART_CR3_TXFTCFG, Threshold << USART_CR3_TXFTCFG_Pos);
770 }
MODIFY_REG(hrtc->Instance->CR, RTC_CR_WUCKSEL,(uint32_t) WakeUpClock)

◆ LL_USART_SetTXPinLevel()

__STATIC_INLINE void LL_USART_SetTXPinLevel ( USART_TypeDef *  USARTx,
uint32_t  PinInvMethod 
)

Configure TX pin active level logic CR2 TXINV LL_USART_SetTXPinLevel.

Parameters
USARTxUSART Instance
PinInvMethodThis parameter can be one of the following values:
  • LL_USART_TXPIN_LEVEL_STANDARD
  • LL_USART_TXPIN_LEVEL_INVERTED
Return values
None

Definition at line 1510 of file stm32l4xx_ll_usart.h.

1511 {
1512  MODIFY_REG(USARTx->CR2, USART_CR2_TXINV, PinInvMethod);
1513 }
MODIFY_REG(hrtc->Instance->CR, RTC_CR_WUCKSEL,(uint32_t) WakeUpClock)

◆ LL_USART_SetTXRXSwap()

__STATIC_INLINE void LL_USART_SetTXRXSwap ( USART_TypeDef *  USARTx,
uint32_t  SwapConfig 
)

Configure TX/RX pins swapping setting. CR2 SWAP LL_USART_SetTXRXSwap.

Parameters
USARTxUSART Instance
SwapConfigThis parameter can be one of the following values:
  • LL_USART_TXRX_STANDARD
  • LL_USART_TXRX_SWAPPED
Return values
None

Definition at line 1456 of file stm32l4xx_ll_usart.h.

1457 {
1458  MODIFY_REG(USARTx->CR2, USART_CR2_SWAP, SwapConfig);
1459 }
MODIFY_REG(hrtc->Instance->CR, RTC_CR_WUCKSEL,(uint32_t) WakeUpClock)

◆ LL_USART_SetWakeUpMethod()

__STATIC_INLINE void LL_USART_SetWakeUpMethod ( USART_TypeDef *  USARTx,
uint32_t  Method 
)

Set Receiver Wake Up method from Mute mode. CR1 WAKE LL_USART_SetWakeUpMethod.

Parameters
USARTxUSART Instance
MethodThis parameter can be one of the following values:
  • LL_USART_WAKEUP_IDLELINE
  • LL_USART_WAKEUP_ADDRESSMARK
Return values
None

Definition at line 1059 of file stm32l4xx_ll_usart.h.

1060 {
1061  MODIFY_REG(USARTx->CR1, USART_CR1_WAKE, Method);
1062 }
MODIFY_REG(hrtc->Instance->CR, RTC_CR_WUCKSEL,(uint32_t) WakeUpClock)

◆ LL_USART_SetWKUPType()

__STATIC_INLINE void LL_USART_SetWKUPType ( USART_TypeDef *  USARTx,
uint32_t  Type 
)

Select event type for Wake UP Interrupt Flag (WUS[1:0] bits)

Note
Macro IS_UART_WAKEUP_FROMSTOP_INSTANCE(USARTx) can be used to check whether or not Wake-up from Stop mode feature is supported by the USARTx instance. CR3 WUS LL_USART_SetWKUPType
Parameters
USARTxUSART Instance
TypeThis parameter can be one of the following values:
  • LL_USART_WAKEUP_ON_ADDRESS
  • LL_USART_WAKEUP_ON_STARTBIT
  • LL_USART_WAKEUP_ON_RXNE
Return values
None

Definition at line 1919 of file stm32l4xx_ll_usart.h.

1920 {
1921  MODIFY_REG(USARTx->CR3, USART_CR3_WUS, Type);
1922 }
MODIFY_REG(hrtc->Instance->CR, RTC_CR_WUCKSEL,(uint32_t) WakeUpClock)

◆ LL_USART_StructInit()

void LL_USART_StructInit ( LL_USART_InitTypeDef USART_InitStruct)

Set each LL_USART_InitTypeDef field to default value.

Parameters
USART_InitStructpointer to a LL_USART_InitTypeDef structure whose fields will be set to default values.
Return values
None

Definition at line 348 of file stm32l4xx_ll_usart.c.

349 {
350  /* Set USART_InitStruct fields to default values */
351 #if defined(USART_PRESC_PRESCALER)
352  USART_InitStruct->PrescalerValue = LL_USART_PRESCALER_DIV1;
353 #endif /* USART_PRESC_PRESCALER */
354  USART_InitStruct->BaudRate = 9600U;
355  USART_InitStruct->DataWidth = LL_USART_DATAWIDTH_8B;
356  USART_InitStruct->StopBits = LL_USART_STOPBITS_1;
357  USART_InitStruct->Parity = LL_USART_PARITY_NONE ;
358  USART_InitStruct->TransferDirection = LL_USART_DIRECTION_TX_RX;
359  USART_InitStruct->HardwareFlowControl = LL_USART_HWCONTROL_NONE;
360  USART_InitStruct->OverSampling = LL_USART_OVERSAMPLING_16;
361 }

Variable Documentation

◆ BaudRate

__STATIC_INLINE void uint32_t uint32_t uint32_t BaudRate
Initial value:
{
uint32_t usartdiv

Definition at line 1979 of file stm32l4xx_ll_usart.h.

◆ brrtemp

register uint32_t brrtemp

Definition at line 1981 of file stm32l4xx_ll_usart.h.

◆ OverSampling

__STATIC_INLINE void uint32_t uint32_t OverSampling

Definition at line 1976 of file stm32l4xx_ll_usart.h.

◆ PeriphClk

__STATIC_INLINE void uint32_t PeriphClk

Definition at line 1976 of file stm32l4xx_ll_usart.h.