diff --git a/lib/led-matrix-32-16/led-matrix-32-16.cpp b/lib/led-matrix-32-16/led-matrix-32-16.cpp index 23fc0b5..88287a3 100644 --- a/lib/led-matrix-32-16/led-matrix-32-16.cpp +++ b/lib/led-matrix-32-16/led-matrix-32-16.cpp @@ -26,8 +26,39 @@ inline VirtualCoords CustomPxBasePanel::getCoords(int16_t x, int16_t y) } -LedMetrix32x16::LedMetrix32x16(/* args */) +LedMetrix32x16::LedMetrix32x16(HUB75_I2S_CFG::i2s_pins _pins) { + _pins.r1 = _pins.r1; + _pins.g1 = _pins.g1; + _pins.b1 = _pins.b1; + _pins.r2 = _pins.r2; + _pins.g2 = _pins.g2; + _pins.b2 = _pins.b2; + _pins.a = _pins.a; + _pins.b = _pins.b; + _pins.c = _pins.c; + _pins.d = _pins.d; + _pins.e = _pins.e; + _pins.lat = _pins.lat; + _pins.oe = _pins.oe; + _pins.clk = _pins.clk; +} +LedMetrix32x16::LedMetrix32x16() +{ + _pins.r1 = R1_PIN_DEFAULT; + _pins.g1 = G1_PIN_DEFAULT; + _pins.b1 = B1_PIN_DEFAULT; + _pins.r2 = R2_PIN_DEFAULT; + _pins.g2 = G2_PIN_DEFAULT; + _pins.b2 = B2_PIN_DEFAULT; + _pins.a = A_PIN_DEFAULT; + _pins.b = B_PIN_DEFAULT; + _pins.c = C_PIN_DEFAULT; + _pins.d = D_PIN_DEFAULT; + _pins.e = E_PIN_DEFAULT; + _pins.lat = LAT_PIN_DEFAULT; + _pins.oe = OE_PIN_DEFAULT; + _pins.clk = CLK_PIN_DEFAULT; } void LedMetrix32x16::begin(int nRow, int nColl, int res_x, int res_y, PANEL_CHAIN_TYPE chain_type ) @@ -35,10 +66,8 @@ void LedMetrix32x16::begin(int nRow, int nColl, int res_x, int res_y, PANEL_CHAI HUB75_I2S_CFG mxconfig ( res_x * 2, // width of a single panel res_y / 2, // height of a single panel - nRow * nColl // chain length - number of panels in the chain - // {R1_PIN_DEFAULT, G1_PIN_DEFAULT, B1_PIN_DEFAULT, R2_PIN_DEFAULT, G2_PIN_DEFAULT, B2_PIN_DEFAULT, - // A_PIN_DEFAULT, B_PIN_DEFAULT, C_PIN_DEFAULT, D_PIN_DEFAULT, E_PIN_DEFAULT, - // LAT_PIN_DEFAULT, OE_PIN_DEFAULT, CLK_PIN_DEFAULT}, // GPIO pin mapping + nRow * nColl, // chain length - number of panels in the chain + _pins // pin mapping ); // I2S clock speed // Create the DMA display object diff --git a/lib/led-matrix-32-16/led-matrix-32-16.hpp b/lib/led-matrix-32-16/led-matrix-32-16.hpp index 3d38bb4..f6c3d91 100644 --- a/lib/led-matrix-32-16/led-matrix-32-16.hpp +++ b/lib/led-matrix-32-16/led-matrix-32-16.hpp @@ -19,9 +19,11 @@ class LedMetrix32x16 private: MatrixPanel_I2S_DMA * dma_display = nullptr; // pointer to the DMA display object CustomPxBasePanel * virtual_display = nullptr; // pointer to the virtual display object + HUB75_I2S_CFG::i2s_pins _pins; public: LedMetrix32x16(); + LedMetrix32x16(HUB75_I2S_CFG::i2s_pins _pins); void begin(int nRow, int nColl, int res_x, int res_y, PANEL_CHAIN_TYPE chain_type = CHAIN_BOTTOM_RIGHT_UP); inline MatrixPanel_I2S_DMA * getDisplay() { return dma_display; } // return pointer to the DMA display object