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

◆ lerp15by16()

LIB8STATIC int16_t lerp15by16 ( int16_t a,
int16_t b,
fract16 frac )

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

Definition at line 505 of file lib8tion.h.

506{
507 int16_t result;
508 if( b > a) {
509 uint16_t delta = b - a;
510 uint16_t scaled = scale16( delta, frac);
511 result = a + scaled;
512 } else {
513 uint16_t delta = a - b;
514 uint16_t scaled = scale16( delta, frac);
515 result = a - scaled;
516 }
517 return result;
518}
LIB8STATIC uint16_t scale16(uint16_t i, fract16 scale)
Scale a 16-bit unsigned value by an 16-bit value, which is treated as the numerator of a fraction who...
Definition scale8.h:546

References LIB8STATIC, and scale16().

+ Here is the call graph for this function: