Skip to content

Conversation

@gitcnd
Copy link

@gitcnd gitcnd commented Feb 3, 2025

This is essentially the same as the CST816S driver, but with the Chip_ID being 0xB7 instead of 0xB5.

It is tested and working (code and screenshots here: #278 )

@gitcnd
Copy link
Author

gitcnd commented Feb 3, 2025

Pardon the additional commit... I was unable to get the popular esp32_243sS028r, aka "cheap yellow board" or CYB touch working without resorting to adding the swapxy option that many other drivers seem to have. With this here, it now works nicely.
Code and screenshots here: #281

@yusuhua
Copy link

yusuhua commented Feb 20, 2025

The driver code for the CST816 class is basically the same and can actually be extracted. The _ChipIDValue can be set as a parameter. For example, my T-CameraPlus-S3 uses the CST816D, so changing the _ChipIDValue to 0xB6 works.
https://github.com/esphome/esphome/blob/dev/esphome/components/cst816/touchscreen/cst816_touchscreen.h

@ThomasFarstrike
Copy link
Contributor

ThomasFarstrike commented Oct 10, 2025

Note that the driver currently already has:

_ChipIDValue = const(0xB5) _ChipIDValue2 = const(0xB6) 

and

if chip_id not in (_ChipIDValue, _ChipIDValue2): 

So I would kindly propose @gitcnd to modify that driver, just add a _ChipIDValue3 of 0xB7, make the pull request and done :-)

And maybe also rename the file from cst816s.py to cst8xx.py and add a comment to clarify that it supports 816S, 816D and 820?

@kdschlosser
Copy link
Collaborator

I am not opposed to having separate drivers as this makes it a bit easier for a user to use. However I am going to suggest that we do what is done with the focaltech drivers where there is a base class that can be used across multiple models. This requires a litle bit more work as the build script will need to be adjusted to also freeze the base class file into the firmware. It's not hard to do just requires more work to do it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

4 participants