Add reverse_enable for max7219 (#1489)

This commit is contained in:
Samuel Sieb
2021-02-17 11:26:22 -08:00
committed by GitHub
parent c92c439d17
commit acc1af0f51
3 changed files with 11 additions and 3 deletions
+4
View File
@@ -9,11 +9,14 @@ max7219_ns = cg.esphome_ns.namespace('max7219')
MAX7219Component = max7219_ns.class_('MAX7219Component', cg.PollingComponent, spi.SPIDevice)
MAX7219ComponentRef = MAX7219Component.operator('ref')
CONF_REVERSE_ENABLE = 'reverse_enable'
CONFIG_SCHEMA = display.BASIC_DISPLAY_SCHEMA.extend({
cv.GenerateID(): cv.declare_id(MAX7219Component),
cv.Optional(CONF_NUM_CHIPS, default=1): cv.int_range(min=1, max=255),
cv.Optional(CONF_INTENSITY, default=15): cv.int_range(min=0, max=15),
cv.Optional(CONF_REVERSE_ENABLE, default=False): cv.boolean,
}).extend(cv.polling_component_schema('1s')).extend(spi.spi_device_schema())
@@ -25,6 +28,7 @@ def to_code(config):
cg.add(var.set_num_chips(config[CONF_NUM_CHIPS]))
cg.add(var.set_intensity(config[CONF_INTENSITY]))
cg.add(var.set_reverse(config[CONF_REVERSE_ENABLE]))
if CONF_LAMBDA in config:
lambda_ = yield cg.process_lambda(config[CONF_LAMBDA], [(MAX7219ComponentRef, 'it')],