stm32 Keil 下 使用串口重定义printf函数

 


#include <stdio.h>//标准的库函数

#define _PRINTF_
//重写这个函数就可以了
#ifdef _PRINTF_
int fputc(int ch, FILE *f)
{
    USART_SendData(USART2, (unsigned char) ch);

    while(!(USART_GetFlagStatus(USART2, USART_FLAG_TXE) == SET))
    {
    }
    return ch;
}
#endif

 

stm32 Keil 下 使用串口重定义printf函数

 

 

 

相关文章:

  • 2021-10-31
  • 2022-12-23
  • 2022-12-23
  • 2021-11-17
  • 2021-08-07
  • 2021-11-10
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-05-08
  • 2021-07-07
  • 2022-12-23
  • 2022-12-23
  • 2021-11-05
  • 2021-12-06
  • 2022-02-03
相关资源
相似解决方案