Go to the documentation of this file.
219 #include "stm32f4xx_hal.h"
229 #ifdef HAL_UART_MODULE_ENABLED
246 #if (USE_HAL_UART_REGISTER_CALLBACKS == 1)
346 #if (USE_HAL_UART_REGISTER_CALLBACKS == 1)
347 UART_InitCallbacksToDefault(
huart);
412 #if (USE_HAL_UART_REGISTER_CALLBACKS == 1)
413 UART_InitCallbacksToDefault(
huart);
488 #if (USE_HAL_UART_REGISTER_CALLBACKS == 1)
489 UART_InitCallbacksToDefault(
huart);
570 #if (USE_HAL_UART_REGISTER_CALLBACKS == 1)
571 UART_InitCallbacksToDefault(
huart);
641 #if (USE_HAL_UART_REGISTER_CALLBACKS == 1)
693 #if (USE_HAL_UART_REGISTER_CALLBACKS == 1)
717 if (pCallback ==
NULL)
731 case HAL_UART_TX_HALFCOMPLETE_CB_ID :
732 huart->TxHalfCpltCallback = pCallback;
735 case HAL_UART_TX_COMPLETE_CB_ID :
736 huart->TxCpltCallback = pCallback;
739 case HAL_UART_RX_HALFCOMPLETE_CB_ID :
740 huart->RxHalfCpltCallback = pCallback;
743 case HAL_UART_RX_COMPLETE_CB_ID :
744 huart->RxCpltCallback = pCallback;
747 case HAL_UART_ERROR_CB_ID :
748 huart->ErrorCallback = pCallback;
751 case HAL_UART_ABORT_COMPLETE_CB_ID :
752 huart->AbortCpltCallback = pCallback;
755 case HAL_UART_ABORT_TRANSMIT_COMPLETE_CB_ID :
756 huart->AbortTransmitCpltCallback = pCallback;
759 case HAL_UART_ABORT_RECEIVE_COMPLETE_CB_ID :
760 huart->AbortReceiveCpltCallback = pCallback;
763 case HAL_UART_MSPINIT_CB_ID :
764 huart->MspInitCallback = pCallback;
767 case HAL_UART_MSPDEINIT_CB_ID :
768 huart->MspDeInitCallback = pCallback;
784 case HAL_UART_MSPINIT_CB_ID :
785 huart->MspInitCallback = pCallback;
788 case HAL_UART_MSPDEINIT_CB_ID :
789 huart->MspDeInitCallback = pCallback;
845 case HAL_UART_TX_HALFCOMPLETE_CB_ID :
849 case HAL_UART_TX_COMPLETE_CB_ID :
853 case HAL_UART_RX_HALFCOMPLETE_CB_ID :
857 case HAL_UART_RX_COMPLETE_CB_ID :
861 case HAL_UART_ERROR_CB_ID :
865 case HAL_UART_ABORT_COMPLETE_CB_ID :
869 case HAL_UART_ABORT_TRANSMIT_COMPLETE_CB_ID :
873 case HAL_UART_ABORT_RECEIVE_COMPLETE_CB_ID :
877 case HAL_UART_MSPINIT_CB_ID :
881 case HAL_UART_MSPDEINIT_CB_ID :
898 case HAL_UART_MSPINIT_CB_ID :
902 case HAL_UART_MSPDEINIT_CB_ID :
1027 uint32_t tickstart = 0U;
1032 if ((pData ==
NULL) || (Size == 0U))
1061 tmp = (uint16_t *) pData;
1113 uint32_t tickstart = 0U;
1118 if ((pData ==
NULL) || (Size == 0U))
1148 tmp = (uint16_t *) pData;
1206 if ((pData ==
NULL) || (Size == 0U))
1251 if ((pData ==
NULL) || (Size == 0U))
1304 if ((pData ==
NULL) || (Size == 0U))
1332 tmp = (uint32_t *)&pData;
1372 if ((pData ==
NULL) || (Size == 0U))
1399 tmp = (uint32_t *)&pData;
1434 uint32_t dmarequest = 0x00U;
1507 uint32_t dmarequest = 0x00U;
1525 UART_EndTxTransfer(
huart);
1539 UART_EndRxTransfer(
huart);
1746 uint32_t AbortCplt = 0x01U;
1832 if (AbortCplt == 0x01U)
1846 #if (USE_HAL_UART_REGISTER_CALLBACKS == 1)
1905 #if (USE_HAL_UART_REGISTER_CALLBACKS == 1)
1923 #if (USE_HAL_UART_REGISTER_CALLBACKS == 1)
1983 #if (USE_HAL_UART_REGISTER_CALLBACKS == 1)
2001 #if (USE_HAL_UART_REGISTER_CALLBACKS == 1)
2024 uint32_t errorflags = 0x00U;
2025 uint32_t dmarequest = 0x00U;
2029 if (errorflags ==
RESET)
2034 UART_Receive_IT(
huart);
2072 UART_Receive_IT(
huart);
2083 UART_EndRxTransfer(
huart);
2105 #if (USE_HAL_UART_REGISTER_CALLBACKS == 1)
2117 #if (USE_HAL_UART_REGISTER_CALLBACKS == 1)
2130 #if (USE_HAL_UART_REGISTER_CALLBACKS == 1)
2147 UART_Transmit_IT(
huart);
2154 UART_EndTransmit_IT(
huart);
2391 uint32_t tmpreg = 0x00U;
2426 uint32_t tmpreg = 0x00U;
2483 uint32_t temp1 = 0x00U, temp2 = 0x00U;
2518 #if (USE_HAL_UART_REGISTER_CALLBACKS == 1)
2559 #if (USE_HAL_UART_REGISTER_CALLBACKS == 1)
2579 #if (USE_HAL_UART_REGISTER_CALLBACKS == 1)
2613 #if (USE_HAL_UART_REGISTER_CALLBACKS == 1)
2632 #if (USE_HAL_UART_REGISTER_CALLBACKS == 1)
2649 uint32_t dmarequest = 0x00U;
2657 UART_EndTxTransfer(
huart);
2665 UART_EndRxTransfer(
huart);
2669 #if (USE_HAL_UART_REGISTER_CALLBACKS == 1)
2696 if ((Timeout == 0U) || ((
HAL_GetTick() - Tickstart) > Timeout))
2757 #if (USE_HAL_UART_REGISTER_CALLBACKS == 1)
2802 #if (USE_HAL_UART_REGISTER_CALLBACKS == 1)
2847 #if (USE_HAL_UART_REGISTER_CALLBACKS == 1)
2875 #if (USE_HAL_UART_REGISTER_CALLBACKS == 1)
2903 #if (USE_HAL_UART_REGISTER_CALLBACKS == 1)
2973 #if (USE_HAL_UART_REGISTER_CALLBACKS == 1)
3037 #if (USE_HAL_UART_REGISTER_CALLBACKS == 1)
3097 #if defined(USART6) && defined(UART9) && defined(UART10)
3103 #elif defined(USART6)
3125 #if defined(USART6) && defined(UART9) && defined(UART10)
3131 #elif defined(USART6)
void HAL_UART_ErrorCallback(UART_HandleTypeDef *huart)
#define assert_param(expr)
Include module's header file.
HAL_StatusTypeDef HAL_UART_Transmit_IT(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size)
HAL_StatusTypeDef HAL_MultiProcessor_ExitMuteMode(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)
#define HAL_UART_ERROR_NE
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)
void(* XferHalfCpltCallback)(struct __DMA_HandleTypeDef *hdma)
#define IS_UART_HWFLOW_INSTANCE(INSTANCE)
#define HAL_UART_ERROR_FE
DMA handle Structure definition.
HAL_StatusTypeDef HAL_UART_Transmit_DMA(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size)
#define IS_UART_HALFDUPLEX_INSTANCE(INSTANCE)
#define HAL_DMA_ERROR_TIMEOUT
#define UART_BRR_SAMPLING8(_PCLK_, _BAUD_)
HAL_StatusTypeDef HAL_DMA_Abort_IT(DMA_HandleTypeDef *hdma)
#define IS_UART_ADDRESS(ADDRESS)
#define IS_UART_MODE(MODE)
__IO uint16_t TxXferCount
HAL_StatusTypeDef HAL_UART_DMAStop(UART_HandleTypeDef *huart)
HAL_StatusTypeDef HAL_UART_Abort_IT(UART_HandleTypeDef *huart)
uint32_t HAL_RCC_GetPCLK2Freq(void)
void(* XferAbortCallback)(struct __DMA_HandleTypeDef *hdma)
UART handle Structure definition.
#define __HAL_UART_ENABLE(__HANDLE__)
Enable UART.
#define UART_WORDLENGTH_9B
#define __HAL_UART_GET_FLAG(__HANDLE__, __FLAG__)
Checks whether the specified UART flag is set or not.
#define __HAL_UART_DISABLE(__HANDLE__)
Disable UART.
#define CLEAR_BIT(REG, BIT)
uint32_t HAL_GetTick(void)
Provides a tick value in millisecond.
#define IS_UART_WAKEUPMETHOD(WAKEUP)
#define HAL_UART_ERROR_PE
HAL_StatusTypeDef HAL_UART_DMAResume(UART_HandleTypeDef *huart)
#define IS_UART_LIN_WORD_LENGTH(LENGTH)
void HAL_UART_MspInit(UART_HandleTypeDef *huart)
UART MSP Initialization This function configures the hardware resources used in this example.
#define UART_HWCONTROL_NONE
#define UART_OVERSAMPLING_8
HAL_StatusTypeDef HAL_HalfDuplex_EnableReceiver(UART_HandleTypeDef *huart)
void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart)
#define __HAL_UART_DISABLE_IT(__HANDLE__, __INTERRUPT__)
Disable the specified UART interrupt.
#define IS_UART_PARITY(PARITY)
#define IS_UART_LIN_BREAK_DETECT_LENGTH(LENGTH)
void HAL_UART_RxHalfCpltCallback(UART_HandleTypeDef *huart)
DMA_HandleTypeDef * hdmatx
#define __HAL_LOCK(__HANDLE__)
HAL_UART_StateTypeDef HAL_UART_GetState(UART_HandleTypeDef *huart)
DMA_Stream_TypeDef * Instance
#define IS_UART_LIN_OVERSAMPLING(SAMPLING)
HAL_StatusTypeDef HAL_UART_AbortReceive_IT(UART_HandleTypeDef *huart)
#define MODIFY_REG(REG, CLEARMASK, SETMASK)
#define HAL_UART_ERROR_DMA
#define UART_BRR_SAMPLING16(_PCLK_, _BAUD_)
HAL_StatusTypeDef HAL_UART_Init(UART_HandleTypeDef *huart)
#define HAL_UART_ERROR_ORE
HAL_StatusTypeDef HAL_UART_AbortTransmit_IT(UART_HandleTypeDef *huart)
#define __HAL_UART_CLEAR_OREFLAG(__HANDLE__)
Clears the UART ORE pending flag.
HAL_StatusTypeDef HAL_DMA_Start_IT(DMA_HandleTypeDef *hdma, uint32_t SrcAddress, uint32_t DstAddress, uint32_t DataLength)
HAL_StatusTypeDef HAL_UART_Receive_DMA(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size)
__IO HAL_UART_StateTypeDef RxState
#define __HAL_UNLOCK(__HANDLE__)
HAL_StatusTypeDef HAL_DMA_Abort(DMA_HandleTypeDef *hdma)
HAL_StatusTypeDef HAL_UART_Receive(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size, uint32_t Timeout)
__IO HAL_UART_StateTypeDef gState
#define HAL_UART_ERROR_NONE
DMA_HandleTypeDef * hdmarx
HAL_StatusTypeDef UART_SetConfig(UART_HandleTypeDef *huart)
#define __HAL_UART_ENABLE_IT(__HANDLE__, __INTERRUPT__)
Enable the specified UART interrupt.
#define IS_UART_LIN_INSTANCE
HAL_StatusTypeDef HAL_HalfDuplex_EnableTransmitter(UART_HandleTypeDef *huart)
void(* XferCpltCallback)(struct __DMA_HandleTypeDef *hdma)
#define IS_UART_HARDWARE_FLOW_CONTROL(CONTROL)
HAL_StatusTypeDef UART_WaitOnFlagUntilTimeout(UART_HandleTypeDef *huart, uint32_t Flag, FlagStatus Status, uint32_t Tickstart, uint32_t Timeout)
uint32_t HAL_RCC_GetPCLK1Freq(void)
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)
#define HAL_IS_BIT_SET(REG, BIT)
#define WRITE_REG(REG, VAL)
#define IS_UART_STOPBITS(STOPBITS)
uint32_t HAL_DMA_GetError(DMA_HandleTypeDef *hdma)
HAL_StatusTypeDef HAL_UART_DeInit(UART_HandleTypeDef *huart)
#define IS_UART_WORD_LENGTH(LENGTH)
#define SET_BIT(REG, BIT)
void HAL_UART_AbortTransmitCpltCallback(UART_HandleTypeDef *huart)
#define IS_UART_OVERSAMPLING(SAMPLING)
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)
void HAL_UART_AbortCpltCallback(UART_HandleTypeDef *huart)
#define __HAL_UART_CLEAR_FLAG(__HANDLE__, __FLAG__)
Clears the specified UART pending flag.
__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.
HAL_StatusTypeDef HAL_UART_DMAPause(UART_HandleTypeDef *huart)
HAL_StatusTypeDef HAL_UART_Abort(UART_HandleTypeDef *huart)
void(* XferErrorCallback)(struct __DMA_HandleTypeDef *hdma)
#define IS_UART_BAUDRATE(BAUDRATE)
uint32_t HAL_UART_GetError(UART_HandleTypeDef *huart)