File tree 6 files changed +45
-10
lines changed
6 files changed +45
-10
lines changed Original file line number Diff line number Diff line change @@ -56,15 +56,26 @@ void setup() {
56
56
57
57
// Now we will try to open the 'volume'/'partition' - it should be FAT16 or FAT32
58
58
if (!fatFs.init ()) {
59
- Serial.println (" Could not find FAT16/FAT32 partition.\n Make sure you've formatted the card" );
59
+ Serial.println (" Could not find FAT partition.\n Make sure you've formatted the card" );
60
60
return ;
61
61
}
62
62
63
63
// print the type and size of the first FAT-type volume
64
64
uint64_t volumesize;
65
- Serial.print (" \n Volume type is FAT" );
66
- Serial.println (fatFs.fatType (), DEC);
67
- Serial.println ();
65
+ Serial.print (" \n Volume type is " );
66
+ uint8_t fatType = fatFs.fatType ();
67
+ #if defined(FAT_TYPE_EXFAT)
68
+ if (fatType == FAT_TYPE_EXFAT) {
69
+ Serial.println (" exFAT" );
70
+ } else
71
+ #endif
72
+ {
73
+ if (fatType != FAT_TYPE_UNK) {
74
+ Serial.printf (" FAT%u\n " , fatFs.fatType ());
75
+ } else {
76
+ Serial.println (" unknown" );
77
+ }
78
+ }
68
79
69
80
volumesize = fatFs.blocksPerCluster (); // clusters are collections of blocks
70
81
volumesize *= fatFs.clusterCount (); // we'll have a lot of clusters
Original file line number Diff line number Diff line change @@ -37,3 +37,8 @@ setDxDIR KEYWORD2
37
37
#######################################
38
38
FILE_READ LITERAL1
39
39
FILE_WRITE LITERAL1
40
+ FAT_TYPE_EXFAT LITERAL1
41
+ FAT_TYPE_FAT12 LITERAL1
42
+ FAT_TYPE_FAT16 LITERAL1
43
+ FAT_TYPE_FAT32 LITERAL1
44
+ FAT_TYPE_UNK LITERAL1
Original file line number Diff line number Diff line change @@ -66,14 +66,24 @@ bool SdFatFs::deinit(void)
66
66
67
67
uint8_t SdFatFs::fatType (void )
68
68
{
69
+ uint8_t fatType = FAT_TYPE_UNK;
69
70
switch (_SDFatFs.fs_type ) {
71
+ #if defined(FS_EXFAT)
72
+ case FS_EXFAT:
73
+ fatType = FAT_TYPE_EXFAT;
74
+ break ;
75
+ #endif
70
76
case FS_FAT12:
71
- return 12 ;
77
+ fatType = FAT_TYPE_FAT12;
78
+ break ;
72
79
case FS_FAT16:
73
- return 16 ;
80
+ fatType = FAT_TYPE_FAT16;
81
+ break ;
74
82
case FS_FAT32:
75
- return 32 ;
83
+ fatType = FAT_TYPE_FAT32;
84
+ break ;
76
85
default :
77
- return 0 ;
86
+ fatType = FAT_TYPE_UNK ;
78
87
}
88
+ return fatType;
79
89
}
Original file line number Diff line number Diff line change 42
42
/* FatFs includes component */
43
43
#include " FatFs.h"
44
44
45
+ /* Filesystem type (FATFS.fs_type) */
46
+ #define FAT_TYPE_FAT12 12 // FS_FAT12
47
+ #define FAT_TYPE_FAT16 16 // FS_FAT16
48
+ #define FAT_TYPE_FAT32 32 // FS_FAT32
49
+ #if defined(FS_EXFAT)
50
+ #define FAT_TYPE_EXFAT 64 // FS_EXFAT
51
+ #endif
52
+ #define FAT_TYPE_UNK 0 // Unknown
53
+
45
54
/* To match Arduino definition*/
46
55
#define FILE_WRITE FA_WRITE
47
56
#define FILE_READ FA_READ
Original file line number Diff line number Diff line change 230
230
/ buffer in the file system object (FATFS) is used for the file data transfer. */
231
231
232
232
233
- #define _FS_EXFAT 0
233
+ #define _FS_EXFAT 1
234
234
/* This option switches support of exFAT file system. (0:Disable or 1:Enable)
235
235
/ When enable exFAT, also LFN needs to be enabled. (_USE_LFN >= 1)
236
236
/ Note that enabling exFAT discards C89 compatibility. */
Original file line number Diff line number Diff line change 231
231
/ buffer in the filesystem object (FATFS) is used for the file data transfer. */
232
232
233
233
234
- #define FF_FS_EXFAT 0
234
+ #define FF_FS_EXFAT 1
235
235
/* This option switches support for exFAT filesystem. (0:Disable or 1:Enable)
236
236
/ To enable exFAT, also LFN needs to be enabled. (FF_USE_LFN >= 1)
237
237
/ Note that enabling exFAT discards ANSI C (C89) compatibility. */
You can’t perform that action at this time.
0 commit comments