A re-written SDFileSystem library with improved compatibility, CRC support, and card removal/replacement support.
Fork of SDFileSystem by
Diff: SDFileSystem.cpp
- Revision:
- 16:dca379d55382
- Parent:
- 15:c9e938f6934f
--- a/SDFileSystem.cpp Mon Oct 27 17:02:05 2014 +0000 +++ b/SDFileSystem.cpp Mon Dec 29 15:26:39 2014 +0000 @@ -48,11 +48,14 @@ m_Cd.mode(PullUp); m_CdAssert = 0; m_Cd.rise(this, &SDFileSystem::onCardRemoval); - } else { + } else if (cdtype == SWITCH_NEG_NC) { m_Cd.mode(PullUp); m_CdAssert = 1; m_Cd.fall(this, &SDFileSystem::onCardRemoval); } + else { + m_CdAssert = -1; + } } SDFileSystem::CardType SDFileSystem::card_type() @@ -403,8 +406,8 @@ inline void SDFileSystem::checkSocket() { - //Check if a card is in the socket - if (m_Cd == m_CdAssert) { + //Check if a card is in the socket (or always asume it is when switch not used) + if (m_CdAssert == -1 || m_Cd == m_CdAssert) { //The socket is occupied, clear the STA_NODISK flag m_Status &= ~STA_NODISK; } else {