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

◆ getAverageLight()

FASTLED_FORCE_INLINE uint8_t CRGB::getAverageLight ( ) const

Get the average of the R, G, and B values.

Examples
TwinkleFox.ino.

Definition at line 163 of file crgb.hpp.

163 {
164#if FASTLED_SCALE8_FIXED == 1
165 const uint8_t eightyfive = 85;
166#else
167 const uint8_t eightyfive = 86;
168#endif
169 uint8_t avg = scale8_LEAVING_R1_DIRTY( r, eightyfive) + \
170 scale8_LEAVING_R1_DIRTY( g, eightyfive) + \
171 scale8_LEAVING_R1_DIRTY( b, eightyfive);
172 cleanup_R1();
173 return avg;
174}
LIB8STATIC_ALWAYS_INLINE void cleanup_R1()
Clean up the r1 register after a series of *LEAVING_R1_DIRTY calls.
Definition scale8.h:333
LIB8STATIC_ALWAYS_INLINE uint8_t scale8_LEAVING_R1_DIRTY(uint8_t i, fract8 scale)
This version of scale8() does not clean up the R1 register on AVR.
Definition scale8.h:170

References cleanup_R1(), FASTLED_FORCE_INLINE, and scale8_LEAVING_R1_DIRTY().

Referenced by fl::TwinkleFox::drawTwinkleFox(), and drawTwinkles().

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