|
|
@@ -20,6 +20,7 @@
|
|
|
/* Includes ------------------------------------------------------------------*/
|
|
|
#include "main.h"
|
|
|
#include "stm32f1xx_it.h"
|
|
|
+#include "string.h"
|
|
|
#include <stdio.h>
|
|
|
/* Private includes ----------------------------------------------------------*/
|
|
|
/* USER CODE BEGIN Includes */
|
|
|
@@ -247,7 +248,8 @@ void USART2_IRQHandler(void)
|
|
|
|
|
|
uint32_t received_len = sizeof(rx_buf) - __HAL_DMA_GET_COUNTER(huart2.hdmarx);
|
|
|
// printf("Received %lu bytes: %.*s\r\n", received_len, (int)received_len, rx_buf);
|
|
|
-
|
|
|
+ HAL_UART_Transmit(&huart1, rx_buf, received_len, 100);
|
|
|
+ memset(rx_buf, 0, sizeof(rx_buf));
|
|
|
HAL_UART_Receive_DMA(&huart2, rx_buf, sizeof(rx_buf)); // 重新启动
|
|
|
}
|
|
|
/* USER CODE END USART2_IRQn 1 */
|