uart printf
This commit is contained in:
parent
7086e5f9e9
commit
89472640cb
1 changed files with 39 additions and 0 deletions
39
uart.c
39
uart.c
|
@ -5,6 +5,9 @@
|
|||
#include <libopencm3/stm32/rcc.h>
|
||||
#include <libopencm3/stm32/usart.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
int _write(int file, char *ptr, int len);
|
||||
|
@ -36,3 +39,39 @@ int _write(int file, char *ptr, int len) {
|
|||
errno = EIO;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int _close(int file);
|
||||
int _close(int file) {
|
||||
(void)file;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int _fstat(int file, struct stat *st);
|
||||
int _fstat(int file, struct stat *st) {
|
||||
(void)file;
|
||||
st->st_mode = S_IFCHR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int _isatty(int file);
|
||||
int _isatty(int file) {
|
||||
(void)file;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int _lseek(int file, int ptr, int dir);
|
||||
int _lseek(int file, int ptr, int dir) {
|
||||
(void)file;
|
||||
(void)ptr;
|
||||
(void)dir;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Optional — stubbed read (e.g. for scanf), returns 0 bytes
|
||||
int _read(int file, char *ptr, int len);
|
||||
int _read(int file, char *ptr, int len) {
|
||||
(void)file;
|
||||
(void)ptr;
|
||||
(void)len;
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue