uint8_t RxByte; uint8_t RxBuff[256]; uint16_t Rx_Count;
HAL_UART_Receive_IT(&huart1,&RxByte,1);
/* USER CODE BEGIN 4 */ void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart) { /* Prevent unused argument(s) compilation warning */ UNUSED(huart); /* NOTE : This function should not be modified, when the callback is needed, the HAL_UART_RxCpltCallback can be implemented in the user file */ RxBuff[Rx_Count++]=RxByte; if(RxByte==0x0A) { while(HAL_UART_Transmit_IT(&huart1,RxBuff,Rx_Count)==HAL_OK); Rx_Count=0; } if(Rx_Count>=254) { Rx_Count=0; } while(HAL_UART_Receive_IT(&huart1,&RxByte,1)==HAL_OK); } /* USER CODE END 4 */