Touch support for CST820 controller (ESP32-2432S024C)

After getting the display and the onboard RGB to work I am now trying to figure out if the touchscreen can also work with ESPHome.

I saw there is a work in progress driver implementation to exactly support this board (Support for CST 820 Touch screen controller by dirkjankrijnders · Pull Request #5641 · esphome/esphome · GitHub).

But I wonder if anybody has implemented this screen yet and can share his code in ESPHome? What files do I have to include in my ESPHome build? For example can I include the changed files as custom components like this or do I need to compile my own ESPHome binary:

esphome:
  includes:
    - cst820/binary_sensor.py
    - ...

I got the same board and just managed to get the touchscreen working with latest ESPHome and this code:

i2c: # required for touchscreen
  sda: GPIO33
  scl: GPIO32

touchscreen:
  platform: cst816
  id: my_touchscreen
  display: my_display
#  interrupt_pin: GPIO21
  reset_pin: GPIO25
  update_interval: 50ms # recommended if interrupt_pin is disabled
  on_touch:
      - lambda: |-
            ESP_LOGI("touch", "x=%d, y=%d, x_raw=%d, y_raw=%0d",
                touch.x,
                touch.y,
                touch.x_raw,
                touch.y_raw
                );

The important thing to make it work is NOT USING the interrupt pin. That’s why is commented. You’ll see the touch coordinates in ESPHome log.