summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoriabdalkader <i.abdalkader@gmail.com>2022-01-15 04:32:01 +0200
committerDamien George <damien@micropython.org>2022-01-20 16:57:03 +1100
commit5db278f1dd061ea0d7d9263cc6b4a3b212b34caf (patch)
tree373ca0df6607dc984878a3e843a214f98ed0aa52
parentf44fb760551809d038d3fda49ffe07975e92091d (diff)
rp2/mphalport: Add optional dupterm support.
-rw-r--r--ports/rp2/moduos.c1
-rw-r--r--ports/rp2/mphalport.c14
2 files changed, 15 insertions, 0 deletions
diff --git a/ports/rp2/moduos.c b/ports/rp2/moduos.c
index 02f34eb96..a9dc30df8 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 3385323db..c4169fb66 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) {