Add constants used by multiple display drivers to global const.py (#6033)

* Add constants used by multiple display drivers to global const.py

* Add further constants

* Refactor st7789v and st7735v
This commit is contained in:
Clyde Stubbs
2023-12-29 13:00:19 +11:00
committed by GitHub
parent d4d49e38fc
commit 21ec42f495
6 changed files with 31 additions and 21 deletions
+8 -8
View File
@@ -17,6 +17,14 @@ from esphome.const import (
CONF_WIDTH,
CONF_HEIGHT,
CONF_ROTATION,
CONF_MIRROR_X,
CONF_MIRROR_Y,
CONF_SWAP_XY,
CONF_COLOR_ORDER,
CONF_OFFSET_HEIGHT,
CONF_OFFSET_WIDTH,
CONF_TRANSFORM,
CONF_INVERT_COLORS,
)
DEPENDENCIES = ["spi"]
@@ -70,14 +78,6 @@ COLOR_PALETTE = cv.one_of("NONE", "GRAYSCALE", "IMAGE_ADAPTIVE")
CONF_LED_PIN = "led_pin"
CONF_COLOR_PALETTE_IMAGES = "color_palette_images"
CONF_INVERT_DISPLAY = "invert_display"
CONF_INVERT_COLORS = "invert_colors"
CONF_MIRROR_X = "mirror_x"
CONF_MIRROR_Y = "mirror_y"
CONF_SWAP_XY = "swap_xy"
CONF_COLOR_ORDER = "color_order"
CONF_OFFSET_HEIGHT = "offset_height"
CONF_OFFSET_WIDTH = "offset_width"
CONF_TRANSFORM = "transform"
def _validate(config):
+4 -4
View File
@@ -5,6 +5,10 @@ from esphome.components import display
from esphome.const import (
CONF_LAMBDA,
CONF_RESET_PIN,
CONF_MIRROR_X,
CONF_MIRROR_Y,
CONF_TRANSFORM,
CONF_INVERT_COLORS,
)
CODEOWNERS = ["@latonita"]
@@ -14,10 +18,6 @@ ST7567 = st7567_base_ns.class_("ST7567", cg.PollingComponent, display.DisplayBuf
ST7567Model = st7567_base_ns.enum("ST7567Model")
# todo in future: reuse following constants from const.py when they are released
CONF_INVERT_COLORS = "invert_colors"
CONF_TRANSFORM = "transform"
CONF_MIRROR_X = "mirror_x"
CONF_MIRROR_Y = "mirror_y"
ST7567_SCHEMA = display.FULL_DISPLAY_SCHEMA.extend(
+1 -1
View File
@@ -10,6 +10,7 @@ from esphome.const import (
CONF_MODEL,
CONF_RESET_PIN,
CONF_PAGES,
CONF_INVERT_COLORS,
)
from . import st7735_ns
@@ -23,7 +24,6 @@ CONF_ROW_START = "row_start"
CONF_COL_START = "col_start"
CONF_EIGHT_BIT_COLOR = "eight_bit_color"
CONF_USE_BGR = "use_bgr"
CONF_INVERT_COLORS = "invert_colors"
SPIST7735 = st7735_ns.class_(
"ST7735", cg.PollingComponent, display.DisplayBuffer, spi.SPIDevice
+2 -2
View File
@@ -14,12 +14,12 @@ from esphome.const import (
CONF_POWER_SUPPLY,
CONF_ROTATION,
CONF_CS_PIN,
CONF_OFFSET_HEIGHT,
CONF_OFFSET_WIDTH,
)
from . import st7789v_ns
CONF_EIGHTBITCOLOR = "eightbitcolor"
CONF_OFFSET_HEIGHT = "offset_height"
CONF_OFFSET_WIDTH = "offset_width"
CODEOWNERS = ["@kbx81"]
+8 -6
View File
@@ -3,7 +3,14 @@ import esphome.codegen as cg
from esphome.components import display
from esphome import automation
from esphome.const import CONF_ON_TOUCH, CONF_ON_RELEASE
from esphome.const import (
CONF_ON_TOUCH,
CONF_ON_RELEASE,
CONF_MIRROR_X,
CONF_MIRROR_Y,
CONF_SWAP_XY,
CONF_TRANSFORM,
)
from esphome.core import coroutine_with_priority
CODEOWNERS = ["@jesserockz", "@nielsnl68"]
@@ -26,11 +33,6 @@ CONF_REPORT_INTERVAL = "report_interval" # not used yet:
CONF_ON_UPDATE = "on_update"
CONF_TOUCH_TIMEOUT = "touch_timeout"
CONF_MIRROR_X = "mirror_x"
CONF_MIRROR_Y = "mirror_y"
CONF_SWAP_XY = "swap_xy"
CONF_TRANSFORM = "transform"
def touchscreen_schema(default_touch_timeout):
return cv.Schema(