Sfoglia il codice sorgente

Add usedSize() and totalSize()

main
PaulStoffregen 4 anni fa
parent
commit
9b52e7d639
1 ha cambiato i file con 8 aggiunte e 1 eliminazioni
  1. +8
    -1
      src/SD.h

+ 8
- 1
src/SD.h Vedi File

@@ -138,7 +138,7 @@ public:
return sdfs.mkdir(filepath);
}
bool rename(const char *oldfilepath, const char *newfilepath) {
return sdfs.remame(oldfilepath, newfilepath);
return sdfs.rename(oldfilepath, newfilepath);
}
bool remove(const char *filepath) {
return sdfs.remove(filepath);
@@ -146,6 +146,13 @@ public:
bool rmdir(const char *filepath) {
return sdfs.rmdir(filepath);
}
uint64_t usedSize() {
return (uint64_t)(sdfs.clusterCount() - sdfs.freeClusterCount())
* (uint64_t)sdfs.bytesPerCluster();
}
uint64_t totalSize() {
return (uint64_t)sdfs.clusterCount() * (uint64_t)sdfs.bytesPerCluster();
}
public: // allow access, so users can mix SD & SdFat APIs
SDFAT_BASE sdfs;
};

Loading…
Annulla
Salva