basic application support
This commit is contained in:
@@ -10,7 +10,6 @@
|
||||
const char* TAG = "cst816";
|
||||
|
||||
static esp_err_t prv_init_io(esp_lcd_panel_io_handle_t* io_handle) {
|
||||
// Init I2C
|
||||
const i2c_config_t i2c_conf = {
|
||||
.mode = I2C_MODE_MASTER,
|
||||
.sda_io_num = GPIO_NUM_33,
|
||||
@@ -19,18 +18,31 @@ static esp_err_t prv_init_io(esp_lcd_panel_io_handle_t* io_handle) {
|
||||
.scl_pullup_en = GPIO_PULLUP_DISABLE,
|
||||
.master.clk_speed = 400000
|
||||
};
|
||||
ESP_RETURN_ON_ERROR(i2c_param_config(CST816_I2C_PORT, &i2c_conf), TAG, "i2c config failed");
|
||||
ESP_RETURN_ON_ERROR(i2c_driver_install(CST816_I2C_PORT, i2c_conf.mode, 0, 0, 0), TAG, "i2c driver install failed");
|
||||
|
||||
// Configure I2C
|
||||
ESP_RETURN_ON_ERROR(
|
||||
i2c_param_config(CST816_I2C_PORT, &i2c_conf),
|
||||
TAG,
|
||||
"i2c config failed"
|
||||
);
|
||||
|
||||
ESP_RETURN_ON_ERROR(
|
||||
i2c_driver_install(CST816_I2C_PORT, i2c_conf.mode, 0, 0, 0),
|
||||
TAG,
|
||||
"i2c driver install failed"
|
||||
);
|
||||
|
||||
const esp_lcd_panel_io_i2c_config_t touch_io_config = ESP_LCD_TOUCH_IO_I2C_CST816S_CONFIG();
|
||||
ESP_RETURN_ON_ERROR(esp_lcd_new_panel_io_i2c((esp_lcd_i2c_bus_handle_t)CST816_I2C_PORT, &touch_io_config, io_handle), TAG, "esp_lcd_panel creation failed");
|
||||
|
||||
ESP_RETURN_ON_ERROR(
|
||||
esp_lcd_new_panel_io_i2c((esp_lcd_i2c_bus_handle_t)CST816_I2C_PORT, &touch_io_config, io_handle),
|
||||
TAG,
|
||||
"esp_lcd_panel creation failed"
|
||||
);
|
||||
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
static esp_err_t prv_create_touch(esp_lcd_panel_io_handle_t io_handle, esp_lcd_touch_handle_t* touch_handle) {
|
||||
// Configure touch
|
||||
esp_lcd_touch_config_t config = {
|
||||
.x_max = 240,
|
||||
.y_max = 320,
|
||||
@@ -48,7 +60,6 @@ static esp_err_t prv_create_touch(esp_lcd_panel_io_handle_t io_handle, esp_lcd_t
|
||||
.interrupt_callback = NULL,
|
||||
};
|
||||
|
||||
// Init touch
|
||||
return esp_lcd_touch_new_i2c_cst816s(io_handle, &config, touch_handle);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user