59#define FASTLED_USES_ESP32S3_I2S
66#define NUM_LEDS_PER_STRIP 256
67#define NUM_LEDS (NUM_LEDS_PER_STRIP * NUMSTRIPS)
69#define EXAMPLE_PIN_NUM_DATA0 19
70#define EXAMPLE_PIN_NUM_DATA1 45
71#define EXAMPLE_PIN_NUM_DATA2 21
72#define EXAMPLE_PIN_NUM_DATA3 6
73#define EXAMPLE_PIN_NUM_DATA4 7
74#define EXAMPLE_PIN_NUM_DATA5 8
75#define EXAMPLE_PIN_NUM_DATA6 9
76#define EXAMPLE_PIN_NUM_DATA7 10
77#define EXAMPLE_PIN_NUM_DATA8 11
78#define EXAMPLE_PIN_NUM_DATA9 12
79#define EXAMPLE_PIN_NUM_DATA10 13
80#define EXAMPLE_PIN_NUM_DATA11 14
81#define EXAMPLE_PIN_NUM_DATA12 15
82#define EXAMPLE_PIN_NUM_DATA13 16
83#define EXAMPLE_PIN_NUM_DATA14 17
84#define EXAMPLE_PIN_NUM_DATA15 18
87const bool gUseFastLEDApi =
true;
90 EXAMPLE_PIN_NUM_DATA0,
91 EXAMPLE_PIN_NUM_DATA1,
92 EXAMPLE_PIN_NUM_DATA2,
93 EXAMPLE_PIN_NUM_DATA3,
94 EXAMPLE_PIN_NUM_DATA4,
95 EXAMPLE_PIN_NUM_DATA5,
96 EXAMPLE_PIN_NUM_DATA6,
97 EXAMPLE_PIN_NUM_DATA7,
98 EXAMPLE_PIN_NUM_DATA8,
99 EXAMPLE_PIN_NUM_DATA9,
100 EXAMPLE_PIN_NUM_DATA10,
101 EXAMPLE_PIN_NUM_DATA11,
102 EXAMPLE_PIN_NUM_DATA12,
103 EXAMPLE_PIN_NUM_DATA13,
104 EXAMPLE_PIN_NUM_DATA14,
105 EXAMPLE_PIN_NUM_DATA15
108fl::InternalI2SDriver *driver =
nullptr;
111void setup_i2s_using_fastled_api() {
115 leds + (0 * NUM_LEDS_PER_STRIP), NUM_LEDS_PER_STRIP
118 leds + (1 * NUM_LEDS_PER_STRIP), NUM_LEDS_PER_STRIP
121 leds + (2 * NUM_LEDS_PER_STRIP), NUM_LEDS_PER_STRIP
124 leds + (3 * NUM_LEDS_PER_STRIP), NUM_LEDS_PER_STRIP
127 leds + (4 * NUM_LEDS_PER_STRIP), NUM_LEDS_PER_STRIP
130 leds + (5 * NUM_LEDS_PER_STRIP), NUM_LEDS_PER_STRIP
133 leds + (6 * NUM_LEDS_PER_STRIP), NUM_LEDS_PER_STRIP
136 leds + (7 * NUM_LEDS_PER_STRIP), NUM_LEDS_PER_STRIP
139 leds + (8 * NUM_LEDS_PER_STRIP), NUM_LEDS_PER_STRIP
142 leds + (9 * NUM_LEDS_PER_STRIP), NUM_LEDS_PER_STRIP
145 leds + (10 * NUM_LEDS_PER_STRIP), NUM_LEDS_PER_STRIP
148 leds + (11 * NUM_LEDS_PER_STRIP), NUM_LEDS_PER_STRIP
151 leds + (12 * NUM_LEDS_PER_STRIP), NUM_LEDS_PER_STRIP
154 leds + (13 * NUM_LEDS_PER_STRIP), NUM_LEDS_PER_STRIP
157 leds + (14 * NUM_LEDS_PER_STRIP), NUM_LEDS_PER_STRIP
160 leds + (15 * NUM_LEDS_PER_STRIP), NUM_LEDS_PER_STRIP
170 Serial.begin(115200);
173 log_d(
"Total heap: %d", ESP.getHeapSize());
174 log_d(
"Free heap: %d", ESP.getFreeHeap());
175 log_d(
"Total PSRAM: %d", ESP.getPsramSize());
176 log_d(
"Free PSRAM: %d", ESP.getFreePsram());
178 log_d(
"waiting 6 second before startup");
180 if (gUseFastLEDApi) {
181 setup_i2s_using_fastled_api();
183 driver = fl::InternalI2SDriver::create();
184 driver->initled((uint8_t *)leds, PINS, NUMSTRIPS, NUM_LEDS_PER_STRIP);
185 driver->setBrightness(32);
190 static int s_offset = 0;
191 for (
int j = 0; j < NUMSTRIPS; j++) {
192 for (
int i = 0; i < NUM_LEDS_PER_STRIP; i++) {
193 int idx = (i + s_offset) % NUM_LEDS_PER_STRIP + NUM_LEDS_PER_STRIP * j;
194 all_leds[idx] =
CHSV(i, 255, 255);
202 if (gUseFastLEDApi) {
205 FASTLED_ASSERT(driver !=
nullptr,
"Did not expect driver to be null");
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.
@ GRB
Green, Red, Blue (0102)
void fill_rainbow(struct CRGB *targetArray, int numToFill, uint8_t initialhue, uint8_t deltahue)
Fill a range of LEDs with a rainbow of colors.
Representation of an HSV pixel (hue, saturation, value (aka brightness)).
Representation of an RGB pixel (Red, Green, Blue)