It took me several days to read and partly understood the content of the doc you had given me.
I also did some research and reading in lib/lv_bindings/driver and indeed, as u said, the current lvgl only supports esp32, SDL, and linux. As I walked through lib/lv_bindings/driver/esp32, there are several files: ili9341.py and modILI9341.c or xpt2046.py and modxpt2046.c (I did some research and ILI9341 and xpt2046 are screen modules). I guess these are the files I base on to write driver for the screen of my board.
I also see espidf.c and .h . I guess i dont need this. And modrtch.c i don’t need this too due to my screen is not a resistive touch driver.
The first thing you need to decide is whether you want to develop a pure micropython display driver or a C display driver.
As a reference, ili9341.py is a pure python display driver and modILI9341.c is a C display driver.
I believe STM32F4 Discovery already has a C lvgl driver (non micropython) but I’m not sure for which display hardware exactly, and whether it is up to date. @embeddedt /@kisvegabor - could you give more information about existing STM32F4 Discovery display drivers?
So as the first step, please try to run lvgl C code (without Micropython) on your stm32 and display hardware and make sure you have a working lvgl C display driver.
The next step would be to use this driver with micropython.
In order to use a C display driver in micropython, it would need the following changes:
Parameters should be set on runtime not compile time. For example, when you set SPI ports on C driver you usually use #define to declare them, so they are set during compile time.
On a micropython driver on the other hand, you need to receive port numbers as function arguments that can be set on runtime.
The existing drivers for STM32 discovery boards are provided as components of the pre-made projects. They are built to work with the STM32Cube infrastructure. Significant work is probably necessary to adapt them to MicroPython.
The standalone drivers in the lv_drivers repository are not dependent on Cube and may be easier to work with, but only if your chipset is already supported.
The first thing you need to decide is whether you want to develop a pure micropython display driver or a C display driver. Files are written in C language and then they are translated into Micropython modules. Also I have just started this project for 2 months. So I am a bit confused which one to choose.
As I suggested, try to run lvgl C code (without Micropython) on your stm32 and display hardware and make sure you have a working lvgl C display driver .
After you have lvgl running with your display, I’ll explain what you need to do in order to use it with micropython.
As @embeddedt suggested, start with a driver from lv_drivers, which matches (or as close to) your hardware.
So you mean that there exists an already-made display driver for STM32 discovery boards? and this driver is written in C so that I could use it via STM32Cube? Where can i find this driver?
As i read through the link of Github you gave, there are several drivers for some display modules. But mine display module (MB1314) is not supported. So i guess i have to write a new driver.
By “close” I mean displays with the same controller or almost the same controller, such as ILI9488 and ILI9341. Their initialization is different, but commands are the same.
I’m not familiar with MB1314. I suggest you search the internet and ST resources for a driver example.
For example, a quick search on GitHub for RM67162 (which is the controller of MB1314 according to your datasheet) brings multiple results:
As you talk about the lvgl C code, I realize that our team did that before at the very beginning of this project. As we upgraded the the library of STM32L4 for the Github repo of lv_micropython from1.8 to 1.14, we come across this rar file from this link:
Inside the link, there is not only the upgraded 1.14 library, but also some examples for us to interact with the screen: (As you download and extract the file), it is in: STM32Cube_FW_L4_V1.14.0/Projects/32L4R9IDISC/Examples.
Is that the thing you mentioned and suggested me to do? If so, yes we can turn on the screen and interact with it. (the demonstration is STemWin).
Turning the screen on and interacting with it would be the first step.
The second step is to use it with lvgl (C code)
The third step is to bind it to lv_micropython.
I got your idea. I will start the second step and update as i finish it.
However, there are some difficulties as the screen on the only board i have was broken. I got a display module of STM32L4R9I Eval. Meanwhile, my board is STM32L4R9I Discovery. Our team is trying to modify the module to run it on the Disco board.
There are LittlevGL drivers for STM32 discovery boards that use STM32Cube. I’m not sure how difficult they would be to integrate with MicroPython, but they would certainly be more work than a bare-metal driver with no dependencies.
To find them I suggest searching for the name of your chip here. In that example I searched for “stm32f429” and got the STM32F429-DISCO project. I believe there is also one for F469.
Or do you mean that I also need to write "#include “lv_conf.h” " in some file?
I am also a bit confused about the line " Include lvgl/lvgl.h where you need to use LittlevGL related functions.". I put "#include “…/lvgl/lvgl.h” " in main.c file. Is that the right thing to do?
It’s a bit hard for me to know your exact project setup, particularly since you’re creating it from scratch.
What I can suggest is that you check whether that lv_conf.h file is actually being included properly (an #error directive added to its first line should tell you that quickly).