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

◆ pacifica_add_whitecaps()

void fl::Pacifica::pacifica_add_whitecaps ( fl::span< CRGB > leds)
private

Definition at line 108 of file pacifica.h.

108 {
109 u8 basethreshold = beatsin8(9, 55, 65);
110 u8 wave = beat8(7);
111
112 for (u16 i = 0; i < mNumLeds; i++) {
113 u8 threshold = scale8(sin8(wave), 20) + basethreshold;
114 wave += 7;
115 u8 l = leds[i].getAverageLight();
116 if (l > threshold) {
117 u8 overage = l - threshold;
118 u8 overage2 = qadd8(overage, overage);
119 leds[i] += CRGB(overage, overage2, qadd8(overage2, overage2));
120 }
121 }
122}
fl::CRGB leds[NUM_LEDS]
u16 mNumLeds
Definition fx.h:53
LIB8STATIC u8 beatsin8(accum88 beats_per_minute, u8 lowest=0, u8 highest=255, u32 timebase=0, u8 phase_offset=0) FL_NOEXCEPT
Generates an 8-bit sine wave at a given BPM that oscillates within a given range.
Definition beat.h:105
LIB8STATIC u8 beat8(accum88 beats_per_minute, u32 timebase=0) FL_NOEXCEPT
Generates an 8-bit "sawtooth" wave at a given BPM.
Definition beat.h:51
unsigned char u8
Definition stdint.h:131
fl::CRGB CRGB
Definition video.h:15
FASTLED_FORCE_INLINE u8 getAverageLight() const FL_NOEXCEPT
Get the average of the R, G, and B values.
Definition crgb.hpp:152

References fl::beat8(), fl::beatsin8(), leds, and fl::Fx::mNumLeds.

+ Here is the call graph for this function: