summaryrefslogtreecommitdiff
path: root/extmod
diff options
context:
space:
mode:
authorScott Shawcroft <scott.shawcroft@gmail.com>2017-04-21 14:43:03 -0700
committerScott Shawcroft <scott.shawcroft@gmail.com>2017-05-01 13:10:03 -0700
commit58b9789d0c824c665db744ef3653d6304e908bc0 (patch)
treecffd27607f558314246640be45b245f512c8c939 /extmod
parent30b8091df016bab1fce1f3aa5a813fc8e279cb16 (diff)
atmel-samd: Introduce audio sample playback via audioio.AudioOut.
Diffstat (limited to 'extmod')
-rw-r--r--extmod/vfs_fat_file.c17
-rw-r--r--extmod/vfs_fat_file.h26
2 files changed, 28 insertions, 15 deletions
diff --git a/extmod/vfs_fat_file.c b/extmod/vfs_fat_file.c
index 77848b5a5..ef57225a9 100644
--- a/extmod/vfs_fat_file.c
+++ b/extmod/vfs_fat_file.c
@@ -24,7 +24,8 @@
* THE SOFTWARE.
*/
-#include "py/mpconfig.h"
+#include "extmod/vfs_fat_file.h"
+
// *_ADHOC part is for cc3200 port which doesn't use general uPy
// infrastructure and instead duplicates code. TODO: Resolve.
#if MICROPY_FSUSERMOUNT || MICROPY_FSUSERMOUNT_ADHOC
@@ -37,15 +38,6 @@
#include "py/stream.h"
#include "py/mperrno.h"
#include "lib/fatfs/ff.h"
-#include "extmod/vfs_fat_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;
// this table converts from FRESULT to POSIX errno
const byte fresult_to_errno_table[20] = {
@@ -71,11 +63,6 @@ const byte fresult_to_errno_table[20] = {
[FR_INVALID_PARAMETER] = MP_EINVAL,
};
-typedef struct _pyb_file_obj_t {
- mp_obj_base_t base;
- FIL fp;
-} pyb_file_obj_t;
-
STATIC void file_obj_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
(void)kind;
mp_printf(print, "<io.%s %p>", mp_obj_get_type_str(self_in), MP_OBJ_TO_PTR(self_in));
diff --git a/extmod/vfs_fat_file.h b/extmod/vfs_fat_file.h
index 5c271b6ee..5dc627986 100644
--- a/extmod/vfs_fat_file.h
+++ b/extmod/vfs_fat_file.h
@@ -24,9 +24,35 @@
* THE SOFTWARE.
*/
+#ifndef __MICROPY_INCLUDED_EXTMOD_VFS_FAT_FILE_H__
+#define __MICROPY_INCLUDED_EXTMOD_VFS_FAT_FILE_H__
+
+#include "lib/fatfs/ff.h"
+#include "py/mpconfig.h"
+#include "py/obj.h"
+
+#if MICROPY_FSUSERMOUNT || MICROPY_FSUSERMOUNT_ADHOC
+
extern const byte fresult_to_errno_table[20];
+#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;
+
+typedef struct _pyb_file_obj_t {
+ mp_obj_base_t base;
+ FIL fp;
+} pyb_file_obj_t;
+
mp_obj_t fatfs_builtin_open(mp_uint_t n_args, const mp_obj_t *args, mp_map_t *kwargs);
MP_DECLARE_CONST_FUN_OBJ_KW(mp_builtin_open_obj);
mp_obj_t fat_vfs_listdir(const char *path, bool is_str_type);
+
+#endif // MICROPY_FSUSERMOUNT || MICROPY_FSUSERMOUNT_ADHOC
+
+#endif // __MICROPY_INCLUDED_EXTMOD_VFS_FAT_FILE_H__