I don’t think you need to copy components/lvgl
since lvgl already exists under lv_bindings
.
Adding lvgl_esp32_drivers
is supposed to be enough.
Did you notice that lv_bindings
has its own lv_conf.h configuration file, which is different from lv_conf.h of lv_port_esp32?
You might need to create a new “lv_conf.h” which is a combination of both.
The lv_port_esp32 version depends on kconfig and probably configures your display driver parameters (such as SPI parameters).
The lv_bindings version contains some important definitions, specifically related to reusing Micropython Garbage Collector in LVGL.
There is actually a problem with including FT81x.h
in lvgl.h
.
FT81x.h itself already includes lvgl.h so it can’t be included from lvgl.h.
This is probably the source of the error you are seeing:
raise ParseError("%s: %s" % (coord, msg))
pycparser.plyparser.ParseError: ../../lib/lv_bindings/lvgl/src/lvgl_esp32_drivers/lvgl_tft/../lvgl_tft/disp_driver.h:69:45: before: *
It complains about a type that is defined in lvgl, but still undefined at this point in code after preprocessing.
To work around this, the simplest solution is not to include FT81x.h
in lvgl.h
.
Instead, you can add some extern
to the functions you need.
Something like that:
extern void disp_driver_init(void);
extern void disp_driver_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * color_map);
You can add this to lv_conf.h
if you want, instead of lvgl.h
.
One more thing worth noting:
The steps I’m describing here are the “quick and dirty” way to achieve what you want, but is not the regular way we develop drivers for Micropython.
One of the disadvantages of this “quick and dirty” method is that if you want to change some display parameters (such as the display interface pins, SPI configuration etc.) you would have to rebuild the firmware.
The “right” way to develop a Micropython driver, which requires a bit more effort, is to change the driver such that it receives all parameters on runtime. That allows the same firmware use the driver in different configurations, and provide the configuration in the Micropython script. This is how existing LVGL micropython drivers (such as ili9XXX) are designed.