Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

10 роки тому
10 роки тому
10 роки тому
10 роки тому
10 роки тому
10 роки тому
10 роки тому
10 роки тому
10 роки тому
10 роки тому
10 роки тому
10 роки тому
10 роки тому
10 роки тому
10 роки тому
10 роки тому
10 роки тому
10 роки тому
10 роки тому
10 роки тому
10 роки тому
10 роки тому
10 роки тому
10 роки тому
10 роки тому
10 роки тому
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  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. * Set ARDUINO_FILE_USES_STREAM nonzero to use Stream as the base class
  53. * for the Arduino File class. If ARDUINO_FILE_USES_STREAM is zero, Print
  54. * will be used as the base class for the Arduino File class.
  55. *
  56. * You can save some flash if you do not use Stream input functions such as
  57. * find(), findUntil(), readBytesUntil(), readString(), readStringUntil(),
  58. * parseInt(), and parseFloat().
  59. */
  60. #define ARDUINO_FILE_USES_STREAM 1
  61. //------------------------------------------------------------------------------
  62. /**
  63. * The symbol SD_SPI_CONFIGURATION defines SPI access to the SD card.
  64. *
  65. * IF SD_SPI_CONFIGUTATION is define to be zero, only the SdFat class
  66. * is define and SdFat uses a fast custom SPI implementation.
  67. *
  68. * If SD_SPI_CONFIGURATION is define to be one, only the SdFat class is
  69. * define and SdFat uses the standard Arduino SD.h library.
  70. *
  71. * If SD_SPI_CONFIGURATION is define to be two, only the SdFat class is
  72. * define and SdFat uses software SPI on the pins defined below.
  73. *
  74. * If SD_SPI_CONFIGURATION is define to be three, the three classes, SdFat,
  75. * SdFatLibSpi, and SdFatSoftSpi are defined. SdFat uses the fast
  76. * custom SPI implementation. SdFatLibSpi uses the standard Arduino SPI
  77. * library. SdFatSoftSpi is a template class that uses Software SPI. The
  78. * template parameters define the software SPI pins. See the ThreeCard
  79. * example for simultaneous use of all three classes.
  80. */
  81. #define SD_SPI_CONFIGURATION 0
  82. //------------------------------------------------------------------------------
  83. /**
  84. * If SD_SPI_CONFIGURATION is defined to be two, these definitions
  85. * will define the pins used for software SPI.
  86. *
  87. * The default definition allows Uno shields to be used on other boards.
  88. */
  89. /** Software SPI Master Out Slave In pin */
  90. uint8_t const SOFT_SPI_MOSI_PIN = 11;
  91. /** Software SPI Master In Slave Out pin */
  92. uint8_t const SOFT_SPI_MISO_PIN = 12;
  93. /** Software SPI Clock pin */
  94. uint8_t const SOFT_SPI_SCK_PIN = 13;
  95. //------------------------------------------------------------------------------
  96. /**
  97. * To enable SD card CRC checking set USE_SD_CRC nonzero.
  98. *
  99. * Set USE_SD_CRC to 1 to use a smaller slower CRC-CCITT function.
  100. *
  101. * Set USE_SD_CRC to 2 to used a larger faster table driven CRC-CCITT function.
  102. */
  103. #define USE_SD_CRC 0
  104. //------------------------------------------------------------------------------
  105. /**
  106. * Set ENABLE_SPI_TRANSACTION nonzero to enable the SPI transaction feature
  107. * of the standard Arduino SPI library. You must include SPI.h in your
  108. * programs when ENABLE_SPI_TRANSACTION is nonzero.
  109. */
  110. #define ENABLE_SPI_TRANSACTION 0
  111. //------------------------------------------------------------------------------
  112. /**
  113. * Set ENABLE_SPI_YIELD nonzero to enable release of the SPI bus during
  114. * SD card busy waits.
  115. *
  116. * This will allow interrupt routines to access the SPI bus if
  117. * ENABLE_SPI_TRANSACTION is nonzero.
  118. *
  119. * Setting ENABLE_SPI_YIELD will introduce some extra overhead and will
  120. * slightly slow transfer rates. A few older SD cards may fail when
  121. * ENABLE_SPI_YIELD is nonzero.
  122. */
  123. #define ENABLE_SPI_YIELD 0
  124. //------------------------------------------------------------------------------
  125. /**
  126. * Set FAT12_SUPPORT nonzero to enable use if FAT12 volumes.
  127. * FAT12 has not been well tested and requires additional flash.
  128. */
  129. #define FAT12_SUPPORT 0
  130. //------------------------------------------------------------------------------
  131. /**
  132. * Set DESTRUCTOR_CLOSES_FILE nonzero to close a file in its destructor.
  133. *
  134. * Causes use of lots of heap in ARM.
  135. */
  136. #define DESTRUCTOR_CLOSES_FILE 0
  137. //------------------------------------------------------------------------------
  138. /**
  139. * Call flush for endl if ENDL_CALLS_FLUSH is nonzero
  140. *
  141. * The standard for iostreams is to call flush. This is very costly for
  142. * SdFat. Each call to flush causes 2048 bytes of I/O to the SD.
  143. *
  144. * SdFat has a single 512 byte buffer for SD I/O so it must write the current
  145. * data block to the SD, read the directory block from the SD, update the
  146. * directory entry, write the directory block to the SD and read the data
  147. * block back into the buffer.
  148. *
  149. * The SD flash memory controller is not designed for this many rewrites
  150. * so performance may be reduced by more than a factor of 100.
  151. *
  152. * If ENDL_CALLS_FLUSH is zero, you must call flush and/or close to force
  153. * all data to be written to the SD.
  154. */
  155. #define ENDL_CALLS_FLUSH 0
  156. //------------------------------------------------------------------------------
  157. /**
  158. * SPI SCK divisor for SD initialization commands.
  159. * or greater
  160. */
  161. #ifdef __AVR__
  162. const uint8_t SPI_SCK_INIT_DIVISOR = 64;
  163. #else
  164. const uint8_t SPI_SCK_INIT_DIVISOR = 128;
  165. #endif
  166. //------------------------------------------------------------------------------
  167. /**
  168. * Set USE_SEPARATE_FAT_CACHE nonzero to use a second 512 byte cache
  169. * for FAT table entries. This improves performance for large writes
  170. * that are not a multiple of 512 bytes.
  171. */
  172. #ifdef __arm__
  173. #define USE_SEPARATE_FAT_CACHE 1
  174. #else // __arm__
  175. #define USE_SEPARATE_FAT_CACHE 0
  176. #endif // __arm__
  177. //------------------------------------------------------------------------------
  178. /**
  179. * Set USE_MULTI_BLOCK_IO nonzero to use multi-block SD read/write.
  180. *
  181. * Don't use mult-block read/write on small AVR boards.
  182. */
  183. #if defined(RAMEND) && RAMEND < 3000
  184. #define USE_MULTI_BLOCK_IO 0
  185. #else // RAMEND
  186. #define USE_MULTI_BLOCK_IO 1
  187. #endif // RAMEND
  188. #endif // SdFatConfig_h