Support for DIYables 3.5 TFT LCD Color Touch Screen Shield #9
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changes necessary to make the DIYables 3.5 TFT LCD Color Touch Screen Shield work when connected to a NUCLEO-F103RB system. It has an 8-bit parallel interface using the GPIO driver. With these changes it appears to pass all tests quite well, and has a responsive touch interface that reports pressure. Several items are configuration items that likely shouldn't be committed to the master repo, but I wanted to first provide everything to make it work in case others want to reproduce and test.
The vendor's page: https://diyables.io/products/3.5-tft-lcd-color-touch-screen-shield-for-arduino-uno-mega-320x480-resolution-ili9488-driver-parallel-8-bit-interface-28pin-module-with-touch
Drivers/io_gpio/lcdts_io_gpio8_hal.c:
ADC_SAMPLETIME_15CYCLES is not present in my generated files. Use ADC_SAMPLETIME_1CYCLE_5 which seems to work, there are other choices that might be better. I believe this is due to my particular model of NUCLEO board or perhaps version of the STM32IDE, and not anything to do with the shield.
TS_IO_DetectToch() (intentional mispelling to match existing) would not detect touches. Referenced the DIYAbles code at https://github.com/DIYables/DIYables_TFT_Shield/blob/main/src/DIYables_TFT_Shield.cpp and rewrote the function. This screen detects the touch pressure, so instead of the function simply returning true (1) or false (0) it now returns the pressure. Values under 10 are returned as 0 to prevent spurious readings, although my unit pretty reliably returns 0 when there is no press.
Wrap the new and old function in the TS_PRESSURE flag.
Drivers/io_gpio/lcdts_io_gpio8_hal.h:
Set TS_RS_ADCCH and TS_WR_ADCCH to match the NUCLEO-F103RB ADC channels.
Ran the App/TouchCalib and generated a new TS_CINDEX value to match my device.
Add a new TS_PRESSURE flag.
Drivers/lcd/ili9488.c:
The SETWINDOW and SETCURSOR functions do not need to be changed based on the ILI9488_ORIENTATION parameter with this board. Add a new #if DIYABLES_QUIRK == 1 section that always uses the standard functions.
Proper operation with all 4 values of ILI9488_ORIENTATION was confirmed after this change.
In ili9488_Init() this board needs to have "ILI9488_INVON" set to get the proper colors. That's right, INVON = not inverted while INVOFF = inverted. Also wrap this in a #if DIYABLES_QUIRK == 1.
Drivers/lcd/ili9488.h:
This board has a parallel interface, so set ILI9488_INTERFACE 2.
Set the new variable DIYABLES_QUIRK to 1 to trigger the quirk handling above.