8000 stmhal: FatFS configuration moved to the library folder. · matthewelse/micropython@748509a · GitHub
[go: up one dir, main page]

Skip to content

Commit 748509a

Browse files
Alex Marchdpgeorge
authored andcommitted
stmhal: FatFS configuration moved to the library folder.
Port specific settings defined in mpconfigport.
1 parent 3447230 commit 748509a

File tree

4 files changed

+17
-317
lines changed

4 files changed

+17
-317
lines changed

stmhal/diskio.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434

3535
#include "py/runtime.h"
3636
#include "lib/fatfs/ff.h" /* FatFs lower layer API */
37-
#include "lib/fatfs/diskio.h" /* FatFs lower layer API */
37+
#include "lib/fatfs/diskio.h" /* FatFs lower layer API */
3838
#include "rtc.h"
3939
#include "storage.h"
4040
#include "sdcard.h"
@@ -50,10 +50,6 @@ const PARTITION VolToPart[] = {
5050
*/
5151
};
5252

53-
/* Definitions of physical drive number for each media */
54-
#define PD_FLASH (0)
55-
#define PD_SDCARD (1)
56-
#define PD_USER (2)
5753

5854
/*-----------------------------------------------------------------------*/
5955
/* Initialize a Drive */

stmhal/ffconf.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@
2828

2929
#include "py/mpstate.h"
3030
#include "lib/fatfs/ff.h"
31-
#include "ffconf.h"
31+
#include "lib/fatfs/ffconf.h"
32+
#include "lib/fatfs/diskio.h"
3233
#include "fsusermount.h"
3334

3435
STATIC bool check_path(const TCHAR **path, const char *mount_point_str, mp_uint_t mount_point_len) {
@@ -60,21 +61,21 @@ int ff_get_ldnumber (const TCHAR **path) {
6061
}
6162

6263
if (check_path(path, "/flash", 6)) {
63-
return 0;
64+
return PD_FLASH;
6465
} else if (check_path(path, "/sd", 3)) {
65-
return 1;
66+
return PD_SDCARD;
6667
} else if (MP_STATE_PORT(fs_user_mount) != NULL && check_path(path, MP_STATE_PORT(fs_user_mount)->str, MP_STATE_PORT(fs_user_mount)->len)) {
67-
return 2;
68+
return PD_USER;
6869
} else {
6970
return -1;
7071
}
7172
}
7273

7374
void ff_get_volname(BYTE vol, TCHAR **dest) {
74-
if (vol == 0) {
75+
if (vol == PD_FLASH) {
7576
memcpy(*dest, "/flash", 6);
7677
*dest += 6;
77-
} else if (vol == 1) {
78+
} else if (vol == PD_SDCARD) {
7879
memcpy(*dest, "/sd", 3);
7980
*dest += 3;
8081
} else {

stmhal/ffconf.h

Lines changed: 0 additions & 298 deletions
This file was deleted.

stmhal/mpconfigport.h

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,15 @@
4646
#define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_FLOAT)
4747
#define MICROPY_OPT_COMPUTED_GOTO (1)
4848
#define MICROPY_OPT_CACHE_MAP_LOOKUP_IN_BYTECODE (0)
49-
/* Enable FatFS LFNs
50-
0: Disable LFN feature.
51-
1: Enable LFN with static working buffer on the BSS. Always NOT reentrant.
52-
2: Enable LFN with dynamic working buffer on the STACK.
53-
3: Enable LFN with dynamic working buffer on the HEAP.
54-
*/
55-
#define MICROPY_ENABLE_LFN (1)
56-
#define MICROPY_LFN_CODE_PAGE (437) /* 1=SFN/ANSI 437=LFN/U.S.(OEM) */
49+
50+
// fatfs configuration used in ffconf.h
51+
#define MICROPY_FATFS_ENABLE_LFN (1)
52+
#define MICROPY_FATFS_LFN_CODE_PAGE (437) /* 1=SFN/ANSI 437=LFN/U.S.(OEM) */
53+
#define MICROPY_FATFS_USE_LABEL (1)
54+
#define MICROPY_FATFS_RPATH (2)
55+
#define MICROPY_FATFS_VOLUMES (3)
56+
#define MICROPY_FATFS_MULTI_PARTITION (1)
57+
5758
#define MICROPY_STREAMS_NON_BLOCK (1)
5859
#define MICROPY_MODULE_WEAK_LINKS (1)
5960
#define MICROPY_CAN_OVERRIDE_BUILTINS (1)

0 commit comments

Comments
 (0)
0