/* 包含头文件 */ #include <stdio.h> /* 重定义putc函数 */ int fputc(int ch, FILE *f) { /* 将需要printf的字符通过串口中断FIFO发送出去,printf函数会立即返回 */ //comSendChar(COM1, ch); HAL_UART_Transmit(&huart1,(uint8_t *)&ch,1,1000); return ch; }