flip tile

Dependencies:   FATFileSystem

Fork of SDFileSystem by mbed official

Files at this revision

API Documentation at this revision

Comitter:
jsmith352
Date:
Thu Oct 22 15:25:57 2015 +0000
Parent:
2:c8f66dc765d4
Commit message:
10/22/2015

Changed in this revision

SDFileSystem.cpp Show annotated file Show diff for this revision Revisions of this file
SDFileSystem.h Show annotated file Show diff for this revision Revisions of this file
--- a/SDFileSystem.cpp	Thu Nov 29 10:56:21 2012 +0000
+++ b/SDFileSystem.cpp	Thu Oct 22 15:25:57 2015 +0000
@@ -240,6 +240,20 @@
 int SDFileSystem::disk_sync() { return 0; }
 uint64_t SDFileSystem::disk_sectors() { return _sectors; }
 
+//function to check if there is an SD card inserted
+bool SDFileSystem::SD_inserted()
+{
+    DigitalIn enable(p20);
+    enable.mode(PullUp);
+    
+    if(enable)
+        inserted = true; //returns true if inserted
+    else
+        inserted = false; //returns false otherwise
+        
+    return(inserted);
+}
+
 
 // PRIVATE FUNCTIONS
 int SDFileSystem::_cmd(int cmd, int arg) {
--- a/SDFileSystem.h	Thu Nov 29 10:56:21 2012 +0000
+++ b/SDFileSystem.h	Thu Oct 22 15:25:57 2015 +0000
@@ -58,6 +58,7 @@
     virtual int disk_write(const uint8_t * buffer, uint64_t block_number);
     virtual int disk_sync();
     virtual uint64_t disk_sectors();
+    bool SD_inserted(); //checks for an SD card
 
 protected:
 
@@ -77,6 +78,9 @@
     SPI _spi;
     DigitalOut _cs;
     int cdv;
+    
+    bool inserted;
+    
 };
 
 #endif