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

10 лет назад
10 лет назад
10 лет назад
10 лет назад
10 лет назад
10 лет назад
10 лет назад
10 лет назад
10 лет назад
10 лет назад
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  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 SD_FILE_USES_STREAM nonzero to use Stream instead of Print for SdFile.
  33. * Using Stream will use more flash and may cause compatibility problems
  34. * with code written for older versions of SdFat.
  35. */
  36. #define SD_FILE_USES_STREAM 0
  37. //------------------------------------------------------------------------------
  38. /**
  39. * To enable SD card CRC checking set USE_SD_CRC nonzero.
  40. *
  41. * Set USE_SD_CRC to 1 to use a smaller slower CRC-CCITT function.
  42. *
  43. * Set USE_SD_CRC to 2 to used a larger faster table driven CRC-CCITT function.
  44. */
  45. #define USE_SD_CRC 0
  46. //------------------------------------------------------------------------------
  47. /**
  48. * To use multiple SD cards set USE_MULTIPLE_CARDS nonzero.
  49. *
  50. * Using multiple cards costs about 200 bytes of flash.
  51. *
  52. * Each card requires about 550 bytes of SRAM so use of a Mega is recommended.
  53. */
  54. #define USE_MULTIPLE_CARDS 0
  55. //------------------------------------------------------------------------------
  56. /**
  57. * Set DESTRUCTOR_CLOSES_FILE nonzero to close a file in its destructor.
  58. *
  59. * Causes use of lots of heap in ARM.
  60. */
  61. #define DESTRUCTOR_CLOSES_FILE 0
  62. //------------------------------------------------------------------------------
  63. /**
  64. * For AVR
  65. *
  66. * Set USE_SERIAL_FOR_STD_OUT nonzero to use Serial (the HardwareSerial class)
  67. * for error messages and output from print functions like ls().
  68. *
  69. * If USE_SERIAL_FOR_STD_OUT is zero, a small non-interrupt driven class
  70. * is used to output messages to serial port zero. This allows an alternate
  71. * Serial library like SerialPort to be used with SdFat.
  72. *
  73. * You can redirect stdOut with SdFat::setStdOut(Print* stream) and
  74. * get the current stream with SdFat::stdOut().
  75. */
  76. #define USE_SERIAL_FOR_STD_OUT 0
  77. //------------------------------------------------------------------------------
  78. /**
  79. * Set FAT12_SUPPORT nonzero to enable use if FAT12 volumes.
  80. * FAT12 has not been well tested and requires additional flash.
  81. */
  82. #define FAT12_SUPPORT 0
  83. //------------------------------------------------------------------------------
  84. /**
  85. * Set ENABLE_SPI_TRANSACTION nonzero to enable the SPI transaction feature
  86. * of the standard Arduino SPI library. You must include SPI.h in your
  87. * sketches when ENABLE_SPI_TRANSACTION is nonzero.
  88. */
  89. #define ENABLE_SPI_TRANSACTION 0
  90. //------------------------------------------------------------------------------
  91. /**
  92. * Set ENABLE_SPI_YIELD nonzero to enable release of the SPI bus during
  93. * SD card busy waits.
  94. *
  95. * This will allow interrupt routines to access the SPI bus if
  96. * ENABLE_SPI_TRANSACTION is nonzero.
  97. *
  98. * Setting ENABLE_SPI_YIELD will introduce some extra overhead and will
  99. * slightly slow transfer rates. A few older SD cards may fail when
  100. * ENABLE_SPI_YIELD is nonzero.
  101. */
  102. #define ENABLE_SPI_YIELD 0
  103. //------------------------------------------------------------------------------
  104. /**
  105. * Set USE_ARDUINO_SPI_LIBRARY nonzero to force use of Arduino Standard
  106. * SPI library. This will override native and software SPI for all boards.
  107. */
  108. #define USE_ARDUINO_SPI_LIBRARY 0
  109. //------------------------------------------------------------------------------
  110. /**
  111. * Set AVR_SOFT_SPI nonzero to use software SPI on all AVR Arduinos.
  112. */
  113. #define AVR_SOFT_SPI 0
  114. //------------------------------------------------------------------------------
  115. /**
  116. * Set DUE_SOFT_SPI nonzero to use software SPI on Due Arduinos.
  117. */
  118. #define DUE_SOFT_SPI 0
  119. //------------------------------------------------------------------------------
  120. /**
  121. * Set LEONARDO_SOFT_SPI nonzero to use software SPI on Leonardo Arduinos.
  122. * LEONARDO_SOFT_SPI allows an unmodified 328 Shield to be used
  123. * on Leonardo Arduinos.
  124. */
  125. #define LEONARDO_SOFT_SPI 0
  126. //------------------------------------------------------------------------------
  127. /**
  128. * Set MEGA_SOFT_SPI nonzero to use software SPI on Mega Arduinos.
  129. * MEGA_SOFT_SPI allows an unmodified 328 Shield to be used
  130. * on Mega Arduinos.
  131. */
  132. #define MEGA_SOFT_SPI 0
  133. //------------------------------------------------------------------------------
  134. /**
  135. * Set TEENSY3_SOFT_SPI nonzero to use software SPI on Teensy 3.x boards.
  136. */
  137. #define TEENSY3_SOFT_SPI 0
  138. //------------------------------------------------------------------------------
  139. /**
  140. * Define software SPI pins. Default allows Uno shields to be used on other
  141. * boards.
  142. */
  143. // define software SPI pins
  144. /** Default Software SPI chip select pin */
  145. uint8_t const SOFT_SPI_CS_PIN = 10;
  146. /** Software SPI Master Out Slave In pin */
  147. uint8_t const SOFT_SPI_MOSI_PIN = 11;
  148. /** Software SPI Master In Slave Out pin */
  149. uint8_t const SOFT_SPI_MISO_PIN = 12;
  150. /** Software SPI Clock pin */
  151. uint8_t const SOFT_SPI_SCK_PIN = 13;
  152. //------------------------------------------------------------------------------
  153. /**
  154. * Call flush for endl if ENDL_CALLS_FLUSH is nonzero
  155. *
  156. * The standard for iostreams is to call flush. This is very costly for
  157. * SdFat. Each call to flush causes 2048 bytes of I/O to the SD.
  158. *
  159. * SdFat has a single 512 byte buffer for SD I/O so it must write the current
  160. * data block to the SD, read the directory block from the SD, update the
  161. * directory entry, write the directory block to the SD and read the data
  162. * block back into the buffer.
  163. *
  164. * The SD flash memory controller is not designed for this many rewrites
  165. * so performance may be reduced by more than a factor of 100.
  166. *
  167. * If ENDL_CALLS_FLUSH is zero, you must call flush and/or close to force
  168. * all data to be written to the SD.
  169. */
  170. #define ENDL_CALLS_FLUSH 0
  171. //------------------------------------------------------------------------------
  172. /**
  173. * SPI SCK divisor for SD initialization commands.
  174. * or greater
  175. */
  176. #ifdef __AVR__
  177. const uint8_t SPI_SCK_INIT_DIVISOR = 64;
  178. #else
  179. const uint8_t SPI_SCK_INIT_DIVISOR = 128;
  180. #endif
  181. //------------------------------------------------------------------------------
  182. /**
  183. * Set USE_SEPARATE_FAT_CACHE nonzero to use a second 512 byte cache
  184. * for FAT table entries. Improves performance for large writes that
  185. * are not a multiple of 512 bytes.
  186. */
  187. #ifdef __arm__
  188. #define USE_SEPARATE_FAT_CACHE 1
  189. #else // __arm__
  190. #define USE_SEPARATE_FAT_CACHE 0
  191. #endif // __arm__
  192. //------------------------------------------------------------------------------
  193. /**
  194. * Set USE_MULTI_BLOCK_SD_IO nonzero to use multi-block SD read/write.
  195. *
  196. * Don't use mult-block read/write on small AVR boards.
  197. */
  198. #if defined(RAMEND) && RAMEND < 3000
  199. #define USE_MULTI_BLOCK_SD_IO 0
  200. #else // RAMEND
  201. #define USE_MULTI_BLOCK_SD_IO 1
  202. #endif // RAMEND
  203. #endif // SdFatConfig_h