Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ST7789 240x240 display #86

Open
Adrianotiger opened this issue Jun 10, 2022 · 6 comments
Open

ST7789 240x240 display #86

Adrianotiger opened this issue Jun 10, 2022 · 6 comments

Comments

@Adrianotiger
Copy link

Hi,
I was trying to add the 240x240 display to the list, but I can't see how I should do it.

If I just add the template an offset to the image is set.

Probably I need to edit some data here:


static const PROGMEM uint8_t s_ST7789_lcd135x240x16_initData[] = {
#ifdef SDL_EMULATION
    SDL_LCD_ST7789, 0x00, 0b00010000, 0x00,
#endif
    0x01, CMD_DELAY, 150,                     // SWRESET sw reset. not needed, we do hardware reset
    0x11, CMD_DELAY, 20,                      // SLPOUT exit sleep mode
    0x13, CMD_DELAY, 10,                      // NORON
    0x3A, 0x01, 0x55,                         // COLMOD set 16-bit pixel format 0x55
    0x36, 0x01, 0b00001000,                   // MADCTL 08 Adafruit
    0xB6, 0x02, 0x0A, 0x82,                   // DISSET5
    0xB2, 0x05, 0x0C, 0x0C, 0x00, 0x33, 0x33, // FRMCTR2 / PORCTL, Frame Rate Control (In Idle mode/ 8-colors)
    0xB7, 0x01, 0x35,                         // VGH / VGL
    0xBB, 0x01, 0x28,                         // VCOM
    0xC0, 0x01, 0x0C,                         // LCM / PWCTR1 power control 1
    0xC2, 0x02, 0x01, 0xFF,                   // VDV PWCTR3 power control 3
    0xC3, 0x01, 0x10,                         // VRH
    0xC4, 0x01, 0x20,                         // VDV
    0xC6, 0x01, 0x0F,                         // FRCTR2
    0xD0, 0x02, 0xA4, 0xA1,                   // PWCTRL1
    0xE0, 0x0E,                               // GMCTRP1 positive gamma correction
    0xD0, 0x00, 0x02, 0x07, 0x0A, 0x28, 0x32, 0x44, 0x42, 0x06, 0x0E, 0x12, 0x14, 0x17, 0xE1,
    0x0E, // GMCTRN1 negative gamma correction
    0xD0, 0x00, 0x02, 0x07, 0x0A, 0x28, 0x31, 0x54, 0x47, 0x0E, 0x1C, 0x17, 0x1B, 0x1E,
    //    0x2A,  0x04,  0x00,  0x00,  0x00,  0x7F,   // set column address, not needed. set by direct API
    //    0x2B,  0x04,  0x00,  0x00,  0x00,  0x9F,   // set page address, not needed. set by direct API
    0x21, CMD_DELAY, 10,  // INVON (21h): Display Inversion On
    0x29, CMD_DELAY, 120, // DISPON display on
};

But I don't know what. Is it possible to add the display in a future release? Thanks.

@lexus2k
Copy link
Owner

lexus2k commented Jun 13, 2022

Hi, yes, it is possible to add such support for future releases.
You may use ST7735 displays as an example, the actual library c++ files are automatically generated by Python script.
Did you try to run it? lcd_code_generator.py

@Adrianotiger
Copy link
Author

Did you try to run it? lcd_code_generator.py

No, sorry. Didn't know that there was this possibility. I will try it. Thanks.

@lexus2k
Copy link
Owner

lexus2k commented Jun 16, 2022

Can you check the latest commit?

@GitMoDu
Copy link

GitMoDu commented Dec 21, 2023

I have tested the current version and it's not fully working yet. Seems like the offset aren't right.
IMG_20231221_140521

@lexus2k
Copy link
Owner

lexus2k commented Dec 26, 2023

@GitMoDu Did you try to use setOffset API? It is available for ST7789.

@GitMoDu
Copy link

GitMoDu commented Dec 27, 2023

Thanks, that did the trick. Using setOffset() API directly on the driver had no effect, but through the getInterface() I was able to set the offsets to 0. Now most orientations fill the screen perfectly with no artifacts.

IMG_20231227_132722

However, with -90 degree orientation seems like it's still not aligned.
IMG_20231227_132726

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants