Merge branch 'arch/drivers'

This commit is contained in:
Amir Gonnen 2023-03-11 00:42:14 +02:00
commit cd1a2178d0
3 changed files with 23 additions and 33 deletions

View File

@ -120,34 +120,22 @@ import lvgl as lv
lv.init() lv.init()
``` ```
Then display driver and input driver needs to be registered. Then event loop, display driver and input driver needs to be registered.
Refer to [Porting the library](https://docs.lvgl.io/8.0/porting/index.html) for more information. Refer to [Porting the library](https://docs.lvgl.io/8.0/porting/index.html) for more information.
Here is an example of registering SDL drivers on Micropython unix port: Here is an example of registering SDL drivers on Micropython unix port:
```python ```python
import SDL # Create an event loop and Register SDL display/mouse/keyboard drivers.
SDL.init() from lv_utils import event_loop
# Register SDL display driver. WIDTH = 480
HEIGHT = 320
draw_buf = lv.disp_draw_buf_t() event_loop = event_loop()
buf1_1 = bytearray(480*10) disp_drv = lv.sdl_window_create(WIDTH, HEIGHT)
draw_buf.init(buf1_1, None, len(buf1_1)//4) mouse = lv.sdl_mouse_create()
disp_drv = lv.disp_drv_t() keyboard = lv.sdl_keyboard_create()
disp_drv.init() keyboard.set_group(self.group)
disp_drv.draw_buf = draw_buf
disp_drv.flush_cb = SDL.monitor_flush
disp_drv.hor_res = 480
disp_drv.ver_res = 320
disp_drv.register()
# Regsiter SDL mouse driver
indev_drv = lv.indev_drv_t()
indev_drv.init()
indev_drv.type = lv.INDEV_TYPE.POINTER
indev_drv.read_cb = SDL.mouse_read
indev_drv.register()
``` ```
Here is an alternative example, for registering ILI9341 drivers on Micropython ESP32 port: Here is an alternative example, for registering ILI9341 drivers on Micropython ESP32 port:

@ -1 +1 @@
Subproject commit f960502a3260f795f21bfa90b2e7d7199430cf88 Subproject commit 5659b1449ed8625a3cd64da7a9cb6ca235cfe9e3

View File

@ -99,7 +99,7 @@ else
# Use gcc syntax for map file # Use gcc syntax for map file
LDFLAGS_ARCH = -Wl,-Map=$@.map,--cref -Wl,--gc-sections LDFLAGS_ARCH = -Wl,-Map=$@.map,--cref -Wl,--gc-sections
endif endif
LDFLAGS += $(LDFLAGS_MOD) $(LDFLAGS_ARCH) -lm $(LDFLAGS_EXTRA) -lSDL2 LDFLAGS += $(LDFLAGS_MOD) $(LDFLAGS_ARCH) -lm $(LDFLAGS_EXTRA)
# Flags to link with pthread library # Flags to link with pthread library
LIBPTHREAD = -lpthread LIBPTHREAD = -lpthread
@ -219,6 +219,17 @@ endif
# Additional optional libraries # Additional optional libraries
ifneq ($(UNAME_S),Darwin)
CFLAGS_MOD += -DMICROPY_FB=1
endif
SDL_CFLAGS_MOD := $(shell pkg-config --silence-errors --cflags sdl2)
SDL_LDFLAGS_MOD := $(shell pkg-config --silence-errors --libs sdl2)
ifneq ($(SDL_LDFLAGS_MOD),)
CFLAGS_MOD += $(SDL_CFLAGS_MOD) -DMICROPY_SDL=1
LDFLAGS_MOD += $(SDL_LDFLAGS_MOD)
endif
RLOTTIE_CFLAGS_MOD := $(shell pkg-config --silence-errors --cflags rlottie) RLOTTIE_CFLAGS_MOD := $(shell pkg-config --silence-errors --cflags rlottie)
RLOTTIE_LDFLAGS_MOD := $(shell pkg-config --silence-errors --libs rlottie) RLOTTIE_LDFLAGS_MOD := $(shell pkg-config --silence-errors --libs rlottie)
ifneq ($(RLOTTIE_LDFLAGS_MOD),) ifneq ($(RLOTTIE_LDFLAGS_MOD),)
@ -262,9 +273,6 @@ SRC_C += \
$(wildcard $(VARIANT_DIR)/*.c) $(wildcard $(VARIANT_DIR)/*.c)
LIB_SRC_C += $(addprefix lib/,\ LIB_SRC_C += $(addprefix lib/,\
lv_bindings/driver/SDL/sdl_common.c \
lv_bindings/driver/SDL/sdl.c \
lv_bindings/driver/SDL/modSDL.c \
$(LIB_SRC_C_EXTRA) \ $(LIB_SRC_C_EXTRA) \
) )
@ -274,12 +282,6 @@ SHARED_SRC_C += $(addprefix shared/,\
$(SHARED_SRC_C_EXTRA) \ $(SHARED_SRC_C_EXTRA) \
) )
ifneq ($(UNAME_S),Darwin)
LIB_SRC_C += $(addprefix lib/,\
lv_bindings/driver/linux/modfb.c \
)
endif
SRC_CXX += \ SRC_CXX += \
$(SRC_MOD_CXX) $(SRC_MOD_CXX)