-
-
Notifications
You must be signed in to change notification settings - Fork 266
NeoTopology object
Michael Miller edited this page Mar 24, 2016
·
2 revisions
The NeoTopology object is constructed with a layout "method" that provides the mapping from the 2d coordinate system to index that the NeoPixelBus requires.
template <typename T_LAYOUT> class NeoTopology
The T_LAYOUT will define how the pixels on the matrix panel are laid out. See Layout objects for all the possible "methods".
Once you have constructed one, you can then use it map a given x,y to the index, which can then be used to set a pixel color.
NeoPixelBus<NeoGrbFeature, Neo800KbpsMethod> strip(PixelCount, PixelPin);
NeoTopology <RowMajorAlternatingLayout> topo(PanelWidth, PanelHeight);
...
strip.SetPixelColor(topo.Map(4, 5), RgbColor(16,16,98));
Using the NeoPixelsTopologyDump.ino sample, the following are some example layouts.
0 1 2 3 4 5 6 7
------------------------------------------------------------------
0 | 0 15 16 31 32 47 48 63
1 | 1 14 17 30 33 46 49 62
2 | 2 13 18 29 34 45 50 61
3 | 3 12 19 28 35 44 51 60
4 | 4 11 20 27 36 43 52 59
5 | 5 10 21 26 37 42 53 58
6 | 6 9 22 25 38 41 54 57
7 | 7 8 23 24 39 40 55 56
0 1 2 3 4 5 6 7
------------------------------------------------------------------
0 | 0 1 2 3 4 5 6 7
1 | 15 14 13 12 11 10 9 8
2 | 16 17 18 19 20 21 22 23
3 | 31 30 29 28 27 26 25 24
4 | 32 33 34 35 36 37 38 39
5 | 47 46 45 44 43 42 41 40
6 | 48 49 50 51 52 53 54 55
7 | 63 62 61 60 59 58 57 56
0 1 2 3 4 5 6 7
------------------------------------------------------------------
0 | 0 1 2 3 4 5 6 7
1 | 8 9 10 11 12 13 14 15
2 | 16 17 18 19 20 21 22 23
3 | 24 25 26 27 28 29 30 31
4 | 32 33 34 35 36 37 38 39
5 | 40 41 42 43 44 45 46 47
6 | 48 49 50 51 52 53 54 55
7 | 56 57 58 59 60 61 62 63