+ self._current_group = None
+ self._last_refresh_call = 0
+ self._refresh_thread = None
+ self._colorconverter = ColorConverter()
+
+ self._backlight_type = None
+ if backlight_pin is not None:
+ try:
+ from pwmio import PWMOut # pylint: disable=import-outside-toplevel
+
+ # 100Hz looks decent and doesn't keep the CPU too busy
+ self._backlight = PWMOut(backlight_pin, frequency=100, duty_cycle=0)
+ self._backlight_type = BACKLIGHT_PWM
+ except (ImportError, NotImplementedError):
+ # PWMOut not implemented on this platform
+ pass
+ if self._backlight_type is None:
+ self._backlight_type = BACKLIGHT_IN_OUT
+ self._backlight = digitalio.DigitalInOut(backlight_pin)
+ self._backlight.switch_to_output()
+ self.brightness = brightness
+ if not circuitpython_splash._in_group:
+ self._set_root_group(circuitpython_splash)
+ self.auto_refresh = auto_refresh
+
+ def __new__(cls, *args, **kwargs):
+ from . import ( # pylint: disable=import-outside-toplevel, cyclic-import
+ allocate_display,
+ )
+
+ display_instance = super().__new__(cls)
+ allocate_display(display_instance)
+ return display_instance
+