Generic MIPI display driver and `user_data` access
Introduce the problem
Hi!
First things first, thank you for this amazing library!
Context
Currently developing a C++ app to manage filament spool and I thought it would be a great opportunity to start using LVGL. Hardware-wise we are talking about a Pico Pi W and a ST7789 display.
The problem
After giving a look at the codebase I saw that the user data field in lv_display_t would make a good candidate to store the class instance upon which to call the send_cmd and send_color callbacks.
Unfortunately in the case of the ST7789 driver and, by extension, the general MIPI driver, some calls to the callbacks are made before one is given the change to set the user_data field.
The only remaining way to define these callbacks is, AFAIK, to use static objects. This is suboptimal in my opinion.
Proposal
I was wondering if you guys would be open to splitting up the create function into two parts?
- a
createthat would return alv_display_tobject - an
initfunction that would perform the driver setup with calls the the callbacks
This would allow the user to insert user_data before the callbacks are called. Naming is just a proposition, we can be more inventive and ensure backward compatibility ;)
Side note: How many of us need more than one driver? This would be an argument against performing any change indeed.
Source: lvgl/lvgl