tinygo-org / drivers

TinyGo drivers for sensors, displays, wireless adaptors, and other devices that use I2C, SPI, GPIO, ADC, and UART interfaces.
https://tinygo.org
BSD 3-Clause "New" or "Revised" License
587 stars 180 forks source link

ili9341: support tear-free display updates #543

Closed aykevl closed 1 year ago

aykevl commented 1 year ago

Many displays don't have the TE pin exposed. But those that do have the pin (for example, the PyPortal) can use it to synchronize writing a new image to the display. When implemented correctly, tearing can be avoided entirely.

This commit also changes the LCD refresh direction to either top-to-bottom or left-to-right depending on the rotation. Previously it might refresh from right-to-left or bottom-to-top. This has little impact on code that doesn't use the TE line, but code that does now only needs to worry about two cases (top-to-bottom and left-to-right) instead of four. (Unfortunately, it appears that the hardware doesn't support changing the major LCD refresh order so code that wants to do tear-free rendering still needs to care about these two cases).

sago35 commented 1 year ago

I will check later.

deadprogram commented 1 year ago

Verified that it still works as expected, and code seems good, so now merging. Thanks @aykevl