Skip to content

Commit bc82706

Browse files
authored
Merge pull request #884 from board707/pixel_mapping_example2
Update Pixel_Mapping_Test example to support panels with any height
2 parents 30c984a + a642043 commit bc82706

1 file changed

Lines changed: 21 additions & 1 deletion

File tree

examples/Pixel_Mapping_Test/Pixel_Mapping_Test.ino

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,22 @@ inline VirtualCoords CustomPxBasePanel ::getCoords(int16_t x, int16_t y) {
7373
}
7474
coords.y = (coords.y >> 3) * 4 + (coords.y & 0b00000011);
7575
}
76+
// mapper for panels with any other heights
77+
else {
78+
uint8_t half_height = panelResY / 2;
79+
80+
if ((coords.y % half_height ) < half_height/2)
81+
{
82+
coords.x += (coords.x / pxbase + 1) * pxbase;
83+
}
84+
else
85+
{
86+
coords.x += (coords.x / pxbase) * pxbase; // 2nd, 4th 'block' of 8 rows of pixels, offset by panel width in DMA buffer
87+
}
88+
89+
coords.y = (coords.y / half_height ) * (half_height/2) + (coords.y % (half_height/2));
90+
91+
}
7692
return coords;
7793
}
7894

@@ -107,7 +123,11 @@ void setup()
107123
//,_pins // Uncomment to enable custom pins
108124
);
109125

110-
mxconfig.clkphase = false; // Change this if you see pixels showing up shifted wrongly by one column the left or right.
126+
// Change this if you see pixels showing up shifted wrongly by one column the left or right.
127+
mxconfig.clkphase = false;
128+
129+
// Uncomment this to use a TYPE595 decoder like DP32020/SM5368/TC75xx
130+
//mxconfig.line_decoder = HUB75_I2S_CFG::TYPE595;
111131

112132
// OK, now we can create our matrix object
113133
dma_display = new MatrixPanel_I2S_DMA(mxconfig);

0 commit comments

Comments
 (0)