From 7e14680a83525bf0822ef9cab899a5625496d662 Mon Sep 17 00:00:00 2001 From: Andrew Leech Date: Mon, 26 Sep 2022 11:02:31 +1000 Subject: py/objringio: Add micropython.RingIO() interface for general use. This commit adds a new `RingIO` type which exposes the internal ring-buffer code for general use in Python programs. It has the stream interface making it similar to `StringIO` and `BytesIO`, except `RingIO` has a fixed buffer size and is automatically safe when reads and writes are in different threads or an IRQ. This new type is enabled at the "extra features" ROM level. Signed-off-by: Andrew Leech --- py/modmicropython.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'py/modmicropython.c') diff --git a/py/modmicropython.c b/py/modmicropython.c index daf03807c8..1bf0a000c2 100644 --- a/py/modmicropython.c +++ b/py/modmicropython.c @@ -200,6 +200,9 @@ static const mp_rom_map_elem_t mp_module_micropython_globals_table[] = { #if MICROPY_KBD_EXCEPTION { MP_ROM_QSTR(MP_QSTR_kbd_intr), MP_ROM_PTR(&mp_micropython_kbd_intr_obj) }, #endif + #if MICROPY_PY_MICROPYTHON_RINGIO + { MP_ROM_QSTR(MP_QSTR_RingIO), MP_ROM_PTR(&mp_type_ringio) }, + #endif #if MICROPY_ENABLE_SCHEDULER { MP_ROM_QSTR(MP_QSTR_schedule), MP_ROM_PTR(&mp_micropython_schedule_obj) }, #endif -- cgit v1.2.3