Skip to content

Commit f84b1a5

Browse files
Add ifndef brackets around configuration settings
To allow users to override the library settings at compile time with platform.txt options, bracked the configuration #defines with #ifndef.
1 parent 05fd2c8 commit f84b1a5

File tree

1 file changed

+30
-10
lines changed

1 file changed

+30
-10
lines changed

src/SdFatConfig.h

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@
3838
* Set INCLUDE_SDIOS nonzero to include sdios.h in SdFat.h.
3939
* sdios.h provides C++ style IO Streams.
4040
*/
41-
#define INCLUDE_SDIOS 1
41+
#ifndef INCLUDE_SDIOS
42+
#define INCLUDE_SDIOS 0
43+
#endif
4244

4345
//------------------------------------------------------------------------------
4446
/**
@@ -59,7 +61,9 @@
5961
* * (asterisk)
6062
*
6163
*/
62-
#define USE_LONG_FILE_NAMES 1
64+
#ifndef USE_LONG_FILE_NAMES
65+
#define USE_LONG_FILE_NAMES 1
66+
#endif
6367
//------------------------------------------------------------------------------
6468
/**
6569
* If the symbol ENABLE_EXTENDED_TRANSFER_CLASS is nonzero, the class SdFatEX
@@ -69,7 +73,9 @@
6973
* These classes used extended multi-block SD I/O for better performance.
7074
* the SPI bus may not be shared with other devices in this mode.
7175
*/
72-
#define ENABLE_EXTENDED_TRANSFER_CLASS 0
76+
#ifndef ENABLE_EXTENDED_TRANSFER_CLASS
77+
#define ENABLE_EXTENDED_TRANSFER_CLASS 0
78+
#endif
7379
//------------------------------------------------------------------------------
7480
/**
7581
* If the symbol USE_STANDARD_SPI_LIBRARY is zero, an optimized custom SPI
@@ -78,14 +84,18 @@
7884
* USE_STANDARD_SPI_LIBRARY is two, the SPI port can be selected with the
7985
* constructors SdFat(SPIClass* spiPort) and SdFatEX(SPIClass* spiPort).
8086
*/
81-
#define USE_STANDARD_SPI_LIBRARY 0
87+
#ifndef USE_STANDARD_SPI_LIBRARY
88+
#define USE_STANDARD_SPI_LIBRARY 0
89+
#endif
8290
//------------------------------------------------------------------------------
8391
/**
8492
* If the symbol ENABLE_SOFTWARE_SPI_CLASS is nonzero, the class SdFatSoftSpi
8593
* will be defined. If ENABLE_EXTENDED_TRANSFER_CLASS is also nonzero,
8694
* the class SdFatSoftSpiEX will be defined.
8795
*/
88-
#define ENABLE_SOFTWARE_SPI_CLASS 0
96+
#ifndef ENABLE_SOFTWARE_SPI_CLASS
97+
#define ENABLE_SOFTWARE_SPI_CLASS 0
98+
#endif
8999
//------------------------------------------------------------------------------
90100
/** If the symbol USE_FCNTL_H is nonzero, open flags for access modes O_RDONLY,
91101
* O_WRONLY, O_RDWR and the open modifiers O_APPEND, O_CREAT, O_EXCL, O_SYNC
@@ -112,14 +122,18 @@
112122
* Some cards will not sleep in low power mode unless CHECK_FLASH_PROGRAMMING
113123
* is non-zero.
114124
*/
115-
#define CHECK_FLASH_PROGRAMMING 1
125+
#ifndef CHECK_FLASH_PROGRAMMING
126+
#define CHECK_FLASH_PROGRAMMING 1
127+
#endif
116128
//------------------------------------------------------------------------------
117129
/**
118130
* Set MAINTAIN_FREE_CLUSTER_COUNT nonzero to keep the count of free clusters
119131
* updated. This will increase the speed of the freeClusterCount() call
120132
* after the first call. Extra flash will be required.
121133
*/
122-
#define MAINTAIN_FREE_CLUSTER_COUNT 0
134+
#ifndef MAINTAIN_FREE_CLUSTER_COUNT
135+
#define MAINTAIN_FREE_CLUSTER_COUNT 0
136+
#endif
123137
//------------------------------------------------------------------------------
124138
/**
125139
* To enable SD card CRC checking set USE_SD_CRC nonzero.
@@ -130,7 +144,9 @@
130144
* Set USE_SD_CRC to 2 to used a larger table driven CRC-CCITT function. This
131145
* function is faster for AVR but may be slower for ARM and other processors.
132146
*/
133-
#define USE_SD_CRC 0
147+
#ifndef USE_SD_CRC
148+
#define USE_SD_CRC 0
149+
#endif
134150
//------------------------------------------------------------------------------
135151
/**
136152
* Handle Watchdog Timer for WiFi modules.
@@ -156,7 +172,9 @@
156172
*
157173
* Causes use of lots of heap in ARM.
158174
*/
159-
#define DESTRUCTOR_CLOSES_FILE 0
175+
#ifndef DESTRUCTOR_CLOSES_FILE
176+
#define DESTRUCTOR_CLOSES_FILE 0
177+
#endif
160178
//------------------------------------------------------------------------------
161179
/**
162180
* Call flush for endl if ENDL_CALLS_FLUSH is nonzero
@@ -175,7 +193,9 @@
175193
* If ENDL_CALLS_FLUSH is zero, you must call flush and/or close to force
176194
* all data to be written to the SD.
177195
*/
178-
#define ENDL_CALLS_FLUSH 0
196+
#ifndef ENDL_CALLS_FLUSH
197+
#define ENDL_CALLS_FLUSH 0
198+
#endif
179199
//------------------------------------------------------------------------------
180200
/**
181201
* Set USE_SEPARATE_FAT_CACHE nonzero to use a second 512 byte cache

0 commit comments

Comments
 (0)