diff options
author | Damien George <damien@micropython.org> | 2023-11-29 12:18:10 +1100 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2023-11-30 16:33:56 +1100 |
commit | 22d9116c8c53463805dcd30fbeb78fbfa84c0e98 (patch) | |
tree | 9a3e28bf721c2cc90a0d04d0fba283513076499e /extmod/modos.c | |
parent | e3c4c32c640465a3596acdb1bd6a2b8f1eb89a29 (diff) | |
download | micropython-22d9116c8c53463805dcd30fbeb78fbfa84c0e98.tar.gz micropython-22d9116c8c53463805dcd30fbeb78fbfa84c0e98.zip |
nrf: Convert os module to use extmod version.
The os.dupterm() function has changed on this port, it now matches the
semantics used by all other ports (except it's restricted to accept only
machine.UART objects).
Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'extmod/modos.c')
-rw-r--r-- | extmod/modos.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/extmod/modos.c b/extmod/modos.c index 6df49d7f84..da14fd81f8 100644 --- a/extmod/modos.c +++ b/extmod/modos.c @@ -48,6 +48,13 @@ #include "extmod/vfs_posix.h" #endif +#if MICROPY_MBFS +#if MICROPY_VFS +#error "MICROPY_MBFS requires MICROPY_VFS to be disabled" +#endif +#include "ports/nrf/modules/os/microbitfs.h" +#endif + #if MICROPY_PY_OS_UNAME #include "genhdr/mpversion.h" #endif @@ -187,6 +194,14 @@ STATIC const mp_rom_map_elem_t os_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_VfsPosix), MP_ROM_PTR(&mp_type_vfs_posix) }, #endif #endif + + #if MICROPY_MBFS + // For special micro:bit filesystem only. + { MP_ROM_QSTR(MP_QSTR_listdir), MP_ROM_PTR(&os_mbfs_listdir_obj) }, + { MP_ROM_QSTR(MP_QSTR_ilistdir), MP_ROM_PTR(&os_mbfs_ilistdir_obj) }, + { MP_ROM_QSTR(MP_QSTR_stat), MP_ROM_PTR(&os_mbfs_stat_obj) }, + { MP_ROM_QSTR(MP_QSTR_remove), MP_ROM_PTR(&os_mbfs_remove_obj) }, + #endif }; STATIC MP_DEFINE_CONST_DICT(os_module_globals, os_module_globals_table); |