1 /* (CC-BY-NC-SA) ROBIN KRENS - ROBIN @ ROBINKRENS.NL
4 * 2019/7/23 - ROBIN KRENS
8 * The 'classic' putc and getchar functions. Should not be used directly
9 * use the tinyprintf library instead
11 * Can be extended for multiple interfaces (serial, tft or oled screens)
19 #include <lib/stdio.h>
20 #include <lib/string.h>
21 #include <drivers/uart.h>
27 static char stdbuf[BUFSIZE];
29 /* Abstraction layer for I/O communication */
34 while ((c = uart_getc()) == 0);
40 void cputchar(char c) {
48 void putc(void *p, char c) {
54 void cputs(unsigned char *str) {
57 for (i = 0; i < strlen(str); i++) {
63 char * readline(char *prompt)
77 } else if ((c == '\b' || c == '\x7f') && i > 0) {
81 } else if (c >= ' ' && i < BUFSIZE-1) {
85 } else if (c == '\n' || c == '\r') {