From ab0e36b3dac042cdc43c0e6ae5283c4d2154f960 Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Sat, 6 Feb 2016 21:05:43 +0200 Subject: [PATCH] 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. --- stmhal/file.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/stmhal/file.c b/stmhal/file.c index b3e811231a..37e43a7db3 100644 --- a/stmhal/file.c +++ b/stmhal/file.c @@ -33,6 +33,11 @@ #include "lib/fatfs/ff.h" #include "file.h" +#if MICROPY_VFS_FAT +#define mp_type_fileio fatfs_type_fileio +#define mp_type_textio fatfs_type_textio +#endif + extern const mp_obj_type_t mp_type_fileio; extern const mp_obj_type_t mp_type_textio;