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

◆ mapToIndex()

uint16_t fl::XMap::mapToIndex ( uint16_t x) const

Definition at line 54 of file xmap.cpp.

54 {
55 uint16_t index;
56 switch (type) {
57 case kLinear:
58 index = x_linear(x, length);
59 break;
60 case kReverse:
61 index = x_reverse(x, length);
62 break;
63 case kFunction:
64 x = x % length;
65 index = xFunction(x, length);
66 break;
67 case kLookUpTable:
68 index = mData[x];
69 break;
70 default:
71 return 0;
72 }
73 return index + mOffset;
74}
int x
Definition Audio.ino:71
uint16_t mOffset
Definition xmap.h:66
Type type
Definition xmap.h:62
const uint16_t * mData
Definition xmap.h:64
uint16_t length
Definition xmap.h:61
@ kFunction
Definition xmap.h:30
@ kLookUpTable
Definition xmap.h:30
@ kLinear
Definition xmap.h:30
@ kReverse
Definition xmap.h:30
XFunction xFunction
Definition xmap.h:63
FASTLED_FORCE_INLINE uint16_t x_linear(uint16_t x, uint16_t length)
Definition xmap.h:14
FASTLED_FORCE_INLINE uint16_t x_reverse(uint16_t x, uint16_t length)
Definition xmap.h:19

References kFunction, kLinear, kLookUpTable, kReverse, length, mData, mOffset, type, x, fl::x_linear(), fl::x_reverse(), and xFunction.

Referenced by convertToLookUpTable(), and operator()().

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