board707 / DMD_STM32

STM32Duino library for RGB, Monochrome and Two-color led matrix panels
GNU General Public License v3.0
64 stars 21 forks source link

Add a new panel 32x16 s4 DP5125 #96

Closed miralay001 closed 5 months ago

miralay001 commented 6 months ago

Panel description

Dimensions (in pixels) : 16x32

Scan factor: 1/4

Chips on rear side: DP5125

Panel photos

Specifications

// pin OE must be one of PB0 PB1 PA6 PA7

define DMD_PIN_nOE PB1

define DMD_PIN_SCLK PB11

// Pins for R0, G0, B0, R1, G1, B1 channels and for clock. // By default the library uses RGB color order. // If you need to change this - reorder the R0, G0, B0, R1, G1, B1 pins. // All this pins also must be selected from same port! uint8_t custom_rgbpins[] = { PA6, PA0,PA1,PA2,PA3,PA4,PA5 }; // CLK, R0, G0, B0, R1, G1, B1

// Fire up the DMD object as dmd<MATRIX_TYPE, COLOR_DEPTH>

// For pattern testing use one of matrix below: // RGB32x16plainS4 - 32x16 1/4 Binary mux // RGB32x16plainS4_DIRECT - 32x16 1/4 DIRECT mux // RGB32x16plainS2_DIRECT - 32x16 1/2 Binary mux

DMD_RGB <RGB32x16plainS4, COLOR_4BITS> dmd(mux_list, DMD_PIN_nOE, DMD_PIN_SCLK, custom_rgbpins, DISPLAYS_ACROSS, DISPLAYS_DOWN, ENABLE_DUAL_BUFFER);

https://github.com/board707/DMD_STM32/assets/108148338/86d475bb-14ee-4fe4-9468-3290ecbf2f1b

I'm waiting for your help

Result when I use RGB32x16_S4 template

https://github.com/board707/DMD_STM32/assets/108148338/fce94c53-d5fa-4596-bfe8-3c3191404706

board707 commented 6 months ago

Hi It looks like I worked with similar panel.

Please add this code snippet to your sketch just after #include "DMD_RGB.h" line: Use template RGB32x16_S4_miralay001 for init of the DMD class instance.

template<int COL_DEPTH>
#define RGB32x16_S4_miralay001 2,32,16,4,65
class DMD_RGB<RGB32x16_S4_miralay001, COL_DEPTH> : public DMD_RGB_BASE2<COL_DEPTH>
    {
    public:
        DMD_RGB(uint8_t* mux_list, byte _pin_nOE, byte _pin_SCLK, uint8_t* pinlist,
            byte panelsWide, byte panelsHigh, bool d_buf = false) :
            DMD_RGB_BASE2<COL_DEPTH>(2, mux_list, _pin_nOE, _pin_SCLK, pinlist,
                panelsWide, panelsHigh, d_buf, COL_DEPTH, 4, 32, 16)
            {
            this->fast_Hbyte = false;
            this->use_shift = false;
            }
        // Fast text shift is disabled for complex patterns, so we don't need the method
        void disableFastTextShift(bool shift) override {}

    protected:
        uint16_t get_base_addr(int16_t& x, int16_t& y) override {
                        static const uint8_t  pix_base =8;
            this->transform_XY(x, y);
            uint8_t pol_y = y % this->pol_displ;
            x += (y / this->DMD_PIXELS_DOWN) * this->WIDTH;
             uint16_t base_addr = (pol_y % this->nRows) * this->x_len +
                           (x / pix_base) * this->multiplex * pix_base +
                           x % pix_base;
                          base_addr += pix_base * (pol_y / this->nRows) ;
             return base_addr;
            }
    };
miralay001 commented 6 months ago

Thank You :)

https://github.com/board707/DMD_STM32/assets/108148338/f6dd7967-7b71-4f38-9482-ef69fb2f4a1e

board707 commented 6 months ago

You are welcome :)

board707 commented 5 months ago

Pattern RGB32x16_S4_miralay001 added to the library v1.1.3. Now you can use it directly in the DMD class init:

DMD_RGB <RGB32x16_S4_miralay001, COLOR_4BITS> dmd(mux_list, DMD_PIN_nOE, DMD_PIN_SCLK, custom_rgbpins, DISPLAYS_ACROSS, DISPLAYS_DOWN, ENABLE_DUAL_BUFFER);