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

◆ ease8InOutCubic()

LIB8STATIC fract8 ease8InOutCubic ( fract8 i)

8-bit cubic ease-in / ease-out function.

Takes around 18 cycles on AVR.

Definition at line 504 of file lib8tion.h.

505{
506 uint8_t ii = scale8_LEAVING_R1_DIRTY( i, i);
507 uint8_t iii = scale8_LEAVING_R1_DIRTY( ii, i);
508
509 uint16_t r1 = (3 * (uint16_t)(ii)) - ( 2 * (uint16_t)(iii));
510
511 /* the code generated for the above *'s automatically
512 cleans up R1, so there's no need to explicitily call
513 cleanup_R1(); */
514
515 uint8_t result = r1;
516
517 // if we got "256", return 255:
518 if( r1 & 0x100 ) {
519 result = 255;
520 }
521 return result;
522}
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:180

References LIB8STATIC, and scale8_LEAVING_R1_DIRTY().

Referenced by cubicwave8().

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