1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-02-19 13:54:23 +01:00

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.
This commit is contained in:
squelched 2015-04-26 15:29:20 -07:00 committed by Martino Facchin
parent b10417505f
commit 1c25d2432f

View File

@ -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();
}