Add ektf2232 touchscreen controller (#1793)

This commit is contained in:
Jesse Hills 2022-01-21 15:45:57 +13:00 committed by GitHub
parent 5060264b1b
commit c1322525ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 98 additions and 0 deletions

View File

@ -0,0 +1,96 @@
EKTF2232 Touch Screen Controller
================================
.. seo::
:description: Instructions for setting up EKTF2232 touch screen controller with ESPHome
:image: ektf2232.svg
:keywords: EKTF2232
.. _ektf2232-component:
Component/Hub
-------------
The ``ektf2232`` component allows using the touch screen controller
found in the :doc:`Inkplate 6 Plus </components/display/inkplate6>` with ESPHome.
The :ref:`I²C <i2c>` is required to be set up in your configuration for this sensor to work.
.. code-block:: yaml
# Example configuration entry
ektf2232:
interrupt_pin: GPIO36
rts_pin: GPIO16
binary_sensor:
- platform: ektf2232
id: touch_key0
x_min: 80
x_max: 160
y_min: 106
y_max: 212
Configuration variables:
------------------------
- **id** (*Optional*, :ref:`config-id`): Set the ID of this sensor.
- **rts_pin** (*Optional*, :ref:`Pin Schema <config-pin_schema>`): The reset pin of the controller.
- **interupt_pin** (*Optional*, :ref:`Pin Schema <config-pin_schema>`): The touch detection pin.
- **display_width** (*Optional*, int): The dimension of the display in the horizontal
direction. Defaults to ``1024`` to match the Inkplate 6 Plus.
- **display_height** (*Optional*, int): The dimension of the display in the vertical
direction. Defaults to ``758`` to match the Inkplate 6 Plus.
- **on_touch** (*Optional*, :ref:`Automation <automation>`): An automation to perform
when the touch screen is pressed. See :ref:`ektf2232-on_touch`.
.. _ektf2232-on_touch:
``on_touch`` Trigger
--------------------
This automation will be triggered when the EKTF2232 touch screen detects a touch.
This trigger provides one arguments of type :apistruct:`ektf2232::TouchPoint` which has two integer members: ``x`` and ``y`` which
represent the position of the touch calibrated to the display width and heigh config options given.
Binary Sensor
-------------
The ``ektf2232`` binary sensor allows you to setup areas on the touch screen as virtual
buttons. First, setup a :ref:`ektf2232-component` and then use this binary sensor platform
to create individual binary sensors for each virtual button.
Configuration variables:
------------------------
- **name** (*Optional*, string): The name for the binary sensor.
- **id** (*Optional*, :ref:`config-id`): Manually specify the ID used for code generation.
- **ektf2232_id** (*Optional*, :ref:`config-id`): Manually specify the ID of the component the sensor is part of.
- **x_min** (**Required**, int): Left coordinate of the screen area to be detected as the virtual button.
- **x_max** (**Required**, int): Right coordinate of the screen area to be detected as the virtual button.
- **y_min** (**Required**, int): Top coordinate of the screen area to be detected as the virtual button.
- **y_max** (**Required**, int): Bottom coordinate of the screen area to be detected as the virtual button.
- All other options from :ref:`Binary Sensor <config-binary_sensor>`.
See Also
--------
- :ref:`Binary Sensor Filters <binary_sensor-filters>`
- :doc:`Inkplate 6 Plus </components/display/inkplate6>`
- :apiref:`ektf2232/ektf2232.h`
- :apiref:`ektf2232/binary_sensor/ektf2232_binary_sensor.h`
- :ghedit:`Edit`

1
images/ektf2232.svg Normal file
View File

@ -0,0 +1 @@
<svg width="491.773" height="98.944" viewBox="0 0 130.115 26.179" xmlns="http://www.w3.org/2000/svg"><path style="fill:#000;fill-opacity:1;stroke-width:.133497;stroke-miterlimit:4;stroke-dasharray:none" d="M6.271 0h117.573a6.257 6.257 0 0 1 6.271 6.271v13.637a6.257 6.257 0 0 1-6.271 6.271H6.27A6.257 6.257 0 0 1 0 19.908V6.27A6.257 6.257 0 0 1 6.271 0Z"/><g aria-label="EKTF2232" style="font-size:10.5833px;line-height:1.25;letter-spacing:1.08479px;fill:#fffffc;stroke-width:.264583"><path d="M10.115 14.073v3.658h8.602v2.935H6.48V4.862h11.944v2.935h-8.309v3.431h7.338v2.845zM37.796 20.666H33.53l-5.057-6.209-2.123 2.213v3.996h-3.635V4.862h3.635v7.382l7-7.382h4.064l-6.548 7.044zM46.354 20.666h-3.657V7.842h-5.058v-2.98h13.773v2.98h-5.058zM66.405 4.862v2.935h-8.286v4.177h7.315v2.935h-7.315v5.757H54.46V4.862ZM74.082 17.686h6.796v2.98H68.934v-2.37l6.096-5.758q.971-.926 1.31-1.58.339-.678.339-1.333 0-.948-.655-1.445-.632-.519-1.874-.519-1.039 0-1.874.407-.836.383-1.4 1.174l-2.664-1.716q.926-1.378 2.551-2.145 1.626-.79 3.725-.79 1.762 0 3.071.587 1.332.564 2.055 1.625.745 1.039.745 2.461 0 1.287-.542 2.416t-2.1 2.574zM88.488 17.686h6.796v2.98H83.34v-2.37l6.096-5.758q.97-.926 1.31-1.58.338-.678.338-1.333 0-.948-.655-1.445-.632-.519-1.873-.519-1.04 0-1.874.407-.836.383-1.4 1.174l-2.664-1.716q.925-1.378 2.55-2.145 1.626-.79 3.726-.79 1.761 0 3.07.587 1.333.564 2.055 1.625.745 1.039.745 2.461 0 1.287-.541 2.416-.542 1.129-2.1 2.574zM105.264 11.296q2.077.339 3.184 1.558 1.106 1.197 1.106 2.98 0 1.378-.723 2.552-.722 1.151-2.212 1.851-1.468.7-3.613.7-1.67 0-3.296-.429-1.603-.452-2.732-1.264l1.422-2.8q.904.677 2.078 1.061 1.196.361 2.438.361 1.377 0 2.168-.519.79-.542.79-1.513 0-1.941-2.958-1.941h-1.67v-2.416l3.25-3.68h-6.728V4.862h11.063v2.37zM117.231 17.686h6.796v2.98h-11.943v-2.37l6.096-5.758q.97-.926 1.31-1.58.338-.678.338-1.333 0-.948-.655-1.445-.632-.519-1.874-.519-1.038 0-1.874.407-.835.383-1.4 1.174l-2.664-1.716q.926-1.378 2.551-2.145 1.626-.79 3.726-.79 1.76 0 3.07.587 1.333.564 2.055 1.625.745 1.039.745 2.461 0 1.287-.542 2.416t-2.1 2.574z" style="font-weight:700;font-size:22.5778px;font-family:Montserrat;-inkscape-font-specification:'Montserrat, Bold'"/></g></svg>

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@ -401,6 +401,7 @@ Binary Sensor Components
Modbus Binary Sensor, components/binary_sensor/modbus_controller, modbus.png
XPT2046, components/binary_sensor/xpt2046, xpt2046.jpg
CAP1188 Capacitive Touch Sensor, components/binary_sensor/cap1188, cap1188.jpg
EKTF2232 Touchscreen, components/binary_sensor/ektf2232, ektf2232.svg
Custom Binary Sensor, components/binary_sensor/custom, language-cpp.svg
Output Components