Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e2e01ef

Browse filesBrowse files
committed
compiles and runs; hangs on import storage;storage.VfsFat.<tab>
1 parent 0d27f4d commit e2e01ef
Copy full SHA for e2e01ef

25 files changed

+71-80Lines changed: 71 additions & 80 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎extmod/vfs.h‎

Copy file name to clipboardExpand all lines: extmod/vfs.h
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ typedef struct _mp_vfs_ilistdir_it_t {
6868
bool is_iter;
6969
} mp_vfs_ilistdir_it_t;
7070

71+
mp_obj_t mp_vfs_ilistdir_it_iternext(mp_obj_t self_in);
72+
7173
mp_vfs_mount_t *mp_vfs_lookup_path(const char *path, const char **path_out);
7274
mp_import_stat_t mp_vfs_import_stat(const char *path);
7375
mp_obj_t mp_vfs_mount(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args);
Collapse file

‎extmod/vfs_fat.c‎

Copy file name to clipboardExpand all lines: extmod/vfs_fat.c
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848

4949
#define mp_obj_fat_vfs_t fs_user_mount_t
5050

51-
STATIC mp_import_stat_t fat_vfs_import_stat(void *vfs_in, const char *path) {
51+
mp_import_stat_t fat_vfs_import_stat(void *vfs_in, const char *path) {
5252
fs_user_mount_t *vfs = vfs_in;
5353
FILINFO fno;
5454
assert(vfs != NULL);
@@ -411,11 +411,11 @@ STATIC mp_obj_t vfs_fat_getlabel(mp_obj_t self_in) {
411411
if (res != FR_OK) {
412412
mp_raise_OSError(fresult_to_errno_table[res]);
413413
}
414-
return mp_obj_new_str(working_buf, strlen(working_buf), false);
414+
return mp_obj_new_str(working_buf, strlen(working_buf));
415415
}
416416
STATIC MP_DEFINE_CONST_FUN_OBJ_1(fat_vfs_getlabel_obj, vfs_fat_getlabel);
417417

418-
static mp_obj_t vfs_fat_setlabel(mp_obj_t self_in, mp_obj_t label_in) {
418+
STATIC mp_obj_t vfs_fat_setlabel(mp_obj_t self_in, mp_obj_t label_in) {
419419
fs_user_mount_t *self = MP_OBJ_TO_PTR(self_in);
420420
const char *label_str = mp_obj_str_get_str(label_in);
421421
FRESULT res = f_setlabel(&self->fatfs, label_str);
Collapse file

‎extmod/vfs_fat.h‎

Copy file name to clipboardExpand all lines: extmod/vfs_fat.h
+21-4Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,9 @@
3535
#define FSUSER_NATIVE (0x0001) // readblocks[2]/writeblocks[2] contain native func
3636
#define FSUSER_FREE_OBJ (0x0002) // fs_user_mount_t obj should be freed on umount
3737
#define FSUSER_HAVE_IOCTL (0x0004) // new protocol with ioctl
38+
#define FSUSER_NO_FILESYSTEM (0x0008) // the block device has no filesystem on it
3839
// Device is writable over USB and read-only to MicroPython.
39-
#define FSUSER_USB_WRITABLE (0x0008)
40+
#define FSUSER_USB_WRITABLE (0x0010)
4041

4142
typedef struct _fs_user_mount_t {
4243
mp_obj_base_t base;
@@ -54,12 +55,28 @@ typedef struct _fs_user_mount_t {
5455
FATFS fatfs;
5556
} fs_user_mount_t;
5657

58+
typedef struct _pyb_file_obj_t {
59+
mp_obj_base_t base;
60+
FIL fp;
61+
} pyb_file_obj_t;
62+
63+
64+
// These should be general types (mpy TOOD says so). In micropython, these are defined in
65+
// mpconfigport.h.
66+
#define mp_type_fileio mp_type_vfs_fat_fileio
67+
#define mp_type_textio mp_type_vfs_fat_textio
68+
69+
extern const mp_obj_type_t mp_type_fileio;
70+
extern const mp_obj_type_t mp_type_textio;
71+
5772
extern const byte fresult_to_errno_table[20];
5873
extern const mp_obj_type_t mp_fat_vfs_type;
74+
extern const mp_obj_type_t mp_type_vfs_fat_fileio;
75+
extern const mp_obj_type_t mp_type_vfs_fat_textio;
76+
77+
mp_import_stat_t fat_vfs_import_stat(void *vfs, const char *path);
5978

60-
mp_import_stat_t fat_vfs_import_stat(struct _fs_user_mount_t *vfs, const char *path);
61-
mp_obj_t fatfs_builtin_open_self(mp_obj_t self_in, mp_obj_t path, mp_obj_t mode);
62-
MP_DECLARE_CONST_FUN_OBJ_KW(mp_builtin_open_obj);
79+
MP_DECLARE_CONST_FUN_OBJ_3(fat_vfs_open_obj);
6380

6481
mp_obj_t fat_vfs_ilistdir2(struct _fs_user_mount_t *vfs, const char *path, bool is_str_type);
6582

Collapse file

‎extmod/vfs_fat_diskio.c‎

Copy file name to clipboardExpand all lines: extmod/vfs_fat_diskio.c
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ STATIC fs_user_mount_t *disk_get_device(void *bdev) {
5757

5858
STATIC
5959
DSTATUS disk_initialize (
60-
bdev_t pdrv /* Physical drive nmuber (0..) */
60+
bdev_t pdrv /* Physical drive number (0..) */
6161
)
6262
{
6363
fs_user_mount_t *vfs = disk_get_device(pdrv);
Collapse file

‎extmod/vfs_fat_file.c‎

Copy file name to clipboardExpand all lines: extmod/vfs_fat_file.c
-2Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@
2727
#include "py/mpconfig.h"
2828
#if MICROPY_VFS && MICROPY_VFS_FAT
2929

30-
#include "extmod/vfs_fat_file.h"
31-
3230
#include <stdio.h>
3331

3432
#include "py/runtime.h"
Collapse file

‎extmod/vfs_fat_file.h‎

Copy file name to clipboardExpand all lines: extmod/vfs_fat_file.h
-50Lines changed: 0 additions & 50 deletions
This file was deleted.
Collapse file

‎ports/atmel-samd/audio_dma.h‎

Copy file name to clipboardExpand all lines: ports/atmel-samd/audio_dma.h
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#ifndef MICROPY_INCLUDED_ATMEL_SAMD_AUDIO_DMA_H
2828
#define MICROPY_INCLUDED_ATMEL_SAMD_AUDIO_DMA_H
2929

30-
#include "extmod/vfs_fat_file.h"
30+
#include "extmod/vfs_fat.h"
3131
#include "py/obj.h"
3232
#include "shared-module/audioio/RawSample.h"
3333
#include "shared-module/audioio/WaveFile.h"
Collapse file

‎ports/atmel-samd/common-hal/audiobusio/I2SOut.c‎

Copy file name to clipboardExpand all lines: ports/atmel-samd/common-hal/audiobusio/I2SOut.c
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#include <stdint.h>
2828
#include <string.h>
2929

30-
#include "extmod/vfs_fat_file.h"
30+
#include "extmod/vfs_fat.h"
3131
#include "py/gc.h"
3232
#include "py/mperrno.h"
3333
#include "py/runtime.h"
Collapse file

‎ports/atmel-samd/common-hal/audiobusio/PDMIn.h‎

Copy file name to clipboardExpand all lines: ports/atmel-samd/common-hal/audiobusio/PDMIn.h
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
#include "common-hal/microcontroller/Pin.h"
3131

32-
#include "extmod/vfs_fat_file.h"
32+
#include "extmod/vfs_fat.h"
3333
#include "py/obj.h"
3434

3535
typedef struct {
Collapse file

‎ports/atmel-samd/common-hal/audioio/AudioOut.c‎

Copy file name to clipboardExpand all lines: ports/atmel-samd/common-hal/audioio/AudioOut.c
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#include <stdint.h>
2828
#include <string.h>
2929

30-
#include "extmod/vfs_fat_file.h"
30+
#include "extmod/vfs_fat.h"
3131
#include "py/gc.h"
3232
#include "py/mperrno.h"
3333
#include "py/runtime.h"

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.