8000 Moved "using namespac" + added volumesize function by Woutvstk · Pull Request #166 · arduino-libraries/SD · GitHub
[go: up one dir, main page]

Skip to content

Moved "using namespac" + added volumesize function #166

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
added function in SDClass to request card size
  • Loading branch information
Woutvstk committed Dec 16, 2024
commit a9739413913781eba7c63178bd54438d69d68e34
15 changes: 14 additions & 1 deletion src/SD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@

*/

#include "SD.h"
#include <SD.h>

namespace SDLib {

Expand Down Expand Up @@ -366,6 +366,19 @@ namespace SDLib {
root.openRoot(volume);
}

/**
Get information about the volume size

@return Returns the volume size in kB of the first volume/partition
*/
uint32_t SDClass::getvolumesize()
{
uint32_t volumesize = volume.blocksPerCluster(); // clusters are collections of blocks
volumesize *= volume.clusterCount(); // we'll have a lot of clusters
volumesize /= 2;
return (volumesize); //2 blocks make 1kB
}

//call this when a card is removed. It will allow you to insert and initialise a new card.
void SDClass::end() {
root.close();
Expand Down
2 changes: 2 additions & 0 deletions src/SD.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ namespace SDLib {
return rmdir(filepath.c_str());
}

uint32_t getvolumesize();

private:

// This is used to determine the mode used to open a file
Expand Down
0