summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGlenn Ruben Bakke <glennbakke@gmail.com>2020-07-23 21:08:25 +0200
committerDamien George <damien@micropython.org>2021-08-08 23:09:26 +1000
commit7a833edf37ed9714abdf5b7cf96d615fe877f3b9 (patch)
treeab0d4874721dde45662983c62343ecb4803bb119
parent0bde907a8b010e0b7a6436f3840f7350455bcd01 (diff)
nrf/modules/uos: Allow a board to configure MICROPY_VFS_FAT/LFS1/LFS2.
-rw-r--r--ports/nrf/modules/uos/moduos.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/ports/nrf/modules/uos/moduos.c b/ports/nrf/modules/uos/moduos.c
index 98a5661f4..fd5334d00 100644
--- a/ports/nrf/modules/uos/moduos.c
+++ b/ports/nrf/modules/uos/moduos.c
@@ -36,6 +36,7 @@
#include "modules/uos/microbitfs.h"
#include "extmod/vfs.h"
#include "extmod/vfs_fat.h"
+#include "extmod/vfs_lfs.h"
#include "genhdr/mpversion.h"
#include "uart.h"
@@ -85,10 +86,12 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_0(os_uname_obj, os_uname);
/// \function sync()
/// Sync all filesystems.
STATIC mp_obj_t os_sync(void) {
+ #if MICROPY_VFS_FAT
for (mp_vfs_mount_t *vfs = MP_STATE_VM(vfs_mount_table); vfs != NULL; vfs = vfs->next) {
// this assumes that vfs->obj is fs_user_mount_t with block device functions
disk_ioctl(MP_OBJ_TO_PTR(vfs->obj), CTRL_SYNC, NULL);
}
+ #endif
return mp_const_none;
}
MP_DEFINE_CONST_FUN_OBJ_0(mod_os_sync_obj, os_sync);
@@ -174,7 +177,15 @@ STATIC const mp_rom_map_elem_t os_module_globals_table[] = {
#if MICROPY_VFS
{ MP_ROM_QSTR(MP_QSTR_mount), MP_ROM_PTR(&mp_vfs_mount_obj) },
{ MP_ROM_QSTR(MP_QSTR_umount), MP_ROM_PTR(&mp_vfs_umount_obj) },
+ #if MICROPY_VFS_FAT
{ MP_ROM_QSTR(MP_QSTR_VfsFat), MP_ROM_PTR(&mp_fat_vfs_type) },
+ #endif
+ #if MICROPY_VFS_LFS1
+ { MP_ROM_QSTR(MP_QSTR_VfsLfs1), MP_ROM_PTR(&mp_type_vfs_lfs1) },
+ #endif
+ #if MICROPY_VFS_LFS2
+ { MP_ROM_QSTR(MP_QSTR_VfsLfs2), MP_ROM_PTR(&mp_type_vfs_lfs2) },
+ #endif
#endif
};