stm32串口重定义Fputc+micrlib
stm32 串口重定义
- 在usart.c或者urat.c文件末尾添加
int fputc(int ch, FILE *fp)
{
HAL_USART_Transmit(&husart1, (uint8_t *)&ch, 1, 0xffff);
return ch;
}
- 再勾选 魔术棒-> target-> use MicroLIB即可
int fputc(int ch, FILE *fp)
{
HAL_USART_Transmit(&husart1, (uint8_t *)&ch, 1, 0xffff);
return ch;
}