Jump to content

Detect any touch event


Joshua

Recommended Posts

Hey there,

I am wondering how I can detect any touch event, not just when touching a "pressable" widget. My goal is to turn the screen off after x seconds with no user input, then once the user touches the screen again, for it to turn back on.

My event code follows the code samples closely: 

    // Init event listener
    geventListenerInit(&gl);
    gwinAttachListener(&gl);
 
   // ...
 
    GEventpe = geventEventWait(&glgDelayNone);
    if (pe != NULL) {
        log_debug("ui/main""want this to log on any touch\n");
        switch (pe->type) {
           ...
Link to comment
Share on other sites

Hello & welcome to the µGFX community!

There are various ways of achieving this. For example, you can have a look at the /demos/applications/notepad demo which is a small paint-like application. To draw without handling the touch (mouse) inputs through widgets. Instead, it uses ginputGetMouseStatus() to retrieve the current mouse status.

You can use the GTIMER module to implement the screen timeout easily.

Link to comment
Share on other sites

I'm using the FT6x06 driver. I discovered that when I log the coordinates read in `read_xyz`, when the app starts it detects a touch but the coordinates are x=4095 and y=-1, which don't make sense to me. I could modify the driver to check for this but perhaps it points to a problem elsewhere?

Link to comment
Share on other sites

After more investigation it seems the FT6x06_TOUCH_POINTS register on my display is initialized to 0xFF instead of 0x00 as on the datasheet. I have modified the touch check to see if the number of touch points is valid (1 or 2)

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...