Prusa MINI Firmware overview
UART Exported Macros
Collaboration diagram for UART Exported Macros:

Macros

#define __HAL_UART_RESET_HANDLE_STATE(__HANDLE__)
 Reset UART handle gstate & RxState. More...
 
#define __HAL_UART_FLUSH_DRREGISTER(__HANDLE__)   ((__HANDLE__)->Instance->DR)
 Flushes the UART DR register. More...
 
#define __HAL_UART_GET_FLAG(__HANDLE__, __FLAG__)   (((__HANDLE__)->Instance->SR & (__FLAG__)) == (__FLAG__))
 Checks whether the specified UART flag is set or not. More...
 
#define __HAL_UART_CLEAR_FLAG(__HANDLE__, __FLAG__)   ((__HANDLE__)->Instance->SR = ~(__FLAG__))
 Clears the specified UART pending flag. More...
 
#define __HAL_UART_CLEAR_PEFLAG(__HANDLE__)
 Clear the UART PE pending flag. More...
 
#define __HAL_UART_CLEAR_FEFLAG(__HANDLE__)   __HAL_UART_CLEAR_PEFLAG(__HANDLE__)
 Clear the UART FE pending flag. More...
 
#define __HAL_UART_CLEAR_NEFLAG(__HANDLE__)   __HAL_UART_CLEAR_PEFLAG(__HANDLE__)
 Clear the UART NE pending flag. More...
 
#define __HAL_UART_CLEAR_OREFLAG(__HANDLE__)   __HAL_UART_CLEAR_PEFLAG(__HANDLE__)
 Clear the UART ORE pending flag. More...
 
#define __HAL_UART_CLEAR_IDLEFLAG(__HANDLE__)   __HAL_UART_CLEAR_PEFLAG(__HANDLE__)
 Clear the UART IDLE pending flag. More...
 
#define UART_IT_MASK   0x0000FFFFU
 Enable the specified UART interrupt. More...
 
#define __HAL_UART_ENABLE_IT(__HANDLE__, __INTERRUPT__)
 
#define __HAL_UART_DISABLE_IT(__HANDLE__, __INTERRUPT__)
 Disable the specified UART interrupt. More...
 
#define __HAL_UART_GET_IT_SOURCE(__HANDLE__, __IT__)
 Checks whether the specified UART interrupt has occurred or not. More...
 
#define __HAL_UART_HWCONTROL_CTS_ENABLE(__HANDLE__)
 Enable CTS flow control This macro allows to enable CTS hardware flow control for a given UART instance, without need to call HAL_UART_Init() function. As involving direct access to UART registers, usage of this macro should be fully endorsed by user. More...
 
#define __HAL_UART_HWCONTROL_CTS_DISABLE(__HANDLE__)
 Disable CTS flow control This macro allows to disable CTS hardware flow control for a given UART instance, without need to call HAL_UART_Init() function. As involving direct access to UART registers, usage of this macro should be fully endorsed by user. More...
 
#define __HAL_UART_HWCONTROL_RTS_ENABLE(__HANDLE__)
 Enable RTS flow control This macro allows to enable RTS hardware flow control for a given UART instance, without need to call HAL_UART_Init() function. As involving direct access to UART registers, usage of this macro should be fully endorsed by user. More...
 
#define __HAL_UART_HWCONTROL_RTS_DISABLE(__HANDLE__)
 Disable RTS flow control This macro allows to disable RTS hardware flow control for a given UART instance, without need to call HAL_UART_Init() function. As involving direct access to UART registers, usage of this macro should be fully endorsed by user. More...
 
#define __HAL_UART_ONE_BIT_SAMPLE_ENABLE(__HANDLE__)   ((__HANDLE__)->Instance->CR3|= USART_CR3_ONEBIT)
 macros to enables the UART's one bit sample method More...
 
#define __HAL_UART_ONE_BIT_SAMPLE_DISABLE(__HANDLE__)   ((__HANDLE__)->Instance->CR3 &= (uint16_t)~((uint16_t)USART_CR3_ONEBIT))
 macros to disables the UART's one bit sample method More...
 
#define __HAL_UART_ENABLE(__HANDLE__)   ((__HANDLE__)->Instance->CR1 |= USART_CR1_UE)
 Enable UART. More...
 
#define __HAL_UART_DISABLE(__HANDLE__)   ((__HANDLE__)->Instance->CR1 &= ~USART_CR1_UE)
 Disable UART. More...
 

Detailed Description

Macro Definition Documentation

◆ __HAL_UART_RESET_HANDLE_STATE

#define __HAL_UART_RESET_HANDLE_STATE (   __HANDLE__)
Value:
do{ \
(__HANDLE__)->gState = HAL_UART_STATE_RESET; \
(__HANDLE__)->RxState = HAL_UART_STATE_RESET; \
} while(0U)

Reset UART handle gstate & RxState.

Parameters
<strong>HANDLE</strong>specifies the UART Handle. This parameter can be UARTx where x: 1, 2, 3, 4, 5, 6, 7 or 8 to select the USART or UART peripheral.
Return values
None

◆ __HAL_UART_FLUSH_DRREGISTER

#define __HAL_UART_FLUSH_DRREGISTER (   __HANDLE__)    ((__HANDLE__)->Instance->DR)

Flushes the UART DR register.

Parameters
<strong>HANDLE</strong>specifies the UART Handle.

◆ __HAL_UART_GET_FLAG

#define __HAL_UART_GET_FLAG (   __HANDLE__,
  __FLAG__ 
)    (((__HANDLE__)->Instance->SR & (__FLAG__)) == (__FLAG__))

Checks whether the specified UART flag is set or not.

Parameters
<strong>HANDLE</strong>specifies the UART Handle. This parameter can be UARTx where x: 1, 2, 3, 4, 5, 6, 7 or 8 to select the USART or UART peripheral.
<strong>FLAG</strong>specifies the flag to check. This parameter can be one of the following values:
  • UART_FLAG_CTS: CTS Change flag (not available for UART4 and UART5)
  • UART_FLAG_LBD: LIN Break detection flag
  • UART_FLAG_TXE: Transmit data register empty flag
  • UART_FLAG_TC: Transmission Complete flag
  • UART_FLAG_RXNE: Receive data register not empty flag
  • UART_FLAG_IDLE: Idle Line detection flag
  • UART_FLAG_ORE: Overrun Error flag
  • UART_FLAG_NE: Noise Error flag
  • UART_FLAG_FE: Framing Error flag
  • UART_FLAG_PE: Parity Error flag
Return values
Thenew state of FLAG (TRUE or FALSE).

◆ __HAL_UART_CLEAR_FLAG

#define __HAL_UART_CLEAR_FLAG (   __HANDLE__,
  __FLAG__ 
)    ((__HANDLE__)->Instance->SR = ~(__FLAG__))

Clears the specified UART pending flag.

Parameters
<strong>HANDLE</strong>specifies the UART Handle. This parameter can be UARTx where x: 1, 2, 3, 4, 5, 6, 7 or 8 to select the USART or UART peripheral.
<strong>FLAG</strong>specifies the flag to check. This parameter can be any combination of the following values:
  • UART_FLAG_CTS: CTS Change flag (not available for UART4 and UART5).
  • UART_FLAG_LBD: LIN Break detection flag.
  • UART_FLAG_TC: Transmission Complete flag.
  • UART_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

◆ __HAL_UART_CLEAR_PEFLAG

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

Clear the UART PE pending flag.

Parameters
<strong>HANDLE</strong>specifies the UART Handle. This parameter can be UARTx where x: 1, 2, 3, 4, 5, 6, 7 or 8 to select the USART or UART peripheral.
Return values
None

◆ __HAL_UART_CLEAR_FEFLAG

#define __HAL_UART_CLEAR_FEFLAG (   __HANDLE__)    __HAL_UART_CLEAR_PEFLAG(__HANDLE__)

Clear the UART FE pending flag.

Parameters
<strong>HANDLE</strong>specifies the UART Handle. This parameter can be UARTx where x: 1, 2, 3, 4, 5, 6, 7 or 8 to select the USART or UART peripheral.
Return values
None

◆ __HAL_UART_CLEAR_NEFLAG

#define __HAL_UART_CLEAR_NEFLAG (   __HANDLE__)    __HAL_UART_CLEAR_PEFLAG(__HANDLE__)

Clear the UART NE pending flag.

Parameters
<strong>HANDLE</strong>specifies the UART Handle. This parameter can be UARTx where x: 1, 2, 3, 4, 5, 6, 7 or 8 to select the USART or UART peripheral.
Return values
None

◆ __HAL_UART_CLEAR_OREFLAG

#define __HAL_UART_CLEAR_OREFLAG (   __HANDLE__)    __HAL_UART_CLEAR_PEFLAG(__HANDLE__)

Clear the UART ORE pending flag.

Parameters
<strong>HANDLE</strong>specifies the UART Handle. This parameter can be UARTx where x: 1, 2, 3, 4, 5, 6, 7 or 8 to select the USART or UART peripheral.
Return values
None

◆ __HAL_UART_CLEAR_IDLEFLAG

#define __HAL_UART_CLEAR_IDLEFLAG (   __HANDLE__)    __HAL_UART_CLEAR_PEFLAG(__HANDLE__)

Clear the UART IDLE pending flag.

Parameters
<strong>HANDLE</strong>specifies the UART Handle. This parameter can be UARTx where x: 1, 2, 3, 4, 5, 6, 7 or 8 to select the USART or UART peripheral.
Return values
None

◆ UART_IT_MASK

#define UART_IT_MASK   0x0000FFFFU

Enable the specified UART interrupt.

Parameters
<strong>HANDLE</strong>specifies the UART Handle. This parameter can be UARTx where x: 1, 2, 3, 4, 5, 6, 7 or 8 to select the USART or UART peripheral.
<strong>INTERRUPT</strong>specifies the UART interrupt source to enable. This parameter can be one of the following values:
  • UART_IT_CTS: CTS change interrupt
  • UART_IT_LBD: LIN Break detection interrupt
  • UART_IT_TXE: Transmit Data Register empty interrupt
  • UART_IT_TC: Transmission complete interrupt
  • UART_IT_RXNE: Receive Data register not empty interrupt
  • UART_IT_IDLE: Idle line detection interrupt
  • UART_IT_PE: Parity Error interrupt
  • UART_IT_ERR: Error interrupt(Frame error, noise error, overrun error)
Return values
None

◆ __HAL_UART_ENABLE_IT

#define __HAL_UART_ENABLE_IT (   __HANDLE__,
  __INTERRUPT__ 
)
Value:
((((__INTERRUPT__) >> 28U) == 1U)? ((__HANDLE__)->Instance->CR1 |= ((__INTERRUPT__) & UART_IT_MASK)): \
(((__INTERRUPT__) >> 28U) == 2U)? ((__HANDLE__)->Instance->CR2 |= ((__INTERRUPT__) & UART_IT_MASK)): \
((__HANDLE__)->Instance->CR3 |= ((__INTERRUPT__) & UART_IT_MASK)))

◆ __HAL_UART_DISABLE_IT

#define __HAL_UART_DISABLE_IT (   __HANDLE__,
  __INTERRUPT__ 
)
Value:
((((__INTERRUPT__) >> 28U) == 1U)? ((__HANDLE__)->Instance->CR1 &= ~((__INTERRUPT__) & UART_IT_MASK)): \
(((__INTERRUPT__) >> 28U) == 2U)? ((__HANDLE__)->Instance->CR2 &= ~((__INTERRUPT__) & UART_IT_MASK)): \
((__HANDLE__)->Instance->CR3 &= ~ ((__INTERRUPT__) & UART_IT_MASK)))

Disable the specified UART interrupt.

Parameters
<strong>HANDLE</strong>specifies the UART Handle. This parameter can be UARTx where x: 1, 2, 3, 4, 5, 6, 7 or 8 to select the USART or UART peripheral.
<strong>INTERRUPT</strong>specifies the UART interrupt source to disable. This parameter can be one of the following values:
  • UART_IT_CTS: CTS change interrupt
  • UART_IT_LBD: LIN Break detection interrupt
  • UART_IT_TXE: Transmit Data Register empty interrupt
  • UART_IT_TC: Transmission complete interrupt
  • UART_IT_RXNE: Receive Data register not empty interrupt
  • UART_IT_IDLE: Idle line detection interrupt
  • UART_IT_PE: Parity Error interrupt
  • UART_IT_ERR: Error interrupt(Frame error, noise error, overrun error)
Return values
None

◆ __HAL_UART_GET_IT_SOURCE

#define __HAL_UART_GET_IT_SOURCE (   __HANDLE__,
  __IT__ 
)
Value:
(((((__IT__) >> 28U) == 1U)? (__HANDLE__)->Instance->CR1:(((((uint32_t)(__IT__)) >> 28U) == 2U)? \
(__HANDLE__)->Instance->CR2 : (__HANDLE__)->Instance->CR3)) & (((uint32_t)(__IT__)) & UART_IT_MASK))

Checks whether the specified UART interrupt has occurred or not.

Parameters
<strong>HANDLE</strong>specifies the UART Handle. This parameter can be UARTx where x: 1, 2, 3, 4, 5, 6, 7 or 8 to select the USART or UART peripheral.
<strong>IT</strong>specifies the UART interrupt source to check. This parameter can be one of the following values:
  • UART_IT_CTS: CTS change interrupt (not available for UART4 and UART5)
  • UART_IT_LBD: LIN Break detection interrupt
  • UART_IT_TXE: Transmit Data Register empty interrupt
  • UART_IT_TC: Transmission complete interrupt
  • UART_IT_RXNE: Receive Data register not empty interrupt
  • UART_IT_IDLE: Idle line detection interrupt
  • USART_IT_ERR: Error interrupt
Return values
Thenew state of IT (TRUE or FALSE).

◆ __HAL_UART_HWCONTROL_CTS_ENABLE

#define __HAL_UART_HWCONTROL_CTS_ENABLE (   __HANDLE__)
Value:
do{ \
SET_BIT((__HANDLE__)->Instance->CR3, USART_CR3_CTSE); \
(__HANDLE__)->Init.HwFlowCtl |= USART_CR3_CTSE; \
} while(0U)

Enable CTS flow control This macro allows to enable CTS hardware flow control for a given UART instance, without need to call HAL_UART_Init() function. As involving direct access to UART registers, usage of this macro should be fully endorsed by user.

Note
As macro is expected to be used for modifying CTS Hw flow control feature activation, without need for USART instance Deinit/Init, following conditions for macro call should be fulfilled :
  • UART instance should have already been initialised (through call of HAL_UART_Init() )
  • macro could only be called when corresponding UART instance is disabled (i.e HAL_UART_DISABLE(__HANDLE)) and should be followed by an Enable macro (i.e HAL_UART_ENABLE(__HANDLE)).
Parameters
<strong>HANDLE</strong>specifies the UART Handle. The Handle Instance can be USART1, USART2 or LPUART.
Return values
None

◆ __HAL_UART_HWCONTROL_CTS_DISABLE

#define __HAL_UART_HWCONTROL_CTS_DISABLE (   __HANDLE__)
Value:
do{ \
CLEAR_BIT((__HANDLE__)->Instance->CR3, USART_CR3_CTSE); \
(__HANDLE__)->Init.HwFlowCtl &= ~(USART_CR3_CTSE); \
} while(0U)

Disable CTS flow control This macro allows to disable CTS hardware flow control for a given UART instance, without need to call HAL_UART_Init() function. As involving direct access to UART registers, usage of this macro should be fully endorsed by user.

Note
As macro is expected to be used for modifying CTS Hw flow control feature activation, without need for USART instance Deinit/Init, following conditions for macro call should be fulfilled :
  • UART instance should have already been initialised (through call of HAL_UART_Init() )
  • macro could only be called when corresponding UART instance is disabled (i.e HAL_UART_DISABLE(__HANDLE)) and should be followed by an Enable macro (i.e HAL_UART_ENABLE(__HANDLE)).
Parameters
<strong>HANDLE</strong>specifies the UART Handle. The Handle Instance can be USART1, USART2 or LPUART.
Return values
None

◆ __HAL_UART_HWCONTROL_RTS_ENABLE

#define __HAL_UART_HWCONTROL_RTS_ENABLE (   __HANDLE__)
Value:
do{ \
SET_BIT((__HANDLE__)->Instance->CR3, USART_CR3_RTSE); \
(__HANDLE__)->Init.HwFlowCtl |= USART_CR3_RTSE; \
} while(0U)

Enable RTS flow control This macro allows to enable RTS hardware flow control for a given UART instance, without need to call HAL_UART_Init() function. As involving direct access to UART registers, usage of this macro should be fully endorsed by user.

Note
As macro is expected to be used for modifying RTS Hw flow control feature activation, without need for USART instance Deinit/Init, following conditions for macro call should be fulfilled :
  • UART instance should have already been initialised (through call of HAL_UART_Init() )
  • macro could only be called when corresponding UART instance is disabled (i.e HAL_UART_DISABLE(__HANDLE)) and should be followed by an Enable macro (i.e HAL_UART_ENABLE(__HANDLE)).
Parameters
<strong>HANDLE</strong>specifies the UART Handle. The Handle Instance can be USART1, USART2 or LPUART.
Return values
None

◆ __HAL_UART_HWCONTROL_RTS_DISABLE

#define __HAL_UART_HWCONTROL_RTS_DISABLE (   __HANDLE__)
Value:
do{ \
CLEAR_BIT((__HANDLE__)->Instance->CR3, USART_CR3_RTSE);\
(__HANDLE__)->Init.HwFlowCtl &= ~(USART_CR3_RTSE); \
} while(0U)

Disable RTS flow control This macro allows to disable RTS hardware flow control for a given UART instance, without need to call HAL_UART_Init() function. As involving direct access to UART registers, usage of this macro should be fully endorsed by user.

Note
As macro is expected to be used for modifying RTS Hw flow control feature activation, without need for USART instance Deinit/Init, following conditions for macro call should be fulfilled :
  • UART instance should have already been initialised (through call of HAL_UART_Init() )
  • macro could only be called when corresponding UART instance is disabled (i.e HAL_UART_DISABLE(__HANDLE)) and should be followed by an Enable macro (i.e HAL_UART_ENABLE(__HANDLE)).
Parameters
<strong>HANDLE</strong>specifies the UART Handle. The Handle Instance can be USART1, USART2 or LPUART.
Return values
None

◆ __HAL_UART_ONE_BIT_SAMPLE_ENABLE

#define __HAL_UART_ONE_BIT_SAMPLE_ENABLE (   __HANDLE__)    ((__HANDLE__)->Instance->CR3|= USART_CR3_ONEBIT)

macros to enables the UART's one bit sample method

Parameters
<strong>HANDLE</strong>specifies the UART Handle.
Return values
None

◆ __HAL_UART_ONE_BIT_SAMPLE_DISABLE

#define __HAL_UART_ONE_BIT_SAMPLE_DISABLE (   __HANDLE__)    ((__HANDLE__)->Instance->CR3 &= (uint16_t)~((uint16_t)USART_CR3_ONEBIT))

macros to disables the UART's one bit sample method

Parameters
<strong>HANDLE</strong>specifies the UART Handle.
Return values
None

◆ __HAL_UART_ENABLE

#define __HAL_UART_ENABLE (   __HANDLE__)    ((__HANDLE__)->Instance->CR1 |= USART_CR1_UE)

Enable UART.

Parameters
<strong>HANDLE</strong>specifies the UART Handle.
Return values
None

◆ __HAL_UART_DISABLE

#define __HAL_UART_DISABLE (   __HANDLE__)    ((__HANDLE__)->Instance->CR1 &= ~USART_CR1_UE)

Disable UART.

Parameters
<strong>HANDLE</strong>specifies the UART Handle.
Return values
None
HAL_UART_STATE_RESET
Definition: stm32f4xx_hal_uart.h:136
UART_IT_MASK
#define UART_IT_MASK
Enable the specified UART interrupt.
Definition: stm32f4xx_hal_uart.h:476