Cleanup lvgl_helpers (#171)

* lvgl_spi_conf: Define TFT_SPI_HOST even when no SPI is choosen

* lvgl_helpers: Let the SPI driver choose SPI DMA Channel

Use SPI_DMA_CH1 only on ESP32 target.

* lvgl_helpers: Move FT81X initialization to helper

* lvgl_interface_init: Initial cleanup

* lvgl_helpers: Replace spi_common_dma_t values with integers

This enum was introduced in ESP-IDF v4.3 and can't be used in older versions
of ESP-IDF.

* lvgl_helpers: Rearrange includes

* lvgl_tft: Remove gpio_pad_select_gpio from drivers init functions

* lvgl_helpers: Use spi_host_device_t from v4.3 onwards

* esp_backlight: Replace gpio with esp_rom API

* il3820: Remove GPIO initialization from driver init

* FT81x: Replace gpio_pad_select_gpio with esp_rom alias

* Fix esp_rom_gpio.h path

* FT81x: Fix esp_rom_gpio.h path

* adcraw: Disable usage of gpio_pad_select_gpio

* GC9A01: Remove usage of gpio_pad_select_gpio

* ra8875: Remove usage of gpio_pad_select_gpio

* Revert "esp_backlight: Replace gpio with esp_rom API"

This reverts commit 24e4bf0b88.

* Revert "FT81x: Replace gpio_pad_select_gpio with esp_rom alias"

This reverts commit 8c7bc42140.

* esp_lcd_backlight: Handle different versions of ESP-IDF

* esp_lcd_backlight: Add missing header

* lvgl_spi_conf: Add missing include

* uc8151d/jd79653a: Fix compilation error when logging is enabled

* FT81x: Handle ESP-IDF v4.3 rom_gpio

* FT81x: Add missing include

* Compilation error when SPI Host is not selected

* lvgl_helpers.c: Enable init_ft81x only when FT81X is selected

* adcraw: Handle gpio_pad_selection on multiple ESP-IDF versions

* esp_lcd_backlight: Remove esp_rom functions

* FT81x: Remove esp_rom functions

* adcraw: Remove esp_rom functions
This commit is contained in:
Carlos Diaz 2022-02-02 16:45:52 -06:00 committed by GitHub
parent 8dda9ded4f
commit 463721e291
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 337 additions and 325 deletions

View file

@ -36,6 +36,7 @@ static void st7796s_set_orientation(uint8_t orientation);
static void st7796s_send_cmd(uint8_t cmd);
static void st7796s_send_data(void *data, uint16_t length);
static void st7796s_send_color(void *data, uint16_t length);
static void st7796s_reset(void);
/**********************
* STATIC VARIABLES
@ -79,37 +80,24 @@ void st7796s_init(void)
{0, {0}, 0xff},
};
//Initialize non-SPI GPIOs
gpio_pad_select_gpio(ST7796S_DC);
gpio_set_direction(ST7796S_DC, GPIO_MODE_OUTPUT);
st7796s_reset();
#if ST7796S_USE_RST
gpio_pad_select_gpio(ST7796S_RST);
gpio_set_direction(ST7796S_RST, GPIO_MODE_OUTPUT);
LV_LOG_INFO("Initialization.");
//Reset the display
gpio_set_level(ST7796S_RST, 0);
vTaskDelay(100 / portTICK_RATE_MS);
gpio_set_level(ST7796S_RST, 1);
vTaskDelay(100 / portTICK_RATE_MS);
#endif
//Send all the commands
uint16_t cmd = 0;
while (init_cmds[cmd].databytes != 0xff)
{
st7796s_send_cmd(init_cmds[cmd].cmd);
st7796s_send_data(init_cmds[cmd].data, init_cmds[cmd].databytes & 0x1F);
if (init_cmds[cmd].databytes & 0x80)
{
vTaskDelay(100 / portTICK_RATE_MS);
}
cmd++;
}
LV_LOG_INFO("Initialization.");
//Send all the commands
uint16_t cmd = 0;
while (init_cmds[cmd].databytes != 0xff)
{
st7796s_send_cmd(init_cmds[cmd].cmd);
st7796s_send_data(init_cmds[cmd].data, init_cmds[cmd].databytes & 0x1F);
if (init_cmds[cmd].databytes & 0x80)
{
vTaskDelay(100 / portTICK_RATE_MS);
}
cmd++;
}
st7796s_set_orientation(CONFIG_LV_DISPLAY_ORIENTATION);
st7796s_set_orientation(CONFIG_LV_DISPLAY_ORIENTATION);
#if ST7796S_INVERT_COLORS == 1
st7796s_send_cmd(0x21);
@ -210,3 +198,13 @@ static void st7796s_set_orientation(uint8_t orientation)
st7796s_send_cmd(0x36);
st7796s_send_data((void *)&data[orientation], 1);
}
static void st7796s_reset(void)
{
#if ST7796S_USE_RST
gpio_set_level(ST7796S_RST, 0);
vTaskDelay(100 / portTICK_RATE_MS);
gpio_set_level(ST7796S_RST, 1);
vTaskDelay(100 / portTICK_RATE_MS);
#endif
}