Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 528c071

Browse filesBrowse files
authored
Adding sectorsize() and numSectors() to SD (#6457)
* Update SD.h * Added numSectors() and sectorSize()
1 parent 7b89b39 commit 528c071
Copy full SHA for 528c071

File tree

Expand file treeCollapse file tree

2 files changed

+18
-0
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+18
-0
lines changed

‎libraries/SD/src/SD.cpp

Copy file name to clipboardExpand all lines: libraries/SD/src/SD.cpp
+16Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,22 @@ uint64_t SDFS::cardSize()
7575
return (uint64_t)sectors * sectorSize;
7676
}
7777

78+
size_t SDFS::numSectors()
79+
{
80+
if(_pdrv == 0xFF) {
81+
return 0;
82+
}
83+
return sdcard_num_sectors(_pdrv);
84+
}
85+
86+
size_t SDFS::sectorSize()
87+
{
88+
if(_pdrv == 0xFF) {
89+
return 0;
90+
}
91+
return sdcard_sector_size(_pdrv);
92+
}
93+
7894
uint64_t SDFS::totalBytes()
7995
{
8096
FATFS* fsinfo;

‎libraries/SD/src/SD.h

Copy file name to clipboardExpand all lines: libraries/SD/src/SD.h
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ class SDFS : public FS
3232
void end();
3333
sdcard_type_t cardType();
3434
uint64_t cardSize();
35+
size_t numSectors();
36+
size_t sectorSize();
3537
uint64_t totalBytes();
3638
uint64_t usedBytes();
3739
bool readRAW(uint8_t* buffer, uint32_t sector);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.