FastLED 3.9.15
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 71 of file wave.cpp.hpp.

72 {
73 BatchDraw batch(leds, &mGradient);
74 const fl::u32 width = waveSim.getWidth();
75 const fl::u32 height = waveSim.getHeight();
76 for (fl::u32 y = 0; y < height; y++) {
77 for (fl::u32 x = 0; x < width; x++) {
78 fl::u32 idx = xymap(x, y);
79 u8 value8 = waveSim.getu8(x, y);
80 batch.push(idx, value8);
81 }
82 }
83 batch.flush();
84}
fl::CRGB leds[NUM_LEDS]
XYMap xymap
Gradient mGradient
Definition wave.h:95
u8 getu8(fl::size x) const
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::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: