summaryrefslogtreecommitdiffstatshomepage
path: root/shared/libc/printf.c
diff options
context:
space:
mode:
Diffstat (limited to 'shared/libc/printf.c')
-rw-r--r--shared/libc/printf.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/shared/libc/printf.c b/shared/libc/printf.c
index 6b5373188f..715181229e 100644
--- a/shared/libc/printf.c
+++ b/shared/libc/printf.c
@@ -72,16 +72,14 @@ int vprintf(const char *fmt, va_list ap) {
// need this because gcc optimises printf("%c", c) -> putchar(c), and printf("a") -> putchar('a')
int putchar(int c) {
char chr = c;
- mp_hal_stdout_tx_strn_cooked(&chr, 1);
+ MICROPY_INTERNAL_PRINTF_PRINTER->print_strn(MICROPY_INTERNAL_PRINTF_PRINTER->data, &chr, 1);
return chr;
}
// need this because gcc optimises printf("string\n") -> puts("string")
int puts(const char *s) {
- mp_hal_stdout_tx_strn_cooked(s, strlen(s));
- char chr = '\n';
- mp_hal_stdout_tx_strn_cooked(&chr, 1);
- return 1;
+ MICROPY_INTERNAL_PRINTF_PRINTER->print_strn(MICROPY_INTERNAL_PRINTF_PRINTER->data, s, strlen(s));
+ return putchar('\n'); // will return 10, which is >0 per specs of puts
}
typedef struct _strn_print_env_t {