Skip to content

Commit 6575def

Browse files
authored
Develop into 2.0.9 (#146)
* Prepared new version 2.0.4 * Updated boards * Updated platformio.ini * Added extern for touch_calibration_data * New build system for CI * Updated PCLK_HZ * UPdated variables for ST7789 * Update Variables GC9A01 * Updated ILI9341 * LVGL to ^8.3.9 * Typos * DST7262 variables * Typos and ST7701 variables * ST7701_LINE_CONFIG * ST7796 variables * SPI_DMA_CHANNEL * CST816S variables * GT911 variables * XPT2046 variables * Typo * esp_lcd_panel_io_3wire_spi_config_t * Updated boards * Updated boards * BOARD_HAS_ * Update board * rename with interfaces * Added Interface type to boards for LCD/TOUCH * All boards * wip ESP32-24232s022 * Updated 2432S022C * Updated boards Added warning for st7789_i80 * Added 8048S070R * Updated boards * Do not invert colors * Added IPS Setting * rename, include strength * Removed v11 version * Added logging * logging * Removed touch_config flags * Removed not required backlight set * Added strength * GT911, fix for non matching touch resolutions * UPdated boards * Updated boards * GT911 vendorId * updated boards * Update board * Boards to main * Updated boards * UPdate boards * %d->%f * Added logging for vendor config initialization * Two decimals * Updated boards * Data bits are upper D8-D15 * Updated boards * Updated boards * Added PlatformIo badge * Use LVGL pixel buffer size and malloc flags for json (#124) * Updated boards * Added spi_bus_config_t flags, intr flags and max_size * Small changes esp3228S022 * Update version to 2.0.5 * Minor changes to st7789_i80 * BCKL to GPIO_BCKL * Typo miso_io_num * Changed location of tuning off the display when initializing * Updated boards * Updated boards * 21-nothing-shown-on-screen-only-backlight * Updated boards to current develop * Do not check for information GT911 * Reenabled reading GTInfo: is required for resolution * Attempt to read GTInfo else use defaults * Updated boards * Updated boards + library version * Set PWM frtequency to 400Hz * New xpt2046 driver * Invert if IPS * Removed settings for XPT2046 * Fixed typo ptr in logging Updated boards/platformio.ini * Work in progress GT911 * Update for gt911 * Corrected rot swap touch * Move esp_lcd_touch to library * Updated defines * Updated boards * Test for all boards * Flags not yet! * Added export/exclude * Updated glob * Updated exclude globs * Moved touch libraries back in esp32-smartdisplay * Updated touch * Work in progress gc9a01 * Move addressed I2C to header * Added logging * Readded io_expander.c * Disabled reading info from gt911. Seems to cause problems * fixes * Typo refactor * calloc fix! * fixed for touch * Typo * Fixes * Fixes * fixes * fixes * st7796 * parameter checking for touch * Fixes * Fixes * fixes * VendorConfig * Remove cmd/cmds_size * Fixed * Fixes * Test * Update boards * 7701 * Fixes * fixes * Fixes rotation * lcd mirror conditional * TOUCH_SWAP_XY TOUCH_MIRROR_XY * All platforms * Bugfix for more points than configured * Updated MD/boards/platformio.ini * Updated boards * Updated boards * Updated boards * Updated MD * Display rotation not working (#145) * rotation test * Corrected rotation * LCD->DISPLAY * Updated boards * GAP_X/GAP_Y * All boards * Updated boards * Update to 2.0.9
1 parent b04cc23 commit 6575def

20 files changed

+161
-98
lines changed

README.md

Lines changed: 57 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,17 @@ More information, data sheets, ordering information etc. can be found at [Sunton
1414

1515
Currently this library supports the following boards:
1616

17-
- ESP32-1732S019N/C
18-
- ESP32-2424S012N/C
19-
- ESP32-2432S024R/C/N
20-
- ESP32-2432S028R
21-
- ESP32-2432S032N/R/C
22-
- ESP32-3248S035R/C
23-
- ESP32-4827S043R/C
24-
- ESP32-4848S040C_I_Y_1/3
25-
- ESP32-8048S050N/C
26-
- ESP32-8048S070N/C
27-
- ESP32-4848S040C
17+
- ESP32-1732S019 N/C
18+
- ESP32-2424S012 N/C
19+
- ESP32-2432S022 N/C
20+
- ESP32-2432S024 R/C/N
21+
- ESP32-2432S028 R ( 3 variants)
22+
- ESP32-2432S032 N/R/C
23+
- ESP32-3248S035 R/C
24+
- ESP32-4827S043 R/C
25+
- ESP32-4848S040C _I_Y_1/3
26+
- ESP32-8048S050 N/C/R
27+
- ESP32-8048S070 N/C/R
2828

2929
This library integrates seamlessly in [PlatformIO](https://platformio.org/) and supports these boards by providing display and touch and provides a jump start!
3030

@@ -62,7 +62,6 @@ Get started by following the steps below. It is also highly recommended to look
6262
This demo provides:
6363

6464
- User Interface created using the SquareLine Studio GUI generator.
65-
- Sound over I2S and internal DAC
6665
- Read the CdS (light sensor)
6766
- Control of the LEDs
6867
- Works for all known boards
@@ -200,15 +199,17 @@ Especially the definition of the LV_CONF_PATH is critical, this must point to an
200199
build_flags =
201200
-Ofast
202201
-Wall
203-
-D CORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_VERBOSE
202+
#-D CORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_VERBOSE
203+
#-D CORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_DEBUG
204+
#-D CORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_INFO
204205
# LVGL settings. Point to your lv_conf.h file
205206
-D LV_CONF_PATH="${PROJECT_DIR}/example/lv_conf.h"
206207
```
207208

208209
The line in the settings logs to the serial console but can be omitted for production builds:
209210

210211
```ini
211-
-D CORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_VERBOSE
212+
-D CORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_NONE
212213
```
213214

214215
The -Wall flag can also be removed but outputs all the warnings.
@@ -365,8 +366,11 @@ The data returned can set in to the ```touch_calibration_data```
365366
366367
## Rotation of the display and touch
367368
368-
The library supports rotating for most of the controllers using hardware. Support for the direct 16bits parallel connection is done using software emulation (in LVGL).
369-
Rotating the touch is also done when rotating.
369+
The library supports rotating for most of the controllers using hardware. Support for the direct 16bits parallel connection is done using software emulation (in LVGL). Rotating the touch is done by LVGL when rotating.
370+
371+
From the LVGL documentation:
372+
*The rotation values are relative to how you would rotate the physical display in the clockwise direction.
373+
Thus, LV_DISP_ROT_90 means you rotate the hardware 90 degrees clockwise, and the display rotates 90 degrees counterclockwise to compensate.*
370374
371375
Rotating is done calling the ```lv_disp_set_rotation``` function in the LVGL library with the rotation:
372376
@@ -376,7 +380,18 @@ Rotating is done calling the ```lv_disp_set_rotation``` function in the LVGL lib
376380
```
377381

378382
Some boards are around that have flipped screens, this is probably due to differences during tha manufacturing or using different TFTs. It is possible to correct these boards overriding the default defines.
379-
However if this is encountered a separate board definition is preferable.
383+
384+
To adjust the display and touch to the default (LV_DISP_ROT_NONE) there are 6 defines in the boards definition:
385+
386+
| Name | Description |
387+
|--- |--- |
388+
| DISPLAY_SWAP_XY | Swaps the X and Y coordinates for the display |
389+
| DISPLAY_MIRROR_X | Mirrors the X coordinate for the display |
390+
| DISPLAY_MIRROR_Y | Mirrors the Y coordinate for the display |
391+
| TOUCH_SWAP_XY | Swaps the X and Y coordinates for the touch |
392+
| TOUCH_MIRROR_X | Mirrors the X coordinate for the touch |
393+
| TOUCH_MIRROR_Y | Mirrors the Y coordinate for the touch |
394+
380395

381396
## Appendix: Template to support ALL the boards
382397

@@ -391,11 +406,14 @@ The platformio.ini file below supports all the boards. This is useful when runni
391406
#default_envs = esp32-1732S019N
392407
#default_envs = esp32-2424S012C
393408
#default_envs = esp32-2424S012N
409+
#default_envs = esp32-2432S022N
410+
#default_envs = esp32-2432S022C
394411
#default_envs = esp32-2432S024C
395412
#default_envs = esp32-2432S024N
396413
#default_envs = esp32-2432S024R
397414
#default_envs = esp32-2432S028R
398415
#default_envs = esp32-2432S028Rv2
416+
#default_envs = esp32-2432S028Rv3
399417
#default_envs = esp32-2432S032C
400418
#default_envs = esp32-2432S032N
401419
#default_envs = esp32-2432S032R
@@ -404,8 +422,8 @@ The platformio.ini file below supports all the boards. This is useful when runni
404422
#default_envs = esp32-4827S043C
405423
#default_envs = esp32-4827S043N
406424
#default_envs = esp32-4827S043R
407-
#default_envs = esp32-4848S040C_I_Y_1
408-
#default_envs = esp32-4848S040C_I_Y_2
425+
#default_envs = esp32-4848S040CIY1
426+
#default_envs = esp32-4848S040CIY3
409427
#default_envs = esp32-8048S043C
410428
#default_envs = esp32-8048S043N
411429
#default_envs = esp32-8048S043R
@@ -414,6 +432,7 @@ The platformio.ini file below supports all the boards. This is useful when runni
414432
#default_envs = esp32-8048S050R
415433
#default_envs = esp32-8048S070C
416434
#default_envs = esp32-8048S070N
435+
#default_envs = esp32-8048S070R
417436

418437
[env]
419438
platform = espressif32
@@ -449,6 +468,12 @@ board = esp32-2424S012C
449468
[env:esp32-2424S012N]
450469
board = esp32-2424S012N
451470

471+
[env:esp32-2432S022N]
472+
board = esp32-2432S022N
473+
474+
[env:esp32-2432S022C]
475+
board = esp32-2432S022C
476+
452477
[env:esp32-2432S024C]
453478
board = esp32-2432S024C
454479

@@ -464,6 +489,9 @@ board = esp32-2432S028R
464489
[env:esp32-2432S028Rv2]
465490
board = esp32-2432S028Rv2
466491

492+
[env:esp32-2432S028Rv3]
493+
board = esp32-2432S028Rv3
494+
467495
[env:esp32-2432S032C]
468496
board = esp32-2432S032C
469497

@@ -482,17 +510,17 @@ board = esp32-3248S035R
482510
[env:esp32-4827S043C]
483511
board = esp32-4827S043C
484512

485-
[env:esp32-4827S043N]
486-
board = esp32-4827S043N
487-
488513
[env:esp32-4827S043R]
489514
board = esp32-4827S043R
490515

491-
[env:esp32-4848S040C_I_Y_1]
492-
board = esp32-8048S043C_I_Y_1
516+
[env:esp32-4827S043N]
517+
board = esp32-4827S043N
518+
519+
[env:esp32-4848S040CIY1]
520+
board = esp32-4848S040CIY1
493521

494-
[env:esp32-4848S040C_I_Y_3]
495-
board = esp32-8048S043C_I_Y_3
522+
[env:esp32-4848S040CIY3]
523+
board = esp32-4848S040CIY3
496524

497525
[env:esp32-8048S043C]
498526
board = esp32-8048S043C
@@ -517,6 +545,9 @@ board = esp32-8048S070C
517545

518546
[env:esp32-8048S070N]
519547
board = esp32-8048S070N
548+
549+
[env:esp32-8048S070R]
550+
board = esp32-8048S070R
520551
```
521552

522553
## Appendix: External dependencies

library.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"$schema": "https://raw.githubusercontent.com/platformio/platformio-core/develop/platformio/assets/schema/library.json",
33
"name": "esp32_smartdisplay",
4-
"version": "2.0.8",
4+
"version": "2.0.9",
55
"description": "LVGL driver for Sunton ESP32 Cheap Yellow Display display boards",
66
"keywords": "LVGL Sunton CYD LCD TFT Touch",
77
"repository": {

src/esp32_smartdisplay.c

Lines changed: 37 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include <esp32_smartdisplay.h>
2+
#include <esp_lcd_panel_ops.h>
23

34
#ifdef BOARD_HAS_TOUCH
45
#include <esp_lcd_touch.h>
@@ -136,17 +137,46 @@ touch_calibration_data_t smartdisplay_compute_touch_calibration(const lv_point_t
136137
};
137138
#endif
138139

140+
// Called when driver parameters are updated (rotation)
141+
// Top of the display is top left when connector is at the bottom
142+
// The rotation values are relative to how you would rotate the physical display in the clockwise direction.
143+
// Thus, LV_DISP_ROT_90 means you rotate the hardware 90 degrees clockwise, and the display rotates 90 degrees counterclockwise to compensate.
144+
void lvgl_update_callback(lv_disp_drv_t *drv)
145+
{
146+
if (drv->sw_rotate == false)
147+
{
148+
const esp_lcd_panel_handle_t panel_handle = disp_drv.user_data;
149+
switch (drv->rotated)
150+
{
151+
case LV_DISP_ROT_NONE:
152+
ESP_ERROR_CHECK(esp_lcd_panel_swap_xy(panel_handle, DISPLAY_SWAP_XY));
153+
ESP_ERROR_CHECK(esp_lcd_panel_mirror(panel_handle, DISPLAY_MIRROR_X, DISPLAY_MIRROR_Y));
154+
break;
155+
case LV_DISP_ROT_90:
156+
ESP_ERROR_CHECK(esp_lcd_panel_swap_xy(panel_handle, !DISPLAY_SWAP_XY));
157+
ESP_ERROR_CHECK(esp_lcd_panel_mirror(panel_handle, DISPLAY_MIRROR_X, !DISPLAY_MIRROR_Y));
158+
break;
159+
case LV_DISP_ROT_180:
160+
ESP_ERROR_CHECK(esp_lcd_panel_swap_xy(panel_handle, DISPLAY_SWAP_XY));
161+
ESP_ERROR_CHECK(esp_lcd_panel_mirror(panel_handle, !DISPLAY_MIRROR_X, !DISPLAY_MIRROR_Y));
162+
break;
163+
case LV_DISP_ROT_270:
164+
ESP_ERROR_CHECK(esp_lcd_panel_swap_xy(panel_handle, !DISPLAY_SWAP_XY));
165+
ESP_ERROR_CHECK(esp_lcd_panel_mirror(panel_handle, !DISPLAY_MIRROR_X, DISPLAY_MIRROR_Y));
166+
break;
167+
}
168+
}
169+
}
170+
139171
void smartdisplay_init()
140172
{
141173
log_d("smartdisplay_init");
142174
#ifdef BOARD_HAS_RGB_LED
143175
// Setup RGB LED. High is off
144176
pinMode(RGB_LED_R, OUTPUT);
145-
digitalWrite(RGB_LED_R, true);
146177
pinMode(RGB_LED_G, OUTPUT);
147-
digitalWrite(RGB_LED_G, true);
148178
pinMode(RGB_LED_B, OUTPUT);
149-
digitalWrite(RGB_LED_B, true);
179+
smartdisplay_led_set_rgb(false, false, false);
150180
#endif
151181

152182
#ifdef BOARD_HAS_CDS
@@ -177,12 +207,14 @@ void smartdisplay_init()
177207
#endif
178208
// Setup TFT display
179209
lv_disp_drv_init(&disp_drv);
180-
disp_drv.hor_res = LCD_WIDTH;
181-
disp_drv.ver_res = LCD_HEIGHT;
210+
disp_drv.hor_res = DISPLAY_WIDTH;
211+
disp_drv.ver_res = DISPLAY_HEIGHT;
182212
// Create drawBuffer
183213
disp_drv.draw_buf = (lv_disp_draw_buf_t *)malloc(sizeof(lv_disp_draw_buf_t));
184214
void *drawBuffer = heap_caps_malloc(sizeof(lv_color_t) * LVGL_BUFFER_PIXELS, LVGL_BUFFER_MALLOC_FLAGS);
185215
lv_disp_draw_buf_init(disp_drv.draw_buf, drawBuffer, NULL, LVGL_BUFFER_PIXELS);
216+
// Register callback for changes to the driver parameters (rotation!)
217+
disp_drv.drv_update_cb = lvgl_update_callback;
186218
// Initialize specific driver
187219
lvgl_lcd_init(&disp_drv);
188220
__attribute__((unused)) lv_disp_t *display = lv_disp_drv_register(&disp_drv);

src/esp_io_expander.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#ifdef LCD_ST7701_PAR
1+
#ifdef DISPLAY_ST7701_PAR
22

33
/*
44
* SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD

src/esp_lcd_panel_io_3wire_spi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#ifdef LCD_ST7701_PAR
1+
#ifdef DISPLAY_ST7701_PAR
22

33
/*
44
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD

src/esp_panel_gc9a01.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#ifdef LCD_GC9A01_SPI
1+
#ifdef DISPLAY_GC9A01_SPI
22

33
#include <esp_panel_gc9a01.h>
44
#include <esp32-hal-log.h>

src/esp_panel_ili9341.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#ifdef LCD_ILI9341_SPI
1+
#ifdef DISPLAY_ILI9341_SPI
22

33
#include <esp_panel_ili9341.h>
44
#include <esp32-hal-log.h>

src/esp_panel_st7701.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#ifdef LCD_ST7701_PAR
1+
#ifdef DISPLAY_ST7701_PAR
22

33
#include <esp_panel_st7701.h>
44
#include <esp32-hal-log.h>

src/esp_panel_st7796.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#ifdef LCD_ST7796_SPI
1+
#ifdef DISPLAY_ST7796_SPI
22

33
#include <esp_panel_st7796.h>
44
#include <esp32-hal-log.h>

0 commit comments

Comments
 (0)