MCP230xx open drain interrupt pins (#1243)

This commit is contained in:
Keith Burzinski
2021-02-13 03:07:11 -06:00
committed by GitHub
parent 81b512a7b3
commit b52f7cfe86
8 changed files with 24 additions and 7 deletions
+3 -1
View File
@@ -2,7 +2,7 @@ import esphome.codegen as cg
import esphome.config_validation as cv
from esphome import pins
from esphome.components import i2c
from esphome.const import CONF_ID, CONF_NUMBER, CONF_MODE, CONF_INVERTED
from esphome.const import CONF_ID, CONF_NUMBER, CONF_MODE, CONF_INVERTED, CONF_OPEN_DRAIN_INTERRUPT
DEPENDENCIES = ['i2c']
MULTI_CONF = True
@@ -20,6 +20,7 @@ MCP23008GPIOPin = mcp23008_ns.class_('MCP23008GPIOPin', cg.GPIOPin)
CONFIG_SCHEMA = cv.Schema({
cv.Required(CONF_ID): cv.declare_id(MCP23008),
cv.Optional(CONF_OPEN_DRAIN_INTERRUPT, default=False): cv.boolean,
}).extend(cv.COMPONENT_SCHEMA).extend(i2c.i2c_device_schema(0x20))
@@ -27,6 +28,7 @@ def to_code(config):
var = cg.new_Pvariable(config[CONF_ID])
yield cg.register_component(var, config)
yield i2c.register_i2c_device(var, config)
cg.add(var.set_open_drain_ints(config[CONF_OPEN_DRAIN_INTERRUPT]))
CONF_MCP23008 = 'mcp23008'