Skip to content

Commit 31771b3

Browse files
committed
Merge branch 'feat/support_backlight_pwm_freq_conf' into 'master'
Closes #189 See merge request ae_group/ESP32_Display_Panel!14
2 parents 9a8fbf5 + 3d2d797 commit 31771b3

File tree

15 files changed

+205
-18
lines changed

15 files changed

+205
-18
lines changed

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
# ChangeLog
22

3-
## v1.0.2 - 2025-03-24
3+
## v1.0.2 - 2025-04-23
4+
5+
### Enhancements:
6+
7+
* feat(backlight): add PWM parameters configuration (#188)
48

59
### Bugfixes:
610

@@ -9,6 +13,7 @@
913
* fix(docs): update README
1014
* fix(conf): update comments of custom config file
1115
* fix(examples): enable CPU 240M and task WDT default in esp_idf/lvgl_v8_port
16+
* fix(lcd): fix ST7701 mirror issue
1217

1318
## v1.0.1 - 2025-03-13
1419

esp_panel_board_custom_conf.h

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,22 @@
476476
#define ESP_PANEL_BOARD_BACKLIGHT_IO (38) // Output GPIO pin number
477477
#define ESP_PANEL_BOARD_BACKLIGHT_ON_LEVEL (1) // Active level, 0: low, 1: high
478478

479+
#if ESP_PANEL_BOARD_BACKLIGHT_TYPE == ESP_PANEL_BACKLIGHT_TYPE_PWM_LEDC
480+
/**
481+
* @brief PWM parameters configuration
482+
*/
483+
#define ESP_PANEL_BOARD_BACKLIGHT_PWM_FREQ_HZ (5000) // LEDC timer frequency.
484+
// Different backlight driver chips may have different
485+
// frequency limits, please refer to the datasheet of
486+
// the specific chip.
487+
// https://github.com/esp-arduino-libs/ESP32_Display_Panel/issues/188
488+
489+
#define ESP_PANEL_BOARD_BACKLIGHT_PWM_DUTY_RESOLUTION (10) // LEDC timer duty resolution.
490+
// The frequency and duty resolution of the LEDC timer
491+
// need to be properly matched, please refer to:
492+
// https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/ledc.html#supported-range-of-frequency-and-duty-resolutions
493+
#endif
494+
479495
#elif ESP_PANEL_BOARD_BACKLIGHT_TYPE == ESP_PANEL_BACKLIGHT_TYPE_CUSTOM
480496

481497
/**
@@ -735,8 +751,8 @@
735751
* 3. Patch version mismatch: No impact on functionality
736752
*/
737753
#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MAJOR 1
738-
#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MINOR 0
739-
#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_PATCH 2
754+
#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MINOR 1
755+
#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_PATCH 0
740756

741757
#endif // ESP_PANEL_BOARD_DEFAULT_USE_CUSTOM
742758

examples/arduino/board/board_static_config/esp_panel_board_custom_conf.h

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,22 @@
476476
#define ESP_PANEL_BOARD_BACKLIGHT_IO (38) // Output GPIO pin number
477477
#define ESP_PANEL_BOARD_BACKLIGHT_ON_LEVEL (1) // Active level, 0: low, 1: high
478478

479+
#if ESP_PANEL_BOARD_BACKLIGHT_TYPE == ESP_PANEL_BACKLIGHT_TYPE_PWM_LEDC
480+
/**
481+
* @brief PWM parameters configuration
482+
*/
483+
#define ESP_PANEL_BOARD_BACKLIGHT_PWM_FREQ_HZ (5000) // LEDC timer frequency.
484+
// Different backlight driver chips may have different
485+
// frequency limits, please refer to the datasheet of
486+
// the specific chip.
487+
// https://github.com/esp-arduino-libs/ESP32_Display_Panel/issues/188
488+
489+
#define ESP_PANEL_BOARD_BACKLIGHT_PWM_DUTY_RESOLUTION (10) // LEDC timer duty resolution.
490+
// The frequency and duty resolution of the LEDC timer
491+
// need to be properly matched, please refer to:
492+
// https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/ledc.html#supported-range-of-frequency-and-duty-resolutions
493+
#endif
494+
479495
#elif ESP_PANEL_BOARD_BACKLIGHT_TYPE == ESP_PANEL_BACKLIGHT_TYPE_CUSTOM
480496

481497
/**
@@ -735,8 +751,8 @@
735751
* 3. Patch version mismatch: No impact on functionality
736752
*/
737753
#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MAJOR 1
738-
#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MINOR 0
739-
#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_PATCH 2
754+
#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MINOR 1
755+
#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_PATCH 0
740756

741757
#endif // ESP_PANEL_BOARD_DEFAULT_USE_CUSTOM
742758

examples/arduino/gui/lvgl_v8/simple_port/esp_panel_board_custom_conf.h

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,22 @@
476476
#define ESP_PANEL_BOARD_BACKLIGHT_IO (38) // Output GPIO pin number
477477
#define ESP_PANEL_BOARD_BACKLIGHT_ON_LEVEL (1) // Active level, 0: low, 1: high
478478

479+
#if ESP_PANEL_BOARD_BACKLIGHT_TYPE == ESP_PANEL_BACKLIGHT_TYPE_PWM_LEDC
480+
/**
481+
* @brief PWM parameters configuration
482+
*/
483+
#define ESP_PANEL_BOARD_BACKLIGHT_PWM_FREQ_HZ (5000) // LEDC timer frequency.
484+
// Different backlight driver chips may have different
485+
// frequency limits, please refer to the datasheet of
486+
// the specific chip.
487+
// https://github.com/esp-arduino-libs/ESP32_Display_Panel/issues/188
488+
489+
#define ESP_PANEL_BOARD_BACKLIGHT_PWM_DUTY_RESOLUTION (10) // LEDC timer duty resolution.
490+
// The frequency and duty resolution of the LEDC timer
491+
// need to be properly matched, please refer to:
492+
// https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/ledc.html#supported-range-of-frequency-and-duty-resolutions
493+
#endif
494+
479495
#elif ESP_PANEL_BOARD_BACKLIGHT_TYPE == ESP_PANEL_BACKLIGHT_TYPE_CUSTOM
480496

481497
/**
@@ -735,8 +751,8 @@
735751
* 3. Patch version mismatch: No impact on functionality
736752
*/
737753
#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MAJOR 1
738-
#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MINOR 0
739-
#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_PATCH 2
754+
#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MINOR 1
755+
#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_PATCH 0
740756

741757
#endif // ESP_PANEL_BOARD_DEFAULT_USE_CUSTOM
742758

examples/arduino/gui/lvgl_v8/simple_rotation/esp_panel_board_custom_conf.h

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,22 @@
476476
#define ESP_PANEL_BOARD_BACKLIGHT_IO (38) // Output GPIO pin number
477477
#define ESP_PANEL_BOARD_BACKLIGHT_ON_LEVEL (1) // Active level, 0: low, 1: high
478478

479+
#if ESP_PANEL_BOARD_BACKLIGHT_TYPE == ESP_PANEL_BACKLIGHT_TYPE_PWM_LEDC
480+
/**
481+
* @brief PWM parameters configuration
482+
*/
483+
#define ESP_PANEL_BOARD_BACKLIGHT_PWM_FREQ_HZ (5000) // LEDC timer frequency.
484+
// Different backlight driver chips may have different
485+
// frequency limits, please refer to the datasheet of
486+
// the specific chip.
487+
// https://github.com/esp-arduino-libs/ESP32_Display_Panel/issues/188
488+
489+
#define ESP_PANEL_BOARD_BACKLIGHT_PWM_DUTY_RESOLUTION (10) // LEDC timer duty resolution.
490+
// The frequency and duty resolution of the LEDC timer
491+
// need to be properly matched, please refer to:
492+
// https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/ledc.html#supported-range-of-frequency-and-duty-resolutions
493+
#endif
494+
479495
#elif ESP_PANEL_BOARD_BACKLIGHT_TYPE == ESP_PANEL_BACKLIGHT_TYPE_CUSTOM
480496

481497
/**
@@ -735,8 +751,8 @@
735751
* 3. Patch version mismatch: No impact on functionality
736752
*/
737753
#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MAJOR 1
738-
#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MINOR 0
739-
#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_PATCH 2
754+
#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MINOR 1
755+
#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_PATCH 0
740756

741757
#endif // ESP_PANEL_BOARD_DEFAULT_USE_CUSTOM
742758

examples/arduino/gui/lvgl_v8/squareline_port/esp_panel_board_custom_conf.h

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,22 @@
476476
#define ESP_PANEL_BOARD_BACKLIGHT_IO (38) // Output GPIO pin number
477477
#define ESP_PANEL_BOARD_BACKLIGHT_ON_LEVEL (1) // Active level, 0: low, 1: high
478478

479+
#if ESP_PANEL_BOARD_BACKLIGHT_TYPE == ESP_PANEL_BACKLIGHT_TYPE_PWM_LEDC
480+
/**
481+
* @brief PWM parameters configuration
482+
*/
483+
#define ESP_PANEL_BOARD_BACKLIGHT_PWM_FREQ_HZ (5000) // LEDC timer frequency.
484+
// Different backlight driver chips may have different
485+
// frequency limits, please refer to the datasheet of
486+
// the specific chip.
487+
// https://github.com/esp-arduino-libs/ESP32_Display_Panel/issues/188
488+
489+
#define ESP_PANEL_BOARD_BACKLIGHT_PWM_DUTY_RESOLUTION (10) // LEDC timer duty resolution.
490+
// The frequency and duty resolution of the LEDC timer
491+
// need to be properly matched, please refer to:
492+
// https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/ledc.html#supported-range-of-frequency-and-duty-resolutions
493+
#endif
494+
479495
#elif ESP_PANEL_BOARD_BACKLIGHT_TYPE == ESP_PANEL_BACKLIGHT_TYPE_CUSTOM
480496

481497
/**
@@ -735,8 +751,8 @@
735751
* 3. Patch version mismatch: No impact on functionality
736752
*/
737753
#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MAJOR 1
738-
#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MINOR 0
739-
#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_PATCH 2
754+
#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MINOR 1
755+
#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_PATCH 0
740756

741757
#endif // ESP_PANEL_BOARD_DEFAULT_USE_CUSTOM
742758

examples/arduino/gui/lvgl_v8/squareline_wifi_clock/esp_panel_board_custom_conf.h

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,22 @@
476476
#define ESP_PANEL_BOARD_BACKLIGHT_IO (38) // Output GPIO pin number
477477
#define ESP_PANEL_BOARD_BACKLIGHT_ON_LEVEL (1) // Active level, 0: low, 1: high
478478

479+
#if ESP_PANEL_BOARD_BACKLIGHT_TYPE == ESP_PANEL_BACKLIGHT_TYPE_PWM_LEDC
480+
/**
481+
* @brief PWM parameters configuration
482+
*/
483+
#define ESP_PANEL_BOARD_BACKLIGHT_PWM_FREQ_HZ (5000) // LEDC timer frequency.
484+
// Different backlight driver chips may have different
485+
// frequency limits, please refer to the datasheet of
486+
// the specific chip.
487+
// https://github.com/esp-arduino-libs/ESP32_Display_Panel/issues/188
488+
489+
#define ESP_PANEL_BOARD_BACKLIGHT_PWM_DUTY_RESOLUTION (10) // LEDC timer duty resolution.
490+
// The frequency and duty resolution of the LEDC timer
491+
// need to be properly matched, please refer to:
492+
// https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/ledc.html#supported-range-of-frequency-and-duty-resolutions
493+
#endif
494+
479495
#elif ESP_PANEL_BOARD_BACKLIGHT_TYPE == ESP_PANEL_BACKLIGHT_TYPE_CUSTOM
480496

481497
/**
@@ -735,8 +751,8 @@
735751
* 3. Patch version mismatch: No impact on functionality
736752
*/
737753
#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MAJOR 1
738-
#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MINOR 0
739-
#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_PATCH 2
754+
#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MINOR 1
755+
#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_PATCH 0
740756

741757
#endif // ESP_PANEL_BOARD_DEFAULT_USE_CUSTOM
742758

examples/platformio/lvgl_v8_port/src/esp_panel_board_custom_conf.h

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,22 @@
476476
#define ESP_PANEL_BOARD_BACKLIGHT_IO (38) // Output GPIO pin number
477477
#define ESP_PANEL_BOARD_BACKLIGHT_ON_LEVEL (1) // Active level, 0: low, 1: high
478478

479+
#if ESP_PANEL_BOARD_BACKLIGHT_TYPE == ESP_PANEL_BACKLIGHT_TYPE_PWM_LEDC
480+
/**
481+
* @brief PWM parameters configuration
482+
*/
483+
#define ESP_PANEL_BOARD_BACKLIGHT_PWM_FREQ_HZ (5000) // LEDC timer frequency.
484+
// Different backlight driver chips may have different
485+
// frequency limits, please refer to the datasheet of
486+
// the specific chip.
487+
// https://github.com/esp-arduino-libs/ESP32_Display_Panel/issues/188
488+
489+
#define ESP_PANEL_BOARD_BACKLIGHT_PWM_DUTY_RESOLUTION (10) // LEDC timer duty resolution.
490+
// The frequency and duty resolution of the LEDC timer
491+
// need to be properly matched, please refer to:
492+
// https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/ledc.html#supported-range-of-frequency-and-duty-resolutions
493+
#endif
494+
479495
#elif ESP_PANEL_BOARD_BACKLIGHT_TYPE == ESP_PANEL_BACKLIGHT_TYPE_CUSTOM
480496

481497
/**
@@ -735,8 +751,8 @@
735751
* 3. Patch version mismatch: No impact on functionality
736752
*/
737753
#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MAJOR 1
738-
#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MINOR 0
739-
#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_PATCH 2
754+
#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MINOR 1
755+
#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_PATCH 0
740756

741757
#endif // ESP_PANEL_BOARD_DEFAULT_USE_CUSTOM
742758

src/board/custom/Kconfig.board_custom.backlight

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,23 @@ if ESP_PANEL_BOARD_USE_BACKLIGHT
5757
Active level for backlight control.
5858
endmenu
5959

60+
menu "PWM parameters"
61+
depends on ESP_PANEL_BOARD_BACKLIGHT_TYPE_PWM_LEDC
62+
63+
config ESP_PANEL_BOARD_BACKLIGHT_PWM_FREQ_HZ
64+
int "Frequency"
65+
default 5000
66+
help
67+
Frequency for PWM control.
68+
69+
config ESP_PANEL_BOARD_BACKLIGHT_PWM_DUTY_RESOLUTION
70+
int "Duty resolution"
71+
default 10
72+
range 1 20
73+
help
74+
Duty resolution for PWM control.
75+
endmenu
76+
6077
config ESP_PANEL_BOARD_BACKLIGHT_IDLE_OFF
6178
bool "Idle off"
6279
default n

src/board/custom/esp_panel_board_kconfig_custom_backlight.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,26 @@
4242
#error "Missing configuration: ESP_PANEL_BOARD_BACKLIGHT_ON_LEVEL"
4343
#endif
4444
#endif
45+
46+
#if (ESP_PANEL_BOARD_BACKLIGHT_TYPE == ESP_PANEL_BACKLIGHT_TYPE_PWM_LEDC)
47+
#ifndef ESP_PANEL_BOARD_BACKLIGHT_PWM_FREQ_HZ
48+
#ifdef CONFIG_ESP_PANEL_BOARD_BACKLIGHT_PWM_FREQ_HZ
49+
#define ESP_PANEL_BOARD_BACKLIGHT_PWM_FREQ_HZ CONFIG_ESP_PANEL_BOARD_BACKLIGHT_PWM_FREQ_HZ
50+
#else
51+
#define ESP_PANEL_BOARD_BACKLIGHT_PWM_FREQ_HZ 5000 // Keep the backward compatibility
52+
#endif
53+
#endif
54+
#endif
55+
56+
#if (ESP_PANEL_BOARD_BACKLIGHT_TYPE == ESP_PANEL_BACKLIGHT_TYPE_PWM_LEDC)
57+
#ifndef ESP_PANEL_BOARD_BACKLIGHT_PWM_DUTY_RESOLUTION
58+
#ifdef CONFIG_ESP_PANEL_BOARD_BACKLIGHT_PWM_DUTY_RESOLUTION
59+
#define ESP_PANEL_BOARD_BACKLIGHT_PWM_DUTY_RESOLUTION CONFIG_ESP_PANEL_BOARD_BACKLIGHT_PWM_DUTY_RESOLUTION
60+
#else
61+
#define ESP_PANEL_BOARD_BACKLIGHT_PWM_DUTY_RESOLUTION 10 // Keep the backward compatibility
62+
#endif
63+
#endif
64+
#endif
4565
#endif
4666

4767
#ifndef ESP_PANEL_BOARD_BACKLIGHT_IDLE_OFF

0 commit comments

Comments
 (0)