Skip to content

Commit

Permalink
Merge pull request #191 from tore-espressif/develop
Browse files Browse the repository at this point in the history
Merge master into develop
  • Loading branch information
tore-espressif committed Apr 19, 2022
2 parents 7c6bdc5 + 9fd1634 commit bd8a7e3
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 33 deletions.
12 changes: 7 additions & 5 deletions .github/workflows/build_examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@ jobs:
build:
strategy:
matrix:
idf_ver: ["v4.1", "v4.2", "v4.3"]
idf_target: ["esp32"]
include:
- idf_ver: "v4.2"
idf_ver: ["v4.1", "v4.2", "v4.3", "v4.4"]
idf_target: ["esp32", "esp32s2", "esp32c3"]
exclude:
- idf_ver: "v4.1"
idf_target: esp32s2
- idf_ver: "v4.3"
- idf_ver: "v4.1"
idf_target: esp32c3
- idf_ver: "v4.2"
idf_target: esp32c3
runs-on: ubuntu-20.04
container: espressif/idf:release-${{ matrix.idf_ver }}
Expand Down
30 changes: 6 additions & 24 deletions lvgl_helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,6 @@ void lvgl_interface_init(void)

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)
init_ft81x(dma_channel);
return;
Expand All @@ -107,8 +99,9 @@ void lvgl_interface_init(void)
miso = TP_SPI_MISO;
#endif

// We use DMA channel 1 for all cases
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);

Expand Down Expand Up @@ -248,6 +241,7 @@ size_t lvgl_get_display_buffer_size(void)

#else /* LVGL v8 */
/* ToDo: Implement display buffer size calculation with configuration values from the display driver */
disp_buffer_size = 320*40; // Reasonable for start
#endif

return disp_buffer_size;
Expand All @@ -267,12 +261,6 @@ bool lvgl_spi_driver_init(int host,
int dma_channel,
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[] = {
"SPI1_HOST", "SPI2_HOST", "SPI3_HOST"
};
Expand All @@ -293,13 +281,7 @@ bool lvgl_spi_driver_init(int host,
};

ESP_LOGI(TAG, "Initializing SPI bus...");

#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

esp_err_t ret = spi_bus_initialize((spi_host_device_t) host, &buscfg, dma_channel);
assert(ret == ESP_OK);

return ESP_OK != ret;
Expand All @@ -308,7 +290,7 @@ bool lvgl_spi_driver_init(int host,
static int calculate_spi_max_transfer_size(const int display_buffer_size)
{
int retval = 0;

#if defined (CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9481) || \
defined (CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9488)
retval = display_buffer_size * 3;
Expand All @@ -325,7 +307,7 @@ static int calculate_spi_max_transfer_size(const int display_buffer_size)
#else
retval = display_buffer_size * 2;
#endif

return retval;
}

Expand Down
7 changes: 5 additions & 2 deletions lvgl_spi_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,11 @@ extern "C" {
* 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
* 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) && \
(CONFIG_LV_TFT_DISPLAY_PROTOCOL_SPI == 1) && \
Expand Down Expand Up @@ -170,7 +174,6 @@ extern "C" {
#else
#define SPI_TFT_SPI_MODE (0U)
#endif
#endif

/* Touch driver */
#if (CONFIG_LV_TOUCH_CONTROLLER == TOUCH_CONTROLLER_STMPE610)
Expand Down
5 changes: 3 additions & 2 deletions lvgl_tft/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -469,8 +469,9 @@ menu "LVGL TFT Display controller"

choice
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_SPI3_HOST if !LV_PREDEFINED_DISPLAY_TTGO
default LV_TFT_DISPLAY_SPI2_HOST
help
Select the SPI Bus the TFT Display is attached to.

config LV_TFT_DISPLAY_SPI2_HOST
bool "SPI2_HOST"
Expand Down

0 comments on commit bd8a7e3

Please sign in to comment.