FastLED 3.10.8
Loading...
Searching...
No Matches

◆ mapWaveToLEDs()

void fl::WaveCrgbGradientMap::mapWaveToLEDs ( const XYMap & xymap,
WaveSimulation2D & waveSim,
fl::span< CRGB > leds )
overridevirtual

Map wave values to gradient-colored LEDs.

Parameters
xymapCoordinate mapping from 2D grid to 1D LED array
waveSimWave simulation containing amplitude values
ledsOutput LED array to write colors to

Implements fl::WaveCrgbMap.

Definition at line 72 of file wave.cpp.hpp.

73 {
74 BatchDraw batch(leds, &mGradient);
75 const fl::u32 width = waveSim.getWidth();
76 const fl::u32 height = waveSim.getHeight();
77 for (fl::u32 y = 0; y < height; y++) {
78 for (fl::u32 x = 0; x < width; x++) {
79 fl::u32 idx = xymap(x, y);
80 u8 value8 = waveSim.getu8(x, y);
81 batch.push(idx, value8);
82 }
83 }
84 batch.flush();
85}
CRGB leds[1]
XYMap xymap
Gradient mGradient
Definition wave.h:96
u8 getu8(fl::size x) const FL_NO_EXCEPT
fl::WaveSimulation1D waveSim(NUM_LEDS, fl::SuperSample::SUPER_SAMPLE_2X)
unsigned char u8
Definition stdint.h:131
u8 u8 height
Definition blur.h:186
u8 width
Definition blur.h:186

References fl::FL_NO_EXCEPT, fl::height, leds, mGradient, waveSim(), fl::width, fl::x, xymap, and fl::y.

Referenced by WaveCrgbGradientMap().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: