Jump to content

Touch Panel Coordinates Valid flag


wctltya

Recommended Posts

Hi,

My touch IC provides coordinates Valid Flag, a quote from datasheet:  "Valid bit field tells that this point ID is valid and the XY information represents a real touch point on touch sensor". It's not clear what is the value then.

So, in case of NOT valid coordinates the questions are:

1. What shall return the "bool_t read_xyz(GMouse* m, GMouseReading* prd)" for coordinates? Is there a coordinate value, which are assumed as not valid and will not be taken into consideration?

2. What shall return as a function? Is it OK to return "FALSE" without putting new values for prd->x and prd->y. 

3. What about prd->buttons and prd->z?

Shortly the question is - How to tell the library that there are no new coordinates?

BTW, such a situation arises, even w/o "valid" flag, in case of I2C session crashes for some reasons.   

Link to comment
Share on other sites

Yourread_xyz() function is supposed to return FALSE if the retrieved touch coordinates are invalid. In that case, the GINPUT module won't read the GMouseReadings struct at all and you can simply leave the coordinates and the buttons unchanged.

There's not much more to say. I hope that that answers all of your questions. Otherwise, don't hesitate to ask :)

Link to comment
Share on other sites

Actually it is a bit trickier than that as the system needs to recieve a touch up event. A better way is to always return TRUE but set the z value based on your valid flag. When not valid you don't have to read the x & y values (although you can). The button values you shouldn't touch. You can then set the vmt flags to indicate the behaviour just described.

Many of the touch drivers work as just described. Look for one that returns 1 or 0 for the z value.

By the way, returning FALSE basically means that no valid reading is available  (including the up/down touch state). In your case the "valid" flag is more likely to indicate a touch up condition and therefore the need to return TRUE.

Link to comment
Share on other sites

As an additional aside, if your controller is capable of returning pressure values, using that for z and ignoring the valid flag will often give much better results.

The reason for this is that our software detection of an up event is much more reliable than the simple (or non-existent) algorithms built into the controller firmware.

 

@inmarket didn't we encounter some issues with that approach quite a few years ago with some noisier touchscreen controller outputs and decided to "change that"?

When we rewrote the mouse driver we fixed those issues specifically because of controller bugs.

Most controllers which have a "valid" flag actually are using that to indicate touch up not that the controller cant determine what is currently happenning . Of course coordinates will be invalid during a touch up but the touch up itself is still valid and important. 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...