Linear interpolation between two unsigned 8-bit values, with 8-bit fraction.
Definition at line 293 of file lib8tion.h.
294{
295 uint8_t result;
296 if( b > a) {
297 uint8_t delta = b - a;
298 uint8_t scaled =
scale8( delta, frac);
299 result = a + scaled;
300 } else {
301 uint8_t delta = a - b;
302 uint8_t scaled =
scale8( delta, frac);
303 result = a - scaled;
304 }
305 return result;
306}
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 ...
References LIB8STATIC, and scale8().
Referenced by CRGB::lerp8().