mirror of
https://github.com/esphome/esphome.git
synced 2024-11-21 22:48:10 +01:00
parent
0fa52d0ce6
commit
d3f2fab88a
2 changed files with 19 additions and 5 deletions
|
@ -4,8 +4,10 @@ import esphomeyaml.config_validation as cv
|
||||||
from esphomeyaml import pins
|
from esphomeyaml import pins
|
||||||
from esphomeyaml.components import display
|
from esphomeyaml.components import display
|
||||||
from esphomeyaml.components.display import ssd1306_spi
|
from esphomeyaml.components.display import ssd1306_spi
|
||||||
from esphomeyaml.const import CONF_ADDRESS, CONF_EXTERNAL_VCC, CONF_ID, CONF_MODEL, CONF_RESET_PIN
|
from esphomeyaml.const import CONF_ADDRESS, CONF_EXTERNAL_VCC, CONF_ID, \
|
||||||
from esphomeyaml.helpers import App, Pvariable, add, gpio_output_pin_expression
|
CONF_MODEL, CONF_RESET_PIN, CONF_LAMBDA
|
||||||
|
from esphomeyaml.helpers import App, Pvariable, add, \
|
||||||
|
gpio_output_pin_expression, process_lambda
|
||||||
|
|
||||||
DEPENDENCIES = ['i2c']
|
DEPENDENCIES = ['i2c']
|
||||||
|
|
||||||
|
@ -32,6 +34,11 @@ def to_code(config):
|
||||||
add(ssd.set_external_vcc(config[CONF_EXTERNAL_VCC]))
|
add(ssd.set_external_vcc(config[CONF_EXTERNAL_VCC]))
|
||||||
if CONF_ADDRESS in config:
|
if CONF_ADDRESS in config:
|
||||||
add(ssd.set_address(config[CONF_ADDRESS]))
|
add(ssd.set_address(config[CONF_ADDRESS]))
|
||||||
|
if CONF_LAMBDA in config:
|
||||||
|
for lambda_ in process_lambda(config[CONF_LAMBDA],
|
||||||
|
[(display.DisplayBufferRef, 'it')]):
|
||||||
|
yield
|
||||||
|
add(ssd.set_writer(lambda_))
|
||||||
|
|
||||||
display.setup_display(ssd, config)
|
display.setup_display(ssd, config)
|
||||||
|
|
||||||
|
|
|
@ -4,9 +4,11 @@ import esphomeyaml.config_validation as cv
|
||||||
from esphomeyaml import pins
|
from esphomeyaml import pins
|
||||||
from esphomeyaml.components import display
|
from esphomeyaml.components import display
|
||||||
from esphomeyaml.components.spi import SPIComponent
|
from esphomeyaml.components.spi import SPIComponent
|
||||||
from esphomeyaml.const import CONF_CS_PIN, CONF_DC_PIN, CONF_EXTERNAL_VCC, CONF_ID, CONF_MODEL, \
|
from esphomeyaml.const import CONF_CS_PIN, CONF_DC_PIN, CONF_EXTERNAL_VCC, \
|
||||||
CONF_RESET_PIN, CONF_SPI_ID
|
CONF_ID, CONF_MODEL, \
|
||||||
from esphomeyaml.helpers import App, Pvariable, add, get_variable, gpio_output_pin_expression
|
CONF_RESET_PIN, CONF_SPI_ID, CONF_LAMBDA
|
||||||
|
from esphomeyaml.helpers import App, Pvariable, add, get_variable, \
|
||||||
|
gpio_output_pin_expression, process_lambda
|
||||||
|
|
||||||
DEPENDENCIES = ['spi']
|
DEPENDENCIES = ['spi']
|
||||||
|
|
||||||
|
@ -52,6 +54,11 @@ def to_code(config):
|
||||||
add(ssd.set_reset_pin(reset))
|
add(ssd.set_reset_pin(reset))
|
||||||
if CONF_EXTERNAL_VCC in config:
|
if CONF_EXTERNAL_VCC in config:
|
||||||
add(ssd.set_external_vcc(config[CONF_EXTERNAL_VCC]))
|
add(ssd.set_external_vcc(config[CONF_EXTERNAL_VCC]))
|
||||||
|
if CONF_LAMBDA in config:
|
||||||
|
for lambda_ in process_lambda(config[CONF_LAMBDA],
|
||||||
|
[(display.DisplayBufferRef, 'it')]):
|
||||||
|
yield
|
||||||
|
add(ssd.set_writer(lambda_))
|
||||||
|
|
||||||
display.setup_display(ssd, config)
|
display.setup_display(ssd, config)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue