Replies: 1 comment
-
I am guessing that there have not been very many others who have played much with this driver. As an alternative to it, I hacked up a copy of Arduino library I mentioned in the first post by Paul Stoffregen. For this pass I put some parts of it into the device tree. The code is not totally clean right now. And relies on polling the
So far the code is working reasonably well: Not sure what I will do with it after this? Not sure if it makes sense to try to update the current built in code? Not sure if Paul's way of reading the registers is better or not, but I am getting good readings for pressure and the like.
But not sure if I will do much more if there is no interest in it. Back to playing |
Beta Was this translation helpful? Give feedback.
-
Sorry in advance, I am semi new to the zephyr world, and especially using it natively. My first introduction to Zephyr was through the ArduinoCore-zephyr code base. For several years now I have played a lot with the Teensy (PJRC -> Sparkfun) boards such as the Teensy 4, 4.1, Micromod (and earlier the 3.2, LC, ...), During that time, I have contributed to several of the display drivers.
Some of my current Zephyr experiments are up in my github project: https://github.com/KurtE/zephyr_test_sketches
Current experiment: Try adapting part of my ILI9341 display drivers to work with Zephyr, that does not use LVGL.
I currently have one hooked up to an Teensy Micromod board. I am using one of the displays I purchased earlier from PJRC:
https://www.pjrc.com/store/display_ili9341_touch.html which uses an XPT2046 touch controller.
I have also purchased the same display on eBay. Amazon...
The display code is currently limping along. I thought as a test I might port over a version of a simple touch paint,
which was originally in the Adafruit_ILI9341 library. I have since adapted it to the XPT2046 driver instead of the touch
controller that was on the Adafruit displays.
Code is up at: https://github.com/KurtE/zephyr_test_sketches/tree/master/ILI9341_touchpaint_xpt2046
This sketch allows you to drag your finger on the screen and it should show dots where you were touching in the color
chosen. Touching one of the color squares changes what color will display...
Currently I am trying to use the XPT2046 input class, and having issues, questions, etc. with it and wondered if others
have successfully used this and have suggestions on the proper usage. I have an instance of the touch class defined
in my app overlay:
There is some callback code in my main source file:
Which currently I do receive some events, which I currently just display in a loop:
Note: the Arduino Code, that this is based on is up at:
https://github.com/KurtE/ILI9341_t3n/tree/master/examples/touchpaint_xpt2046
And uses the library: https://github.com/PaulStoffregen/XPT2046_Touchscreen
Issues/Questions:
Converting touch coordinates to screen coordinates:
I know my above stuff is incorrect within the overlay, but it is unclear to me what to do.
In many cases with these screens, the touch panel and the pixels man not be in the same orientations.
That is with these displays, the Screen is in portrait mode (240x320), but the touch is in landscape orientation.
And each sketch(app) might be setup to change the display orientation.
With the Arduino code base: The library simply returns the touch coordinates in RAW mode, and we convert. From the
Arduino sketch:
Note the above are somewhat rough, but gives the general idea.
Any suggestions on ways to do this with using Zephyr?
Receive data while dragging finger(pen)
Currently it appears like, I might get two events per finger pressed. The press event and maybe a release that gets sent
by a timer. During that time it appears like the interrupt is disabled. So wondering how this is supposed to work
for things like I am doing or, for things like scrollbars, etc?
Looks like the timer code maybe tries to recheck if the button is still pressed?
It might simply be that it is not being sampled fast enough. I believe the Arduino library he limits the
time between checks to be > 3ms and here the code is checking after 100ms.
Maybe this should be settable and not hard coded?
Other suggestions?
Thanks
Kurt
Beta Was this translation helpful? Give feedback.
All reactions