Chapter 2. API Reference
Fig. 16: Touch sensor signal threshold
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 =
Signal
press
− Signal
rel ease
Signal
rel ease
=
Signal
delta
Signal
benchmark
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 touch_element_install()
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 touch_element_start()
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 touch_element_message_receive()
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, touch_element_stop() should be called to suspend the Touch Element
system and then resume it by calling touch_element_start() again.
In code, the flow above may look like as follows:
Espressif Systems 422
Submit Document Feedback
Release v4.4