STM32 接收完成中断

 

HAL_UARTEx_ReceiveToIdle_IT(&huart1,(uint8_t*)&Rx_Buf,255);

void HAL_UARTEx_RxEventCallback(UART_HandleTypeDef *huart, uint16_t Size)
{
    if(huart->Instance==USART1)
    {
        RxCount = Size;
        HAL_UARTEx_ReceiveToIdle_IT(&huart1,(uint8_t*)&Rx_Buf,255);
        Rx_MSG = MSG_COM;
    }
//	else if(huart->Instance==USART3)
//	{
//		esp8266.FramLength=Size;
//		HAL_UART_Transmit(&huart1,esp8266.Rx_Data_Buf,esp8266.FramLength,|
//        esp8266.FramLength);
//		HAL_UARTEx_ReceiveToIdle_IT(&huart1,serial.Rx_Data_Buf,RX_BUF_MAX_LEN);
//	}
}

/*******************************************************************************
HAL库写Flash操作引起的串口ORE错误不再接收的解决
*******************************************************************************/
void HAL_UART_ErrorCallback(UART_HandleTypeDef *huart)
{ 
if (huart->Instance == USART1)
{
HAL_UARTEx_ReceiveToIdle_IT(&huart1,(uint8_t*)&Rx_Buf_IT,200);
}
else if (huart->Instance == USART3)
{
HAL_UARTEx_ReceiveToIdle_IT(&huart3,(uint8_t*)&Rx3_Buf,200);
}

}

 

发表评论