diff options
author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2016-01-01 16:41:26 +0200 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2016-01-01 16:43:35 +0200 |
commit | 30b7344eb0a96c9cf608bec55ea38dfcb39ddfaf (patch) | |
tree | 9eac67e3b637994a6cc7273a138004a2aa225fc5 /unix/unix_mphal.c | |
parent | 00ee84e1e139416e1069a87965065a8c66c8afa4 (diff) | |
download | micropython-30b7344eb0a96c9cf608bec55ea38dfcb39ddfaf.tar.gz micropython-30b7344eb0a96c9cf608bec55ea38dfcb39ddfaf.zip |
extmod/moduos_dupterm: Make mp_uos_dupterm_tx_strn() function reusable.
Function to actually spool output terminal data to dupterm object.
Diffstat (limited to 'unix/unix_mphal.c')
-rw-r--r-- | unix/unix_mphal.c | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/unix/unix_mphal.c b/unix/unix_mphal.c index 16e80b7ef8..9da8680562 100644 --- a/unix/unix_mphal.c +++ b/unix/unix_mphal.c @@ -32,6 +32,7 @@ #include "py/mpstate.h" #include "py/mphal.h" #include "py/runtime.h" +#include "extmod/misc.h" #ifndef _WIN32 #include <signal.h> @@ -107,17 +108,6 @@ void mp_hal_stdio_mode_orig(void) { #endif -#if MICROPY_PY_OS_DUPTERM -void mp_hal_dupterm_tx_strn(const char *str, size_t len) { - if (MP_STATE_PORT(term_obj) != MP_OBJ_NULL) { - mp_obj_t write_m[3]; - mp_load_method(MP_STATE_PORT(term_obj), MP_QSTR_write, write_m); - write_m[2] = mp_obj_new_bytearray_by_ref(len, (char*)str); - mp_call_method_n_kw(1, 0, write_m); - } -} -#endif - int mp_hal_stdin_rx_chr(void) { unsigned char c; #if MICROPY_PY_OS_DUPTERM @@ -152,7 +142,7 @@ int mp_hal_stdin_rx_chr(void) { void mp_hal_stdout_tx_strn(const char *str, size_t len) { int ret = write(1, str, len); - mp_hal_dupterm_tx_strn(str, len); + mp_uos_dupterm_tx_strn(str, len); (void)ret; // to suppress compiler warning } |