SDFileSystem edited to have CD

Dependencies:   FATFileSystem

Dependents:   SongPop

Fork of SDFileSystem by mbed official

Revision:
3:7526c2b13d28
Parent:
2:c8f66dc765d4
--- a/SDFileSystem.cpp	Thu Nov 29 10:56:21 2012 +0000
+++ b/SDFileSystem.cpp	Wed Mar 11 22:13:39 2015 +0000
@@ -119,9 +119,11 @@
 
 #define SD_DBG             0
 
-SDFileSystem::SDFileSystem(PinName mosi, PinName miso, PinName sclk, PinName cs, const char* name) :
-    FATFileSystem(name), _spi(mosi, miso, sclk), _cs(cs) {
+SDFileSystem::SDFileSystem(PinName mosi, PinName miso, PinName sclk, PinName cs, PinName cd, const char* name) :
+    FATFileSystem(name), _spi(mosi, miso, sclk), _cs(cs), _cd(cd) {
     _cs = 1;
+    _cd.mode(PullUp);
+    wait(.01);
 }
 
 #define R1_IDLE_STATE           (1 << 0)
@@ -462,4 +464,14 @@
             return 0;
     };
     return blocks;
+    
 }
+
+bool SDFileSystem::cdcheck()
+{
+if(_cd == 0)
+   { return false;
+   }
+return true;
+}
+        
\ No newline at end of file