Unverified Commit 528c0712 authored by tobozo's avatar tobozo Committed by GitHub

Adding sectorsize() and numSectors() to SD (#6457)

* Update SD.h

* Added numSectors() and sectorSize()
parent 7b89b39e
...@@ -75,6 +75,22 @@ uint64_t SDFS::cardSize() ...@@ -75,6 +75,22 @@ uint64_t SDFS::cardSize()
return (uint64_t)sectors * sectorSize; return (uint64_t)sectors * sectorSize;
} }
size_t SDFS::numSectors()
{
if(_pdrv == 0xFF) {
return 0;
}
return sdcard_num_sectors(_pdrv);
}
size_t SDFS::sectorSize()
{
if(_pdrv == 0xFF) {
return 0;
}
return sdcard_sector_size(_pdrv);
}
uint64_t SDFS::totalBytes() uint64_t SDFS::totalBytes()
{ {
FATFS* fsinfo; FATFS* fsinfo;
......
...@@ -32,6 +32,8 @@ public: ...@@ -32,6 +32,8 @@ public:
void end(); void end();
sdcard_type_t cardType(); sdcard_type_t cardType();
uint64_t cardSize(); uint64_t cardSize();
size_t numSectors();
size_t sectorSize();
uint64_t totalBytes(); uint64_t totalBytes();
uint64_t usedBytes(); uint64_t usedBytes();
bool readRAW(uint8_t* buffer, uint32_t sector); bool readRAW(uint8_t* buffer, uint32_t sector);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment