Skip to content

Commit b31c790

Browse files
committed
added getCardType function to SDClass
1 parent 5d5730a commit b31c790

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

src/SD.cpp

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -371,14 +371,23 @@ namespace SDLib {
371371
372372
@return Returns the volume size in kB of the first volume/partition
373373
*/
374-
uint32_t SDClass::getvolumesize()
374+
uint32_t SDClass::getVolumeSize()
375375
{
376376
uint32_t volumesize = volume.blocksPerCluster(); // clusters are collections of blocks
377-
volumesize *= volume.clusterCount(); // we'll have a lot of clusters
378-
volumesize /= 2;
377+
volumesize *= volume.clusterCount(); // we'll have a lot of clusters
378+
volumesize /= 2;
379379
return (volumesize); //2 blocks make 1kB
380380
}
381-
381+
382+
/**
383+
Get card type
384+
@return 0:none, 1:SDv1, 2:SDv2, 3:SDHC
385+
*/
386+
uint8_t SDClass::getCardType()
387+
{
388+
return card.type();
389+
}
390+
382391
//call this when a card is removed. It will allow you to insert and initialise a new card.
383392
void SDClass::end() {
384393
root.close();

src/SD.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,10 @@ namespace SDLib {
106106
return rmdir(filepath.c_str());
107107
}
108108

109-
uint32_t getvolumesize();
109+
uint32_t getVolumeSize();
110110

111+
uint8_t getCardType();
112+
111113
private:
112114

113115
// This is used to determine the mode used to open a file

0 commit comments

Comments
 (0)