7#include "platforms/wasm/fs_wasm.h"
8#elif __has_include(<SD.h>)
28 size_t size()
const override {
return 0; }
29 size_t read(uint8_t *dst,
size_t bytesToRead)
override {
34 size_t pos()
const override {
return 0; }
35 const char *
path()
const override {
36 return "NULL FILE HANDLE";
54 FASTLED_WARN(
"NullFileSystem instantiated as a placeholder, please implement a file system for your platform.");
58 bool begin()
override {
return true; }
59 void end()
override {}
61 void close(FileHandlePtr file)
override {
67 FileHandlePtr
openRead(
const char *_path)
override {
69 FileHandlePtr out = FileHandlePtr::TakeOwnership(
new NullFileHandle());
86 mFs = platform_filesystem;
118 *error =
"Failed to read file: ";
138 *error =
"Failed to read file: ";
157 Video video(pixelsPerFrame, fps, nFrameHistory);
158 FileHandlePtr file =
openRead(path);
160 video.setError(
fl::Str(
"Could not open file: ").append(path));
168 FileHandlePtr file =
openRead(path);
173 size_t size = file->size();
176 while (file->available()) {
178 size_t n = file->read(buf,
sizeof(buf));
180 out->
append((
const char*)buf, n);
184 FASTLED_DBG_IF(!wrote,
"Failed to write any data to the output string.");
virtual size_t size() const =0
virtual size_t bytesLeft() const
virtual size_t pos() const =0
FileHandlePtr openRead(const char *path)
Video openVideo(const char *path, size_t pixelsPerFrame, float fps=30.0f, size_t nFrameHistory=0)
bool readScreenMap(const char *path, const char *name, ScreenMap *out, Str *error=nullptr)
bool readScreenMaps(const char *path, FixedMap< Str, ScreenMap, 16 > *out, Str *error=nullptr)
bool readText(const char *path, Str *out)
bool readJson(const char *path, JsonDocument *doc)
bool begin(FsImplPtr platform_filesystem)
void close(FileHandlePtr file)
bool available() const override
size_t read(uint8_t *dst, size_t bytesToRead) override
const char * path() const override
size_t pos() const override
size_t size() const override
bool valid() const override
bool seek(size_t pos) override
~NullFileHandle() override
~NullFileSystem() override
void close(FileHandlePtr file) override
FileHandlePtr openRead(const char *_path) override
static bool ParseJson(const char *jsonStrScreenMap, FixedMap< Str, ScreenMap, 16 > *segmentMaps, Str *err=nullptr)
Str & append(const char *str)
const char * c_str() const
void reserve(size_t newCapacity)
#define FASTLED_DBG_IF(COND, MSG)
Implements the FastLED namespace macros.
bool parseJson(const char *json, fl::JsonDocument *doc, Str *_error)
FsImplPtr make_sdcard_filesystem(int cs_pin)
Implements a simple red square effect for 2D LED grids.
#define FASTLED_UNUSED(x)