This commit is contained in:
tetele 2024-08-02 12:26:26 +03:00
parent 68a1b6bc02
commit 8aff0e7bfe

View file

@ -31,7 +31,8 @@ def validate_instruction_list():
CONFIG_SCHEMA = ( CONFIG_SCHEMA = (
cv.Schema({ cv.Schema(
{
cv.GenerateID(): cv.declare_id(ES8388Component), cv.GenerateID(): cv.declare_id(ES8388Component),
cv.Optional(CONF_PRESET): cv.enum(ES8388_PRESETS, lower=True), cv.Optional(CONF_PRESET): cv.enum(ES8388_PRESETS, lower=True),
cv.Optional(CONF_INIT_INSTRUCTIONS): validate_instruction_list(), cv.Optional(CONF_INIT_INSTRUCTIONS): validate_instruction_list(),
@ -41,7 +42,8 @@ CONFIG_SCHEMA = (
cv.Required(CONF_INSTRUCTIONS): validate_instruction_list(), cv.Required(CONF_INSTRUCTIONS): validate_instruction_list(),
} }
), ),
}) }
)
.extend(i2c.i2c_device_schema(0x10)) .extend(i2c.i2c_device_schema(0x10))
.extend(cv.COMPONENT_SCHEMA) .extend(cv.COMPONENT_SCHEMA)
) )
@ -63,7 +65,7 @@ async def to_code(config):
{ {
cv.Required(CONF_ID): cv.declare_id(Macro), cv.Required(CONF_ID): cv.declare_id(Macro),
cv.Required(CONF_INSTRUCTIONS): validate_instruction_list(), cv.Required(CONF_INSTRUCTIONS): validate_instruction_list(),
} },
) )
cg.add(var.register_macro(macro[CONF_ID], macro[CONF_INSTRUCTIONS])) cg.add(var.register_macro(macro[CONF_ID], macro[CONF_INSTRUCTIONS]))