#ifndef __SYSCALLS_H #define __SYSCALLS_H #include #include #include #include #include #include #include #include "usart.h" #define DEFAULT_HUART 1 #define HUART1 (&huart1) #define HUART2 (&huart2) #if DEFAULT_HUART == 1 #define HUART HUART1 #else #define HUART HUART2 #endif // 条件编译,适配不同平台 (GNU, GCC) #ifdef __GNUC__ #define PUTCHAR_PROTOTYPE int __io_putchar(int ch) #define GETCHAR_PROTOTYPE int __io_getchar(void) #else #define PUTCHAR_PROTOTYPE int fputc(int ch, FILE *f) #define GETCHAR_PROTOTYPE int fgetc(FILE *f) #endif /* __GNUC__ */ int _read(int file, char *ptr, int len); int _write(int file, char *ptr, int len); int myprintf(const char *format, ...); void my_printf(UART_HandleTypeDef *huart, const char *buf, ...); #endif