Skip to content

CST328 Touchscreen #5188

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: next
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions components/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1062,6 +1062,7 @@ Touchscreen Components
Touchscreen Core, components/touchscreen/index, folder-open.svg, dark-invert
AXS15231, components/touchscreen/axs15231, axs15231.svg
CST226, components/touchscreen/cst226, t4-s3.jpg
CST328, components/touchscreen/cst328, cst328_.jpg
CST816, components/touchscreen/cst816, cst816.jpg
CHSC6X, components/touchscreen/chsc6x, chsc6x.png
EKTF2232, components/touchscreen/ektf2232, ektf2232.svg, Inkplate 6 Plus
Expand Down
87 changes: 87 additions & 0 deletions components/touchscreen/cst328.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
cst328 Touch Screen Controller
===============================

.. seo::
:description: Instructions for setting up cst328 touch screen controller with ESPHome
:image: cst328_.jpg
:keywords: cst328

The ``cst328`` touchscreen platform allows using the touch screen controllers based on the cst328 chip with ESPHome.
The :ref:`I²C <i2c>` is required to be set up in your configuration for this touchscreen to work.

This controller is used in the Waveshare ESP32-S3 Touch LCD 2.8 board.

.. figure:: images/cst328.jpg
:align: center
:width: 50.0%

cst328 touchscreen on Waveshare ESP32-S3 Touch LCD 2.8 board

Base Touchscreen Configuration
------------------------------

.. code-block:: yaml

# Example configuration entry
touchscreen:
platform: cst328
id: my_touchscreen
interrupt_pin: GPIOXX

Configuration variables:
************************

- **id** (*Optional*, :ref:`config-id`): Manually set the ID of this touchscreen.
- **interrupt_pin** (*Optional*, :ref:`Pin Schema <config-pin_schema>`): The touch detection pin.
- **reset_pin** (*Optional*, :ref:`Pin Schema <config-pin_schema>`): The chip reset pin.

- All other options from :ref:`Touchscreen <config-touchscreen>`.

Binary Sensor
-------------

In addition to touch areas on the screen configured through the :ref:`Touchscreen <config-touchscreen>` component,
a simple binary sensor can be configured to react to touching the screen.

.. code-block:: yaml

# Example configuration entry
binary_sensor:
- platform: cst328
name: "Home"

Configuration variables:
************************

- **cst328_id** (*Optional*, :ref:`config-id`): Manually specify the ID of the touchscreen.

- All other options from :ref:`Binary Sensor <config-binary_sensor>`.



Sample Config
-------------
Waveshare ESP32-S3 Touch LCD 2.8 board
**************************************

.. code-block:: yaml

i2c:
- id: touch_i2c
sda: GPIO1
scl: GPIO3
frequency: 400kHz

touchscreen:
- id: my_touchscreen
platform: cst328
i2c_id: touch_i2c
interrupt_pin: GPIO4
reset_pin: GPIO2


See Also
--------

- :apiref:`cst328/touchscreen/cst328_touchscreen.h`
- :ghedit:`Edit`
Binary file added components/touchscreen/images/cst328.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/cst328_.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.