1234567891011121314151617181920 |
- #include "Printf.h"
- //此处代码与使用 Printf 函数相关,使用时要添加 stdio.h 文件
- #ifdef __GNUC__
- #define PUTCHAR_PROTOTYPE int __io_putchar(int ch)
- #else
- #define PUTCHAR_PROTOTYPE int fputc(int ch, FILE *f)
- #endif
- PUTCHAR_PROTOTYPE
- {
- HAL_UART_Transmit(&huart2 , (uint8_t *)&ch, 1, 0xFFFF);
- return ch;
- }
|