SDFileSystem

Dependencies:   FATFileSystem

Dependents:   1kbftp_final trial fft_merge_main_codev1_FTPGTET delete_file ... more

Fork of SDFileSystem by Mbed

Files at this revision

API Documentation at this revision

Comitter:
lalitkumar
Date:
Sun Jun 28 06:05:09 2015 +0000
Parent:
3:7b35d1709458
Commit message:
disk_initialize modified to prevent hang incase of missing sd card

Changed in this revision

SDFileSystem.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 7b35d1709458 -r ddd0ac1e8bf0 SDFileSystem.cpp
--- a/SDFileSystem.cpp	Mon Mar 17 14:34:01 2014 +0000
+++ b/SDFileSystem.cpp	Sun Jun 28 06:05:09 2015 +0000
@@ -199,14 +199,14 @@
 int SDFileSystem::disk_initialize() {
     int i = initialise_card();
     debug_if(SD_DBG, "init card = %d\n", i);
-    _sectors = _sd_sectors();
-    
+    if(i) _sectors = _sd_sectors();
+    else return 1;
+    //debug("stage 3\r\n");
     // Set block length to 512 (CMD16)
     if (_cmd(16, 512) != 0) {
         debug("Set 512-byte block timed out\n");
         return 1;
     }
-    
     _spi.frequency(1000000); // Set to 1MHz for data transfer
     return 0;
 }