Go to the documentation of this file.
21 #ifndef STM32F7xx_HAL_UART_H
22 #define STM32F7xx_HAL_UART_H
79 uint32_t OverSampling;
226 #if (USE_HAL_UART_REGISTER_CALLBACKS == 1)
243 #if (USE_HAL_UART_REGISTER_CALLBACKS == 1)
249 HAL_UART_TX_HALFCOMPLETE_CB_ID = 0x00U,
250 HAL_UART_TX_COMPLETE_CB_ID = 0x01U,
251 HAL_UART_RX_HALFCOMPLETE_CB_ID = 0x02U,
252 HAL_UART_RX_COMPLETE_CB_ID = 0x03U,
253 HAL_UART_ERROR_CB_ID = 0x04U,
254 HAL_UART_ABORT_COMPLETE_CB_ID = 0x05U,
255 HAL_UART_ABORT_TRANSMIT_COMPLETE_CB_ID = 0x06U,
256 HAL_UART_ABORT_RECEIVE_COMPLETE_CB_ID = 0x07U,
257 HAL_UART_WAKEUP_CB_ID = 0x08U,
259 HAL_UART_MSPINIT_CB_ID = 0x0BU,
260 HAL_UART_MSPDEINIT_CB_ID = 0x0CU
262 } HAL_UART_CallbackIDTypeDef;
283 #define HAL_UART_STATE_RESET 0x00000000U
285 #define HAL_UART_STATE_READY 0x00000020U
287 #define HAL_UART_STATE_BUSY 0x00000024U
289 #define HAL_UART_STATE_BUSY_TX 0x00000021U
291 #define HAL_UART_STATE_BUSY_RX 0x00000022U
293 #define HAL_UART_STATE_BUSY_TX_RX 0x00000023U
296 #define HAL_UART_STATE_TIMEOUT 0x000000A0U
298 #define HAL_UART_STATE_ERROR 0x000000E0U
307 #define HAL_UART_ERROR_NONE ((uint32_t)0x00000000U)
308 #define HAL_UART_ERROR_PE ((uint32_t)0x00000001U)
309 #define HAL_UART_ERROR_NE ((uint32_t)0x00000002U)
310 #define HAL_UART_ERROR_FE ((uint32_t)0x00000004U)
311 #define HAL_UART_ERROR_ORE ((uint32_t)0x00000008U)
312 #define HAL_UART_ERROR_DMA ((uint32_t)0x00000010U)
313 #define HAL_UART_ERROR_RTO ((uint32_t)0x00000020U)
315 #if (USE_HAL_UART_REGISTER_CALLBACKS == 1)
316 #define HAL_UART_ERROR_INVALID_CALLBACK ((uint32_t)0x00000040U)
325 #define UART_STOPBITS_0_5 USART_CR2_STOP_0
326 #define UART_STOPBITS_1 0x00000000U
327 #define UART_STOPBITS_1_5 (USART_CR2_STOP_0 | USART_CR2_STOP_1)
328 #define UART_STOPBITS_2 USART_CR2_STOP_1
336 #define UART_PARITY_NONE 0x00000000U
337 #define UART_PARITY_EVEN USART_CR1_PCE
338 #define UART_PARITY_ODD (USART_CR1_PCE | USART_CR1_PS)
346 #define UART_HWCONTROL_NONE 0x00000000U
347 #define UART_HWCONTROL_RTS USART_CR3_RTSE
348 #define UART_HWCONTROL_CTS USART_CR3_CTSE
349 #define UART_HWCONTROL_RTS_CTS (USART_CR3_RTSE | USART_CR3_CTSE)
357 #define UART_MODE_RX USART_CR1_RE
358 #define UART_MODE_TX USART_CR1_TE
359 #define UART_MODE_TX_RX (USART_CR1_TE |USART_CR1_RE)
367 #define UART_STATE_DISABLE 0x00000000U
368 #define UART_STATE_ENABLE USART_CR1_UE
376 #define UART_OVERSAMPLING_16 0x00000000U
377 #define UART_OVERSAMPLING_8 USART_CR1_OVER8
385 #define UART_ONE_BIT_SAMPLE_DISABLE 0x00000000U
386 #define UART_ONE_BIT_SAMPLE_ENABLE USART_CR3_ONEBIT
394 #define UART_ADVFEATURE_AUTOBAUDRATE_ONSTARTBIT 0x00000000U
395 #define UART_ADVFEATURE_AUTOBAUDRATE_ONFALLINGEDGE USART_CR2_ABRMODE_0
396 #define UART_ADVFEATURE_AUTOBAUDRATE_ON0X7FFRAME USART_CR2_ABRMODE_1
397 #define UART_ADVFEATURE_AUTOBAUDRATE_ON0X55FRAME USART_CR2_ABRMODE
405 #define UART_RECEIVER_TIMEOUT_DISABLE 0x00000000U
406 #define UART_RECEIVER_TIMEOUT_ENABLE USART_CR2_RTOEN
414 #define UART_LIN_DISABLE 0x00000000U
415 #define UART_LIN_ENABLE USART_CR2_LINEN
423 #define UART_LINBREAKDETECTLENGTH_10B 0x00000000U
424 #define UART_LINBREAKDETECTLENGTH_11B USART_CR2_LBDL
432 #define UART_DMA_TX_DISABLE 0x00000000U
433 #define UART_DMA_TX_ENABLE USART_CR3_DMAT
441 #define UART_DMA_RX_DISABLE 0x00000000U
442 #define UART_DMA_RX_ENABLE USART_CR3_DMAR
450 #define UART_HALF_DUPLEX_DISABLE 0x00000000U
451 #define UART_HALF_DUPLEX_ENABLE USART_CR3_HDSEL
459 #define UART_WAKEUPMETHOD_IDLELINE 0x00000000U
460 #define UART_WAKEUPMETHOD_ADDRESSMARK USART_CR1_WAKE
468 #define UART_AUTOBAUD_REQUEST USART_RQR_ABRRQ
469 #define UART_SENDBREAK_REQUEST USART_RQR_SBKRQ
470 #define UART_MUTE_MODE_REQUEST USART_RQR_MMRQ
471 #define UART_RXDATA_FLUSH_REQUEST USART_RQR_RXFRQ
472 #define UART_TXDATA_FLUSH_REQUEST USART_RQR_TXFRQ
480 #define UART_ADVFEATURE_NO_INIT 0x00000000U
481 #define UART_ADVFEATURE_TXINVERT_INIT 0x00000001U
482 #define UART_ADVFEATURE_RXINVERT_INIT 0x00000002U
483 #define UART_ADVFEATURE_DATAINVERT_INIT 0x00000004U
484 #define UART_ADVFEATURE_SWAP_INIT 0x00000008U
485 #define UART_ADVFEATURE_RXOVERRUNDISABLE_INIT 0x00000010U
486 #define UART_ADVFEATURE_DMADISABLEONERROR_INIT 0x00000020U
487 #define UART_ADVFEATURE_AUTOBAUDRATE_INIT 0x00000040U
488 #define UART_ADVFEATURE_MSBFIRST_INIT 0x00000080U
496 #define UART_ADVFEATURE_TXINV_DISABLE 0x00000000U
497 #define UART_ADVFEATURE_TXINV_ENABLE USART_CR2_TXINV
505 #define UART_ADVFEATURE_RXINV_DISABLE 0x00000000U
506 #define UART_ADVFEATURE_RXINV_ENABLE USART_CR2_RXINV
514 #define UART_ADVFEATURE_DATAINV_DISABLE 0x00000000U
515 #define UART_ADVFEATURE_DATAINV_ENABLE USART_CR2_DATAINV
523 #define UART_ADVFEATURE_SWAP_DISABLE 0x00000000U
524 #define UART_ADVFEATURE_SWAP_ENABLE USART_CR2_SWAP
532 #define UART_ADVFEATURE_OVERRUN_ENABLE 0x00000000U
533 #define UART_ADVFEATURE_OVERRUN_DISABLE USART_CR3_OVRDIS
541 #define UART_ADVFEATURE_AUTOBAUDRATE_DISABLE 0x00000000U
542 #define UART_ADVFEATURE_AUTOBAUDRATE_ENABLE USART_CR2_ABREN
550 #define UART_ADVFEATURE_DMA_ENABLEONRXERROR 0x00000000U
551 #define UART_ADVFEATURE_DMA_DISABLEONRXERROR USART_CR3_DDRE
559 #define UART_ADVFEATURE_MSBFIRST_DISABLE 0x00000000U
560 #define UART_ADVFEATURE_MSBFIRST_ENABLE USART_CR2_MSBFIRST
564 #if defined(USART_CR1_UESM)
569 #define UART_ADVFEATURE_STOPMODE_DISABLE 0x00000000U
570 #define UART_ADVFEATURE_STOPMODE_ENABLE USART_CR1_UESM
579 #define UART_ADVFEATURE_MUTEMODE_DISABLE 0x00000000U
580 #define UART_ADVFEATURE_MUTEMODE_ENABLE USART_CR1_MME
588 #define UART_CR2_ADDRESS_LSB_POS 24U
592 #if defined(USART_CR1_UESM)
597 #define UART_WAKEUP_ON_ADDRESS 0x00000000U
598 #define UART_WAKEUP_ON_STARTBIT USART_CR3_WUS_1
599 #define UART_WAKEUP_ON_READDATA_NONEMPTY USART_CR3_WUS
608 #define UART_DE_POLARITY_HIGH 0x00000000U
609 #define UART_DE_POLARITY_LOW USART_CR3_DEP
617 #define UART_CR1_DEAT_ADDRESS_LSB_POS 21U
625 #define UART_CR1_DEDT_ADDRESS_LSB_POS 16U
633 #define UART_IT_MASK 0x001FU
641 #define HAL_UART_TIMEOUT_VALUE 0x1FFFFFFU
651 #if defined(USART_ISR_REACK)
652 #define UART_FLAG_REACK USART_ISR_REACK
654 #define UART_FLAG_TEACK USART_ISR_TEACK
655 #if defined(USART_CR1_UESM)
656 #define UART_FLAG_WUF USART_ISR_WUF
658 #define UART_FLAG_RWU USART_ISR_RWU
659 #define UART_FLAG_SBKF USART_ISR_SBKF
660 #define UART_FLAG_CMF USART_ISR_CMF
661 #define UART_FLAG_BUSY USART_ISR_BUSY
662 #define UART_FLAG_ABRF USART_ISR_ABRF
663 #define UART_FLAG_ABRE USART_ISR_ABRE
664 #define UART_FLAG_RTOF USART_ISR_RTOF
665 #define UART_FLAG_CTS USART_ISR_CTS
666 #define UART_FLAG_CTSIF USART_ISR_CTSIF
667 #define UART_FLAG_LBDF USART_ISR_LBDF
668 #define UART_FLAG_TXE USART_ISR_TXE
669 #define UART_FLAG_TC USART_ISR_TC
670 #define UART_FLAG_RXNE USART_ISR_RXNE
671 #define UART_FLAG_IDLE USART_ISR_IDLE
672 #define UART_FLAG_ORE USART_ISR_ORE
673 #define UART_FLAG_NE USART_ISR_NE
674 #define UART_FLAG_FE USART_ISR_FE
675 #define UART_FLAG_PE USART_ISR_PE
698 #define UART_IT_PE 0x0028U
699 #define UART_IT_TXE 0x0727U
700 #define UART_IT_TC 0x0626U
701 #define UART_IT_RXNE 0x0525U
702 #define UART_IT_IDLE 0x0424U
703 #define UART_IT_LBD 0x0846U
704 #define UART_IT_CTS 0x096AU
705 #define UART_IT_CM 0x112EU
706 #if defined(USART_CR1_UESM)
707 #define UART_IT_WUF 0x1476U
709 #define UART_IT_RTO 0x0B3AU
711 #define UART_IT_ERR 0x0060U
713 #define UART_IT_ORE 0x0300U
714 #define UART_IT_NE 0x0200U
715 #define UART_IT_FE 0x0100U
723 #define UART_CLEAR_PEF USART_ICR_PECF
724 #define UART_CLEAR_FEF USART_ICR_FECF
725 #define UART_CLEAR_NEF USART_ICR_NCF
726 #define UART_CLEAR_OREF USART_ICR_ORECF
727 #define UART_CLEAR_IDLEF USART_ICR_IDLECF
728 #define UART_CLEAR_TCF USART_ICR_TCCF
729 #define UART_CLEAR_LBDF USART_ICR_LBDCF
730 #define UART_CLEAR_CTSF USART_ICR_CTSCF
731 #define UART_CLEAR_CMF USART_ICR_CMCF
732 #if defined(USART_CR1_UESM)
733 #define UART_CLEAR_WUF USART_ICR_WUCF
735 #define UART_CLEAR_RTOF USART_ICR_RTOCF
754 #if (USE_HAL_UART_REGISTER_CALLBACKS == 1)
755 #define __HAL_UART_RESET_HANDLE_STATE(__HANDLE__) do{ \
756 (__HANDLE__)->gState = HAL_UART_STATE_RESET; \
757 (__HANDLE__)->RxState = HAL_UART_STATE_RESET; \
758 (__HANDLE__)->MspInitCallback = NULL; \
759 (__HANDLE__)->MspDeInitCallback = NULL; \
762 #define __HAL_UART_RESET_HANDLE_STATE(__HANDLE__) do{ \
763 (__HANDLE__)->gState = HAL_UART_STATE_RESET; \
764 (__HANDLE__)->RxState = HAL_UART_STATE_RESET; \
772 #define __HAL_UART_FLUSH_DRREGISTER(__HANDLE__) \
774 SET_BIT((__HANDLE__)->Instance->RQR, UART_RXDATA_FLUSH_REQUEST); \
775 SET_BIT((__HANDLE__)->Instance->RQR, UART_TXDATA_FLUSH_REQUEST); \
797 #define __HAL_UART_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ICR = (__FLAG__))
803 #define __HAL_UART_CLEAR_PEFLAG(__HANDLE__) __HAL_UART_CLEAR_FLAG((__HANDLE__), UART_CLEAR_PEF)
809 #define __HAL_UART_CLEAR_FEFLAG(__HANDLE__) __HAL_UART_CLEAR_FLAG((__HANDLE__), UART_CLEAR_FEF)
815 #define __HAL_UART_CLEAR_NEFLAG(__HANDLE__) __HAL_UART_CLEAR_FLAG((__HANDLE__), UART_CLEAR_NEF)
821 #define __HAL_UART_CLEAR_OREFLAG(__HANDLE__) __HAL_UART_CLEAR_FLAG((__HANDLE__), UART_CLEAR_OREF)
827 #define __HAL_UART_CLEAR_IDLEFLAG(__HANDLE__) __HAL_UART_CLEAR_FLAG((__HANDLE__), UART_CLEAR_IDLEF)
860 #define __HAL_UART_GET_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->ISR & (__FLAG__)) == (__FLAG__))
881 #define __HAL_UART_ENABLE_IT(__HANDLE__, __INTERRUPT__) (((((uint8_t)(__INTERRUPT__)) >> 5U) == 1U)? ((__HANDLE__)->Instance->CR1 |= (1U << ((__INTERRUPT__) & UART_IT_MASK))): \
882 ((((uint8_t)(__INTERRUPT__)) >> 5U) == 2U)? ((__HANDLE__)->Instance->CR2 |= (1U << ((__INTERRUPT__) & UART_IT_MASK))): \
883 ((__HANDLE__)->Instance->CR3 |= (1U << ((__INTERRUPT__) & UART_IT_MASK))))
905 #define __HAL_UART_DISABLE_IT(__HANDLE__, __INTERRUPT__) (((((uint8_t)(__INTERRUPT__)) >> 5U) == 1U)? ((__HANDLE__)->Instance->CR1 &= ~ (1U << ((__INTERRUPT__) & UART_IT_MASK))): \
906 ((((uint8_t)(__INTERRUPT__)) >> 5U) == 2U)? ((__HANDLE__)->Instance->CR2 &= ~ (1U << ((__INTERRUPT__) & UART_IT_MASK))): \
907 ((__HANDLE__)->Instance->CR3 &= ~ (1U << ((__INTERRUPT__) & UART_IT_MASK))))
928 #define __HAL_UART_GET_IT(__HANDLE__, __INTERRUPT__) ((((__HANDLE__)->Instance->ISR\
929 & (1U << ((__INTERRUPT__)>> 8U))) != RESET) ? SET : RESET)
950 #define __HAL_UART_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((((((uint8_t)(__INTERRUPT__)) >> 5U) == 1U) ? (__HANDLE__)->Instance->CR1 : \
951 (((((uint8_t)(__INTERRUPT__)) >> 5U) == 2U) ? (__HANDLE__)->Instance->CR2 : \
952 (__HANDLE__)->Instance->CR3)) & (1U << (((uint16_t)(__INTERRUPT__)) & UART_IT_MASK))) != RESET) ? SET : RESET)
974 #define __HAL_UART_CLEAR_IT(__HANDLE__, __IT_CLEAR__) ((__HANDLE__)->Instance->ICR = (uint32_t)(__IT_CLEAR__))
987 #define __HAL_UART_SEND_REQ(__HANDLE__, __REQ__) ((__HANDLE__)->Instance->RQR |= (uint16_t)(__REQ__))
993 #define __HAL_UART_ONE_BIT_SAMPLE_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR3|= USART_CR3_ONEBIT)
999 #define __HAL_UART_ONE_BIT_SAMPLE_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR3 &= ~USART_CR3_ONEBIT)
1005 #define __HAL_UART_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR1 |= USART_CR1_UE)
1011 #define __HAL_UART_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR1 &= ~USART_CR1_UE)
1025 #define __HAL_UART_HWCONTROL_CTS_ENABLE(__HANDLE__) \
1027 SET_BIT((__HANDLE__)->Instance->CR3, USART_CR3_CTSE); \
1028 (__HANDLE__)->Init.HwFlowCtl |= USART_CR3_CTSE; \
1043 #define __HAL_UART_HWCONTROL_CTS_DISABLE(__HANDLE__) \
1045 CLEAR_BIT((__HANDLE__)->Instance->CR3, USART_CR3_CTSE); \
1046 (__HANDLE__)->Init.HwFlowCtl &= ~(USART_CR3_CTSE); \
1061 #define __HAL_UART_HWCONTROL_RTS_ENABLE(__HANDLE__) \
1063 SET_BIT((__HANDLE__)->Instance->CR3, USART_CR3_RTSE); \
1064 (__HANDLE__)->Init.HwFlowCtl |= USART_CR3_RTSE; \
1079 #define __HAL_UART_HWCONTROL_RTS_DISABLE(__HANDLE__) \
1081 CLEAR_BIT((__HANDLE__)->Instance->CR3, USART_CR3_RTSE);\
1082 (__HANDLE__)->Init.HwFlowCtl &= ~(USART_CR3_RTSE); \
1099 #define UART_DIV_SAMPLING8(__PCLK__, __BAUD__) ((((__PCLK__)*2U) + ((__BAUD__)/2U)) / (__BAUD__))
1106 #define UART_DIV_SAMPLING16(__PCLK__, __BAUD__) (((__PCLK__) + ((__BAUD__)/2U)) / (__BAUD__))
1115 #define IS_UART_BAUDRATE(__BAUDRATE__) ((__BAUDRATE__) < 27000001U)
1121 #define IS_UART_ASSERTIONTIME(__TIME__) ((__TIME__) <= 0x1FU)
1127 #define IS_UART_DEASSERTIONTIME(__TIME__) ((__TIME__) <= 0x1FU)
1134 #define IS_UART_STOPBITS(__STOPBITS__) (((__STOPBITS__) == UART_STOPBITS_0_5) || \
1135 ((__STOPBITS__) == UART_STOPBITS_1) || \
1136 ((__STOPBITS__) == UART_STOPBITS_1_5) || \
1137 ((__STOPBITS__) == UART_STOPBITS_2))
1145 #define IS_UART_PARITY(__PARITY__) (((__PARITY__) == UART_PARITY_NONE) || \
1146 ((__PARITY__) == UART_PARITY_EVEN) || \
1147 ((__PARITY__) == UART_PARITY_ODD))
1154 #define IS_UART_HARDWARE_FLOW_CONTROL(__CONTROL__)\
1155 (((__CONTROL__) == UART_HWCONTROL_NONE) || \
1156 ((__CONTROL__) == UART_HWCONTROL_RTS) || \
1157 ((__CONTROL__) == UART_HWCONTROL_CTS) || \
1158 ((__CONTROL__) == UART_HWCONTROL_RTS_CTS))
1165 #define IS_UART_MODE(__MODE__) ((((__MODE__) & (~((uint32_t)(UART_MODE_TX_RX)))) == 0x00U) && ((__MODE__) != 0x00U))
1172 #define IS_UART_STATE(__STATE__) (((__STATE__) == UART_STATE_DISABLE) || \
1173 ((__STATE__) == UART_STATE_ENABLE))
1180 #define IS_UART_OVERSAMPLING(__SAMPLING__) (((__SAMPLING__) == UART_OVERSAMPLING_16) || \
1181 ((__SAMPLING__) == UART_OVERSAMPLING_8))
1188 #define IS_UART_ONE_BIT_SAMPLE(__ONEBIT__) (((__ONEBIT__) == UART_ONE_BIT_SAMPLE_DISABLE) || \
1189 ((__ONEBIT__) == UART_ONE_BIT_SAMPLE_ENABLE))
1196 #define IS_UART_ADVFEATURE_AUTOBAUDRATEMODE(__MODE__) (((__MODE__) == UART_ADVFEATURE_AUTOBAUDRATE_ONSTARTBIT) || \
1197 ((__MODE__) == UART_ADVFEATURE_AUTOBAUDRATE_ONFALLINGEDGE) || \
1198 ((__MODE__) == UART_ADVFEATURE_AUTOBAUDRATE_ON0X7FFRAME) || \
1199 ((__MODE__) == UART_ADVFEATURE_AUTOBAUDRATE_ON0X55FRAME))
1206 #define IS_UART_RECEIVER_TIMEOUT(__TIMEOUT__) (((__TIMEOUT__) == UART_RECEIVER_TIMEOUT_DISABLE) || \
1207 ((__TIMEOUT__) == UART_RECEIVER_TIMEOUT_ENABLE))
1214 #define IS_UART_RECEIVER_TIMEOUT_VALUE(__TIMEOUTVALUE__) ((__TIMEOUTVALUE__) <= 0xFFFFFFU)
1221 #define IS_UART_LIN(__LIN__) (((__LIN__) == UART_LIN_DISABLE) || \
1222 ((__LIN__) == UART_LIN_ENABLE))
1229 #define IS_UART_LIN_BREAK_DETECT_LENGTH(__LENGTH__) (((__LENGTH__) == UART_LINBREAKDETECTLENGTH_10B) || \
1230 ((__LENGTH__) == UART_LINBREAKDETECTLENGTH_11B))
1237 #define IS_UART_DMA_TX(__DMATX__) (((__DMATX__) == UART_DMA_TX_DISABLE) || \
1238 ((__DMATX__) == UART_DMA_TX_ENABLE))
1245 #define IS_UART_DMA_RX(__DMARX__) (((__DMARX__) == UART_DMA_RX_DISABLE) || \
1246 ((__DMARX__) == UART_DMA_RX_ENABLE))
1253 #define IS_UART_HALF_DUPLEX(__HDSEL__) (((__HDSEL__) == UART_HALF_DUPLEX_DISABLE) || \
1254 ((__HDSEL__) == UART_HALF_DUPLEX_ENABLE))
1261 #define IS_UART_WAKEUPMETHOD(__WAKEUP__) (((__WAKEUP__) == UART_WAKEUPMETHOD_IDLELINE) || \
1262 ((__WAKEUP__) == UART_WAKEUPMETHOD_ADDRESSMARK))
1269 #define IS_UART_REQUEST_PARAMETER(__PARAM__) (((__PARAM__) == UART_AUTOBAUD_REQUEST) || \
1270 ((__PARAM__) == UART_SENDBREAK_REQUEST) || \
1271 ((__PARAM__) == UART_MUTE_MODE_REQUEST) || \
1272 ((__PARAM__) == UART_RXDATA_FLUSH_REQUEST) || \
1273 ((__PARAM__) == UART_TXDATA_FLUSH_REQUEST))
1280 #define IS_UART_ADVFEATURE_INIT(__INIT__) ((__INIT__) <= (UART_ADVFEATURE_NO_INIT | \
1281 UART_ADVFEATURE_TXINVERT_INIT | \
1282 UART_ADVFEATURE_RXINVERT_INIT | \
1283 UART_ADVFEATURE_DATAINVERT_INIT | \
1284 UART_ADVFEATURE_SWAP_INIT | \
1285 UART_ADVFEATURE_RXOVERRUNDISABLE_INIT | \
1286 UART_ADVFEATURE_DMADISABLEONERROR_INIT | \
1287 UART_ADVFEATURE_AUTOBAUDRATE_INIT | \
1288 UART_ADVFEATURE_MSBFIRST_INIT))
1295 #define IS_UART_ADVFEATURE_TXINV(__TXINV__) (((__TXINV__) == UART_ADVFEATURE_TXINV_DISABLE) || \
1296 ((__TXINV__) == UART_ADVFEATURE_TXINV_ENABLE))
1303 #define IS_UART_ADVFEATURE_RXINV(__RXINV__) (((__RXINV__) == UART_ADVFEATURE_RXINV_DISABLE) || \
1304 ((__RXINV__) == UART_ADVFEATURE_RXINV_ENABLE))
1311 #define IS_UART_ADVFEATURE_DATAINV(__DATAINV__) (((__DATAINV__) == UART_ADVFEATURE_DATAINV_DISABLE) || \
1312 ((__DATAINV__) == UART_ADVFEATURE_DATAINV_ENABLE))
1319 #define IS_UART_ADVFEATURE_SWAP(__SWAP__) (((__SWAP__) == UART_ADVFEATURE_SWAP_DISABLE) || \
1320 ((__SWAP__) == UART_ADVFEATURE_SWAP_ENABLE))
1327 #define IS_UART_OVERRUN(__OVERRUN__) (((__OVERRUN__) == UART_ADVFEATURE_OVERRUN_ENABLE) || \
1328 ((__OVERRUN__) == UART_ADVFEATURE_OVERRUN_DISABLE))
1335 #define IS_UART_ADVFEATURE_AUTOBAUDRATE(__AUTOBAUDRATE__) (((__AUTOBAUDRATE__) == UART_ADVFEATURE_AUTOBAUDRATE_DISABLE) || \
1336 ((__AUTOBAUDRATE__) == UART_ADVFEATURE_AUTOBAUDRATE_ENABLE))
1343 #define IS_UART_ADVFEATURE_DMAONRXERROR(__DMA__) (((__DMA__) == UART_ADVFEATURE_DMA_ENABLEONRXERROR) || \
1344 ((__DMA__) == UART_ADVFEATURE_DMA_DISABLEONRXERROR))
1351 #define IS_UART_ADVFEATURE_MSBFIRST(__MSBFIRST__) (((__MSBFIRST__) == UART_ADVFEATURE_MSBFIRST_DISABLE) || \
1352 ((__MSBFIRST__) == UART_ADVFEATURE_MSBFIRST_ENABLE))
1354 #if defined(USART_CR1_UESM)
1360 #define IS_UART_ADVFEATURE_STOPMODE(__STOPMODE__) (((__STOPMODE__) == UART_ADVFEATURE_STOPMODE_DISABLE) || \
1361 ((__STOPMODE__) == UART_ADVFEATURE_STOPMODE_ENABLE))
1369 #define IS_UART_MUTE_MODE(__MUTE__) (((__MUTE__) == UART_ADVFEATURE_MUTEMODE_DISABLE) || \
1370 ((__MUTE__) == UART_ADVFEATURE_MUTEMODE_ENABLE))
1371 #if defined(USART_CR1_UESM)
1378 #define IS_UART_WAKEUP_SELECTION(__WAKE__) (((__WAKE__) == UART_WAKEUP_ON_ADDRESS) || \
1379 ((__WAKE__) == UART_WAKEUP_ON_STARTBIT) || \
1380 ((__WAKE__) == UART_WAKEUP_ON_READDATA_NONEMPTY))
1388 #define IS_UART_DE_POLARITY(__POLARITY__) (((__POLARITY__) == UART_DE_POLARITY_HIGH) || \
1389 ((__POLARITY__) == UART_DE_POLARITY_LOW))
1419 #if (USE_HAL_UART_REGISTER_CALLBACKS == 1)
1421 pUART_CallbackTypeDef pCallback);
1505 #if (USE_HAL_UART_REGISTER_CALLBACKS == 1)
1511 uint32_t Tickstart, uint32_t Timeout);
void HAL_UART_ErrorCallback(UART_HandleTypeDef *huart)
HAL_StatusTypeDef HAL_UART_Transmit_IT(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size)
void(* TxISR)(struct __UART_HandleTypeDef *huart)
HAL_StatusTypeDef
HAL Status structures definition
void HAL_UART_TxCpltCallback(UART_HandleTypeDef *huart)
HAL_UART_StateTypeDef
HAL UART State structures definition.
HAL_StatusTypeDef HAL_UART_AbortReceive(UART_HandleTypeDef *huart)
Universal Synchronous Asynchronous Receiver Transmitter.
HAL_StatusTypeDef HAL_LIN_SendBreak(UART_HandleTypeDef *huart)
HAL_StatusTypeDef HAL_UART_Transmit(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size, uint32_t Timeout)
DMA handle Structure definition.
HAL_StatusTypeDef HAL_UART_Transmit_DMA(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size)
@ UART_CLOCKSOURCE_SYSCLK
@ UART_CLOCKSOURCE_UNDEFINED
__IO uint16_t TxXferCount
HAL_StatusTypeDef HAL_UART_DMAStop(UART_HandleTypeDef *huart)
void UART_AdvFeatureConfig(UART_HandleTypeDef *huart)
HAL_StatusTypeDef HAL_UART_Abort_IT(UART_HandleTypeDef *huart)
HAL_StatusTypeDef HAL_MultiProcessor_EnableMuteMode(UART_HandleTypeDef *huart)
UART handle Structure definition.
uint32_t RxPinLevelInvert
Header file of UART HAL Extended module.
HAL_StatusTypeDef HAL_UART_DisableReceiverTimeout(UART_HandleTypeDef *huart)
HAL_LockTypeDef
HAL Lock structures definition
HAL_StatusTypeDef HAL_MultiProcessor_DisableMuteMode(UART_HandleTypeDef *huart)
HAL_StatusTypeDef HAL_UART_DMAResume(UART_HandleTypeDef *huart)
void HAL_UART_MspInit(UART_HandleTypeDef *huart)
UART MSP Initialization This function configures the hardware resources used in this example.
void HAL_UART_ReceiverTimeout_Config(UART_HandleTypeDef *huart, uint32_t TimeoutValue)
HAL_StatusTypeDef HAL_HalfDuplex_EnableReceiver(UART_HandleTypeDef *huart)
UART Init Structure definition.
HAL_StatusTypeDef UART_CheckIdleState(UART_HandleTypeDef *huart)
void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart)
UART Advanced Features initialization structure definition.
void HAL_UART_RxHalfCpltCallback(UART_HandleTypeDef *huart)
DMA_HandleTypeDef * hdmatx
HAL_UART_StateTypeDef HAL_UART_GetState(UART_HandleTypeDef *huart)
HAL_StatusTypeDef HAL_UART_EnableReceiverTimeout(UART_HandleTypeDef *huart)
HAL_StatusTypeDef HAL_UART_AbortReceive_IT(UART_HandleTypeDef *huart)
HAL_StatusTypeDef HAL_UART_Init(UART_HandleTypeDef *huart)
HAL_StatusTypeDef HAL_UART_AbortTransmit_IT(UART_HandleTypeDef *huart)
struct __UART_HandleTypeDef UART_HandleTypeDef
UART handle Structure definition.
HAL_StatusTypeDef HAL_UART_Receive_DMA(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size)
uint32_t DMADisableonRxError
uint32_t AutoBaudRateMode
__IO HAL_UART_StateTypeDef RxState
uint32_t TxPinLevelInvert
UART_AdvFeatureInitTypeDef AdvancedInit
UART_ClockSourceTypeDef
UART clock sources definition.
void(* RxISR)(struct __UART_HandleTypeDef *huart)
HAL_StatusTypeDef HAL_UART_Receive(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size, uint32_t Timeout)
__IO HAL_UART_StateTypeDef gState
DMA_HandleTypeDef * hdmarx
HAL_StatusTypeDef UART_SetConfig(UART_HandleTypeDef *huart)
HAL_StatusTypeDef HAL_HalfDuplex_EnableTransmitter(UART_HandleTypeDef *huart)
HAL_StatusTypeDef UART_WaitOnFlagUntilTimeout(UART_HandleTypeDef *huart, uint32_t Flag, FlagStatus Status, uint32_t Tickstart, uint32_t Timeout)
This file contains HAL common defines, enumeration, macros and structures definitions.
HAL_StatusTypeDef HAL_MultiProcessor_Init(UART_HandleTypeDef *huart, uint8_t Address, uint32_t WakeUpMethod)
HAL_StatusTypeDef HAL_UART_AbortTransmit(UART_HandleTypeDef *huart)
HAL_StatusTypeDef HAL_LIN_Init(UART_HandleTypeDef *huart, uint32_t BreakDetectLength)
void HAL_UART_AbortReceiveCpltCallback(UART_HandleTypeDef *huart)
void HAL_UART_IRQHandler(UART_HandleTypeDef *huart)
HAL_StatusTypeDef HAL_HalfDuplex_Init(UART_HandleTypeDef *huart)
HAL_StatusTypeDef HAL_UART_DeInit(UART_HandleTypeDef *huart)
void HAL_UART_AbortTransmitCpltCallback(UART_HandleTypeDef *huart)
void HAL_UART_TxHalfCpltCallback(UART_HandleTypeDef *huart)
HAL_StatusTypeDef HAL_UART_Receive_IT(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size)
HAL_StatusTypeDef HAL_MultiProcessor_EnterMuteMode(UART_HandleTypeDef *huart)
uint32_t HAL_UART_StateTypeDef
HAL UART State definition.
void HAL_UART_AbortCpltCallback(UART_HandleTypeDef *huart)
__IO uint16_t RxXferCount
void HAL_UART_MspDeInit(UART_HandleTypeDef *huart)
UART MSP De-Initialization This function freeze the hardware resources used in this example.
uint32_t AutoBaudRateEnable
HAL_StatusTypeDef HAL_UART_DMAPause(UART_HandleTypeDef *huart)
HAL_StatusTypeDef HAL_UART_Abort(UART_HandleTypeDef *huart)
uint32_t HAL_UART_GetError(UART_HandleTypeDef *huart)