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

◆ mapToIndex()

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

Definition at line 64 of file xmap.cpp.

64 {
65 uint16_t index;
66 switch (type) {
67 case kLinear:
68 index = x_linear(x, length);
69 break;
70 case kReverse:
71 index = x_reverse(x, length);
72 break;
73 case kFunction:
74 x = x % length;
75 index = xFunction(x, length);
76 break;
77 case kLookUpTable:
78 index = mData[x];
79 break;
80 default:
81 return 0;
82 }
83 return index + mOffset;
84}
uint32_t x[NUM_LAYERS]
Definition Fire2023.ino:80
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: