From c1322525edfdd5417c25652bd5c88737ff5f4596 Mon Sep 17 00:00:00 2001 From: Jesse Hills <3060199+jesserockz@users.noreply.github.com> Date: Fri, 21 Jan 2022 15:45:57 +1300 Subject: [PATCH] Add ektf2232 touchscreen controller (#1793) --- components/binary_sensor/ektf2232.rst | 96 +++++++++++++++++++++++++++ images/ektf2232.svg | 1 + index.rst | 1 + 3 files changed, 98 insertions(+) create mode 100644 components/binary_sensor/ektf2232.rst create mode 100644 images/ektf2232.svg diff --git a/components/binary_sensor/ektf2232.rst b/components/binary_sensor/ektf2232.rst new file mode 100644 index 000000000..c0a99877a --- /dev/null +++ b/components/binary_sensor/ektf2232.rst @@ -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 ` with ESPHome. +The :ref:`I²C ` 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 `): The reset pin of the controller. + +- **interupt_pin** (*Optional*, :ref:`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 `): 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 `. + + +See Also +-------- + +- :ref:`Binary Sensor Filters ` +- :doc:`Inkplate 6 Plus ` +- :apiref:`ektf2232/ektf2232.h` +- :apiref:`ektf2232/binary_sensor/ektf2232_binary_sensor.h` +- :ghedit:`Edit` diff --git a/images/ektf2232.svg b/images/ektf2232.svg new file mode 100644 index 000000000..3058355dc --- /dev/null +++ b/images/ektf2232.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/index.rst b/index.rst index 32d15af1e..da34670f0 100644 --- a/index.rst +++ b/index.rst @@ -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