lvgl_esp32_drivers
lvgl_esp32_drivers copied to clipboard
Add drivers configuration file
This PR is intended to enable driver using a header file, we will also need to update the Kconfig files, so the users can enable drivers by the menuconfig tool. The CMakeLists.txt file will also need to be updated.
Any suggestions @kisvegabor @embeddedt ?
I apologize for my forgetfulness, but the long-term plan is to eventually merge this and lv_drivers together, right?
That's no problem @embeddedt, the plan for this repo is to have lv_drivers as a submodule and provide the necessary code so the drivers can be used on the ESP32.
On the other PR I tried to move all the platform dependent code into one place, so we can work towards generic drivers.
I have a proof of concept here, where the user_data field of lv_disp_drv_t is used to pass user callbacks, so the driver can use them, like here:
void ili9341_reset(lv_disp_drv_t *drv)
{
driver_generic_t *driver = (driver_generic_t *) drv->user_data;
/* Reset the display */
if (driver->hw_reset) {
driver->hw_reset(drv);
} else {
/* Software reset when no hw_reset user callback is available */
ili9341_send_cmd(drv, ILI9341_CMD_SWRESET);
driver->delay_ms(drv, 5);
}
}
The user callbacks should be responsible of sending the data to the display, it's just an approach, nothing is decided yet.
@C47D
I have a proof of concept here, where the user_data field of lv_disp_drv_t is used to pass user callbacks, so the driver can use them, like here:
I like the idea of adding the low level driver/interface callbacks to user_data.
I assume in the end you have also imagined somehing like this:
driver_generic_t ili9341_driver = {...};
lv_disp_drv_t disp_drv;
/* `flush_cb`, `rounder_cb`, `set_px_cb`, and `user_data` correctly*/
lv_drv_ili9341_create(&disp_drv, &ili9341_driver, /*other params if required?*/);