mirror of
https://github.com/micropython/micropython.git
synced 2025-12-16 09:50:15 +01:00
extmod/modos: Factor os.dupterm_notify() function to common extmod code.
esp8266 doesn't need ets task because the notify is now scheduled (see commits7d57037906andc60caf1995for relevant history). Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
@@ -29,6 +29,9 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
// This file is never compiled standalone, it's included directly from
|
||||
// extmod/modos.c via MICROPY_PY_OS_INCLUDEFILE.
|
||||
|
||||
#include "py/runtime.h"
|
||||
#include "py/mphal.h"
|
||||
#include "modmachine.h"
|
||||
@@ -96,18 +99,3 @@ bool mp_os_dupterm_is_builtin_stream(mp_const_obj_t stream) {
|
||||
return type == &machine_uart_type;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if MICROPY_PY_OS_DUPTERM_NOTIFY
|
||||
STATIC mp_obj_t mp_os_dupterm_notify(mp_obj_t obj_in) {
|
||||
(void)obj_in;
|
||||
for (;;) {
|
||||
int c = mp_os_dupterm_rx_chr();
|
||||
if (c < 0) {
|
||||
break;
|
||||
}
|
||||
ringbuf_put(&stdin_ringbuf, c);
|
||||
}
|
||||
return mp_const_none;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_os_dupterm_notify_obj, mp_os_dupterm_notify);
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user