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

◆ XY()

uint16_t XY ( uint8_t x,
uint8_t y )

Definition at line 31 of file Noise.ino.

32{
33 uint16_t i;
34
35 if( kMatrixSerpentineLayout == false) {
36 i = (y * kMatrixWidth) + x;
37 }
38
39 if( kMatrixSerpentineLayout == true) {
40 if( y & 0x01) {
41 // Odd rows run backwards
42 uint8_t reverseX = (kMatrixWidth - 1) - x;
43 i = (y * kMatrixWidth) + reverseX;
44 } else {
45 // Even rows run forwards
46 i = (y * kMatrixWidth) + x;
47 }
48 }
49
50 return i;
51}
int y
Definition simple.h:93
int x
Definition simple.h:92
#define kMatrixSerpentineLayout
#define kMatrixWidth
fl::u16 uint16_t
Definition s16x16x4.h:214
unsigned char uint8_t
Definition s16x16x4.h:209

References kMatrixSerpentineLayout, kMatrixWidth, x, and y.