summaryrefslogtreecommitdiffstatshomepage
path: root/stmhal/file.c
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2016-02-06 21:05:43 +0200
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2016-02-07 01:25:28 +0200
commitab0e36b3dac042cdc43c0e6ae5283c4d2154f960 (patch)
treea363c4993da41b89145bb21144bda7fe4128120e /stmhal/file.c
parent350ab0f570a2cc570ceb9facb38cbd9ce68057f3 (diff)
downloadmicropython-ab0e36b3dac042cdc43c0e6ae5283c4d2154f960.tar.gz
micropython-ab0e36b3dac042cdc43c0e6ae5283c4d2154f960.zip
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.
Diffstat (limited to 'stmhal/file.c')
-rw-r--r--stmhal/file.c5
1 files changed, 5 insertions, 0 deletions
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;