FastLED 3.10.6
Loading...
Searching...
No Matches
crgb_json.h File Reference

Detailed Description

JSON serialization helpers for CRGB pixel buffers.

The encoded schema is versioned so persisted data can be validated before it replaces a live pixel buffer:

{"version":1,"pixels":[[255,0,0],[0,255,0],[0,0,255]]}

These helpers convert pixels to and from fl::json. Choosing and operating a persistent store (LittleFS, SD, EEPROM, and so on) remains platform-specific.

Definition in file crgb_json.h.

#include "fl/gfx/crgb.h"
#include "fl/stl/json.h"
#include "fl/stl/optional.h"
#include "fl/stl/span.h"
+ Include dependency graph for crgb_json.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  fl
 Base definition for an LED controller.
 

Functions

bool fl::crgbFromJson (const json &document, span< CRGB > pixels) FL_NO_EXCEPT
 Decode a versioned JSON object into an existing CRGB pixel buffer.
 
optional< json > fl::crgbToJson (span< const CRGB > pixels) FL_NO_EXCEPT
 Encode a CRGB pixel buffer as a versioned JSON object.