Merge branch 'arch/drivers'
This commit is contained in:
commit
cd1a2178d0
32
README.md
32
README.md
@ -120,34 +120,22 @@ import lvgl as lv
|
||||
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.
|
||||
Here is an example of registering SDL drivers on Micropython unix port:
|
||||
|
||||
```python
|
||||
import SDL
|
||||
SDL.init()
|
||||
# Create an event loop and Register SDL display/mouse/keyboard drivers.
|
||||
from lv_utils import event_loop
|
||||
|
||||
# Register SDL display driver.
|
||||
WIDTH = 480
|
||||
HEIGHT = 320
|
||||
|
||||
draw_buf = lv.disp_draw_buf_t()
|
||||
buf1_1 = bytearray(480*10)
|
||||
draw_buf.init(buf1_1, None, len(buf1_1)//4)
|
||||
disp_drv = lv.disp_drv_t()
|
||||
disp_drv.init()
|
||||
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()
|
||||
event_loop = event_loop()
|
||||
disp_drv = lv.sdl_window_create(WIDTH, HEIGHT)
|
||||
mouse = lv.sdl_mouse_create()
|
||||
keyboard = lv.sdl_keyboard_create()
|
||||
keyboard.set_group(self.group)
|
||||
```
|
||||
|
||||
Here is an alternative example, for registering ILI9341 drivers on Micropython ESP32 port:
|
||||
|
||||
@ -1 +1 @@
|
||||
Subproject commit f960502a3260f795f21bfa90b2e7d7199430cf88
|
||||
Subproject commit 5659b1449ed8625a3cd64da7a9cb6ca235cfe9e3
|
||||
@ -99,7 +99,7 @@ else
|
||||
# Use gcc syntax for map file
|
||||
LDFLAGS_ARCH = -Wl,-Map=$@.map,--cref -Wl,--gc-sections
|
||||
endif
|
||||
LDFLAGS += $(LDFLAGS_MOD) $(LDFLAGS_ARCH) -lm $(LDFLAGS_EXTRA) -lSDL2
|
||||
LDFLAGS += $(LDFLAGS_MOD) $(LDFLAGS_ARCH) -lm $(LDFLAGS_EXTRA)
|
||||
|
||||
# Flags to link with pthread library
|
||||
LIBPTHREAD = -lpthread
|
||||
@ -219,6 +219,17 @@ endif
|
||||
|
||||
# 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_LDFLAGS_MOD := $(shell pkg-config --silence-errors --libs rlottie)
|
||||
ifneq ($(RLOTTIE_LDFLAGS_MOD),)
|
||||
@ -262,9 +273,6 @@ SRC_C += \
|
||||
$(wildcard $(VARIANT_DIR)/*.c)
|
||||
|
||||
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) \
|
||||
)
|
||||
|
||||
@ -274,12 +282,6 @@ SHARED_SRC_C += $(addprefix shared/,\
|
||||
$(SHARED_SRC_C_EXTRA) \
|
||||
)
|
||||
|
||||
ifneq ($(UNAME_S),Darwin)
|
||||
LIB_SRC_C += $(addprefix lib/,\
|
||||
lv_bindings/driver/linux/modfb.c \
|
||||
)
|
||||
endif
|
||||
|
||||
SRC_CXX += \
|
||||
$(SRC_MOD_CXX)
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user