f
Fork of SDFileSystem by
Diff: SDFileSystem.cpp
- Revision:
- 3:44b82d302743
- Parent:
- 2:c8f66dc765d4
diff -r c8f66dc765d4 -r 44b82d302743 SDFileSystem.cpp --- a/SDFileSystem.cpp Thu Nov 29 10:56:21 2012 +0000 +++ b/SDFileSystem.cpp Wed Mar 26 18:18:45 2014 +0000 @@ -119,8 +119,8 @@ #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; } @@ -240,6 +240,17 @@ int SDFileSystem::disk_sync() { return 0; } uint64_t SDFileSystem::disk_sectors() { return _sectors; } +bool SDFileSystem::sd_inserted() { + DigitalIn SDcard_detect(p9); + SDcard_detect.mode(PullUp); + wait(0.1); + if(SDcard_detect==1) { + return true; + } + else { + return false; + } +} // PRIVATE FUNCTIONS int SDFileSystem::_cmd(int cmd, int arg) {