From aae9b62a00adb799dae9db834f153b6db61b9cbe Mon Sep 17 00:00:00 2001 From: Will Tatam Date: Wed, 25 Oct 2023 01:26:21 +0100 Subject: [PATCH] Define pins to match SmartMatrix esp32 formum layout --- wled00/bus_manager.cpp | 56 ++++++++++++++++++++++++++++++++++++------ wled00/bus_manager.h | 2 +- 2 files changed, 50 insertions(+), 8 deletions(-) diff --git a/wled00/bus_manager.cpp b/wled00/bus_manager.cpp index db4c63b0..4c4d4799 100644 --- a/wled00/bus_manager.cpp +++ b/wled00/bus_manager.cpp @@ -464,20 +464,62 @@ void BusNetwork::cleanup() { BusSmartMatrix::BusSmartMatrix(BusConfig &bc) : Bus(bc.type, bc.start, bc.autoWhite) { +/* + #define R1_PIN GPIO_NUM_2 + #define G1_PIN GPIO_NUM_15 + #define B1_PIN GPIO_NUM_4 + #define R2_PIN GPIO_NUM_16 + #define G2_PIN GPIO_NUM_27 + #define B2_PIN GPIO_NUM_17 + + #define A_PIN GPIO_NUM_5 + #define B_PIN GPIO_NUM_18 + #define C_PIN GPIO_NUM_19 + #define D_PIN GPIO_NUM_21 + #define E_PIN GPIO_NUM_12 + #define LAT_PIN GPIO_NUM_26 + #define OE_PIN GPIO_NUM_25 + + #define CLK_PIN GPIO_NUM_22 +*/ + HUB75_I2S_CFG mxconfig; - mxconfig.double_buff = true; // <------------- Turn on double buffer + mxconfig.double_buff = false; // <------------- Turn on double buffer mxconfig.mx_width = 64; mxconfig.mx_height = 64; - mxconfig.gpio.e = 18; - // OK, now we can create our matrix object + + mxconfig.gpio.r1 = 2; + mxconfig.gpio.g1 = 15; + mxconfig.gpio.b1 = 4; + mxconfig.gpio.r2 = 16; + mxconfig.gpio.g2 = 27; + mxconfig.gpio.b2 = 17; + + mxconfig.gpio.lat = 26; + mxconfig.gpio.oe = 25; + mxconfig.gpio.clk = 22; + + mxconfig.gpio.a = 5; + mxconfig.gpio.b = 18; + mxconfig.gpio.c = 19; + mxconfig.gpio.d = 21; + mxconfig.gpio.e = 12; + + this->_len = (mxconfig.mx_width * mxconfig.mx_height); + + USER_PRINTLN("MatrixPanel_I2S_DMA config"); + + // OK, now we can create our matrix object display = new MatrixPanel_I2S_DMA(mxconfig); + USER_PRINTLN("MatrixPanel_I2S_DMA created"); // let's adjust default brightness display->setBrightness8(125); // range is 0-255, 0 - 0%, 255 - 100% // Allocate memory and start DMA display - if( not display->begin() ) + if( not display->begin() ) { Serial.println("****** !KABOOM! I2S memory allocation failed ***********"); + } } @@ -488,9 +530,9 @@ void BusSmartMatrix::setPixelColor(uint16_t pix, uint32_t c) { display->drawPixelRGB888(1, 1, r, g, b); } -// void BusSmartMatrix::setBrightness(uint8_t b, bool immediate) { -// this->smartMatrix->setBrightness(b); -// } +void BusSmartMatrix::setBrightness(uint8_t b, bool immediate) { + this->display->setBrightness(b); +} #endif // *************************************************************************** diff --git a/wled00/bus_manager.h b/wled00/bus_manager.h index cdbeaef5..9a1eed0f 100644 --- a/wled00/bus_manager.h +++ b/wled00/bus_manager.h @@ -353,7 +353,7 @@ class BusSmartMatrix : public Bus { return true; // return !backgroundLayer->isSwapPending(); } - // void setBrightness(uint8_t b, bool immediate); + void setBrightness(uint8_t b, bool immediate); // uint8_t getPins(uint8_t* pinArray) {} // todo