Compare commits
10 commits
feat/displ
...
master
Author | SHA1 | Date | |
---|---|---|---|
Andreas Mieke | 341b522b7b | ||
Andreas Mieke | 8592cb9d29 | ||
26fe6e7703 | |||
c4cd524487 | |||
8d1fbcf5c4 | |||
8cbbc299e9 | |||
762bb35265 | |||
d44b7e808a | |||
02d351f898 | |||
22ba4161b5 |
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -56,3 +56,7 @@ dkms.conf
|
||||||
|
|
||||||
# ESP-IDF build dir
|
# ESP-IDF build dir
|
||||||
build
|
build
|
||||||
|
|
||||||
|
# Kconfig files
|
||||||
|
sdkconfig
|
||||||
|
sdkconfig.old
|
|
@ -44,6 +44,8 @@ elseif(CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9163C)
|
||||||
list(APPEND SOURCES "lvgl_tft/ili9163c.c")
|
list(APPEND SOURCES "lvgl_tft/ili9163c.c")
|
||||||
elseif(CONFIG_LV_TFT_DISPLAY_CONTROLLER_PCD8544)
|
elseif(CONFIG_LV_TFT_DISPLAY_CONTROLLER_PCD8544)
|
||||||
list(APPEND SOURCES "lvgl_tft/pcd8544.c")
|
list(APPEND SOURCES "lvgl_tft/pcd8544.c")
|
||||||
|
elseif(CONFIG_LV_TFT_DISPLAY_CONTROLLER_SCHMITT)
|
||||||
|
list(APPEND SOURCES "lvgl_tft/schmitt.c")
|
||||||
else()
|
else()
|
||||||
message(WARNING "LVGL ESP32 drivers: Display controller not defined.")
|
message(WARNING "LVGL ESP32 drivers: Display controller not defined.")
|
||||||
endif()
|
endif()
|
||||||
|
@ -86,7 +88,7 @@ endif()
|
||||||
|
|
||||||
idf_component_register(SRCS ${SOURCES}
|
idf_component_register(SRCS ${SOURCES}
|
||||||
INCLUDE_DIRS ${LVGL_INCLUDE_DIRS}
|
INCLUDE_DIRS ${LVGL_INCLUDE_DIRS}
|
||||||
REQUIRES lvgl)
|
REQUIRES lvgl driver esp_common log freertos esp_rom soc)
|
||||||
|
|
||||||
target_compile_definitions(${COMPONENT_LIB} PUBLIC "-DLV_LVGL_H_INCLUDE_SIMPLE")
|
target_compile_definitions(${COMPONENT_LIB} PUBLIC "-DLV_LVGL_H_INCLUDE_SIMPLE")
|
||||||
|
|
||||||
|
|
|
@ -154,34 +154,12 @@ 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)
|
||||||
{
|
{
|
||||||
int dma_chan = 0 /* SPI_DMA_DISABLED */;
|
assert((0 <= host) && (3 > host));
|
||||||
|
|
||||||
#if defined (CONFIG_IDF_TARGET_ESP32)
|
|
||||||
assert((SPI_HOST <= host) && (VSPI_HOST >= host));
|
|
||||||
const char *spi_names[] = {
|
|
||||||
"SPI_HOST", "HSPI_HOST", "VSPI_HOST"
|
|
||||||
};
|
|
||||||
|
|
||||||
dma_chan = dma_channel;
|
|
||||||
#elif defined (CONFIG_IDF_TARGET_ESP32S2)
|
|
||||||
assert((SPI_HOST <= host) && (HSPI_HOST >= host));
|
|
||||||
const char *spi_names[] = {
|
|
||||||
"SPI_HOST", "", ""
|
|
||||||
};
|
|
||||||
|
|
||||||
dma_chan = dma_channel;
|
|
||||||
#elif defined (CONFIG_IDF_TARGET_ESP32C3)
|
|
||||||
assert((SPI1_HOST <= host) && (SPI3_HOST >= host));
|
|
||||||
const char *spi_names[] = {
|
const char *spi_names[] = {
|
||||||
"SPI1_HOST", "SPI2_HOST", "SPI3_HOST"
|
"SPI1_HOST", "SPI2_HOST", "SPI3_HOST"
|
||||||
};
|
};
|
||||||
|
|
||||||
dma_chan = 3 /* SPI_DMA_CH_AUTO */;
|
ESP_LOGI(TAG, "Configuring SPI host %s", spi_names[host]);
|
||||||
#else
|
|
||||||
#error "Target chip not selected"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
ESP_LOGI(TAG, "Configuring SPI host %s (%d)", spi_names[host], host);
|
|
||||||
ESP_LOGI(TAG, "MISO pin: %d, MOSI pin: %d, SCLK pin: %d, IO2/WP pin: %d, IO3/HD pin: %d",
|
ESP_LOGI(TAG, "MISO pin: %d, MOSI pin: %d, SCLK pin: %d, IO2/WP pin: %d, IO3/HD pin: %d",
|
||||||
miso_pin, mosi_pin, sclk_pin, quadwp_pin, quadhd_pin);
|
miso_pin, mosi_pin, sclk_pin, quadwp_pin, quadhd_pin);
|
||||||
|
|
||||||
|
@ -189,17 +167,19 @@ bool lvgl_spi_driver_init(int host,
|
||||||
|
|
||||||
spi_bus_config_t buscfg = {
|
spi_bus_config_t buscfg = {
|
||||||
.miso_io_num = miso_pin,
|
.miso_io_num = miso_pin,
|
||||||
.mosi_io_num = mosi_pin,
|
.mosi_io_num = mosi_pin,
|
||||||
.sclk_io_num = sclk_pin,
|
.sclk_io_num = sclk_pin,
|
||||||
.quadwp_io_num = quadwp_pin,
|
.quadwp_io_num = quadwp_pin,
|
||||||
.quadhd_io_num = quadhd_pin,
|
.quadhd_io_num = quadhd_pin,
|
||||||
.max_transfer_sz = max_transfer_sz
|
.max_transfer_sz = max_transfer_sz
|
||||||
};
|
};
|
||||||
|
|
||||||
ESP_LOGI(TAG, "Initializing SPI bus...");
|
ESP_LOGI(TAG, "Initializing SPI bus...");
|
||||||
esp_err_t ret = spi_bus_initialize(host, &buscfg, dma_chan);
|
#if defined (CONFIG_IDF_TARGET_ESP32C3)
|
||||||
|
dma_channel = SPI_DMA_CH_AUTO;
|
||||||
|
#endif
|
||||||
|
esp_err_t ret = spi_bus_initialize(host, &buscfg, (spi_dma_chan_t)dma_channel);
|
||||||
assert(ret == ESP_OK);
|
assert(ret == ESP_OK);
|
||||||
|
|
||||||
return ESP_OK != ret;
|
return ESP_OK != ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -78,6 +78,8 @@ extern "C" {
|
||||||
#define DISP_BUF_SIZE (LV_HOR_RES_MAX * 40)
|
#define DISP_BUF_SIZE (LV_HOR_RES_MAX * 40)
|
||||||
#elif defined (CONFIG_LV_TFT_DISPLAY_CONTROLLER_PCD8544)
|
#elif defined (CONFIG_LV_TFT_DISPLAY_CONTROLLER_PCD8544)
|
||||||
#define DISP_BUF_SIZE (LV_HOR_RES_MAX * (LV_VER_RES_MAX / 8))
|
#define DISP_BUF_SIZE (LV_HOR_RES_MAX * (LV_VER_RES_MAX / 8))
|
||||||
|
#elif defined (CONFIG_LV_TFT_DISPLAY_CONTROLLER_SCHMITT)
|
||||||
|
#define DISP_BUF_SIZE (LV_HOR_RES_MAX * LV_VER_RES_MAX)
|
||||||
#else
|
#else
|
||||||
#error "No display controller selected"
|
#error "No display controller selected"
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -64,9 +64,7 @@ extern "C" {
|
||||||
|
|
||||||
#define ENABLE_TOUCH_INPUT CONFIG_LV_ENABLE_TOUCH
|
#define ENABLE_TOUCH_INPUT CONFIG_LV_ENABLE_TOUCH
|
||||||
|
|
||||||
#if defined (CONFIG_LV_TFT_DISPLAY_SPI1_HOST)
|
#if defined (CONFIG_LV_TFT_DISPLAY_SPI2_HOST)
|
||||||
#define TFT_SPI_HOST SPI1_HOST
|
|
||||||
#elif defined (CONFIG_LV_TFT_DISPLAY_SPI2_HOST)
|
|
||||||
#define TFT_SPI_HOST SPI2_HOST
|
#define TFT_SPI_HOST SPI2_HOST
|
||||||
#elif defined (CONFIG_LV_TFT_DISPLAY_SPI3_HOST)
|
#elif defined (CONFIG_LV_TFT_DISPLAY_SPI3_HOST)
|
||||||
#define TFT_SPI_HOST SPI3_HOST
|
#define TFT_SPI_HOST SPI3_HOST
|
||||||
|
@ -86,12 +84,10 @@ extern "C" {
|
||||||
#define DISP_SPI_TRANS_MODE_SIO
|
#define DISP_SPI_TRANS_MODE_SIO
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined (CONFIG_LV_TOUCH_CONTROLLER_SPI_HSPI)
|
#if defined (CONFIG_LV_TOUCH_CONTROLLER_SPI2_HOST)
|
||||||
#define TOUCH_SPI_HOST HSPI_HOST
|
#define TOUCH_SPI_HOST SPI2_HOST
|
||||||
#elif defined (CONFIG_LV_TOUCH_CONTROLLER_SPI_VSPI)
|
#elif defined (CONFIG_LV_TOUCH_CONTROLLER_SPI3_HOST)
|
||||||
#define TOUCH_SPI_HOST VSPI_HOST
|
#define TOUCH_SPI_HOST SPI3_HOST
|
||||||
#elif defined (CONFIG_LV_TOUCH_CONTROLLER_SPI_FSPI)
|
|
||||||
#define TOUCH_SPI_HOST FSPI_HOST
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Handle the FT81X Special case */
|
/* Handle the FT81X Special case */
|
||||||
|
@ -107,7 +103,7 @@ extern "C" {
|
||||||
// Detect the use of a shared SPI Bus and verify the user specified the same SPI bus for both touch and tft
|
// Detect the use of a shared SPI Bus and verify the user specified the same SPI bus for both touch and tft
|
||||||
#if defined (CONFIG_LV_TOUCH_DRIVER_PROTOCOL_SPI) && TP_SPI_MOSI == DISP_SPI_MOSI && TP_SPI_CLK == DISP_SPI_CLK
|
#if defined (CONFIG_LV_TOUCH_DRIVER_PROTOCOL_SPI) && TP_SPI_MOSI == DISP_SPI_MOSI && TP_SPI_CLK == DISP_SPI_CLK
|
||||||
#if TFT_SPI_HOST != TOUCH_SPI_HOST
|
#if TFT_SPI_HOST != TOUCH_SPI_HOST
|
||||||
#error You must specify the same SPI host (HSPI, VSPI or FSPI) for both display and touch driver
|
#error You must specify the same SPI host (SPIx_HOST) for both display and touch driver
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define SHARED_SPI_BUS
|
#define SHARED_SPI_BUS
|
||||||
|
@ -118,7 +114,11 @@ extern "C" {
|
||||||
/**********************
|
/**********************
|
||||||
* TYPEDEFS
|
* TYPEDEFS
|
||||||
**********************/
|
**********************/
|
||||||
#if defined (CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9481) || \
|
#if defined (CONFIG_LV_TFT_DISPLAY_CONTROLLER_SCHMITT)
|
||||||
|
|
||||||
|
#define SPI_BUS_MAX_TRANSFER_SZ (DISP_BUF_SIZE * 4)
|
||||||
|
|
||||||
|
#elif defined (CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9481) || \
|
||||||
defined (CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9488)
|
defined (CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9488)
|
||||||
|
|
||||||
#define SPI_BUS_MAX_TRANSFER_SZ (DISP_BUF_SIZE * 3)
|
#define SPI_BUS_MAX_TRANSFER_SZ (DISP_BUF_SIZE * 3)
|
||||||
|
@ -165,7 +165,7 @@ extern "C" {
|
||||||
#elif defined (CONFIG_LV_TFT_DISPLAY_CONTROLLER_PCD8544)
|
#elif defined (CONFIG_LV_TFT_DISPLAY_CONTROLLER_PCD8544)
|
||||||
#define SPI_TFT_CLOCK_SPEED_HZ (4*1000*1000)
|
#define SPI_TFT_CLOCK_SPEED_HZ (4*1000*1000)
|
||||||
#else
|
#else
|
||||||
#define SPI_TFT_CLOCK_SPEED_HZ (40*1000*1000)
|
#define SPI_TFT_CLOCK_SPEED_HZ (5*1000*1000) // Set to 40 later
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -22,7 +22,7 @@ menu "LVGL TFT Display controller"
|
||||||
select LV_TFT_DISPLAY_CONTROLLER_ILI9341
|
select LV_TFT_DISPLAY_CONTROLLER_ILI9341
|
||||||
select LV_TFT_DISPLAY_PROTOCOL_SPI
|
select LV_TFT_DISPLAY_PROTOCOL_SPI
|
||||||
config LV_PREDEFINED_DISPLAY_M5CORE2
|
config LV_PREDEFINED_DISPLAY_M5CORE2
|
||||||
bool "M5Core2"
|
bool "M5Core2"
|
||||||
select LV_TFT_DISPLAY_CONTROLLER_ILI9341
|
select LV_TFT_DISPLAY_CONTROLLER_ILI9341
|
||||||
select LV_TFT_DISPLAY_PROTOCOL_SPI
|
select LV_TFT_DISPLAY_PROTOCOL_SPI
|
||||||
config LV_PREDEFINED_DISPLAY_M5STICK
|
config LV_PREDEFINED_DISPLAY_M5STICK
|
||||||
|
@ -178,6 +178,10 @@ menu "LVGL TFT Display controller"
|
||||||
bool
|
bool
|
||||||
help
|
help
|
||||||
PCD8544 display controller (Nokia 3110/5110)
|
PCD8544 display controller (Nokia 3110/5110)
|
||||||
|
config LV_TFT_DISPLAY_CONTROLLER_SCHMITT
|
||||||
|
bool
|
||||||
|
help
|
||||||
|
Schmitt's display controller
|
||||||
# Display controller communication protocol
|
# Display controller communication protocol
|
||||||
#
|
#
|
||||||
# This symbols define the communication protocol used by the
|
# This symbols define the communication protocol used by the
|
||||||
|
@ -349,6 +353,10 @@ menu "LVGL TFT Display controller"
|
||||||
select LV_TFT_DISPLAY_CONTROLLER_PCD8544
|
select LV_TFT_DISPLAY_CONTROLLER_PCD8544
|
||||||
select LV_TFT_DISPLAY_PROTOCOL_SPI
|
select LV_TFT_DISPLAY_PROTOCOL_SPI
|
||||||
select LV_TFT_DISPLAY_MONOCHROME
|
select LV_TFT_DISPLAY_MONOCHROME
|
||||||
|
config LV_TFT_DISPLAY_USER_CONTROLLER_SCHMITT
|
||||||
|
bool "SCHMITT"
|
||||||
|
select LV_TFT_DISPLAY_CONTROLLER_SCHMITT
|
||||||
|
select LV_TFT_DISPLAY_PROTOCOL_SPI
|
||||||
endchoice
|
endchoice
|
||||||
|
|
||||||
config CUSTOM_DISPLAY_BUFFER_SIZE
|
config CUSTOM_DISPLAY_BUFFER_SIZE
|
||||||
|
@ -469,13 +477,10 @@ 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_SPI3_HOST if LV_PREDEFINED_DISPLAY_TTGO && \
|
default LV_TFT_DISPLAY_SPI2_HOST
|
||||||
!IDF_TARGET_ESP32S2
|
|
||||||
help
|
help
|
||||||
Select the SPI Bus the TFT Display is attached to.
|
Select the SPI Bus the TFT Display is attached to.
|
||||||
|
|
||||||
config LV_TFT_DISPLAY_SPI1_HOST
|
|
||||||
bool "SPI1_HOST"
|
|
||||||
config LV_TFT_DISPLAY_SPI2_HOST
|
config LV_TFT_DISPLAY_SPI2_HOST
|
||||||
bool "SPI2_HOST"
|
bool "SPI2_HOST"
|
||||||
config LV_TFT_DISPLAY_SPI3_HOST
|
config LV_TFT_DISPLAY_SPI3_HOST
|
||||||
|
@ -1011,6 +1016,3 @@ menu "LVGL TFT Display controller"
|
||||||
default 0
|
default 0
|
||||||
|
|
||||||
endmenu
|
endmenu
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -45,6 +45,8 @@ void *disp_driver_init(void)
|
||||||
ili9163c_init();
|
ili9163c_init();
|
||||||
#elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_PCD8544
|
#elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_PCD8544
|
||||||
pcd8544_init();
|
pcd8544_init();
|
||||||
|
#elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_SCHMITT
|
||||||
|
schmitt_init();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// We still use menuconfig for these settings
|
// We still use menuconfig for these settings
|
||||||
|
@ -111,6 +113,8 @@ void disp_driver_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t *
|
||||||
ili9163c_flush(drv, area, color_map);
|
ili9163c_flush(drv, area, color_map);
|
||||||
#elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_PCD8544
|
#elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_PCD8544
|
||||||
pcd8544_flush(drv, area, color_map);
|
pcd8544_flush(drv, area, color_map);
|
||||||
|
#elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_SCHMITT
|
||||||
|
schmitt_flush(drv, area, color_map);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,6 +54,8 @@ extern "C" {
|
||||||
#include "ili9163c.h"
|
#include "ili9163c.h"
|
||||||
#elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_PCD8544
|
#elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_PCD8544
|
||||||
#include "pcd8544.h"
|
#include "pcd8544.h"
|
||||||
|
#elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_SCHMITT
|
||||||
|
#include "schmitt.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*********************
|
/*********************
|
||||||
|
|
|
@ -8,10 +8,12 @@
|
||||||
*********************/
|
*********************/
|
||||||
#include "esp_lcd_backlight.h"
|
#include "esp_lcd_backlight.h"
|
||||||
#include "driver/ledc.h"
|
#include "driver/ledc.h"
|
||||||
#include "driver/gpio.h"
|
#include "rom/gpio.h"
|
||||||
#include "esp_log.h"
|
#include "esp_log.h"
|
||||||
#include "soc/ledc_periph.h" // to invert LEDC output on IDF version < v4.3
|
#include "soc/ledc_periph.h" // to invert LEDC output on IDF version < v4.3
|
||||||
|
|
||||||
|
#define SIG_GPIO_OUT_IDX 128
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
bool pwm_control; // true: LEDC is used, false: GPIO is used
|
bool pwm_control; // true: LEDC is used, false: GPIO is used
|
||||||
int index; // Either GPIO or LEDC channel
|
int index; // Either GPIO or LEDC channel
|
||||||
|
@ -49,7 +51,7 @@ disp_backlight_h disp_backlight_new(const disp_backlight_config_t *config)
|
||||||
};
|
};
|
||||||
const ledc_timer_config_t LCD_backlight_timer = {
|
const ledc_timer_config_t LCD_backlight_timer = {
|
||||||
.speed_mode = LEDC_LOW_SPEED_MODE,
|
.speed_mode = LEDC_LOW_SPEED_MODE,
|
||||||
.bit_num = LEDC_TIMER_10_BIT,
|
.duty_resolution = LEDC_TIMER_10_BIT,
|
||||||
.timer_num = config->timer_idx,
|
.timer_num = config->timer_idx,
|
||||||
.freq_hz = 5000,
|
.freq_hz = 5000,
|
||||||
.clk_cfg = LEDC_AUTO_CLK};
|
.clk_cfg = LEDC_AUTO_CLK};
|
||||||
|
|
27
lvgl_tft/schmitt.c
Normal file
27
lvgl_tft/schmitt.c
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include "schmitt.h"
|
||||||
|
#include "disp_spi.h"
|
||||||
|
|
||||||
|
#include "esp_log.h"
|
||||||
|
|
||||||
|
static const char* TAG = "SCHMITT_DIS";
|
||||||
|
|
||||||
|
void schmitt_init(void)
|
||||||
|
{
|
||||||
|
disp_spi_acquire();
|
||||||
|
// Do things
|
||||||
|
ESP_LOGI(TAG, "schmitt_init() called");
|
||||||
|
disp_spi_release();
|
||||||
|
}
|
||||||
|
|
||||||
|
void schmitt_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * color_map)
|
||||||
|
{
|
||||||
|
disp_spi_acquire();
|
||||||
|
// Do things
|
||||||
|
uint32_t size = lv_area_get_width(area) * lv_area_get_height(area);
|
||||||
|
disp_spi_send_colors(color_map, size * 4);
|
||||||
|
ESP_LOGI(TAG, "schmitt_flush() called");
|
||||||
|
disp_spi_release();
|
||||||
|
lv_disp_flush_ready(drv);
|
||||||
|
}
|
20
lvgl_tft/schmitt.h
Normal file
20
lvgl_tft/schmitt.h
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
#ifndef SCHMITT_H_
|
||||||
|
#define SCHMITT_H_
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#ifdef LV_LVGL_H_INCLUDE_SIMPLE
|
||||||
|
#include "lvgl.h"
|
||||||
|
#else
|
||||||
|
#include "lvgl/lvgl.h"
|
||||||
|
#endif
|
||||||
|
#include "../lvgl_helpers.h"
|
||||||
|
|
||||||
|
#define LV_HOR_RES_MAX 64
|
||||||
|
#define LV_VER_RES_MAX 64
|
||||||
|
|
||||||
|
void schmitt_init(void);
|
||||||
|
|
||||||
|
void schmitt_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * color_map);
|
||||||
|
|
||||||
|
#endif /* SCHMITT_H_ */
|
|
@ -120,9 +120,9 @@ void st7789_init(void)
|
||||||
st7789_set_orientation(CONFIG_LV_DISPLAY_ORIENTATION);
|
st7789_set_orientation(CONFIG_LV_DISPLAY_ORIENTATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The ST7789 display controller can drive 320*240 displays, when using a 240*240
|
/* The ST7789 display controller can drive up to 320*240 displays, when using a 240*240 or 240*135
|
||||||
* display there's a gap of 80px, we need to edit the coordinates to take into
|
* displays there's a gap of 80px or 40/52/53px respectively. 52px or 53x offset depends on display orientation.
|
||||||
* account that gap, this is not necessary in all orientations. */
|
* We need to edit the coordinates to take into account those gaps, this is not necessary in all orientations. */
|
||||||
void st7789_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * color_map)
|
void st7789_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * color_map)
|
||||||
{
|
{
|
||||||
uint8_t data[4] = {0};
|
uint8_t data[4] = {0};
|
||||||
|
@ -139,13 +139,29 @@ void st7789_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * colo
|
||||||
offsety2 += CONFIG_LV_TFT_DISPLAY_Y_OFFSET;
|
offsety2 += CONFIG_LV_TFT_DISPLAY_Y_OFFSET;
|
||||||
|
|
||||||
#elif (LV_HOR_RES_MAX == 240) && (LV_VER_RES_MAX == 240)
|
#elif (LV_HOR_RES_MAX == 240) && (LV_VER_RES_MAX == 240)
|
||||||
#if (CONFIG_LV_DISPLAY_ORIENTATION_PORTRAIT)
|
#if (CONFIG_LV_DISPLAY_ORIENTATION_PORTRAIT)
|
||||||
offsetx1 += 80;
|
offsetx1 += 80;
|
||||||
offsetx2 += 80;
|
offsetx2 += 80;
|
||||||
#elif (CONFIG_LV_DISPLAY_ORIENTATION_LANDSCAPE_INVERTED)
|
#elif (CONFIG_LV_DISPLAY_ORIENTATION_LANDSCAPE_INVERTED)
|
||||||
offsety1 += 80;
|
offsety1 += 80;
|
||||||
offsety2 += 80;
|
offsety2 += 80;
|
||||||
#endif
|
#endif
|
||||||
|
#elif (LV_HOR_RES_MAX == 240) && (LV_VER_RES_MAX == 135)
|
||||||
|
#if (CONFIG_LV_DISPLAY_ORIENTATION_PORTRAIT) || \
|
||||||
|
(CONFIG_LV_DISPLAY_ORIENTATION_PORTRAIT_INVERTED)
|
||||||
|
offsetx1 += 40;
|
||||||
|
offsetx2 += 40;
|
||||||
|
offsety1 += 53;
|
||||||
|
offsety2 += 53;
|
||||||
|
#endif
|
||||||
|
#elif (LV_HOR_RES_MAX == 135) && (LV_VER_RES_MAX == 240)
|
||||||
|
#if (CONFIG_LV_DISPLAY_ORIENTATION_LANDSCAPE) || \
|
||||||
|
(CONFIG_LV_DISPLAY_ORIENTATION_LANDSCAPE_INVERTED)
|
||||||
|
offsetx1 += 52;
|
||||||
|
offsetx2 += 52;
|
||||||
|
offsety1 += 40;
|
||||||
|
offsety2 += 40;
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*Column addresses*/
|
/*Column addresses*/
|
||||||
|
|
|
@ -1,28 +1,28 @@
|
||||||
menu "LVGL Touch controller"
|
menu "LVGL Touch controller"
|
||||||
|
|
||||||
config LV_TOUCH_CONTROLLER
|
config LV_TOUCH_CONTROLLER
|
||||||
int
|
int
|
||||||
default 0 if LV_TOUCH_CONTROLLER_NONE
|
default 0 if LV_TOUCH_CONTROLLER_NONE
|
||||||
default 1 if LV_TOUCH_CONTROLLER_XPT2046
|
default 1 if LV_TOUCH_CONTROLLER_XPT2046
|
||||||
default 2 if LV_TOUCH_CONTROLLER_FT6X06
|
default 2 if LV_TOUCH_CONTROLLER_FT6X06
|
||||||
default 3 if LV_TOUCH_CONTROLLER_STMPE610
|
default 3 if LV_TOUCH_CONTROLLER_STMPE610
|
||||||
default 4 if LV_TOUCH_CONTROLLER_ADCRAW
|
default 4 if LV_TOUCH_CONTROLLER_ADCRAW
|
||||||
default 5 if LV_TOUCH_CONTROLLER_FT81X
|
default 5 if LV_TOUCH_CONTROLLER_FT81X
|
||||||
default 6 if LV_TOUCH_CONTROLLER_RA8875
|
default 6 if LV_TOUCH_CONTROLLER_RA8875
|
||||||
default 7 if LV_TOUCH_CONTROLLER_GT911
|
default 7 if LV_TOUCH_CONTROLLER_GT911
|
||||||
|
|
||||||
choice
|
choice
|
||||||
prompt "Select a touch panel controller model."
|
prompt "Select a touch panel controller model."
|
||||||
default LV_TOUCH_CONTROLLER_NONE
|
default LV_TOUCH_CONTROLLER_NONE
|
||||||
help
|
help
|
||||||
Select the controller for your touch panel.
|
Select the controller for your touch panel.
|
||||||
|
|
||||||
config LV_TOUCH_CONTROLLER_NONE
|
config LV_TOUCH_CONTROLLER_NONE
|
||||||
bool "None"
|
bool "None"
|
||||||
config LV_TOUCH_CONTROLLER_XPT2046
|
config LV_TOUCH_CONTROLLER_XPT2046
|
||||||
select LV_TOUCH_DRIVER_PROTOCOL_SPI
|
select LV_TOUCH_DRIVER_PROTOCOL_SPI
|
||||||
bool "XPT2046"
|
bool "XPT2046"
|
||||||
config LV_TOUCH_CONTROLLER_FT6X06
|
config LV_TOUCH_CONTROLLER_FT6X06
|
||||||
select LV_I2C_TOUCH
|
select LV_I2C_TOUCH
|
||||||
bool "FT6X06"
|
bool "FT6X06"
|
||||||
config LV_TOUCH_CONTROLLER_STMPE610
|
config LV_TOUCH_CONTROLLER_STMPE610
|
||||||
|
@ -61,23 +61,20 @@ menu "LVGL Touch controller"
|
||||||
bool
|
bool
|
||||||
help
|
help
|
||||||
Touch controller uses same interface/device as display
|
Touch controller uses same interface/device as display
|
||||||
(Note: Display must be initialized before touch)
|
(Note: Display must be initialized before touch)
|
||||||
|
|
||||||
choice
|
choice
|
||||||
prompt "Touch Controller SPI Bus."
|
prompt "Touch Controller SPI Bus."
|
||||||
depends on LV_TOUCH_DRIVER_PROTOCOL_SPI
|
depends on LV_TOUCH_DRIVER_PROTOCOL_SPI
|
||||||
|
|
||||||
default LV_TOUCH_CONTROLLER_SPI_VSPI if !IDF_TARGET_ESP32S2
|
default LV_TOUCH_CONTROLLER_SPI2_HOST
|
||||||
default LV_TOUCH_CONTROLLER_SPI_FSPI if IDF_TARGET_ESP32S2
|
|
||||||
help
|
help
|
||||||
Select the SPI Bus the TFT Display is attached to.
|
Select the SPI Bus the touch controller is attached to.
|
||||||
|
|
||||||
config LV_TOUCH_CONTROLLER_SPI_HSPI
|
config LV_TOUCH_CONTROLLER_SPI2_HOST
|
||||||
bool "HSPI"
|
bool "SPI2_HOST"
|
||||||
config LV_TOUCH_CONTROLLER_SPI_VSPI
|
config LV_TOUCH_CONTROLLER_SPI3_HOST
|
||||||
bool "VSPI" if !IDF_TARGET_ESP32S2
|
bool "SPI3_HOST"
|
||||||
config LV_TOUCH_CONTROLLER_SPI_FSPI
|
|
||||||
bool "FSPI" if IDF_TARGET_ESP32S2
|
|
||||||
endchoice
|
endchoice
|
||||||
|
|
||||||
menu "Touchpanel (XPT2046) Pin Assignments"
|
menu "Touchpanel (XPT2046) Pin Assignments"
|
||||||
|
@ -153,10 +150,10 @@ menu "LVGL Touch controller"
|
||||||
default 4095 if LV_PREDEFINED_PINS_38V4
|
default 4095 if LV_PREDEFINED_PINS_38V4
|
||||||
default 1900
|
default 1900
|
||||||
|
|
||||||
config LV_TOUCH_XY_SWAP
|
config LV_TOUCH_XY_SWAP
|
||||||
bool
|
bool
|
||||||
prompt "Swap XY."
|
prompt "Swap XY."
|
||||||
default y
|
default y
|
||||||
|
|
||||||
config LV_TOUCH_INVERT_X
|
config LV_TOUCH_INVERT_X
|
||||||
bool
|
bool
|
||||||
|
@ -278,9 +275,9 @@ menu "LVGL Touch controller"
|
||||||
default 3800
|
default 3800
|
||||||
|
|
||||||
config LV_TOUCH_XY_SWAP
|
config LV_TOUCH_XY_SWAP
|
||||||
bool
|
bool
|
||||||
prompt "Swap XY."
|
prompt "Swap XY."
|
||||||
default n
|
default n
|
||||||
|
|
||||||
config LV_TOUCH_INVERT_X
|
config LV_TOUCH_INVERT_X
|
||||||
bool
|
bool
|
||||||
|
@ -379,25 +376,25 @@ menu "LVGL Touch controller"
|
||||||
config LV_TOUCH_X_MIN
|
config LV_TOUCH_X_MIN
|
||||||
int
|
int
|
||||||
prompt "Minimum X coordinate ADC value"
|
prompt "Minimum X coordinate ADC value"
|
||||||
range 0 1023
|
range 0 1023
|
||||||
default 0
|
default 0
|
||||||
|
|
||||||
config LV_TOUCH_Y_MIN
|
config LV_TOUCH_Y_MIN
|
||||||
int
|
int
|
||||||
prompt "Minimum Y coordinate ADC value"
|
prompt "Minimum Y coordinate ADC value"
|
||||||
range 0 1023
|
range 0 1023
|
||||||
default 0
|
default 0
|
||||||
|
|
||||||
config LV_TOUCH_X_MAX
|
config LV_TOUCH_X_MAX
|
||||||
int
|
int
|
||||||
prompt "Maximum X coordinate ADC value"
|
prompt "Maximum X coordinate ADC value"
|
||||||
range 0 1023
|
range 0 1023
|
||||||
default 1023
|
default 1023
|
||||||
|
|
||||||
config LV_TOUCH_Y_MAX
|
config LV_TOUCH_Y_MAX
|
||||||
int
|
int
|
||||||
prompt "Maximum Y coordinate ADC value"
|
prompt "Maximum Y coordinate ADC value"
|
||||||
range 0 1023
|
range 0 1023
|
||||||
default 1023
|
default 1023
|
||||||
|
|
||||||
config LV_TOUCH_XY_SWAP
|
config LV_TOUCH_XY_SWAP
|
||||||
|
@ -418,13 +415,13 @@ menu "LVGL Touch controller"
|
||||||
config LV_TOUCH_RA8875_SAMPLE_TIME
|
config LV_TOUCH_RA8875_SAMPLE_TIME
|
||||||
int
|
int
|
||||||
prompt "TP Sample Time Adjusting"
|
prompt "TP Sample Time Adjusting"
|
||||||
range 0 7
|
range 0 7
|
||||||
default 0
|
default 0
|
||||||
|
|
||||||
config LV_TOUCH_RA8875_ADC_CLOCK
|
config LV_TOUCH_RA8875_ADC_CLOCK
|
||||||
int
|
int
|
||||||
prompt "ADC Clock Setting"
|
prompt "ADC Clock Setting"
|
||||||
range 0 7
|
range 0 7
|
||||||
default 0
|
default 0
|
||||||
|
|
||||||
config LV_TOUCH_RA8875_WAKEUP_ENABLE
|
config LV_TOUCH_RA8875_WAKEUP_ENABLE
|
||||||
|
@ -447,10 +444,10 @@ menu "LVGL Touch controller"
|
||||||
menu "Touchpanel Configuration (GT911)"
|
menu "Touchpanel Configuration (GT911)"
|
||||||
depends on LV_TOUCH_CONTROLLER_GT911
|
depends on LV_TOUCH_CONTROLLER_GT911
|
||||||
|
|
||||||
config LV_GT911_SWAPXY
|
config LV_GT911_SWAPXY
|
||||||
bool
|
bool
|
||||||
prompt "Swap X with Y coordinate."
|
prompt "Swap X with Y coordinate."
|
||||||
default y
|
default y
|
||||||
|
|
||||||
config LV_GT911_INVERT_X
|
config LV_GT911_INVERT_X
|
||||||
bool
|
bool
|
||||||
|
|
Loading…
Reference in a new issue