mirror of
https://github.com/esphome/esphome.git
synced 2024-11-10 01:07:45 +01:00
Mark esp32_touch supported only on standard esp32 variant (#4562)
* Mark esp32_touch supported only on standard esp32 variant * Add back default
This commit is contained in:
parent
d3f2b93c42
commit
215107e8ea
1 changed files with 32 additions and 24 deletions
|
@ -11,6 +11,7 @@ from esphome.const import (
|
|||
CONF_VOLTAGE_ATTENUATION,
|
||||
)
|
||||
from esphome.core import TimePeriod
|
||||
from esphome.components import esp32
|
||||
|
||||
AUTO_LOAD = ["binary_sensor"]
|
||||
DEPENDENCIES = ["esp32"]
|
||||
|
@ -50,30 +51,37 @@ VOLTAGE_ATTENUATION = {
|
|||
"0V": cg.global_ns.TOUCH_HVOLT_ATTEN_0V,
|
||||
}
|
||||
|
||||
CONFIG_SCHEMA = cv.Schema(
|
||||
{
|
||||
cv.GenerateID(): cv.declare_id(ESP32TouchComponent),
|
||||
cv.Optional(CONF_SETUP_MODE, default=False): cv.boolean,
|
||||
cv.Optional(
|
||||
CONF_IIR_FILTER, default="0ms"
|
||||
): cv.positive_time_period_milliseconds,
|
||||
cv.Optional(CONF_SLEEP_DURATION, default="27306us"): cv.All(
|
||||
cv.positive_time_period, cv.Range(max=TimePeriod(microseconds=436906))
|
||||
),
|
||||
cv.Optional(CONF_MEASUREMENT_DURATION, default="8192us"): cv.All(
|
||||
cv.positive_time_period, cv.Range(max=TimePeriod(microseconds=8192))
|
||||
),
|
||||
cv.Optional(CONF_LOW_VOLTAGE_REFERENCE, default="0.5V"): validate_voltage(
|
||||
LOW_VOLTAGE_REFERENCE
|
||||
),
|
||||
cv.Optional(CONF_HIGH_VOLTAGE_REFERENCE, default="2.7V"): validate_voltage(
|
||||
HIGH_VOLTAGE_REFERENCE
|
||||
),
|
||||
cv.Optional(CONF_VOLTAGE_ATTENUATION, default="0V"): validate_voltage(
|
||||
VOLTAGE_ATTENUATION
|
||||
),
|
||||
}
|
||||
).extend(cv.COMPONENT_SCHEMA)
|
||||
CONFIG_SCHEMA = cv.All(
|
||||
cv.Schema(
|
||||
{
|
||||
cv.GenerateID(): cv.declare_id(ESP32TouchComponent),
|
||||
cv.Optional(CONF_SETUP_MODE, default=False): cv.boolean,
|
||||
cv.Optional(
|
||||
CONF_IIR_FILTER, default="0ms"
|
||||
): cv.positive_time_period_milliseconds,
|
||||
cv.Optional(CONF_SLEEP_DURATION, default="27306us"): cv.All(
|
||||
cv.positive_time_period, cv.Range(max=TimePeriod(microseconds=436906))
|
||||
),
|
||||
cv.Optional(CONF_MEASUREMENT_DURATION, default="8192us"): cv.All(
|
||||
cv.positive_time_period, cv.Range(max=TimePeriod(microseconds=8192))
|
||||
),
|
||||
cv.Optional(CONF_LOW_VOLTAGE_REFERENCE, default="0.5V"): validate_voltage(
|
||||
LOW_VOLTAGE_REFERENCE
|
||||
),
|
||||
cv.Optional(CONF_HIGH_VOLTAGE_REFERENCE, default="2.7V"): validate_voltage(
|
||||
HIGH_VOLTAGE_REFERENCE
|
||||
),
|
||||
cv.Optional(CONF_VOLTAGE_ATTENUATION, default="0V"): validate_voltage(
|
||||
VOLTAGE_ATTENUATION
|
||||
),
|
||||
}
|
||||
).extend(cv.COMPONENT_SCHEMA),
|
||||
esp32.only_on_variant(
|
||||
supported=[
|
||||
esp32.const.VARIANT_ESP32,
|
||||
]
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
async def to_code(config):
|
||||
|
|
Loading…
Reference in a new issue