Arrow / Mbed OS DAPLink Reset
Embed: (wiki syntax)

« Back to documentation index

IO operation functions

IO operation functions
[UART Exported Functions]

UART Transmit and Receive functions. More...

Functions

HAL_StatusTypeDef HAL_UART_Transmit (UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size, uint32_t Timeout)
 Sends an amount of data in blocking mode.
HAL_StatusTypeDef HAL_UART_Receive (UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size, uint32_t Timeout)
 Receives an amount of data in blocking mode.
HAL_StatusTypeDef HAL_UART_Transmit_IT (UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size)
 Sends an amount of data in non blocking mode.
HAL_StatusTypeDef HAL_UART_Receive_IT (UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size)
 Receives an amount of data in non blocking mode.
HAL_StatusTypeDef HAL_UART_Transmit_DMA (UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size)
 Sends an amount of data in non blocking mode.
HAL_StatusTypeDef HAL_UART_Receive_DMA (UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size)
 Receives an amount of data in non blocking mode.
HAL_StatusTypeDef HAL_UART_DMAPause (UART_HandleTypeDef *huart)
 Pauses the DMA Transfer.
HAL_StatusTypeDef HAL_UART_DMAResume (UART_HandleTypeDef *huart)
 Resumes the DMA Transfer.
HAL_StatusTypeDef HAL_UART_DMAStop (UART_HandleTypeDef *huart)
 Stops the DMA Transfer.
void HAL_UART_IRQHandler (UART_HandleTypeDef *huart)
 This function handles UART interrupt request.
__weak void HAL_UART_TxCpltCallback (UART_HandleTypeDef *huart)
 Tx Transfer completed callbacks.
__weak void HAL_UART_TxHalfCpltCallback (UART_HandleTypeDef *huart)
 Tx Half Transfer completed callbacks.
__weak void HAL_UART_RxCpltCallback (UART_HandleTypeDef *huart)
 Rx Transfer completed callbacks.
__weak void HAL_UART_RxHalfCpltCallback (UART_HandleTypeDef *huart)
 Rx Half Transfer completed callbacks.
__weak void HAL_UART_ErrorCallback (UART_HandleTypeDef *huart)
 UART error callbacks.

Detailed Description

UART Transmit and Receive functions.

  ==============================================================================
                      ##### IO operation functions #####
  ==============================================================================  
  [..]
    This subsection provides a set of functions allowing to manage the UART asynchronous
    and Half duplex data transfers.

    (#) There are two modes of transfer:
       (++) Blocking mode: The communication is performed in polling mode. 
            The HAL status of all data processing is returned by the same function 
            after finishing transfer.  
       (++) Non blocking mode: The communication is performed using Interrupts 
            or DMA, these APIs return the HAL status.
            The end of the data processing will be indicated through the 
            dedicated UART IRQ when using Interrupt mode or the DMA IRQ when 
            using DMA mode.
            The HAL_UART_TxCpltCallback(), HAL_UART_RxCpltCallback() user callbacks 
            will be executed respectively at the end of the transmit or receive process.
            The HAL_UART_ErrorCallback() user callback will be executed when 
            a communication error is detected.

    (#) Blocking mode APIs are:
        (++) HAL_UART_Transmit()
        (++) HAL_UART_Receive() 

    (#) Non Blocking mode APIs with Interrupt are:
        (++) HAL_UART_Transmit_IT()
        (++) HAL_UART_Receive_IT()
        (++) HAL_UART_IRQHandler()

    (#) Non Blocking mode functions with DMA are:
        (++) HAL_UART_Transmit_DMA()
        (++) HAL_UART_Receive_DMA()
        (++) HAL_UART_DMAPause()
        (++) HAL_UART_DMAResume()
        (++) HAL_UART_DMAStop()

    (#) A set of Transfer Complete Callbacks are provided in non blocking mode:
        (++) HAL_UART_TxHalfCpltCallback()
        (++) HAL_UART_TxCpltCallback()
        (++) HAL_UART_RxHalfCpltCallback()
        (++) HAL_UART_RxCpltCallback()
        (++) HAL_UART_ErrorCallback()

    [..] 
      (@) In the Half duplex communication, it is forbidden to run the transmit 
          and receive process in parallel, the UART state HAL_UART_STATE_BUSY_TX_RX 
          can't be useful.
      

Function Documentation

HAL_StatusTypeDef HAL_UART_DMAPause ( UART_HandleTypeDef *  huart )

Pauses the DMA Transfer.

Parameters:
huart,:Pointer to a UART_HandleTypeDef structure that contains the configuration information for the specified UART module.
Return values:
HALstatus

Definition at line 1072 of file stm32f1xx_hal_uart.c.

HAL_StatusTypeDef HAL_UART_DMAResume ( UART_HandleTypeDef *  huart )

Resumes the DMA Transfer.

Parameters:
huart,:Pointer to a UART_HandleTypeDef structure that contains the configuration information for the specified UART module.
Return values:
HALstatus

Definition at line 1112 of file stm32f1xx_hal_uart.c.

HAL_StatusTypeDef HAL_UART_DMAStop ( UART_HandleTypeDef *  huart )

Stops the DMA Transfer.

Parameters:
huart,:Pointer to a UART_HandleTypeDef structure that contains the configuration information for the specified UART module.
Return values:
HALstatus

Definition at line 1156 of file stm32f1xx_hal_uart.c.

__weak void HAL_UART_ErrorCallback ( UART_HandleTypeDef *  huart )

UART error callbacks.

Parameters:
huart,:Pointer to a UART_HandleTypeDef structure that contains the configuration information for the specified UART module.
Return values:
None

Definition at line 1325 of file stm32f1xx_hal_uart.c.

void HAL_UART_IRQHandler ( UART_HandleTypeDef *  huart )

This function handles UART interrupt request.

Parameters:
huart,:Pointer to a UART_HandleTypeDef structure that contains the configuration information for the specified UART module.
Return values:
None

Definition at line 1189 of file stm32f1xx_hal_uart.c.

HAL_StatusTypeDef HAL_UART_Receive ( UART_HandleTypeDef *  huart,
uint8_t *  pData,
uint16_t  Size,
uint32_t  Timeout 
)

Receives an amount of data in blocking mode.

Parameters:
huart,:Pointer to a UART_HandleTypeDef structure that contains the configuration information for the specified UART module.
pData,:Pointer to data buffer
Size,:Amount of data to be received
Timeout,:Timeout duration
Return values:
HALstatus

Definition at line 727 of file stm32f1xx_hal_uart.c.

HAL_StatusTypeDef HAL_UART_Receive_DMA ( UART_HandleTypeDef *  huart,
uint8_t *  pData,
uint16_t  Size 
)

Receives an amount of data in non blocking mode.

Parameters:
huart,:Pointer to a UART_HandleTypeDef structure that contains the configuration information for the specified UART module.
pData,:Pointer to data buffer
Size,:Amount of data to be received
Note:
When the UART parity is enabled (PCE = 1), the received data contain the parity bit (MSB position)
Return values:
HALstatus

Definition at line 1008 of file stm32f1xx_hal_uart.c.

HAL_StatusTypeDef HAL_UART_Receive_IT ( UART_HandleTypeDef *  huart,
uint8_t *  pData,
uint16_t  Size 
)

Receives an amount of data in non blocking mode.

Parameters:
huart,:Pointer to a UART_HandleTypeDef structure that contains the configuration information for the specified UART module.
pData,:Pointer to data buffer
Size,:Amount of data to be received
Return values:
HALstatus

Definition at line 878 of file stm32f1xx_hal_uart.c.

__weak void HAL_UART_RxCpltCallback ( UART_HandleTypeDef *  huart )

Rx Transfer completed callbacks.

Parameters:
huart,:Pointer to a UART_HandleTypeDef structure that contains the configuration information for the specified UART module.
Return values:
None

Definition at line 1295 of file stm32f1xx_hal_uart.c.

__weak void HAL_UART_RxHalfCpltCallback ( UART_HandleTypeDef *  huart )

Rx Half Transfer completed callbacks.

Parameters:
huart,:Pointer to a UART_HandleTypeDef structure that contains the configuration information for the specified UART module.
Return values:
None

Definition at line 1310 of file stm32f1xx_hal_uart.c.

HAL_StatusTypeDef HAL_UART_Transmit ( UART_HandleTypeDef *  huart,
uint8_t *  pData,
uint16_t  Size,
uint32_t  Timeout 
)

Sends an amount of data in blocking mode.

Parameters:
huart,:Pointer to a UART_HandleTypeDef structure that contains the configuration information for the specified UART module.
pData,:Pointer to data buffer
Size,:Amount of data to be sent
Timeout,:Timeout duration
Return values:
HALstatus

Definition at line 633 of file stm32f1xx_hal_uart.c.

HAL_StatusTypeDef HAL_UART_Transmit_DMA ( UART_HandleTypeDef *  huart,
uint8_t *  pData,
uint16_t  Size 
)

Sends an amount of data in non blocking mode.

Parameters:
huart,:Pointer to a UART_HandleTypeDef structure that contains the configuration information for the specified UART module.
pData,:Pointer to data buffer
Size,:Amount of data to be sent
Return values:
HALstatus

Definition at line 936 of file stm32f1xx_hal_uart.c.

HAL_StatusTypeDef HAL_UART_Transmit_IT ( UART_HandleTypeDef *  huart,
uint8_t *  pData,
uint16_t  Size 
)

Sends an amount of data in non blocking mode.

Parameters:
huart,:Pointer to a UART_HandleTypeDef structure that contains the configuration information for the specified UART module.
pData,:Pointer to data buffer
Size,:Amount of data to be sent
Return values:
HALstatus

Definition at line 826 of file stm32f1xx_hal_uart.c.

__weak void HAL_UART_TxCpltCallback ( UART_HandleTypeDef *  huart )

Tx Transfer completed callbacks.

Parameters:
huart,:Pointer to a UART_HandleTypeDef structure that contains the configuration information for the specified UART module.
Return values:
None

Definition at line 1265 of file stm32f1xx_hal_uart.c.

__weak void HAL_UART_TxHalfCpltCallback ( UART_HandleTypeDef *  huart )

Tx Half Transfer completed callbacks.

Parameters:
huart,:Pointer to a UART_HandleTypeDef structure that contains the configuration information for the specified UART module.
Return values:
None

Definition at line 1280 of file stm32f1xx_hal_uart.c.