diff --git a/boards b/boards index 2e6532d..0e471db 160000 --- a/boards +++ b/boards @@ -1 +1 @@ -Subproject commit 2e6532dbfaaf54f81e6dee67efc22d8eb8cfe0a3 +Subproject commit 0e471dbb1a687e0df9b8f14f2365feb6f2ae9df0 diff --git a/include/esp_lcd_touch_cst816s.h b/include/esp_lcd_touch_cst816s.h index eecec05..ecc05af 100644 --- a/include/esp_lcd_touch_cst816s.h +++ b/include/esp_lcd_touch_cst816s.h @@ -2,6 +2,9 @@ #include +// I2C Address +#define CST816S_IO_I2C_CONFIG_DEV_ADDRESS_15 0x15 // 0x15 (0x2A/0x2B): INT High during reset or + #ifdef __cplusplus extern "C" { diff --git a/src/esp_lcd_touch_cst816s.c b/src/esp_lcd_touch_cst816s.c index ea88a95..5b430a6 100644 --- a/src/esp_lcd_touch_cst816s.c +++ b/src/esp_lcd_touch_cst816s.c @@ -117,7 +117,7 @@ extern "C" return res; } - log_d("CST816S Id: 0x$02X", info.id); + log_d("CST816S Id: 0x%02X", info.id); log_d("CST816S Project id: %d", info.projectId); log_d("CST816S Firmware version: %d", info.fwVersion); @@ -216,7 +216,7 @@ extern "C" } esp_err_t res; - const esp_lcd_touch_handle_t th = heap_caps_aligned_alloc(1, sizeof(esp_lcd_touch_t), MALLOC_CAP_DEFAULT); + const esp_lcd_touch_handle_t th = heap_caps_calloc(1, sizeof(esp_lcd_touch_t), MALLOC_CAP_DEFAULT); if (th == NULL) { log_e("No memory available for esp_lcd_touch_t"); diff --git a/src/lvgl_gc9a01_spi.c b/src/lvgl_gc9a01_spi.c index 4878333..54df0ac 100644 --- a/src/lvgl_gc9a01_spi.c +++ b/src/lvgl_gc9a01_spi.c @@ -45,10 +45,11 @@ void lvgl_lcd_init(lv_disp_drv_t *drv) .max_transfer_sz = GC9A01_SPI_BUS_MAX_TRANSFER_SZ, .flags = GC9A01_SPI_BUS_FLAGS, .intr_flags = GC9A01_SPI_BUS_INTR_FLAGS}; + log_d("spi_bus_config: mosi_io_num:%d, miso_io_num:%d, sclk_io_num:%d, quadwp_io_num:%d, quadhd_io_num:%d, max_transfer_sz:%d, flags:0x%08x, intr_flags:0x%04x", spi_bus_config.mosi_io_num, spi_bus_config.miso_io_num, spi_bus_config.sclk_io_num, spi_bus_config.quadwp_io_num, spi_bus_config.quadhd_io_num, spi_bus_config.max_transfer_sz, spi_bus_config.flags, spi_bus_config.intr_flags); ESP_ERROR_CHECK_WITHOUT_ABORT(spi_bus_initialize(GC9A01_SPI_HOST, &spi_bus_config, GC9A01_SPI_DMA_CHANNEL)); // Attach the LCD controller to the SPI bus - const esp_lcd_panel_io_spi_config_t io_config = { + const esp_lcd_panel_io_spi_config_t io_spi_config = { .cs_gpio_num = GC9A01_SPI_CONFIG_CS_GPIO_NUM, .dc_gpio_num = GC9A01_SPI_CONFIG_DC_GPIO_NUM, .spi_mode = GC9A01_SPI_CONFIG_SPI_MODE, @@ -63,8 +64,9 @@ void lvgl_lcd_init(lv_disp_drv_t *drv) .dc_low_on_data = GC9A01_SPI_CONFIG_FLAGS_DC_LOW_ON_DATA, .octal_mode = GC9A01_SPI_CONFIG_FLAGS_OCTAL_MODE, .lsb_first = GC9A01_SPI_CONFIG_FLAGS_LSB_FIRST}}; + log_d("io_spi_config: cs_gpio_num:%d, dc_gpio_num:%d, spi_mode:%d, pclk_hz:%d, trans_queue_depth:%d, user_ctx:0x%08x, on_color_trans_done:0x%08x, lcd_cmd_bits:%d, lcd_param_bits:%d, flags.dc_as_cmd_phase:%d, flags.dc_low_on_data:%d, flags.octal_mode:%d, flags.lsb_first:%d", io_spi_config.cs_gpio_num, io_spi_config.dc_gpio_num, io_spi_config.spi_mode, io_spi_config.pclk_hz, io_spi_config.trans_queue_depth, io_spi_config.user_ctx, io_spi_config.on_color_trans_done, io_spi_config.lcd_cmd_bits, io_spi_config.lcd_param_bits, io_spi_config.flags.dc_as_cmd_phase, io_spi_config.flags.dc_low_on_data, io_spi_config.flags.octal_mode, io_spi_config.flags.lsb_first); esp_lcd_panel_io_handle_t io_handle; - ESP_ERROR_CHECK(esp_lcd_new_panel_io_spi((esp_lcd_spi_bus_handle_t)GC9A01_SPI_HOST, &io_config, &io_handle)); + ESP_ERROR_CHECK(esp_lcd_new_panel_io_spi((esp_lcd_spi_bus_handle_t)GC9A01_SPI_HOST, &io_spi_config, &io_handle)); // Create gc9a01 panel handle const esp_lcd_panel_dev_config_t panel_dev_config = { @@ -74,6 +76,7 @@ void lvgl_lcd_init(lv_disp_drv_t *drv) .flags = { .reset_active_high = GC9A01_DEV_CONFIG_FLAGS_RESET_ACTIVE_HIGH}, .vendor_config = GC9A01_DEV_CONFIG_VENDOR_CONFIG}; + log_d("panel_dev_config: reset_gpio_num:%d, color_space:%d, bits_per_pixel:%d, flags.reset_active_high:%d, vendor_config: 0x%08x", panel_dev_config.reset_gpio_num, panel_dev_config.color_space, panel_dev_config.bits_per_pixel, panel_dev_config.flags.reset_active_high, panel_dev_config.vendor_config); esp_lcd_panel_handle_t panel_handle; ESP_ERROR_CHECK(esp_lcd_new_panel_gc9a01(io_handle, &panel_dev_config, &panel_handle)); diff --git a/src/lvgl_xpt2046_spi.c b/src/lvgl_xpt2046_spi.c index 6de1827..bd728ff 100644 --- a/src/lvgl_xpt2046_spi.c +++ b/src/lvgl_xpt2046_spi.c @@ -38,6 +38,7 @@ void lvgl_touch_init(lv_indev_drv_t *drv) .sclk_io_num = XPT2046_SPI_BUS_SCLK_IO_NUM, .quadwp_io_num = XPT2046_SPI_BUS_QUADWP_IO_NUM, .quadhd_io_num = XPT2046_SPI_BUS_QUADHD_IO_NUM}; + log_d("spi_bus_config: mosi_io_num:%d, miso_io_num:%d, sclk_io_num:%d, quadwp_io_num:%d, quadhd_io_num:%d, max_transfer_sz:%d, flags:0x%08x, intr_flags:0x%04x", spi_bus_config.mosi_io_num, spi_bus_config.miso_io_num, spi_bus_config.sclk_io_num, spi_bus_config.quadwp_io_num, spi_bus_config.quadhd_io_num, spi_bus_config.max_transfer_sz, spi_bus_config.flags, spi_bus_config.intr_flags); ESP_ERROR_CHECK_WITHOUT_ABORT(spi_bus_initialize(XPT2046_SPI_HOST, &spi_bus_config, XPT2046_SPI_DMA_CHANNEL)); // Attach the touch controller to the SPI bus @@ -55,6 +56,7 @@ void lvgl_touch_init(lv_indev_drv_t *drv) .dc_low_on_data = XPT2046_SPI_CONFIG_FLAGS_DC_LOW_ON_DATA, .octal_mode = XPT2046_SPI_CONFIG_FLAGS_OCTAL_MODE, .lsb_first = XPT2046_SPI_CONFIG_FLAGS_LSB_FIRST}}; + log_d("io_config: cs_gpio_num:%d, dc_gpio_num:%d, spi_mode:%d, pclk_hz:%d, trans_queue_depth:%d, user_ctx:0x%08x, on_color_trans_done:0x%08x, lcd_cmd_bits:%d, lcd_param_bits:%d, flags.dc_as_cmd_phase:%d, flags.dc_low_on_data:%d, flags.octal_mode:%d, flags.lsb_first:%d", io_config.cs_gpio_num, io_config.dc_gpio_num, io_config.spi_mode, io_config.pclk_hz, io_config.trans_queue_depth, io_config.user_ctx, io_config.on_color_trans_done, io_config.lcd_cmd_bits, io_config.lcd_param_bits, io_config.flags.dc_as_cmd_phase, io_config.flags.dc_low_on_data, io_config.flags.octal_mode, io_config.flags.lsb_first); esp_lcd_panel_io_handle_t io_handle; ESP_ERROR_CHECK(esp_lcd_new_panel_io_spi((esp_lcd_spi_bus_handle_t)XPT2046_SPI_HOST, &io_spi_config, &io_handle));