Skip to content

Commit ab0e36b

Browse files
committed
stmhal/file: For self-contained usecase, don't define global types.
If MICROPY_VFS_FAT is defined, mp_type_fileio & mp_type_textio won't be defined, as these may be alredy defined elsewhere. The idea is to have compartmentalized VFS FatFs class, which can work in parallel with some other "main" filesystem. E.g., for unix port, mp_type_fileio, etc. will be defined for the main POSIX filesystem, while stmhal/file.c will be a self-contained VFS file class.
1 parent 350ab0f commit ab0e36b

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

stmhal/file.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@
3333
#include "lib/fatfs/ff.h"
3434
#include "file.h"
3535

36+
#if MICROPY_VFS_FAT
37+
#define mp_type_fileio fatfs_type_fileio
38+
#define mp_type_textio fatfs_type_textio
39+
#endif
40+
3641
extern const mp_obj_type_t mp_type_fileio;
3742
extern const mp_obj_type_t mp_type_textio;
3843

0 commit comments

Comments
 (0)