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)
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
To support an easier integration of user supplied
orientation_tables
inILI9XXX
based classes I extended the API to enable the user to provide an ownorientation_table
and thus still reuse the already defined rotation constants. The API, when the user provided a positive rotation value is still active.Changes
Possible optimizations
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 around2.9
)