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

◆ mapToIndex()

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

Definition at line 55 of file xmap.cpp.hpp.

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

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

Referenced by convertToLookUpTable(), fl::XYMap::fromXMap(), and operator()().

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