mirror of
https://github.com/esphome/esphome.git
synced 2025-10-08 04:43:46 +01:00
23 lines
633 B
Python
23 lines
633 B
Python
import esphome.codegen as cg
|
|
from esphome.components import touchscreen
|
|
import esphome.config_validation as cv
|
|
from esphome.const import CONF_ID
|
|
|
|
from ..display import CONF_SDL_ID, Sdl, sdl_ns
|
|
|
|
SdlTouchscreen = sdl_ns.class_("SdlTouchscreen", touchscreen.Touchscreen)
|
|
|
|
|
|
CONFIG_SCHEMA = touchscreen.TOUCHSCREEN_SCHEMA.extend(
|
|
{
|
|
cv.GenerateID(): cv.declare_id(SdlTouchscreen),
|
|
cv.GenerateID(CONF_SDL_ID): cv.use_id(Sdl),
|
|
}
|
|
)
|
|
|
|
|
|
async def to_code(config):
|
|
var = cg.new_Pvariable(config[CONF_ID])
|
|
await cg.register_parented(var, config[CONF_SDL_ID])
|
|
await touchscreen.register_touchscreen(var, config)
|