PyDevices / pydisplay

Display, touch and encoder drivers for MicroPython, CircuitPython and Python
Other
34 stars 9 forks source link

Fix detection of CST816 with autosleep #21

Closed easytarget closed 1 month ago

easytarget commented 1 month ago

CST816 touch controller has an autosleep feature enabled by default and will not appear as a I2C device unless recently touched or reset.

The driver needs to do the supported device test after sending a reset to ensure device is detectable, currently init() fails on device detection unless the unit was recently powered up or hard (not soft) reset.

This was /really/ confusing for me when trying to get my code running on a T-Display Touch, (lost an hr debugging as an I2C issue.. fortunately I'd run esp-ide examples where touch did work, so I persisted)

ref: https://github.com/espressif/esp-bsp/issues/178#issuecomment-1588817982 https://github.com/fbiego/CST816S/tree/main?tab=readme-ov-file#auto-sleep-control