Add exFAT support (#150)
## Summary * Swap to updated SDCardManager which uses SdFat * Add exFAT support * Swap to using FsFile everywhere * Use newly exposed `SdMan` macro to get to static instance of SDCardManager * Move a bunch of FsHelpers up to SDCardManager
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
#pragma once
|
||||
#include <FS.h>
|
||||
#include <SdFat.h>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
@@ -10,7 +10,7 @@ static void writePod(std::ostream& os, const T& value) {
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
static void writePod(File& file, const T& value) {
|
||||
static void writePod(FsFile& file, const T& value) {
|
||||
file.write(reinterpret_cast<const uint8_t*>(&value), sizeof(T));
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ static void readPod(std::istream& is, T& value) {
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
static void readPod(File& file, T& value) {
|
||||
static void readPod(FsFile& file, T& value) {
|
||||
file.read(reinterpret_cast<uint8_t*>(&value), sizeof(T));
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ static void writeString(std::ostream& os, const std::string& s) {
|
||||
os.write(s.data(), len);
|
||||
}
|
||||
|
||||
static void writeString(File& file, const std::string& s) {
|
||||
static void writeString(FsFile& file, const std::string& s) {
|
||||
const uint32_t len = s.size();
|
||||
writePod(file, len);
|
||||
file.write(reinterpret_cast<const uint8_t*>(s.data()), len);
|
||||
@@ -43,10 +43,10 @@ static void readString(std::istream& is, std::string& s) {
|
||||
is.read(&s[0], len);
|
||||
}
|
||||
|
||||
static void readString(File& file, std::string& s) {
|
||||
static void readString(FsFile& file, std::string& s) {
|
||||
uint32_t len;
|
||||
readPod(file, len);
|
||||
s.resize(len);
|
||||
file.read(reinterpret_cast<uint8_t*>(&s[0]), len);
|
||||
file.read(&s[0], len);
|
||||
}
|
||||
} // namespace serialization
|
||||
|
||||
Reference in New Issue
Block a user