7#ifndef COMPILE_VIDEO_STREAM
10#define COMPILE_VIDEO_STREAM 0
12#define COMPILE_VIDEO_STREAM 1
16#if COMPILE_VIDEO_STREAM
20#include "fx/storage/bytestreammemory.h"
21#include "fx/2d/video.hpp"
22#include "fx/fx_engine.h"
28#define LED_TYPE WS2811
29#define COLOR_ORDER GRB
31#define MATRIX_WIDTH 22
32#define MATRIX_HEIGHT 22
33#define NUM_LEDS (MATRIX_WIDTH * MATRIX_HEIGHT)
37const int BYTES_PER_FRAME = 3 * NUM_LEDS;
38const int NUM_FRAMES = 2;
39const uint32_t BUFFER_SIZE = BYTES_PER_FRAME * NUM_FRAMES;
41ByteStreamMemoryRef memoryStream;
44XYMap xymap(MATRIX_WIDTH, MATRIX_HEIGHT);
46void write_one_frame(ByteStreamMemoryRef memoryStream) {
48 uint32_t total_bytes_written = 0;
49 int toggle = (millis() / 500) % 2;
50 for (uint32_t i = 0; i < NUM_LEDS; ++i) {
52 size_t bytes_written = memoryStream->write(color.
raw, 3);
53 if (bytes_written != 3) {
55 total_bytes_written += bytes_written;
67 memoryStream = ByteStreamMemoryRef::New(BUFFER_SIZE);
68 write_one_frame(memoryStream);
69 Video video(memoryStream, NUM_LEDS, 30.0f, 0);
77 write_one_frame(memoryStream);
80 fxEngine.
draw(millis(), leds);
CFastLED FastLED
Global LED strip management instance.
central include file for FastLED, defines the CFastLED class/object
void setBrightness(uint8_t scale)
Set the global brightness scaling.
void show(uint8_t scale)
Update all our controllers with the current led colors, using the passed in brightness.
static CLEDController & addLeds(CLEDController *pLed, struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset=0)
Add a CLEDController instance to the world.
Manages and renders multiple visual effects (Fx) for LED strips.
int addVideo(Video video, XYMap xymap)
Adds a new video effect to the engine.
bool draw(uint32_t now, CRGB *outputBuffer)
Renders the current effect or transition to the output buffer.
@ TypicalLEDStrip
Typical values for SMD5050 LEDs.
uint8_t raw[3]
Access the red, green, and blue data as an array.
Representation of an RGB pixel (Red, Green, Blue)