MCPcopy Create free account
hub / github.com/FastLED/FastLED / XY

Function XY

examples/SmartMatrix/SmartMatrixSketch.h:26–46  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24
25
26uint16_t XY( uint8_t x, uint8_t y)
27{
28 uint16_t i;
29
30 if( kMatrixSerpentineLayout == false) {
31 i = (y * kMatrixWidth) + x;
32 }
33
34 if( kMatrixSerpentineLayout == true) {
35 if( y & 0x01) {
36 // Odd rows run backwards
37 uint8_t reverseX = (kMatrixWidth - 1) - x;
38 i = (y * kMatrixWidth) + reverseX;
39 } else {
40 // Even rows run forwards
41 i = (y * kMatrixWidth) + x;
42 }
43 }
44
45 return i;
46}
47
48// The 32bit version of our coordinates
49static uint16_t x;

Callers 1

loopFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected