STM32F4xx_HAL_Driver  1.8.3
USART Initialization and de-initialization functions

Initialization and Configuration functions. More...

+ Collaboration diagram for USART Initialization and de-initialization functions:

Functions

HAL_StatusTypeDef HAL_USART_Init (USART_HandleTypeDef *husart)
 Initialize the USART mode according to the specified parameters in the USART_InitTypeDef and initialize the associated handle. More...
 
HAL_StatusTypeDef HAL_USART_DeInit (USART_HandleTypeDef *husart)
 DeInitializes the USART peripheral. More...
 
void HAL_USART_MspInit (USART_HandleTypeDef *husart)
 USART MSP Init. More...
 
void HAL_USART_MspDeInit (USART_HandleTypeDef *husart)
 USART MSP DeInit. More...
 
HAL_StatusTypeDef HAL_USART_RegisterCallback (USART_HandleTypeDef *husart, HAL_USART_CallbackIDTypeDef CallbackID, pUSART_CallbackTypeDef pCallback)
 
HAL_StatusTypeDef HAL_USART_UnRegisterCallback (USART_HandleTypeDef *husart, HAL_USART_CallbackIDTypeDef CallbackID)
 Unregister an USART Callback USART callaback is redirected to the weak predefined callback. More...
 

Detailed Description

Initialization and Configuration functions.

  ==============================================================================
              ##### Initialization and Configuration functions #####
  ==============================================================================
  [..]
  This subsection provides a set of functions allowing to initialize the USART
  in asynchronous and in synchronous modes.
  (+) For the asynchronous mode only these parameters can be configured:
      (++) Baud Rate
      (++) Word Length
      (++) Stop Bit
      (++) Parity: If the parity is enabled, then the MSB bit of the data written
           in the data register is transmitted but is changed by the parity bit.
           Depending on the frame length defined by the M bit (8-bits or 9-bits),
           please refer to Reference manual for possible USART frame formats.
      (++) USART polarity
      (++) USART phase
      (++) USART LastBit
      (++) Receiver/transmitter modes

  [..]
    The HAL_USART_Init() function follows the USART  synchronous configuration
    procedures (details for the procedures are available in reference manual
    (RM0430 for STM32F4X3xx MCUs and RM0402 for STM32F412xx MCUs
     RM0383 for STM32F411xC/E MCUs and RM0401 for STM32F410xx MCUs
     RM0090 for STM32F4X5xx/STM32F4X7xx/STM32F429xx/STM32F439xx MCUs
     RM0390 for STM32F446xx MCUs and RM0386 for STM32F469xx/STM32F479xx MCUs)).

Function Documentation

◆ HAL_USART_DeInit()

HAL_StatusTypeDef HAL_USART_DeInit ( USART_HandleTypeDef husart)

DeInitializes the USART peripheral.

Parameters
husartPointer to a USART_HandleTypeDef structure that contains the configuration information for the specified USART module.
Return values
HALstatus

Definition at line 359 of file stm32f4xx_hal_usart.c.

◆ HAL_USART_Init()

HAL_StatusTypeDef HAL_USART_Init ( USART_HandleTypeDef husart)

Initialize the USART mode according to the specified parameters in the USART_InitTypeDef and initialize the associated handle.

Parameters
husartPointer to a USART_HandleTypeDef structure that contains the configuration information for the specified USART module.
Return values
HALstatus

Definition at line 300 of file stm32f4xx_hal_usart.c.

◆ HAL_USART_MspDeInit()

__weak void HAL_USART_MspDeInit ( USART_HandleTypeDef husart)

USART MSP DeInit.

Parameters
husartPointer to a USART_HandleTypeDef structure that contains the configuration information for the specified USART module.
Return values
None

Definition at line 417 of file stm32f4xx_hal_usart.c.

◆ HAL_USART_MspInit()

__weak void HAL_USART_MspInit ( USART_HandleTypeDef husart)

USART MSP Init.

Parameters
husartPointer to a USART_HandleTypeDef structure that contains the configuration information for the specified USART module.
Return values
None

Definition at line 402 of file stm32f4xx_hal_usart.c.

◆ HAL_USART_RegisterCallback()

HAL_StatusTypeDef HAL_USART_RegisterCallback ( USART_HandleTypeDef husart,
HAL_USART_CallbackIDTypeDef  CallbackID,
pUSART_CallbackTypeDef  pCallback 
)
@brief  Register a User USART Callback
        To be used instead of the weak predefined callback
@note   The HAL_USART_RegisterCallback() may be called before HAL_USART_Init() in HAL_USART_STATE_RESET
        to register callbacks for HAL_USART_MSPINIT_CB_ID and HAL_USART_MSPDEINIT_CB_ID
@param  husart usart handle
@param  CallbackID ID of the callback to be registered
        This parameter can be one of the following values:
          @arg @ref HAL_USART_TX_HALFCOMPLETE_CB_ID Tx Half Complete Callback ID
          @arg @ref HAL_USART_TX_COMPLETE_CB_ID Tx Complete Callback ID
          @arg @ref HAL_USART_RX_HALFCOMPLETE_CB_ID Rx Half Complete Callback ID
          @arg @ref HAL_USART_RX_COMPLETE_CB_ID Rx Complete Callback ID
          @arg @ref HAL_USART_TX_RX_COMPLETE_CB_ID Rx Complete Callback ID
          @arg @ref HAL_USART_ERROR_CB_ID Error Callback ID
          @arg @ref HAL_USART_ABORT_COMPLETE_CB_ID Abort Complete Callback ID
          @arg @ref HAL_USART_MSPINIT_CB_ID MspInit Callback ID
          @arg @ref HAL_USART_MSPDEINIT_CB_ID MspDeInit Callback ID
@param  pCallback pointer to the Callback function
@retval HAL status

Definition at line 447 of file stm32f4xx_hal_usart.c.

◆ HAL_USART_UnRegisterCallback()

HAL_StatusTypeDef HAL_USART_UnRegisterCallback ( USART_HandleTypeDef husart,
HAL_USART_CallbackIDTypeDef  CallbackID 
)

Unregister an USART Callback USART callaback is redirected to the weak predefined callback.

Note
The HAL_USART_UnRegisterCallback() may be called before HAL_USART_Init() in HAL_USART_STATE_RESET to un-register callbacks for HAL_USART_MSPINIT_CB_ID and HAL_USART_MSPDEINIT_CB_ID
Parameters
husartusart handle
CallbackIDID of the callback to be unregistered This parameter can be one of the following values:
Return values
HALstatus

Definition at line 561 of file stm32f4xx_hal_usart.c.