Hi, all I’m trying to use multiple display with lv_port_esp32 lib and lvgl_esp32_drivers
Both displays are shared the same SPI (SCL, SDA, DC) control by different CS pins (14 & 15)
I have modified the lvgl_helpers.c to allow register both displays
disp_spi_add_device(TFT_SPI_HOST,15);
disp_driver_init();
static lv_color_t buf1[DISP_BUF_SIZE];
static lv_color_t buf2[DISP_BUF_SIZE];
static lv_disp_buf_t disp_buf;
uint32_t size_in_px = DISP_BUF_SIZE;
lv_disp_buf_init(&disp_buf, buf1, buf2, size_in_px);
lv_disp_drv_t disp_drv;
lv_disp_drv_init(&disp_drv);
disp_drv.flush_cb = disp_driver_flush;
disp_drv.buffer = &disp_buf;
dis1 = lv_disp_drv_register(&disp_drv);
//dis1 = lv_disp_get_default();
disp_spi_add_device(TFT_SPI_HOST,14);
disp_driver_init();
static lv_color_t buf21[DISP_BUF_SIZE];
static lv_color_t buf22[DISP_BUF_SIZE];
static lv_disp_buf_t disp_buf2;
lv_disp_buf_init(&disp_buf2, buf21, buf22, DISP_BUF_SIZE);
lv_disp_drv_t disp_drv2;
lv_disp_drv_init(&disp_drv2);
disp_drv2.flush_cb = disp_driver_flush;
disp_drv2.buffer = &disp_buf2;
dis2 = lv_disp_drv_register(&disp_drv2);
As well the disp_spi.c to allow spi_bus_add_device for different CS pin
void disp_spi_add_device_with_speed(spi_host_device_t host, int clock_speed_hz, int cs_pin)
{
ESP_LOGI(TAG, "Adding SPI device");
ESP_LOGI(TAG, "Clock speed: %dHz, mode: %d, CS pin: %d",
clock_speed_hz, SPI_TFT_SPI_MODE, cs_pin);
spi_device_interface_config_t devcfg={
.clock_speed_hz = clock_speed_hz,
.mode = SPI_TFT_SPI_MODE,
// .mode = 3,
.spics_io_num=cs_pin, // CS pin
//.spics_io_num=-1,
.input_delay_ns=DISP_SPI_INPUT_DELAY_NS,
.queue_size=1,
.pre_cb=NULL,
.post_cb=NULL,
#if defined (CONFIG_LVGL_TFT_DISPLAY_CONTROLLER_FT81X)
.flags = 0,
#elif defined (CONFIG_LVGL_TFT_DISPLAY_CONTROLLER_RA8875)
.flags = SPI_DEVICE_NO_DUMMY,
#else
//.flags = SPI_DEVICE_NO_DUMMY | SPI_DEVICE_HALFDUPLEX,
#endif
};
disp_spi_add_device_config(host, &devcfg);
}
With use of lv_obj_t *scr1 = lv_disp_get_scr_act(dis1) & lv_obj_t *scr1 = lv_disp_get_scr_act(dis2)
To switch between displays, however, only the last init display shows graphs
I suspect the dis1 and dis2 are the same, is there any way to tell which is which by printout display information?
Cheers!