keil使用printf重定义方法
时间:2020-06-11 13:48:26
收藏:0
阅读:160
在usart.c文件底部添加一下代码
#include "stdio.h"
int fputc(int ch,FILE *f)
{
HAL_UART_Transmit(&huart1,(uint8_t*)&ch,1,10);
return(ch);
}
其中&huart1
是你所使用的串口指针,添加代码后会报错FILE *f
未定义,需要添加引用#include "stdio.h"
原文:https://www.cnblogs.com/mengydz/p/13092485.html
评论(0)