mirror of
https://github.com/esphome/esphome.git
synced 2025-10-30 06:33:51 +00:00
add-black (#1593)
* Add black Update pre commit Update pre commit add empty line * Format with black
This commit is contained in:
committed by
GitHub
parent
2b60b0f1fa
commit
69879920eb
@@ -3,21 +3,28 @@ import esphome.config_validation as cv
|
||||
from esphome.components import display, spi
|
||||
from esphome.const import CONF_ID, CONF_INTENSITY, CONF_LAMBDA, CONF_NUM_CHIPS
|
||||
|
||||
DEPENDENCIES = ['spi']
|
||||
DEPENDENCIES = ["spi"]
|
||||
|
||||
max7219_ns = cg.esphome_ns.namespace('max7219')
|
||||
MAX7219Component = max7219_ns.class_('MAX7219Component', cg.PollingComponent, spi.SPIDevice)
|
||||
MAX7219ComponentRef = MAX7219Component.operator('ref')
|
||||
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'
|
||||
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())
|
||||
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())
|
||||
)
|
||||
|
||||
|
||||
def to_code(config):
|
||||
@@ -31,6 +38,7 @@ def to_code(config):
|
||||
cg.add(var.set_reverse(config[CONF_REVERSE_ENABLE]))
|
||||
|
||||
if CONF_LAMBDA in config:
|
||||
lambda_ = yield cg.process_lambda(config[CONF_LAMBDA], [(MAX7219ComponentRef, 'it')],
|
||||
return_type=cg.void)
|
||||
lambda_ = yield cg.process_lambda(
|
||||
config[CONF_LAMBDA], [(MAX7219ComponentRef, "it")], return_type=cg.void
|
||||
)
|
||||
cg.add(var.set_writer(lambda_))
|
||||
|
||||
Reference in New Issue
Block a user