From 1c25d2432f6d2d30913fd6bff48dd3d6eb99b74c Mon Sep 17 00:00:00 2001 From: squelched Date: Sun, 26 Apr 2015 15:29:20 -0700 Subject: [PATCH] SD: allow multiple SD instances The SDClass class makes a reference to "SD.card" instead of just "card". SD is a global instance of SDClass. This prevents any other instance of SDClass from functioning correctly. The fix also allows SDClass to be used with an SD card which is removed and replaced, whereas previously, using the global instance SD did not allow this due to the limitation of begin() which cannot be called more than once. --- libraries/SD/src/SD.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/SD/src/SD.cpp b/libraries/SD/src/SD.cpp index 65d32741c..3bf79aca2 100644 --- a/libraries/SD/src/SD.cpp +++ b/libraries/SD/src/SD.cpp @@ -450,7 +450,7 @@ File SDClass::open(const char *filepath, uint8_t mode) { // there is a special case for the Root directory since its a static dir if (parentdir.isRoot()) { - if ( ! file.open(SD.root, filepath, mode)) { + if ( ! file.open(root, filepath, mode)) { // failed to open the file :( return File(); }