Reset the Elecrow's GT911 the way Elecrow's own V3.0 example does (0.2.96, firmware 0.2.82)
The 2 ms reset of ESPHome's expander support (0.2.81) left the chip silent: "Calibration error" with the PCA9557 answering at 0x18. A component of smart_display's (elecrow_touch_reset.h, setup priority 700: after the I2C bus, before the GT911 driver) writes the expander as Elecrow's V3.0 ESPHome example does: every pin an output and low, 20 ms, the reset released, 100 ms, the interrupt line back to an input. The driver's reset and interrupt pins are gone.
This commit is contained in:
@@ -7,12 +7,16 @@ into a screen's YAML.
|
||||
|
||||
`smart_display: partitions: 4mb_wide_slots` (firmware 0.2.79) builds with one of the partition tables of partitions.py
|
||||
instead of ESPHome's own: two update slots of 1,984 KB on a 4 MB ESP32-S3, which the Elecrow CrowPanel 7.0" needs.
|
||||
|
||||
`smart_display: elecrow_touch_reset: {i2c_id: ..., address: 0x18}` (firmware 0.2.82) brings the GT911 of the Elecrow
|
||||
CrowPanel 7.0" V3.0 out of reset through its PCA9557 before the touch driver runs (elecrow_touch_reset.h).
|
||||
"""
|
||||
import logging
|
||||
|
||||
import esphome.codegen as cg
|
||||
from esphome.components import esp32
|
||||
from esphome.components import esp32, i2c
|
||||
import esphome.config_validation as cv
|
||||
from esphome.const import CONF_ID
|
||||
from esphome.core import CORE
|
||||
from esphome.helpers import write_file_if_changed
|
||||
|
||||
@@ -24,6 +28,10 @@ _LOGGER = logging.getLogger(__name__)
|
||||
|
||||
CONF_LANGUAGE = "language"
|
||||
CONF_PARTITIONS = "partitions"
|
||||
CONF_ELECROW_TOUCH_RESET = "elecrow_touch_reset"
|
||||
|
||||
elecrow_ns = cg.global_ns.namespace("elecrow")
|
||||
TouchReset = elecrow_ns.class_("TouchReset", cg.Component, i2c.I2CDevice)
|
||||
|
||||
|
||||
def _language(value):
|
||||
@@ -36,6 +44,8 @@ def _language(value):
|
||||
CONFIG_SCHEMA = cv.Schema({
|
||||
cv.Optional(CONF_LANGUAGE, default="en"): _language,
|
||||
cv.Optional(CONF_PARTITIONS): cv.one_of(*partitions.TABLES, lower=True),
|
||||
cv.Optional(CONF_ELECROW_TOUCH_RESET): cv.Schema({cv.GenerateID(): cv.declare_id(TouchReset)})
|
||||
.extend(cv.COMPONENT_SCHEMA).extend(i2c.i2c_device_schema(0x18)),
|
||||
})
|
||||
|
||||
|
||||
@@ -51,3 +61,9 @@ async def to_code(config):
|
||||
table = CORE.relative_build_path("smart_display_partitions.csv")
|
||||
write_file_if_changed(table, partitions.TABLES[config[CONF_PARTITIONS]])
|
||||
esp32.add_extra_build_file("partitions.csv", table)
|
||||
if CONF_ELECROW_TOUCH_RESET in config:
|
||||
conf = config[CONF_ELECROW_TOUCH_RESET]
|
||||
reset = cg.new_Pvariable(conf[CONF_ID])
|
||||
await cg.register_component(reset, conf)
|
||||
await i2c.register_i2c_device(reset, conf)
|
||||
cg.add_build_flag("-DESP_SCREENS_ELECROW_TOUCH_RESET=1")
|
||||
|
||||
Reference in New Issue
Block a user