Selected drivers: make mode a bound variable

pull/48/head
Peter Hinch 2024-07-02 19:01:43 +01:00
rodzic 00c5edaf16
commit 2fc50107c0
5 zmienionych plików z 15 dodań i 15 usunięć

Wyświetl plik

@ -77,12 +77,12 @@ class GC9A01(framebuf.FrameBuffer):
self.width = width
self._spi_init = init_spi
self._gscale = False # Interpret buffer as index into color LUT
mode = framebuf.GS4_HMSB
self.palette = BoolPalette(mode)
self.mode = framebuf.GS4_HMSB
self.palette = BoolPalette(self.mode)
gc.collect()
buf = bytearray(height * width // 2) # Frame buffer
self.mvb = memoryview(buf)
super().__init__(buf, width, height, mode)
super().__init__(buf, width, height, self.mode)
self._linebuf = bytearray(width * 2) # Line buffer (16-bit colors)
# Hardware reset

Wyświetl plik

@ -63,12 +63,12 @@ class GC9A01(framebuf.FrameBuffer):
self.height = height # Logical dimensions for GUIs
self.width = width
self._spi_init = init_spi
mode = framebuf.GS8 # Use 8bit greyscale for 8 bit color.
self.palette = BoolPalette(mode)
self.mode = framebuf.GS8 # Use 8bit greyscale for 8 bit color.
self.palette = BoolPalette(self.mode)
gc.collect()
buf = bytearray(height * width) # Frame buffer
self.mvb = memoryview(buf)
super().__init__(buf, width, height, mode)
super().__init__(buf, width, height, self.mode)
self._linebuf = bytearray(width * 2) # Line buffer (16-bit colors)
# Hardware reset

Wyświetl plik

@ -62,12 +62,12 @@ class ILI9341(framebuf.FrameBuffer):
self.width = width
self._spi_init = init_spi
self._gscale = False # Interpret buffer as index into color LUT
mode = framebuf.GS4_HMSB
self.palette = BoolPalette(mode)
self.mode = framebuf.GS4_HMSB
self.palette = BoolPalette(self.mode)
gc.collect()
buf = bytearray(self.height * self.width // 2)
self.mvb = memoryview(buf)
super().__init__(buf, self.width, self.height, mode)
super().__init__(buf, self.width, self.height, self.mode)
self._linebuf = bytearray(self.width * 2)
# Hardware reset
self._rst(0)

Wyświetl plik

@ -92,12 +92,12 @@ class ILI9486(framebuf.FrameBuffer):
self._short = min(height, width)
self._spi_init = init_spi
self._gscale = False # Interpret buffer as index into color LUT
mode = framebuf.GS4_HMSB
self.palette = BoolPalette(mode)
self.mode = framebuf.GS4_HMSB
self.palette = BoolPalette(self.mode)
gc.collect()
buf = bytearray(height * width // 2)
self.mvb = memoryview(buf)
super().__init__(buf, width, height, mode) # Logical aspect ratio
super().__init__(buf, width, height, self.mode) # Logical aspect ratio
self._linebuf = bytearray(self._short * 2)
# Hardware reset

Wyświetl plik

@ -96,12 +96,12 @@ class ST7789(framebuf.FrameBuffer):
self._spi_init = init_spi # Possible user callback
self._lock = asyncio.Lock()
self._gscale = False # Interpret buffer as index into color LUT
mode = framebuf.GS4_HMSB # Use 4bit greyscale.
self.palette = BoolPalette(mode)
self.mode = framebuf.GS4_HMSB # Use 4bit greyscale.
self.palette = BoolPalette(self.mode)
gc.collect()
buf = bytearray(height * -(-width // 2)) # Ceiling division for odd widths
self.mvb = memoryview(buf)
super().__init__(buf, width, height, mode)
super().__init__(buf, width, height, self.mode)
self._linebuf = bytearray(self.width * 2) # 16 bit color out
self._init(disp_mode, orientation)
self.show()