Skip to content

Commit ae39579

Browse files
rzeldentRene Zeldenthuis
andauthored
Develop (#257)
* Minor fix: add != NULL * Fixed typo in log * Pinned LVGL version to 9.2.0 (exact) * Changed the order of enabling interrupts (#196) Corrected interrupts leven pos/neg edge * Remove sw_rotate (#210) * Remove sw_rotate * Removed unused code * LVGL version to 9.2.2 * Enable all devices * Updated markdown * Lvgl9.2.2 (#211) * Remove sw_rotate * Removed unused code * LVGL version to 9.2.2 * Enable all devices * Updated markdown * Test hardware rotation st7701 * Test use underlying driver for swap and mirror * Reenabled code * test * Use define for DISPLAY_SOFTWARE_ROTATION * Update boards to develop * Added check for rst_gpio_num == GPIO_NUM_NC (#215) * Boards to develop * Updated boards * JC3248W535N * Removed _IO_NUM and GPIO_NUM * Dependabot github-actions * Updated md * Added TOC * Updated TOC * md * Boards updated * Update boards * Added s3-touch-lcd-4p3 * esp32-s3-touch-lcd-4p3 * esp32-s3-touch-lcd-4p3 * Removed GPIO in naming * Updated platformio * removed semicolumn * Removed quotes LV_CONF_PATH * Added quotes --------- Co-authored-by: Rene Zeldenthuis <“[email protected]”>
1 parent a49bf44 commit ae39579

17 files changed

+704
-86
lines changed

README.md

Lines changed: 43 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,39 @@
33
[![Platform IO CI](https://github.com/rzeldent/esp32-smartdisplay/actions/workflows/main.yml/badge.svg)](https://github.com/rzeldent/esp32-smartdisplay/actions/workflows/main.yml)
44
[![PlatformIO Registry](https://badges.registry.platformio.org/packages/rzeldent/library/esp32_smartdisplay.svg)](https://registry.platformio.org/libraries/rzeldent/esp32_smartdisplay)
55

6+
## Table of Contents
7+
8+
- [LVGL drivers for Chinese Sunton Smart display boards, aka CYD (Cheap Yellow Display)](#lvgl-drivers-for-chinese-sunton-smart-display-boards-aka-cyd-cheap-yellow-display)
9+
- [Table of Contents](#table-of-contents)
10+
- [Supported boards](#supported-boards)
11+
- [Why this library](#why-this-library)
12+
- [Dependencies](#dependencies)
13+
- [How to use](#how-to-use)
14+
- [Step 1: Download (or open) PlatformIO](#step-1-download-or-open-platformio)
15+
- [Step 2: Boards definitions](#step-2-boards-definitions)
16+
- [Step 3: Create a new project](#step-3-create-a-new-project)
17+
- [Step 4: Add this library to your project](#step-4-add-this-library-to-your-project)
18+
- [Step 5: Create a settings file for LVGL](#step-5-create-a-settings-file-for-lvgl)
19+
- [Step 6: Copy the build flags below in your project](#step-6-copy-the-build-flags-below-in-your-project)
20+
- [Step 7: Initialize the display (and touch) in your project](#step-7-initialize-the-display-and-touch-in-your-project)
21+
- [Step 8 (Optional): Create your LVGL file or use SquareLine Studio to make a design](#step-8-optional-create-your-lvgl-file-or-use-squareline-studio-to-make-a-design)
22+
- [Step 9: Compile, upload and enjoy](#step-9-compile-upload-and-enjoy)
23+
- [Porting from LVGL 8.3.9](#porting-from-lvgl-839)
24+
- [lv\_conf.h](#lv_confh)
25+
- [Ticker](#ticker)
26+
- [More on lv\_conf.h](#more-on-lv_confh)
27+
- [LVGL initialization Functions](#lvgl-initialization-functions)
28+
- [void smartdisplay\_init()](#void-smartdisplay_init)
29+
- [void smartdisplay\_lcd\_set\_backlight(float duty)](#void-smartdisplay_lcd_set_backlightfloat-duty)
30+
- [void smartdisplay\_lcd\_set\_brightness\_cb(smartdisplay\_lcd\_adaptive\_brightness\_cb\_t cb, uint interval)](#void-smartdisplay_lcd_set_brightness_cbsmartdisplay_lcd_adaptive_brightness_cb_t-cb-uint-interval)
31+
- [void smartdisplay\_led\_set\_rgb(bool r, bool g, bool b)](#void-smartdisplay_led_set_rgbbool-r-bool-g-bool-b)
32+
- [touch\_calibration\_data\_t touch\_calibration\_data](#touch_calibration_data_t-touch_calibration_data)
33+
- [touch\_calibration\_data\_t smartdisplay\_compute\_touch\_calibration(const lv\_point\_t screen\[3\], const lv\_point\_t touch\[3\])](#touch_calibration_data_t-smartdisplay_compute_touch_calibrationconst-lv_point_t-screen3-const-lv_point_t-touch3)
34+
- [Rotation of the display and touch](#rotation-of-the-display-and-touch)
35+
- [Appendix: Template to support ALL the boards](#appendix-template-to-support-all-the-boards)
36+
- [Appendix: External dependencies](#appendix-external-dependencies)
37+
- [Version history](#version-history)
38+
639
## Supported boards
740

841
These Sunton boards have an LCD display and most of them have a touch interface.
@@ -51,7 +84,7 @@ This library depends on:
5184
- [platformio-espressif32-sunton](https://github.com/rzeldent/platformio-espressif32-sunton)
5285

5386
> [!NOTE]
54-
> This library uses the newly introduced esp_lcd_panel interfaces. This should provide some support in the future for updates and new boards. These drivers are provided by Espressid and have already been copied and included to this library.
87+
> This library uses the newly introduced esp_lcd_panel interfaces. This should provide some support in the future for updates and new boards. These drivers are provided by Espressif and have already been copied and included to this library.
5588
5689
## How to use
5790

@@ -84,7 +117,14 @@ Make sure you have PlatformIO installed and functional. Follow the documentation
84117

85118
The board definitions required for this library are defined in the boards library [platformio-espressif32-sunton](https://github.com/rzeldent/platformio-espressif32-sunton). This library must reside in the `<project>/boards` directory so PlatformIo will automatically recognize these boards.
86119

87-
**It is recommended to use `git submodule` to include these board definitions automatically.**
120+
**It is recommended to use `git clone --recurse-submodules` to include these board definitions automatically.**
121+
122+
In case the repository was opened without the submodules, the submodules need to be initialized and updated. To do this type at the command prompt:
123+
124+
```bash
125+
git submodule init
126+
git submodule update
127+
```
88128

89129
> [!TIP]
90130
> If you already have a project, clone it with the `git clone --recurse-submodules`. If creating a new project, use `git submodule add https://github.com/rzeldent/platformio-espressif32-sunton.git boards` to add them to your project as a submodule.
@@ -352,7 +392,7 @@ This function can be called to periodically call a user defined function to set
352392
The callback function must have the following format:
353393

354394
```cpp
355-
float smartdisplay_lcd_adaptive_brightness_function)()
395+
float smartdisplay_lcd_adaptive_brightness_function()
356396
{
357397
...
358398
return <float[0,1]>

include/esp_panel_axs15231b.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#pragma once
2+
3+
#include <esp_lcd.h>
4+
#include <esp_lcd_types.h>
5+
#include <esp_lcd_panel_vendor.h>
6+
7+
#ifdef __cplusplus
8+
extern "C"
9+
{
10+
#endif
11+
12+
typedef struct
13+
{
14+
const lcd_init_cmd_t *init_cmds;
15+
uint16_t init_cmds_size;
16+
} axs15231b_vendor_config_t;
17+
18+
esp_err_t esp_lcd_new_panel_axs15231b(const esp_lcd_panel_io_handle_t io, const esp_lcd_panel_dev_config_t *config, esp_lcd_panel_handle_t *handle);
19+
20+
#ifdef __cplusplus
21+
}
22+
#endif

platformio.ini

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,17 @@
3636
#default_envs = esp32-8048S043R
3737
#default_envs = esp32-8048S050C
3838
#default_envs = esp32-8048S050N
39-
#default_envs = esp32-8048S050R
39+
#default_envs = esp32-8048S050R
4040
#default_envs = esp32-8048S070C
4141
#default_envs = esp32-8048S070N
4242
#default_envs = esp32-8048S070R
43-
#default_envs = esp32-s3touchlcd7
44-
#default_envs = esp32-2432W328C
4543
#default_envs = esp32-8048S550C
44+
#default_envs = esp32-s3touchlcd7
45+
#default_envs = esp32-s3touchlcd4p3
46+
#default_envs = JC2432W328C
47+
#default_envs = JC3248W535N
48+
#default_envs = JC8048W550C
49+
4650

4751
[env]
4852
platform = espressif32
@@ -53,7 +57,7 @@ build_flags =
5357
-Wall
5458
'-D CORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_VERBOSE'
5559
# LVGL settings
56-
'-D LV_CONF_PATH=${platformio.test_dir}/lv_conf.h'
60+
'-D LV_CONF_PATH="${platformio.test_dir}/lv_conf.h"'
5761
'-D ESP_LCD_PANEL_IO_ADDITIONS_VER_MAJOR=1'
5862
'-D ESP_LCD_PANEL_IO_ADDITIONS_VER_MINOR=0'
5963
'-D ESP_LCD_PANEL_IO_ADDITIONS_VER_PATCH=1'
@@ -157,11 +161,20 @@ board = esp32-8048S070N
157161
[env:esp32-8048S070R]
158162
board = esp32-8048S070R
159163

164+
[env:esp32-8048S550C]
165+
board = esp32-8048S550C
166+
160167
[env:esp32-s3touchlcd7]
161168
board = esp32-s3touchlcd7
162169

163-
[env:esp32-2432W328C]
164-
board = esp32-2432W328C
170+
[env:esp32-s3touchlcd4p3]
171+
board = esp32-s3touchlcd4p3
165172

166-
[env:esp32-8048S550C]
167-
board = esp32-8048S550C
173+
[env:JC2432W328C]
174+
board = JC2432W328C
175+
176+
[env:JC3248W535N]
177+
board = JC3248W535N
178+
179+
[env:JC8048W550C]
180+
board = JC8048W550C

src/esp32_smartdisplay.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ void smartdisplay_lcd_set_backlight(float duty)
5656
if (duty < 0.0f)
5757
duty = 0.0f;
5858
#if ESP_ARDUINO_VERSION_MAJOR >= 3
59-
ledcWrite(GPIO_BCKL, duty * PWM_MAX_BCKL);
59+
ledcWrite(DISPLAY_BCKL, duty * PWM_MAX_BCKL);
6060
#else
6161
ledcWrite(PWM_CHANNEL_BCKL, duty * PWM_MAX_BCKL);
6262
#endif
@@ -183,13 +183,13 @@ void smartdisplay_init()
183183

184184
lv_init();
185185
// Setup backlight
186-
pinMode(GPIO_BCKL, OUTPUT);
187-
digitalWrite(GPIO_BCKL, LOW);
186+
pinMode(DISPLAY_BCKL, OUTPUT);
187+
digitalWrite(DISPLAY_BCKL, LOW);
188188
#if ESP_ARDUINO_VERSION_MAJOR >= 3
189-
ledcAttach(GPIO_BCKL, PWM_FREQ_BCKL, PWM_BITS_BCKL);
189+
ledcAttach(DISPLAY_BCKL, PWM_FREQ_BCKL, PWM_BITS_BCKL);
190190
#else
191191
ledcSetup(PWM_CHANNEL_BCKL, PWM_FREQ_BCKL, PWM_BITS_BCKL);
192-
ledcAttachPin(GPIO_BCKL, PWM_CHANNEL_BCKL);
192+
ledcAttachPin(DISPLAY_BCKL, PWM_CHANNEL_BCKL);
193193
#endif
194194
// Setup TFT display
195195
display = lvgl_lcd_init();

0 commit comments

Comments
 (0)