Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Topics - xlc

#1
General Development / touchscreen
May 31, 2017, 11:16:01 PM
Hello,

I'm developping for my 700D with this nice code and  after searching some features for my own module, I have found the touch screen that I want to share :

in surveying the event, I can find the X, Y position when you touch the screen with one or two fingers.

First the different event numbers for my 700D are in event->param with for example one function unsigned int f(struct event *event)

event-> param = 107 when you press and then touch with 1 finger,
108  when unpress 1 finger touch
109  if you shift the finger
114 when press the 2nd fingers touch
115 when unpress 2nd fingers touch
116 and 117 when shift altenartivly with two fingers

for the X,Y position and the fingerNmber, I made for example this code :
static void xlc_write_event(struct event *event)
{

   uint32_t* info = NULL;
   uint16_t* XY;
   uint16_t X, Y;
   uint32_t fingerNbr;
      
if (event->param > 100)   {   //700D  touchscreen events

      info  = (uint32_t*)(*(uint32_t*)(event->obj+4));
      switch (event->param) {
         case 107://single touch - one finger
         case 108:
         case 109 :
         XY=(uint16_t*)&info[4];
         X=XY[1];
         Y=XY[0];
         fingerNbr=info[5];
         break;
         case 114: // double touch - two fingers
         case 115:
         case 116:
         case 117:
         XY=(uint16_t*)&info[2];
         X=XY[1];
         Y=XY[0];
         fingerNbr=info[3];
         break;
      default :
         X=0;Y=0;fingerNbr=0;
      };   
      bmp_printf( FONT_MED, 200, 240,"ev=%d;Finger->%d;X=%d;Y=%d\n",  event->param, fingerNbr, X, Y);

      }else {
      X=0;Y=0;fingerNbr=0;
      bmp_printf(FONT_MED, 200, 240,"ev=%d;NoTouch\n", event->param);
      };

}

enjoy with that