From de52f295db7e91165166eb4c9d8bf9aba43cb239 Mon Sep 17 00:00:00 2001 From: hiruna Date: Sat, 3 Jun 2023 23:08:29 +1000 Subject: [PATCH] backward compatibility with esp-idf release/v4.4 --- lvgl_helpers.c | 3 +++ lvgl_tft/FT81x.c | 12 ++++++++++-- lvgl_tft/GC9A01.c | 13 ++++++++++++- lvgl_tft/esp_lcd_backlight.c | 13 ++++++++++++- lvgl_tft/hx8357.c | 13 ++++++++++++- lvgl_tft/il3820.c | 16 ++++++++++++++++ lvgl_tft/ili9163c.c | 16 ++++++++++++++-- lvgl_tft/ili9341.c | 12 ++++++++++++ lvgl_tft/ili9481.c | 13 ++++++++++++- lvgl_tft/ili9486.c | 12 ++++++++++++ lvgl_tft/ili9488.c | 14 +++++++++++++- lvgl_tft/pcd8544.c | 13 ++++++++++++- lvgl_tft/ra8875.c | 8 ++++++++ lvgl_tft/sh1107.c | 16 ++++++++++++++-- lvgl_tft/st7735s.c | 16 ++++++++++++++-- lvgl_tft/st7789.c | 12 ++++++++++++ lvgl_tft/st7796s.c | 16 ++++++++++++++-- lvgl_touch/adcraw.c | 16 ++++++++++++++-- 18 files changed, 216 insertions(+), 18 deletions(-) diff --git a/lvgl_helpers.c b/lvgl_helpers.c index 52b20f1..0d64212 100644 --- a/lvgl_helpers.c +++ b/lvgl_helpers.c @@ -23,6 +23,9 @@ #include "lvgl/lvgl.h" #endif +#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5,0,0) +#define SPI_HOST_MAX SOC_SPI_PERIPH_NUM +#endif /********************* * DEFINES *********************/ diff --git a/lvgl_tft/FT81x.c b/lvgl_tft/FT81x.c index 8755079..0242d7e 100644 --- a/lvgl_tft/FT81x.c +++ b/lvgl_tft/FT81x.c @@ -7,7 +7,10 @@ #include "EVE.h" #include "EVE_commands.h" - +#include "esp_idf_version.h" +#if ESP_IDF_VERSION <= ESP_IDF_VERSION_VAL(5,0,0) +#include "rom/gpio.h" +#endif /* some pre-definded colors */ #define RED 0xff0000UL #define ORANGE 0xffa500UL @@ -263,7 +266,12 @@ void TFT_bitmap_display(void) void FT81x_init(void) { #if EVE_USE_PDN - esp_rom_gpio_pad_select_gpio(EVE_PDN); +#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5,0,0) + gpio_pad_select_gpio(EVE_PDN); +#else + esp_rom_gpio_pad_select_gpio(EVE_PDN); +#endif + #endif gpio_set_level(EVE_CS, 1); diff --git a/lvgl_tft/GC9A01.c b/lvgl_tft/GC9A01.c index fe5c7b8..b27f444 100644 --- a/lvgl_tft/GC9A01.c +++ b/lvgl_tft/GC9A01.c @@ -12,7 +12,10 @@ #include "esp_log.h" #include "freertos/FreeRTOS.h" #include "freertos/task.h" - +#include "esp_idf_version.h" +#if ESP_IDF_VERSION <= ESP_IDF_VERSION_VAL(5,0,0) +#include "rom/gpio.h" +#endif /********************* * DEFINES *********************/ @@ -112,11 +115,19 @@ void GC9A01_init(void) }; //Initialize non-SPI GPIOs +#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5,0,0) + gpio_pad_select_gpio(GC9A01_DC); +#else esp_rom_gpio_pad_select_gpio(GC9A01_DC); +#endif gpio_set_direction(GC9A01_DC, GPIO_MODE_OUTPUT); #if GC9A01_USE_RST +#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5,0,0) + gpio_pad_select_gpio(GC9A01_RST); +#else esp_rom_gpio_pad_select_gpio(GC9A01_RST); +#endif gpio_set_direction(GC9A01_RST, GPIO_MODE_OUTPUT); //Reset the display diff --git a/lvgl_tft/esp_lcd_backlight.c b/lvgl_tft/esp_lcd_backlight.c index 0da96cb..27f15fb 100644 --- a/lvgl_tft/esp_lcd_backlight.c +++ b/lvgl_tft/esp_lcd_backlight.c @@ -12,7 +12,10 @@ #include "driver/gpio.h" #include "esp_log.h" #include "soc/ledc_periph.h" // to invert LEDC output on IDF version < v4.3 - +#include "esp_idf_version.h" +#if ESP_IDF_VERSION <= ESP_IDF_VERSION_VAL(5,0,0) +#include "rom/gpio.h" +#endif typedef struct { bool pwm_control; // true: LEDC is used, false: GPIO is used int index; // Either GPIO or LEDC channel @@ -63,7 +66,11 @@ disp_backlight_h disp_backlight_new(const disp_backlight_config_t *config) { // Configure GPIO for output bckl_dev->index = config->gpio_num; +#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5,0,0) + gpio_pad_select_gpio(config->gpio_num); +#else esp_rom_gpio_pad_select_gpio(config->gpio_num); +#endif ESP_ERROR_CHECK(gpio_set_direction(config->gpio_num, GPIO_MODE_OUTPUT)); gpio_iomux_out(config->gpio_num, SIG_GPIO_OUT_IDX, config->output_invert); } @@ -102,7 +109,11 @@ void disp_backlight_delete(disp_backlight_h bckl) if (bckl_dev->pwm_control) { ledc_stop(LEDC_LOW_SPEED_MODE, bckl_dev->index, 0); } else { +#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5,0,0) + gpio_pad_select_gpio(bckl_dev->index); +#else esp_rom_gpio_pad_select_gpio(bckl_dev->index); +#endif } free (bckl); } diff --git a/lvgl_tft/hx8357.c b/lvgl_tft/hx8357.c index 30a3e38..b5b2a9d 100644 --- a/lvgl_tft/hx8357.c +++ b/lvgl_tft/hx8357.c @@ -21,7 +21,10 @@ #include #include "freertos/FreeRTOS.h" #include "freertos/task.h" - +#include "esp_idf_version.h" +#if ESP_IDF_VERSION <= ESP_IDF_VERSION_VAL(5,0,0) +#include "rom/gpio.h" +#endif /********************* * DEFINES *********************/ @@ -160,11 +163,19 @@ static uint8_t displayType = HX8357D; void hx8357_init(void) { //Initialize non-SPI GPIOs +#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5,0,0) + gpio_pad_select_gpio(HX8357_DC); +#else esp_rom_gpio_pad_select_gpio(HX8357_DC); +#endif gpio_set_direction(HX8357_DC, GPIO_MODE_OUTPUT); #if HX8357_USE_RST +#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5,0,0) + gpio_pad_select_gpio(HX8357_RST); +#else esp_rom_gpio_pad_select_gpio(HX8357_RST); +#endif gpio_set_direction(HX8357_RST, GPIO_MODE_OUTPUT); //Reset the display diff --git a/lvgl_tft/il3820.c b/lvgl_tft/il3820.c index d4ff1ad..7bad876 100644 --- a/lvgl_tft/il3820.c +++ b/lvgl_tft/il3820.c @@ -33,6 +33,10 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR TH #include "esp_log.h" #include "freertos/FreeRTOS.h" #include "freertos/task.h" +#include "esp_idf_version.h" +#if ESP_IDF_VERSION <= ESP_IDF_VERSION_VAL(5,0,0) +#include "rom/gpio.h" +#endif #include "il3820.h" @@ -196,14 +200,26 @@ void il3820_init(void) uint8_t tmp[3] = {0}; /* Initialize non-SPI GPIOs */ +#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5,0,0) + gpio_pad_select_gpio(IL3820_DC_PIN); +#else esp_rom_gpio_pad_select_gpio(IL3820_DC_PIN); +#endif gpio_set_direction(IL3820_DC_PIN, GPIO_MODE_OUTPUT); +#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5,0,0) + gpio_pad_select_gpio(IL3820_BUSY_PIN); +#else esp_rom_gpio_pad_select_gpio(IL3820_BUSY_PIN); +#endif gpio_set_direction(IL3820_BUSY_PIN, GPIO_MODE_INPUT); #if IL3820_USE_RST +#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5,0,0) + gpio_pad_select_gpio(IL3820_RST_PIN); +#else esp_rom_gpio_pad_select_gpio(IL3820_RST_PIN); +#endif gpio_set_direction(IL3820_RST_PIN, GPIO_MODE_OUTPUT); /* Harware reset */ diff --git a/lvgl_tft/ili9163c.c b/lvgl_tft/ili9163c.c index a4e0019..c52b6aa 100644 --- a/lvgl_tft/ili9163c.c +++ b/lvgl_tft/ili9163c.c @@ -13,6 +13,10 @@ #include "freertos/FreeRTOS.h" #include "freertos/task.h" #include "assert.h" +#include "esp_idf_version.h" +#if ESP_IDF_VERSION <= ESP_IDF_VERSION_VAL(5,0,0) +#include "rom/gpio.h" +#endif /********************* * DEFINES @@ -138,9 +142,17 @@ void ili9163c_init(void) }; //Initialize non-SPI GPIOs - esp_rom_gpio_pad_select_gpio(ILI9163C_DC); +#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5,0,0) + gpio_pad_select_gpio(ILI9163C_DC); +#else + esp_rom_gpio_pad_select_gpio(ILI9163C_DC); +#endif gpio_set_direction(ILI9163C_DC, GPIO_MODE_OUTPUT); - esp_rom_gpio_pad_select_gpio(ILI9163C_RST); +#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5,0,0) + gpio_pad_select_gpio(ILI9163C_RST); +#else + esp_rom_gpio_pad_select_gpio(ILI9163C_RST); +#endif gpio_set_direction(ILI9163C_RST, GPIO_MODE_OUTPUT); //Reset the display diff --git a/lvgl_tft/ili9341.c b/lvgl_tft/ili9341.c index f580e67..99ae5a2 100644 --- a/lvgl_tft/ili9341.c +++ b/lvgl_tft/ili9341.c @@ -12,6 +12,10 @@ #include "esp_log.h" #include "freertos/FreeRTOS.h" #include "freertos/task.h" +#include "esp_idf_version.h" +#if ESP_IDF_VERSION <= ESP_IDF_VERSION_VAL(5,0,0) +#include "rom/gpio.h" +#endif /********************* * DEFINES @@ -81,11 +85,19 @@ void ili9341_init(void) }; //Initialize non-SPI GPIOs +#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5,0,0) + gpio_pad_select_gpio(ILI9341_DC); +#else esp_rom_gpio_pad_select_gpio(ILI9341_DC); +#endif gpio_set_direction(ILI9341_DC, GPIO_MODE_OUTPUT); #if ILI9341_USE_RST +#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5,0,0) + gpio_pad_select_gpio(ILI9341_RST); +#else esp_rom_gpio_pad_select_gpio(ILI9341_RST); +#endif gpio_set_direction(ILI9341_RST, GPIO_MODE_OUTPUT); //Reset the display diff --git a/lvgl_tft/ili9481.c b/lvgl_tft/ili9481.c index b27c517..5a2679e 100644 --- a/lvgl_tft/ili9481.c +++ b/lvgl_tft/ili9481.c @@ -13,7 +13,10 @@ #include "freertos/FreeRTOS.h" #include "freertos/task.h" - +#include "esp_idf_version.h" +#if ESP_IDF_VERSION <= ESP_IDF_VERSION_VAL(5,0,0) +#include "rom/gpio.h" +#endif /********************* * DEFINES *********************/ @@ -74,11 +77,19 @@ void ili9481_init(void) }; //Initialize non-SPI GPIOs +#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5,0,0) + gpio_pad_select_gpio(ILI9481_DC); +#else esp_rom_gpio_pad_select_gpio(ILI9481_DC); +#endif gpio_set_direction(ILI9481_DC, GPIO_MODE_OUTPUT); #if ILI9481_USE_RST +#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5,0,0) + gpio_pad_select_gpio(ILI9481_RST); +#else esp_rom_gpio_pad_select_gpio(ILI9481_RST); +#endif gpio_set_direction(ILI9481_RST, GPIO_MODE_OUTPUT); //Reset the display diff --git a/lvgl_tft/ili9486.c b/lvgl_tft/ili9486.c index 0d4a823..ef5c3fb 100644 --- a/lvgl_tft/ili9486.c +++ b/lvgl_tft/ili9486.c @@ -12,6 +12,10 @@ #include "esp_log.h" #include "freertos/FreeRTOS.h" #include "freertos/task.h" +#include "esp_idf_version.h" +#if ESP_IDF_VERSION <= ESP_IDF_VERSION_VAL(5,0,0) +#include "rom/gpio.h" +#endif /********************* * DEFINES @@ -66,11 +70,19 @@ void ili9486_init(void) }; //Initialize non-SPI GPIOs +#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5,0,0) + gpio_pad_select_gpio(ILI9486_DC); +#else esp_rom_gpio_pad_select_gpio(ILI9486_DC); +#endif gpio_set_direction(ILI9486_DC, GPIO_MODE_OUTPUT); #if ILI9486_USE_RST +#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5,0,0) + gpio_pad_select_gpio(ILI9486_RST); +#else esp_rom_gpio_pad_select_gpio(ILI9486_RST); +#endif gpio_set_direction(ILI9486_RST, GPIO_MODE_OUTPUT); //Reset the display diff --git a/lvgl_tft/ili9488.c b/lvgl_tft/ili9488.c index f67a5d1..769d868 100644 --- a/lvgl_tft/ili9488.c +++ b/lvgl_tft/ili9488.c @@ -13,6 +13,10 @@ #include "freertos/FreeRTOS.h" #include "freertos/task.h" +#include "esp_idf_version.h" +#if ESP_IDF_VERSION <= ESP_IDF_VERSION_VAL(5,0,0) +#include "rom/gpio.h" +#endif /********************* * DEFINES @@ -76,11 +80,19 @@ void ili9488_init(void) }; //Initialize non-SPI GPIOs +#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5,0,0) + gpio_pad_select_gpio(ILI9488_DC); +#else esp_rom_gpio_pad_select_gpio(ILI9488_DC); +#endif gpio_set_direction(ILI9488_DC, GPIO_MODE_OUTPUT); #if ILI9488_USE_RST - esp_rom_gpio_pad_select_gpio(ILI9488_RST); +#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5,0,0) + gpio_pad_select_gpio(ILI9488_RST); +#else + esp_rom_gpio_pad_select_gpio(ILI9488_RST); +#endif gpio_set_direction(ILI9488_RST, GPIO_MODE_OUTPUT); //Reset the display diff --git a/lvgl_tft/pcd8544.c b/lvgl_tft/pcd8544.c index 9f5e2ff..9dcd935 100644 --- a/lvgl_tft/pcd8544.c +++ b/lvgl_tft/pcd8544.c @@ -14,7 +14,10 @@ #include "freertos/task.h" #include "pcd8544.h" - +#include "esp_idf_version.h" +#if ESP_IDF_VERSION <= ESP_IDF_VERSION_VAL(5,0,0) +#include "rom/gpio.h" +#endif #define TAG "lv_pcd8544" /********************** @@ -57,9 +60,17 @@ void pcd8544_init(void){ // TODO: orientation // Initialize non-SPI GPIOs +#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5,0,0) + gpio_pad_select_gpio(PCD8544_DC); +#else esp_rom_gpio_pad_select_gpio(PCD8544_DC); +#endif gpio_set_direction(PCD8544_DC, GPIO_MODE_OUTPUT); +#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5,0,0) + gpio_pad_select_gpio(PCD8544_RST); +#else esp_rom_gpio_pad_select_gpio(PCD8544_RST); +#endif gpio_set_direction(PCD8544_RST, GPIO_MODE_OUTPUT); // Reset the display diff --git a/lvgl_tft/ra8875.c b/lvgl_tft/ra8875.c index 2a5e455..73acd4f 100644 --- a/lvgl_tft/ra8875.c +++ b/lvgl_tft/ra8875.c @@ -12,6 +12,10 @@ #include "esp_log.h" #include "freertos/FreeRTOS.h" #include "freertos/task.h" +#include "esp_idf_version.h" +#if ESP_IDF_VERSION <= ESP_IDF_VERSION_VAL(5,0,0) +#include "rom/gpio.h" +#endif /********************* * DEFINES @@ -151,7 +155,11 @@ void ra8875_init(void) // Initialize non-SPI GPIOs #if RA8875_USE_RST +#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5,0,0) + gpio_pad_select_gpio(RA8875_RST); +#else esp_rom_gpio_pad_select_gpio(RA8875_RST); +#endif gpio_set_direction(RA8875_RST, GPIO_MODE_OUTPUT); // Reset the RA8875 diff --git a/lvgl_tft/sh1107.c b/lvgl_tft/sh1107.c index bef776c..622d002 100644 --- a/lvgl_tft/sh1107.c +++ b/lvgl_tft/sh1107.c @@ -12,6 +12,10 @@ #include "esp_log.h" #include "freertos/FreeRTOS.h" #include "freertos/task.h" +#include "esp_idf_version.h" +#if ESP_IDF_VERSION <= ESP_IDF_VERSION_VAL(5,0,0) +#include "rom/gpio.h" +#endif /********************* * DEFINES @@ -92,11 +96,19 @@ void sh1107_init(void) }; //Initialize non-SPI GPIOs - esp_rom_gpio_pad_select_gpio(SH1107_DC); +#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5,0,0) + gpio_pad_select_gpio(SH1107_DC); +#else + esp_rom_gpio_pad_select_gpio(SH1107_DC); +#endif gpio_set_direction(SH1107_DC, GPIO_MODE_OUTPUT); #if SH1107_USE_RST - esp_rom_gpio_pad_select_gpio(SH1107_RST); +#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5,0,0) + gpio_pad_select_gpio(SH1107_RST); +#else + esp_rom_gpio_pad_select_gpio(SH1107_RST); +#endif gpio_set_direction(SH1107_RST, GPIO_MODE_OUTPUT); //Reset the display diff --git a/lvgl_tft/st7735s.c b/lvgl_tft/st7735s.c index ed1f481..e817645 100644 --- a/lvgl_tft/st7735s.c +++ b/lvgl_tft/st7735s.c @@ -12,6 +12,10 @@ #include "esp_log.h" #include "freertos/FreeRTOS.h" #include "freertos/task.h" +#include "esp_idf_version.h" +#if ESP_IDF_VERSION <= ESP_IDF_VERSION_VAL(5,0,0) +#include "rom/gpio.h" +#endif #ifdef CONFIG_LV_M5STICKC_HANDLE_AXP192 #include "lvgl_i2c/i2c_manager.h" @@ -98,11 +102,19 @@ void st7735s_init(void) }; //Initialize non-SPI GPIOs - esp_rom_gpio_pad_select_gpio(ST7735S_DC); +#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5,0,0) + gpio_pad_select_gpio(ST7735S_DC); +#else + esp_rom_gpio_pad_select_gpio(ST7735S_DC); +#endif gpio_set_direction(ST7735S_DC, GPIO_MODE_OUTPUT); #if ST7735S_USE_RST - esp_rom_gpio_pad_select_gpio(ST7735S_RST); +#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5,0,0) + gpio_pad_select_gpio(ST7735S_RST); +#else + esp_rom_gpio_pad_select_gpio(ST7735S_RST); +#endif gpio_set_direction(ST7735S_RST, GPIO_MODE_OUTPUT); //Reset the display diff --git a/lvgl_tft/st7789.c b/lvgl_tft/st7789.c index 40451f8..361924c 100644 --- a/lvgl_tft/st7789.c +++ b/lvgl_tft/st7789.c @@ -14,6 +14,10 @@ #include "disp_spi.h" #include "driver/gpio.h" +#include "esp_idf_version.h" +#if ESP_IDF_VERSION <= ESP_IDF_VERSION_VAL(5,0,0) +#include "rom/gpio.h" +#endif /********************* * DEFINES @@ -86,11 +90,19 @@ void st7789_init(void) }; //Initialize non-SPI GPIOs +#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5,0,0) + gpio_pad_select_gpio(ST7789_DC); +#else esp_rom_gpio_pad_select_gpio(ST7789_DC); +#endif gpio_set_direction(ST7789_DC, GPIO_MODE_OUTPUT); #if !defined(ST7789_SOFT_RST) +#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5,0,0) + gpio_pad_select_gpio(ST7789_RST); +#else esp_rom_gpio_pad_select_gpio(ST7789_RST); +#endif gpio_set_direction(ST7789_RST, GPIO_MODE_OUTPUT); #endif diff --git a/lvgl_tft/st7796s.c b/lvgl_tft/st7796s.c index 6faae1e..072c433 100644 --- a/lvgl_tft/st7796s.c +++ b/lvgl_tft/st7796s.c @@ -12,6 +12,10 @@ #include "esp_log.h" #include "freertos/FreeRTOS.h" #include "freertos/task.h" +#include "esp_idf_version.h" +#if ESP_IDF_VERSION <= ESP_IDF_VERSION_VAL(5,0,0) +#include "rom/gpio.h" +#endif /********************* * DEFINES @@ -82,11 +86,19 @@ void st7796s_init(void) }; //Initialize non-SPI GPIOs - esp_rom_gpio_pad_select_gpio(ST7796S_DC); +#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5,0,0) + gpio_pad_select_gpio(ST7796S_DC); +#else + esp_rom_gpio_pad_select_gpio(ST7796S_DC); +#endif gpio_set_direction(ST7796S_DC, GPIO_MODE_OUTPUT); #if ST7796S_USE_RST - esp_rom_gpio_pad_select_gpio(ST7796S_RST); +#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5,0,0) + gpio_pad_select_gpio(ST7796S_RST); +#else + esp_rom_gpio_pad_select_gpio(ST7796S_RST); +#endif gpio_set_direction(ST7796S_RST, GPIO_MODE_OUTPUT); //Reset the display diff --git a/lvgl_touch/adcraw.c b/lvgl_touch/adcraw.c index 7759048..e0930a5 100644 --- a/lvgl_touch/adcraw.c +++ b/lvgl_touch/adcraw.c @@ -9,6 +9,10 @@ #include "freertos/task.h" #include "driver/gpio.h" #include +#include "esp_idf_version.h" +#if ESP_IDF_VERSION <= ESP_IDF_VERSION_VAL(5,0,0) +#include "rom/gpio.h" +#endif #if CONFIG_LV_TOUCH_CONTROLLER_ADCRAW @@ -139,10 +143,18 @@ static void setup_axis(gpio_num_t plus, gpio_num_t minus, gpio_num_t measure, gp { // Set GPIOs: // - Float "ignore" and "measure" - esp_rom_gpio_pad_select_gpio(ignore); +#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5,0,0) + gpio_pad_select_gpio(ignore); +#else + esp_rom_gpio_pad_select_gpio(ignore); +#endif gpio_set_direction(ignore, GPIO_MODE_DISABLE); gpio_set_pull_mode(ignore, GPIO_FLOATING); - esp_rom_gpio_pad_select_gpio(measure); +#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5,0,0) + gpio_pad_select_gpio(measure); +#else + esp_rom_gpio_pad_select_gpio(measure); +#endif gpio_set_direction(measure, GPIO_MODE_DISABLE); gpio_set_pull_mode(measure, GPIO_FLOATING); // - Set "plus" to 1, "minus" to 0