Merge branch 'master' into develop

Resolving conflicts
This commit is contained in:
Tomas Rezucha 2022-04-11 09:14:22 +02:00
commit ef108457c7
3 changed files with 13 additions and 28 deletions

View file

@ -82,14 +82,6 @@ void lvgl_interface_init(void)
ESP_LOGI(TAG, "Display buffer size: %d", display_buffer_size); ESP_LOGI(TAG, "Display buffer size: %d", display_buffer_size);
/* SPI DMA Channel selection
* SPI_DMA_CH1 is only defined for ESP32, so let the driver choose which
* channel to use, and use the proven channel 1 on esp32 targets */
int dma_channel = 3;
#if defined (CONFIG_IDF_TARGET_ESP32)
dma_channel = 1;
#endif
#if defined (CONFIG_LV_TFT_DISPLAY_CONTROLLER_FT81X) #if defined (CONFIG_LV_TFT_DISPLAY_CONTROLLER_FT81X)
init_ft81x(dma_channel); init_ft81x(dma_channel);
return; return;
@ -107,8 +99,9 @@ void lvgl_interface_init(void)
miso = TP_SPI_MISO; miso = TP_SPI_MISO;
#endif #endif
// We use DMA channel 1 for all cases
lvgl_spi_driver_init(TFT_SPI_HOST, miso, DISP_SPI_MOSI, DISP_SPI_CLK, lvgl_spi_driver_init(TFT_SPI_HOST, miso, DISP_SPI_MOSI, DISP_SPI_CLK,
spi_max_transfer_size, dma_channel, DISP_SPI_IO2, DISP_SPI_IO3); spi_max_transfer_size, 1, DISP_SPI_IO2, DISP_SPI_IO3);
disp_spi_add_device(TFT_SPI_HOST); disp_spi_add_device(TFT_SPI_HOST);
@ -267,12 +260,6 @@ bool lvgl_spi_driver_init(int host,
int dma_channel, int dma_channel,
int quadwp_pin, int quadhd_pin) int quadwp_pin, int quadhd_pin)
{ {
#if defined (SPI_HOST_MAX)
assert((SPI1_HOST <= host) && (SPI_HOST_MAX > host));
#else
assert((SPI1_HOST <= host) && ((SPI3_HOST + 1) > host));
#endif
const char *spi_names[] = { const char *spi_names[] = {
"SPI1_HOST", "SPI2_HOST", "SPI3_HOST" "SPI1_HOST", "SPI2_HOST", "SPI3_HOST"
}; };
@ -293,13 +280,7 @@ bool lvgl_spi_driver_init(int host,
}; };
ESP_LOGI(TAG, "Initializing SPI bus..."); ESP_LOGI(TAG, "Initializing SPI bus...");
esp_err_t ret = spi_bus_initialize((spi_host_device_t) host, &buscfg, dma_channel);
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 3, 0)
esp_err_t ret = spi_bus_initialize((spi_host_device_t) host, &buscfg, (spi_dma_chan_t)dma_channel);
#else
esp_err_t ret = spi_bus_initialize(host, &buscfg, dma_channel);
#endif
assert(ret == ESP_OK); assert(ret == ESP_OK);
return ESP_OK != ret; return ESP_OK != ret;
@ -308,7 +289,7 @@ bool lvgl_spi_driver_init(int host,
static int calculate_spi_max_transfer_size(const int display_buffer_size) static int calculate_spi_max_transfer_size(const int display_buffer_size)
{ {
int retval = 0; int retval = 0;
#if defined (CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9481) || \ #if defined (CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9481) || \
defined (CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9488) defined (CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9488)
retval = display_buffer_size * 3; retval = display_buffer_size * 3;
@ -325,7 +306,7 @@ static int calculate_spi_max_transfer_size(const int display_buffer_size)
#else #else
retval = display_buffer_size * 2; retval = display_buffer_size * 2;
#endif #endif
return retval; return retval;
} }

View file

@ -112,7 +112,11 @@ extern "C" {
* If the user sets the same MOSI and CLK pins for both display and indev * If the user sets the same MOSI and CLK pins for both display and indev
* controllers then we can assume the user is using the same SPI bus * controllers then we can assume the user is using the same SPI bus
* If so verify the user specified the same SPI bus for both */ * If so verify the user specified the same SPI bus for both */
#if !defined (CONFIG_LV_TFT_DISPLAY_CONTROLLER_FT81X) #if defined (CONFIG_LV_TOUCH_CONTROLLER_SPI2_HOST)
#define TOUCH_SPI_HOST SPI2_HOST
#elif defined (CONFIG_LV_TOUCH_CONTROLLER_SPI3_HOST)
#define TOUCH_SPI_HOST SPI3_HOST
#endif
#if defined (CONFIG_LV_TFT_DISPLAY_PROTOCOL_SPI) && \ #if defined (CONFIG_LV_TFT_DISPLAY_PROTOCOL_SPI) && \
(CONFIG_LV_TFT_DISPLAY_PROTOCOL_SPI == 1) && \ (CONFIG_LV_TFT_DISPLAY_PROTOCOL_SPI == 1) && \
@ -170,7 +174,6 @@ extern "C" {
#else #else
#define SPI_TFT_SPI_MODE (0U) #define SPI_TFT_SPI_MODE (0U)
#endif #endif
#endif
/* Touch driver */ /* Touch driver */
#if (CONFIG_LV_TOUCH_CONTROLLER == TOUCH_CONTROLLER_STMPE610) #if (CONFIG_LV_TOUCH_CONTROLLER == TOUCH_CONTROLLER_STMPE610)

View file

@ -469,8 +469,9 @@ menu "LVGL TFT Display controller"
choice choice
prompt "TFT SPI Bus." if LV_TFT_DISPLAY_PROTOCOL_SPI prompt "TFT SPI Bus." if LV_TFT_DISPLAY_PROTOCOL_SPI
default LV_TFT_DISPLAY_SPI2_HOST if LV_PREDEFINED_DISPLAY_TTGO default LV_TFT_DISPLAY_SPI2_HOST
default LV_TFT_DISPLAY_SPI3_HOST if !LV_PREDEFINED_DISPLAY_TTGO help
Select the SPI Bus the TFT Display is attached to.
config LV_TFT_DISPLAY_SPI2_HOST config LV_TFT_DISPLAY_SPI2_HOST
bool "SPI2_HOST" bool "SPI2_HOST"