diff --git a/ports/rp2/moduos.c b/ports/rp2/moduos.c index 02f34eb960..a9dc30df89 100644 --- a/ports/rp2/moduos.c +++ b/ports/rp2/moduos.c @@ -26,6 +26,7 @@ #include "py/objstr.h" #include "py/runtime.h" +#include "extmod/misc.h" #include "extmod/vfs.h" #include "extmod/vfs_fat.h" #include "extmod/vfs_lfs.h" diff --git a/ports/rp2/mphalport.c b/ports/rp2/mphalport.c index 3385323db0..c4169fb66c 100644 --- a/ports/rp2/mphalport.c +++ b/ports/rp2/mphalport.c @@ -27,6 +27,7 @@ #include "py/runtime.h" #include "py/stream.h" #include "py/mphal.h" +#include "extmod/misc.h" #include "shared/timeutils/timeutils.h" #include "tusb.h" #include "uart.h" @@ -74,6 +75,9 @@ uintptr_t mp_hal_stdio_poll(uintptr_t poll_flags) { ret |= MP_STREAM_POLL_RD; } #endif + #if MICROPY_PY_OS_DUPTERM + ret |= mp_uos_dupterm_poll(poll_flags); + #endif return ret; } @@ -95,6 +99,12 @@ int mp_hal_stdin_rx_chr(void) { } } #endif + #if MICROPY_PY_OS_DUPTERM + int dupterm_c = mp_uos_dupterm_rx_chr(); + if (dupterm_c >= 0) { + return dupterm_c; + } + #endif MICROPY_EVENT_POLL_HOOK } } @@ -123,6 +133,10 @@ void mp_hal_stdout_tx_strn(const char *str, mp_uint_t len) { } } #endif + + #if MICROPY_PY_OS_DUPTERM + mp_uos_dupterm_tx_strn(str, len); + #endif } void mp_hal_delay_ms(mp_uint_t ms) {