for alarm program

Dependencies:   FATFileSystem

Fork of SDFileSystem by mbed official

Revision:
3:b8c141fd8e0e
Parent:
2:c8f66dc765d4
--- a/SDFileSystem.cpp	Thu Nov 29 10:56:21 2012 +0000
+++ b/SDFileSystem.cpp	Tue Dec 02 15:19:26 2014 +0000
@@ -119,9 +119,10 @@
 
 #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);
 }
 
 #define R1_IDLE_STATE           (1 << 0)
@@ -463,3 +464,15 @@
     };
     return blocks;
 }
+//creates SD card detect using cd
+bool SDFileSystem:: SD_inserted(){
+
+if ( _cd==1){
+    wait(0.1);
+    disk_initialize();
+return true;
+}
+else{
+return false;
+}
+}
\ No newline at end of file