From a5bbd8de87cdf16bc392599eb54ee6197e322f91 Mon Sep 17 00:00:00 2001 From: Vilem Zavodny Date: Thu, 9 Jan 2025 12:34:26 +0100 Subject: [PATCH] fix(esp_lcd_touch_cst816s): Fixed compilation error for IDF5.1 and lower --- .../esp_lcd_touch_cst816s/idf_component.yml | 2 +- .../include/esp_lcd_touch_cst816s.h | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/components/lcd_touch/esp_lcd_touch_cst816s/idf_component.yml b/components/lcd_touch/esp_lcd_touch_cst816s/idf_component.yml index 42270e72..8d658a53 100644 --- a/components/lcd_touch/esp_lcd_touch_cst816s/idf_component.yml +++ b/components/lcd_touch/esp_lcd_touch_cst816s/idf_component.yml @@ -1,4 +1,4 @@ -version: "1.0.4" +version: "1.0.5" description: ESP LCD Touch CST816S - touch controller CST816S url: https://github.com/espressif/esp-bsp/tree/master/components/lcd_touch/esp_lcd_touch_cst816s dependencies: diff --git a/components/lcd_touch/esp_lcd_touch_cst816s/include/esp_lcd_touch_cst816s.h b/components/lcd_touch/esp_lcd_touch_cst816s/include/esp_lcd_touch_cst816s.h index 0a2fbf7e..8e727ff3 100644 --- a/components/lcd_touch/esp_lcd_touch_cst816s/include/esp_lcd_touch_cst816s.h +++ b/components/lcd_touch/esp_lcd_touch_cst816s/include/esp_lcd_touch_cst816s.h @@ -11,6 +11,7 @@ #pragma once +#include "esp_idf_version.h" #include "esp_lcd_touch.h" #ifdef __cplusplus @@ -40,6 +41,23 @@ esp_err_t esp_lcd_touch_new_i2c_cst816s(const esp_lcd_panel_io_handle_t io, cons * @brief Touch IO configuration structure * */ +#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 2, 0) +#define ESP_LCD_TOUCH_IO_I2C_CST816S_CONFIG() \ + { \ + .dev_addr = ESP_LCD_TOUCH_IO_I2C_CST816S_ADDRESS, \ + .on_color_trans_done = 0, \ + .user_ctx = 0, \ + .control_phase_bytes = 1, \ + .dc_bit_offset = 0, \ + .lcd_cmd_bits = 8, \ + .lcd_param_bits = 0, \ + .flags = \ + { \ + .dc_low_on_data = 0, \ + .disable_control_phase = 1, \ + } \ + } +#else #define ESP_LCD_TOUCH_IO_I2C_CST816S_CONFIG() \ { \ .dev_addr = ESP_LCD_TOUCH_IO_I2C_CST816S_ADDRESS, \ @@ -56,6 +74,7 @@ esp_err_t esp_lcd_touch_new_i2c_cst816s(const esp_lcd_panel_io_handle_t io, cons }, \ .scl_speed_hz = 0 \ } +#endif #ifdef __cplusplus }