STM32F4xx HAL Documentation
Hardware Abstraction Layer for STM32F4 familiy
Loading...
Searching...
No Matches
USART Exported Macros
Collaboration diagram for USART Exported Macros:

Macros

#define __HAL_USART_RESET_HANDLE_STATE(__HANDLE__)
 Reset USART handle state.
 
#define __HAL_USART_GET_FLAG(__HANDLE__, __FLAG__)
 Check whether the specified USART flag is set or not.
 
#define __HAL_USART_CLEAR_FLAG(__HANDLE__, __FLAG__)
 Clear the specified USART pending flags.
 
#define __HAL_USART_CLEAR_PEFLAG(__HANDLE__)
 Clear the USART PE pending flag.
 
#define __HAL_USART_CLEAR_FEFLAG(__HANDLE__)
 Clear the USART FE pending flag.
 
#define __HAL_USART_CLEAR_NEFLAG(__HANDLE__)
 Clear the USART NE pending flag.
 
#define __HAL_USART_CLEAR_OREFLAG(__HANDLE__)
 Clear the USART ORE pending flag.
 
#define __HAL_USART_CLEAR_IDLEFLAG(__HANDLE__)
 Clear the USART IDLE pending flag.
 
#define __HAL_USART_ENABLE_IT(__HANDLE__, __INTERRUPT__)
 Enables or disables the specified USART interrupts.
 
#define __HAL_USART_DISABLE_IT(__HANDLE__, __INTERRUPT__)
 
#define __HAL_USART_GET_IT_SOURCE(__HANDLE__, __IT__)
 Checks whether the specified USART interrupt has occurred or not.
 
#define __HAL_USART_ONE_BIT_SAMPLE_ENABLE(__HANDLE__)
 Macro to enable the USART's one bit sample method.
 
#define __HAL_USART_ONE_BIT_SAMPLE_DISABLE(__HANDLE__)
 Macro to disable the USART's one bit sample method.
 
#define __HAL_USART_ENABLE(__HANDLE__)
 Enable USART.
 
#define __HAL_USART_DISABLE(__HANDLE__)
 Disable USART.
 

Detailed Description

Macro Definition Documentation

◆ __HAL_USART_RESET_HANDLE_STATE

#define __HAL_USART_RESET_HANDLE_STATE ( __HANDLE__)

#include <stm32f4xx_hal_usart.h>

Value:
((__HANDLE__)->State = HAL_USART_STATE_RESET)
@ HAL_USART_STATE_RESET

Reset USART handle state.

Parameters
__HANDLE__specifies the USART Handle. USART Handle selects the USARTx peripheral (USART availability and x value depending on device).
Return values
None

Definition at line 335 of file stm32f4xx_hal_usart.h.

◆ __HAL_USART_GET_FLAG

#define __HAL_USART_GET_FLAG ( __HANDLE__,
__FLAG__ )

#include <stm32f4xx_hal_usart.h>

Value:
(((__HANDLE__)->Instance->SR & (__FLAG__)) == (__FLAG__))

Check whether the specified USART flag is set or not.

Parameters
__HANDLE__specifies the USART Handle. USART Handle selects the USARTx peripheral (USART availability and x value depending on device).
__FLAG__specifies the flag to check. This parameter can be one of the following values:
  • USART_FLAG_TXE: Transmit data register empty flag
  • USART_FLAG_TC: Transmission Complete flag
  • USART_FLAG_RXNE: Receive data register not empty flag
  • USART_FLAG_IDLE: Idle Line detection flag
  • USART_FLAG_ORE: Overrun Error flag
  • USART_FLAG_NE: Noise Error flag
  • USART_FLAG_FE: Framing Error flag
  • USART_FLAG_PE: Parity Error flag
Return values
Thenew state of FLAG (TRUE or FALSE).

Definition at line 353 of file stm32f4xx_hal_usart.h.

Referenced by USART_TransmitReceive_IT(), and USART_WaitOnFlagUntilTimeout().

◆ __HAL_USART_CLEAR_FLAG

#define __HAL_USART_CLEAR_FLAG ( __HANDLE__,
__FLAG__ )

#include <stm32f4xx_hal_usart.h>

Value:
((__HANDLE__)->Instance->SR = ~(__FLAG__))

Clear the specified USART pending flags.

Parameters
__HANDLE__specifies the USART Handle. USART Handle selects the USARTx peripheral (USART availability and x value depending on device).
__FLAG__specifies the flag to check. This parameter can be any combination of the following values:
  • USART_FLAG_TC: Transmission Complete flag.
  • USART_FLAG_RXNE: Receive data register not empty flag.
Note
PE (Parity error), FE (Framing error), NE (Noise error), ORE (Overrun error) and IDLE (Idle line detected) flags are cleared by software sequence: a read operation to USART_SR register followed by a read operation to USART_DR register.
RXNE flag can be also cleared by a read to the USART_DR register.
TC flag can be also cleared by software sequence: a read operation to USART_SR register followed by a write operation to USART_DR register.
TXE flag is cleared only by a write to the USART_DR register.
Return values
None

Definition at line 374 of file stm32f4xx_hal_usart.h.

Referenced by HAL_USART_Transmit_DMA(), and HAL_USART_TransmitReceive_DMA().

◆ __HAL_USART_CLEAR_PEFLAG

#define __HAL_USART_CLEAR_PEFLAG ( __HANDLE__)

#include <stm32f4xx_hal_usart.h>

Value:
do{ \
__IO uint32_t tmpreg = 0x00U; \
tmpreg = (__HANDLE__)->Instance->SR; \
tmpreg = (__HANDLE__)->Instance->DR; \
UNUSED(tmpreg); \
} while(0U)

Clear the USART PE pending flag.

Parameters
__HANDLE__specifies the USART Handle. USART Handle selects the USARTx peripheral (USART availability and x value depending on device).
Return values
None

Definition at line 381 of file stm32f4xx_hal_usart.h.

◆ __HAL_USART_CLEAR_FEFLAG

#define __HAL_USART_CLEAR_FEFLAG ( __HANDLE__)

#include <stm32f4xx_hal_usart.h>

Value:
#define __HAL_USART_CLEAR_PEFLAG(__HANDLE__)
Clear the USART PE pending flag.

Clear the USART FE pending flag.

Parameters
__HANDLE__specifies the USART Handle. USART Handle selects the USARTx peripheral (USART availability and x value depending on device).
Return values
None

Definition at line 394 of file stm32f4xx_hal_usart.h.

◆ __HAL_USART_CLEAR_NEFLAG

#define __HAL_USART_CLEAR_NEFLAG ( __HANDLE__)

#include <stm32f4xx_hal_usart.h>

Value:

Clear the USART NE pending flag.

Parameters
__HANDLE__specifies the USART Handle. USART Handle selects the USARTx peripheral (USART availability and x value depending on device).
Return values
None

Definition at line 401 of file stm32f4xx_hal_usart.h.

◆ __HAL_USART_CLEAR_OREFLAG

#define __HAL_USART_CLEAR_OREFLAG ( __HANDLE__)

#include <stm32f4xx_hal_usart.h>

Value:

Clear the USART ORE pending flag.

Parameters
__HANDLE__specifies the USART Handle. USART Handle selects the USARTx peripheral (USART availability and x value depending on device).
Return values
None

Definition at line 408 of file stm32f4xx_hal_usart.h.

Referenced by HAL_USART_Receive_DMA(), and HAL_USART_TransmitReceive_DMA().

◆ __HAL_USART_CLEAR_IDLEFLAG

#define __HAL_USART_CLEAR_IDLEFLAG ( __HANDLE__)

#include <stm32f4xx_hal_usart.h>

Value:

Clear the USART IDLE pending flag.

Parameters
__HANDLE__specifies the USART Handle. USART Handle selects the USARTx peripheral (USART availability and x value depending on device).
Return values
None

Definition at line 415 of file stm32f4xx_hal_usart.h.

◆ __HAL_USART_ENABLE_IT

#define __HAL_USART_ENABLE_IT ( __HANDLE__,
__INTERRUPT__ )

#include <stm32f4xx_hal_usart.h>

Value:
((((__INTERRUPT__) >> 28U) == USART_CR1_REG_INDEX)? ((__HANDLE__)->Instance->CR1 |= ((__INTERRUPT__) & USART_IT_MASK)): \
(((__INTERRUPT__) >> 28U) == USART_CR2_REG_INDEX)? ((__HANDLE__)->Instance->CR2 |= ((__INTERRUPT__) & USART_IT_MASK)): \
((__HANDLE__)->Instance->CR3 |= ((__INTERRUPT__) & USART_IT_MASK)))
#define USART_IT_MASK
USART interruptions flag mask.
#define USART_CR1_REG_INDEX
#define USART_CR2_REG_INDEX

Enables or disables the specified USART interrupts.

Parameters
__HANDLE__specifies the USART Handle. USART Handle selects the USARTx peripheral (USART availability and x value depending on device).
__INTERRUPT__specifies the USART interrupt source to check. This parameter can be one of the following values:
  • USART_IT_TXE: Transmit Data Register empty interrupt
  • USART_IT_TC: Transmission complete interrupt
  • USART_IT_RXNE: Receive Data register not empty interrupt
  • USART_IT_IDLE: Idle line detection interrupt
  • USART_IT_PE: Parity Error interrupt
  • USART_IT_ERR: Error interrupt(Frame error, noise error, overrun error)
Return values
None

Definition at line 430 of file stm32f4xx_hal_usart.h.

◆ __HAL_USART_DISABLE_IT

#define __HAL_USART_DISABLE_IT ( __HANDLE__,
__INTERRUPT__ )

#include <stm32f4xx_hal_usart.h>

Value:
((((__INTERRUPT__) >> 28U) == USART_CR1_REG_INDEX)? ((__HANDLE__)->Instance->CR1 &= ~((__INTERRUPT__) & USART_IT_MASK)): \
(((__INTERRUPT__) >> 28U) == USART_CR2_REG_INDEX)? ((__HANDLE__)->Instance->CR2 &= ~((__INTERRUPT__) & USART_IT_MASK)): \
((__HANDLE__)->Instance->CR3 &= ~ ((__INTERRUPT__) & USART_IT_MASK)))

Definition at line 433 of file stm32f4xx_hal_usart.h.

◆ __HAL_USART_GET_IT_SOURCE

#define __HAL_USART_GET_IT_SOURCE ( __HANDLE__,
__IT__ )

#include <stm32f4xx_hal_usart.h>

Value:
(((((__IT__) >> 28U) == USART_CR1_REG_INDEX)? (__HANDLE__)->Instance->CR1:(((((uint32_t)(__IT__)) >> 28U) == USART_CR2_REG_INDEX)? \
(__HANDLE__)->Instance->CR2 : (__HANDLE__)->Instance->CR3)) & (((uint32_t)(__IT__)) & USART_IT_MASK))

Checks whether the specified USART interrupt has occurred or not.

Parameters
__HANDLE__specifies the USART Handle. USART Handle selects the USARTx peripheral (USART availability and x value depending on device).
__IT__specifies the USART interrupt source to check. This parameter can be one of the following values:
  • USART_IT_TXE: Transmit Data Register empty interrupt
  • USART_IT_TC: Transmission complete interrupt
  • USART_IT_RXNE: Receive Data register not empty interrupt
  • USART_IT_IDLE: Idle line detection interrupt
  • USART_IT_ERR: Error interrupt
  • USART_IT_PE: Parity Error interrupt
Return values
Thenew state of IT (TRUE or FALSE).

Definition at line 450 of file stm32f4xx_hal_usart.h.

◆ __HAL_USART_ONE_BIT_SAMPLE_ENABLE

#define __HAL_USART_ONE_BIT_SAMPLE_ENABLE ( __HANDLE__)

#include <stm32f4xx_hal_usart.h>

Value:
((__HANDLE__)->Instance->CR3 |= USART_CR3_ONEBIT)

Macro to enable the USART's one bit sample method.

Parameters
__HANDLE__specifies the USART Handle.
Return values
None

Definition at line 457 of file stm32f4xx_hal_usart.h.

◆ __HAL_USART_ONE_BIT_SAMPLE_DISABLE

#define __HAL_USART_ONE_BIT_SAMPLE_DISABLE ( __HANDLE__)

#include <stm32f4xx_hal_usart.h>

Value:
((__HANDLE__)->Instance->CR3\
&= (uint16_t)~((uint16_t)USART_CR3_ONEBIT))

Macro to disable the USART's one bit sample method.

Parameters
__HANDLE__specifies the USART Handle.
Return values
None

Definition at line 463 of file stm32f4xx_hal_usart.h.

◆ __HAL_USART_ENABLE

#define __HAL_USART_ENABLE ( __HANDLE__)

#include <stm32f4xx_hal_usart.h>

Value:
((__HANDLE__)->Instance->CR1 |= USART_CR1_UE)

Enable USART.

Parameters
__HANDLE__specifies the USART Handle. USART Handle selects the USARTx peripheral (USART availability and x value depending on device).
Return values
None

Definition at line 471 of file stm32f4xx_hal_usart.h.

Referenced by HAL_USART_Init().

◆ __HAL_USART_DISABLE

#define __HAL_USART_DISABLE ( __HANDLE__)

#include <stm32f4xx_hal_usart.h>

Value:
((__HANDLE__)->Instance->CR1 &= ~USART_CR1_UE)

Disable USART.

Parameters
__HANDLE__specifies the USART Handle. USART Handle selects the USARTx peripheral (USART availability and x value depending on device).
Return values
None

Definition at line 478 of file stm32f4xx_hal_usart.h.

Referenced by HAL_USART_DeInit().