Update ESP32-VirtualMatrixPanel-I2S-DMA.h
This commit is contained in:
parent
264d997618
commit
7d1841e355
1 changed files with 265 additions and 267 deletions
|
@ -46,7 +46,8 @@ struct VirtualCoords
|
||||||
|
|
||||||
enum PANEL_SCAN_RATE
|
enum PANEL_SCAN_RATE
|
||||||
{
|
{
|
||||||
NORMAL_TWO_SCAN, NORMAL_ONE_SIXTEEN, // treated as the same
|
NORMAL_TWO_SCAN,
|
||||||
|
NORMAL_ONE_SIXTEEN, // treated as the same
|
||||||
FOUR_SCAN_32PX_HIGH,
|
FOUR_SCAN_32PX_HIGH,
|
||||||
FOUR_SCAN_16PX_HIGH
|
FOUR_SCAN_16PX_HIGH
|
||||||
};
|
};
|
||||||
|
@ -54,6 +55,7 @@ enum PANEL_SCAN_RATE
|
||||||
// Chaining approach... From the perspective of the DISPLAY / LED side of the chain of panels.
|
// Chaining approach... From the perspective of the DISPLAY / LED side of the chain of panels.
|
||||||
enum PANEL_CHAIN_TYPE
|
enum PANEL_CHAIN_TYPE
|
||||||
{
|
{
|
||||||
|
CHAIN_NONE,
|
||||||
CHAIN_TOP_LEFT_DOWN,
|
CHAIN_TOP_LEFT_DOWN,
|
||||||
CHAIN_TOP_RIGHT_DOWN,
|
CHAIN_TOP_RIGHT_DOWN,
|
||||||
CHAIN_BOTTOM_LEFT_UP,
|
CHAIN_BOTTOM_LEFT_UP,
|
||||||
|
@ -74,8 +76,7 @@ class VirtualMatrixPanel
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
VirtualMatrixPanel(MatrixPanel_I2S_DMA &disp, int _vmodule_rows, int _vmodule_cols, int _panelResX, int _panelResY, PANEL_CHAIN_TYPE _panel_chain_type = CHAIN_NONE)
|
||||||
VirtualMatrixPanel(MatrixPanel_I2S_DMA &disp, int _vmodule_rows, int _vmodule_cols, int _panelResX, int _panelResY, PANEL_CHAIN_TYPE _panel_chain_type = CHAIN_TOP_RIGHT_DOWN)
|
|
||||||
#ifdef USE_GFX_ROOT
|
#ifdef USE_GFX_ROOT
|
||||||
: GFX(_vmodule_cols * _panelResX, _vmodule_rows * _panelResY)
|
: GFX(_vmodule_cols * _panelResX, _vmodule_rows * _panelResY)
|
||||||
#elif !defined NO_GFX
|
#elif !defined NO_GFX
|
||||||
|
@ -121,7 +122,10 @@ public:
|
||||||
void drawPixel(int16_t x, int16_t y, CRGB color);
|
void drawPixel(int16_t x, int16_t y, CRGB color);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
uint16_t color444(uint8_t r, uint8_t g, uint8_t b) { return display->color444(r, g, b); }
|
uint16_t color444(uint8_t r, uint8_t g, uint8_t b)
|
||||||
|
{
|
||||||
|
return display->color444(r, g, b);
|
||||||
|
}
|
||||||
uint16_t color565(uint8_t r, uint8_t g, uint8_t b) { return display->color565(r, g, b); }
|
uint16_t color565(uint8_t r, uint8_t g, uint8_t b) { return display->color565(r, g, b); }
|
||||||
uint16_t color333(uint8_t r, uint8_t g, uint8_t b) { return display->color333(r, g, b); }
|
uint16_t color333(uint8_t r, uint8_t g, uint8_t b) { return display->color333(r, g, b); }
|
||||||
|
|
||||||
|
@ -198,7 +202,6 @@ inline VirtualCoords VirtualMatrixPanel::getCoords(int16_t &virt_x, int16_t &vir
|
||||||
coords.x = ((vmodule_rows - (row + 1)) * virtualResX) + virt_x;
|
coords.x = ((vmodule_rows - (row + 1)) * virtualResX) + virt_x;
|
||||||
coords.y = virt_y % panelResY;
|
coords.y = virt_y % panelResY;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -241,7 +244,6 @@ inline VirtualCoords VirtualMatrixPanel::getCoords(int16_t &virt_x, int16_t &vir
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case (CHAIN_BOTTOM_LEFT_UP): //
|
case (CHAIN_BOTTOM_LEFT_UP): //
|
||||||
{
|
{
|
||||||
row = vmodule_rows - row - 1;
|
row = vmodule_rows - row - 1;
|
||||||
|
@ -259,7 +261,6 @@ inline VirtualCoords VirtualMatrixPanel::getCoords(int16_t &virt_x, int16_t &vir
|
||||||
coords.x = dmaResX - (row * virtualResX) - virt_x;
|
coords.x = dmaResX - (row * virtualResX) - virt_x;
|
||||||
coords.y = panelResY - 1 - (virt_y % panelResY);
|
coords.y = panelResY - 1 - (virt_y % panelResY);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -291,7 +292,6 @@ inline VirtualCoords VirtualMatrixPanel::getCoords(int16_t &virt_x, int16_t &vir
|
||||||
coords.x = dmaResX - (row * virtualResX) - virt_x;
|
coords.x = dmaResX - (row * virtualResX) - virt_x;
|
||||||
coords.y = panelResY - 1 - (virt_y % panelResY);
|
coords.y = panelResY - 1 - (virt_y % panelResY);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -307,15 +307,14 @@ inline VirtualCoords VirtualMatrixPanel::getCoords(int16_t &virt_x, int16_t &vir
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
// Q: 1 row!? Why?
|
||||||
|
// A: In cases people are only using virtual matrix panel for panels of non-standard scan rates.
|
||||||
default:
|
default:
|
||||||
coords.x = coords.y = -1; // By defalt use an invalid co-ordinates that will be rejected by updateMatrixDMABuffer
|
coords.x = virt_x; coords.y = virt_y;
|
||||||
return coords;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
} // end switch
|
} // end switch
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* START: Pixel remapping AGAIN to convert TWO parallel scanline output that the
|
/* START: Pixel remapping AGAIN to convert TWO parallel scanline output that the
|
||||||
* the underlying hardware library is designed for (because
|
* the underlying hardware library is designed for (because
|
||||||
* there's only 2 x RGB pins... and convert this to 1/4 or something
|
* there's only 2 x RGB pins... and convert this to 1/4 or something
|
||||||
|
@ -344,7 +343,6 @@ inline VirtualCoords VirtualMatrixPanel::getCoords(int16_t &virt_x, int16_t &vir
|
||||||
// Real number of DMA y rows is half reality
|
// Real number of DMA y rows is half reality
|
||||||
// coords.y = (y / 16)*8 + (y & 0b00000111);
|
// coords.y = (y / 16)*8 + (y & 0b00000111);
|
||||||
coords.y = (virt_y >> 4) * 8 + (virt_y & 0b00000111);
|
coords.y = (virt_y >> 4) * 8 + (virt_y & 0b00000111);
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (panel_scan_rate == FOUR_SCAN_16PX_HIGH)
|
else if (panel_scan_rate == FOUR_SCAN_16PX_HIGH)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue