mirror of
https://github.com/Threnklyn/esphome-dev.git
synced 2026-06-06 21:09:53 +02: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:
committed by
GitHub
parent
f9ce35c894
commit
f8cdb087fc
@@ -0,0 +1,31 @@
|
||||
import esphome.codegen as cg
|
||||
import esphome.config_validation as cv
|
||||
from esphome.components import spi, weikai
|
||||
|
||||
from esphome.const import CONF_ID
|
||||
|
||||
CODEOWNERS = ["@DrCoolZic"]
|
||||
DEPENDENCIES = ["spi"]
|
||||
AUTO_LOAD = ["weikai", "weikai_spi"]
|
||||
MULTI_CONF = True
|
||||
|
||||
weikai_spi_ns = cg.esphome_ns.namespace("weikai_spi")
|
||||
WeikaiComponentSPI = weikai_spi_ns.class_(
|
||||
"WeikaiComponentSPI", weikai.WeikaiComponent, spi.SPIDevice
|
||||
)
|
||||
|
||||
CONFIG_SCHEMA = cv.All(
|
||||
weikai.WKBASE_SCHEMA.extend(
|
||||
{
|
||||
cv.GenerateID(): cv.declare_id(WeikaiComponentSPI),
|
||||
}
|
||||
).extend(spi.spi_device_schema()),
|
||||
weikai.check_channel_max_2,
|
||||
)
|
||||
|
||||
|
||||
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 spi.register_spi_device(var, config)
|
||||
Reference in New Issue
Block a user