1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-13 13:01:55 +03:00

Add SD.end() method, including arg to leave SPI up (#5402)

* Add SD.end() method with endSPI flag as arg

* cleanup and fix a default arg

* Fix typo
This commit is contained in:
Develo
2018-11-30 18:25:47 -03:00
committed by GitHub
parent 92373a9837
commit 7f7e658d66
4 changed files with 50 additions and 0 deletions

View File

@ -350,6 +350,17 @@ boolean SDClass::begin(uint8_t csPin, uint32_t speed) {
root.openRoot(volume);
}
//Warning: see comment in SD.h about possible card corruption.
void SDClass::end(bool endSPI)
{
if(card.errorCode() == 0 && root.isOpen()) {
root.close(); //Warning: this calls sync(), see above comment about corruption.
}
card.end(endSPI);
}
// this little helper is used to traverse paths
SdFile SDClass::getParentDir(const char *filepath, int *index) {
// get parent directory