Updates for new driver API

This commit is contained in:
Amir Gonnen 2023-03-11 00:24:40 +02:00
parent fd21cf3287
commit 67c953aa27
2 changed files with 11 additions and 23 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 9fbece5520de81f5dfea8aacb43bc5463fab69c4 Subproject commit 476dbdbe3e18ced26029a1e69de7fcae15abb5e5