#include "stm32f4xx_hal.h"
Private define
Private function prototypes
HAL_UART_Init(UART_HandleTypeDef *)
if
(huart == NULL)
if
(huart->Init.HwFlowCtl != UART_HWCONTROL_NONE)
else
if
(huart->gState == HAL_UART_STATE_RESET)
if
(huart->MspInitCallback == NULL)
HAL_HalfDuplex_Init(UART_HandleTypeDef *)
if
(huart == NULL)
if
(huart->gState == HAL_UART_STATE_RESET)
if
(huart->MspInitCallback == NULL)
HAL_LIN_Init(UART_HandleTypeDef *, uint32_t)
if
(huart == NULL)
if
(huart->gState == HAL_UART_STATE_RESET)
if
(huart->MspInitCallback == NULL)
HAL_MultiProcessor_Init(UART_HandleTypeDef *, uint8_t, uint32_t)
if
(huart == NULL)
if
(huart->gState == HAL_UART_STATE_RESET)
if
(huart->MspInitCallback == NULL)
HAL_UART_DeInit(UART_HandleTypeDef *)
if
(huart == NULL)
if
(huart->MspDeInitCallback == NULL)
HAL_UART_MspInit(UART_HandleTypeDef *)
HAL_UART_MspDeInit(UART_HandleTypeDef *)
HAL_UART_Transmit(UART_HandleTypeDef *, const uint8_t *, uint16_t, uint32_t)
if
(huart->gState == HAL_UART_STATE_READY)
if
((pData == NULL) || (Size == 0U))
if
((huart->Init.WordLength == UART_WORDLENGTH_9B) && (huart->Init.Parity == UART_PARITY_NONE))
else
while
(huart->TxXferCount > 0U)
if
(UART_WaitOnFlagUntilTimeout(huart, UART_FLAG_TXE, RESET, tickstart, Timeout) != HAL_OK)
if
(pdata8bits == NULL)
else
if
(UART_WaitOnFlagUntilTimeout(huart, UART_FLAG_TC, RESET, tickstart, Timeout) != HAL_OK)
else
HAL_UART_Receive(UART_HandleTypeDef *, uint8_t *, uint16_t, uint32_t)
if
(huart->RxState == HAL_UART_STATE_READY)
if
((pData == NULL) || (Size == 0U))
if
((huart->Init.WordLength == UART_WORDLENGTH_9B) && (huart->Init.Parity == UART_PARITY_NONE))
else
while
(huart->RxXferCount > 0U)
if
(UART_WaitOnFlagUntilTimeout(huart, UART_FLAG_RXNE, RESET, tickstart, Timeout) != HAL_OK)
if
(pdata8bits == NULL)
else
if
((huart->Init.WordLength == UART_WORDLENGTH_9B) || ((huart->Init.WordLength == UART_WORDLENGTH_8B) && (huart->Init.Parity == UART_PARITY_NONE)))
else
else
HAL_UART_Transmit_IT(UART_HandleTypeDef *, const uint8_t *, uint16_t)
if
(huart->gState == HAL_UART_STATE_READY)
if
((pData == NULL) || (Size == 0U))
else
HAL_UART_Receive_IT(UART_HandleTypeDef *, uint8_t *, uint16_t)
if
(huart->RxState == HAL_UART_STATE_READY)
if
((pData == NULL) || (Size == 0U))
else
HAL_UART_Transmit_DMA(UART_HandleTypeDef *, const uint8_t *, uint16_t)
if
(huart->gState == HAL_UART_STATE_READY)
if
((pData == NULL) || (Size == 0U))
else
HAL_UART_Receive_DMA(UART_HandleTypeDef *, uint8_t *, uint16_t)
if
(huart->RxState == HAL_UART_STATE_READY)
if
((pData == NULL) || (Size == 0U))
else
HAL_UART_DMAPause(UART_HandleTypeDef *)
if
((huart->gState == HAL_UART_STATE_BUSY_TX) && dmarequest)
if
((huart->RxState == HAL_UART_STATE_BUSY_RX) && dmarequest)
HAL_UART_DMAResume(UART_HandleTypeDef *)
if
(huart->gState == HAL_UART_STATE_BUSY_TX)
if
(huart->RxState == HAL_UART_STATE_BUSY_RX)
if
(huart->Init.Parity != UART_PARITY_NONE)
HAL_UART_DMAStop(UART_HandleTypeDef *)
if
((huart->gState == HAL_UART_STATE_BUSY_TX) && dmarequest)
if
(huart->hdmatx != NULL)
if
((huart->RxState == HAL_UART_STATE_BUSY_RX) && dmarequest)
if
(huart->hdmarx != NULL)
HAL_UARTEx_ReceiveToIdle(UART_HandleTypeDef *, uint8_t *, uint16_t, uint16_t *, uint32_t)
if
(huart->RxState == HAL_UART_STATE_READY)
if
((pData == NULL) || (Size == 0U))
if
((huart->Init.WordLength == UART_WORDLENGTH_9B) && (huart->Init.Parity == UART_PARITY_NONE))
else
while
(huart->RxXferCount > 0U)
if
(__HAL_UART_GET_FLAG(huart, UART_FLAG_IDLE))
if
(*RxLen > 0U)
if
(__HAL_UART_GET_FLAG(huart, UART_FLAG_RXNE))
if
(pdata8bits == NULL)
else
if
((huart->Init.WordLength == UART_WORDLENGTH_9B) || ((huart->Init.WordLength == UART_WORDLENGTH_8B) && (huart->Init.Parity == UART_PARITY_NONE)))
else
if
(Timeout != HAL_MAX_DELAY)
if
(((HAL_GetTick() - tickstart) > Timeout) || (Timeout == 0U))
else
HAL_UARTEx_ReceiveToIdle_IT(UART_HandleTypeDef *, uint8_t *, uint16_t)
if
(huart->RxState == HAL_UART_STATE_READY)
if
((pData == NULL) || (Size == 0U))
if
(status == HAL_OK)
if
(huart->ReceptionType == HAL_UART_RECEPTION_TOIDLE)
else
else
HAL_UARTEx_ReceiveToIdle_DMA(UART_HandleTypeDef *, uint8_t *, uint16_t)
if
(huart->RxState == HAL_UART_STATE_READY)
if
((pData == NULL) || (Size == 0U))
if
(status == HAL_OK)
if
(huart->ReceptionType == HAL_UART_RECEPTION_TOIDLE)
else
else
HAL_UARTEx_GetRxEventType(UART_HandleTypeDef *)
HAL_UART_Abort(UART_HandleTypeDef *)
if
(huart->ReceptionType == HAL_UART_RECEPTION_TOIDLE)
if
(HAL_IS_BIT_SET(huart->Instance->CR3, USART_CR3_DMAT))
if
(huart->hdmatx != NULL)
if
(HAL_DMA_Abort(huart->hdmatx) != HAL_OK)
if
(HAL_DMA_GetError(huart->hdmatx) == HAL_DMA_ERROR_TIMEOUT)
if
(HAL_IS_BIT_SET(huart->Instance->CR3, USART_CR3_DMAR))
if
(huart->hdmarx != NULL)
if
(HAL_DMA_Abort(huart->hdmarx) != HAL_OK)
if
(HAL_DMA_GetError(huart->hdmarx) == HAL_DMA_ERROR_TIMEOUT)
HAL_UART_AbortTransmit(UART_HandleTypeDef *)
if
(HAL_IS_BIT_SET(huart->Instance->CR3, USART_CR3_DMAT))
if
(huart->hdmatx != NULL)
if
(HAL_DMA_Abort(huart->hdmatx) != HAL_OK)
if
(HAL_DMA_GetError(huart->hdmatx) == HAL_DMA_ERROR_TIMEOUT)
HAL_UART_AbortReceive(UART_HandleTypeDef *)
if
(huart->ReceptionType == HAL_UART_RECEPTION_TOIDLE)
if
(HAL_IS_BIT_SET(huart->Instance->CR3, USART_CR3_DMAR))
if
(huart->hdmarx != NULL)
if
(HAL_DMA_Abort(huart->hdmarx) != HAL_OK)
if
(HAL_DMA_GetError(huart->hdmarx) == HAL_DMA_ERROR_TIMEOUT)
HAL_UART_Abort_IT(UART_HandleTypeDef *)
if
(huart->ReceptionType == HAL_UART_RECEPTION_TOIDLE)
if
(huart->hdmatx != NULL)
if
(HAL_IS_BIT_SET(huart->Instance->CR3, USART_CR3_DMAT))
else
if
(huart->hdmarx != NULL)
if
(HAL_IS_BIT_SET(huart->Instance->CR3, USART_CR3_DMAR))
else
if
(HAL_IS_BIT_SET(huart->Instance->CR3, USART_CR3_DMAT))
if
(huart->hdmatx != NULL)
if
(HAL_DMA_Abort_IT(huart->hdmatx) != HAL_OK)
else
if
(HAL_IS_BIT_SET(huart->Instance->CR3, USART_CR3_DMAR))
if
(huart->hdmarx != NULL)
if
(HAL_DMA_Abort_IT(huart->hdmarx) != HAL_OK)
else
if
(AbortCplt == 0x01U)
HAL_UART_AbortTransmit_IT(UART_HandleTypeDef *)
if
(HAL_IS_BIT_SET(huart->Instance->CR3, USART_CR3_DMAT))
if
(huart->hdmatx != NULL)
if
(HAL_DMA_Abort_IT(huart->hdmatx) != HAL_OK)
else
else
HAL_UART_AbortReceive_IT(UART_HandleTypeDef *)
if
(huart->ReceptionType == HAL_UART_RECEPTION_TOIDLE)
if
(HAL_IS_BIT_SET(huart->Instance->CR3, USART_CR3_DMAR))
if
(huart->hdmarx != NULL)
if
(HAL_DMA_Abort_IT(huart->hdmarx) != HAL_OK)
else
else
HAL_UART_IRQHandler(UART_HandleTypeDef *)
if
(errorflags == RESET)
if
(((isrflags & USART_SR_RXNE) != RESET) && ((cr1its & USART_CR1_RXNEIE) != RESET))
if
((errorflags != RESET) && (((cr3its & USART_CR3_EIE) != RESET) || ((cr1its & (USART_CR1_RXNEIE | USART_CR1_PEIE)) != RESET)))
UART parity error interrupt occurred
if
(((isrflags & USART_SR_PE) != RESET) && ((cr1its & USART_CR1_PEIE) != RESET))
UART noise error interrupt occurred
if
(((isrflags & USART_SR_NE) != RESET) && ((cr3its & USART_CR3_EIE) != RESET))
UART frame error interrupt occurred
if
(((isrflags & USART_SR_FE) != RESET) && ((cr3its & USART_CR3_EIE) != RESET))
UART Over-Run interrupt occurred
if
(((isrflags & USART_SR_ORE) != RESET) && (((cr1its & USART_CR1_RXNEIE) != RESET) || ((cr3its & USART_CR3_EIE) != RESET)))
if
(huart->ErrorCode != HAL_UART_ERROR_NONE)
if
(((isrflags & USART_SR_RXNE) != RESET) && ((cr1its & USART_CR1_RXNEIE) != RESET))
if
(((huart->ErrorCode & HAL_UART_ERROR_ORE) != RESET) || dmarequest)
if
(HAL_IS_BIT_SET(huart->Instance->CR3, USART_CR3_DMAR))
if
(huart->hdmarx != NULL)
if
(HAL_DMA_Abort_IT(huart->hdmarx) != HAL_OK)
else
else
else
if
((huart->ReceptionType == HAL_UART_RECEPTION_TOIDLE) && ((isrflags & USART_SR_IDLE) != 0U) && ((cr1its & USART_SR_IDLE) != 0U))
if
(HAL_IS_BIT_SET(huart->Instance->CR3, USART_CR3_DMAR))
if
((nb_remaining_rx_data > 0U) && (nb_remaining_rx_data < huart->RxXferSize))
if
(huart->hdmarx->Init.Mode != DMA_CIRCULAR)
else
if
((huart->RxXferCount > 0U) && (nb_rx_data > 0U))
UART in mode Transmitter
if
(((isrflags & USART_SR_TXE) != RESET) && ((cr1its & USART_CR1_TXEIE) != RESET))
if
(((isrflags & USART_SR_TC) != RESET) && ((cr1its & USART_CR1_TCIE) != RESET))
HAL_UART_TxCpltCallback(UART_HandleTypeDef *)
HAL_UART_TxHalfCpltCallback(UART_HandleTypeDef *)
HAL_UART_RxCpltCallback(UART_HandleTypeDef *)
HAL_UART_RxHalfCpltCallback(UART_HandleTypeDef *)
HAL_UART_ErrorCallback(UART_HandleTypeDef *)
HAL_UART_AbortCpltCallback(UART_HandleTypeDef *)
HAL_UART_AbortTransmitCpltCallback(UART_HandleTypeDef *)
HAL_UART_AbortReceiveCpltCallback(UART_HandleTypeDef *)
HAL_UARTEx_RxEventCallback(UART_HandleTypeDef *, uint16_t)
HAL_LIN_SendBreak(UART_HandleTypeDef *)
HAL_MultiProcessor_EnterMuteMode(UART_HandleTypeDef *)
HAL_MultiProcessor_ExitMuteMode(UART_HandleTypeDef *)
HAL_HalfDuplex_EnableTransmitter(UART_HandleTypeDef *)
HAL_HalfDuplex_EnableReceiver(UART_HandleTypeDef *)
HAL_UART_GetState(const UART_HandleTypeDef *)
HAL_UART_GetError(const UART_HandleTypeDef *)
UART_DMATransmitCplt(DMA_HandleTypeDef *)
if
((hdma->Instance->CR & DMA_SxCR_CIRC) == 0U)
else
UART_DMATxHalfCplt(DMA_HandleTypeDef *)
UART_DMAReceiveCplt(DMA_HandleTypeDef *)
if
((hdma->Instance->CR & DMA_SxCR_CIRC) == 0U)
if
(huart->ReceptionType == HAL_UART_RECEPTION_TOIDLE)
if
(huart->ReceptionType == HAL_UART_RECEPTION_TOIDLE)
else
UART_DMARxHalfCplt(DMA_HandleTypeDef *)
if
(huart->ReceptionType == HAL_UART_RECEPTION_TOIDLE)
else
UART_DMAError(DMA_HandleTypeDef *)
if
((huart->gState == HAL_UART_STATE_BUSY_TX) && dmarequest)
if
((huart->RxState == HAL_UART_STATE_BUSY_RX) && dmarequest)
UART_WaitOnFlagUntilTimeout(UART_HandleTypeDef *, uint32_t, FlagStatus, uint32_t, uint32_t)
while
((__HAL_UART_GET_FLAG(huart, Flag) ? SET : RESET) == Status)
if
(Timeout != HAL_MAX_DELAY)
if
(((HAL_GetTick() - Tickstart) > Timeout) || (Timeout == 0U))
if
((READ_BIT(huart->Instance->CR1, USART_CR1_RE) != 0U) && (Flag != UART_FLAG_TXE) && (Flag != UART_FLAG_TC))
if
(__HAL_UART_GET_FLAG(huart, UART_FLAG_ORE) == SET)
UART_Start_Receive_IT(UART_HandleTypeDef *, uint8_t *, uint16_t)
if
(huart->Init.Parity != UART_PARITY_NONE)
UART_Start_Receive_DMA(UART_HandleTypeDef *, uint8_t *, uint16_t)
if
(huart->Init.Parity != UART_PARITY_NONE)
UART_EndTxTransfer(UART_HandleTypeDef *)
UART_EndRxTransfer(UART_HandleTypeDef *)
if
(huart->ReceptionType == HAL_UART_RECEPTION_TOIDLE)
UART_DMAAbortOnError(DMA_HandleTypeDef *)
UART_DMATxAbortCallback(DMA_HandleTypeDef *)
if
(huart->hdmarx != NULL)
if
(huart->hdmarx->XferAbortCallback != NULL)
UART_DMARxAbortCallback(DMA_HandleTypeDef *)
if
(huart->hdmatx != NULL)
if
(huart->hdmatx->XferAbortCallback != NULL)
UART_DMATxOnlyAbortCallback(DMA_HandleTypeDef *)
UART_DMARxOnlyAbortCallback(DMA_HandleTypeDef *)
UART_Transmit_IT(UART_HandleTypeDef *)
if
(huart->gState == HAL_UART_STATE_BUSY_TX)
if
((huart->Init.WordLength == UART_WORDLENGTH_9B) && (huart->Init.Parity == UART_PARITY_NONE))
else
if
(--huart->TxXferCount == 0U)
else
UART_EndTransmit_IT(UART_HandleTypeDef *)
UART_Receive_IT(UART_HandleTypeDef *)
if
(huart->RxState == HAL_UART_STATE_BUSY_RX)
if
((huart->Init.WordLength == UART_WORDLENGTH_9B) && (huart->Init.Parity == UART_PARITY_NONE))
else
if
((huart->Init.WordLength == UART_WORDLENGTH_9B) || ((huart->Init.WordLength == UART_WORDLENGTH_8B) && (huart->Init.Parity == UART_PARITY_NONE)))
else
if
(--huart->RxXferCount == 0U)
if
(huart->ReceptionType == HAL_UART_RECEPTION_TOIDLE)
if
(__HAL_UART_GET_FLAG(huart, UART_FLAG_IDLE))
else
else
UART_SetConfig(UART_HandleTypeDef *)
-------------------------- USART CR2 Configuration
-------------------------- USART CR1 Configuration
-------------------------- USART CR3 Configuration
if
((huart->Instance == USART1) || (huart->Instance == USART6) || (huart->Instance == UART9) || (huart->Instance == UART10))
if
((huart->Instance == USART1) || (huart->Instance == USART6))
if
(huart->Instance == USART1)
else
if
(huart->Init.OverSampling == UART_OVERSAMPLING_8)
else