Digole
Digital Solutions
iDigole Buyer ProtectioniDigole Buyer
Protection
My shopping cart
0 Items:
Secure Checkout
Top Rated Plus
Visit Our Live Auctions
99.9% Customer's Satisfaction
 
Forum : Digole Serial Display :

 Search Forum.. 
 Creat New Topic   Reply 

Touch not seeming to work

I am in the process of coding up a UI library, which I am putting on Github if anyone wants for Pi.

 

That being said, in my code I  have the following:


 {
  return Point(-1,-1);
 }
 delay(50);
 int x, y;
 int c = wiringPiI2CRead(i2cfd);
 std::stringstream ss;
 c <<= 8; 
 c |= wiringPiI2CRead(i2cfd);
 x = c;
 c = wiringPiI2CRead(i2cfd);
 c <<= 8; 
 c |= wiringPiI2CRead(i2cfd);
 y = c;
 if (x > 0 && x<lcdWidth && y>0 && y < lcdHeight)
  return Point(x, y);
 return Point(-1, -1);

 

I am never getting an accurate touch event read from the device.  i2cfd is definely the file descriptor, because I am drawing via that one.

Am I missing something?

 

RE:Touch not seeming to work

 Sorry, my cut and paste left out the most important line, here it is correct:

  if (!writeCmd("RPNXYI"))
 {
  return Point(-1,-1);
 }
 delay(50);
 int x, y;
 int c = wiringPiI2CRead(i2cfd);
 std::stringstream ss;
 c <<= 8; 
 c |= wiringPiI2CRead(i2cfd);
 x = c;
 c = wiringPiI2CRead(i2cfd);
 c <<= 8; 
 c |= wiringPiI2CRead(i2cfd);
 y = c;
 if (x > 0 && x<lcdWidth && y>0 && y < lcdHeight)
  return Point(x, y);
 return Point(-1, -1);

RE:Touch not seeming to work

Use "RPNXYC", "RPNXYI" usuall used with PENIRQ pin, and this command return unusable data if touch panel not pressed.

If you using hardware UART/I2C and FIFO buffer to receive data, please clear the buffer first before sending these commands which need data returns, otherwise you may retreive gabage data first and lost the sinyc of data.

RE:Touch not seeming to work

 How do you suggest clearing the buffer?

 

RE:Touch not seeming to work

 Ping?  Im still not getting touch events properly.

 

RE:Touch not seeming to work

Any ideas here?  Touch's are not registering properly and I am still awaiting a response as to how to "clear the i2c buffer" as you stated above.

 

RE:Touch not seeming to work

It depends on the controller you used, some controllers have hardware FIFO, some compiler use software FIFO, so, it's hard to say, you need to check your system yourself.

"RPNXYI" will return garbage data if the touch panel not pressed down, if you need to read a press down data, use "RPNXYT", if you need to read a click data (press down then released), use "RPNXYC", the "RPNXYI" usually used with PENIRQ singnal.

Copyright Digole Digital Solutions, 2008-2017. All rights reserved.
Powered by Victor Sun