Skip to content

Commit

Permalink
backward compatibility with esp-idf release/v4.4
Browse files Browse the repository at this point in the history
  • Loading branch information
hiruna committed Jun 3, 2023
1 parent 50b212a commit de52f29
Show file tree
Hide file tree
Showing 18 changed files with 216 additions and 18 deletions.
3 changes: 3 additions & 0 deletions lvgl_helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
*********************/
Expand Down
12 changes: 10 additions & 2 deletions lvgl_tft/FT81x.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down
13 changes: 12 additions & 1 deletion lvgl_tft/GC9A01.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
*********************/
Expand Down Expand Up @@ -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
Expand Down
13 changes: 12 additions & 1 deletion lvgl_tft/esp_lcd_backlight.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);
}
13 changes: 12 additions & 1 deletion lvgl_tft/hx8357.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
*********************/
Expand Down Expand Up @@ -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
Expand Down
16 changes: 16 additions & 0 deletions lvgl_tft/il3820.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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 */
Expand Down
16 changes: 14 additions & 2 deletions lvgl_tft/ili9163c.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
12 changes: 12 additions & 0 deletions lvgl_tft/ili9341.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
13 changes: 12 additions & 1 deletion lvgl_tft/ili9481.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
*********************/
Expand Down Expand Up @@ -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
Expand Down
12 changes: 12 additions & 0 deletions lvgl_tft/ili9486.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
14 changes: 13 additions & 1 deletion lvgl_tft/ili9488.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
13 changes: 12 additions & 1 deletion lvgl_tft/pcd8544.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"

/**********************
Expand Down Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions lvgl_tft/ra8875.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Loading

0 comments on commit de52f29

Please sign in to comment.