mirror of
https://github.com/esphome/esphome.git
synced 2024-11-29 10:14:13 +01:00
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:
parent
d4d49e38fc
commit
21ec42f495
6 changed files with 31 additions and 21 deletions
|
@ -17,6 +17,14 @@ from esphome.const import (
|
||||||
CONF_WIDTH,
|
CONF_WIDTH,
|
||||||
CONF_HEIGHT,
|
CONF_HEIGHT,
|
||||||
CONF_ROTATION,
|
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"]
|
DEPENDENCIES = ["spi"]
|
||||||
|
@ -70,14 +78,6 @@ COLOR_PALETTE = cv.one_of("NONE", "GRAYSCALE", "IMAGE_ADAPTIVE")
|
||||||
CONF_LED_PIN = "led_pin"
|
CONF_LED_PIN = "led_pin"
|
||||||
CONF_COLOR_PALETTE_IMAGES = "color_palette_images"
|
CONF_COLOR_PALETTE_IMAGES = "color_palette_images"
|
||||||
CONF_INVERT_DISPLAY = "invert_display"
|
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):
|
def _validate(config):
|
||||||
|
|
|
@ -5,6 +5,10 @@ from esphome.components import display
|
||||||
from esphome.const import (
|
from esphome.const import (
|
||||||
CONF_LAMBDA,
|
CONF_LAMBDA,
|
||||||
CONF_RESET_PIN,
|
CONF_RESET_PIN,
|
||||||
|
CONF_MIRROR_X,
|
||||||
|
CONF_MIRROR_Y,
|
||||||
|
CONF_TRANSFORM,
|
||||||
|
CONF_INVERT_COLORS,
|
||||||
)
|
)
|
||||||
|
|
||||||
CODEOWNERS = ["@latonita"]
|
CODEOWNERS = ["@latonita"]
|
||||||
|
@ -14,10 +18,6 @@ ST7567 = st7567_base_ns.class_("ST7567", cg.PollingComponent, display.DisplayBuf
|
||||||
ST7567Model = st7567_base_ns.enum("ST7567Model")
|
ST7567Model = st7567_base_ns.enum("ST7567Model")
|
||||||
|
|
||||||
# todo in future: reuse following constants from const.py when they are released
|
# 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(
|
ST7567_SCHEMA = display.FULL_DISPLAY_SCHEMA.extend(
|
||||||
|
|
|
@ -10,6 +10,7 @@ from esphome.const import (
|
||||||
CONF_MODEL,
|
CONF_MODEL,
|
||||||
CONF_RESET_PIN,
|
CONF_RESET_PIN,
|
||||||
CONF_PAGES,
|
CONF_PAGES,
|
||||||
|
CONF_INVERT_COLORS,
|
||||||
)
|
)
|
||||||
from . import st7735_ns
|
from . import st7735_ns
|
||||||
|
|
||||||
|
@ -23,7 +24,6 @@ CONF_ROW_START = "row_start"
|
||||||
CONF_COL_START = "col_start"
|
CONF_COL_START = "col_start"
|
||||||
CONF_EIGHT_BIT_COLOR = "eight_bit_color"
|
CONF_EIGHT_BIT_COLOR = "eight_bit_color"
|
||||||
CONF_USE_BGR = "use_bgr"
|
CONF_USE_BGR = "use_bgr"
|
||||||
CONF_INVERT_COLORS = "invert_colors"
|
|
||||||
|
|
||||||
SPIST7735 = st7735_ns.class_(
|
SPIST7735 = st7735_ns.class_(
|
||||||
"ST7735", cg.PollingComponent, display.DisplayBuffer, spi.SPIDevice
|
"ST7735", cg.PollingComponent, display.DisplayBuffer, spi.SPIDevice
|
||||||
|
|
|
@ -14,12 +14,12 @@ from esphome.const import (
|
||||||
CONF_POWER_SUPPLY,
|
CONF_POWER_SUPPLY,
|
||||||
CONF_ROTATION,
|
CONF_ROTATION,
|
||||||
CONF_CS_PIN,
|
CONF_CS_PIN,
|
||||||
|
CONF_OFFSET_HEIGHT,
|
||||||
|
CONF_OFFSET_WIDTH,
|
||||||
)
|
)
|
||||||
from . import st7789v_ns
|
from . import st7789v_ns
|
||||||
|
|
||||||
CONF_EIGHTBITCOLOR = "eightbitcolor"
|
CONF_EIGHTBITCOLOR = "eightbitcolor"
|
||||||
CONF_OFFSET_HEIGHT = "offset_height"
|
|
||||||
CONF_OFFSET_WIDTH = "offset_width"
|
|
||||||
|
|
||||||
CODEOWNERS = ["@kbx81"]
|
CODEOWNERS = ["@kbx81"]
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,14 @@ import esphome.codegen as cg
|
||||||
|
|
||||||
from esphome.components import display
|
from esphome.components import display
|
||||||
from esphome import automation
|
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
|
from esphome.core import coroutine_with_priority
|
||||||
|
|
||||||
CODEOWNERS = ["@jesserockz", "@nielsnl68"]
|
CODEOWNERS = ["@jesserockz", "@nielsnl68"]
|
||||||
|
@ -26,11 +33,6 @@ CONF_REPORT_INTERVAL = "report_interval" # not used yet:
|
||||||
CONF_ON_UPDATE = "on_update"
|
CONF_ON_UPDATE = "on_update"
|
||||||
CONF_TOUCH_TIMEOUT = "touch_timeout"
|
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):
|
def touchscreen_schema(default_touch_timeout):
|
||||||
return cv.Schema(
|
return cv.Schema(
|
||||||
|
|
|
@ -127,6 +127,7 @@ CONF_COLOR_BRIGHTNESS = "color_brightness"
|
||||||
CONF_COLOR_CORRECT = "color_correct"
|
CONF_COLOR_CORRECT = "color_correct"
|
||||||
CONF_COLOR_INTERLOCK = "color_interlock"
|
CONF_COLOR_INTERLOCK = "color_interlock"
|
||||||
CONF_COLOR_MODE = "color_mode"
|
CONF_COLOR_MODE = "color_mode"
|
||||||
|
CONF_COLOR_ORDER = "color_order"
|
||||||
CONF_COLOR_PALETTE = "color_palette"
|
CONF_COLOR_PALETTE = "color_palette"
|
||||||
CONF_COLOR_TEMPERATURE = "color_temperature"
|
CONF_COLOR_TEMPERATURE = "color_temperature"
|
||||||
CONF_COLORS = "colors"
|
CONF_COLORS = "colors"
|
||||||
|
@ -370,6 +371,7 @@ CONF_INTERRUPT_PIN = "interrupt_pin"
|
||||||
CONF_INTERVAL = "interval"
|
CONF_INTERVAL = "interval"
|
||||||
CONF_INVALID_COOLDOWN = "invalid_cooldown"
|
CONF_INVALID_COOLDOWN = "invalid_cooldown"
|
||||||
CONF_INVERT = "invert"
|
CONF_INVERT = "invert"
|
||||||
|
CONF_INVERT_COLORS = "invert_colors"
|
||||||
CONF_INVERTED = "inverted"
|
CONF_INVERTED = "inverted"
|
||||||
CONF_IP_ADDRESS = "ip_address"
|
CONF_IP_ADDRESS = "ip_address"
|
||||||
CONF_IRQ_PIN = "irq_pin"
|
CONF_IRQ_PIN = "irq_pin"
|
||||||
|
@ -454,6 +456,8 @@ CONF_MIN_VALUE = "min_value"
|
||||||
CONF_MIN_VERSION = "min_version"
|
CONF_MIN_VERSION = "min_version"
|
||||||
CONF_MINUTE = "minute"
|
CONF_MINUTE = "minute"
|
||||||
CONF_MINUTES = "minutes"
|
CONF_MINUTES = "minutes"
|
||||||
|
CONF_MIRROR_X = "mirror_x"
|
||||||
|
CONF_MIRROR_Y = "mirror_y"
|
||||||
CONF_MISO_PIN = "miso_pin"
|
CONF_MISO_PIN = "miso_pin"
|
||||||
CONF_MODE = "mode"
|
CONF_MODE = "mode"
|
||||||
CONF_MODE_COMMAND_TOPIC = "mode_command_topic"
|
CONF_MODE_COMMAND_TOPIC = "mode_command_topic"
|
||||||
|
@ -485,6 +489,8 @@ CONF_NUMBER_DATAPOINT = "number_datapoint"
|
||||||
CONF_OFF_MODE = "off_mode"
|
CONF_OFF_MODE = "off_mode"
|
||||||
CONF_OFF_SPEED_CYCLE = "off_speed_cycle"
|
CONF_OFF_SPEED_CYCLE = "off_speed_cycle"
|
||||||
CONF_OFFSET = "offset"
|
CONF_OFFSET = "offset"
|
||||||
|
CONF_OFFSET_HEIGHT = "offset_height"
|
||||||
|
CONF_OFFSET_WIDTH = "offset_width"
|
||||||
CONF_ON = "on"
|
CONF_ON = "on"
|
||||||
CONF_ON_BLE_ADVERTISE = "on_ble_advertise"
|
CONF_ON_BLE_ADVERTISE = "on_ble_advertise"
|
||||||
CONF_ON_BLE_MANUFACTURER_DATA_ADVERTISE = "on_ble_manufacturer_data_advertise"
|
CONF_ON_BLE_MANUFACTURER_DATA_ADVERTISE = "on_ble_manufacturer_data_advertise"
|
||||||
|
@ -749,6 +755,7 @@ CONF_SUPPORTED_PRESETS = "supported_presets"
|
||||||
CONF_SUPPORTED_SWING_MODES = "supported_swing_modes"
|
CONF_SUPPORTED_SWING_MODES = "supported_swing_modes"
|
||||||
CONF_SUPPORTS_COOL = "supports_cool"
|
CONF_SUPPORTS_COOL = "supports_cool"
|
||||||
CONF_SUPPORTS_HEAT = "supports_heat"
|
CONF_SUPPORTS_HEAT = "supports_heat"
|
||||||
|
CONF_SWAP_XY = "swap_xy"
|
||||||
CONF_SWING_BOTH_ACTION = "swing_both_action"
|
CONF_SWING_BOTH_ACTION = "swing_both_action"
|
||||||
CONF_SWING_HORIZONTAL_ACTION = "swing_horizontal_action"
|
CONF_SWING_HORIZONTAL_ACTION = "swing_horizontal_action"
|
||||||
CONF_SWING_MODE = "swing_mode"
|
CONF_SWING_MODE = "swing_mode"
|
||||||
|
@ -799,6 +806,7 @@ CONF_TOPIC_PREFIX = "topic_prefix"
|
||||||
CONF_TOTAL = "total"
|
CONF_TOTAL = "total"
|
||||||
CONF_TOTAL_POWER = "total_power"
|
CONF_TOTAL_POWER = "total_power"
|
||||||
CONF_TRACES = "traces"
|
CONF_TRACES = "traces"
|
||||||
|
CONF_TRANSFORM = "transform"
|
||||||
CONF_TRANSITION_LENGTH = "transition_length"
|
CONF_TRANSITION_LENGTH = "transition_length"
|
||||||
CONF_TRIGGER_ID = "trigger_id"
|
CONF_TRIGGER_ID = "trigger_id"
|
||||||
CONF_TRIGGER_PIN = "trigger_pin"
|
CONF_TRIGGER_PIN = "trigger_pin"
|
||||||
|
|
Loading…
Reference in a new issue