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

ST7781_driver #1181

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

ST7781_driver #1181

wants to merge 7 commits into from

Conversation

kakaroto33
Copy link

Hi!

This is my first time making pull request, and my English is not so good.
The driver is for ST7781 / SPFD5408 (MCUFIREND shield), I tested with ESP 32 Dev Kit.

I used by reference this sources:
https://github.com/compihu/SWIFT-Shield
https://github.com/prenticedavid/MCUFRIEND_kbv (Defines is from there)

Docs:
https://www.crystalfontz.com/controllers/Sitronix/ST7781/
https://www.rhydolabz.com/documents/SPFD5408A.pdf

Major changes is on core:

  • 8bit commands is not work 100% all time, on Init 16 bit is required. (#define WRITE_COMMAND_16)
  • At end of pushBlock(), is need reset setWindow() (#define NO_MIPI_DCS_REV)
  • Some rotation operation is like ILI9225_DRIVER, but need little adjust (take a lot time to figure out on MCUFRIEND_kbv sources).

My shield is parallel one, and tested on with ESP 32 only, on examples I put one adaption of tftpaint with resistive touch library (Adafruit).
I tested some exemples, like graphictest, animated_eyes, clock and worked without problems.

Anyways, thanks for great project.

@Bodmer
Copy link
Owner

Bodmer commented May 11, 2021

Thanks for your input, nicely done. I do not have one of those displays so I am unable to test, this is a problem for me if a user has an issue later and typically in these situations I have been forced to buy a display to fix problems!

Can you provide a link to a display vendor.

I am not sure why the following sequence:

#if defined(NO_MIPI_DCS_REV1)
  setWindow(0, 0, _width - 1, _height - 1);
#endif

is required, and why it is only needed for pushBlock(). If it is important there, then I would expect it to be needed in many other functions. Can you expalin this?

There is no single example that tests all library functions, so as a confidence test can you list all the library examples you have run and whether they worked without error? As a minimum all these, these and these should run fine on an ESP32. Sprite tests are also good to run as that provides confidence the displau support has not missed anything.

@kakaroto33
Copy link
Author

Hi!

Well, searched for vendor and invoice and didn't found any register :(, I buy this maybe 10 years ago, recently I re-using old projects parts and wanted use theses displays. I have 2, and if you want I can send one for free.
Today, I found on other site same board, some one having same trouble as I.

https://www.engineersgarage.com/arduino/displaying-text-on-tft-lcd/

On back has 2 x 74HC245 and 1 x AMS1117, is too much like common TFT 2.4" ILI9341, maybe is cheap clone.

About:

#if defined(NO_MIPI_DCS_REV1)
  setWindow(0, 0, _width - 1, _height - 1);
#endif

Maybe become a little lazy, on test and tiring fix rotation, I found it on references sources, and it make work some calls like fillRect() with normally is after flood()/rotation().

https://github.com/prenticedavid/MCUFRIEND_kbv/blob/master/MCUFRIEND_kbv.cpp
setAddrWindow(0, 0, width() - 1, height() - 1);
    Lines:
    MCUFRIEND_kbv::readGRAM()#350
    MCUFRIEND_kbv::setRotation()#512
    MCUFRIEND_kbv::fillRect()#658


https://github.com/adafruit/TFTLCD-Library/blob/master/Adafruit_TFTLCD.cpp
setAddrWindow(0, 0, TFTWIDTH - 1, TFTHEIGHT - 1);
    Lines:
    Adafruit_TFTLCD::begin()#340,365
    Adafruit_TFTLCD::drawFastHLine()#626
    Adafruit_TFTLCD::drawFastVLine()#651
    Adafruit_TFTLCD::fillRect()#684
    Adafruit_TFTLCD::fillScreen()#727
    Adafruit_TFTLCD::setRotation()#858,905,928

   // Unlike the 932X drivers that set the address window to the full screen
  // by default (using the address counter for drawPixel operations), the
  // 7575 needs the address window set on all graphics operations.  In order
  // to save a few register writes on each pixel drawn, the lower-right
  // corner of the address window is reset after most fill operations, so
  // that drawPixel only needs to change the upper left each time.
  void Adafruit_TFTLCD::setLR(void) ..

I truly don't known why is need, but worked, with little time today, I re-checked and removed it.. and worked without it, I think is directly related with correct flags on rotation. On old test, rotate didn't rotate current contents on display, only remap references, or I still don't known, so, we can remove it..

About tests, I tested some Sprites, one show some trouble 'Animated_dial' on needle background, I need more time to tests all and check issues, maybe on weekend.

And need figure out how GIT works and rollback/fix the pull, because I from CVS and SVN....

Thanks.

@Bodmer
Copy link
Owner

Bodmer commented May 12, 2021

The 'Animated_dial' example reads from the display so changes to the readAddrWindow() function may be required. Some displays however do not allow reading from the display so this capability is not critical.

@kakaroto33
Copy link
Author

Hi!

Tests done, report in file attached.
I fixed setAddrWindow(), readPixel(), readRect(), now 'Animated_dial' is working.
Only hardware specific and with touch not tested, since screen uses resistive touch (added one exemple).

I'm stating using Git, still confusing..

ST7781_Driver Tests - 20210515.pdf

@morganflint
Copy link

Hello!
I'm also interested in ST7783 support, the same as ST7781 according to https://github.com/nopnop2002/esp-idf-parallel-tft
How is this work progressing?
I see in the previous comments a request for a link to a display vendor, so here are two of them:
https://es.aliexpress.com/item/32953996658.html
https://es.aliexpress.com/item/32749045174.html
Thanks!

@kakaroto33
Copy link
Author

Hello! I'm also interested in ST7783 support, the same as ST7781 according to https://github.com/nopnop2002/esp-idf-parallel-tft How is this work progressing? I see in the previous comments a request for a link to a display vendor, so here are two of them: https://es.aliexpress.com/item/32953996658.html https://es.aliexpress.com/item/32749045174.html Thanks!

If is same, you can try out my fork, branch ST7781_driver, is full working with ST7781: https://github.com/kakaroto33/TFT_eSPI/tree/ST7781_driver
Is not updated/synched at last 1 year, maybe I do it another day.

See files for referency:
User_Setups/Setup37_ST7781.h
examples/320 x 240/TFT_Resistive_Touch_MCU_ST7781

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

Successfully merging this pull request may close these issues.

None yet

3 participants