STM32L4xx_HAL_Driver  1.14.0
Peripheral Control functions

UART control functions. More...

Functions

HAL_StatusTypeDef HAL_LIN_SendBreak (UART_HandleTypeDef *huart)
 Transmit break characters. More...
 
HAL_StatusTypeDef HAL_MultiProcessor_EnableMuteMode (UART_HandleTypeDef *huart)
 Enable UART in mute mode (does not mean UART enters mute mode; to enter mute mode, HAL_MultiProcessor_EnterMuteMode() API must be called). More...
 
HAL_StatusTypeDef HAL_MultiProcessor_DisableMuteMode (UART_HandleTypeDef *huart)
 Disable UART mute mode (does not mean the UART actually exits mute mode as it may not have been in mute mode at this very moment). More...
 
void HAL_MultiProcessor_EnterMuteMode (UART_HandleTypeDef *huart)
 Enter UART mute mode (means UART actually enters mute mode). More...
 
HAL_StatusTypeDef HAL_HalfDuplex_EnableTransmitter (UART_HandleTypeDef *huart)
 Enable the UART transmitter and disable the UART receiver. More...
 
HAL_StatusTypeDef HAL_HalfDuplex_EnableReceiver (UART_HandleTypeDef *huart)
 Enable the UART receiver and disable the UART transmitter. More...
 

Detailed Description

UART control functions.

 ===============================================================================
                      ##### Peripheral Control functions #####
 ===============================================================================
    [..]
    This subsection provides a set of functions allowing to control the UART.
     (+) HAL_MultiProcessor_EnableMuteMode() API enables mute mode
     (+) HAL_MultiProcessor_DisableMuteMode() API disables mute mode
     (+) HAL_MultiProcessor_EnterMuteMode() API enters mute mode
     (+) UART_SetConfig() API configures the UART peripheral
     (+) UART_AdvFeatureConfig() API optionally configures the UART advanced features
     (+) UART_CheckIdleState() API ensures that TEACK and/or REACK are set after initialization
     (+) HAL_HalfDuplex_EnableTransmitter() API disables receiver and enables transmitter
     (+) HAL_HalfDuplex_EnableReceiver() API disables transmitter and enables receiver
     (+) HAL_LIN_SendBreak() API transmits the break characters

Function Documentation

◆ HAL_HalfDuplex_EnableReceiver()

HAL_StatusTypeDef HAL_HalfDuplex_EnableReceiver ( UART_HandleTypeDef huart)

Enable the UART receiver and disable the UART transmitter.

Parameters
huartUART handle.
Return values
HALstatus.

Definition at line 2719 of file stm32l4xx_hal_uart.c.

2720 {
2721  __HAL_LOCK(huart);
2722  huart->gState = HAL_UART_STATE_BUSY;
2723 
2724  /* Clear TE and RE bits */
2725  CLEAR_BIT(huart->Instance->CR1, (USART_CR1_TE | USART_CR1_RE));
2726 
2727  /* Enable the USART's receive interface by setting the RE bit in the USART CR1 register */
2728  SET_BIT(huart->Instance->CR1, USART_CR1_RE);
2729 
2730  huart->gState = HAL_UART_STATE_READY;
2731 
2732  __HAL_UNLOCK(huart);
2733 
2734  return HAL_OK;
2735 }
__HAL_UNLOCK(hrtc)
CLEAR_BIT(hrtc->Instance->CR, RTC_CR_WUTE)
__HAL_LOCK(hrtc)
return HAL_OK
USART_TypeDef * Instance
__IO HAL_UART_StateTypeDef gState

◆ HAL_HalfDuplex_EnableTransmitter()

HAL_StatusTypeDef HAL_HalfDuplex_EnableTransmitter ( UART_HandleTypeDef huart)

Enable the UART transmitter and disable the UART receiver.

Parameters
huartUART handle.
Return values
HALstatus

Definition at line 2696 of file stm32l4xx_hal_uart.c.

2697 {
2698  __HAL_LOCK(huart);
2699  huart->gState = HAL_UART_STATE_BUSY;
2700 
2701  /* Clear TE and RE bits */
2702  CLEAR_BIT(huart->Instance->CR1, (USART_CR1_TE | USART_CR1_RE));
2703 
2704  /* Enable the USART's transmit interface by setting the TE bit in the USART CR1 register */
2705  SET_BIT(huart->Instance->CR1, USART_CR1_TE);
2706 
2707  huart->gState = HAL_UART_STATE_READY;
2708 
2709  __HAL_UNLOCK(huart);
2710 
2711  return HAL_OK;
2712 }
__HAL_UNLOCK(hrtc)
CLEAR_BIT(hrtc->Instance->CR, RTC_CR_WUTE)
__HAL_LOCK(hrtc)
return HAL_OK
USART_TypeDef * Instance
__IO HAL_UART_StateTypeDef gState

◆ HAL_LIN_SendBreak()

HAL_StatusTypeDef HAL_LIN_SendBreak ( UART_HandleTypeDef huart)

Transmit break characters.

Parameters
huartUART handle.
Return values
HALstatus

Definition at line 2743 of file stm32l4xx_hal_uart.c.

2744 {
2745  /* Check the parameters */
2746  assert_param(IS_UART_LIN_INSTANCE(huart->Instance));
2747 
2748  __HAL_LOCK(huart);
2749 
2750  huart->gState = HAL_UART_STATE_BUSY;
2751 
2752  /* Send break characters */
2753  __HAL_UART_SEND_REQ(huart, UART_SENDBREAK_REQUEST);
2754 
2755  huart->gState = HAL_UART_STATE_READY;
2756 
2757  __HAL_UNLOCK(huart);
2758 
2759  return HAL_OK;
2760 }
__HAL_UNLOCK(hrtc)
__HAL_LOCK(hrtc)
return HAL_OK
USART_TypeDef * Instance
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))
__IO HAL_UART_StateTypeDef gState

◆ HAL_MultiProcessor_DisableMuteMode()

HAL_StatusTypeDef HAL_MultiProcessor_DisableMuteMode ( UART_HandleTypeDef huart)

Disable UART mute mode (does not mean the UART actually exits mute mode as it may not have been in mute mode at this very moment).

Parameters
huartUART handle.
Return values
HALstatus

Definition at line 2666 of file stm32l4xx_hal_uart.c.

2667 {
2668  __HAL_LOCK(huart);
2669 
2670  huart->gState = HAL_UART_STATE_BUSY;
2671 
2672  /* Disable USART mute mode by clearing the MME bit in the CR1 register */
2673  CLEAR_BIT(huart->Instance->CR1, USART_CR1_MME);
2674 
2675  huart->gState = HAL_UART_STATE_READY;
2676 
2677  return (UART_CheckIdleState(huart));
2678 }
HAL_StatusTypeDef UART_CheckIdleState(UART_HandleTypeDef *huart)
Check the UART Idle State.
CLEAR_BIT(hrtc->Instance->CR, RTC_CR_WUTE)
__HAL_LOCK(hrtc)
USART_TypeDef * Instance
__IO HAL_UART_StateTypeDef gState

◆ HAL_MultiProcessor_EnableMuteMode()

HAL_StatusTypeDef HAL_MultiProcessor_EnableMuteMode ( UART_HandleTypeDef huart)

Enable UART in mute mode (does not mean UART enters mute mode; to enter mute mode, HAL_MultiProcessor_EnterMuteMode() API must be called).

Parameters
huartUART handle.
Return values
HALstatus

Definition at line 2646 of file stm32l4xx_hal_uart.c.

2647 {
2648  __HAL_LOCK(huart);
2649 
2650  huart->gState = HAL_UART_STATE_BUSY;
2651 
2652  /* Enable USART mute mode by setting the MME bit in the CR1 register */
2653  SET_BIT(huart->Instance->CR1, USART_CR1_MME);
2654 
2655  huart->gState = HAL_UART_STATE_READY;
2656 
2657  return (UART_CheckIdleState(huart));
2658 }
HAL_StatusTypeDef UART_CheckIdleState(UART_HandleTypeDef *huart)
Check the UART Idle State.
__HAL_LOCK(hrtc)
USART_TypeDef * Instance
__IO HAL_UART_StateTypeDef gState

◆ HAL_MultiProcessor_EnterMuteMode()

void HAL_MultiProcessor_EnterMuteMode ( UART_HandleTypeDef huart)

Enter UART mute mode (means UART actually enters mute mode).

Note
To exit from mute mode, HAL_MultiProcessor_DisableMuteMode() API must be called.
Parameters
huartUART handle.
Return values
None

Definition at line 2686 of file stm32l4xx_hal_uart.c.

2687 {
2688  __HAL_UART_SEND_REQ(huart, UART_MUTE_MODE_REQUEST);
2689 }