Skip to content

Commit e79c669

Browse files
committed
stmhal: Fix file print methods to use print instead of printf.
Also make stdout_print_strn static (ultimately this function needs to be merged with stdout_tx_strn).
1 parent 34ab8dd commit e79c669

3 files changed

Lines changed: 3 additions & 3 deletions

File tree

stmhal/file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ typedef struct _pyb_file_obj_t {
7070
} pyb_file_obj_t;
7171

7272
void file_obj_print(void (*print)(void *env, const char *fmt, ...), void *env, mp_obj_t self_in, mp_print_kind_t kind) {
73-
printf("<io.%s %p>", mp_obj_get_type_str(self_in), self_in);
73+
print(env, "<io.%s %p>", mp_obj_get_type_str(self_in), self_in);
7474
}
7575

7676
STATIC machine_int_t file_obj_read(mp_obj_t self_in, void *buf, machine_uint_t size, int *errcode) {

stmhal/printf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ int pfenv_printf(const pfenv_t *pfenv, const char *fmt, va_list args) {
195195
return chrs;
196196
}
197197

198-
void stdout_print_strn(void *data, const char *str, unsigned int len) {
198+
STATIC void stdout_print_strn(void *data, const char *str, unsigned int len) {
199199
// TODO this needs to be replaced with a proper stdio interface ala CPython
200200
// send stdout to UART and USB CDC VCP
201201
if (pyb_uart_global_debug != PYB_UART_NONE) {

stmhal/pybstdio.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ typedef struct _pyb_stdio_obj_t {
9696

9797
void stdio_obj_print(void (*print)(void *env, const char *fmt, ...), void *env, mp_obj_t self_in, mp_print_kind_t kind) {
9898
pyb_stdio_obj_t *self = self_in;
99-
printf("<io.FileIO %d>", self->fd);
99+
print(env, "<io.FileIO %d>", self->fd);
100100
}
101101

102102
STATIC machine_int_t stdio_read(mp_obj_t self_in, void *buf, machine_uint_t size, int *errcode) {

0 commit comments

Comments
 (0)