Comments (4)
Hello @michalk-exi ,
Good question(s). So the generic resistive touch driver isn't really obsolete, but it isn't structured the same as the display driver. I'm open to suggestions as far as how to make it a little bit more user friendly. I was going to send you an example that uses this generic resistive driver, but it seems all of our dev boards for the last couple of years utilize capacitive touch screens so I don't have anything at my fingertips. Still digging on that one, I will try to get you an example.
The summary is the generic resistive touch driver tries to remove the repetitive code that we used to have to write for every touch screen: 1) Code to calibrate the resistive touch screen 2) Code to decide what to do with the latest touch status.
There are really three layers here: 1) The generic code to calibrate and send events to GUIX 2) Your hardware specific code to detect pen down and read raw touch coordinates and 3) Application code that provides prompts during calibration and a bitmap to use for the calibration target. We try to write one "driver" for the hardware, and then re-use this driver in different applications. Since the resource IDs are application specific, we divided the GX_RESISTIVE_TOUCH structure into the hardware-specific portion and the application defined portion. The application fills in the GX_RESISTIVE_TOUCH_INFO, and the hardware-specific driver fills in the remainder of the GX_RESISTIVE_TOUCH structure. Hope that all makes sense.
It's up to the application to provide the GX_RESISTIVE_TOUCH_INFO structure with the strings you want to display to the user for each calibration step (touch the target, stop touching the target, etc.., in whatever language you want to use), and a MULTI_LINE_TEXT_VIEW widget into which the generic code will display the prompts during calibration. You also have to provide callback functions via the GX_RESISTIVE_TOUCH::gx_resistive_touch_pen_down_detect and GX_RESISTIVE_TOUCH::gx_resistive_touch_sample_read function pointers. Once these structures are initialized, you call _gx_touch_driver_generic_resistive_calibrate(), and then go into a loop calling gx_touch_driver_generic_resistive_update. For our example drivers we just polled calling gx_touch_driver_generic_resistive_update on a timer, but it would be better to sleep until there is a pen_down interrupt, then poll until the pen is released.
So to get started do this:
extern the functions
VOID _gx_touch_driver_generic_resistive_setup(GX_RESISTIVE_TOUCH *touch, GX_RESISTIVE_TOUCH_INFO *info);
VOID _gx_touch_driver_generic_resistive_update(GX_RESISTIVE_TOUCH *touch);
VOID _gx_touch_driver_generic_resistive_calibrate(GX_RESISTIVE_TOUCH *touch);
in your touch driver source. From your application initialize a GX_RESISTIVE_TOUCH_INFO structure and call gx_touch_driver_resistive_setup. Initialize the remaining fields in the GX_RESISTIVE_TOUCH structure from your driver level code. Then call calibrate() and go into a loop calling update().
As soon as I find an example for one of our older dev boards I will forward that to you.
from guix.
Attached a real-hardware example that might be helpful.
from guix.
I should have noted that if you are using a capacitive (not resistive) touch screen, don't bother with the generic_resistive_touch. That code is mainly about implementing the calibration, which you don't need for a capacitive touch. If you are using capacitive, just follow the examples in the generic resistive touch in terms of how to send each event type into the GUIX event queue. I have several capacitive touch drivers I can send you if that is what you need.
from guix.
Hi @jdeere5220,
Thanks for all your help, I especially appreciate the real world example of a driver. It also has reference values for stuff like gx_resistive_touch_max_retries
and gx_resistive_touch_sample_size
which is especially useful as it is impossible to find them anywhere else.
And yes, I'm working with resistive touchscreen, so to me all that will be very useful, thanks again.
I've also figured out that An-Fn
members of a TOUCH_CALIBRATION_MATRIX
are just coefficients, they don't have any special meaning.
In my case what I did in the end is what you've suggested. I've exposed the ..._update
, ..._setup
and ..._calibrate
function prototypes and wrote my driver around them.
As for suggestions, I think the driver is in a decent shape overall. What I would like to be a bit different is the gx_resistive_touch_sample_read
function to read both x
and y
coordinates at the same time and return them as GX_POINT
, but that is obviously a change that breaks current API. Other than that, the ..._event_send
functions hardcode the gx_event_display_handle
to be 0, which from my understanding sends these events to nowhere. I had no luck with handling them (I was not receiving any GX_EVENT_PEN_...
in my event handlers), until I changed that argument to point, to the gx_display_driver_data
from GX_DISPLAY
, following sample code of demo_guix_keyboard
. Figuring that out took me more time than I want to admit though. It is however entirely possible that my root window should set the display_handle to 0.
In any case, thanks again for all your help!
from guix.
Related Issues (20)
- PNG/DEFLATE font compression
- How to implement physical key operations
- GUIX Studio does not generate proper specification code when JPEG support is disabled HOT 5
- Unable to import into latest GUIX Studio HOT 12
- gx_prompt_text_id_set doesn't conform to transparency setting HOT 5
- _gx_system_thread_entry gets stuck in tx_queue_receive after a few hours HOT 10
- Documentation question about gx_system_event_send() error code HOT 8
- Incorrect PNG function being called when 2d engine is disabled HOT 3
- Bad LowerCase/UpperCase file loading in recent file window HOT 3
- GUIX Studio RGB888 frame buffer support HOT 7
- Documentation Errors HOT 5
- 4bit per pixel png image support HOT 2
- GUIX in low power mode HOT 11
- gx_studio_auto_event_handler calls event function on a deleted widget HOT 9
- GUIX Studio font heights above 240 pixels are not possible HOT 2
- If a vertical lists has a multiple childs of different heights, the scrollbar thumb does not reach the end of the scrollbar HOT 3
- The GX_EVENT_FOCUS_LOST event is not sent if the parent does not have focus HOT 2
- GX_VERTICAL_LIST does not release input if it contains GX_SINGLE_LINE_TEXT_INPUT HOT 2
- Increase maximum font size HOT 2
- Hebrew : multiline text view widgets dont display correctly on several lines HOT 10
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from guix.