The function is in lv_espidf.c
/*
* espidf extension definition for:
* esp_err_t esp_lcd_new_rgb_panel(const esp_lcd_rgb_panel_config_t *rgb_panel_config, esp_lcd_panel_handle_t *ret_panel)
*/
STATIC mp_obj_t mp_esp_lcd_new_rgb_panel(size_t mp_n_args, const mp_obj_t *mp_args, void *lv_func_ptr)
{
const esp_lcd_rgb_panel_config_t *rgb_panel_config = (const esp_lcd_rgb_panel_config_t *)mp_write_ptr_esp_lcd_rgb_panel_config_t(mp_args[0]);
esp_lcd_panel_handle_t *ret_panel = mp_to_ptr(mp_args[1]);
esp_err_t _res = ((esp_err_t (*)(const esp_lcd_rgb_panel_config_t *, esp_lcd_panel_handle_t *))lv_func_ptr)(rgb_panel_config, ret_panel);
return mp_obj_new_int(_res);
}
STATIC MP_DEFINE_CONST_LV_FUN_OBJ_VAR(mp_esp_lcd_new_rgb_panel_mpobj, 2, mp_esp_lcd_new_rgb_panel, esp_lcd_new_rgb_panel);
STATIC const mp_rom_map_elem_t mp_esp_lcd_rgb_panel_config_t_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR___SIZE__), MP_ROM_PTR(MP_ROM_INT(sizeof(esp_lcd_rgb_panel_config_t))) },
{ MP_ROM_QSTR(MP_QSTR_new_rgb_panel), MP_ROM_PTR(&mp_esp_lcd_new_rgb_panel_mpobj) },
};
STATIC MP_DEFINE_CONST_DICT(mp_esp_lcd_rgb_panel_config_t_locals_dict, mp_esp_lcd_rgb_panel_config_t_locals_dict_table);
STATIC const mp_rom_map_elem_t mp_esp_lcd_rgb_timing_t_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR___SIZE__), MP_ROM_PTR(MP_ROM_INT(sizeof(esp_lcd_rgb_timing_t))) },
};
STATIC MP_DEFINE_CONST_DICT(mp_esp_lcd_rgb_timing_t_locals_dict, mp_esp_lcd_rgb_timing_t_locals_dict_table);
STATIC const mp_rom_map_elem_t mp_esp_lcd_rgb_timing_flags_t_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR___SIZE__), MP_ROM_PTR(MP_ROM_INT(sizeof(esp_lcd_rgb_timing_flags_t))) },
};
STATIC MP_DEFINE_CONST_DICT(mp_esp_lcd_rgb_timing_flags_t_locals_dict, mp_esp_lcd_rgb_timing_flags_t_locals_dict_table);
STATIC const mp_rom_map_elem_t mp_esp_lcd_panel_t_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR___SIZE__), MP_ROM_PTR(MP_ROM_INT(sizeof(struct esp_lcd_panel_t))) },
};
STATIC MP_DEFINE_CONST_DICT(mp_esp_lcd_panel_t_locals_dict, mp_esp_lcd_panel_t_locals_dict_table);
STATIC const mp_rom_map_elem_t mp_esp_lcd_rgb_panel_config_flags_t_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR___SIZE__), MP_ROM_PTR(MP_ROM_INT(sizeof(esp_lcd_rgb_panel_config_flags_t))) },
};
STATIC MP_DEFINE_CONST_DICT(mp_esp_lcd_rgb_panel_config_flags_t_locals_dict, mp_esp_lcd_rgb_panel_config_flags_t_locals_dict_table);
Just after a working one (with less additional structs, but similar):
/*
* espidf extension definition for:
* esp_err_t esp_lcd_new_i80_bus(const esp_lcd_i80_bus_config_t *bus_config, esp_lcd_i80_bus_handle_t *ret_bus)
*/
STATIC mp_obj_t mp_esp_lcd_new_i80_bus(size_t mp_n_args, const mp_obj_t *mp_args, void *lv_func_ptr)
{
const esp_lcd_i80_bus_config_t *bus_config = (const esp_lcd_i80_bus_config_t *)mp_write_ptr_esp_lcd_i80_bus_config_t(mp_args[0]);
esp_lcd_i80_bus_handle_t *ret_bus = mp_to_ptr(mp_args[1]);
esp_err_t _res = ((esp_err_t (*)(const esp_lcd_i80_bus_config_t *, esp_lcd_i80_bus_handle_t *))lv_func_ptr)(bus_config, ret_bus);
return mp_obj_new_int(_res);
}
STATIC MP_DEFINE_CONST_LV_FUN_OBJ_VAR(mp_esp_lcd_new_i80_bus_mpobj, 2, mp_esp_lcd_new_i80_bus, esp_lcd_new_i80_bus);
STATIC const mp_rom_map_elem_t mp_esp_lcd_i80_bus_config_t_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR___SIZE__), MP_ROM_PTR(MP_ROM_INT(sizeof(esp_lcd_i80_bus_config_t))) },
{ MP_ROM_QSTR(MP_QSTR_new_i80_bus), MP_ROM_PTR(&mp_esp_lcd_new_i80_bus_mpobj) },
};
STATIC MP_DEFINE_CONST_DICT(mp_esp_lcd_i80_bus_config_t_locals_dict, mp_esp_lcd_i80_bus_config_t_locals_dict_table);
However, in the lv_espidf.json, it’s no more to be found, while the other is there
"esp_lcd_new_panel_io_i80": {
"type": "function",
"args": [
{
"type": "void*",
"name": "bus"
},
{
"type": "esp_lcd_panel_io_i80_config_t",
"name": "io_config"
},
{
"type": "void*",
"name": "ret_io"
}
],
"return_type": "int"
},
I got no warning with a clean build.
The esp_lcd_new_rgb_panel func is both in lv_espidf.c.pp and lv_espidf.c.pp.filtered
So this looks like an issue with gen_mpy not converting this func for some reason, likely one of the extra struct used.
As for the ->del issue, rather than modifying existing existing build stuff that everyone relies on, wouldn’t it be more generic to use a wrapper like someone suggested on another thread?
I supposed there is little chance esp changes its structs just for some python specific build, and mp changes a default build component for a specific hardware and esp lib not following its conventions, so dealing with it “by hand” with a wrapper would limit the scope of the required changes to the mp esp32-s3 boards only. Less elegant, but easier to follow, more guarantees it remains compatible with future mp versions.
Update
I can confirm this is because of the structs, maybe the timings inside the config.
I create a new func with hardcoded params to make sure, like
esp_err_t esp_lcd_new_testrgb_panel(esp_lcd_panel_handle_t *ret_panel) {
esp_lcd_rgb_panel_config_t *_panel_config = (esp_lcd_rgb_panel_config_t *)heap_caps_calloc(1, sizeof(esp_lcd_rgb_panel_config_t), MALLOC_CAP_DMA | MALLOC_CAP_INTERNAL);
_panel_config->clk_src = LCD_CLK_SRC_PLL160M;
_panel_config->timings.pclk_hz = 16000000L;
_panel_config->timings.h_res = 800;
_panel_config->timings.v_res = 600;
[...]
And there it’s exposed to MP.
Not a long term solution, but this will allow me to move on with further testing.
(init now crashes with corrupted stack trace)
Update2
I reverted to the working makerfabs.c specific driver for now, so I could test the touch driver.
I couldn’t get the generic display driver to properly work.
I issued a PR with some fixes and comments on the GT911 driver, there is also specific stuff with I2C on esp32s3 that needs a patch, see comments at file begin.
I also added comments with returned values in the code.
The TP interrupt pin is not used at all in the current implementation, is that ok?