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:
committed by
GitHub
parent
f9ce35c894
commit
f8cdb087fc
30
esphome/components/wk2132_i2c/__init__.py
Normal file
30
esphome/components/wk2132_i2c/__init__.py
Normal 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_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 i2c.register_i2c_device(var, config)
|
||||
4
esphome/components/wk2132_i2c/wk2132_i2c.cpp
Normal file
4
esphome/components/wk2132_i2c/wk2132_i2c.cpp
Normal file
@@ -0,0 +1,4 @@
|
||||
/* compiling with esp-idf framework requires a .cpp file for some reason ? */
|
||||
namespace esphome {
|
||||
namespace wk2132_i2c {}
|
||||
} // namespace esphome
|
||||
Reference in New Issue
Block a user