First step - try to build lv_micropython with your driver.
lv_micropython now supports stm32, see this PR:
Add the relevant files (your display.c file as well as the necessary BSP files) to the stm32 makefile and try to build and deploy it.
Another option, if you don’t want to change stm32 Makefile, is to add your code an en extenral module as explained here:
You should be able to get the micropython prompt (through UART).
Try to import lvstm32 and lvgl.
Next step, if everything builds and works fine, you need a way to call your driver functions from Micropython. This is done by creating a micropython module that wraps your display driver.
From your code it looks like your driver gets no parameters. How do you configure it? set its IO pins etc? In Micropython all these are usually set on runtime.
Once you decide how your module should look like (which parameters it should receive), please have a look at https://micropython-usermod.readthedocs.io/en/latest/usermods_05.html. That’s a guide that explains how to add micropython user module and how to build it.
My suggestion is to have an
init function which receives the parameters to configure your driver, and a
deinit function to remove the driver.
You can call
lv_disp_drv_register in your init function (like you do in your
display.c), but another option is to call
lv.disp_drv_register in micropython and let the driver provide a pointer to
flush_cb, like is done on ili9341 driver on ESP32.