6#include "platforms/wasm/fs_wasm.h"
7#elif __has_include(<SD.h>)
25 size_t size()
const override {
return 0; }
26 size_t read(uint8_t *dst,
size_t bytesToRead)
override {
31 size_t pos()
const override {
return 0; }
32 const char *
path()
const override {
return "NULL FILE HANDLE"; }
49 FASTLED_WARN(
"NullFileSystem instantiated as a placeholder, please "
50 "implement a file system for your platform.");
54 bool begin()
override {
return true; }
55 void end()
override {}
57 void close(FileHandlePtr file)
override {
63 FileHandlePtr
openRead(
const char *_path)
override {
65 FileHandlePtr out = FileHandlePtr::TakeOwnership(
new NullFileHandle());
80 mFs = platform_filesystem;
112 *error =
"Failed to read file: ";
133 *error =
"Failed to read file: ";
151 return mFs->openRead(path);
154 size_t nFrameHistory) {
155 Video video(pixelsPerFrame, fps, nFrameHistory);
156 FileHandlePtr file =
openRead(path);
158 video.setError(
fl::Str(
"Could not open file: ").append(path));
166 FileHandlePtr file =
openRead(path);
171 size_t size = file->size();
174 while (file->available()) {
176 size_t n = file->read(buf,
sizeof(buf));
178 out->
append((
const char *)buf, n);
182 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 T &val)
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)