From 41d370fb2870dbb363348e2da5f4969835473291 Mon Sep 17 00:00:00 2001 From: ficeto Date: Mon, 11 May 2015 22:29:02 +0300 Subject: [PATCH] Add option to select SPI speed at SD::begin --- libraries/SD/src/SD.cpp | 4 ++-- libraries/SD/src/SD.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libraries/SD/src/SD.cpp b/libraries/SD/src/SD.cpp index 65d32741c..1d42e3738 100644 --- a/libraries/SD/src/SD.cpp +++ b/libraries/SD/src/SD.cpp @@ -332,7 +332,7 @@ boolean callback_rmdir(SdFile& parentDir, char *filePathComponent, -boolean SDClass::begin(uint8_t csPin) { +boolean SDClass::begin(uint8_t csPin, uint32_t speed) { /* Performs the initialisation required by the sdfatlib library. @@ -340,7 +340,7 @@ boolean SDClass::begin(uint8_t csPin) { Return true if initialization succeeds, false otherwise. */ - return card.init(SPI_HALF_SPEED, csPin) && + return card.init(speed, csPin) && volume.init(card) && root.openRoot(volume); } diff --git a/libraries/SD/src/SD.h b/libraries/SD/src/SD.h index 7435cf577..6ba08b21b 100644 --- a/libraries/SD/src/SD.h +++ b/libraries/SD/src/SD.h @@ -65,7 +65,7 @@ private: public: // This needs to be called to set up the connection to the SD card // before other methods are used. - boolean begin(uint8_t csPin = SD_CHIP_SELECT_PIN); + boolean begin(uint8_t csPin = SD_CHIP_SELECT_PIN, uint32_t speed = SPI_HALF_SPEED); // Open the specified file/directory with the supplied mode (e.g. read or // write, etc). Returns a File object for interacting with the file.