STM32F4xx_HAL_Driver  1.8.3
UART Exported Types
+ Collaboration diagram for UART Exported Types:

Data Structures

struct  UART_InitTypeDef
 UART Init Structure definition. More...
 
struct  __UART_HandleTypeDef
 UART handle Structure definition. More...
 

Typedefs

typedef uint32_t HAL_UART_RxTypeTypeDef
 HAL UART Reception type definition. More...
 
typedef uint32_t HAL_UART_RxEventTypeTypeDef
 HAL UART Rx Event type definition. More...
 
typedef struct __UART_HandleTypeDef UART_HandleTypeDef
 UART handle Structure definition.
 
typedef void(* pUART_CallbackTypeDef) (UART_HandleTypeDef *huart)
 HAL UART Callback pointer definition. More...
 
typedef void(* pUART_RxEventCallbackTypeDef) (struct __UART_HandleTypeDef *huart, uint16_t Pos)
 

Enumerations

enum  HAL_UART_StateTypeDef {
  HAL_UART_STATE_RESET = 0x00U , HAL_UART_STATE_READY = 0x20U , HAL_UART_STATE_BUSY = 0x24U , HAL_UART_STATE_BUSY_TX = 0x21U ,
  HAL_UART_STATE_BUSY_RX = 0x22U , HAL_UART_STATE_BUSY_TX_RX = 0x23U , HAL_UART_STATE_TIMEOUT = 0xA0U , HAL_UART_STATE_ERROR = 0xE0U
}
 HAL UART State structures definition. More...
 
enum  HAL_UART_CallbackIDTypeDef {
  HAL_UART_TX_HALFCOMPLETE_CB_ID = 0x00U , HAL_UART_TX_COMPLETE_CB_ID = 0x01U , HAL_UART_RX_HALFCOMPLETE_CB_ID = 0x02U , HAL_UART_RX_COMPLETE_CB_ID = 0x03U ,
  HAL_UART_ERROR_CB_ID = 0x04U , HAL_UART_ABORT_COMPLETE_CB_ID = 0x05U , HAL_UART_ABORT_TRANSMIT_COMPLETE_CB_ID = 0x06U , HAL_UART_ABORT_RECEIVE_COMPLETE_CB_ID = 0x07U ,
  HAL_UART_WAKEUP_CB_ID = 0x08U , HAL_UART_MSPINIT_CB_ID = 0x0BU , HAL_UART_MSPDEINIT_CB_ID = 0x0CU
}
 HAL UART Callback ID enumeration definition. More...
 

Detailed Description


Data Structure Documentation

◆ UART_InitTypeDef

struct UART_InitTypeDef

UART Init Structure definition.

Definition at line 46 of file stm32f4xx_hal_uart.h.

Data Fields
uint32_t BaudRate

This member configures the UART communication baud rate. The baud rate is computed using the following formula:

  • IntegerDivider = ((PCLKx) / (8 * (OVR8+1) * (huart->Init.BaudRate)))
  • FractionalDivider = ((IntegerDivider - ((uint32_t) IntegerDivider)) * 8 * (OVR8+1)) + 0.5 Where OVR8 is the "oversampling by 8 mode" configuration bit in the CR1 register.
uint32_t HwFlowCtl

Specifies whether the hardware flow control mode is enabled or disabled. This parameter can be a value of UART Hardware Flow Control

uint32_t Mode

Specifies whether the Receive or Transmit mode is enabled or disabled. This parameter can be a value of UART Transfer Mode

uint32_t OverSampling

Specifies whether the Over sampling 8 is enabled or disabled, to achieve higher speed (up to fPCLK/8). This parameter can be a value of UART Over Sampling

uint32_t Parity

Specifies the parity mode. This parameter can be a value of UART Parity

Note
When parity is enabled, the computed parity is inserted at the MSB position of the transmitted data (9th bit when the word length is set to 9 data bits; 8th bit when the word length is set to 8 data bits).
uint32_t StopBits

Specifies the number of stop bits transmitted. This parameter can be a value of UART Number of Stop Bits

uint32_t WordLength

Specifies the number of data bits transmitted or received in a frame. This parameter can be a value of UART Word Length

◆ __UART_HandleTypeDef

struct __UART_HandleTypeDef

UART handle Structure definition.

Definition at line 160 of file stm32f4xx_hal_uart.h.

+ Collaboration diagram for __UART_HandleTypeDef:

Data Fields

USART_TypeDef * Instance
 
UART_InitTypeDef Init
 
const uint8_t * pTxBuffPtr
 
uint16_t TxXferSize
 
__IO uint16_t TxXferCount
 
uint8_t * pRxBuffPtr
 
uint16_t RxXferSize
 
__IO uint16_t RxXferCount
 
__IO HAL_UART_RxTypeTypeDef ReceptionType
 
__IO HAL_UART_RxEventTypeTypeDef RxEventType
 
DMA_HandleTypeDefhdmatx
 
DMA_HandleTypeDefhdmarx
 
HAL_LockTypeDef Lock
 
__IO HAL_UART_StateTypeDef gState
 
__IO HAL_UART_StateTypeDef RxState
 
__IO uint32_t ErrorCode
 
void(* TxHalfCpltCallback )(struct __UART_HandleTypeDef *huart)
 
void(* TxCpltCallback )(struct __UART_HandleTypeDef *huart)
 
void(* RxHalfCpltCallback )(struct __UART_HandleTypeDef *huart)
 
void(* RxCpltCallback )(struct __UART_HandleTypeDef *huart)
 
void(* ErrorCallback )(struct __UART_HandleTypeDef *huart)
 
void(* AbortCpltCallback )(struct __UART_HandleTypeDef *huart)
 
void(* AbortTransmitCpltCallback )(struct __UART_HandleTypeDef *huart)
 
void(* AbortReceiveCpltCallback )(struct __UART_HandleTypeDef *huart)
 
void(* WakeupCallback )(struct __UART_HandleTypeDef *huart)
 
void(* RxEventCallback )(struct __UART_HandleTypeDef *huart, uint16_t Pos)
 
void(* MspInitCallback )(struct __UART_HandleTypeDef *huart)
 
void(* MspDeInitCallback )(struct __UART_HandleTypeDef *huart)
 

Field Documentation

◆ AbortCpltCallback

void(* __UART_HandleTypeDef::AbortCpltCallback) (struct __UART_HandleTypeDef *huart)

UART Abort Complete Callback

Definition at line 203 of file stm32f4xx_hal_uart.h.

◆ AbortReceiveCpltCallback

void(* __UART_HandleTypeDef::AbortReceiveCpltCallback) (struct __UART_HandleTypeDef *huart)

UART Abort Receive Complete Callback

Definition at line 205 of file stm32f4xx_hal_uart.h.

◆ AbortTransmitCpltCallback

void(* __UART_HandleTypeDef::AbortTransmitCpltCallback) (struct __UART_HandleTypeDef *huart)

UART Abort Transmit Complete Callback

Definition at line 204 of file stm32f4xx_hal_uart.h.

◆ ErrorCallback

void(* __UART_HandleTypeDef::ErrorCallback) (struct __UART_HandleTypeDef *huart)

UART Error Callback

Definition at line 202 of file stm32f4xx_hal_uart.h.

◆ ErrorCode

__IO uint32_t __UART_HandleTypeDef::ErrorCode

UART Error code

Definition at line 195 of file stm32f4xx_hal_uart.h.

◆ gState

__IO HAL_UART_StateTypeDef __UART_HandleTypeDef::gState

UART state information related to global Handle management and also related to Tx operations. This parameter can be a value of HAL_UART_StateTypeDef

Definition at line 188 of file stm32f4xx_hal_uart.h.

◆ hdmarx

DMA_HandleTypeDef* __UART_HandleTypeDef::hdmarx

UART Rx DMA Handle parameters

Definition at line 184 of file stm32f4xx_hal_uart.h.

◆ hdmatx

DMA_HandleTypeDef* __UART_HandleTypeDef::hdmatx

UART Tx DMA Handle parameters

Definition at line 182 of file stm32f4xx_hal_uart.h.

◆ Init

UART_InitTypeDef __UART_HandleTypeDef::Init

UART communication parameters

Definition at line 164 of file stm32f4xx_hal_uart.h.

◆ Instance

USART_TypeDef* __UART_HandleTypeDef::Instance

UART registers base address

Definition at line 162 of file stm32f4xx_hal_uart.h.

◆ Lock

HAL_LockTypeDef __UART_HandleTypeDef::Lock

Locking object

Definition at line 186 of file stm32f4xx_hal_uart.h.

◆ MspDeInitCallback

void(* __UART_HandleTypeDef::MspDeInitCallback) (struct __UART_HandleTypeDef *huart)

UART Msp DeInit callback

Definition at line 210 of file stm32f4xx_hal_uart.h.

◆ MspInitCallback

void(* __UART_HandleTypeDef::MspInitCallback) (struct __UART_HandleTypeDef *huart)

UART Msp Init callback

Definition at line 209 of file stm32f4xx_hal_uart.h.

◆ pRxBuffPtr

uint8_t* __UART_HandleTypeDef::pRxBuffPtr

Pointer to UART Rx transfer Buffer

Definition at line 172 of file stm32f4xx_hal_uart.h.

◆ pTxBuffPtr

const uint8_t* __UART_HandleTypeDef::pTxBuffPtr

Pointer to UART Tx transfer Buffer

Definition at line 166 of file stm32f4xx_hal_uart.h.

◆ ReceptionType

__IO HAL_UART_RxTypeTypeDef __UART_HandleTypeDef::ReceptionType

Type of ongoing reception

Definition at line 178 of file stm32f4xx_hal_uart.h.

◆ RxCpltCallback

void(* __UART_HandleTypeDef::RxCpltCallback) (struct __UART_HandleTypeDef *huart)

UART Rx Complete Callback

Definition at line 201 of file stm32f4xx_hal_uart.h.

◆ RxEventCallback

void(* __UART_HandleTypeDef::RxEventCallback) (struct __UART_HandleTypeDef *huart, uint16_t Pos)

UART Reception Event Callback

Definition at line 207 of file stm32f4xx_hal_uart.h.

◆ RxEventType

__IO HAL_UART_RxEventTypeTypeDef __UART_HandleTypeDef::RxEventType

Type of Rx Event

Definition at line 180 of file stm32f4xx_hal_uart.h.

◆ RxHalfCpltCallback

void(* __UART_HandleTypeDef::RxHalfCpltCallback) (struct __UART_HandleTypeDef *huart)

UART Rx Half Complete Callback

Definition at line 200 of file stm32f4xx_hal_uart.h.

◆ RxState

__IO HAL_UART_StateTypeDef __UART_HandleTypeDef::RxState

UART state information related to Rx operations. This parameter can be a value of HAL_UART_StateTypeDef

Definition at line 192 of file stm32f4xx_hal_uart.h.

◆ RxXferCount

__IO uint16_t __UART_HandleTypeDef::RxXferCount

UART Rx Transfer Counter

Definition at line 176 of file stm32f4xx_hal_uart.h.

◆ RxXferSize

uint16_t __UART_HandleTypeDef::RxXferSize

UART Rx Transfer size

Definition at line 174 of file stm32f4xx_hal_uart.h.

◆ TxCpltCallback

void(* __UART_HandleTypeDef::TxCpltCallback) (struct __UART_HandleTypeDef *huart)

UART Tx Complete Callback

Definition at line 199 of file stm32f4xx_hal_uart.h.

◆ TxHalfCpltCallback

void(* __UART_HandleTypeDef::TxHalfCpltCallback) (struct __UART_HandleTypeDef *huart)

UART Tx Half Complete Callback

Definition at line 198 of file stm32f4xx_hal_uart.h.

◆ TxXferCount

__IO uint16_t __UART_HandleTypeDef::TxXferCount

UART Tx Transfer Counter

Definition at line 170 of file stm32f4xx_hal_uart.h.

◆ TxXferSize

uint16_t __UART_HandleTypeDef::TxXferSize

UART Tx Transfer size

Definition at line 168 of file stm32f4xx_hal_uart.h.

◆ WakeupCallback

void(* __UART_HandleTypeDef::WakeupCallback) (struct __UART_HandleTypeDef *huart)

UART Wakeup Callback

Definition at line 206 of file stm32f4xx_hal_uart.h.

Typedef Documentation

◆ HAL_UART_RxEventTypeTypeDef

typedef uint32_t HAL_UART_RxEventTypeTypeDef

HAL UART Rx Event type definition.

Note
HAL UART Rx Event type value aims to identify which type of Event has occurred leading to call of the RxEvent callback. This parameter can be a value of UART RxEvent type values : HAL_UART_RXEVENT_TC = 0x00U, HAL_UART_RXEVENT_HT = 0x01U, HAL_UART_RXEVENT_IDLE = 0x02U,

Definition at line 155 of file stm32f4xx_hal_uart.h.

◆ HAL_UART_RxTypeTypeDef

typedef uint32_t HAL_UART_RxTypeTypeDef

HAL UART Reception type definition.

Note
HAL UART Reception type value aims to identify which type of Reception is ongoing. This parameter can be a value of UART Reception type values : HAL_UART_RECEPTION_STANDARD = 0x00U, HAL_UART_RECEPTION_TOIDLE = 0x01U,

Definition at line 144 of file stm32f4xx_hal_uart.h.

◆ pUART_CallbackTypeDef

typedef void(* pUART_CallbackTypeDef) (UART_HandleTypeDef *huart)

HAL UART Callback pointer definition.

pointer to an UART callback function

Definition at line 239 of file stm32f4xx_hal_uart.h.

◆ pUART_RxEventCallbackTypeDef

typedef void(* pUART_RxEventCallbackTypeDef) (struct __UART_HandleTypeDef *huart, uint16_t Pos)

pointer to a UART Rx Event specific callback function

Definition at line 240 of file stm32f4xx_hal_uart.h.

Enumeration Type Documentation

◆ HAL_UART_CallbackIDTypeDef

HAL UART Callback ID enumeration definition.

Enumerator
HAL_UART_TX_HALFCOMPLETE_CB_ID 

UART Tx Half Complete Callback ID

HAL_UART_TX_COMPLETE_CB_ID 

UART Tx Complete Callback ID

HAL_UART_RX_HALFCOMPLETE_CB_ID 

UART Rx Half Complete Callback ID

HAL_UART_RX_COMPLETE_CB_ID 

UART Rx Complete Callback ID

HAL_UART_ERROR_CB_ID 

UART Error Callback ID

HAL_UART_ABORT_COMPLETE_CB_ID 

UART Abort Complete Callback ID

HAL_UART_ABORT_TRANSMIT_COMPLETE_CB_ID 

UART Abort Transmit Complete Callback ID

HAL_UART_ABORT_RECEIVE_COMPLETE_CB_ID 

UART Abort Receive Complete Callback ID

HAL_UART_WAKEUP_CB_ID 

UART Wakeup Callback ID

HAL_UART_MSPINIT_CB_ID 

UART MspInit callback ID

HAL_UART_MSPDEINIT_CB_ID 

UART MspDeInit callback ID

Definition at line 219 of file stm32f4xx_hal_uart.h.

◆ HAL_UART_StateTypeDef

HAL UART State structures definition.

Note
HAL UART State value is a combination of 2 different substates: gState and RxState.
  • gState contains UART state information related to global Handle management and also information related to Tx operations. gState value coding follow below described bitmap : b7-b6 Error information 00 : No Error 01 : (Not Used) 10 : Timeout 11 : Error b5 Peripheral initialization status 0 : Reset (Peripheral not initialized) 1 : Init done (Peripheral initialized. HAL UART Init function already called) b4-b3 (not used) xx : Should be set to 00 b2 Intrinsic process state 0 : Ready 1 : Busy (Peripheral busy with some configuration or internal operations) b1 (not used) x : Should be set to 0 b0 Tx state 0 : Ready (no Tx operation ongoing) 1 : Busy (Tx operation ongoing)
  • RxState contains information related to Rx operations. RxState value coding follow below described bitmap : b7-b6 (not used) xx : Should be set to 00 b5 Peripheral initialization status 0 : Reset (Peripheral not initialized) 1 : Init done (Peripheral initialized) b4-b2 (not used) xxx : Should be set to 000 b1 Rx state 0 : Ready (no Rx operation ongoing) 1 : Busy (Rx operation ongoing) b0 (not used) x : Should be set to 0.
Enumerator
HAL_UART_STATE_RESET 

Peripheral is not yet Initialized Value is allowed for gState and RxState

HAL_UART_STATE_READY 

Peripheral Initialized and ready for use Value is allowed for gState and RxState

HAL_UART_STATE_BUSY 

an internal process is ongoing Value is allowed for gState only

HAL_UART_STATE_BUSY_TX 

Data Transmission process is ongoing Value is allowed for gState only

HAL_UART_STATE_BUSY_RX 

Data Reception process is ongoing Value is allowed for RxState only

HAL_UART_STATE_BUSY_TX_RX 

Data Transmission and Reception process is ongoing Not to be used for neither gState nor RxState. Value is result of combination (Or) between gState and RxState values

HAL_UART_STATE_TIMEOUT 

Timeout state Value is allowed for gState only

HAL_UART_STATE_ERROR 

Error Value is allowed for gState only

Definition at line 116 of file stm32f4xx_hal_uart.h.