PDA

View Full Version : Please consider adding a library page for touchRead



MichaelMeissner
01-15-2014, 08:29 PM
I was posting to a disabled gamer on the arduino.cc forum, and I was suggesting he might think about using the touch sensors on the Teensy 3.0/3.1. However, I couldn't find an entry for it in the Teensy library page (http://www.pjrc.com/teensy/td_libs.html). I pointed him to the threads I've read in the past about touchRead, but it would be nice to have a library page for it.

When the audio library goes out of beta, it would be nice to have an official page for that as well.

jwatte
01-08-2019, 01:19 AM
We still don't have this documentation! What pinMode() does touchRead() need? How fast is it? What are typical values returned? Should I code in an absolute value, or try to detect big changes?

Polymorph
04-22-2019, 05:19 PM
Can I use a touchRead() on a pin, and use it as an IO pin?

Theremingenieur
04-22-2019, 05:44 PM
No, either IO or touch read. In opposite to the cheap and simple RC-via-IO method on older AVR processors, the Teensy 3.x processors have a dedicated and sophisticated internal TSI engine which can measure fractions of a pF in touch capacitance. When you invoke the touchRead function, the selected pin is internally disconnected from GPIO and connected to the TSI through the internal pin multiplexer. When touchRead has finished, you might (if you do not intend to do continuous or repeated touch detection) invoke pinMode which links the pin back to GPIO.

Polymorph
04-22-2019, 07:39 PM
Well... then the answer is yes, I can use a pin for both. Of course I don't mean at the same time. I mean within a program, I can use a pin as an IO pin, then with touchRead(), then as an IO pin, etc.

As expected, I would invoke pinMode to use a pin as an IO pin after using it with touchRead().

Is an entry on the library page planned?

Theremingenieur
04-22-2019, 07:50 PM
Is an entry on the library page planned?

Can't tell, I'm not a PJRC official, just a volunteer. But basically, since touchRead() has become a core function and does not need any library, the library page could be the wrong place. Best documentation are the TSI chapter of the reference manual and Paul's comments in the source code of touch.c