Skip to content

Commit 4dbec4b

Browse files
committed
Major update to version 2.0.0
1 parent 7d0261d commit 4dbec4b

File tree

1,281 files changed

+97423
-83272
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,281 files changed

+97423
-83272
lines changed

LICENSE.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2011..2017 Bill Greiman
3+
Copyright (c) 2011..2020 Bill Greiman
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

+83-27
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,98 @@
1-
The Arduino SdFat library provides read/write access to FAT16/FAT32
2-
file systems on SD/SDHC flash cards.
1+
### Warning: This is SdFat Version 2.
32

4-
SdFat requires Arduino 1.6x or greater.
3+
Earlier releases of Version 1 are here:
54

6-
Key changes:
5+
https://github.com/greiman/SdFat/releases
76

8-
Support for multiple SPI ports now uses a pointer to a SPIClass object.
7+
SdFat Version 2 supports FAT16/FAT32 and exFAT SD cards. It is mostly
8+
backward compatible with SdFat Version 1 for FAT16/FAT32 cards.
99

10-
See the STM32Test example.
10+
exFAT supports files larger than 4GB so files sizes and positions are
11+
type uint64_t for classes that support exFAT.
12+
13+
exFAT has many features not available in FAT16/FAT32. exFAT has excellent
14+
support for contiguous files on flash devices and supports preallocation.
15+
16+
If the SD card is the only SPI device, use dedicated SPI mode. This can
17+
greatly improve performance. See the bench example.
18+
19+
Here is write performance for an old, 2011, card on a Due board.
20+
```
21+
Shared SPI:
22+
write speed and latency
23+
speed,max,min,avg
24+
KB/Sec,usec,usec,usec
25+
294.45,24944,1398,1737
26+
27+
Dedicated SPI:
28+
write speed and latency
29+
speed,max,min,avg
30+
KB/Sec,usec,usec,usec
31+
3965.11,16733,110,127
32+
```
33+
The default version of SdFatConfig.h enables support for dedicated SPI and
34+
optimized access to contiguous files. This makes SdFat Version 2 slightly
35+
larger than Version 1. If these features are disabled, Version 2 is smaller
36+
than Version 1.
37+
38+
The types for the classes SdFat and File are defined in SdFatConfig.h.
39+
The default version of SdFatConfig.h defines SdFat to only support FAT16/FAT32.
40+
SdFat and File are defined in terms of more basic classes by typedefs. You
41+
can use these basic classes in applications.
42+
43+
Support for exFAT requires a substantial amount of flash. Here are sizes on
44+
an UNO for a simple program that opens a file, prints one line, and closes
45+
the file.
46+
```
47+
FAT16/FAT32 only: 9780 bytes flash, 875 bytes SRAM.
48+
49+
exFAT only: 13830 bytes flash, 938 bytes SRAM.
50+
51+
FAT16/FAT32/exFAT: 19326 bytes flash, 928 bytes SRAM.
1152
```
12-
explicit SdFat(SPIClass* spiPort);
13-
\\ or
14-
explicit SdFatEX(SPIClass* spiPort);
53+
The section below of SdFatConfig.h has been edited to uses FAT16/FAT32 for
54+
small AVR boards and FAT16/FAT32/exFAT for all other boards.
1555
```
56+
/**
57+
* File types for SdFat, File, SdFile, SdBaseFile, fstream,
58+
* ifstream, and ofstream.
59+
*
60+
* Set SDFAT_FILE_TYPE to:
61+
*
62+
* 1 for FAT16/FAT32, 2 for exFAT, 3 for FAT16/FAT32 and exFAT.
63+
*/
64+
#if defined(__AVR__) && FLASHEND < 0X8000
65+
// FAT16/FAT32 for 32K AVR boards.
66+
#define SDFAT_FILE_TYPE 1
67+
#else // defined(__AVR__) && FLASHEND < 0X8000
68+
// FAT16/FAT32 and exFAT for all other boards.
69+
#define SDFAT_FILE_TYPE 3
70+
#endif // defined(__AVR__) && FLASHEND < 0X8000
71+
```
72+
The SdBaseFile class has no Arduino Stream or Print support.
73+
74+
The File class is derived from Stream and SdBaseFile.
1675

17-
Open flags now follow POSIX conventions. O_RDONLY is the same as O_READ and O_WRONLY is the
18-
same as O_WRITE. One and only one of of the mode flags, O_RDONLY, O_RDWR, or
19-
O_WRONLY is required.
20-
21-
Open flags for Particle Gen3 and ARM boards are now defined by fcntl.h.
22-
See SdFatConfig.h for options.
76+
The SdFile class is derived from SdBaseFile and Print.
2377

24-
Support for particle Gen3 devices.
78+
Please try the examples. Start with SdInfo, bench, and ExFatLogger.
2579

26-
New cluster allocation algorithm.
80+
To use SdFat Version 2, unzip the download file, rename the library folder
81+
SdFat and place the SdFat folder into the libraries sub-folder in your main
82+
sketch folder.
2783

28-
Please read changes.txt and the html documentation in the extras folder for more information.
84+
For more information see the Manual installation section of this guide:
2985

30-
Please report problems as issues.
86+
http://arduino.cc/en/Guide/Libraries
3187

3288
A number of configuration options can be set by editing SdFatConfig.h
33-
define macros. See the html documentation for details
89+
define macros. See the html documentation File tab for details.
90+
91+
Please read the html documentation for this library in SdFat/doc/SdFat.html.
92+
Start with the Main Page. Next go to the Classes tab and read the
93+
documentation for the classes SdFat32, SdExFat, SdFs, File32, ExFile, FsFile.
3494

35-
Please read the html documentation for this library. Start with
36-
html/index.html and read the Main Page. Next go to the Classes tab and
37-
read the documentation for the classes SdFat, SdFatEX, SdBaseFile,
38-
SdFile, File, StdioStream, ifstream, ofstream, and others.
39-
40-
Please continue by reading the html documentation in SdFat/extras/html
95+
The SdFat and File classes are defined in terms of the above classes by
96+
typedefs. Edit SdFatConfig.h to select class options.
4197

42-
Updated 28 Dec 2018
98+
Please continue by reading the html documentation in the SdFat/doc folder.

0 commit comments

Comments
 (0)