STM32F103xB HAL User Manual
Functions
UART Private Functions
UART

Functions

void UART_InitCallbacksToDefault (UART_HandleTypeDef *huart)
 Initialize the callbacks to their default values.
static void UART_EndTxTransfer (UART_HandleTypeDef *huart)
 End ongoing Tx transfer on UART peripheral (following error detection or Transmit completion).
static void UART_EndRxTransfer (UART_HandleTypeDef *huart)
 End ongoing Rx transfer on UART peripheral (following error detection or Reception completion).
static void UART_DMATransmitCplt (DMA_HandleTypeDef *hdma)
 DMA UART transmit process complete callback.
static void UART_DMAReceiveCplt (DMA_HandleTypeDef *hdma)
 DMA UART receive process complete callback.
static void UART_DMATxHalfCplt (DMA_HandleTypeDef *hdma)
 DMA UART transmit process half complete callback.
static void UART_DMARxHalfCplt (DMA_HandleTypeDef *hdma)
 DMA UART receive process half complete callback.
static void UART_DMAError (DMA_HandleTypeDef *hdma)
 DMA UART communication error callback.
static void UART_DMAAbortOnError (DMA_HandleTypeDef *hdma)
 DMA UART communication abort callback, when initiated by HAL services on Error (To be called at end of DMA Abort procedure following error occurrence).
static void UART_DMATxAbortCallback (DMA_HandleTypeDef *hdma)
 DMA UART Tx communication abort callback, when initiated by user (To be called at end of DMA Tx Abort procedure following user abort request).
static void UART_DMARxAbortCallback (DMA_HandleTypeDef *hdma)
 DMA UART Rx communication abort callback, when initiated by user (To be called at end of DMA Rx Abort procedure following user abort request).
static void UART_DMATxOnlyAbortCallback (DMA_HandleTypeDef *hdma)
 DMA UART Tx communication abort callback, when initiated by user by a call to HAL_UART_AbortTransmit_IT API (Abort only Tx transfer) (This callback is executed at end of DMA Tx Abort procedure following user abort request, and leads to user Tx Abort Complete callback execution).
static void UART_DMARxOnlyAbortCallback (DMA_HandleTypeDef *hdma)
 DMA UART Rx communication abort callback, when initiated by user by a call to HAL_UART_AbortReceive_IT API (Abort only Rx transfer) (This callback is executed at end of DMA Rx Abort procedure following user abort request, and leads to user Rx Abort Complete callback execution).
static HAL_StatusTypeDef UART_Transmit_IT (UART_HandleTypeDef *huart)
 Sends an amount of data in non blocking mode.
static HAL_StatusTypeDef UART_EndTransmit_IT (UART_HandleTypeDef *huart)
 Wraps up transmission in non blocking mode.
static HAL_StatusTypeDef UART_Receive_IT (UART_HandleTypeDef *huart)
 Receives an amount of data in non blocking mode.
static HAL_StatusTypeDef UART_WaitOnFlagUntilTimeout (UART_HandleTypeDef *huart, uint32_t Flag, FlagStatus Status, uint32_t Tickstart, uint32_t Timeout)
 This function handles UART Communication Timeout.
static void UART_SetConfig (UART_HandleTypeDef *huart)
 Configures the UART peripheral.
HAL_StatusTypeDef UART_Start_Receive_IT (UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size)
 Start Receive operation in interrupt mode.
HAL_StatusTypeDef UART_Start_Receive_DMA (UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size)
 Start Receive operation in DMA mode.

Function Documentation

static void UART_DMAAbortOnError ( DMA_HandleTypeDef hdma) [static]

DMA UART communication abort callback, when initiated by HAL services on Error (To be called at end of DMA Abort procedure following error occurrence).

Parameters:
hdmaPointer to a DMA_HandleTypeDef structure that contains the configuration information for the specified DMA module.
Return values:
None

Definition at line 3328 of file stm32f1xx_hal_uart.c.

References __UART_HandleTypeDef::ErrorCallback, HAL_UART_ErrorCallback(), __TIM_HandleTypeDef::hdma, __UART_HandleTypeDef::RxXferCount, and __UART_HandleTypeDef::TxXferCount.

Referenced by HAL_UART_IRQHandler().

static void UART_DMAError ( DMA_HandleTypeDef hdma) [static]
static void UART_DMAReceiveCplt ( DMA_HandleTypeDef hdma) [static]
static void UART_DMARxAbortCallback ( DMA_HandleTypeDef hdma) [static]

DMA UART Rx communication abort callback, when initiated by user (To be called at end of DMA Rx Abort procedure following user abort request).

Note:
When this callback is executed, User Abort complete call back is called only if no Abort still ongoing for Tx DMA Handle.
Parameters:
hdmaPointer to a DMA_HandleTypeDef structure that contains the configuration information for the specified DMA module.
Return values:
None

Definition at line 3398 of file stm32f1xx_hal_uart.c.

References __UART_HandleTypeDef::AbortCpltCallback, __UART_HandleTypeDef::ErrorCode, __UART_HandleTypeDef::gState, HAL_UART_AbortCpltCallback(), HAL_UART_ERROR_NONE, HAL_UART_RECEPTION_STANDARD, HAL_UART_STATE_READY, __TIM_HandleTypeDef::hdma, __UART_HandleTypeDef::hdmarx, __UART_HandleTypeDef::hdmatx, __UART_HandleTypeDef::ReceptionType, __UART_HandleTypeDef::RxState, __UART_HandleTypeDef::RxXferCount, __UART_HandleTypeDef::TxXferCount, and __DMA_HandleTypeDef::XferAbortCallback.

Referenced by HAL_UART_Abort_IT().

static void UART_DMARxHalfCplt ( DMA_HandleTypeDef hdma) [static]

DMA UART receive process half complete callback.

Parameters:
hdmaPointer to a DMA_HandleTypeDef structure that contains the configuration information for the specified DMA module.
Return values:
None

Definition at line 3091 of file stm32f1xx_hal_uart.c.

References HAL_UART_RECEPTION_TOIDLE, HAL_UART_RxHalfCpltCallback(), HAL_UARTEx_RxEventCallback(), __TIM_HandleTypeDef::hdma, __UART_HandleTypeDef::ReceptionType, __UART_HandleTypeDef::RxEventCallback, __UART_HandleTypeDef::RxHalfCpltCallback, and __UART_HandleTypeDef::RxXferSize.

Referenced by UART_Start_Receive_DMA().

static void UART_DMARxOnlyAbortCallback ( DMA_HandleTypeDef hdma) [static]

DMA UART Rx communication abort callback, when initiated by user by a call to HAL_UART_AbortReceive_IT API (Abort only Rx transfer) (This callback is executed at end of DMA Rx Abort procedure following user abort request, and leads to user Rx Abort Complete callback execution).

Parameters:
hdmaPointer to a DMA_HandleTypeDef structure that contains the configuration information for the specified DMA module.
Return values:
None

Definition at line 3472 of file stm32f1xx_hal_uart.c.

References __UART_HandleTypeDef::AbortReceiveCpltCallback, HAL_UART_AbortReceiveCpltCallback(), HAL_UART_RECEPTION_STANDARD, HAL_UART_STATE_READY, __TIM_HandleTypeDef::hdma, __UART_HandleTypeDef::ReceptionType, __UART_HandleTypeDef::RxState, and __UART_HandleTypeDef::RxXferCount.

Referenced by HAL_UART_AbortReceive_IT().

static void UART_DMATransmitCplt ( DMA_HandleTypeDef hdma) [static]

DMA UART transmit process complete callback.

Parameters:
hdmaPointer to a DMA_HandleTypeDef structure that contains the configuration information for the specified DMA module.
Return values:
None

Definition at line 2980 of file stm32f1xx_hal_uart.c.

References HAL_UART_TxCpltCallback(), __TIM_HandleTypeDef::hdma, __DMA_HandleTypeDef::Instance, __UART_HandleTypeDef::Instance, __UART_HandleTypeDef::TxCpltCallback, and __UART_HandleTypeDef::TxXferCount.

Referenced by HAL_UART_Transmit_DMA().

static void UART_DMATxAbortCallback ( DMA_HandleTypeDef hdma) [static]

DMA UART Tx communication abort callback, when initiated by user (To be called at end of DMA Tx Abort procedure following user abort request).

Note:
When this callback is executed, User Abort complete call back is called only if no Abort still ongoing for Rx DMA Handle.
Parameters:
hdmaPointer to a DMA_HandleTypeDef structure that contains the configuration information for the specified DMA module.
Return values:
None

Definition at line 3352 of file stm32f1xx_hal_uart.c.

References __UART_HandleTypeDef::AbortCpltCallback, __UART_HandleTypeDef::ErrorCode, __UART_HandleTypeDef::gState, HAL_UART_AbortCpltCallback(), HAL_UART_ERROR_NONE, HAL_UART_RECEPTION_STANDARD, HAL_UART_STATE_READY, __TIM_HandleTypeDef::hdma, __UART_HandleTypeDef::hdmarx, __UART_HandleTypeDef::hdmatx, __UART_HandleTypeDef::ReceptionType, __UART_HandleTypeDef::RxState, __UART_HandleTypeDef::RxXferCount, __UART_HandleTypeDef::TxXferCount, and __DMA_HandleTypeDef::XferAbortCallback.

Referenced by HAL_UART_Abort_IT().

static void UART_DMATxHalfCplt ( DMA_HandleTypeDef hdma) [static]

DMA UART transmit process half complete callback.

Parameters:
hdmaPointer to a DMA_HandleTypeDef structure that contains the configuration information for the specified DMA module.
Return values:
None

Definition at line 3015 of file stm32f1xx_hal_uart.c.

References HAL_UART_TxHalfCpltCallback(), __TIM_HandleTypeDef::hdma, and __UART_HandleTypeDef::TxHalfCpltCallback.

Referenced by HAL_UART_Transmit_DMA().

static void UART_DMATxOnlyAbortCallback ( DMA_HandleTypeDef hdma) [static]

DMA UART Tx communication abort callback, when initiated by user by a call to HAL_UART_AbortTransmit_IT API (Abort only Tx transfer) (This callback is executed at end of DMA Tx Abort procedure following user abort request, and leads to user Tx Abort Complete callback execution).

Parameters:
hdmaPointer to a DMA_HandleTypeDef structure that contains the configuration information for the specified DMA module.
Return values:
None

Definition at line 3444 of file stm32f1xx_hal_uart.c.

References __UART_HandleTypeDef::AbortTransmitCpltCallback, __UART_HandleTypeDef::gState, HAL_UART_AbortTransmitCpltCallback(), HAL_UART_STATE_READY, __TIM_HandleTypeDef::hdma, and __UART_HandleTypeDef::TxXferCount.

Referenced by HAL_UART_AbortTransmit_IT().

static void UART_EndRxTransfer ( UART_HandleTypeDef huart) [static]

End ongoing Rx transfer on UART peripheral (following error detection or Reception completion).

Parameters:
huartUART handle.
Return values:
None

Definition at line 3304 of file stm32f1xx_hal_uart.c.

References HAL_UART_RECEPTION_STANDARD, HAL_UART_RECEPTION_TOIDLE, HAL_UART_STATE_READY, __UART_HandleTypeDef::Instance, __UART_HandleTypeDef::ReceptionType, and __UART_HandleTypeDef::RxState.

Referenced by HAL_UART_DMAStop(), HAL_UART_IRQHandler(), and UART_DMAError().

static HAL_StatusTypeDef UART_EndTransmit_IT ( UART_HandleTypeDef huart) [static]

Wraps up transmission in non blocking mode.

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

Definition at line 3538 of file stm32f1xx_hal_uart.c.

References __HAL_UART_DISABLE_IT, __UART_HandleTypeDef::gState, HAL_UART_STATE_READY, HAL_UART_TxCpltCallback(), __UART_HandleTypeDef::TxCpltCallback, and UART_IT_TC.

Referenced by HAL_UART_IRQHandler().

static void UART_EndTxTransfer ( UART_HandleTypeDef huart) [static]

End ongoing Tx transfer on UART peripheral (following error detection or Transmit completion).

Parameters:
huartUART handle.
Return values:
None

Definition at line 3290 of file stm32f1xx_hal_uart.c.

References __UART_HandleTypeDef::gState, HAL_UART_STATE_READY, and __UART_HandleTypeDef::Instance.

Referenced by HAL_UART_DMAStop(), and UART_DMAError().

static HAL_StatusTypeDef UART_Receive_IT ( UART_HandleTypeDef huart) [static]
static void UART_SetConfig ( UART_HandleTypeDef huart) [static]
HAL_StatusTypeDef UART_Start_Receive_DMA ( UART_HandleTypeDef huart,
uint8_t *  pData,
uint16_t  Size 
)

Start Receive operation in DMA mode.

Note:
This function could be called by all HAL UART API providing reception in DMA mode.
When calling this function, parameters validity is considered as already checked, i.e. Rx State, buffer address, ... UART Handle is assumed as Locked.
Parameters:
huartUART handle.
pDataPointer to data buffer (u8 or u16 data elements).
SizeAmount of data elements (u8 or u16) to be received.
Return values:
HALstatus

Definition at line 3240 of file stm32f1xx_hal_uart.c.

References __HAL_UART_CLEAR_OREFLAG, __UART_HandleTypeDef::ErrorCode, HAL_DMA_Start_IT(), HAL_UART_ERROR_NONE, HAL_UART_STATE_BUSY_RX, __UART_HandleTypeDef::hdmarx, __UART_HandleTypeDef::Instance, __UART_HandleTypeDef::pRxBuffPtr, __UART_HandleTypeDef::RxState, __UART_HandleTypeDef::RxXferSize, UART_DMAError(), UART_DMAReceiveCplt(), UART_DMARxHalfCplt(), __DMA_HandleTypeDef::XferAbortCallback, __DMA_HandleTypeDef::XferCpltCallback, __DMA_HandleTypeDef::XferErrorCallback, and __DMA_HandleTypeDef::XferHalfCpltCallback.

Referenced by HAL_UART_Receive_DMA(), and HAL_UARTEx_ReceiveToIdle_DMA().

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

Start Receive operation in interrupt mode.

Note:
This function could be called by all HAL UART API providing reception in Interrupt mode.
When calling this function, parameters validity is considered as already checked, i.e. Rx State, buffer address, ... UART Handle is assumed as Locked.
Parameters:
huartUART handle.
pDataPointer to data buffer (u8 or u16 data elements).
SizeAmount of data elements (u8 or u16) to be received.
Return values:
HALstatus

Definition at line 3205 of file stm32f1xx_hal_uart.c.

References __HAL_UART_ENABLE_IT, __UART_HandleTypeDef::ErrorCode, HAL_UART_ERROR_NONE, HAL_UART_STATE_BUSY_RX, __UART_HandleTypeDef::pRxBuffPtr, __UART_HandleTypeDef::RxState, __UART_HandleTypeDef::RxXferCount, __UART_HandleTypeDef::RxXferSize, UART_IT_ERR, UART_IT_PE, and UART_IT_RXNE.

Referenced by HAL_UART_Receive_IT(), and HAL_UARTEx_ReceiveToIdle_IT().

static HAL_StatusTypeDef UART_Transmit_IT ( UART_HandleTypeDef huart) [static]

Sends an amount of data in non blocking mode.

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

Definition at line 3498 of file stm32f1xx_hal_uart.c.

References __HAL_UART_DISABLE_IT, __HAL_UART_ENABLE_IT, __UART_HandleTypeDef::gState, HAL_UART_STATE_BUSY_TX, __UART_HandleTypeDef::Init, __UART_HandleTypeDef::Instance, UART_InitTypeDef::Parity, __UART_HandleTypeDef::pTxBuffPtr, __UART_HandleTypeDef::TxXferCount, UART_IT_TC, UART_IT_TXE, UART_PARITY_NONE, UART_WORDLENGTH_9B, and UART_InitTypeDef::WordLength.

Referenced by HAL_UART_IRQHandler().

static HAL_StatusTypeDef UART_WaitOnFlagUntilTimeout ( UART_HandleTypeDef huart,
uint32_t  Flag,
FlagStatus  Status,
uint32_t  Tickstart,
uint32_t  Timeout 
) [static]

This function handles UART Communication Timeout.

Parameters:
huartPointer to a UART_HandleTypeDef structure that contains the configuration information for the specified UART module.
Flagspecifies the UART flag to check.
StatusThe new Flag status (SET or RESET).
TickstartTick start value
TimeoutTimeout duration
Return values:
HALstatus

Definition at line 3167 of file stm32f1xx_hal_uart.c.

References __HAL_UART_GET_FLAG, __UART_HandleTypeDef::gState, HAL_GetTick(), HAL_UART_STATE_READY, __UART_HandleTypeDef::Instance, and __UART_HandleTypeDef::RxState.

Referenced by HAL_UART_Receive(), and HAL_UART_Transmit().