1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-30 06:33:51 +00:00

Add the WeiKai SPI/I2C UART/IO Expander components to esphome (#5218)

Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
This commit is contained in:
Jean Louis-Guerin
2024-04-24 03:21:44 +02:00
committed by GitHub
parent f9ce35c894
commit f8cdb087fc
60 changed files with 2874 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
import esphome.codegen as cg
import esphome.config_validation as cv
from esphome.components import i2c, weikai
from esphome.const import CONF_ID
CODEOWNERS = ["@DrCoolZic"]
DEPENDENCIES = ["i2c"]
AUTO_LOAD = ["weikai", "weikai_i2c"]
MULTI_CONF = True
weikai_i2c_ns = cg.esphome_ns.namespace("weikai_i2c")
WeikaiComponentI2C = weikai_i2c_ns.class_(
"WeikaiComponentI2C", weikai.WeikaiComponent, i2c.I2CDevice
)
CONFIG_SCHEMA = cv.All(
weikai.WKBASE_SCHEMA.extend(
{
cv.GenerateID(): cv.declare_id(WeikaiComponentI2C),
}
).extend(i2c.i2c_device_schema(0x2C)),
weikai.check_channel_max_4,
)
async def to_code(config):
var = cg.new_Pvariable(config[CONF_ID])
cg.add(var.set_name(str(config[CONF_ID])))
await weikai.register_weikai(var, config)
await i2c.register_i2c_device(var, config)