rp2/mphalport: Add optional dupterm support.

This commit is contained in:
iabdalkader 2022-01-15 04:32:01 +02:00 committed by Damien George
parent f44fb76055
commit 5db278f1dd
2 changed files with 15 additions and 0 deletions

View File

@ -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"

View File

@ -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) {