Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

185 lines
6.7KB

  1. /* Arduino SdFat Library
  2. * Copyright (C) 2012 by William Greiman
  3. *
  4. * This file is part of the Arduino SdFat Library
  5. *
  6. * This Library is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This Library is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with the Arduino SdFat Library. If not, see
  18. * <http://www.gnu.org/licenses/>.
  19. */
  20. /**
  21. * \file
  22. * \brief configuration definitions
  23. */
  24. #ifndef SdFatConfig_h
  25. #define SdFatConfig_h
  26. #include <stdint.h>
  27. #ifdef __AVR__
  28. #include <avr/io.h>
  29. #endif // __AVR__
  30. //------------------------------------------------------------------------------
  31. /**
  32. * Set USE_LONG_FILE_NAMES nonzero to use long file names (LFN).
  33. * Long File Name are limited to a maximum length of 255 characters.
  34. *
  35. * This implementation allows 7-bit characters in the range
  36. * 0X20 to 0X7E except the following characters are not allowed:
  37. *
  38. * < (less than)
  39. * > (greater than)
  40. * : (colon)
  41. * " (double quote)
  42. * / (forward slash)
  43. * \ (backslash)
  44. * | (vertical bar or pipe)
  45. * ? (question mark)
  46. * * (asterisk)
  47. *
  48. */
  49. #define USE_LONG_FILE_NAMES 1
  50. //------------------------------------------------------------------------------
  51. /**
  52. * The symbol SD_SPI_CONFIGURATION defines SPI access to the SD card.
  53. *
  54. * IF SD_SPI_CONFIGUTATION is define to be zero, only the SdFat class
  55. * is define and SdFat uses a fast custom SPI implementation.
  56. *
  57. * If SD_SPI_CONFIGURATION is define to be one, only the SdFat class is
  58. * define and SdFat uses the standard Arduino SD.h library.
  59. *
  60. * If SD_SPI_CONFIGURATION is define to be two, only the SdFat class is
  61. * define and SdFat uses software SPI on the pins defined below.
  62. *
  63. * If SD_SPI_CONFIGURATION is define to be three, the three classes, SdFat,
  64. * SdFatLibSpi, and SdFatSoftSpi are defined. SdFat uses the fast
  65. * custom SPI implementation. SdFatLibSpi uses the standard Arduino SPI
  66. * library. SdFatSoftSpi is a template class that uses Software SPI. The
  67. * template parameters define the software SPI pins. See the ThreeCard
  68. * example for simultaneous use of all three classes.
  69. */
  70. #define SD_SPI_CONFIGURATION 0
  71. //------------------------------------------------------------------------------
  72. /**
  73. * If SD_SPI_CONFIGURATION is defined to be two, these definitions
  74. * will define the pins used for software SPI.
  75. *
  76. * The default definition allows Uno shields to be used on other boards.
  77. */
  78. /** Software SPI Master Out Slave In pin */
  79. uint8_t const SOFT_SPI_MOSI_PIN = 11;
  80. /** Software SPI Master In Slave Out pin */
  81. uint8_t const SOFT_SPI_MISO_PIN = 12;
  82. /** Software SPI Clock pin */
  83. uint8_t const SOFT_SPI_SCK_PIN = 13;
  84. //------------------------------------------------------------------------------
  85. /**
  86. * To enable SD card CRC checking set USE_SD_CRC nonzero.
  87. *
  88. * Set USE_SD_CRC to 1 to use a smaller slower CRC-CCITT function.
  89. *
  90. * Set USE_SD_CRC to 2 to used a larger faster table driven CRC-CCITT function.
  91. */
  92. #define USE_SD_CRC 0
  93. //------------------------------------------------------------------------------
  94. /**
  95. * Set ENABLE_SPI_TRANSACTION nonzero to enable the SPI transaction feature
  96. * of the standard Arduino SPI library. You must include SPI.h in your
  97. * programs when ENABLE_SPI_TRANSACTION is nonzero.
  98. */
  99. #define ENABLE_SPI_TRANSACTION 0
  100. //------------------------------------------------------------------------------
  101. /**
  102. * Set ENABLE_SPI_YIELD nonzero to enable release of the SPI bus during
  103. * SD card busy waits.
  104. *
  105. * This will allow interrupt routines to access the SPI bus if
  106. * ENABLE_SPI_TRANSACTION is nonzero.
  107. *
  108. * Setting ENABLE_SPI_YIELD will introduce some extra overhead and will
  109. * slightly slow transfer rates. A few older SD cards may fail when
  110. * ENABLE_SPI_YIELD is nonzero.
  111. */
  112. #define ENABLE_SPI_YIELD 0
  113. //------------------------------------------------------------------------------
  114. /**
  115. * Set FAT12_SUPPORT nonzero to enable use if FAT12 volumes.
  116. * FAT12 has not been well tested and requires additional flash.
  117. */
  118. #define FAT12_SUPPORT 0
  119. //------------------------------------------------------------------------------
  120. /**
  121. * Set DESTRUCTOR_CLOSES_FILE nonzero to close a file in its destructor.
  122. *
  123. * Causes use of lots of heap in ARM.
  124. */
  125. #define DESTRUCTOR_CLOSES_FILE 0
  126. //------------------------------------------------------------------------------
  127. /**
  128. * Call flush for endl if ENDL_CALLS_FLUSH is nonzero
  129. *
  130. * The standard for iostreams is to call flush. This is very costly for
  131. * SdFat. Each call to flush causes 2048 bytes of I/O to the SD.
  132. *
  133. * SdFat has a single 512 byte buffer for SD I/O so it must write the current
  134. * data block to the SD, read the directory block from the SD, update the
  135. * directory entry, write the directory block to the SD and read the data
  136. * block back into the buffer.
  137. *
  138. * The SD flash memory controller is not designed for this many rewrites
  139. * so performance may be reduced by more than a factor of 100.
  140. *
  141. * If ENDL_CALLS_FLUSH is zero, you must call flush and/or close to force
  142. * all data to be written to the SD.
  143. */
  144. #define ENDL_CALLS_FLUSH 0
  145. //------------------------------------------------------------------------------
  146. /**
  147. * Set SD_FILE_USES_STREAM nonzero to use Stream instead of Print for SdFile.
  148. * Using Stream will use more flash and may cause compatibility problems
  149. * with code written for older versions of SdFat.
  150. */
  151. #define SD_FILE_USES_STREAM 0
  152. //------------------------------------------------------------------------------
  153. /**
  154. * SPI SCK divisor for SD initialization commands.
  155. * or greater
  156. */
  157. #ifdef __AVR__
  158. const uint8_t SPI_SCK_INIT_DIVISOR = 64;
  159. #else
  160. const uint8_t SPI_SCK_INIT_DIVISOR = 128;
  161. #endif
  162. //------------------------------------------------------------------------------
  163. /**
  164. * Set USE_SEPARATE_FAT_CACHE nonzero to use a second 512 byte cache
  165. * for FAT table entries. This improves performance for large writes
  166. * that are not a multiple of 512 bytes.
  167. */
  168. #ifdef __arm__
  169. #define USE_SEPARATE_FAT_CACHE 1
  170. #else // __arm__
  171. #define USE_SEPARATE_FAT_CACHE 0
  172. #endif // __arm__
  173. //------------------------------------------------------------------------------
  174. /**
  175. * Set USE_MULTI_BLOCK_SD_IO nonzero to use multi-block SD read/write.
  176. *
  177. * Don't use mult-block read/write on small AVR boards.
  178. */
  179. #if defined(RAMEND) && RAMEND < 3000
  180. #define USE_MULTI_BLOCK_IO 0
  181. #else // RAMEND
  182. #define USE_MULTI_BLOCK_IO 1
  183. #endif // RAMEND
  184. #endif // SdFatConfig_h