File tree 2 files changed +14
-0
lines changed
2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -350,6 +350,17 @@ boolean SDClass::begin(uint8_t csPin, uint32_t speed) {
350
350
root.openRoot (volume);
351
351
}
352
352
353
+ // Ends SD card connection
354
+ void SDClass::end () {
355
+ if (card.errorCode () == 0 && root.isOpen ()) {
356
+ root.close ();
357
+ }
358
+
359
+ root = SdFile ();
360
+ volume = SdVolume ();
361
+ card = Sd2Card ();
362
+ }
363
+
353
364
// this little helper is used to traverse paths
354
365
SdFile SDClass::getParentDir (const char *filepath, int *index) {
355
366
// get parent directory
Original file line number Diff line number Diff line change @@ -89,6 +89,9 @@ class SDClass {
89
89
// before other methods are used.
90
90
boolean begin (uint8_t csPin = SD_CHIP_SELECT_PIN, uint32_t speed = SPI_HALF_SPEED);
91
91
92
+ // Ends SD card connection
93
+ void end ();
94
+
92
95
// Open the specified file/directory with the supplied mode (e.g. read or
93
96
// write, etc). Returns a File object for interacting with the file.
94
97
// Note that currently only one file can be open at a time.
You can’t perform that action at this time.
0 commit comments