Printf.c 332 B

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