1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-16 11:21:18 +03:00

Using sdfatlib CS pin defaults. SD.begin() returns success or failure.

This commit is contained in:
David A. Mellis
2010-11-20 13:50:45 -05:00
parent 6f0ea10600
commit d05a57af19
4 changed files with 16 additions and 15 deletions

View File

@ -319,21 +319,17 @@ boolean callback_remove(SdFile& parentDir, char *filePathComponent,
void SDClass::begin(uint8_t csPin) {
boolean SDClass::begin(uint8_t csPin) {
/*
Performs the initialisation required by the sdfatlib library.
Does not return if initialisation fails.
Return true if initialization succeeds, false otherwise.
*/
// TODO: Allow chip select pin to be supplied?
if (!(card.init(SPI_HALF_SPEED, csPin)
&& volume.init(card) && root.openRoot(volume))) {
while (true) {
// Bail
}
}
return card.init(SPI_HALF_SPEED, csPin) &&
volume.init(card) &&
root.openRoot(volume);
}