FastLED 3.9.15
Loading...
Searching...
No Matches

◆ mapWaveToLEDs()

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

Map wave values to grayscale LED colors.

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 53 of file wave.h.

54 {
55 const fl::u32 width = waveSim.getWidth();
56 const fl::u32 height = waveSim.getHeight();
57 for (fl::u32 y = 0; y < height; y++) {
58 for (fl::u32 x = 0; x < width; x++) {
59 fl::u32 idx = xymap(x, y);
60 u8 value8 = waveSim.getu8(x, y);
61 leds[idx] = CRGB(value8, value8, value8);
62 }
63 }
64 }
fl::CRGB leds[NUM_LEDS]
XYMap xymap
u8 getu8(fl::size x) const
fl::WaveSimulation1D waveSim(NUM_LEDS, fl::SuperSample::SUPER_SAMPLE_2X)
unsigned char u8
Definition stdint.h:131
fl::CRGB CRGB
Definition video.h:15
u8 u8 height
Definition blur.h:186
u8 width
Definition blur.h:186

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

+ Here is the call graph for this function: