compiles and runs; hangs on import storage;storage.VfsFat.<tab>
This commit is contained in:
parent
0d27f4d9a6
commit
e2e01efa84
@ -68,6 +68,8 @@ typedef struct _mp_vfs_ilistdir_it_t {
|
|||||||
bool is_iter;
|
bool is_iter;
|
||||||
} mp_vfs_ilistdir_it_t;
|
} mp_vfs_ilistdir_it_t;
|
||||||
|
|
||||||
|
mp_obj_t mp_vfs_ilistdir_it_iternext(mp_obj_t self_in);
|
||||||
|
|
||||||
mp_vfs_mount_t *mp_vfs_lookup_path(const char *path, const char **path_out);
|
mp_vfs_mount_t *mp_vfs_lookup_path(const char *path, const char **path_out);
|
||||||
mp_import_stat_t mp_vfs_import_stat(const char *path);
|
mp_import_stat_t mp_vfs_import_stat(const char *path);
|
||||||
mp_obj_t mp_vfs_mount(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args);
|
mp_obj_t mp_vfs_mount(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args);
|
||||||
|
@ -48,7 +48,7 @@
|
|||||||
|
|
||||||
#define mp_obj_fat_vfs_t fs_user_mount_t
|
#define mp_obj_fat_vfs_t fs_user_mount_t
|
||||||
|
|
||||||
STATIC mp_import_stat_t fat_vfs_import_stat(void *vfs_in, const char *path) {
|
mp_import_stat_t fat_vfs_import_stat(void *vfs_in, const char *path) {
|
||||||
fs_user_mount_t *vfs = vfs_in;
|
fs_user_mount_t *vfs = vfs_in;
|
||||||
FILINFO fno;
|
FILINFO fno;
|
||||||
assert(vfs != NULL);
|
assert(vfs != NULL);
|
||||||
@ -411,11 +411,11 @@ STATIC mp_obj_t vfs_fat_getlabel(mp_obj_t self_in) {
|
|||||||
if (res != FR_OK) {
|
if (res != FR_OK) {
|
||||||
mp_raise_OSError(fresult_to_errno_table[res]);
|
mp_raise_OSError(fresult_to_errno_table[res]);
|
||||||
}
|
}
|
||||||
return mp_obj_new_str(working_buf, strlen(working_buf), false);
|
return mp_obj_new_str(working_buf, strlen(working_buf));
|
||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(fat_vfs_getlabel_obj, vfs_fat_getlabel);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_1(fat_vfs_getlabel_obj, vfs_fat_getlabel);
|
||||||
|
|
||||||
static mp_obj_t vfs_fat_setlabel(mp_obj_t self_in, mp_obj_t label_in) {
|
STATIC mp_obj_t vfs_fat_setlabel(mp_obj_t self_in, mp_obj_t label_in) {
|
||||||
fs_user_mount_t *self = MP_OBJ_TO_PTR(self_in);
|
fs_user_mount_t *self = MP_OBJ_TO_PTR(self_in);
|
||||||
const char *label_str = mp_obj_str_get_str(label_in);
|
const char *label_str = mp_obj_str_get_str(label_in);
|
||||||
FRESULT res = f_setlabel(&self->fatfs, label_str);
|
FRESULT res = f_setlabel(&self->fatfs, label_str);
|
||||||
|
@ -35,8 +35,9 @@
|
|||||||
#define FSUSER_NATIVE (0x0001) // readblocks[2]/writeblocks[2] contain native func
|
#define FSUSER_NATIVE (0x0001) // readblocks[2]/writeblocks[2] contain native func
|
||||||
#define FSUSER_FREE_OBJ (0x0002) // fs_user_mount_t obj should be freed on umount
|
#define FSUSER_FREE_OBJ (0x0002) // fs_user_mount_t obj should be freed on umount
|
||||||
#define FSUSER_HAVE_IOCTL (0x0004) // new protocol with ioctl
|
#define FSUSER_HAVE_IOCTL (0x0004) // new protocol with ioctl
|
||||||
|
#define FSUSER_NO_FILESYSTEM (0x0008) // the block device has no filesystem on it
|
||||||
// Device is writable over USB and read-only to MicroPython.
|
// Device is writable over USB and read-only to MicroPython.
|
||||||
#define FSUSER_USB_WRITABLE (0x0008)
|
#define FSUSER_USB_WRITABLE (0x0010)
|
||||||
|
|
||||||
typedef struct _fs_user_mount_t {
|
typedef struct _fs_user_mount_t {
|
||||||
mp_obj_base_t base;
|
mp_obj_base_t base;
|
||||||
@ -54,12 +55,28 @@ typedef struct _fs_user_mount_t {
|
|||||||
FATFS fatfs;
|
FATFS fatfs;
|
||||||
} fs_user_mount_t;
|
} fs_user_mount_t;
|
||||||
|
|
||||||
|
typedef struct _pyb_file_obj_t {
|
||||||
|
mp_obj_base_t base;
|
||||||
|
FIL fp;
|
||||||
|
} pyb_file_obj_t;
|
||||||
|
|
||||||
|
|
||||||
|
// These should be general types (mpy TOOD says so). In micropython, these are defined in
|
||||||
|
// mpconfigport.h.
|
||||||
|
#define mp_type_fileio mp_type_vfs_fat_fileio
|
||||||
|
#define mp_type_textio mp_type_vfs_fat_textio
|
||||||
|
|
||||||
|
extern const mp_obj_type_t mp_type_fileio;
|
||||||
|
extern const mp_obj_type_t mp_type_textio;
|
||||||
|
|
||||||
extern const byte fresult_to_errno_table[20];
|
extern const byte fresult_to_errno_table[20];
|
||||||
extern const mp_obj_type_t mp_fat_vfs_type;
|
extern const mp_obj_type_t mp_fat_vfs_type;
|
||||||
|
extern const mp_obj_type_t mp_type_vfs_fat_fileio;
|
||||||
|
extern const mp_obj_type_t mp_type_vfs_fat_textio;
|
||||||
|
|
||||||
mp_import_stat_t fat_vfs_import_stat(struct _fs_user_mount_t *vfs, const char *path);
|
mp_import_stat_t fat_vfs_import_stat(void *vfs, const char *path);
|
||||||
mp_obj_t fatfs_builtin_open_self(mp_obj_t self_in, mp_obj_t path, mp_obj_t mode);
|
|
||||||
MP_DECLARE_CONST_FUN_OBJ_KW(mp_builtin_open_obj);
|
MP_DECLARE_CONST_FUN_OBJ_3(fat_vfs_open_obj);
|
||||||
|
|
||||||
mp_obj_t fat_vfs_ilistdir2(struct _fs_user_mount_t *vfs, const char *path, bool is_str_type);
|
mp_obj_t fat_vfs_ilistdir2(struct _fs_user_mount_t *vfs, const char *path, bool is_str_type);
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ STATIC fs_user_mount_t *disk_get_device(void *bdev) {
|
|||||||
|
|
||||||
STATIC
|
STATIC
|
||||||
DSTATUS disk_initialize (
|
DSTATUS disk_initialize (
|
||||||
bdev_t pdrv /* Physical drive nmuber (0..) */
|
bdev_t pdrv /* Physical drive number (0..) */
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
fs_user_mount_t *vfs = disk_get_device(pdrv);
|
fs_user_mount_t *vfs = disk_get_device(pdrv);
|
||||||
|
@ -27,8 +27,6 @@
|
|||||||
#include "py/mpconfig.h"
|
#include "py/mpconfig.h"
|
||||||
#if MICROPY_VFS && MICROPY_VFS_FAT
|
#if MICROPY_VFS && MICROPY_VFS_FAT
|
||||||
|
|
||||||
#include "extmod/vfs_fat_file.h"
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "py/runtime.h"
|
#include "py/runtime.h"
|
||||||
|
@ -1,50 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is part of the Micro Python project, http://micropython.org/
|
|
||||||
*
|
|
||||||
* The MIT License (MIT)
|
|
||||||
*
|
|
||||||
* Copyright (c) 2013, 2014 Damien P. George
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
|
||||||
* in the Software without restriction, including without limitation the rights
|
|
||||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
* copies of the Software, and to permit persons to whom the Software is
|
|
||||||
* furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in
|
|
||||||
* all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
* THE SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef MICROPY_INCLUDED_EXTMOD_VFS_FAT_FILE_H
|
|
||||||
#define MICROPY_INCLUDED_EXTMOD_VFS_FAT_FILE_H
|
|
||||||
|
|
||||||
#include "py/mpconfig.h"
|
|
||||||
|
|
||||||
#if MICROPY_VFS && MICROPY_VFS_FAT
|
|
||||||
|
|
||||||
#include "lib/oofatfs/ff.h"
|
|
||||||
#include "py/obj.h"
|
|
||||||
|
|
||||||
#define mp_type_fileio fatfs_type_fileio
|
|
||||||
#define mp_type_textio fatfs_type_textio
|
|
||||||
|
|
||||||
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;
|
|
||||||
|
|
||||||
#endif // MICROPY_VFS && MICROPY_VFS_FAT
|
|
||||||
|
|
||||||
#endif // MICROPY_INCLUDED_EXTMOD_VFS_FAT_FILE_H
|
|
@ -27,7 +27,7 @@
|
|||||||
#ifndef MICROPY_INCLUDED_ATMEL_SAMD_AUDIO_DMA_H
|
#ifndef MICROPY_INCLUDED_ATMEL_SAMD_AUDIO_DMA_H
|
||||||
#define MICROPY_INCLUDED_ATMEL_SAMD_AUDIO_DMA_H
|
#define MICROPY_INCLUDED_ATMEL_SAMD_AUDIO_DMA_H
|
||||||
|
|
||||||
#include "extmod/vfs_fat_file.h"
|
#include "extmod/vfs_fat.h"
|
||||||
#include "py/obj.h"
|
#include "py/obj.h"
|
||||||
#include "shared-module/audioio/RawSample.h"
|
#include "shared-module/audioio/RawSample.h"
|
||||||
#include "shared-module/audioio/WaveFile.h"
|
#include "shared-module/audioio/WaveFile.h"
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "extmod/vfs_fat_file.h"
|
#include "extmod/vfs_fat.h"
|
||||||
#include "py/gc.h"
|
#include "py/gc.h"
|
||||||
#include "py/mperrno.h"
|
#include "py/mperrno.h"
|
||||||
#include "py/runtime.h"
|
#include "py/runtime.h"
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
#include "common-hal/microcontroller/Pin.h"
|
#include "common-hal/microcontroller/Pin.h"
|
||||||
|
|
||||||
#include "extmod/vfs_fat_file.h"
|
#include "extmod/vfs_fat.h"
|
||||||
#include "py/obj.h"
|
#include "py/obj.h"
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "extmod/vfs_fat_file.h"
|
#include "extmod/vfs_fat.h"
|
||||||
#include "py/gc.h"
|
#include "py/gc.h"
|
||||||
#include "py/mperrno.h"
|
#include "py/mperrno.h"
|
||||||
#include "py/runtime.h"
|
#include "py/runtime.h"
|
||||||
|
@ -1242,6 +1242,10 @@ typedef double mp_float_t;
|
|||||||
#define MICROPY_PY_OS_DUPTERM (0)
|
#define MICROPY_PY_OS_DUPTERM (0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef MICROPY_PY_LWIP
|
||||||
|
#define MICROPY_PY_LWIP (0)
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef MICROPY_PY_LWIP_SLIP
|
#ifndef MICROPY_PY_LWIP_SLIP
|
||||||
#define MICROPY_PY_LWIP_SLIP (0)
|
#define MICROPY_PY_LWIP_SLIP (0)
|
||||||
#endif
|
#endif
|
||||||
|
@ -177,6 +177,7 @@ typedef struct _mp_state_vm_t {
|
|||||||
|
|
||||||
#if MICROPY_PY_OS_DUPTERM
|
#if MICROPY_PY_OS_DUPTERM
|
||||||
mp_obj_t dupterm_objs[MICROPY_PY_OS_DUPTERM];
|
mp_obj_t dupterm_objs[MICROPY_PY_OS_DUPTERM];
|
||||||
|
mp_obj_t dupterm_arr_obj;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if MICROPY_PY_LWIP_SLIP
|
#if MICROPY_PY_LWIP_SLIP
|
||||||
|
@ -213,13 +213,13 @@ STATIC const mp_rom_map_elem_t mp_builtin_module_table[] = {
|
|||||||
#if MICROPY_PY_USSL
|
#if MICROPY_PY_USSL
|
||||||
{ MP_ROM_QSTR(MP_QSTR_ussl), MP_ROM_PTR(&mp_module_ussl) },
|
{ MP_ROM_QSTR(MP_QSTR_ussl), MP_ROM_PTR(&mp_module_ussl) },
|
||||||
#endif
|
#endif
|
||||||
#ifdef MICROPY_PY_LWIP
|
#if MICROPY_PY_LWIP
|
||||||
{ MP_ROM_QSTR(MP_QSTR_lwip), MP_ROM_PTR(&mp_module_lwip) },
|
{ MP_ROM_QSTR(MP_QSTR_lwip), MP_ROM_PTR(&mp_module_lwip) },
|
||||||
#endif
|
#endif
|
||||||
#if MICROPY_PY_WEBSOCKET
|
#if MICROPY_PY_WEBSOCKET
|
||||||
{ MP_ROM_QSTR(MP_QSTR_websocket), MP_ROM_PTR(&mp_module_websocket) },
|
{ MP_ROM_QSTR(MP_QSTR_websocket), MP_ROM_PTR(&mp_module_websocket) },
|
||||||
#endif
|
#endif
|
||||||
#ifdef MICROPY_PY_WEBREPL
|
#if MICROPY_PY_WEBREPL
|
||||||
{ MP_ROM_QSTR(MP_QSTR__webrepl), MP_ROM_PTR(&mp_module_webrepl) },
|
{ MP_ROM_QSTR(MP_QSTR__webrepl), MP_ROM_PTR(&mp_module_webrepl) },
|
||||||
#endif
|
#endif
|
||||||
#if MICROPY_PY_FRAMEBUF
|
#if MICROPY_PY_FRAMEBUF
|
||||||
|
@ -60,7 +60,7 @@ STATIC mp_obj_t namedtuple_asdict(mp_obj_t self_in) {
|
|||||||
MP_DEFINE_CONST_FUN_OBJ_1(namedtuple_asdict_obj, namedtuple_asdict);
|
MP_DEFINE_CONST_FUN_OBJ_1(namedtuple_asdict_obj, namedtuple_asdict);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
STATIC void namedtuple_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t kind) {
|
void namedtuple_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t kind) {
|
||||||
(void)kind;
|
(void)kind;
|
||||||
mp_obj_namedtuple_t *o = MP_OBJ_TO_PTR(o_in);
|
mp_obj_namedtuple_t *o = MP_OBJ_TO_PTR(o_in);
|
||||||
mp_printf(print, "%q", o->tuple.base.type->name);
|
mp_printf(print, "%q", o->tuple.base.type->name);
|
||||||
@ -68,7 +68,7 @@ STATIC void namedtuple_print(const mp_print_t *print, mp_obj_t o_in, mp_print_ki
|
|||||||
mp_obj_attrtuple_print_helper(print, fields, &o->tuple);
|
mp_obj_attrtuple_print_helper(print, fields, &o->tuple);
|
||||||
}
|
}
|
||||||
|
|
||||||
STATIC void namedtuple_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) {
|
void namedtuple_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) {
|
||||||
if (dest[0] == MP_OBJ_NULL) {
|
if (dest[0] == MP_OBJ_NULL) {
|
||||||
// load attribute
|
// load attribute
|
||||||
mp_obj_namedtuple_t *self = MP_OBJ_TO_PTR(self_in);
|
mp_obj_namedtuple_t *self = MP_OBJ_TO_PTR(self_in);
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of the MicroPython project, http://micropython.org/
|
* This file is part of the Micro Python project, http://micropython.org/
|
||||||
*
|
*
|
||||||
* The MIT License (MIT)
|
* The MIT License (MIT)
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014-2017 Paul Sokolovsky
|
* Copyright (c) 2013, 2014 Damien P. George
|
||||||
|
* Copyright (c) 2014 Paul Sokolovsky
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
@ -23,14 +24,22 @@
|
|||||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
* THE SOFTWARE.
|
* THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef MICROPY_INCLUDED_PY_OBJNAMEDTUPLE_H
|
#ifndef MICROPY_INCLUDED_PY_OBJNAMEDTUPLE_H
|
||||||
#define MICROPY_INCLUDED_PY_OBJNAMEDTUPLE_H
|
#define MICROPY_INCLUDED_PY_OBJNAMEDTUPLE_H
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "py/nlr.h"
|
||||||
#include "py/objtuple.h"
|
#include "py/objtuple.h"
|
||||||
|
#include "py/runtime.h"
|
||||||
|
#include "py/objstr.h"
|
||||||
|
|
||||||
|
#if MICROPY_PY_COLLECTIONS
|
||||||
|
|
||||||
typedef struct _mp_obj_namedtuple_type_t {
|
typedef struct _mp_obj_namedtuple_type_t {
|
||||||
mp_obj_type_t base;
|
mp_obj_type_t base;
|
||||||
size_t n_fields;
|
mp_uint_t n_fields;
|
||||||
qstr fields[];
|
qstr fields[];
|
||||||
} mp_obj_namedtuple_type_t;
|
} mp_obj_namedtuple_type_t;
|
||||||
|
|
||||||
@ -38,7 +47,12 @@ typedef struct _mp_obj_namedtuple_t {
|
|||||||
mp_obj_tuple_t tuple;
|
mp_obj_tuple_t tuple;
|
||||||
} mp_obj_namedtuple_t;
|
} mp_obj_namedtuple_t;
|
||||||
|
|
||||||
size_t mp_obj_namedtuple_find_field(const mp_obj_namedtuple_type_t *type, qstr name);
|
void namedtuple_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t kind);
|
||||||
mp_obj_namedtuple_type_t *mp_obj_new_namedtuple_base(size_t n_fields, mp_obj_t *fields);
|
|
||||||
|
|
||||||
#endif // MICROPY_INCLUDED_PY_OBJNAMEDTUPLE_H
|
void namedtuple_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest);
|
||||||
|
|
||||||
|
mp_obj_t namedtuple_make_new(const mp_obj_type_t *type_in, size_t n_args, size_t n_kw, const mp_obj_t *args);
|
||||||
|
|
||||||
|
#endif // MICROPY_PY_COLLECTIONS
|
||||||
|
|
||||||
|
#endif // MICROPY_INCLUDED_PY_OBJNAMEDTUPLE_H
|
||||||
|
@ -1285,6 +1285,7 @@ STATIC void super_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) {
|
|||||||
dest[0] = mp_call_method_n_kw(2, 0, attr_get_method);
|
dest[0] = mp_call_method_n_kw(2, 0, attr_get_method);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,10 +116,11 @@ void mp_init(void) {
|
|||||||
MP_STATE_VM(mp_module_builtins_override_dict) = NULL;
|
MP_STATE_VM(mp_module_builtins_override_dict) = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef MICROPY_PY_OS_DUPTERM
|
#if MICROPY_PY_OS_DUPTERM
|
||||||
for (size_t i = 0; i < MICROPY_PY_OS_DUPTERM; ++i) {
|
for (size_t i = 0; i < MICROPY_PY_OS_DUPTERM; ++i) {
|
||||||
MP_STATE_VM(dupterm_objs[i]) = MP_OBJ_NULL;
|
MP_STATE_VM(dupterm_objs[i]) = MP_OBJ_NULL;
|
||||||
}
|
}
|
||||||
|
MP_STATE_VM(dupterm_arr_obj) = MP_OBJ_NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef MICROPY_FSUSERMOUNT
|
#ifdef MICROPY_FSUSERMOUNT
|
||||||
|
@ -158,6 +158,7 @@ NORETURN void mp_raise_RuntimeError(const char *msg);
|
|||||||
NORETURN void mp_raise_ImportError(const char *msg);
|
NORETURN void mp_raise_ImportError(const char *msg);
|
||||||
NORETURN void mp_raise_IndexError(const char *msg);
|
NORETURN void mp_raise_IndexError(const char *msg);
|
||||||
NORETURN void mp_raise_OSError(int errno_);
|
NORETURN void mp_raise_OSError(int errno_);
|
||||||
|
NORETURN void mp_raise_NotImplementedError(const char *msg);
|
||||||
NORETURN void mp_raise_recursion_depth(void);
|
NORETURN void mp_raise_recursion_depth(void);
|
||||||
|
|
||||||
#if MICROPY_BUILTIN_METHOD_CHECK_SELF_ARG
|
#if MICROPY_BUILTIN_METHOD_CHECK_SELF_ARG
|
||||||
|
@ -194,7 +194,7 @@ STATIC mp_obj_t audiobusio_pdmin_obj_record(mp_obj_t self_obj, mp_obj_t destinat
|
|||||||
uint32_t length = MP_OBJ_SMALL_INT_VALUE(destination_length);
|
uint32_t length = MP_OBJ_SMALL_INT_VALUE(destination_length);
|
||||||
|
|
||||||
mp_buffer_info_t bufinfo;
|
mp_buffer_info_t bufinfo;
|
||||||
if (MP_OBJ_IS_TYPE(destination, &fatfs_type_fileio)) {
|
if (MP_OBJ_IS_TYPE(destination, &mp_type_fileio)) {
|
||||||
mp_raise_NotImplementedError("");
|
mp_raise_NotImplementedError("");
|
||||||
} else if (mp_get_buffer(destination, &bufinfo, MP_BUFFER_WRITE)) {
|
} else if (mp_get_buffer(destination, &bufinfo, MP_BUFFER_WRITE)) {
|
||||||
if (bufinfo.len / mp_binary_get_size('@', bufinfo.typecode, NULL) < length) {
|
if (bufinfo.len / mp_binary_get_size('@', bufinfo.typecode, NULL) < length) {
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
#include "common-hal/audiobusio/PDMIn.h"
|
#include "common-hal/audiobusio/PDMIn.h"
|
||||||
#include "common-hal/microcontroller/Pin.h"
|
#include "common-hal/microcontroller/Pin.h"
|
||||||
#include "extmod/vfs_fat_file.h"
|
#include "extmod/vfs_fat.h"
|
||||||
|
|
||||||
extern const mp_obj_type_t audiobusio_pdmin_type;
|
extern const mp_obj_type_t audiobusio_pdmin_type;
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ STATIC mp_obj_t audioio_wavefile_make_new(const mp_obj_type_t *type, size_t n_ar
|
|||||||
|
|
||||||
audioio_wavefile_obj_t *self = m_new_obj(audioio_wavefile_obj_t);
|
audioio_wavefile_obj_t *self = m_new_obj(audioio_wavefile_obj_t);
|
||||||
self->base.type = &audioio_wavefile_type;
|
self->base.type = &audioio_wavefile_type;
|
||||||
if (MP_OBJ_IS_TYPE(args[0], &fatfs_type_fileio)) {
|
if (MP_OBJ_IS_TYPE(args[0], &mp_type_fileio)) {
|
||||||
common_hal_audioio_wavefile_construct(self, MP_OBJ_TO_PTR(args[0]));
|
common_hal_audioio_wavefile_construct(self, MP_OBJ_TO_PTR(args[0]));
|
||||||
} else {
|
} else {
|
||||||
mp_raise_TypeError("file must be a file opened in byte mode");
|
mp_raise_TypeError("file must be a file opened in byte mode");
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
#include "common-hal/audioio/AudioOut.h"
|
#include "common-hal/audioio/AudioOut.h"
|
||||||
#include "common-hal/microcontroller/Pin.h"
|
#include "common-hal/microcontroller/Pin.h"
|
||||||
#include "extmod/vfs_fat_file.h"
|
#include "extmod/vfs_fat.h"
|
||||||
|
|
||||||
extern const mp_obj_type_t audioio_wavefile_type;
|
extern const mp_obj_type_t audioio_wavefile_type;
|
||||||
|
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
#include "extmod/vfs_fat.h"
|
#include "extmod/vfs_fat.h"
|
||||||
#include "py/obj.h"
|
#include "py/obj.h"
|
||||||
#include "py/objnamedtuple.h"
|
#include "py/objnamedtuple.h"
|
||||||
|
#include "py/runtime.h"
|
||||||
#include "shared-bindings/storage/__init__.h"
|
#include "shared-bindings/storage/__init__.h"
|
||||||
|
|
||||||
//| :mod:`storage` --- storage management
|
//| :mod:`storage` --- storage management
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
|
|
||||||
#include "py/obj.h"
|
#include "py/obj.h"
|
||||||
#include "py/objnamedtuple.h"
|
#include "py/objnamedtuple.h"
|
||||||
|
#include "py/runtime.h"
|
||||||
#include "lib/timeutils/timeutils.h"
|
#include "lib/timeutils/timeutils.h"
|
||||||
#include "shared-bindings/rtc/__init__.h"
|
#include "shared-bindings/rtc/__init__.h"
|
||||||
#include "shared-bindings/time/__init__.h"
|
#include "shared-bindings/time/__init__.h"
|
||||||
|
@ -77,7 +77,7 @@ void common_hal_os_chdir(const char* path) {
|
|||||||
// subsequent relative paths begin at the root of that VFS.
|
// subsequent relative paths begin at the root of that VFS.
|
||||||
for (vfs = MP_STATE_VM(vfs_mount_table); vfs != NULL; vfs = vfs->next) {
|
for (vfs = MP_STATE_VM(vfs_mount_table); vfs != NULL; vfs = vfs->next) {
|
||||||
if (vfs->len == 1) {
|
if (vfs->len == 1) {
|
||||||
mp_obj_t root = mp_obj_new_str("/", 1, false);
|
mp_obj_t root = mp_obj_new_str("/", 1);
|
||||||
mp_vfs_proxy_call(vfs, MP_QSTR_chdir, 1, &root);
|
mp_vfs_proxy_call(vfs, MP_QSTR_chdir, 1, &root);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user