mirror of
https://github.com/esphome/esphome.git
synced 2024-11-26 17:05:21 +01:00
ST7789V: Make backlight_pin optional (#2180)
This commit is contained in:
parent
ed68a0e773
commit
565473c90c
1 changed files with 4 additions and 3 deletions
|
@ -29,7 +29,7 @@ CONFIG_SCHEMA = (
|
||||||
cv.Required(CONF_RESET_PIN): pins.gpio_output_pin_schema,
|
cv.Required(CONF_RESET_PIN): pins.gpio_output_pin_schema,
|
||||||
cv.Required(CONF_DC_PIN): pins.gpio_output_pin_schema,
|
cv.Required(CONF_DC_PIN): pins.gpio_output_pin_schema,
|
||||||
cv.Required(CONF_CS_PIN): pins.gpio_output_pin_schema,
|
cv.Required(CONF_CS_PIN): pins.gpio_output_pin_schema,
|
||||||
cv.Required(CONF_BACKLIGHT_PIN): pins.gpio_output_pin_schema,
|
cv.Optional(CONF_BACKLIGHT_PIN): pins.gpio_output_pin_schema,
|
||||||
cv.Optional(CONF_BRIGHTNESS, default=1.0): cv.percentage,
|
cv.Optional(CONF_BRIGHTNESS, default=1.0): cv.percentage,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -49,6 +49,7 @@ async def to_code(config):
|
||||||
reset = await cg.gpio_pin_expression(config[CONF_RESET_PIN])
|
reset = await cg.gpio_pin_expression(config[CONF_RESET_PIN])
|
||||||
cg.add(var.set_reset_pin(reset))
|
cg.add(var.set_reset_pin(reset))
|
||||||
|
|
||||||
|
if CONF_BACKLIGHT_PIN in config:
|
||||||
bl = await cg.gpio_pin_expression(config[CONF_BACKLIGHT_PIN])
|
bl = await cg.gpio_pin_expression(config[CONF_BACKLIGHT_PIN])
|
||||||
cg.add(var.set_backlight_pin(bl))
|
cg.add(var.set_backlight_pin(bl))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue