在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"
在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"
本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。