17#ifndef COMPILE_VIDEO_STREAM
20#define COMPILE_VIDEO_STREAM 0
22#define COMPILE_VIDEO_STREAM 1
26#if COMPILE_VIDEO_STREAM
40#define LED_TYPE WS2811
41#define COLOR_ORDER GRB
43#define MATRIX_WIDTH 22
44#define MATRIX_HEIGHT 22
45#define NUM_LEDS (MATRIX_WIDTH * MATRIX_HEIGHT)
49const int BYTES_PER_FRAME = 3 *
NUM_LEDS;
50const int NUM_FRAMES = 2;
51const uint32_t BUFFER_SIZE = BYTES_PER_FRAME * NUM_FRAMES;
53ByteStreamMemoryPtr memoryStream;
59void write_one_frame(ByteStreamMemoryPtr memoryStream) {
61 uint32_t total_bytes_written = 0;
62 bool toggle = (millis() / 500) % 2 == 0;
64 for (uint32_t i = 0; i <
NUM_LEDS; ++i) {
66 size_t bytes_written = memoryStream->writeCRGB(&color, 1);
67 if (bytes_written != 1) {
68 FASTLED_DBG(
"Failed to write frame data, wrote " << bytes_written <<
" bytes");
71 total_bytes_written += bytes_written;
73 if (total_bytes_written) {
74 FASTLED_DBG(
"Frame written, total bytes: " << total_bytes_written);
88 video.beginStream(memoryStream);
95 write_one_frame(memoryStream);
XYMap xymap(WIDTH, HEIGHT, SERPENTINE)
FL_DISABLE_WARNING_PUSH FL_DISABLE_WARNING_GLOBAL_CONSTRUCTORS CFastLED FastLED
Global LED strip management instance.
central include file for FastLED, defines the CFastLED class/object
Manages and renders multiple visual effects (Fx) for LED strips.
fl::unique_ptr< FxEngine > fxEngine
@ TypicalLEDStrip
Typical values for SMD5050 LEDs.
#define EVERY_N_MILLISECONDS(N)
Alias for EVERY_N_MILLIS.
shared_ptr< T > make_shared(Args &&... args)
@ Black
<div style='background:#000000;width:4em;height:4em;'></div>
Representation of an RGB pixel (Red, Green, Blue)