This commit is contained in:
jeremygan2021
2026-03-03 23:40:33 +08:00
parent f0d44b7290
commit 415cc9df97
6 changed files with 228 additions and 60 deletions

View File

@@ -298,11 +298,11 @@ class ST77xx:
class ST7789(ST77xx):
def init(self, *, color_mode=ColorMode_65K | ColorMode_16bit):
def init(self, *, color_mode=ColorMode_65K | ColorMode_16bit, is_bgr=False):
super().init()
self._set_color_mode(color_mode)
delay_ms(50)
self._set_mem_access_mode(4, True, True, False)
self._set_mem_access_mode(4, True, True, is_bgr)
self.inversion_mode(True)
delay_ms(10)
self.write(ST77XX_NORON)

File diff suppressed because one or more lines are too long

Binary file not shown.

Binary file not shown.

View File

@@ -684,9 +684,9 @@ def generate_image(prompt, progress_callback=None, retry_count=0, max_retries=2)
b5 = (b >> 3) & 0x1F
# Pack as Big Endian (>H) which is standard for SPI displays
# BGR565: Blue(5) Green(6) Red(5)
bgr565 = (b5 << 11) | (g6 << 5) | r5
rgb565_data.extend(struct.pack('>H', bgr565))
# RGB565: Red(5) Green(6) Blue(5)
rgb565 = (r5 << 11) | (g6 << 5) | b5
rgb565_data.extend(struct.pack('>H', rgb565))
# 保存为.bin文件
with open(GENERATED_THUMB_FILE, 'wb') as f: