Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

isTouching method in TouchScreen.h not implemented in .cpp file #8

Open
coursera10062014 opened this issue Oct 28, 2014 · 9 comments
Open

Comments

@coursera10062014
Copy link

There's a bool isTouching() method declared on TouchScreen, but it is not implemented.

Attempts to use it reuslt in:

undefined reference to "TouchScreen::isTouching()"

It looks like the unused pressureThreshhold member variable was intended as a cutoff for the implementation of isTouching().

@Jeroi
Copy link

Jeroi commented Mar 24, 2015

I made but the problem is LCD sharing touchscreen pins. It makes LCD go crazy. But I will take a look more to it and if I find a solution will post it later.

@Jeroi
Copy link

Jeroi commented Mar 24, 2015

Ok here is function which you need to add to your TouchScreen.cpp:

bool TouchScreen::isTouching(void) {
//read current pressure level
uint16_t touch = pressure();

//Clean the touchScreen settings after function is used
//Because LCD may use the same pins
pinMode(_xm, OUTPUT);
digitalWrite(_xm, LOW);
pinMode(_yp, OUTPUT);
digitalWrite(_yp, HIGH);
pinMode(_ym, OUTPUT);
digitalWrite(_ym, LOW);
pinMode(_xp, OUTPUT);
digitalWrite(_xp, HIGH); 

    // Minimum and maximum pressure that we consider true pressing
if (touch > 100 && touch < 900) {
    return true;
}
else return false;

}

@Jeroi
Copy link

Jeroi commented Mar 24, 2015

Have to say also that the pressure() function is not working at current state. It leaves output pins as input and makes LCD go crazy. It needs some serius repairs or movement to private function all to gether.

Edit:
Adding that clean up code to the pressure function fixes quite much. Actually you need to only add that pin cleanup code to the pressure function and leave isTouching function without any pin settings.

I recon this will fix issues of TouchScreen leaving bad settings after done pressure function. I will create fork later and add all my fixes to it and make pull request.

@PatrickGlatt
Copy link

PatrickGlatt commented Nov 14, 2016

First thank you for fixing the isTouching method! :)

"I recon this will fix issues of TouchScreen leaving bad settings after done pressure function. I will create fork later and add all my fixes to it and make pull request."

Hello, did you already fix it?

@het25
Copy link

het25 commented Nov 18, 2016

hey there I am using 4 wire touch controller made by Nkk switch serial # FTCU04B making project ball and plate balance with PID control we can't interface this controller with mega 2560 please let me know asap we have 2 weeks left
thank you

jtickle added a commit to jtickle/TouchScreen that referenced this issue Dec 21, 2017
… of pressureThreshold; fix issue adafruit#8 by implementing isTouching
jtickle added a commit to jtickle/TouchScreen that referenced this issue Dec 21, 2017
… of pressureThreshold; fix issue adafruit#8 by implementing isTouching
@d42ohpaz
Copy link

d42ohpaz commented Feb 4, 2021

I'm using platformio to manage my dependencies, can we get an implementation released officially?

Thank you.

/cc @ladyada

@ladyada
Copy link
Member

ladyada commented Feb 4, 2021

@9ae8sdf76 submit a PR and we'll take a look

@d42ohpaz
Copy link

d42ohpaz commented Feb 5, 2021

@ladyada As much as I want to, I can't even get my screen calibrated - I can't be expected to write code for the library. :) To put it another way: it would take your team 5-10 minutes, while it might take me a day or two (with no guarantee of quality).

@ladyada
Copy link
Member

ladyada commented Feb 5, 2021

@9ae8sdf76 please try! that way you'll get the exact function you'd like implemented. we have no ETA to work on this library

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants