rp2: Enable VfsFat class for FAT filesystem support.
Allows interfacing with SD cards, for example.
This commit is contained in:
parent
23ce25a7c3
commit
8610bababe
@ -51,6 +51,7 @@ set(SOURCE_DRIVERS
|
||||
)
|
||||
|
||||
set(SOURCE_PORT
|
||||
fatfs_port.c
|
||||
machine_adc.c
|
||||
machine_i2c.c
|
||||
machine_pin.c
|
||||
|
34
ports/rp2/fatfs_port.c
Normal file
34
ports/rp2/fatfs_port.c
Normal file
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* This file is part of the MicroPython 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.
|
||||
*/
|
||||
|
||||
#include "lib/oofatfs/ff.h"
|
||||
#include "hardware/rtc.h"
|
||||
|
||||
MP_WEAK DWORD get_fattime(void) {
|
||||
datetime_t t;
|
||||
rtc_get_datetime(&t);
|
||||
return ((2000 + t.year - 1980) << 25) | ((t.month) << 21) | ((t.day) << 16) | ((t.hour) << 11) | ((t.min) << 5) | (t.sec / 2);
|
||||
}
|
@ -118,6 +118,12 @@
|
||||
#define MICROPY_PY_FRAMEBUF (1)
|
||||
#define MICROPY_VFS (1)
|
||||
#define MICROPY_VFS_LFS2 (1)
|
||||
#define MICROPY_VFS_FAT (1)
|
||||
|
||||
// fatfs configuration
|
||||
#define MICROPY_FATFS_ENABLE_LFN (1)
|
||||
#define MICROPY_FATFS_LFN_CODE_PAGE 437 /* 1=SFN/ANSI 437=LFN/U.S.(OEM) */
|
||||
#define MICROPY_FATFS_RPATH (2)
|
||||
|
||||
// Use VfsLfs2's types for fileio/textio
|
||||
#define mp_type_fileio mp_type_vfs_lfs2_fileio
|
||||
|
Loading…
x
Reference in New Issue
Block a user