esp32: Add support for and enable uos.dupterm().

pull/3695/merge
Damien George 2018-04-27 23:51:00 +10:00
rodzic 04dc4a5034
commit 98b05e3614
3 zmienionych plików z 11 dodań i 3 usunięć

Wyświetl plik

@ -31,11 +31,11 @@
#include "esp_system.h"
#include "py/mpconfig.h"
#include "py/obj.h"
#include "py/objstr.h"
#include "py/runtime.h"
#include "py/mperrno.h"
#include "py/mphal.h"
#include "extmod/misc.h"
#include "extmod/vfs.h"
#include "extmod/vfs_fat.h"
#include "genhdr/mpversion.h"
@ -87,7 +87,13 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(os_urandom_obj, os_urandom);
#if MICROPY_PY_OS_DUPTERM
STATIC mp_obj_t os_dupterm_notify(mp_obj_t obj_in) {
(void)obj_in;
mp_hal_signal_dupterm_input();
for (;;) {
int c = mp_uos_dupterm_rx_chr();
if (c < 0) {
break;
}
ringbuf_put(&stdin_ringbuf, c);
}
return mp_const_none;
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(os_dupterm_notify_obj, os_dupterm_notify);

Wyświetl plik

@ -127,6 +127,7 @@
#define MICROPY_PY_UBINASCII_CRC32 (1)
#define MICROPY_PY_URANDOM (1)
#define MICROPY_PY_URANDOM_EXTRA_FUNCS (1)
#define MICROPY_PY_OS_DUPTERM (1)
#define MICROPY_PY_MACHINE (1)
#define MICROPY_PY_MACHINE_PIN_MAKE_NEW mp_pin_make_new
#define MICROPY_PY_MACHINE_PULSE (1)

Wyświetl plik

@ -63,6 +63,7 @@ void mp_hal_stdout_tx_strn(const char *str, uint32_t len) {
uart_tx_one_char(str[i]);
}
MP_THREAD_GIL_ENTER();
mp_uos_dupterm_tx_strn(str, len);
}
// Efficiently convert "\n" to "\r\n"