Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LVGL release/v8.3 & ESP-IDF 4.2 - 5.2 #223

Open
wants to merge 20 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ endif()

idf_component_register(SRCS ${SOURCES}
INCLUDE_DIRS ${LVGL_INCLUDE_DIRS}
REQUIRES lvgl)
REQUIRES lvgl driver)

target_compile_definitions(${COMPONENT_LIB} PUBLIC "-DLV_LVGL_H_INCLUDE_SIMPLE")

Expand Down
10 changes: 9 additions & 1 deletion lvgl_helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,17 @@
#include "lvgl_spi_conf.h"

#include "lvgl_i2c/i2c_manager.h"
#include "esp_idf_version.h"

#ifdef LV_LVGL_H_INCLUDE_SIMPLE
#include "lvgl.h"
#else
#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 Expand Up @@ -175,10 +179,14 @@ bool lvgl_spi_driver_init(int host,
};

ESP_LOGI(TAG, "Initializing SPI bus...");
#if defined (CONFIG_IDF_TARGET_ESP32C3)
#if defined (CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32S3)
dma_channel = SPI_DMA_CH_AUTO;
#endif
#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(4,3,0)
esp_err_t ret = spi_bus_initialize(host, &buscfg, dma_channel);
#else
esp_err_t ret = spi_bus_initialize(host, &buscfg, (spi_dma_chan_t)dma_channel);
#endif
assert(ret == ESP_OK);

return ESP_OK != ret;
Expand Down
12 changes: 10 additions & 2 deletions lvgl_helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ extern "C" {
/*********************
* DEFINES
*********************/

/* Backward compatibility for LV_HOR_RES_MAX & LV_VER_RES_MAX */
#if defined (CONFIG_LV_HOR_RES_MAX)
#define LV_HOR_RES_MAX CONFIG_LV_HOR_RES_MAX
#endif
#if defined (CONFIG_LV_VER_RES_MAX)
#define LV_VER_RES_MAX CONFIG_LV_VER_RES_MAX
#endif

/* DISP_BUF_SIZE value doesn't have an special meaning, but it's the size
* of the buffer(s) passed to LVGL as display buffers. The default values used
Expand All @@ -40,7 +48,7 @@ extern "C" {
#if defined (CONFIG_LV_TFT_DISPLAY_CONTROLLER_ST7789)
#define DISP_BUF_SIZE (LV_HOR_RES_MAX * 40)
#elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_ST7735S
#define DISP_BUF_SIZE (LV_HOR_RES_MAX * 40)
#define DISP_BUF_SIZE (LV_HOR_RES_MAX * LV_VER_RES_MAX)
#elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_ST7796S
#define DISP_BUF_SIZE (LV_HOR_RES_MAX * 40)
#elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_HX8357
Expand All @@ -56,7 +64,7 @@ extern "C" {
#elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9341
#define DISP_BUF_SIZE (LV_HOR_RES_MAX * 40)
#elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_SSD1306
#if defined (CONFIG_LV_THEME_MONO)
#if defined (CONFIG_LV_USE_THEME_MONO)
#define DISP_BUF_SIZE (LV_HOR_RES_MAX * (LV_VER_RES_MAX / 8))
#else
#define DISP_BUF_SIZE (LV_HOR_RES_MAX * LV_VER_RES_MAX)
Expand Down
12 changes: 5 additions & 7 deletions lvgl_i2c/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@ menu "I2C Port 0"
if I2C_MANAGER_0_ENABLED
config I2C_MANAGER_0_SDA
int "SDA (GPIO pin)"
default 0
config I2C_MANAGER_0_SCL
int "SCL (GPIO pin)"
default 0
config I2C_MANAGER_0_FREQ_HZ
int "Frequency (Hz)"
default 400000
Expand All @@ -19,7 +17,7 @@ menu "I2C Port 0"
5000000 (5 Mhz). I2C busses that involve external wires may
have to be slower, and the real maximum speed the bus will
support depends on the value of the pullup resistors and the
design of the overall circuit.
design of the overall circuit.
config I2C_MANAGER_0_TIMEOUT
int "R/W timeout (ms)"
default 20
Expand Down Expand Up @@ -50,10 +48,10 @@ endmenu


menu "I2C Port 1"

config I2C_MANAGER_1_ENABLED
bool "Enable I2C port 1"

if I2C_MANAGER_1_ENABLED
config I2C_MANAGER_1_SDA
int "SDA (GPIO pin)"
Expand All @@ -68,7 +66,7 @@ menu "I2C Port 1"
5000000 (5 Mhz). I2C busses that involve external wires may
have to be slower, and the real maximum speed the bus will
support depends on the value of the pullup resistors and the
design of the overall circuit.
design of the overall circuit.
config I2C_MANAGER_1_TIMEOUT
int "R/W timeout (ms)"
default 20
Expand All @@ -95,4 +93,4 @@ menu "I2C Port 1"
can attain. Try with these off first if you don't know.
endif

endmenu
endmenu
Loading