logo
carrot

太阳当空照,花儿对我笑

stm32 hal 串口中断接收

9/3/2023, 9:58:32 AM
  1. 首页
  2. /
  3. 正文
  1. usart.h->/* USER CODE BEGIN Private defines */

    extern uint8_t uart1RxBuf;
    
  2. usart.c->/* USER CODE BEGIN USART1_Init 2 */

    HAL_UART_Receive_IT(&huart1, &uart1RxBuf, 1);
    
  3. usart.c->/* USER CODE BEGIN 1 */

    uint8_t uart1RxBuf;
    void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart) {
    	if (huart == &huart1) {
    		printf("%c", uart1RxBuf);
    		HAL_UART_Receive_IT(&huart1, &uart1RxBuf, 1);
    	}
    }
    
    
热门文章
标签云
© 2021 Copyright 本站由 upyun 提供储存服务