Skip to content

Commit

Permalink
Removed _IO_NUM and GPIO_NUM
Browse files Browse the repository at this point in the history
  • Loading branch information
rzeldent committed Dec 27, 2024
1 parent 07ea21c commit 49f7208
Show file tree
Hide file tree
Showing 12 changed files with 67 additions and 67 deletions.
2 changes: 1 addition & 1 deletion platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
#default_envs = esp32-8048S550C
#default_envs = esp32-s3touchlcd7
#default_envs = JC2432W328C
default_envs = JC3248W535N
#default_envs = JC3248W535N
#default_envs = JC8048W550C

[env]
Expand Down
16 changes: 8 additions & 8 deletions src/lvgl_panel_gc9a01_spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ lv_display_t *lvgl_lcd_init()

// Create SPI bus
const spi_bus_config_t spi_bus_config = {
.mosi_io_num = GC9A01_SPI_BUS_MOSI_IO_NUM,
.miso_io_num = GC9A01_SPI_BUS_MISO_IO_NUM,
.sclk_io_num = GC9A01_SPI_BUS_SCLK_IO_NUM,
.quadwp_io_num = GC9A01_SPI_BUS_QUADWP_IO_NUM,
.quadhd_io_num = GC9A01_SPI_BUS_QUADHD_IO_NUM,
.mosi_io_num = GC9A01_SPI_BUS_MOSI,
.miso_io_num = GC9A01_SPI_BUS_MISO,
.sclk_io_num = GC9A01_SPI_BUS_SCLK,
.quadwp_io_num = GC9A01_SPI_BUS_QUADWP,
.quadhd_io_num = GC9A01_SPI_BUS_QUADHD,
.max_transfer_sz = GC9A01_SPI_BUS_MAX_TRANSFER_SZ,
.flags = GC9A01_SPI_BUS_FLAGS,
.intr_flags = GC9A01_SPI_BUS_INTR_FLAGS};
Expand All @@ -56,8 +56,8 @@ lv_display_t *lvgl_lcd_init()

// Attach the LCD controller to the SPI bus
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,
.cs_gpio_num = GC9A01_SPI_CONFIG_CS,
.dc_gpio_num = GC9A01_SPI_CONFIG_DC,
.spi_mode = GC9A01_SPI_CONFIG_SPI_MODE,
.pclk_hz = GC9A01_SPI_CONFIG_PCLK_HZ,
.trans_queue_depth = GC9A01_SPI_CONFIG_TRANS_QUEUE_DEPTH,
Expand All @@ -76,7 +76,7 @@ lv_display_t *lvgl_lcd_init()

// Create gc9a01 panel handle
const esp_lcd_panel_dev_config_t panel_dev_config = {
.reset_gpio_num = GC9A01_DEV_CONFIG_RESET_GPIO_NUM,
.reset_gpio_num = GC9A01_DEV_CONFIG_RESET,
.color_space = GC9A01_DEV_CONFIG_COLOR_SPACE,
.bits_per_pixel = GC9A01_DEV_CONFIG_BITS_PER_PIXEL,
.flags = {
Expand Down
16 changes: 8 additions & 8 deletions src/lvgl_panel_ili9341_spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ lv_display_t *lvgl_lcd_init()

// Create SPI bus
const spi_bus_config_t spi_bus_config = {
.mosi_io_num = ILI9341_SPI_BUS_MOSI_IO_NUM,
.miso_io_num = ILI9341_SPI_BUS_MISO_IO_NUM,
.sclk_io_num = ILI9341_SPI_BUS_SCLK_IO_NUM,
.quadwp_io_num = ILI9341_SPI_BUS_QUADWP_IO_NUM,
.quadhd_io_num = ILI9341_SPI_BUS_QUADHD_IO_NUM,
.mosi_io_num = ILI9341_SPI_BUS_MOSI,
.miso_io_num = ILI9341_SPI_BUS_MISO,
.sclk_io_num = ILI9341_SPI_BUS_SCLK,
.quadwp_io_num = ILI9341_SPI_BUS_QUADWP,
.quadhd_io_num = ILI9341_SPI_BUS_QUADHD,
.max_transfer_sz = ILI9341_SPI_BUS_MAX_TRANSFER_SZ,
.flags = ILI9341_SPI_BUS_FLAGS,
.intr_flags = ILI9341_SPI_BUS_INTR_FLAGS};
Expand All @@ -52,8 +52,8 @@ lv_display_t *lvgl_lcd_init()

// Attach the LCD controller to the SPI bus
const esp_lcd_panel_io_spi_config_t io_spi_config = {
.cs_gpio_num = ILI9341_SPI_CONFIG_CS_GPIO_NUM,
.dc_gpio_num = ILI9341_SPI_CONFIG_DC_GPIO_NUM,
.cs_gpio_num = ILI9341_SPI_CONFIG_CS,
.dc_gpio_num = ILI9341_SPI_CONFIG_DC,
.spi_mode = ILI9341_SPI_CONFIG_SPI_MODE,
.pclk_hz = ILI9341_SPI_CONFIG_PCLK_HZ,
.trans_queue_depth = ILI9341_SPI_CONFIG_TRANS_QUEUE_DEPTH,
Expand All @@ -72,7 +72,7 @@ lv_display_t *lvgl_lcd_init()

// Create ili9341 panel handle
const esp_lcd_panel_dev_config_t panel_dev_config = {
.reset_gpio_num = ILI9341_DEV_CONFIG_RESET_GPIO_NUM,
.reset_gpio_num = ILI9341_DEV_CONFIG_RESET,
.color_space = ILI9341_DEV_CONFIG_COLOR_SPACE,
.bits_per_pixel = ILI9341_DEV_CONFIG_BITS_PER_PIXEL,
.flags = {
Expand Down
10 changes: 5 additions & 5 deletions src/lvgl_panel_st7262_par.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,13 @@ lv_display_t *lvgl_lcd_init()
.data_width = ST7262_PANEL_CONFIG_DATA_WIDTH,
.sram_trans_align = ST7262_PANEL_CONFIG_SRAM_TRANS_ALIGN,
.psram_trans_align = ST7262_PANEL_CONFIG_PSRAM_TRANS_ALIGN,
.hsync_gpio_num = ST7262_PANEL_CONFIG_HSYNC_GPIO_NUM,
.vsync_gpio_num = ST7262_PANEL_CONFIG_VSYNC_GPIO_NUM,
.de_gpio_num = ST7262_PANEL_CONFIG_DE_GPIO_NUM,
.pclk_gpio_num = ST7262_PANEL_CONFIG_PCLK_GPIO_NUM,
.hsync_gpio_num = ST7262_PANEL_CONFIG_HSYNC,
.vsync_gpio_num = ST7262_PANEL_CONFIG_VSYNC,
.de_gpio_num = ST7262_PANEL_CONFIG_DE,
.pclk_gpio_num = ST7262_PANEL_CONFIG_PCLK,
// LV_COLOR_16_SWAP is handled by mapping of the data
.data_gpio_nums = {ST7262_PANEL_CONFIG_DATA_GPIO_R0, ST7262_PANEL_CONFIG_DATA_GPIO_R1, ST7262_PANEL_CONFIG_DATA_GPIO_R2, ST7262_PANEL_CONFIG_DATA_GPIO_R3, ST7262_PANEL_CONFIG_DATA_GPIO_R4, ST7262_PANEL_CONFIG_DATA_GPIO_G0, ST7262_PANEL_CONFIG_DATA_GPIO_G1, ST7262_PANEL_CONFIG_DATA_GPIO_G2, ST7262_PANEL_CONFIG_DATA_GPIO_G3, ST7262_PANEL_CONFIG_DATA_GPIO_G4, ST7262_PANEL_CONFIG_DATA_GPIO_G5, ST7262_PANEL_CONFIG_DATA_GPIO_B0, ST7262_PANEL_CONFIG_DATA_GPIO_B1, ST7262_PANEL_CONFIG_DATA_GPIO_B2, ST7262_PANEL_CONFIG_DATA_GPIO_B3, ST7262_PANEL_CONFIG_DATA_GPIO_B4},
.disp_gpio_num = ST7262_PANEL_CONFIG_DISP_GPIO_NUM,
.disp_gpio_num = ST7262_PANEL_CONFIG_DISP,
.on_frame_trans_done = direct_io_frame_trans_done,
.user_ctx = display,
.flags = {.disp_active_low = ST7262_PANEL_CONFIG_FLAGS_DISP_ACTIVE_LOW, .relax_on_idle = ST7262_PANEL_CONFIG_FLAGS_RELAX_ON_IDLE, .fb_in_psram = ST7262_PANEL_CONFIG_FLAGS_FB_IN_PSRAM}};
Expand Down
18 changes: 9 additions & 9 deletions src/lvgl_panel_st7701_par.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,11 @@ lv_display_t *lvgl_lcd_init()
esp_lcd_panel_io_3wire_spi_config_t io_3wire_spi_config = {
.line_config = {
.cs_io_type = IO_TYPE_GPIO,
.cs_gpio_num = ST7701_IO_3WIRE_SPI_LINE_CONFIG_CS_GPIO_NUM,
.cs_gpio_num = ST7701_IO_3WIRE_SPI_LINE_CONFIG_CS,
.scl_io_type = IO_TYPE_GPIO,
.scl_gpio_num = ST7701_IO_3WIRE_SPI_LINE_CONFIG_SCL_GPIO_NUM,
.scl_gpio_num = ST7701_IO_3WIRE_SPI_LINE_CONFIG_SCL,
.sda_io_type = IO_TYPE_GPIO,
.sda_gpio_num = ST7701_IO_3WIRE_SPI_LINE_CONFIG_SDA_GPIO_NUM},
.sda_gpio_num = ST7701_IO_3WIRE_SPI_LINE_CONFIG_SDA},
.expect_clk_speed = ST7701_IO_3WIRE_SPI_EXPECT_CLK_SPEED,
.spi_mode = ST7701_IO_3WIRE_SPI_SPI_MODE,
.lcd_cmd_bytes = ST7701_IO_3WIRE_SPI_LCD_CMD_BYTES,
Expand Down Expand Up @@ -109,19 +109,19 @@ lv_display_t *lvgl_lcd_init()
.data_width = ST7701_PANEL_CONFIG_DATA_WIDTH,
.sram_trans_align = ST7701_PANEL_CONFIG_SRAM_TRANS_ALIGN,
.psram_trans_align = ST7701_PANEL_CONFIG_PSRAM_TRANS_ALIGN,
.hsync_gpio_num = ST7701_PANEL_CONFIG_HSYNC_GPIO_NUM,
.vsync_gpio_num = ST7701_PANEL_CONFIG_VSYNC_GPIO_NUM,
.de_gpio_num = ST7701_PANEL_CONFIG_DE_GPIO_NUM,
.pclk_gpio_num = ST7701_PANEL_CONFIG_PCLK_GPIO_NUM,
.hsync_gpio_num = ST7701_PANEL_CONFIG_HSYNC,
.vsync_gpio_num = ST7701_PANEL_CONFIG_VSYNC,
.de_gpio_num = ST7701_PANEL_CONFIG_DE,
.pclk_gpio_num = ST7701_PANEL_CONFIG_PCLK,
.data_gpio_nums = {ST7701_PANEL_CONFIG_DATA_GPIO_R0, ST7701_PANEL_CONFIG_DATA_GPIO_R1, ST7701_PANEL_CONFIG_DATA_GPIO_R2, ST7701_PANEL_CONFIG_DATA_GPIO_R3, ST7701_PANEL_CONFIG_DATA_GPIO_R4, ST7701_PANEL_CONFIG_DATA_GPIO_G0, ST7701_PANEL_CONFIG_DATA_GPIO_G1, ST7701_PANEL_CONFIG_DATA_GPIO_G2, ST7701_PANEL_CONFIG_DATA_GPIO_G3, ST7701_PANEL_CONFIG_DATA_GPIO_G4, ST7701_PANEL_CONFIG_DATA_GPIO_G5, ST7701_PANEL_CONFIG_DATA_GPIO_B0, ST7701_PANEL_CONFIG_DATA_GPIO_B1, ST7701_PANEL_CONFIG_DATA_GPIO_B2, ST7701_PANEL_CONFIG_DATA_GPIO_B3, ST7701_PANEL_CONFIG_DATA_GPIO_B4},
.disp_gpio_num = ST7701_PANEL_CONFIG_DISP_GPIO_NUM,
.disp_gpio_num = ST7701_PANEL_CONFIG_DISP,
.on_frame_trans_done = direct_io_frame_trans_done,
.user_ctx = display,
.flags = {.disp_active_low = ST7701_PANEL_CONFIG_FLAGS_DISP_ACTIVE_LOW, .relax_on_idle = ST7701_PANEL_CONFIG_FLAGS_RELAX_ON_IDLE, .fb_in_psram = ST7701_PANEL_CONFIG_FLAGS_FB_IN_PSRAM}};
log_d("rgb_panel_config: clk_src:%d, timings:{pclk_hz:%d, h_res:%d, v_res:%d, hsync_pulse_width:%d, hsync_back_porch:%d, hsync_front_porch:%d, vsync_pulse_width:%d, vsync_back_porch:%d, vsync_front_porch:%d, flags:{hsync_idle_low:%d, vsync_idle_low:%d, de_idle_high:%d, pclk_active_neg:%d, pclk_idle_high:%d}}, data_width:%d, sram_trans_align:%d, psram_trans_align:%d, hsync_gpio_num:%d, vsync_gpio_num:%d, de_gpio_num:%d, pclk_gpio_num:%d, data_gpio_nums:[%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d], disp_gpio_num:%d, on_frame_trans_done:0x%08x, user_ctx:0x%08x, flags:{disp_active_low:%d, relax_on_idle:%d, fb_in_psram:%d}", rgb_panel_config.clk_src, rgb_panel_config.timings.pclk_hz, rgb_panel_config.timings.h_res, rgb_panel_config.timings.v_res, rgb_panel_config.timings.hsync_pulse_width, rgb_panel_config.timings.hsync_back_porch, rgb_panel_config.timings.hsync_front_porch, rgb_panel_config.timings.vsync_pulse_width, rgb_panel_config.timings.vsync_back_porch, rgb_panel_config.timings.vsync_front_porch, rgb_panel_config.timings.flags.hsync_idle_low, rgb_panel_config.timings.flags.vsync_idle_low, rgb_panel_config.timings.flags.de_idle_high, rgb_panel_config.timings.flags.pclk_active_neg, rgb_panel_config.timings.flags.pclk_idle_high, rgb_panel_config.data_width, rgb_panel_config.sram_trans_align, rgb_panel_config.psram_trans_align, rgb_panel_config.hsync_gpio_num, rgb_panel_config.vsync_gpio_num, rgb_panel_config.de_gpio_num, rgb_panel_config.pclk_gpio_num, rgb_panel_config.data_gpio_nums[0], rgb_panel_config.data_gpio_nums[1], rgb_panel_config.data_gpio_nums[2], rgb_panel_config.data_gpio_nums[3], rgb_panel_config.data_gpio_nums[4], rgb_panel_config.data_gpio_nums[5], rgb_panel_config.data_gpio_nums[6], rgb_panel_config.data_gpio_nums[7], rgb_panel_config.data_gpio_nums[8], rgb_panel_config.data_gpio_nums[9], rgb_panel_config.data_gpio_nums[10], rgb_panel_config.data_gpio_nums[11], rgb_panel_config.data_gpio_nums[12], rgb_panel_config.data_gpio_nums[13], rgb_panel_config.data_gpio_nums[14], rgb_panel_config.data_gpio_nums[15], rgb_panel_config.disp_gpio_num, rgb_panel_config.on_frame_trans_done, rgb_panel_config.user_ctx, rgb_panel_config.flags.disp_active_low, rgb_panel_config.flags.relax_on_idle, rgb_panel_config.flags.fb_in_psram);
log_d("refresh rate: %d Hz", (ST7701_PANEL_CONFIG_TIMINGS_PCLK_HZ * ST7701_PANEL_CONFIG_DATA_WIDTH) / (ST7701_PANEL_CONFIG_TIMINGS_H_RES + ST7701_PANEL_CONFIG_TIMINGS_HSYNC_PULSE_WIDTH + ST7701_PANEL_CONFIG_TIMINGS_HSYNC_BACK_PORCH + ST7701_PANEL_CONFIG_TIMINGS_HSYNC_FRONT_PORCH) / (ST7701_PANEL_CONFIG_TIMINGS_V_RES + ST7701_PANEL_CONFIG_TIMINGS_VSYNC_PULSE_WIDTH + ST7701_PANEL_CONFIG_TIMINGS_VSYNC_BACK_PORCH + ST7701_PANEL_CONFIG_TIMINGS_VSYNC_FRONT_PORCH) / SOC_LCD_RGB_DATA_WIDTH);
const esp_lcd_panel_dev_config_t panel_dev_config = {
.reset_gpio_num = ST7701_DEV_CONFIG_RESET_GPIO_NUM,
.reset_gpio_num = ST7701_DEV_CONFIG_RESET,
.color_space = ST7701_DEV_CONFIG_COLOR_SPACE,
.bits_per_pixel = ST7701_DEV_CONFIG_BITS_PER_PIXEL,
.flags = {
Expand Down
4 changes: 2 additions & 2 deletions src/lvgl_panel_st7789_i80.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ lv_display_t *lvgl_lcd_init(uint32_t hor_res, uint32_t ver_res)

// Create direct_io panel handle
esp_lcd_panel_io_i80_config_t io_i80_config = {
.cs_gpio_num = ST7789_IO_I80_CONFIG_CS_GPIO_NUM,
.cs_gpio_num = ST7789_IO_I80_CONFIG_CS,
.pclk_hz = ST7789_IO_I80_CONFIG_PCLK_HZ,
.on_color_trans_done = st7789_color_trans_done,
.user_ctx = display,
Expand All @@ -82,7 +82,7 @@ lv_display_t *lvgl_lcd_init(uint32_t hor_res, uint32_t ver_res)

// Create ST7789 panel handle
const esp_lcd_panel_dev_config_t panel_dev_config = {
.reset_gpio_num = ST7789_DEV_CONFIG_RESET_GPIO_NUM,
.reset_gpio_num = ST7789_DEV_CONFIG_RESET,
.color_space = ST7789_DEV_CONFIG_COLOR_SPACE,
.bits_per_pixel = ST7789_DEV_CONFIG_BITS_PER_PIXEL,
.flags = {
Expand Down
16 changes: 8 additions & 8 deletions src/lvgl_panel_st7789_spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ lv_display_t *lvgl_lcd_init(uint32_t hor_res, uint32_t ver_res)

// Create SPI bus
const spi_bus_config_t spi_bus_config = {
.mosi_io_num = ST7789_SPI_BUS_MOSI_IO_NUM,
.miso_io_num = ST7789_SPI_BUS_MISO_IO_NUM,
.sclk_io_num = ST7789_SPI_BUS_SCLK_IO_NUM,
.quadwp_io_num = ST7789_SPI_BUS_QUADWP_IO_NUM,
.quadhd_io_num = ST7789_SPI_BUS_QUADHD_IO_NUM,
.mosi_io_num = ST7789_SPI_BUS_MOSI,
.miso_io_num = ST7789_SPI_BUS_MISO,
.sclk_io_num = ST7789_SPI_BUS_SCLK,
.quadwp_io_num = ST7789_SPI_BUS_QUADWP,
.quadhd_io_num = ST7789_SPI_BUS_QUADHD,
.max_transfer_sz = ST7789_SPI_BUS_MAX_TRANSFER_SZ,
.flags = ST7789_SPI_BUS_FLAGS,
.intr_flags = ST7789_SPI_BUS_INTR_FLAGS};
Expand All @@ -52,8 +52,8 @@ lv_display_t *lvgl_lcd_init(uint32_t hor_res, uint32_t ver_res)

// Attach the LCD controller to the SPI bus
const esp_lcd_panel_io_spi_config_t io_spi_config = {
.cs_gpio_num = ST7789_SPI_CONFIG_CS_GPIO_NUM,
.dc_gpio_num = ST7789_SPI_CONFIG_DC_GPIO_NUM,
.cs_gpio_num = ST7789_SPI_CONFIG_CS,
.dc_gpio_num = ST7789_SPI_CONFIG_DC,
.spi_mode = ST7789_SPI_CONFIG_SPI_MODE,
.pclk_hz = ST7789_SPI_CONFIG_PCLK_HZ,
.on_color_trans_done = st7789_color_trans_done,
Expand All @@ -72,7 +72,7 @@ lv_display_t *lvgl_lcd_init(uint32_t hor_res, uint32_t ver_res)

// Create st7789 panel handle
const esp_lcd_panel_dev_config_t panel_dev_config = {
.reset_gpio_num = ST7789_DEV_CONFIG_RESET_GPIO_NUM,
.reset_gpio_num = ST7789_DEV_CONFIG_RESET,
.color_space = ST7789_DEV_CONFIG_COLOR_SPACE,
.bits_per_pixel = ST7789_DEV_CONFIG_BITS_PER_PIXEL,
.flags = {
Expand Down
16 changes: 8 additions & 8 deletions src/lvgl_panel_st7796_spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ lv_display_t *lvgl_lcd_init(uint32_t hor_res, uint32_t ver_res)

// Create SPI bus
const spi_bus_config_t spi_bus_config = {
.mosi_io_num = ST7796_SPI_BUS_MOSI_IO_NUM,
.miso_io_num = ST7796_SPI_BUS_MISO_IO_NUM,
.sclk_io_num = ST7796_SPI_BUS_SCLK_IO_NUM,
.quadwp_io_num = ST7796_SPI_BUS_QUADWP_IO_NUM,
.quadhd_io_num = ST7796_SPI_BUS_QUADHD_IO_NUM,
.mosi_io_num = ST7796_SPI_BUS_MOSI,
.miso_io_num = ST7796_SPI_BUS_MISO,
.sclk_io_num = ST7796_SPI_BUS_SCLK,
.quadwp_io_num = ST7796_SPI_BUS_QUADWP,
.quadhd_io_num = ST7796_SPI_BUS_QUADHD,
.max_transfer_sz = ST7796_SPI_BUS_MAX_TRANSFER_SZ,
.flags = ST7796_SPI_BUS_FLAGS,
.intr_flags = ST7796_SPI_BUS_INTR_FLAGS};
Expand All @@ -53,8 +53,8 @@ lv_display_t *lvgl_lcd_init(uint32_t hor_res, uint32_t ver_res)

// Attach the LCD controller to the SPI bus
const esp_lcd_panel_io_spi_config_t io_spi_config = {
.cs_gpio_num = ST7796_SPI_CONFIG_CS_GPIO_NUM,
.dc_gpio_num = ST7796_SPI_CONFIG_DC_GPIO_NUM,
.cs_gpio_num = ST7796_SPI_CONFIG_CS,
.dc_gpio_num = ST7796_SPI_CONFIG_DC,
.spi_mode = ST7796_SPI_CONFIG_SPI_MODE,
.pclk_hz = ST7796_SPI_CONFIG_PCLK_HZ,
.on_color_trans_done = st7796_color_trans_done,
Expand All @@ -73,7 +73,7 @@ lv_display_t *lvgl_lcd_init(uint32_t hor_res, uint32_t ver_res)

// Create st7796 panel handle
const esp_lcd_panel_dev_config_t panel_dev_config = {
.reset_gpio_num = ST7796_DEV_CONFIG_RESET_GPIO_NUM,
.reset_gpio_num = ST7796_DEV_CONFIG_RESET,
.color_space = ST7796_DEV_CONFIG_COLOR_SPACE,
.bits_per_pixel = ST7796_DEV_CONFIG_BITS_PER_PIXEL,
.flags = {
Expand Down
8 changes: 4 additions & 4 deletions src/lvgl_touch_cst816s_i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ lv_indev_t *lvgl_touch_init()
// Create I2C bus
const i2c_config_t i2c_config = {
.mode = I2C_MODE_MASTER,
.sda_io_num = CST816S_I2C_CONFIG_SDA_IO_NUM,
.scl_io_num = CST816S_I2C_CONFIG_SCL_IO_NUM,
.sda_io_num = CST816S_I2C_CONFIG_SDA,
.scl_io_num = CST816S_I2C_CONFIG_SCL,
.sda_pullup_en = CST816S_I2C_CONFIG_SDA_PULLUP_EN,
.scl_pullup_en = CST816S_I2C_CONFIG_SCL_PULLUP_EN,
.master = {
Expand Down Expand Up @@ -65,8 +65,8 @@ lv_indev_t *lvgl_touch_init()
const esp_lcd_touch_config_t touch_config = {
.x_max = CST816S_TOUCH_CONFIG_X_MAX,
.y_max = CST816S_TOUCH_CONFIG_Y_MAX,
.rst_gpio_num = CST816S_TOUCH_CONFIG_RST_GPIO_NUM,
.int_gpio_num = CST816S_TOUCH_CONFIG_INT_GPIO_NUM,
.rst_gpio_num = CST816S_TOUCH_CONFIG_RST,
.int_gpio_num = CST816S_TOUCH_CONFIG_INT,
.levels = {
.reset = CST816S_TOUCH_CONFIG_LEVELS_RESET,
.interrupt = CST816S_TOUCH_CONFIG_LEVELS_INTERRUPT},
Expand Down
8 changes: 4 additions & 4 deletions src/lvgl_touch_gt911_i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ lv_indev_t* lvgl_touch_init()
// Create I2C bus
const i2c_config_t i2c_config = {
.mode = I2C_MODE_MASTER,
.sda_io_num = GT911_I2C_CONFIG_SDA_IO_NUM,
.scl_io_num = GT911_I2C_CONFIG_SCL_IO_NUM,
.sda_io_num = GT911_I2C_CONFIG_SDA,
.scl_io_num = GT911_I2C_CONFIG_SCL,
.sda_pullup_en = GT911_I2C_CONFIG_SDA_PULLUP_EN,
.scl_pullup_en = GT911_I2C_CONFIG_SCL_PULLUP_EN,
.master = {
Expand Down Expand Up @@ -66,8 +66,8 @@ lv_indev_t* lvgl_touch_init()
const esp_lcd_touch_config_t touch_config = {
.x_max = GT911_TOUCH_CONFIG_X_MAX,
.y_max = GT911_TOUCH_CONFIG_Y_MAX,
.rst_gpio_num = GT911_TOUCH_CONFIG_RST_GPIO_NUM,
.int_gpio_num = GT911_TOUCH_CONFIG_INT_GPIO_NUM,
.rst_gpio_num = GT911_TOUCH_CONFIG_RST,
.int_gpio_num = GT911_TOUCH_CONFIG_INT,
.levels = {
.reset = GT911_TOUCH_CONFIG_LEVELS_RESET,
.interrupt = GT911_TOUCH_CONFIG_LEVELS_INTERRUPT},
Expand Down
18 changes: 9 additions & 9 deletions src/lvgl_touch_xpt2046_spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,18 @@ lv_indev_t *lvgl_touch_init()

// Create SPI bus only if not already initialized (S035R shares the SPI bus)
const spi_bus_config_t spi_bus_config = {
.mosi_io_num = XPT2046_SPI_BUS_MOSI_IO_NUM,
.miso_io_num = XPT2046_SPI_BUS_MISO_IO_NUM,
.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};
.mosi_io_num = XPT2046_SPI_BUS_MOSI,
.miso_io_num = XPT2046_SPI_BUS_MISO,
.sclk_io_num = XPT2046_SPI_BUS_SCLK,
.quadwp_io_num = XPT2046_SPI_BUS_QUADWP,
.quadhd_io_num = XPT2046_SPI_BUS_QUADHD};
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
const esp_lcd_panel_io_spi_config_t io_spi_config = {
.cs_gpio_num = XPT2046_SPI_CONFIG_CS_GPIO_NUM,
.dc_gpio_num = XPT2046_SPI_CONFIG_DC_GPIO_NUM,
.cs_gpio_num = XPT2046_SPI_CONFIG_CS,
.dc_gpio_num = XPT2046_SPI_CONFIG_DC,
.spi_mode = XPT2046_SPI_CONFIG_SPI_MODE,
.pclk_hz = XPT2046_SPI_CONFIG_PCLK_HZ,
.user_ctx = indev,
Expand All @@ -65,8 +65,8 @@ lv_indev_t *lvgl_touch_init()
const esp_lcd_touch_config_t touch_config = {
.x_max = XPT2046_TOUCH_CONFIG_X_MAX,
.y_max = XPT2046_TOUCH_CONFIG_Y_MAX,
.rst_gpio_num = XPT2046_TOUCH_CONFIG_RST_GPIO_NUM,
.int_gpio_num = XPT2046_TOUCH_CONFIG_INT_GPIO_NUM,
.rst_gpio_num = XPT2046_TOUCH_CONFIG_RST,
.int_gpio_num = XPT2046_TOUCH_CONFIG_INT,
.levels = {
.reset = XPT2046_TOUCH_CONFIG_LEVELS_RESET,
.interrupt = XPT2046_TOUCH_CONFIG_LEVELS_INTERRUPT},
Expand Down

0 comments on commit 49f7208

Please sign in to comment.