FastLED 3.9.15
Loading...
Searching...
No Matches
Codec.ino
Go to the documentation of this file.
1// @filter: (memory is large)
2
3// codec.ino - Comprehensive Multimedia Codec Demonstration
4// Click buttons to decode JPEG, WebP, GIF, and MPEG1 formats
5// All media files embedded as PROGMEM data
6
7#include <FastLED.h>
9#include "fl/ui/ui.h"
10#include "fl/stl/string.h"
11
12#include "fl/math/xymap.h"
13#include "inlined_data.h"
14#include "codec_processor.h"
15
16#define WIDTH 32
17#define HEIGHT 32
18
19#define NUM_LEDS WIDTH*HEIGHT // 32x32 LED matrix
20#define DATA_PIN 3
21#define LED_TYPE WS2812B
22#define COLOR_ORDER GRB
23
25fl::string formatNames[] = {"JPEG", "GIF", "MPEG1"};
26
27// UI Button definitions
31
32
33// Global state (no longer used for automatic cycling)
34
35void setup() {
36 Serial.begin(115200);
37 Serial.println("FastLED Multimedia Codec Demonstration");
38 Serial.println("Click buttons to decode JPEG, GIF, and MPEG1 formats");
39
40 // xymap is for the wasm compiler and is otherwise a no-op.
41 // 32x32 grid for WASM display using XYMap
43
45 .setCorrection(TypicalLEDStrip)
46 .setScreenMap(xymap.toScreenMap());
47
48
49 FastLED.setBrightness(50);
50
51 // Clear LEDs
53 FastLED.show();
54
55 // UI buttons are initialized via constructors
56
57 // Initialize codec processor with LED array
60 CodecProcessor::ledWidth = WIDTH; // 32x32 for 1:1 mapping
62
63 Serial.println("System initialized - codec demonstration ready. Click buttons to decode formats...");
64}
65
66
67
68void loop() {
69 // Check for button clicks
70 if (jpegButton.clicked()) {
72 }
73
74 if (gifButton.clicked()) {
76 }
77
78 if (mpeg1Button.clicked()) {
80 }
81}
#define COLOR_ORDER
#define NUM_LEDS
fl::CRGB leds[NUM_LEDS]
XYMap xymap
#define DATA_PIN
Definition ClientReal.h:82
fl::string formatNames[]
Definition Codec.ino:25
void setup()
Definition Codec.ino:35
fl::UIButton mpeg1Button("MPEG1")
fl::UIButton jpegButton("JPEG")
fl::UIButton gifButton("GIF")
void loop()
Definition Codec.ino:68
FL_DISABLE_WARNING_PUSH FL_DISABLE_WARNING_GLOBAL_CONSTRUCTORS CFastLED FastLED
Global LED strip management instance.
#define WIDTH
#define LED_TYPE
#define HEIGHT
static XYMap constructRectangularGrid(u16 width, u16 height, u16 offset=0) FL_NOEXCEPT
Definition xymap.cpp.hpp:35
void fill_solid(CRGB *targetArray, int numToFill, const CRGB &color) FL_NOEXCEPT
Fill a range of LEDs with a solid color.
Definition fill.cpp.hpp:9
@ TypicalLEDStrip
Typical values for SMD5050 LEDs.
Definition color.h:15
fl::CRGB CRGB
Definition crgb.h:25
void processCodecWithTiming(const char *codecName, fl::function< void()> codecFunc)
@ Black
<div style='background:#000000;width:4em;height:4em;'></div>
Definition crgb.h:510
#define Serial
Definition serial.h:304
Aggregator header for the fl/ui/ family of per-element UI types.