Car/Core/Inc/syscalls.h
2024-07-20 10:44:59 +08:00

40 lines
841 B
C

#ifndef __SYSCALLS_H
#define __SYSCALLS_H
#include <errno.h>
#include <signal.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#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