You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
5 年之前
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. ### Warning: This is an early beta version of SdFat Version 2.
  2. September 19, 2019 - added support for Teensy 4.0 SDIO.
  3. This library is in early development and features may change.
  4. It will clearly have bugs. I am posting this version to get comments and
  5. help finding bugs/compatibility problems.
  6. You can help by posting issues for problems you find. I am doing a great deal
  7. of testing but actual applications make the best test cases.
  8. SdFat Version 2 supports FAT16/FAT32 and exFAT SD cards. It is mostly
  9. backward compatible with SdFat Version 1 for FAT16/FAT32 cards.
  10. exFAT supports files larger than 4GB so files sizes and positions are
  11. type uint64_t for classes that support exFAT.
  12. exFAT has many features not available in FAT16/FAT32. exFAT has excellent
  13. support for contiguous files on flash devices and supports preallocation.
  14. If the SD card is the only SPI device, use dedicated SPI mode. This can
  15. greatly improve performance. See the bench example.
  16. Here is write performance for an old, 2011, card on a Due board.
  17. ```
  18. Shared SPI:
  19. write speed and latency
  20. speed,max,min,avg
  21. KB/Sec,usec,usec,usec
  22. 294.45,24944,1398,1737
  23. Dedicated SPI:
  24. write speed and latency
  25. speed,max,min,avg
  26. KB/Sec,usec,usec,usec
  27. 3965.11,16733,110,127
  28. ```
  29. The default version of SdFatConfig.h enables support for dedicated SPI and
  30. optimized access to contiguous files. This makes SdFat Version 2 slightly
  31. larger than Version 1. If these features are disabled, Version 2 is smaller
  32. than Version 1.
  33. The types for the classes SdFat and File are defined in SdFatConfig.h.
  34. The default version of SdFatConfig.h defines SdFat to only support FAT16/FAT32.
  35. SdFat and File are defined in terms of more basic classes by typedefs. You
  36. can use these basic classes in applications.
  37. Support for exFAT requires a substantial amount of flash. Here are sizes on
  38. an UNO for a simple program that opens a file, prints one line, and closes
  39. the file.
  40. ```
  41. FAT16/FAT32 only: 9780 bytes flash, 875 bytes SRAM.
  42. exFAT only: 13830 bytes flash, 938 bytes SRAM.
  43. FAT16/FAT32/exFAT: 19326 bytes flash, 928 bytes SRAM.
  44. ```
  45. The section below of SdFatConfig.h has been edited to uses FAT16/FAT32 for
  46. small AVR boards and FAT16/FAT32/exFAT for all other boards.
  47. ```
  48. /**
  49. * File types for SdFat, File, SdFile, SdBaseFile, fstream,
  50. * ifstream, and ofstream.
  51. *
  52. * Set SDFAT_FILE_TYPE to:
  53. *
  54. * 1 for FAT16/FAT32, 2 for exFAT, 3 for FAT16/FAT32 and exFAT.
  55. */
  56. #if defined(__AVR__) && FLASHEND < 0X8000
  57. // FAT16/FAT32 for 32K AVR boards.
  58. #define SDFAT_FILE_TYPE 1
  59. #else // defined(__AVR__) && FLASHEND < 0X8000
  60. // FAT16/FAT32 and exFAT for all other boards.
  61. #define SDFAT_FILE_TYPE 3
  62. #endif // defined(__AVR__) && FLASHEND < 0X8000
  63. ```
  64. The SdBaseFile class has no Arduino Stream or Print support.
  65. The File class is derived from Stream and SdBaseFile.
  66. The SdFile class is derived from SdBaseFile and Print.
  67. Please try the examples. Start with SdInfo, bench, and ExFatLogger.
  68. To use SdFat Version 2, unzip the download file, rename the library folder
  69. SdFat and place the SdFat folder into the libraries sub-folder in your main
  70. sketch folder.
  71. For more information see the Manual installation section of this guide:
  72. http://arduino.cc/en/Guide/Libraries
  73. A number of configuration options can be set by editing SdFatConfig.h
  74. define macros. See the html documentation File tab for details.
  75. Please read the html documentation for this library in SdFat/extras/SdFat.html.
  76. Start with the Main Page. Next go to the Classes tab and read the
  77. documentation for the classes SdFat32, SdExFat, SdFs, File32, ExFile, FsFile.
  78. The SdFat and File classes are defined in terms of the above classes by
  79. typedefs. Edit SdFatConfig.h to select class options.
  80. Please continue by reading the html documentation in the SdFat/extras folder.