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>
22 #include <drivers/uart.h>
23 #include <drivers/st7735s.h>
29 static char stdbuf[BUFSIZE];
31 /* Abstraction layer for I/O communication */
36 while ((c = uart_getc()) == 0);
42 void cputchar(char c) {
48 tft_putc(0xFFFF, 0x0000, c);
53 void putc(void *p, char c) {
59 void cputs(unsigned char *str) {
62 for (i = 0; i < strlen(str); i++) {
68 char * readline(char *prompt)
82 } else if ((c == '\b' || c == '\x7f') && i > 0) {
86 } else if (c >= ' ' && i < BUFSIZE-1) {
90 } else if (c == '\n' || c == '\r') {