mirror of
https://github.com/esphome/esphome.git
synced 2025-07-29 14:46:40 +00:00
[mipi] Keep models from different drivers separate (#9865)
This commit is contained in:
parent
c74f12be98
commit
568e774116
@ -234,6 +234,15 @@ class DriverChip:
|
|||||||
self.defaults = defaults
|
self.defaults = defaults
|
||||||
DriverChip.models[name] = self
|
DriverChip.models[name] = self
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def get_models(cls):
|
||||||
|
"""
|
||||||
|
Return the current set of models and reset the models dictionary.
|
||||||
|
"""
|
||||||
|
models = cls.models
|
||||||
|
cls.models = {}
|
||||||
|
return models
|
||||||
|
|
||||||
def extend(self, name, **kwargs) -> "DriverChip":
|
def extend(self, name, **kwargs) -> "DriverChip":
|
||||||
defaults = self.defaults.copy()
|
defaults = self.defaults.copy()
|
||||||
if (
|
if (
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
|
import importlib
|
||||||
import logging
|
import logging
|
||||||
|
import pkgutil
|
||||||
|
|
||||||
from esphome import pins
|
from esphome import pins
|
||||||
import esphome.codegen as cg
|
import esphome.codegen as cg
|
||||||
@ -52,8 +54,7 @@ from esphome.core import CORE
|
|||||||
from esphome.cpp_generator import TemplateArguments
|
from esphome.cpp_generator import TemplateArguments
|
||||||
from esphome.final_validate import full_config
|
from esphome.final_validate import full_config
|
||||||
|
|
||||||
from . import CONF_BUS_MODE, CONF_SPI_16, DOMAIN
|
from . import CONF_BUS_MODE, CONF_SPI_16, DOMAIN, models
|
||||||
from .models import adafruit, amoled, cyd, ili, jc, lanbon, lilygo, waveshare
|
|
||||||
|
|
||||||
DEPENDENCIES = ["spi"]
|
DEPENDENCIES = ["spi"]
|
||||||
|
|
||||||
@ -91,10 +92,11 @@ BusTypes = {
|
|||||||
|
|
||||||
DriverChip("CUSTOM")
|
DriverChip("CUSTOM")
|
||||||
|
|
||||||
MODELS = DriverChip.models
|
# Import all models dynamically from the models package
|
||||||
# This loop is a noop, but suppresses linting of side-effect-only imports
|
for module_info in pkgutil.iter_modules(models.__path__):
|
||||||
for _ in (ili, jc, amoled, lilygo, lanbon, cyd, waveshare, adafruit):
|
importlib.import_module(f".models.{module_info.name}", package=__package__)
|
||||||
pass
|
|
||||||
|
MODELS = DriverChip.get_models()
|
||||||
|
|
||||||
|
|
||||||
DISPLAY_18BIT = "18bit"
|
DISPLAY_18BIT = "18bit"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user