Hi @dahuanzi !
lv_port_indev_init are not part of core LVGL.
They are part of specific LVGL ports for specific drivers and architectures.
lv_micropython is a Micropython fork with core LVGL and does not include specific LVGL ports.
lv_port_indev_init are not available in lv_micropython.
Instead, it provides Python (or hybrid C/Python) drivers for different devices and architectures (such as ili9341 and ili9488 for esp32, ft5336 for STM32F7DISC, SDL and FB for linux etc.)
The main advantage of Python drivers over C drivers is the way they are configured. To change the configuration of C drivers you have to rebuild the firmware upon every configuration change (such as changing IO pins, changing display parameters etc.). On the other hand, on Micropython drivers you set all parameters on runtime from your Python script and there is no need to rebuild the firmware when you change anything.
So the idea is to have a single Micropython firmware image that could be used with different hardware devices and different configurations, and that’s the main reason Python drivers is the preferred approach.
But if you still want to use your own C drivers in lv_micropython, you can still do it.
You would need to:
- Build lv_micropython with your C driver. This requires changing the build script to compile and link your C driver into the Micropython firmware image.
- Create a Micropython binding to your C driver API.
This is usually very easy because the Micropython bindings are automatically generated. All you really need to do is to include your driver API C header from lvgl.h (or from any other header included from lvgl.h). The binding script would consider your driver API to be part of LVGL and automatically generate the code to allow you to call it from Micropython