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

ESP32/CYD: Add support for XPT2046 access via SoftSpi and user supplied orientation tables for ILI9XXX classes #340

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Angus71
Copy link

@Angus71 Angus71 commented May 9, 2024

As I own a set of these cheap 2432S028 boards (CYD - Cheap Yellow Display) I wanted to use this project to create a UI for these kind of boards, but the used XPT2046 is not connected to any of the hardware SPI interfaces and needs to be used with a SoftSPI.

While implementing the required changes, I tried to keep the existing API as stable as possible. So the usage of a hardware vs. a software SPI based XPT2046 should be seamless

from xpt2046 import xpt2046_softspi as xpt2046

To support an easier integration of user supplied orientation_tables in ILI9XXX based classes I extended the API to enable the user to provide an own orientation_table and thus still reuse the already defined rotation constants. The API, when the user provided a positive rotation value is still active.

Changes

  • ILI9341: Add software reset command in init command
  • ILI9XXX: Add option to provide external orientation table
  • XPT2046: Add SoftSPI support (E.g. CYD boards)
  • XPT2046: Returned coords are never outside the screen size

Possible optimizations

  • Due to the nature of the SoftSPI it uses more CPU resources, but for the XPT2046 this might be insignificant (3 bytes are exchanged). It might be possible to change to an interrupt based implementation, if an interrupt pin is available. (xpt2046_softspi.stat() currently returns around 2.9)

ILI9XXX: Add option to provide external orientation table
XPT2046: Add SoftSPI support (E.g. CYD boards)
@robertojguerra
Copy link

robertojguerra commented Jul 26, 2024

For anyone starting out, there is a nice example in
https://forum.lvgl.io/t/modulo-esp32-2432s08-ili9341-xpt2046-problem-touch/14685
I posted a solution, using this patch, and it works with my CYD ESP32-2432S028...

However the button press is a little skewed towards the USB port, while in portrait mode. I (or someone) needs to find the correct calibration numbers.

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

Successfully merging this pull request may close these issues.

2 participants