Skip to content

Restore console_uart_printf, fix use of __ZEPHYR__. #10057

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions supervisor/shared/serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -524,3 +524,15 @@ void print_hexdump(const mp_print_t *printer, const char *prefix, const uint8_t
mp_printf(printer, "\n");
}
}

int console_uart_printf(const char *fmt, ...) {
#if CIRCUITPY_CONSOLE_UART
va_list args;
va_start(args, fmt);
int ret = mp_vprintf(&console_uart_print, fmt, args);
va_end(args);
return ret;
#else
return 0;
#endif
}
2 changes: 2 additions & 0 deletions supervisor/shared/serial.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,6 @@ void board_serial_write_substring(const char *text, uint32_t length);

extern const mp_print_t console_uart_print;

int console_uart_printf(const char *fmt, ...);

void print_hexdump(const mp_print_t *printer, const char *prefix, const uint8_t *buf, size_t len);
2 changes: 1 addition & 1 deletion supervisor/shared/usb/tusb_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ extern "C" {
// When debugging TinyUSB, only output to the console UART link.
#if CIRCUITPY_DEBUG_TINYUSB > 0 && defined(CIRCUITPY_CONSOLE_UART)
#define CFG_TUSB_DEBUG CIRCUITPY_DEBUG_TINYUSB
#if __ZEPHYR__
#ifdef __ZEPHYR__
#define CFG_TUSB_DEBUG_PRINTF zephyr_printk
#else
#define CFG_TUSB_DEBUG_PRINTF console_uart_printf
Expand Down
Loading