Cleanup of Waveshare board drivers

This commit is contained in:
Ken Van Hoeylandt
2024-01-28 22:39:29 +01:00
committed by GitHub
parent ddf46b07e9
commit ae5c828f42
5 changed files with 127 additions and 139 deletions
+2 -25
View File
@@ -1,4 +1,4 @@
#include "display_defines_i.h"
#include "config.h"
#include "driver/i2c.h"
#include "esp_err.h"
@@ -8,33 +8,10 @@
#define TAG "waveshare_s3_touch_i2c"
#define WAVESHARE_TOUCH_I2C_PORT 0
#define WAVESHARE_I2C_MASTER_TX_BUF_DISABLE 0
#define WAVESHARE_I2C_MASTER_RX_BUF_DISABLE 0
static esp_err_t i2c_master_init(void) {
const i2c_config_t i2c_conf = {
.mode = I2C_MODE_MASTER,
.sda_io_num = GPIO_NUM_8,
.sda_pullup_en = GPIO_PULLUP_DISABLE,
.scl_io_num = GPIO_NUM_9,
.scl_pullup_en = GPIO_PULLUP_DISABLE,
.master.clk_speed = 400000
};
i2c_param_config(WAVESHARE_TOUCH_I2C_PORT, &i2c_conf);
return i2c_driver_install(WAVESHARE_TOUCH_I2C_PORT, i2c_conf.mode, WAVESHARE_I2C_MASTER_RX_BUF_DISABLE, WAVESHARE_I2C_MASTER_TX_BUF_DISABLE, 0);
}
static esp_lcd_touch_handle_t touch_init_internal() {
ESP_ERROR_CHECK(i2c_master_init());
ESP_LOGI(TAG, "I2C initialized successfully");
static esp_lcd_panel_io_handle_t tp_io_handle = NULL;
static esp_lcd_panel_io_i2c_config_t tp_io_config = ESP_LCD_TOUCH_IO_I2C_GT911_CONFIG();
ESP_LOGI(TAG, "Initialize touch IO (I2C)");
ESP_LOGI(TAG, "Initialize touch IO");
/* Touch IO handle */
ESP_ERROR_CHECK(esp_lcd_new_panel_io_i2c((esp_lcd_i2c_bus_handle_t)WAVESHARE_TOUCH_I2C_PORT, &tp_io_config, &tp_io_handle));
esp_lcd_touch_config_t tp_cfg = {