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

◆ lerp8by8()

LIB8STATIC uint8_t lerp8by8 ( uint8_t a,
uint8_t b,
fract8 frac )

Linear interpolation between two unsigned 8-bit values, with 8-bit fraction.

Definition at line 437 of file lib8tion.h.

438{
439 uint8_t result;
440 if( b > a) {
441 uint8_t delta = b - a;
442 uint8_t scaled = scale8( delta, frac);
443 result = a + scaled;
444 } else {
445 uint8_t delta = a - b;
446 uint8_t scaled = scale8( delta, frac);
447 result = a - scaled;
448 }
449 return result;
450}
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 ...
Definition scale8.h:40

References LIB8STATIC, and scale8().

Referenced by CRGB::lerp8().

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