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:
parent
59f0064075
commit
6a378f71a0
@ -91,8 +91,12 @@ int IRAM puts(const char *s)
|
|||||||
if (!s) {
|
if (!s) {
|
||||||
return EOF;
|
return EOF;
|
||||||
}
|
}
|
||||||
ets_printf("%s\n", s);
|
int len = strlen(s);
|
||||||
return strlen(s);
|
for (int i = 0; i < len; i++) {
|
||||||
|
__wrap_putchar(s[i]);
|
||||||
|
}
|
||||||
|
__wrap_putchar('\n');
|
||||||
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
char _printf_buf[PRINTF_BUFSIZ];
|
char _printf_buf[PRINTF_BUFSIZ];
|
||||||
@ -105,7 +109,9 @@ int IRAM printf(const char* format, ...)
|
|||||||
int ret = vsnprintf(_printf_buf, PRINTF_BUFSIZ, format, arglist);
|
int ret = vsnprintf(_printf_buf, PRINTF_BUFSIZ, format, arglist);
|
||||||
|
|
||||||
if (ret > 0) {
|
if (ret > 0) {
|
||||||
ets_printf (_printf_buf);
|
for (int i = 0; i < ret; i++) {
|
||||||
|
__wrap_putchar(_printf_buf[i]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
va_end(arglist);
|
va_end(arglist);
|
||||||
|
Loading…
Reference in New Issue
Block a user