STM32L4xx_HAL_Driver  1.14.0
UARTEx Private Functions

Functions

static void UARTEx_Wakeup_AddressConfig (UART_HandleTypeDef *huart, UART_WakeUpTypeDef WakeUpSelection)
 Initialize the UART wake-up from stop mode parameters when triggered by address detection. More...
 
static void UARTEx_SetNbDataToProcess (UART_HandleTypeDef *huart)
 Calculate the number of data to process in RX/TX ISR. More...
 

Detailed Description

Function Documentation

◆ UARTEx_SetNbDataToProcess()

static void UARTEx_SetNbDataToProcess ( UART_HandleTypeDef huart)
static

Calculate the number of data to process in RX/TX ISR.

Note
The RX FIFO depth and the TX FIFO depth is extracted from the UART configuration registers.
Parameters
huartUART handle.
Return values
None

Definition at line 748 of file stm32l4xx_hal_uart_ex.c.

749 {
750  uint8_t rx_fifo_depth;
751  uint8_t tx_fifo_depth;
752  uint8_t rx_fifo_threshold;
753  uint8_t tx_fifo_threshold;
754  uint8_t numerator[] = {1U, 1U, 1U, 3U, 7U, 1U, 0U, 0U};
755  uint8_t denominator[] = {8U, 4U, 2U, 4U, 8U, 1U, 1U, 1U};
756 
757  if (huart->FifoMode == UART_FIFOMODE_DISABLE)
758  {
759  huart->NbTxDataToProcess = 1U;
760  huart->NbRxDataToProcess = 1U;
761  }
762  else
763  {
764  rx_fifo_depth = RX_FIFO_DEPTH;
765  tx_fifo_depth = TX_FIFO_DEPTH;
766  rx_fifo_threshold = (uint8_t)(READ_BIT(huart->Instance->CR3, USART_CR3_RXFTCFG) >> USART_CR3_RXFTCFG_Pos);
767  tx_fifo_threshold = (uint8_t)(READ_BIT(huart->Instance->CR3, USART_CR3_TXFTCFG) >> USART_CR3_TXFTCFG_Pos);
768  huart->NbTxDataToProcess = ((uint16_t)tx_fifo_depth * numerator[tx_fifo_threshold]) / (uint16_t)denominator[tx_fifo_threshold];
769  huart->NbRxDataToProcess = ((uint16_t)rx_fifo_depth * numerator[rx_fifo_threshold]) / (uint16_t)denominator[rx_fifo_threshold];
770  }
771 }
USART_TypeDef * Instance

◆ UARTEx_Wakeup_AddressConfig()

static void UARTEx_Wakeup_AddressConfig ( UART_HandleTypeDef huart,
UART_WakeUpTypeDef  WakeUpSelection 
)
static

Initialize the UART wake-up from stop mode parameters when triggered by address detection.

Parameters
huartUART handle.
WakeUpSelectionUART wake up from stop mode parameters.
Return values
None

Definition at line 729 of file stm32l4xx_hal_uart_ex.c.

730 {
731  assert_param(IS_UART_ADDRESSLENGTH_DETECT(WakeUpSelection.AddressLength));
732 
733  /* Set the USART address length */
734  MODIFY_REG(huart->Instance->CR2, USART_CR2_ADDM7, WakeUpSelection.AddressLength);
735 
736  /* Set the USART address node */
737  MODIFY_REG(huart->Instance->CR2, USART_CR2_ADD, ((uint32_t)WakeUpSelection.Address << UART_CR2_ADDRESS_LSB_POS));
738 }
USART_TypeDef * Instance
MODIFY_REG(hrtc->Instance->CR, RTC_CR_WUCKSEL,(uint32_t) WakeUpClock)
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))