-
-
Notifications
You must be signed in to change notification settings - Fork 532
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
eccbaae
commit 5b24257
Showing
8 changed files
with
123 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#include "SDInterface.h" | ||
|
||
bool SDInterface::initSD() { | ||
if (!SD.begin(SD_CS)) { | ||
Serial.println("Failed to mount SD Card"); | ||
this->supported = false; | ||
return false; | ||
} | ||
else { | ||
this->supported = true; | ||
this->cardType = SD.cardType(); | ||
if (cardType == CARD_MMC) | ||
Serial.println("SD: MMC Mounted"); | ||
else if(cardType == CARD_SD) | ||
Serial.println("SD: SDSC Mounted"); | ||
else if(cardType == CARD_SDHC) | ||
Serial.println("SD: SDHC Mounted"); | ||
else | ||
Serial.println("SD: UNKNOWN Card Mounted"); | ||
|
||
this->cardSizeBT = SD.cardSize(); | ||
this->cardSizeKB = SD.cardSize() / 1024; | ||
this->cardSizeMB = SD.cardSize() / (1024 * 1024); | ||
this->cardSizeGB = SD.cardSize() / (1024 * 1024 * 1024); | ||
|
||
Serial.printf("SD Card Size: %llu Bytes\n", this->cardSizeBT); | ||
Serial.printf("SD Card Size: %lluKB\n", this->cardSizeKB); | ||
Serial.printf("SD Card Size: %lluMB\n", this->cardSizeMB); | ||
Serial.printf("SD Card Size: %lluGB\n", this->cardSizeGB); | ||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#ifndef SDInterface_h | ||
#define SDInterface_h | ||
|
||
#include "SD.h" | ||
|
||
#define SD_CS 12 | ||
|
||
class SDInterface { | ||
|
||
private: | ||
|
||
public: | ||
uint8_t cardType; | ||
uint64_t cardSizeBT; | ||
uint64_t cardSizeKB; | ||
uint64_t cardSizeMB; | ||
uint64_t cardSizeGB; | ||
bool supported = false; | ||
|
||
bool initSD(); | ||
|
||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters