#include "project.h" int _open (const char *name, int flags, int mode) { errno = ENOSYS; return -1; /* Always fails */ } /* _open () */ int _close (int file) { errno = EBADF; return -1; /* Always fails */ } /* _close () */ int _write (int file, char *buf, int nbytes) { int ret; ret = usart2_write (buf, nbytes, 1); cdcacm_write (buf, nbytes, 0); if (ret < 0) { errno = -ret; return -1; } return ret; } /* _write () */ int _read (int file, char *buf, int nbytes) { errno = -EAGAIN; return -1; /* EOF */ } /* _read () */ int _fstat (int file, struct stat *st) { st->st_mode = S_IFCHR; return 0; } /* _fstat () */ int _lseek (int file, int offset, int whence) { return 0; } /* _lseek () */ int isatty (int file) { return 1; } /* _isatty () */ void stdio_drain (void) { usart2_drain(); }