How do I tell the library not to use the E_PIN?

Hello.
I am using an ESP32 to drive some 64x32 panels.

// MatrixHardware_ESP32_V0.h
    #define R1_PIN  25
    #define G1_PIN  5
    #define B1_PIN  26
    #define R2_PIN  27
    #define G2_PIN  23
    #define B2_PIN  14

    #define A_PIN   13
    #define B_PIN   21
    #define C_PIN   18
    #define D_PIN   19
    #define E_PIN   22
    #define LAT_PIN 15
    #define OE_PIN  4

    #define CLK_PIN 2

    #define GPIO_PWM0A_OUT GPIO_NUM_32
    #define GPIO_SYNC0_IN  GPIO_NUM_34

GPIO 22, 32 and 34 are not connected to the panel.

My panels work just fine without them. Have no idea how, I did not design the PCB adapter.

I’ve successfully used GPIO 32 and 34 as INPUTS for some buttons, but I can’t seem to make GPIO 22 work. I’ve tried using it inside my code but it is always set to LOW.

Since GPIO 22 is not connected to the panel, I assumed that the library uses it somehow.

// SmartMatrixMultiplexedRefreshEsp32_Impl.h
    i2s_parallel_config_t cfg={
        .gpio_bus={R1_PIN, G1_PIN, B1_PIN, R2_PIN, G2_PIN, B2_PIN, LAT_PIN, OE_PIN, A_PIN, B_PIN, C_PIN, D_PIN, E_PIN, -1, -1, -1},
        .gpio_clk=CLK_PIN,
        .clkspeed_hz=ESP32_I2S_CLOCK_SPEED,  // formula used is 80000000L/(cfg->clkspeed_hz + 1), must result in >=2.  Acceptable values 26.67MHz, 20MHz, 16MHz, 13.34MHz...
        .bits=MATRIX_I2S_MODE,
        .bufa=0,
        .bufb=0,
        desccount,
        desccount,
        dmadesc_a,
        dmadesc_b
    };

How can I tell the library not to use the E_PIN ?
Where in the panel definition should I point out that the panel does not uses the E_PIN ?

The quickest solution was to #define E_PIN 40 inside MatrixHardware_ESP32_V0.h.

But I don’t know how safe this is, because I’ve tried setting it as 45 and the ESP would just crash infinitely, so the library is trying to use the E_PIN for something.

For the ESP32, you can set the pin number to -1 to disable that pin

#define E_PIN -1

You must have written your hardware definition based on an older SmartMatrix Library, these definitions are no longer necessary, you can remove them as they’re not being used:

    #define GPIO_PWM0A_OUT GPIO_NUM_32
    #define GPIO_SYNC0_IN  GPIO_NUM_34

@Louis Hello Louis.

Thanks for the tip.

I’ve worked with your library around 2 years ago and I haven’t upgraded it since because updating it may break everything.

My version of library uses both

#define GPIO_PWM0A_OUT GPIO_NUM_32
#define GPIO_SYNC0_IN  GPIO_NUM_34

So I can’t remove them. They aren’t connected to anything on the board so no harm done there.

Also, in the newer versions of the library you have replaced

    #define E_PIN   22
//with
    #define E_PIN   GPIO_NUM_22

And I can’t replace GPIO_NUM_22 with -1 because I will get an error saying I can’t use int instead of gpio_num_t.