diff options
author | Andrew Leech <andrew.leech@planetinnovation.com.au> | 2022-09-26 11:02:31 +1000 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2024-09-19 18:00:44 +1000 |
commit | 7e14680a83525bf0822ef9cab899a5625496d662 (patch) | |
tree | e5176548c07d8973956b48e1f3a462c36ed1e532 /py/modmicropython.c | |
parent | 6c73573b34c3fbd3d4da8d56767db03a8e5dd540 (diff) | |
download | micropython-7e14680a83525bf0822ef9cab899a5625496d662.tar.gz micropython-7e14680a83525bf0822ef9cab899a5625496d662.zip |
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 <andrew.leech@planetinnovation.com.au>
Diffstat (limited to 'py/modmicropython.c')
-rw-r--r-- | py/modmicropython.c | 3 |
1 files changed, 3 insertions, 0 deletions
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 |