STM32L486xx HAL User Manual
Defines
UART Private Macros
UART

Defines

#define UART_DIV_LPUART(__PCLK__, __BAUD__)   (((((uint64_t)(__PCLK__)*256U)) + ((__BAUD__)/2U)) / (__BAUD__))
 BRR division operation to set BRR register with LPUART.
#define UART_DIV_SAMPLING8(__PCLK__, __BAUD__)   ((((__PCLK__)*2U) + ((__BAUD__)/2U)) / (__BAUD__))
 BRR division operation to set BRR register in 8-bit oversampling mode.
#define UART_DIV_SAMPLING16(__PCLK__, __BAUD__)   (((__PCLK__) + ((__BAUD__)/2U)) / (__BAUD__))
 BRR division operation to set BRR register in 16-bit oversampling mode.
#define UART_INSTANCE_LOWPOWER(__HANDLE__)   (IS_LPUART_INSTANCE((__HANDLE__)->Instance))
 Check whether or not UART instance is Low Power UART.
#define IS_UART_BAUDRATE(__BAUDRATE__)   ((__BAUDRATE__) < 10000001U)
 Check UART Baud rate.
#define IS_UART_ASSERTIONTIME(__TIME__)   ((__TIME__) <= 0x1FU)
 Check UART assertion time.
#define IS_UART_DEASSERTIONTIME(__TIME__)   ((__TIME__) <= 0x1FU)
 Check UART deassertion time.
#define IS_UART_STOPBITS(__STOPBITS__)
 Ensure that UART frame number of stop bits is valid.
#define IS_LPUART_STOPBITS(__STOPBITS__)
 Ensure that LPUART frame number of stop bits is valid.
#define IS_UART_PARITY(__PARITY__)
 Ensure that UART frame parity is valid.
#define IS_UART_HARDWARE_FLOW_CONTROL(__CONTROL__)
 Ensure that UART hardware flow control is valid.
#define IS_UART_MODE(__MODE__)   ((((__MODE__) & (~((uint32_t)(UART_MODE_TX_RX)))) == 0x00U) && ((__MODE__) != 0x00U))
 Ensure that UART communication mode is valid.
#define IS_UART_STATE(__STATE__)
 Ensure that UART state is valid.
#define IS_UART_OVERSAMPLING(__SAMPLING__)
 Ensure that UART oversampling is valid.
#define IS_UART_ONE_BIT_SAMPLE(__ONEBIT__)
 Ensure that UART frame sampling is valid.
#define IS_UART_ADVFEATURE_AUTOBAUDRATEMODE(__MODE__)
 Ensure that UART auto Baud rate detection mode is valid.
#define IS_UART_RECEIVER_TIMEOUT(__TIMEOUT__)
 Ensure that UART receiver timeout setting is valid.
#define IS_UART_LIN(__LIN__)
 Ensure that UART LIN state is valid.
#define IS_UART_LIN_BREAK_DETECT_LENGTH(__LENGTH__)
 Ensure that UART LIN break detection length is valid.
#define IS_UART_DMA_TX(__DMATX__)
 Ensure that UART DMA TX state is valid.
#define IS_UART_DMA_RX(__DMARX__)
 Ensure that UART DMA RX state is valid.
#define IS_UART_HALF_DUPLEX(__HDSEL__)
 Ensure that UART half-duplex state is valid.
#define IS_UART_WAKEUPMETHOD(__WAKEUP__)
 Ensure that UART wake-up method is valid.
#define IS_UART_REQUEST_PARAMETER(__PARAM__)
 Ensure that UART request parameter is valid.
#define IS_UART_ADVFEATURE_INIT(__INIT__)
 Ensure that UART advanced features initialization is valid.
#define IS_UART_ADVFEATURE_TXINV(__TXINV__)
 Ensure that UART frame TX inversion setting is valid.
#define IS_UART_ADVFEATURE_RXINV(__RXINV__)
 Ensure that UART frame RX inversion setting is valid.
#define IS_UART_ADVFEATURE_DATAINV(__DATAINV__)
 Ensure that UART frame data inversion setting is valid.
#define IS_UART_ADVFEATURE_SWAP(__SWAP__)
 Ensure that UART frame RX/TX pins swap setting is valid.
#define IS_UART_OVERRUN(__OVERRUN__)
 Ensure that UART frame overrun setting is valid.
#define IS_UART_ADVFEATURE_AUTOBAUDRATE(__AUTOBAUDRATE__)
 Ensure that UART auto Baud rate state is valid.
#define IS_UART_ADVFEATURE_DMAONRXERROR(__DMA__)
 Ensure that UART DMA enabling or disabling on error setting is valid.
#define IS_UART_ADVFEATURE_MSBFIRST(__MSBFIRST__)
 Ensure that UART frame MSB first setting is valid.
#define IS_UART_ADVFEATURE_STOPMODE(__STOPMODE__)
 Ensure that UART stop mode state is valid.
#define IS_UART_MUTE_MODE(__MUTE__)
 Ensure that UART mute mode state is valid.
#define IS_UART_WAKEUP_SELECTION(__WAKE__)
 Ensure that UART wake-up selection is valid.
#define IS_UART_DE_POLARITY(__POLARITY__)
 Ensure that UART driver enable polarity is valid.

Define Documentation

#define IS_LPUART_STOPBITS (   __STOPBITS__)
Value:
(((__STOPBITS__) == UART_STOPBITS_1) || \
                                          ((__STOPBITS__) == UART_STOPBITS_2))

Ensure that LPUART frame number of stop bits is valid.

Parameters:
__STOPBITS__LPUART frame number of stop bits.
Return values:
SET(__STOPBITS__ is valid) or RESET (__STOPBITS__ is invalid)

Definition at line 1293 of file stm32l4xx_hal_uart.h.

Referenced by UART_SetConfig().

#define IS_UART_ADVFEATURE_AUTOBAUDRATE (   __AUTOBAUDRATE__)
Value:
(((__AUTOBAUDRATE__) == UART_ADVFEATURE_AUTOBAUDRATE_DISABLE) || \
                                                            ((__AUTOBAUDRATE__) == UART_ADVFEATURE_AUTOBAUDRATE_ENABLE))

Ensure that UART auto Baud rate state is valid.

Parameters:
__AUTOBAUDRATE__UART auto Baud rate state.
Return values:
SET(__AUTOBAUDRATE__ is valid) or RESET (__AUTOBAUDRATE__ is invalid)

Definition at line 1484 of file stm32l4xx_hal_uart.h.

Referenced by UART_AdvFeatureConfig().

#define IS_UART_ADVFEATURE_AUTOBAUDRATEMODE (   __MODE__)
Value:

Ensure that UART auto Baud rate detection mode is valid.

Parameters:
__MODE__UART auto Baud rate detection mode.
Return values:
SET(__MODE__ is valid) or RESET (__MODE__ is invalid)

Definition at line 1352 of file stm32l4xx_hal_uart.h.

Referenced by UART_AdvFeatureConfig().

#define IS_UART_ADVFEATURE_DATAINV (   __DATAINV__)
Value:
(((__DATAINV__) == UART_ADVFEATURE_DATAINV_DISABLE) || \
                                                 ((__DATAINV__) == UART_ADVFEATURE_DATAINV_ENABLE))

Ensure that UART frame data inversion setting is valid.

Parameters:
__DATAINV__UART frame data inversion setting.
Return values:
SET(__DATAINV__ is valid) or RESET (__DATAINV__ is invalid)

Definition at line 1460 of file stm32l4xx_hal_uart.h.

Referenced by UART_AdvFeatureConfig().

#define IS_UART_ADVFEATURE_DMAONRXERROR (   __DMA__)
Value:

Ensure that UART DMA enabling or disabling on error setting is valid.

Parameters:
__DMA__UART DMA enabling or disabling on error setting.
Return values:
SET(__DMA__ is valid) or RESET (__DMA__ is invalid)

Definition at line 1492 of file stm32l4xx_hal_uart.h.

Referenced by UART_AdvFeatureConfig().

#define IS_UART_ADVFEATURE_INIT (   __INIT__)
Value:

Ensure that UART advanced features initialization is valid.

Parameters:
__INIT__UART advanced features initialization.
Return values:
SET(__INIT__ is valid) or RESET (__INIT__ is invalid)

Definition at line 1429 of file stm32l4xx_hal_uart.h.

Referenced by UART_AdvFeatureConfig().

#define IS_UART_ADVFEATURE_MSBFIRST (   __MSBFIRST__)
Value:
(((__MSBFIRST__) == UART_ADVFEATURE_MSBFIRST_DISABLE) || \
                                                   ((__MSBFIRST__) == UART_ADVFEATURE_MSBFIRST_ENABLE))

Ensure that UART frame MSB first setting is valid.

Parameters:
__MSBFIRST__UART frame MSB first setting.
Return values:
SET(__MSBFIRST__ is valid) or RESET (__MSBFIRST__ is invalid)

Definition at line 1500 of file stm32l4xx_hal_uart.h.

Referenced by UART_AdvFeatureConfig().

#define IS_UART_ADVFEATURE_RXINV (   __RXINV__)
Value:
(((__RXINV__) == UART_ADVFEATURE_RXINV_DISABLE) || \
                                             ((__RXINV__) == UART_ADVFEATURE_RXINV_ENABLE))

Ensure that UART frame RX inversion setting is valid.

Parameters:
__RXINV__UART frame RX inversion setting.
Return values:
SET(__RXINV__ is valid) or RESET (__RXINV__ is invalid)

Definition at line 1452 of file stm32l4xx_hal_uart.h.

Referenced by UART_AdvFeatureConfig().

#define IS_UART_ADVFEATURE_STOPMODE (   __STOPMODE__)
Value:
(((__STOPMODE__) == UART_ADVFEATURE_STOPMODE_DISABLE) || \
                                                   ((__STOPMODE__) == UART_ADVFEATURE_STOPMODE_ENABLE))

Ensure that UART stop mode state is valid.

Parameters:
__STOPMODE__UART stop mode state.
Return values:
SET(__STOPMODE__ is valid) or RESET (__STOPMODE__ is invalid)

Definition at line 1508 of file stm32l4xx_hal_uart.h.

#define IS_UART_ADVFEATURE_SWAP (   __SWAP__)
Value:
(((__SWAP__) == UART_ADVFEATURE_SWAP_DISABLE) || \
                                           ((__SWAP__) == UART_ADVFEATURE_SWAP_ENABLE))

Ensure that UART frame RX/TX pins swap setting is valid.

Parameters:
__SWAP__UART frame RX/TX pins swap setting.
Return values:
SET(__SWAP__ is valid) or RESET (__SWAP__ is invalid)

Definition at line 1468 of file stm32l4xx_hal_uart.h.

Referenced by UART_AdvFeatureConfig().

#define IS_UART_ADVFEATURE_TXINV (   __TXINV__)
Value:
(((__TXINV__) == UART_ADVFEATURE_TXINV_DISABLE) || \
                                             ((__TXINV__) == UART_ADVFEATURE_TXINV_ENABLE))

Ensure that UART frame TX inversion setting is valid.

Parameters:
__TXINV__UART frame TX inversion setting.
Return values:
SET(__TXINV__ is valid) or RESET (__TXINV__ is invalid)

Definition at line 1444 of file stm32l4xx_hal_uart.h.

Referenced by UART_AdvFeatureConfig().

#define IS_UART_ASSERTIONTIME (   __TIME__)    ((__TIME__) <= 0x1FU)

Check UART assertion time.

Parameters:
__TIME__5-bit value assertion time.
Return values:
Testresult (TRUE or FALSE).

Definition at line 1270 of file stm32l4xx_hal_uart.h.

Referenced by HAL_RS485Ex_Init().

#define IS_UART_BAUDRATE (   __BAUDRATE__)    ((__BAUDRATE__) < 10000001U)

Check UART Baud rate.

Parameters:
__BAUDRATE__Baudrate specified by the user. The maximum Baud Rate is derived from the maximum clock on L4 divided by the smallest oversampling used on the USART (i.e. 8) (i.e. 120 MHz on STM32L4Rx/L4Sx, 80 Mhz otherwise)
Return values:
SET(__BAUDRATE__ is valid) or RESET (__BAUDRATE__ is invalid)

Definition at line 1263 of file stm32l4xx_hal_uart.h.

Referenced by UART_SetConfig().

#define IS_UART_DE_POLARITY (   __POLARITY__)
Value:
(((__POLARITY__) == UART_DE_POLARITY_HIGH) || \
                                              ((__POLARITY__) == UART_DE_POLARITY_LOW))

Ensure that UART driver enable polarity is valid.

Parameters:
__POLARITY__UART driver enable polarity.
Return values:
SET(__POLARITY__ is valid) or RESET (__POLARITY__ is invalid)

Definition at line 1533 of file stm32l4xx_hal_uart.h.

Referenced by HAL_RS485Ex_Init().

#define IS_UART_DEASSERTIONTIME (   __TIME__)    ((__TIME__) <= 0x1FU)

Check UART deassertion time.

Parameters:
__TIME__5-bit value deassertion time.
Return values:
Testresult (TRUE or FALSE).

Definition at line 1276 of file stm32l4xx_hal_uart.h.

Referenced by HAL_RS485Ex_Init().

#define IS_UART_DMA_RX (   __DMARX__)
Value:
(((__DMARX__) == UART_DMA_RX_DISABLE) || \
                                       ((__DMARX__) == UART_DMA_RX_ENABLE))

Ensure that UART DMA RX state is valid.

Parameters:
__DMARX__UART DMA RX state.
Return values:
SET(__DMARX__ is valid) or RESET (__DMARX__ is invalid)

Definition at line 1394 of file stm32l4xx_hal_uart.h.

#define IS_UART_DMA_TX (   __DMATX__)
Value:
(((__DMATX__) == UART_DMA_TX_DISABLE) || \
                                       ((__DMATX__) == UART_DMA_TX_ENABLE))

Ensure that UART DMA TX state is valid.

Parameters:
__DMATX__UART DMA TX state.
Return values:
SET(__DMATX__ is valid) or RESET (__DMATX__ is invalid)

Definition at line 1386 of file stm32l4xx_hal_uart.h.

#define IS_UART_HALF_DUPLEX (   __HDSEL__)
Value:
(((__HDSEL__) == UART_HALF_DUPLEX_DISABLE) || \
                                            ((__HDSEL__) == UART_HALF_DUPLEX_ENABLE))

Ensure that UART half-duplex state is valid.

Parameters:
__HDSEL__UART half-duplex state.
Return values:
SET(__HDSEL__ is valid) or RESET (__HDSEL__ is invalid)

Definition at line 1402 of file stm32l4xx_hal_uart.h.

#define IS_UART_HARDWARE_FLOW_CONTROL (   __CONTROL__)
Value:
(((__CONTROL__) == UART_HWCONTROL_NONE) || \
                                    ((__CONTROL__) == UART_HWCONTROL_RTS)  || \
                                    ((__CONTROL__) == UART_HWCONTROL_CTS)  || \
                                    ((__CONTROL__) == UART_HWCONTROL_RTS_CTS))

Ensure that UART hardware flow control is valid.

Parameters:
__CONTROL__UART hardware flow control.
Return values:
SET(__CONTROL__ is valid) or RESET (__CONTROL__ is invalid)

Definition at line 1310 of file stm32l4xx_hal_uart.h.

Referenced by UART_SetConfig().

#define IS_UART_LIN (   __LIN__)
Value:
(((__LIN__) == UART_LIN_DISABLE) || \
                                     ((__LIN__) == UART_LIN_ENABLE))

Ensure that UART LIN state is valid.

Parameters:
__LIN__UART LIN state.
Return values:
SET(__LIN__ is valid) or RESET (__LIN__ is invalid)

Definition at line 1370 of file stm32l4xx_hal_uart.h.

#define IS_UART_LIN_BREAK_DETECT_LENGTH (   __LENGTH__)
Value:
(((__LENGTH__) == UART_LINBREAKDETECTLENGTH_10B) || \
                                                     ((__LENGTH__) == UART_LINBREAKDETECTLENGTH_11B))

Ensure that UART LIN break detection length is valid.

Parameters:
__LENGTH__UART LIN break detection length.
Return values:
SET(__LENGTH__ is valid) or RESET (__LENGTH__ is invalid)

Definition at line 1378 of file stm32l4xx_hal_uart.h.

Referenced by HAL_LIN_Init().

#define IS_UART_MODE (   __MODE__)    ((((__MODE__) & (~((uint32_t)(UART_MODE_TX_RX)))) == 0x00U) && ((__MODE__) != 0x00U))

Ensure that UART communication mode is valid.

Parameters:
__MODE__UART communication mode.
Return values:
SET(__MODE__ is valid) or RESET (__MODE__ is invalid)

Definition at line 1321 of file stm32l4xx_hal_uart.h.

Referenced by UART_SetConfig().

#define IS_UART_MUTE_MODE (   __MUTE__)
Value:

Ensure that UART mute mode state is valid.

Parameters:
__MUTE__UART mute mode state.
Return values:
SET(__MUTE__ is valid) or RESET (__MUTE__ is invalid)

Definition at line 1516 of file stm32l4xx_hal_uart.h.

#define IS_UART_ONE_BIT_SAMPLE (   __ONEBIT__)
Value:
(((__ONEBIT__) == UART_ONE_BIT_SAMPLE_DISABLE) || \
                                            ((__ONEBIT__) == UART_ONE_BIT_SAMPLE_ENABLE))

Ensure that UART frame sampling is valid.

Parameters:
__ONEBIT__UART frame sampling.
Return values:
SET(__ONEBIT__ is valid) or RESET (__ONEBIT__ is invalid)

Definition at line 1344 of file stm32l4xx_hal_uart.h.

Referenced by UART_SetConfig().

#define IS_UART_OVERRUN (   __OVERRUN__)
Value:
(((__OVERRUN__) == UART_ADVFEATURE_OVERRUN_ENABLE) || \
                                          ((__OVERRUN__) == UART_ADVFEATURE_OVERRUN_DISABLE))

Ensure that UART frame overrun setting is valid.

Parameters:
__OVERRUN__UART frame overrun setting.
Return values:
SET(__OVERRUN__ is valid) or RESET (__OVERRUN__ is invalid)

Definition at line 1476 of file stm32l4xx_hal_uart.h.

Referenced by UART_AdvFeatureConfig().

#define IS_UART_OVERSAMPLING (   __SAMPLING__)
Value:
(((__SAMPLING__) == UART_OVERSAMPLING_16) || \
                                            ((__SAMPLING__) == UART_OVERSAMPLING_8))

Ensure that UART oversampling is valid.

Parameters:
__SAMPLING__UART oversampling.
Return values:
SET(__SAMPLING__ is valid) or RESET (__SAMPLING__ is invalid)

Definition at line 1336 of file stm32l4xx_hal_uart.h.

Referenced by UART_SetConfig().

#define IS_UART_PARITY (   __PARITY__)
Value:
(((__PARITY__) == UART_PARITY_NONE) || \
                                    ((__PARITY__) == UART_PARITY_EVEN) || \
                                    ((__PARITY__) == UART_PARITY_ODD))

Ensure that UART frame parity is valid.

Parameters:
__PARITY__UART frame parity.
Return values:
SET(__PARITY__ is valid) or RESET (__PARITY__ is invalid)

Definition at line 1301 of file stm32l4xx_hal_uart.h.

Referenced by UART_SetConfig().

#define IS_UART_RECEIVER_TIMEOUT (   __TIMEOUT__)
Value:
(((__TIMEOUT__) == UART_RECEIVER_TIMEOUT_DISABLE) || \
                                               ((__TIMEOUT__) == UART_RECEIVER_TIMEOUT_ENABLE))

Ensure that UART receiver timeout setting is valid.

Parameters:
__TIMEOUT__UART receiver timeout setting.
Return values:
SET(__TIMEOUT__ is valid) or RESET (__TIMEOUT__ is invalid)

Definition at line 1362 of file stm32l4xx_hal_uart.h.

#define IS_UART_REQUEST_PARAMETER (   __PARAM__)
Value:
(((__PARAM__) == UART_AUTOBAUD_REQUEST)     || \
                                              ((__PARAM__) == UART_SENDBREAK_REQUEST)    || \
                                              ((__PARAM__) == UART_MUTE_MODE_REQUEST)    || \
                                              ((__PARAM__) == UART_RXDATA_FLUSH_REQUEST) || \
                                              ((__PARAM__) == UART_TXDATA_FLUSH_REQUEST))

Ensure that UART request parameter is valid.

Parameters:
__PARAM__UART request parameter.
Return values:
SET(__PARAM__ is valid) or RESET (__PARAM__ is invalid)

Definition at line 1418 of file stm32l4xx_hal_uart.h.

#define IS_UART_STATE (   __STATE__)
Value:
(((__STATE__) == UART_STATE_DISABLE) || \
                                  ((__STATE__) == UART_STATE_ENABLE))

Ensure that UART state is valid.

Parameters:
__STATE__UART state.
Return values:
SET(__STATE__ is valid) or RESET (__STATE__ is invalid)

Definition at line 1328 of file stm32l4xx_hal_uart.h.

#define IS_UART_STOPBITS (   __STOPBITS__)
Value:
(((__STOPBITS__) == UART_STOPBITS_0_5) || \
                                        ((__STOPBITS__) == UART_STOPBITS_1)   || \
                                        ((__STOPBITS__) == UART_STOPBITS_1_5) || \
                                        ((__STOPBITS__) == UART_STOPBITS_2))

Ensure that UART frame number of stop bits is valid.

Parameters:
__STOPBITS__UART frame number of stop bits.
Return values:
SET(__STOPBITS__ is valid) or RESET (__STOPBITS__ is invalid)

Definition at line 1283 of file stm32l4xx_hal_uart.h.

Referenced by UART_SetConfig().

#define IS_UART_WAKEUP_SELECTION (   __WAKE__)
Value:
(((__WAKE__) == UART_WAKEUP_ON_ADDRESS)           || \
                                            ((__WAKE__) == UART_WAKEUP_ON_STARTBIT)          || \
                                            ((__WAKE__) == UART_WAKEUP_ON_READDATA_NONEMPTY))

Ensure that UART wake-up selection is valid.

Parameters:
__WAKE__UART wake-up selection.
Return values:
SET(__WAKE__ is valid) or RESET (__WAKE__ is invalid)

Definition at line 1524 of file stm32l4xx_hal_uart.h.

Referenced by HAL_UARTEx_StopModeWakeUpSourceConfig().

#define IS_UART_WAKEUPMETHOD (   __WAKEUP__)
Value:
(((__WAKEUP__) == UART_WAKEUPMETHOD_IDLELINE) || \
                                          ((__WAKEUP__) == UART_WAKEUPMETHOD_ADDRESSMARK))

Ensure that UART wake-up method is valid.

Parameters:
__WAKEUP__UART wake-up method .
Return values:
SET(__WAKEUP__ is valid) or RESET (__WAKEUP__ is invalid)

Definition at line 1410 of file stm32l4xx_hal_uart.h.

Referenced by HAL_MultiProcessor_Init().

#define UART_DIV_LPUART (   __PCLK__,
  __BAUD__ 
)    (((((uint64_t)(__PCLK__)*256U)) + ((__BAUD__)/2U)) / (__BAUD__))

BRR division operation to set BRR register with LPUART.

Parameters:
__PCLK__LPUART clock.
__BAUD__Baud rate set by the user.
Return values:
Divisionresult

Definition at line 1230 of file stm32l4xx_hal_uart.h.

Referenced by UART_SetConfig().

#define UART_DIV_SAMPLING16 (   __PCLK__,
  __BAUD__ 
)    (((__PCLK__) + ((__BAUD__)/2U)) / (__BAUD__))

BRR division operation to set BRR register in 16-bit oversampling mode.

Parameters:
__PCLK__UART clock.
__BAUD__Baud rate set by the user.
Return values:
Divisionresult

Definition at line 1244 of file stm32l4xx_hal_uart.h.

Referenced by UART_SetConfig().

#define UART_DIV_SAMPLING8 (   __PCLK__,
  __BAUD__ 
)    ((((__PCLK__)*2U) + ((__BAUD__)/2U)) / (__BAUD__))

BRR division operation to set BRR register in 8-bit oversampling mode.

Parameters:
__PCLK__UART clock.
__BAUD__Baud rate set by the user.
Return values:
Divisionresult

Definition at line 1237 of file stm32l4xx_hal_uart.h.

Referenced by UART_SetConfig().

#define UART_INSTANCE_LOWPOWER (   __HANDLE__)    (IS_LPUART_INSTANCE((__HANDLE__)->Instance))

Check whether or not UART instance is Low Power UART.

Parameters:
__HANDLE__specifies the UART Handle.
Return values:
SET(instance is LPUART) or RESET (instance isn't LPUART)

Definition at line 1251 of file stm32l4xx_hal_uart.h.

Referenced by UART_SetConfig().