Skip to content

Commit 41d370f

Browse files
ficetoficeto
authored andcommitted
Add option to select SPI speed at SD::begin
1 parent 3394d57 commit 41d370f

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

libraries/SD/src/SD.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -332,15 +332,15 @@ boolean callback_rmdir(SdFile& parentDir, char *filePathComponent,
332332

333333

334334

335-
boolean SDClass::begin(uint8_t csPin) {
335+
boolean SDClass::begin(uint8_t csPin, uint32_t speed) {
336336
/*
337337
338338
Performs the initialisation required by the sdfatlib library.
339339
340340
Return true if initialization succeeds, false otherwise.
341341
342342
*/
343-
return card.init(SPI_HALF_SPEED, csPin) &&
343+
return card.init(speed, csPin) &&
344344
volume.init(card) &&
345345
root.openRoot(volume);
346346
}

libraries/SD/src/SD.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class SDClass {
6565
public:
6666
// This needs to be called to set up the connection to the SD card
6767
// before other methods are used.
68-
boolean begin(uint8_t csPin = SD_CHIP_SELECT_PIN);
68+
boolean begin(uint8_t csPin = SD_CHIP_SELECT_PIN, uint32_t speed = SPI_HALF_SPEED);
6969

7070
// Open the specified file/directory with the supplied mode (e.g. read or
7171
// write, etc). Returns a File object for interacting with the file.

0 commit comments

Comments
 (0)