1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

cpu/esp32: fixes printf and puts

printf and puts used ets_printf before. Unfortunately, ets_printf adds an additional \r for each \n which is not consistent with other RIOT platforms. As a result some automatic tests failed. Therefore, both functions write now character-wise directly to the UART interface.
This commit is contained in:
Gunar Schorcht 2019-08-17 11:34:20 +02:00
parent 59f0064075
commit 6a378f71a0

View File

@ -91,8 +91,12 @@ int IRAM puts(const char *s)
if (!s) {
return EOF;
}
ets_printf("%s\n", s);
return strlen(s);
int len = strlen(s);
for (int i = 0; i < len; i++) {
__wrap_putchar(s[i]);
}
__wrap_putchar('\n');
return len;
}
char _printf_buf[PRINTF_BUFSIZ];
@ -105,7 +109,9 @@ int IRAM printf(const char* format, ...)
int ret = vsnprintf(_printf_buf, PRINTF_BUFSIZ, format, arglist);
if (ret > 0) {
ets_printf (_printf_buf);
for (int i = 0; i < ret; i++) {
__wrap_putchar(_printf_buf[i]);
}
}
va_end(arglist);