Author Topic: touchscreen  (Read 532 times)

xlc

  • New to the forum
  • *
  • Posts: 3
touchscreen
« on: 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


a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 10018
  • 5D Mark Free
Re: touchscreen
« Reply #1 on: June 01, 2017, 12:58:05 AM »
Very similar to what I've found here: https://www.magiclantern.fm/forum/index.php?topic=18544.0

Would be nice if you can continue the experiments from the linked thread, as I currently do not have access to a touch-screen camera (though I'd like to emulate these events in QEMU at some point).

dnlit

  • New to the forum
  • *
  • Posts: 4
Re: touchscreen
« Reply #2 on: June 02, 2017, 07:01:46 PM »
And then there's also lua_touch which I got working on my 700D with some help. Although I think some changes afterwards broke it again.
See here: https://bitbucket.org/hudson/magic-lantern/issues/2520/lua_touch-outdated-hijack_touch_cbr_ptr
It just has finger down, move and up, as far as I remember.

Not sure if this is helpful, this forum is so confusing…

xlc

  • New to the forum
  • *
  • Posts: 3
Re: touchscreen
« Reply #3 on: June 04, 2017, 07:50:56 PM »
@a1ex, OK I will switch on the linked thread.

@dnlit, I will have a look one time.

Thanks for your interest.