110 {
111 uint8_t basethreshold =
beatsin8(9, 55, 65);
112 uint8_t wave =
beat8(7);
113
114 for (uint16_t i = 0; i <
mNumLeds; i++) {
115 uint8_t threshold =
scale8(
sin8(wave), 20) + basethreshold;
116 wave += 7;
118 if (l > threshold) {
119 uint8_t overage = l - threshold;
120 uint8_t overage2 =
qadd8(overage, overage);
121 leds[i] += CRGB(overage, overage2,
qadd8(overage2, overage2));
122 }
123 }
124}
LIB8STATIC uint8_t beat8(accum88 beats_per_minute, uint32_t timebase=0)
Generates an 8-bit "sawtooth" wave at a given BPM.
LIB8STATIC uint8_t beatsin8(accum88 beats_per_minute, uint8_t lowest=0, uint8_t highest=255, uint32_t timebase=0, uint8_t phase_offset=0)
Generates an 8-bit sine wave at a given BPM that oscillates within a given range.
LIB8STATIC_ALWAYS_INLINE uint8_t qadd8(uint8_t i, uint8_t j)
Add one byte to another, saturating at 0xFF.
LIB8STATIC_ALWAYS_INLINE uint8_t scale8(uint8_t i, fract8 scale)
Scale one byte by a second one, which is treated as the numerator of a fraction whose denominator is ...
#define sin8
Platform-independent alias of the fast sin implementation.
FASTLED_FORCE_INLINE uint8_t getAverageLight() const
Get the average of the R, G, and B values.