Skip to content

Add SDClass::end function #37

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 9, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/SD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,12 @@ boolean SDClass::begin(uint32_t clock, uint8_t csPin) {
root.openRoot(volume);
}

//call this when a card is removed. It will allow you to insert and initialise a new card.
void SDClass::end()
{
root.close();
}

// this little helper is used to traverse paths
SdFile SDClass::getParentDir(const char *filepath, int *index) {
// get parent directory
Expand Down
3 changes: 3 additions & 0 deletions src/SD.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ class SDClass {
boolean begin(uint8_t csPin = SD_CHIP_SELECT_PIN);
boolean begin(uint32_t clock, uint8_t csPin);

//call this when a card is removed. It will allow you to insert and initialise a new card.
void end();

// Open the specified file/directory with the supplied mode (e.g. read or
// write, etc). Returns a File object for interacting with the file.
// Note that currently only one file can be open at a time.
Expand Down