Merge pull request #191 from tore-espressif/develop

Merge master into develop
This commit is contained in:
Tomas Rezucha 2022-04-19 08:03:36 +02:00 committed by GitHub
commit bd8a7e3edd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 33 deletions

View file

@ -6,12 +6,14 @@ jobs:
build: build:
strategy: strategy:
matrix: matrix:
idf_ver: ["v4.1", "v4.2", "v4.3"] idf_ver: ["v4.1", "v4.2", "v4.3", "v4.4"]
idf_target: ["esp32"] idf_target: ["esp32", "esp32s2", "esp32c3"]
include: exclude:
- idf_ver: "v4.2" - idf_ver: "v4.1"
idf_target: esp32s2 idf_target: esp32s2
- idf_ver: "v4.3" - idf_ver: "v4.1"
idf_target: esp32c3
- idf_ver: "v4.2"
idf_target: esp32c3 idf_target: esp32c3
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
container: espressif/idf:release-${{ matrix.idf_ver }} container: espressif/idf:release-${{ matrix.idf_ver }}

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);
@ -248,6 +241,7 @@ size_t lvgl_get_display_buffer_size(void)
#else /* LVGL v8 */ #else /* LVGL v8 */
/* ToDo: Implement display buffer size calculation with configuration values from the display driver */ /* ToDo: Implement display buffer size calculation with configuration values from the display driver */
disp_buffer_size = 320*40; // Reasonable for start
#endif #endif
return disp_buffer_size; return disp_buffer_size;
@ -267,12 +261,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 +281,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 +290,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 +307,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"