mirror of
https://github.com/esphome/esphome.git
synced 2024-11-21 22:48:10 +01:00
ST7789v - Allow predefined backlight pin to be disabled. (#5476)
* Allow predefined backlight pin to be disabled. * Add test * Update esphome/components/st7789v/display.py
This commit is contained in:
parent
050fa0d4c1
commit
506c2ba6c7
2 changed files with 6 additions and 3 deletions
|
@ -138,7 +138,10 @@ CONFIG_SCHEMA = cv.All(
|
|||
cv.Required(CONF_MODEL): cv.one_of(*MODELS.keys(), upper=True, space="_"),
|
||||
cv.Optional(CONF_RESET_PIN): pins.gpio_output_pin_schema,
|
||||
cv.Optional(CONF_DC_PIN): pins.gpio_output_pin_schema,
|
||||
cv.Optional(CONF_BACKLIGHT_PIN): pins.gpio_output_pin_schema,
|
||||
cv.Optional(CONF_BACKLIGHT_PIN): cv.Any(
|
||||
cv.boolean,
|
||||
pins.gpio_output_pin_schema,
|
||||
),
|
||||
cv.Optional(CONF_POWER_SUPPLY): cv.use_id(power_supply.PowerSupply),
|
||||
cv.Optional(CONF_EIGHTBITCOLOR, default=False): cv.boolean,
|
||||
cv.Optional(CONF_HEIGHT): cv.int_,
|
||||
|
@ -174,7 +177,7 @@ async def to_code(config):
|
|||
reset = await cg.gpio_pin_expression(config[CONF_RESET_PIN])
|
||||
cg.add(var.set_reset_pin(reset))
|
||||
|
||||
if CONF_BACKLIGHT_PIN in config:
|
||||
if CONF_BACKLIGHT_PIN in config and config[CONF_BACKLIGHT_PIN]:
|
||||
bl = await cg.gpio_pin_expression(config[CONF_BACKLIGHT_PIN])
|
||||
cg.add(var.set_backlight_pin(bl))
|
||||
|
||||
|
|
|
@ -2948,7 +2948,7 @@ display:
|
|||
cs_pin: GPIO5
|
||||
dc_pin: GPIO16
|
||||
reset_pin: GPIO23
|
||||
backlight_pin: GPIO4
|
||||
backlight_pin: no
|
||||
lambda: |-
|
||||
it.rectangle(0, 0, it.get_width(), it.get_height());
|
||||
- platform: st7920
|
||||
|
|
Loading…
Reference in a new issue