Files
displaylvgl/main.py
2025-10-16 21:39:25 +03:00

40 lines
846 B
Python

from micropython import const # NOQA
import lcd_bus # NOQA
_WIDTH = const(480)
_HEIGHT = const(320)
bus = lcd_bus.SDLBus(flags=0)
buf1 = bus.allocate_framebuffer(_WIDTH * _HEIGHT * 3, 0)
import lvgl as lv # NOQA
import sdl_display # NOQA
display = sdl_display.SDLDisplay(
data_bus=bus,
display_width=_WIDTH,
display_height=_HEIGHT,
frame_buffer1=buf1,
color_space=lv.COLOR_FORMAT.RGB888
)
display.init()
import sdl_pointer
import task_handler
mouse = sdl_pointer.SDLPointer()
# the duration needs to be set to 5 to have a good response from the mouse.
# There is a thread that runs that facilitates double buffering.
th = task_handler.TaskHandler(duration=5)
scrn = lv.screen_active()
scrn.set_style_bg_color(lv.color_hex(0x000000), 0)
slider = lv.slider(scrn)
slider.set_size(300, 25)
slider.center()
input()