ducalex/retro-go

ST7789 Display Driver support?

Closed this issue · 2 comments

I would like to add support for the Fri3D Camp 2020/2022 and 2024 badges, which both use the wildly popular ST7789V display driver. The 2022 has 240x240 pixels while the 2024 edition has a 240x296 display.

Initially, I thought this isn't supported by retro-go at all because:

  • all configurations in components/retro-go/targets have "#define RG_SCREEN_DRIVER 0 // 0 = ILI9341".
  • the source code uses "ILI9341_CMD", which sounds like something for the ILI9341 display driver.
  • the code does not have one single mention of ST7789 anywhere.

But digging deeper, it seems that there was a mention of ST7789 in the esplay-s3 support (commit a85bcf7 had "#define RG_SCREEN_TYPE 4 // 4 = ESPLAY-ST7789V2") and I started to suspect that these ILI9341_CMD commands just have an ILI9341-specific name for historical reasons but actually are used to initialize several different display drivers.

I couldn't find much info on that esplay-s3 or esplay-esp32-s3 device itself other than this obscure reference which does mention the ST7789. I did find the ESPlay micro V2 but that's an ILI9341.

So I was wondering, could you please help me clarify which configurations are made for which display drivers? It looks like that info got a bit lost in the refactoring of the above commit.

My goal is to know which ones are likely to work with my ST7789V display driver, or at least to use as a starting point. Thank you!

Hi. I'm using ST7789 display and it works perfectly fine. Here is the changes I made to make it works:

You need to modify components/retro-go/targets/ file:
[-] ILI9341_CMD(0x36, (0x20 | 0x80 | 0x08)); /* Memory Access Control /
[+] ILI9341_CMD(0x36, (0x00 | 0x00 | 0x08)); /
Memory Access Control /
[+] ILI9341_CMD(0x21, 0x80); /
Invert colors */ \

ILI9341_CMD(0x26, 0x01); /* Gamma curve selected */
[-] ILI9341_CMD(0xE0, 0x0F, 0x31, 0x2B, 0x0C, 0x0E, 0x08, 0x4E, 0xF1, 0x37, 0x07, 0x10, 0x03, 0x0E, 0x09, 0x00);
[-] ILI9341_CMD(0xE1, 0x00, 0x0E, 0x14, 0x03, 0x11, 0x07, 0x31, 0xC1, 0x48, 0x08, 0x0F, 0x0C, 0x31, 0x36, 0x0F);
[+] ILI9341_CMD(0xE0, 0xD0, 0x00, 0x05, 0x0E, 0x15, 0x0D, 0x37, 0x43, 0x47, 0x09, 0x15, 0x12, 0x16, 0x19);
[+] ILI9341_CMD(0xE1, 0xD0, 0x00, 0x05, 0x0D, 0x0C, 0x06, 0x2D, 0x44, 0x40, 0x0E, 0x1C, 0x18, 0x16, 0x19);

image

That's it.

Also in my case I needed to rotate display, so I added this line:
[+] ILI9341_CMD(0x36, (0x48 | 0xC0)); /* Rotate screen */ \

Woah that's freaking amazing! Thanks for the quick reply! Now I can't wait to try it out!

If I get it all working nicely, I should submit a pull request to have the Fri3D Camp badge in its own components/retro-go/targets folder.

Thanks again!