Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
rzeldent committed Mar 5, 2024
1 parent 7a3feaa commit f1b8ece
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion boards
3 changes: 3 additions & 0 deletions include/esp_lcd_touch_cst816s.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

#include <esp_lcd_touch.h>

// I2C Address
#define CST816S_IO_I2C_CONFIG_DEV_ADDRESS_15 0x15 // 0x15 (0x2A/0x2B): INT High during reset or

#ifdef __cplusplus
extern "C"
{
Expand Down
4 changes: 2 additions & 2 deletions src/esp_lcd_touch_cst816s.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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");
Expand Down
7 changes: 5 additions & 2 deletions src/lvgl_gc9a01_spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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 = {
Expand All @@ -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));

Expand Down
2 changes: 2 additions & 0 deletions src/lvgl_xpt2046_spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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));

Expand Down

0 comments on commit f1b8ece

Please sign in to comment.