Chapter 2. API Reference
Sensitivity
Important performance parameter of touch sensor, the larger it is, the better touch sensor will perform.
It could be calculated by the format in below:
Sensitivity =
Waterproof
Waterproof is a hardware feature of touch sensor which has guard sensor and shield sensor (Always
connect to Channel 14) that has the ability to resist a degree influence of water drop and detect the water stream.
Touch Button
Touch button consumes one channel of touch sensor, and it looks like as the picture below:
Touch Slider
Touch slider consumes several channels(at least three channels) of touch sensor, the more channels
consumed, the higher resolution and accuracy position it will perform. Touch slider looks like as the picture below:
Touch Matrix
Touch matrix button consumes several channels(at least 2 + 2 = 4 channels), it gives a solution to
use fewer channels and get more buttons. ESP32-S2 supports up to 49 buttons. Touch matrix button looks like as
the picture below:
Touch Element Library Usage
Using this library should follow the initialization flow below:
1. To initialize Touch Element library by calling
2. To initialize touch elements(button/slider etc) by calling touch_xxxx_install()
3. To create a new element instance by calling touch_xxxx_create()
4. To subscribe events by calling touch_xxxx_subscribe_event()
5. To choose a dispatch method by calling touch_xxxx_set_dispatch_method() that tells the library
how to notify you while the subscribed event occur
6. (If dispatch by callback) Call touch_xxxx_set_callback() to set the event handler function.
7. To start Touch Element library by calling
8. (If dispatch by callback) The callback will be called by the driver core when event happen, no need to do any-
thing; (If dispatch by event task) create an event task and call
to obtain messages in a loop.
9. [Optional] If user wants to suspend the Touch Element run-time system or for some reason that could not obtain
the touch element message,
system and then resume it by calling
In code, the flow above may look like as follows:
Espressif Systems
Trigger
Threshold
Fig. 16: Touch sensor signal threshold
Signal
Signal
press
Signal
release
touch_element_install()
touch_element_start()
touch_element_stop()
touch_element_start()
422
Submit Document Feedback
Trigger
Signal
release
delta
=
Signal
benchmark
touch_element_message_receive()
should be called to suspend the Touch Element
again.
Release v4.4
Need help?
Do you have a question about the ESP32-S2 and is the answer not in the manual?
Questions and answers