espressif / esp-bsp

Board support components for Espressif development boards
Other
180 stars 95 forks source link

espressif/esp_lcd_touch_cst816s lost the ".scl_speed_hz" (BSP-501) #330

Open vgegok opened 4 months ago

vgegok commented 4 months ago

Board

ESP32S3 Dev Module

Hardware Description

waveshare ESP32-S3-Touch-LCD-1.28

IDE Name

VSCODE with IDF 5.2.1

Operating System

Win 11

Description

Error:

define ESP_LCD_TOUCH_IO_I2C_CST816S_CONFIG() \

{                                                     \
    .dev_addr = ESP_LCD_TOUCH_IO_I2C_CST816S_ADDRESS, \
    .control_phase_bytes = 1,                         \
    .dc_bit_offset = 0,                               \
    .lcd_cmd_bits = 8,                                \
    .flags =                                          \
    {                                                 \
        .disable_control_phase = 1,                   \
    }                                                 \
}

OK:

define ESP_LCD_TOUCH_IO_I2C_CST816S_CONFIG() \

{                                                     \
    .dev_addr = ESP_LCD_TOUCH_IO_I2C_CST816S_ADDRESS, \
    .scl_speed_hz = EXAMPLE_TOUCH_CLOCK_HZ,           \
    .control_phase_bytes = 1,                         \
    .dc_bit_offset = 0,                               \
    .lcd_cmd_bits = 8,                                \
    .flags =                                          \
    {                                                 \
        .disable_control_phase = 1,                   \
    }                                                 \
}

EXAMPLE_TOUCH_CLOCK_HZ define in main.c

Sketch

#elif CONFIG_EXAMPLE_LCD_TOUCH_CONTROLLER_CST816S
    ESP_LOGI(TAG, "Initialize I2C bus");
    i2c_master_bus_handle_t i2c_bus = NULL;
    i2c_master_bus_config_t bus_config = {
        .i2c_port = 1,
        .sda_io_num = EXAMPLE_PIN_NUM_TOUCH_SDA,
        .scl_io_num = EXAMPLE_PIN_NUM_TOUCH_SCL,
        .clk_source = I2C_CLK_SRC_DEFAULT,
        .glitch_ignore_cnt = 7,
        .flags.enable_internal_pullup = true,

    };
    ESP_ERROR_CHECK(i2c_new_master_bus(&bus_config, &i2c_bus));
    esp_lcd_panel_io_i2c_config_t tp_io_config = ESP_LCD_TOUCH_IO_I2C_CST816S_CONFIG();
    // Attach the TOUCH to the I2C bus
    ESP_ERROR_CHECK(esp_lcd_new_panel_io_i2c(i2c_bus, &tp_io_config, &tp_io_handle));
    esp_lcd_touch_config_t tp_cfg = {
        .x_max = EXAMPLE_LCD_H_RES,
        .y_max = EXAMPLE_LCD_V_RES,
        .rst_gpio_num = EXAMPLE_PIN_NUM_TOUCH_RST,
        .int_gpio_num = EXAMPLE_PIN_NUM_TOUCH_INT,
        // .levels = {
        //     .reset = 0,
        //     .interrupt = 0,
        // },
        .flags = {
            .swap_xy = 0,
            .mirror_x = 0,
            .mirror_y = 0,
        },
        // .interrupt_callback = touch_callback,
    };

    ESP_LOGI(TAG, "Initialize touch controller CST816S");
    ESP_ERROR_CHECK(esp_lcd_touch_new_i2c_cst816s(tp_io_handle, &tp_cfg, &tp));
#endif // CONFIG_EXAMPLE_LCD_TOUCH_CONTROLLER

Other Steps to Reproduce

No response

I have checked existing issues, README.md and ESP32 Forum

tore-espressif commented 2 weeks ago

@vgegok It is not clear to me what are you trying to say.

Could you provide more information about the problem? Is there an issue with an example or with the driver itself?