backward compatibility with esp-idf release/v4.4

This commit is contained in:
hiruna 2023-06-03 23:08:29 +10:00
parent 50b212aa56
commit de52f295db
18 changed files with 216 additions and 18 deletions

View file

@ -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
*********************/

View file

@ -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);

View file

@ -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

View file

@ -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);
}

View file

@ -21,7 +21,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
*********************/
@ -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

View file

@ -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 */

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -9,6 +9,10 @@
#include "freertos/task.h"
#include "driver/gpio.h"
#include <stddef.h>
#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