diff --git a/.github/workflows/check_lib_versions.yml b/.github/workflows/check_lib_versions.yml index 48a48994..ebf83aad 100644 --- a/.github/workflows/check_lib_versions.yml +++ b/.github/workflows/check_lib_versions.yml @@ -26,4 +26,4 @@ jobs: echo "prerelease: ${{ steps.last_release.outputs.prerelease }}" echo "url: ${{ steps.last_release.outputs.url }}" - name: Check & Compare versions - run: bash ./.github/scripts/check_lib_versions.sh --latest_version=${{ steps.last_release.outputs.tag_name }} + run: bash ./tools/check_lib_versions.sh --latest_version=${{ steps.last_release.outputs.tag_name }} diff --git a/.github/workflows/issue_comment.yml b/.github/workflows/issue_comment.yml deleted file mode 100644 index 3b6fcc19..00000000 --- a/.github/workflows/issue_comment.yml +++ /dev/null @@ -1,24 +0,0 @@ -name: Sync issue comments to JIRA - -# This workflow will be triggered when new issue comment is created (including PR comments) -on: issue_comment - -# Limit to single concurrent run for workflows which can create Jira issues. -# Same concurrency group is used in new_issues.yml -concurrency: jira_issues - -jobs: - sync_issue_comments_to_jira: - name: Sync Issue Comments to Jira - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Sync issue comments to JIRA - uses: espressif/github-actions/sync_issues_to_jira@master - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - JIRA_PASS: ${{ secrets.JIRA_PASS }} - JIRA_PROJECT: ${{ secrets.JIRA_PROJECT }} - JIRA_COMPONENT: ${{ secrets.JIRA_COMPONENT }} - JIRA_URL: ${{ secrets.JIRA_URL }} - JIRA_USER: ${{ secrets.JIRA_USER }} diff --git a/.github/workflows/new_issues.yml b/.github/workflows/new_issues.yml deleted file mode 100644 index f0fa4025..00000000 --- a/.github/workflows/new_issues.yml +++ /dev/null @@ -1,24 +0,0 @@ -name: Sync issues to Jira - -# This workflow will be triggered when a new issue is opened -on: issues - -# Limit to single concurrent run for workflows which can create Jira issues. -# Same concurrency group is used in issue_comment.yml -concurrency: jira_issues - -jobs: - sync_issues_to_jira: - name: Sync issues to Jira - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Sync GitHub issues to Jira project - uses: espressif/github-actions/sync_issues_to_jira@master - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - JIRA_PASS: ${{ secrets.JIRA_PASS }} - JIRA_PROJECT: ${{ secrets.JIRA_PROJECT }} - JIRA_COMPONENT: ${{ secrets.JIRA_COMPONENT }} - JIRA_URL: ${{ secrets.JIRA_URL }} - JIRA_USER: ${{ secrets.JIRA_USER }} diff --git a/.github/workflows/new_prs.yml b/.github/workflows/new_prs.yml deleted file mode 100644 index 01d7fe26..00000000 --- a/.github/workflows/new_prs.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: Sync remain PRs to Jira - -# This workflow will be triggered every hour, to sync remaining PRs (i.e. PRs with zero comment) to Jira project -# Note that, PRs can also get synced when new PR comment is created -on: - schedule: - - cron: "0 * * * *" - -# Limit to single concurrent run for workflows which can create Jira issues. -# Same concurrency group is used in issue_comment.yml -concurrency: jira_issues - -jobs: - sync_prs_to_jira: - name: Sync PRs to Jira - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Sync PRs to Jira project - uses: espressif/github-actions/sync_issues_to_jira@master - with: - cron_job: true - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - JIRA_PASS: ${{ secrets.JIRA_PASS }} - JIRA_PROJECT: ${{ secrets.JIRA_PROJECT }} - JIRA_COMPONENT: ${{ secrets.JIRA_COMPONENT }} - JIRA_URL: ${{ secrets.JIRA_URL }} - JIRA_USER: ${{ secrets.JIRA_USER }} diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 7111ea9c..cc477dbf 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -11,4 +11,4 @@ jobs: steps: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 - - uses: pre-commit/action@v2.0.3 + - uses: pre-commit/action@v3.0.1 diff --git a/.gitlab/ci/rules.yml b/.gitlab/ci/rules.yml index bc8fcba8..8368c163 100644 --- a/.gitlab/ci/rules.yml +++ b/.gitlab/ci/rules.yml @@ -10,110 +10,79 @@ # component general files .patterns-component_general: &patterns-component_general + - "src/esp_panel_conf_internal.h" + - "src/esp_panel_types.h" + - "src/esp_panel_versions.h" - "CMakeLists.txt" - "idf_component.yml" - "Kconfig" # component utils files -.patterns-component_utils: &patterns-component_utils - - .patterns-component_general +.patterns-component_utils_all: &patterns-component_utils_all - "src/utils/**/*" # component drivers-general files .patterns-component_drivers_general: &patterns-component_drivers_general - - .patterns-component_general - - .patterns-component_utils - "esp_panel_drivers_conf.h" - "src/drivers/esp_panel_drivers_conf_internal.h" - "src/drivers/Kconfig.drivers" # component drivers-backlight files -.patterns-component_drivers_backlight: &patterns-component_drivers_backlight - - .patterns-component_drivers_general +.patterns-component_drivers_backlight_all: &patterns-component_drivers_backlight_all - "src/drivers/backlight/**/*" # component drivers-host files .patterns-component_drivers_host_general: &patterns-component_drivers_host_general - - .patterns-component_drivers_general - "src/drivers/host/esp_panel_host.*" .patterns-component_drivers_host_dsi: &patterns-component_drivers_host_dsi - - .patterns-component_drivers_host_general - "src/drivers/host/port/esp_panel_host_dsi.*" .patterns-component_drivers_host_i2c: &patterns-component_drivers_host_i2c - - .patterns-component_drivers_host_general - "src/drivers/host/port/esp_panel_host_i2c.*" .patterns-component_drivers_host_spi: &patterns-component_drivers_host_spi - - .patterns-component_drivers_host_general - "src/drivers/host/port/esp_panel_host_spi.*" .patterns-component_drivers_host_all: &patterns-component_drivers_host_all - - .patterns-component_drivers_host_dsi - - .patterns-component_drivers_host_i2c - - .patterns-component_drivers_host_spi + - "src/drivers/host/**/*" # component drivers-bus files .patterns-component_drivers_bus_general: &patterns-component_drivers_bus_general - - .patterns-component_drivers_general - "src/drivers/bus/esp_panel_bus_conf_internal.h" - "src/drivers/bus/esp_panel_bus.*" - "src/drivers/bus/Kconfig.bus" .patterns-component_drivers_bus_dsi: &patterns-component_drivers_bus_dsi - - .patterns-component_drivers_bus_general - - .patterns-component_drivers_host_dsi - "src/drivers/bus/port/esp_panel_bus_dsi.*" .patterns-component_drivers_bus_i2c: &patterns-component_drivers_bus_i2c - - .patterns-component_drivers_bus_general - - .patterns-component_drivers_host_i2c - "src/drivers/bus/port/esp_panel_bus_i2c.*" .patterns-component_drivers_bus_qspi: &patterns-component_drivers_bus_qspi - - .patterns-component_drivers_bus_general - - .patterns-component_drivers_host_spi - "src/drivers/bus/port/esp_panel_bus_qspi.*" .patterns-component_drivers_bus_rgb: &patterns-component_drivers_bus_rgb - - .patterns-component_drivers_bus_general - "src/drivers/bus/port/esp_panel_bus_rgb.*" .patterns-component_drivers_bus_3wire_spi_rgb: &patterns-component_drivers_bus_3wire_spi_rgb - - .patterns-component_drivers_bus_rgb - "src/drivers/bus/port/esp_lcd_panel_io_3wire_spi.c" - "src/drivers/bus/port/esp_lcd_panel_io_additions.h" .patterns-component_drivers_bus_spi: &patterns-component_drivers_bus_spi - - .patterns-component_drivers_bus_general - - .patterns-component_drivers_host_spi - "src/drivers/bus/port/esp_panel_bus_spi.*" .patterns-component_drivers_bus_all: &patterns-component_drivers_bus_all - - .patterns-component_drivers_bus_dsi - - .patterns-component_drivers_bus_i2c - - .patterns-component_drivers_bus_qspi - - .patterns-component_drivers_bus_rgb - - .patterns-component_drivers_bus_3wire_spi_rgb - - .patterns-component_drivers_bus_spi - -# component dirvers-io_expander files -.patterns-component_drivers_io_expander_all: &patterns-component_drivers_io_expander_all - - .patterns-component_drivers_general - - "src/drivers/io_expander/**/*" + - "src/drivers/bus/**/*" # component drivers-lcd files .patterns-component_drivers_lcd_general: &patterns-component_drivers_lcd_general - - .patterns-component_drivers_general - "src/drivers/lcd/port/esp_panel_lcd_vendor_types.h" - "src/drivers/lcd/esp_panel_lcd_conf_internal.h" - "src/drivers/lcd/esp_panel_lcd.*" - "src/drivers/lcd/Kconfig.lcd" .patterns-component_drivers_lcd_mipi_dsi: &patterns-component_drivers_lcd_mipi_dsi - - .patterns-component_drivers_lcd_general - - .patterns-component_drivers_bus_dsi - "src/drivers/lcd/**/*ek79007*" - "src/drivers/lcd/**/*hx8399*" - "src/drivers/lcd/**/*ili9881c*" @@ -125,8 +94,7 @@ - "src/drivers/lcd/**/*st77922*" .patterns-component_drivers_lcd_qspi: &patterns-component_drivers_lcd_qspi - - .patterns-component_drivers_lcd_general - - .patterns-component_drivers_bus_qspi + - "src/drivers/lcd/**/*axs15231b*" - "src/drivers/lcd/**/*gc9b71*" - "src/drivers/lcd/**/*sh8601*" - "src/drivers/lcd/**/*spd2010*" @@ -134,22 +102,16 @@ - "src/drivers/lcd/**/*st77922*" .patterns-component_drivers_lcd_rgb: &patterns-component_drivers_lcd_rgb - - .patterns-component_drivers_lcd_general - - .patterns-component_drivers_bus_rgb - "src/drivers/lcd/**/*ek9716b*" - "src/drivers/lcd/**/*st7262*" .patterns-component_drivers_lcd_3wire_spi_rgb: &patterns-component_drivers_lcd_3wire_spi_rgb - - .patterns-component_drivers_lcd_general - - .patterns-component_drivers_bus_3wire_spi_rgb - "src/drivers/lcd/**/*gc9503*" - "src/drivers/lcd/**/*st7701*" - "src/drivers/lcd/**/*st77903*" - "src/drivers/lcd/**/*st77922*" .patterns-component_drivers_lcd_spi: &patterns-component_drivers_lcd_spi - - .patterns-component_drivers_lcd_general - - .patterns-component_drivers_bus_spi - "src/drivers/lcd/**/*gc9a01*" - "src/drivers/lcd/**/*gc9b71*" - "src/drivers/lcd/**/*ili9341*" @@ -161,23 +123,23 @@ - "src/drivers/lcd/**/*st77916*" - "src/drivers/lcd/**/*st77922*" +.patterns-component_drivers_lcd_all: &patterns-component_drivers_lcd_all + - "src/drivers/lcd/**/*" + # component drivers-touch files .patterns-component_drivers_touch_general: &patterns-component_drivers_touch_general - - .patterns-component_drivers_general - "src/drivers/touch/port/esp_lcd_touch.*" - "src/drivers/touch/esp_panel_touch_conf_internal.h" - "src/drivers/touch/esp_panel_touch.*" - "src/drivers/touch/Kconfig.touch" .patterns-component_drivers_touch_spi: &patterns-component_drivers_touch_spi - - .patterns-component_drivers_touch_general - - .patterns-component_drivers_bus_spi - "src/drivers/touch/**/*stmpe610*" - "src/drivers/touch/**/*xpt2046*" .patterns-component_drivers_touch_i2c: &patterns-component_drivers_touch_i2c - - .patterns-component_drivers_touch_general - - .patterns-component_drivers_bus_i2c + - "src/drivers/touch/**/*axs15231b*" + - "src/drivers/touch/**/*chsc6540*" - "src/drivers/touch/**/*cst816s*" - "src/drivers/touch/**/*ft5x06*" - "src/drivers/touch/**/*gt911*" @@ -187,56 +149,40 @@ - "src/drivers/touch/**/*st7123*" - "src/drivers/touch/**/*tt21100*" -# component drivers-all files -.patterns-component_drivers_all: &patterns-component_drivers_all - - .patterns-component_drivers_backlight - - .patterns-component_drivers_bus - - .patterns-component_drivers_host - - .patterns-component_drivers_io_expander - - .patterns-component_drivers_lcd - - .patterns-component_drivers_touch - - "src/drivers/**/*" +.patterns-component_drivers_touch_all: &patterns-component_drivers_touch_all + - "src/drivers/touch/**/*" # component board files .patterns-component_board_general: &patterns-component_board_general - - .patterns-component_drivers_all - - .patterns-component_utils - "src/board/*.*" - - "src/board/Kconfig.*" .patterns-component_board_custom: &patterns-component_board_custom - - .patterns-component_board_general - "src/board/custom/**/*" .patterns-component_board_supported_elecrow: &patterns-component_board_supported_elecrow - - .patterns-component_board_general - "src/board/supported/elecrow/**/*" .patterns-component_board_supported_espressif: &patterns-component_board_supported_espressif - - .patterns-component_board_general - "src/board/supported/espressif/**/*" .patterns-component_board_supported_jingcai: &patterns-component_board_supported_jingcai - - .patterns-component_board_general - "src/board/supported/jingcai/**/*" .patterns-component_board_supported_m5stack: &patterns-component_board_supported_m5stack - - .patterns-component_board_general - "src/board/supported/m5stack/**/*" .patterns-component_board_supported_viewe: &patterns-component_board_supported_viewe - - .patterns-component_board_general - "src/board/supported/viewe/**/*" .patterns-component_board_supported_waveshare: &patterns-component_board_supported_waveshare - - .patterns-component_board_general - "src/board/supported/waveshare/**/*" +.patterns-component_board_supported_all: &patterns-component_board_supported_all + - "src/board/supported/**/*" + # component all files .patterns-component_all: &patterns-component_all - - .patterns-component_utils - - .patterns-component_drivers_all - - .patterns-component_board_all + - "src/**/*" # docs files .patterns-docs_md: &patterns-docs_md @@ -247,23 +193,18 @@ - "test_apps/common_components/lcd_general_test/**/*" .patterns-test_apps_drivers_lcd_3wire_spi_rgb: &patterns-test_apps_drivers_lcd_3wire_spi_rgb - - .patterns-test_apps_drivers_lcd_general - "test_apps/drivers/lcd/3wire_spi_rgb/**/*" .patterns-test_apps_drivers_lcd_mipi_dsi: &patterns-test_apps_drivers_lcd_mipi_dsi - - .patterns-test_apps_drivers_lcd_general - "test_apps/drivers/lcd/mipi_dsi/**/*" .patterns-test_apps_drivers_lcd_qspi: &patterns-test_apps_drivers_lcd_qspi - - .patterns-test_apps_drivers_lcd_general - "test_apps/drivers/lcd/qspi/**/*" .patterns-test_apps_drivers_lcd_rgb: &patterns-test_apps_drivers_lcd_rgb - - .patterns-test_apps_drivers_lcd_general - "test_apps/drivers/lcd/rgb/**/*" .patterns-test_apps_drivers_lcd_spi: &patterns-test_apps_drivers_lcd_spi - - .patterns-test_apps_drivers_lcd_general - "test_apps/drivers/lcd/spi/**/*" # test_apps touch files @@ -271,49 +212,35 @@ - "test_apps/common_components/touch_general_test/**/*" .patterns-test_apps_drivers_touch_i2c: &patterns-test_apps_drivers_touch_i2c - - .patterns-test_apps_drivers_touch_general - "test_apps/drivers/touch/i2c/**/*" .patterns-test_apps_drivers_touch_spi: &patterns-test_apps_drivers_touch_spi - - .patterns-test_apps_drivers_touch_general - "test_apps/drivers/touch/spi/**/*" # test_apps board files -.patterns-test_apps_board_general: &patterns-test_apps_board_general - - .patterns-test_apps_drivers_lcd_general - - .patterns-test_apps_drivers_touch_general - .patterns-test_apps_board_common: &patterns-test_apps_board_common - - .patterns-test_apps_board_general - "test_apps/board/common/**/*" .patterns-test_apps_board_elecrow: &patterns-test_apps_board_elecrow - - .patterns-test_apps_board_general - "test_apps/board/elecrow/**/*" .patterns-test_apps_board_espressif: &patterns-test_apps_board_espressif - - .patterns-test_apps_board_general - "test_apps/board/espressif/**/*" .patterns-test_apps_board_jingcai: &patterns-test_apps_board_jingcai - - .patterns-test_apps_board_general - "test_apps/board/jingcai/**/*" .patterns-test_apps_board_m5stack: &patterns-test_apps_board_m5stack - - .patterns-test_apps_board_general - "test_apps/board/m5stack/**/*" .patterns-test_apps_board_viewe: &patterns-test_apps_board_viewe - - .patterns-test_apps_board_general - "test_apps/board/viewe/**/*" .patterns-test_apps_board_waveshare: &patterns-test_apps_board_waveshare - - .patterns-test_apps_board_general - "test_apps/board/waveshare/**/*" # test_apps gui files .patterns-test_apps_gui_lvgl_v8_port: &patterns-test_apps_gui_lvgl_v8_port - - .patterns-test_apps_board_general - "test_apps/gui/lvgl_v8_port/**/*" ############## @@ -363,8 +290,22 @@ - <<: *if-trigger-job - <<: *if-dev-push changes: *patterns-build_system + - <<: *if-dev-push + changes: *patterns-component_general + - <<: *if-dev-push + changes: *patterns-component_utils_all + - <<: *if-dev-push + changes: *patterns-component_drivers_general + - <<: *if-dev-push + changes: *patterns-component_drivers_bus_general + - <<: *if-dev-push + changes: *patterns-component_drivers_bus_3wire_spi_rgb + - <<: *if-dev-push + changes: *patterns-component_drivers_lcd_general - <<: *if-dev-push changes: *patterns-component_drivers_lcd_3wire_spi_rgb + - <<: *if-dev-push + changes: *patterns-test_apps_drivers_lcd_general - <<: *if-dev-push changes: *patterns-test_apps_drivers_lcd_3wire_spi_rgb @@ -376,8 +317,26 @@ - <<: *if-trigger-job - <<: *if-dev-push changes: *patterns-build_system + - <<: *if-dev-push + changes: *patterns-component_general + - <<: *if-dev-push + changes: *patterns-component_utils_all + - <<: *if-dev-push + changes: *patterns-component_drivers_general + - <<: *if-dev-push + changes: *patterns-component_drivers_host_general + - <<: *if-dev-push + changes: *patterns-component_drivers_host_dsi + - <<: *if-dev-push + changes: *patterns-component_drivers_bus_general + - <<: *if-dev-push + changes: *patterns-component_drivers_bus_dsi + - <<: *if-dev-push + changes: *patterns-component_drivers_lcd_general - <<: *if-dev-push changes: *patterns-component_drivers_lcd_mipi_dsi + - <<: *if-dev-push + changes: *patterns-test_apps_drivers_lcd_general - <<: *if-dev-push changes: *patterns-test_apps_drivers_lcd_mipi_dsi @@ -389,8 +348,26 @@ - <<: *if-trigger-job - <<: *if-dev-push changes: *patterns-build_system + - <<: *if-dev-push + changes: *patterns-component_general + - <<: *if-dev-push + changes: *patterns-component_utils_all + - <<: *if-dev-push + changes: *patterns-component_drivers_general + - <<: *if-dev-push + changes: *patterns-component_drivers_host_general + - <<: *if-dev-push + changes: *patterns-component_drivers_host_spi + - <<: *if-dev-push + changes: *patterns-component_drivers_bus_general + - <<: *if-dev-push + changes: *patterns-component_drivers_bus_qspi + - <<: *if-dev-push + changes: *patterns-component_drivers_lcd_general - <<: *if-dev-push changes: *patterns-component_drivers_lcd_qspi + - <<: *if-dev-push + changes: *patterns-test_apps_drivers_lcd_general - <<: *if-dev-push changes: *patterns-test_apps_drivers_lcd_qspi @@ -402,8 +379,22 @@ - <<: *if-trigger-job - <<: *if-dev-push changes: *patterns-build_system + - <<: *if-dev-push + changes: *patterns-component_general + - <<: *if-dev-push + changes: *patterns-component_utils_all + - <<: *if-dev-push + changes: *patterns-component_drivers_general + - <<: *if-dev-push + changes: *patterns-component_drivers_bus_general + - <<: *if-dev-push + changes: *patterns-component_drivers_bus_rgb + - <<: *if-dev-push + changes: *patterns-component_drivers_lcd_general - <<: *if-dev-push changes: *patterns-component_drivers_lcd_rgb + - <<: *if-dev-push + changes: *patterns-test_apps_drivers_lcd_general - <<: *if-dev-push changes: *patterns-test_apps_drivers_lcd_rgb @@ -415,8 +406,26 @@ - <<: *if-trigger-job - <<: *if-dev-push changes: *patterns-build_system + - <<: *if-dev-push + changes: *patterns-component_general + - <<: *if-dev-push + changes: *patterns-component_utils_all + - <<: *if-dev-push + changes: *patterns-component_drivers_general + - <<: *if-dev-push + changes: *patterns-component_drivers_host_general + - <<: *if-dev-push + changes: *patterns-component_drivers_host_spi + - <<: *if-dev-push + changes: *patterns-component_drivers_bus_general + - <<: *if-dev-push + changes: *patterns-component_drivers_bus_spi + - <<: *if-dev-push + changes: *patterns-component_drivers_lcd_general - <<: *if-dev-push changes: *patterns-component_drivers_lcd_spi + - <<: *if-dev-push + changes: *patterns-test_apps_drivers_lcd_general - <<: *if-dev-push changes: *patterns-test_apps_drivers_lcd_spi @@ -429,8 +438,26 @@ - <<: *if-trigger-job - <<: *if-dev-push changes: *patterns-build_system + - <<: *if-dev-push + changes: *patterns-component_general + - <<: *if-dev-push + changes: *patterns-component_utils_all + - <<: *if-dev-push + changes: *patterns-component_drivers_general + - <<: *if-dev-push + changes: *patterns-component_drivers_host_general + - <<: *if-dev-push + changes: *patterns-component_drivers_host_i2c + - <<: *if-dev-push + changes: *patterns-component_drivers_bus_general + - <<: *if-dev-push + changes: *patterns-component_drivers_bus_i2c + - <<: *if-dev-push + changes: *patterns-component_drivers_touch_general - <<: *if-dev-push changes: *patterns-component_drivers_touch_i2c + - <<: *if-dev-push + changes: *patterns-test_apps_drivers_touch_general - <<: *if-dev-push changes: *patterns-test_apps_drivers_touch_i2c @@ -442,8 +469,26 @@ - <<: *if-trigger-job - <<: *if-dev-push changes: *patterns-build_system + - <<: *if-dev-push + changes: *patterns-component_general + - <<: *if-dev-push + changes: *patterns-component_utils_all + - <<: *if-dev-push + changes: *patterns-component_drivers_general + - <<: *if-dev-push + changes: *patterns-component_drivers_host_general + - <<: *if-dev-push + changes: *patterns-component_drivers_host_spi + - <<: *if-dev-push + changes: *patterns-component_drivers_bus_general + - <<: *if-dev-push + changes: *patterns-component_drivers_bus_spi + - <<: *if-dev-push + changes: *patterns-component_drivers_touch_general - <<: *if-dev-push changes: *patterns-component_drivers_touch_spi + - <<: *if-dev-push + changes: *patterns-test_apps_drivers_touch_general - <<: *if-dev-push changes: *patterns-test_apps_drivers_touch_spi @@ -458,6 +503,8 @@ changes: *patterns-build_system - <<: *if-dev-push changes: *patterns-component_all + - <<: *if-dev-push + changes: *patterns-component_board_general - <<: *if-dev-push changes: *patterns-test_apps_board_common @@ -549,6 +596,8 @@ - <<: *if-trigger-job - <<: *if-dev-push changes: *patterns-build_system + - <<: *if-dev-push + changes: *patterns-component_all - <<: *if-dev-push changes: *patterns-component_board_general - <<: *if-dev-push diff --git a/.gitlab/tools/executable-list.txt b/.gitlab/tools/executable-list.txt deleted file mode 100644 index 22439eee..00000000 --- a/.gitlab/tools/executable-list.txt +++ /dev/null @@ -1,4 +0,0 @@ -.github/scripts/check_lib_versions.sh -.gitlab/tools/check_executables.py -.gitlab/tools/check_readme_links.py -.gitlab/tools/push_to_github.sh diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 21178af8..32a2d4a7 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,13 +1,14 @@ # See https://pre-commit.com for more information # See https://pre-commit.com/hooks.html for more hooks -exclude: '(libraries/ui/|lv_conf.h)' +exclude: '(libraries/ui/)' repos: - repo: https://github.com/igrr/astyle_py.git rev: v1.0.5 hooks: - id: astyle_py args: ['--style=otbs', '--attach-namespaces', '--attach-classes', '--indent=spaces=4', '--convert-tabs', '--align-pointer=name', '--align-reference=name', '--keep-one-line-statements', '--pad-header', '--pad-oper'] + exclude: '(.*lv_conf.h)' - repo: https://github.com/espressif/check-copyright/ rev: v1.0.3 @@ -42,6 +43,7 @@ repos: .*_pb2.py| .*.pb-c.h| .*.pb-c.c| + .*lv_conf.h| .*.yuv )$ - id: end-of-file-fixer @@ -49,8 +51,10 @@ repos: - id: check-executables-have-shebangs - id: check-shebang-scripts-are-executable - id: mixed-line-ending + exclude: *whitespace_excludes args: ['-f=lf'] - id: double-quote-string-fixer + exclude: *whitespace_excludes - id: no-commit-to-branch name: Do not use more than one slash in the branch name args: ['--pattern', '^[^/]*/[^/]*/'] @@ -77,33 +81,33 @@ repos: hooks: - id: check-executables name: Check File Permissions - entry: .gitlab/tools/check_executables.py --action executables + entry: ./tools/check_executables.py --action executables language: python types: [executable] exclude: '\.pre-commit/.+' - id: check-executable-list name: Validate executable-list.txt - entry: .gitlab/tools/check_executables.py --action list + entry: ./tools/check_executables.py --action list language: python pass_filenames: false always_run: true - id: sync-conf-files name: Update when configuration files change - entry: python3 tools/sync_conf_files.py ./ ./ + entry: python3 ./tools/sync_conf_files.py ./ ./ language: system files: '.*esp_panel_(board_custom|board_supported|drivers)_conf\.h' - id: sync-template-files name: Update when template files change - entry: python3 tools/sync_conf_files.py ./template_files ./ + entry: python3 ./tools/sync_conf_files.py ./template_files ./ language: system files: '(.*esp_utils_conf\.h|.*lv_conf\.h|.*lvgl_v8_port\.cpp|.*lvgl_v8_port\.h)' - id: check-file-versions name: Update when versions change - entry: python3 tools/check_file_version.py ./ + entry: python3 ./tools/check_file_version.py ./ language: system files: '(.*esp_panel_(board_custom|board_supported|drivers)_conf\.h|library.properties|.*esp_panel_versions.h)' - id: check-library-versions name: Check library versions - entry: ./.github/scripts/check_lib_versions.sh + entry: ./tools/check_lib_versions.sh language: system files: '(idf_component.yml|library.properties)' diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e20554f..7f233c3f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,60 @@ # ChangeLog +## v1.0.4 - 2025-07-13 + +### Enhancements: + +* feat(board): add support for Waveshare ESP32-S3 Touch LCD 2.8C @martinroger (#226) +* feat(docs): document usage of `esp_panel_board_custom_conf.h` with ESP-IDF @martinroger (#226) + +### Bugfixes: + +* fix(repo): update dependent esp-lib-utils version for Arduino + +## v1.0.3 - 2025-07-07 + +### Enhancements: + +* feat(docs): provides an example of how to integrate this library into micropython by @tsteinruecken (#190) +* feat(board): add board Waveshare:ESP32_S3_TOUCH_LCD_1_85_C @hegdi (#208) +* feat(board & touch):add new supported viewe board and cst820 touch @VIEWESMART (#197) +* feat(examples): show the usage of 'configVendorCommands()' function in esp_idf/lvgl_v8_port @martinroger (#217) + +### Bugfixes: + +* fix(examples): lvgl_port_v8 only poll touch screen if interrupt happened @hegdi (#209) +* fix(examples): update lv_conf.h for Arduino IDE @davetheghost (#219) +* fix(lcd): correct conditional compilation logic for ST7701 driver @SinKy-Yan (#223) +* fix(board): correct the RGB IO mapping and backlight configuration for Jingcai:JC8048W550C @jompjomp (#210) + +## v1.0.2 - 2025-04-23 + +### Enhancements: + +* feat(backlight): add PWM parameters configuration (#188) + +### Bugfixes: + +* fix(io_expander): remove incompatible header (#175) +* fix(pre-commit): update the pre-commit script +* fix(docs): update README +* fix(conf): update comments of custom config file +* fix(examples): enable CPU 240M and task WDT default in esp_idf/lvgl_v8_port +* fix(lcd): fix ST7701 mirror issue + +## v1.0.1 - 2025-03-13 + +### Enhancements: + +* feat(docs): add new FAQs + +### Bugfixes: + +* fix(touch): avoid reading the button state when disabled (#162) +* fix(docs): correct and add descriptions +* fix(board): resolve compilation error for SPI touch screens @tilordleo (#169) +* fix(conf): correct comments in `esp_panel_board_custom_conf.h` + ## v1.0.0 - 2025-02-17 ### Breaking changes: diff --git a/README.md b/README.md index fc5df82d..377a225c 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,7 @@ The functional block diagram is shown below: * [ESP-IDF](./docs/envs/use_with_idf.md) * [Arduino IDE](./docs/envs/use_with_arduino.md) * [PlatformIO](./examples/platformio/lvgl_v8_port/README.md) +* [Micropython](./docs/envs/use_with_micropython.md) ## Supported Boards @@ -56,7 +57,7 @@ The functional block diagram is shown below: | [M5Stack](./docs/board/board_m5stack.md) | M5STACK-M5CORE2, M5STACK-M5DIAL, M5STACK-M5CORES3 | | [Elecrow](./docs/board/board_elecrow.md) | CrowPanel 7.0" | | [Jingcai](./docs/board/board_jingcai.md) | ESP32-4848S040C_I_Y_3 | -| [Waveshare](./docs/board/board_waveshare.md) | ESP32-S3-Touch-LCD-1.85, ESP32-S3-Touch-LCD-2.1, ESP32-S3-Touch-LCD-4.3, ESP32-S3-Touch-LCD-4.3B, ESP32-S3-Touch-LCD-5, ESP32-S3-Touch-LCD-5B, ESP32-S3-Touch-LCD-7, ESP32-P4-NANO | +| [Waveshare](./docs/board/board_waveshare.md) | ESP32-S3-Touch-LCD-1.85, ESP32-S3-Touch-LCD-2.1, ESP32-S3-Touch-LCD-2.8C, ESP32-S3-Touch-LCD-4.3, ESP32-S3-Touch-LCD-4.3B, ESP32-S3-Touch-LCD-5, ESP32-S3-Touch-LCD-5B, ESP32-S3-Touch-LCD-7, ESP32-P4-NANO | | [VIEWE](./docs/board/board_viewe.md) | UEDX24320024E-WB-A, UEDX24320028E-WB-A, UEDX24320035E-WB-A, UEDX32480035E-WB-A, UEDX48270043E-WB-A, UEDX48480040E-WB-A, UEDX80480043E-WB-A, UEDX80480050E-WB-A, UEDX80480070E-WB-A | 📌 Click on the manufacturer name for detailed information. @@ -72,14 +73,14 @@ The functional block diagram is shown below: | **Manufacturer** | **Model** | | --------------- | --------- | | AXS | AXS15231B | -| Fitipower | EK9716B、EK79007 | -| GalaxyCore | GC9A01、GC9B71、GC9503 | +| Fitipower | EK9716B,EK79007 | +| GalaxyCore | GC9A01,GC9B71,GC9503 | | Himax | HX8399 | -| Ilitek | ILI9341、ILI9881C | -| JADARD | JD9165、JD9365 | +| Ilitek | ILI9341,ILI9881C | +| JADARD | JD9165,JD9365 | | NewVision | NV3022B | | SHENGHE | SH8601 | -| Sitronix | ST7262、ST7701、ST7703、ST7789、ST7796、ST77903、ST77916、ST77922 | +| Sitronix | ST7262,ST7701,ST7703,ST7789,ST7796,ST77903,ST77916,ST77922 | | Solomon Systech | SPD2010 | 📌 For detailed information, please refer to [Supported LCD Controllers](./docs/drivers/lcd.md). @@ -93,10 +94,10 @@ The functional block diagram is shown below: | AXS | AXS15231B | | Chipsemicorp | CHSC6540 | | FocalTech | FT5x06 | -| GOODiX | GT911、GT1151 | -| Hynitron | CST816S | +| GOODiX | GT911,GT1151 | +| Hynitron | CST816S,CST820 | | Parade | TT21100 | -| Sitronix | ST7123、ST1633 | +| Sitronix | ST7123,ST1633 | | Solomon Systech | SPD2010 | | ST | STMPE610 | | Xptek | XPT2046 | @@ -115,12 +116,17 @@ The functional block diagram is shown below: * [How to select and configure supported boards in Arduino IDE?](./docs/envs/use_with_arduino.md#how-to-select-and-configure-supported-boards-in-arduino-ide) * [How to use SquareLine exported UI source files in Arduino IDE?](./docs/envs/use_with_arduino.md#how-to-use-squareline-exported-ui-source-files-in-arduino-ide) * [How to debug when the screen doesn't light up using the library in Arduino IDE?](./docs/envs/use_with_arduino.md#how-to-debug-when-the-screen-doesnt-light-up-using-the-library-in-arduino-ide) - * [How to reduce Flash usage and speed up compilation when using ESP32_Display_Panel in Arduino IDE?](./docs/envs/use_with_arduino.md#how-to-reduce-flash-usage-and-speed-up-compilation-when-using-esp32_display_panel-in-arduino-ide) - * [Can't see log messages or messages are incomplete in Arduino IDE's Serial Monitor, how to fix?](./docs/envs/use_with_arduino.md#can-t-see-log-messages-or-messages-are-incomplete-in-arduino-ides-serial-monitor-how-to-fix) + * [How to fix the issue that log messages are missing or incomplete in Arduino IDE's Serial Monitor?](./docs/envs/use_with_arduino.md#how-to-fix-the-issue-that-log-messages-are-missing-or-incomplete-in-arduino-ides-serial-monitor) * [Solution for screen drift issue when using ESP32-S3 to drive RGB LCD in Arduino IDE](./docs/envs/use_with_arduino.md#solution-for-screen-drift-issue-when-using-esp32-s3-to-drive-rgb-lcd-in-arduino-ide) + * [How to reduce Flash usage and speed up compilation when using ESP32_Display_Panel in Arduino IDE?](./docs/envs/use_with_arduino.md#how-to-reduce-flash-usage-and-speed-up-compilation-when-using-esp32_display_panel-in-arduino-ide) + * [How to avoid I2C re-initialization when using ESP32_Display_Panel in Arduino IDE (e.g., when using Wire library)?](./docs/envs/use_with_arduino.md#how-to-avoid-i2c-re-initialization-when-using-esp32_display_panel-in-arduino-ide-eg-when-using-wire-library) * [ESP-IDF](./docs/envs/use_with_idf.md#faq) * [Solution for screen drift issue when using ESP32-S3 to drive RGB LCD in ESP-IDF](./docs/envs/use_with_idf.md#solution-for-screen-drift-issue-when-using-esp32-s3-to-drive-rgb-lcd-in-esp-idf) * [How to reduce Flash usage and speed up compilation when using ESP32_Display_Panel in ESP-IDF?](./docs/envs/use_with_idf.md#how-to-reduce-flash-usage-and-speed-up-compilation-when-using-esp32_display_panel-in-esp-idf) * [Other LCD issues in ESP-IDF](./docs/envs/use_with_idf.md#other-lcd-issues-in-esp-idf) + +* [Other FAQs](./docs/faq_others.md) + + * [Can't find drivers for the same model of LCD/Touch device?](./docs/faq_others.md#can-t-find-drivers-for-the-same-model-of-lcd/touch-device) diff --git a/README_CN.md b/README_CN.md index 17a3dac4..35b3e03f 100644 --- a/README_CN.md +++ b/README_CN.md @@ -45,6 +45,7 @@ ESP32_Display_Panel 的主要特性如下: * [ESP-IDF](./docs/envs/use_with_idf_cn.md) * [Arduino IDE](./docs/envs/use_with_arduino_cn.md) * [PlatformIO](./examples/platformio/lvgl_v8_port/README.md) +* [Micropython](./docs/envs/use_with_micropython_cn.md) ## 支持的开发板 @@ -56,7 +57,7 @@ ESP32_Display_Panel 的主要特性如下: | [M5Stack](./docs/board/board_m5stack.md) | M5STACK-M5CORE2、M5STACK-M5DIAL、M5STACK-M5CORES3 | | [Elecrow](./docs/board/board_elecrow.md) | CrowPanel 7.0" | | [Jingcai](./docs/board/board_jingcai.md) | ESP32-4848S040C_I_Y_3 | -| [Waveshare](./docs/board/board_waveshare.md) | ESP32-S3-Touch-LCD-1.85、ESP32-S3-Touch-LCD-2.1、ESP32-S3-Touch-LCD-4.3、ESP32-S3-Touch-LCD-4.3B、ESP32-S3-Touch-LCD-5、ESP32-S3-Touch-LCD-5B、ESP32-S3-Touch-LCD-7、ESP32-P4-NANO | +| [Waveshare](./docs/board/board_waveshare.md) | ESP32-S3-Touch-LCD-1.85、ESP32-S3-Touch-LCD-2.1、ESP32-S3-Touch-LCD-2.8C、ESP32-S3-Touch-LCD-4.3、ESP32-S3-Touch-LCD-4.3B、ESP32-S3-Touch-LCD-5、ESP32-S3-Touch-LCD-5B、ESP32-S3-Touch-LCD-7、ESP32-P4-NANO | | [VIEWE](./docs/board/board_viewe.md) | UEDX24320024E-WB-A、UEDX24320028E-WB-A、UEDX24320035E-WB-A、UEDX32480035E-WB-A、UEDX48270043E-WB-A、UEDX48480040E-WB-A、UEDX80480043E-WB-A、UEDX80480050E-WB-A、UEDX80480070E-WB-A | 📌 详细说明请点击制造商名称查看。 @@ -94,7 +95,7 @@ ESP32_Display_Panel 的主要特性如下: | Chipsemicorp | CHSC6540 | | FocalTech | FT5x06 | | GOODiX | GT911、GT1151 | -| Hynitron | CST816S | +| Hynitron | CST816S、CST820 | | Parade | TT21100 | | Sitronix | ST7123、ST1633 | | Solomon Systech | SPD2010 | @@ -118,9 +119,14 @@ ESP32_Display_Panel 的主要特性如下: * [在 Arduino IDE 中打开串口调试器看不到日志信息或日志信息显示不全,如何解决?](./docs/envs/use_with_arduino_cn.md#在-arduino-ide-中打开串口调试器看不到日志信息或日志信息显示不全如何解决) * [在 Arduino IDE 中使用 ESP32-S3 驱动 RGB LCD 时出现画面漂移问题的解决方案](./docs/envs/use_with_arduino_cn.md#在-arduino-ide-中使用-esp32-s3-驱动-rgb-lcd-时出现画面漂移问题的解决方案) * [在 Arduino IDE 中使用 ESP32_Display_Panel 时,如何降低其 Flash 占用及加快编译速度?](./docs/envs/use_with_arduino_cn.md#在-arduino-ide-中使用-esp32_display_panel-时如何降低其-flash-占用及加快编译速度) + * [在 Arduino IDE 中使用 ESP32_Display_Panel 时,如何避免 I2C 重复初始化(如使用 Wire 库)?](./docs/envs/use_with_arduino_cn.md#在-arduino-ide-中使用-esp32_display_panel-时如何避免-i2c-重复初始化如使用-wire-库) * [ESP-IDF](./docs/envs/use_with_idf_cn.md#常见问题及解答) * [在 ESP-IDF 中使用 ESP32-S3 驱动 RGB LCD 时出现画面漂移问题的解决方案](./docs/envs/use_with_idf_cn.md#在-esp-idf-中使用-esp32-s3-驱动-rgb-lcd-时出现画面漂移问题的解决方案) * [在 ESP-IDF 中使用 ESP32_Display_Panel 时,如何降低其 Flash 占用及加快编译速度?](./docs/envs/use_with_idf_cn.md#在-esp-idf-中使用-esp32_display_panel-时如何降低其-flash-占用及加快编译速度) * [在 ESP-IDF 中驱动 LCD 遇到其他问题](./docs/envs/use_with_idf_cn.md#在-esp-idf-中驱动-lcd-遇到其他问题) + +* [其他问题](./docs/faq_others_cn.md) + + * [找不到相同型号的 LCD/Touch 设备驱动?](./docs/faq_others_cn.md#找不到相同型号的-lcd/touch-设备驱动) diff --git a/check_copyright_config.yaml b/check_copyright_config.yaml index e397a788..8550c7e1 100644 --- a/check_copyright_config.yaml +++ b/check_copyright_config.yaml @@ -41,4 +41,4 @@ examples_and_unit_tests: ignore: # You can also select ignoring files here perform_check: no # Don't check files from that block include: - - 'examples/platformio/lvgl_v8_port/src/lv_conf.h' + - '**/**/lv_conf.h' diff --git a/docs/board/board_viewe.md b/docs/board/board_viewe.md index efd43575..d89d6f9e 100644 --- a/docs/board/board_viewe.md +++ b/docs/board/board_viewe.md @@ -4,6 +4,11 @@ | **Picture** | **Name** | **LCD Bus** | **LCD Controller** | **LCD resolution** | **Touch Bus** | **Touch Controller** | | :--------------------------------------------------------------------------------------------------------: | :-----------------------------------------------------------------------------------------------------------------------------------------------------: | :--------------: | :-------------------------------: | ------------------ | :-----------: | :------------------: | +| | [UEDX24240013-MD50E](https://viewedisplay.com/product/esp32-1-28-inch-240x240-round-tft-knob-display-gc9a01-arduino-lvgl/) | SPI | GC9A01 | 240x240 | | | +| | [UEDX46460015-MD50E](https://viewedisplay.com/product/esp32-1-5-inch-466x466-round-amoled-knob-display-touch-screen-arduino-lvgl/) | SPI | CO5300AF-42(like SH8601) | 466x466 | I2C | CST820 | +| | [VIEWE-SMARTRING](https://viewedisplay.com/product/esp32-1-8-inch-round-amoled-touch-display-arduino-lvgl-wifi-voice-assistant-ai-smart-displays/) | SPI | CO5300(like SH8601) | 466x466 | I2C | CST820 | +| | [UEDX48480021-MD80E](https://viewedisplay.com/product/esp32-2-1-inch-480x480-round-tft-knob-display-rotary-encoder-arduino-lvgl/) | SPI | GC9503 | 480x480 | | | +| | [UEDX48480021-MD80ET](https://viewedisplay.com/product/esp32-2-1-inch-480x480-round-tft-knob-touch-display-rotary-encoder-arduino-lvgl/) | SPI | ST7701S | 480x480 | I2C | CST826(like CST820) | | | [UEDX24320024E-WB-A](https://viewedisplay.com/product/esp32-2-4-inch-240x320-rgb-ips-tft-display-touch-screen-arduino-lvgl-wifi-ble-uart-smart-module/) | SPI | GC9307(like GC9A01) | 240x320 | I2C | CHSC6540 | | | [UEDX24320028E-WB-A](https://viewedisplay.com/product/esp32-2-8-inch-240x320-mcu-ips-tft-display-touch-screen-arduino-lvgl-wifi-ble-uart-smart-module/) | SPI | GC9307(like GC9A01) | 240x320 | I2C | CHSC6540 | | | [UEDX24320035E-WB-A](https://viewedisplay.com/product/esp32-3-5-inch-240x320-mcu-ips-tft-display-touch-screen-arduino-lvgl-wifi-ble-uart-smart-module/) | SPI | GC9307(like GC9A01) | 240x320 | I2C | CHSC6540 | @@ -22,17 +27,22 @@ Below are recommended configurations for developing GUI applications on differen These settings can be adjusted according to specific requirements, and users can navigate to the `Tools` menu in the Arduino IDE to configure the following settings. -| Supported Boards | Selected Board | PSRAM | Flash Mode | Flash Size | USB CDC On Boot | Partition Scheme | -| :----------------: | :----------------: | :---: | :--------: | :--------: | :-------------: | :--------------: | -| UEDX24320024E-WB-A | ESP32S3 Dev Module | OPI | QIO 80MHz | 16MB | Enabled | 16M Flash (3MB) | -| UEDX24320028E-WB-A | ESP32S3 Dev Module | OPI | QIO 80MHz | 16MB | Enabled | 16M Flash (3MB) | -| UEDX24320035E-WB-A | ESP32S3 Dev Module | OPI | QIO 80MHz | 16MB | Enabled | 16M Flash (3MB) | -| UEDX32480035E-WB-A | ESP32S3 Dev Module | OPI | QIO 80MHz | 16MB | Enabled | 16M Flash (3MB) | -| UEDX48270043E-WB-A | ESP32S3 Dev Module | OPI | QIO 80MHz | 16MB | Enabled | 16M Flash (3MB) | -| UEDX48480040E-WB-A | ESP32S3 Dev Module | OPI | QIO 80MHz | 16MB | Enabled | 16M Flash (3MB) | -| UEDX80480043E-WB-A | ESP32S3 Dev Module | OPI | QIO 80MHz | 16MB | Enabled | 16M Flash (3MB) | -| UEDX80480050E-WB-A | ESP32S3 Dev Module | OPI | QIO 80MHz | 16MB | Enabled | 16M Flash (3MB) | -| UEDX80480070E-WB-A | ESP32S3 Dev Module | OPI | QIO 80MHz | 16MB | Enabled | 16M Flash (3MB) | +| Supported Boards | Selected Board | PSRAM | Flash Mode | Flash Size | USB CDC On Boot | Partition Scheme | +| :-----------------: | :----------------: | :---: | :--------: | :--------: | :-------------: | :--------------: | +| UEDX24240013-MD50E | ESP32C3 Dev Module | OPI | QIO 80MHz | 4MB | Enabled | 4M | +| UEDX46460015-MD50E | ESP32S3 Dev Module | OPI | QIO 80MHz | 16MB | Enabled | 16M Flash (3MB) | +| VIEWE-SMARTRING | ESP32S3 Dev Module | OPI | QIO 80MHz | 16MB | Enabled | 16M Flash (3MB) | +| UEDX48480021-MD80E | ESP32S3 Dev Module | OPI | QIO 80MHz | 16MB | Enabled | 16M Flash (3MB) | +| UEDX48480021-MD80ET | ESP32S3 Dev Module | OPI | QIO 80MHz | 16MB | Enabled | 16M Flash (3MB) | +| UEDX24320024E-WB-A | ESP32S3 Dev Module | OPI | QIO 80MHz | 16MB | Enabled | 16M Flash (3MB) | +| UEDX24320028E-WB-A | ESP32S3 Dev Module | OPI | QIO 80MHz | 16MB | Enabled | 16M Flash (3MB) | +| UEDX24320035E-WB-A | ESP32S3 Dev Module | OPI | QIO 80MHz | 16MB | Enabled | 16M Flash (3MB) | +| UEDX32480035E-WB-A | ESP32S3 Dev Module | OPI | QIO 80MHz | 16MB | Enabled | 16M Flash (3MB) | +| UEDX48270043E-WB-A | ESP32S3 Dev Module | OPI | QIO 80MHz | 16MB | Enabled | 16M Flash (3MB) | +| UEDX48480040E-WB-A | ESP32S3 Dev Module | OPI | QIO 80MHz | 16MB | Enabled | 16M Flash (3MB) | +| UEDX80480043E-WB-A | ESP32S3 Dev Module | OPI | QIO 80MHz | 16MB | Enabled | 16M Flash (3MB) | +| UEDX80480050E-WB-A | ESP32S3 Dev Module | OPI | QIO 80MHz | 16MB | Enabled | 16M Flash (3MB) | +| UEDX80480070E-WB-A | ESP32S3 Dev Module | OPI | QIO 80MHz | 16MB | Enabled | 16M Flash (3MB) | > [!NOTE] > 1. Enable or disable `USB CDC On Boot` based on the type of port used: diff --git a/docs/board/board_waveshare.md b/docs/board/board_waveshare.md index 2f7e23f6..d84d1a64 100644 --- a/docs/board/board_waveshare.md +++ b/docs/board/board_waveshare.md @@ -6,6 +6,7 @@ | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :-----------------------------------------------------------------------------------------------------: | :--------------: | :----------------: | ------------------ | :-----------: | :------------------: | | | [ESP32-S3-Touch-LCD-1.85](https://www.waveshare.com/esp32-s3-touch-lcd-1.85.htm) | QSPI | ST77916 | 360x360 | I2C | CST816 | | | [ESP32-S3-Touch-LCD-2.1](https://www.waveshare.com/esp32-s3-touch-lcd-2.1.htm) | RGB | ST7701 | 480x480 | I2C | CST820 (CST816-like) | +| | [ESP32-S3-Touch-LCD-2.8C](https://www.waveshare.com/esp32-s3-touch-lcd-2.8c.htm) | RGB | ST7701 | 480x480 | I2C | GT911 | | | [ESP32-S3-Touch-LCD-4.3](https://www.waveshare.com/esp32-s3-touch-lcd-4.3.htm) | RGB | ST7262 | 800x480 | I2C | GT911 | | | [ESP32-S3-Touch-LCD-4.3B](https://www.waveshare.com/esp32-s3-touch-lcd-4.3B.htm) | RGB | ST7262 | 800x480 | I2C | GT911 | | | [ESP32-S3-Touch-LCD-5](https://www.waveshare.com/esp32-s3-touch-lcd-5.htm?sku=28117) | RGB | ST7262 | 800x480 | I2C | GT911 | @@ -25,6 +26,7 @@ These settings can be adjusted according to specific requirements, and users can |:---------------------------------:|:------------------:|:--------:|:----------:|:----------:|:---------------:|:-----------------------:| | Waveshare-ESP32-S3-Touch-LCD-1.85 | ESP32S3 Dev Module | OPI | QIO 80MHz | 16MB | Enabled | 16M Flash (3MB) | | Waveshare-ESP32-S3-Touch-LCD-2.1 | ESP32S3 Dev Module | OPI | QIO 80MHz | 16MB | Enabled | 16M Flash (3MB) | +| Waveshare-ESP32-S3-Touch-LCD-2.8C | ESP32S3 Dev Module | OPI | QIO 80MHz | 16MB | Enabled | 16M Flash (3MB) | | Waveshare-ESP32-S3-Touch-LCD-4.3 | ESP32S3 Dev Module | OPI | QIO 80MHz | 8MB | Disabled | 8M with spiffs | | Waveshare-ESP32-S3-Touch-LCD-4.3B | ESP32S3 Dev Module | OPI | QIO 80MHz | 16MB | Enabled | 16M Flash (3MB) | | Waveshare-ESP32-S3-Touch-LCD-5 | ESP32S3 Dev Module | OPI | QIO 80MHz | 16MB | Enabled | 16M Flash (3MB) | diff --git a/docs/drivers/touch.md b/docs/drivers/touch.md index 7c29347a..771b4d0b 100644 --- a/docs/drivers/touch.md +++ b/docs/drivers/touch.md @@ -3,15 +3,16 @@ | **Name** | **Version** | **I2C** | **SPI** | | :--------------------------------------------------------------------------------------: | :---------: | :-----: | :-----: | | [esp_lcd_touch](https://components.espressif.com/components/espressif/esp_lcd_touch) | 1.1.2 | | | -| AXS15231B | - | ✅ | | -| CHSC6540 | - | ✅ | | -| [CST816S](https://components.espressif.com/components/espressif/esp_lcd_touch_cst816s) | 1.0.3~1 | ✅ | | -| [FT5x06](https://components.espressif.com/components/espressif/esp_lcd_touch_ft5x06) | 1.0.6~1 | ✅ | | -| [GT911](https://components.espressif.com/components/espressif/esp_lcd_touch_gt911) | 1.1.1~1 | ✅ | | -| [GT1151](https://components.espressif.com/components/espressif/esp_lcd_touch_gt1151) | 1.0.5~2 | ✅ | | -| [SPD2010](https://components.espressif.com/components/espressif/esp_lcd_touch_spd2010) | 1.0.0 | ✅ | | -| ST1633 | 0.1.0 | ✅ | | -| [ST7123](https://components.espressif.com/components/espressif/esp_lcd_touch_st7123) | 1.0.0 | ✅ | | -| [STMPE610](https://components.espressif.com/components/espressif/esp_lcd_touch_stmpe610) | 1.0.6 | | ✅ | -| [TT21100](https://components.espressif.com/components/espressif/esp_lcd_touch_tt21100) | 1.1.0~1 | ✅ | | -| [XPT2046](https://components.espressif.com/components/atanisoft/esp_lcd_touch_xpt2046) | 1.0.5 | | ✅ | +| AXS15231B | - | ✅ | | +| CHSC6540 | - | ✅ | | +| [CST816S](https://components.espressif.com/components/espressif/esp_lcd_touch_cst816s) | 1.0.3~1 | ✅ | | +| CST820 | - | ✅ | | +| [FT5x06](https://components.espressif.com/components/espressif/esp_lcd_touch_ft5x06) | 1.0.6~1 | ✅ | | +| [GT911](https://components.espressif.com/components/espressif/esp_lcd_touch_gt911) | 1.1.1~1 | ✅ | | +| [GT1151](https://components.espressif.com/components/espressif/esp_lcd_touch_gt1151) | 1.0.5~2 | ✅ | | +| [SPD2010](https://components.espressif.com/components/espressif/esp_lcd_touch_spd2010) | 1.0.0 | ✅ | | +| ST1633 | 0.1.0 | ✅ | | +| [ST7123](https://components.espressif.com/components/espressif/esp_lcd_touch_st7123) | 1.0.0 | ✅ | | +| [STMPE610](https://components.espressif.com/components/espressif/esp_lcd_touch_stmpe610) | 1.0.6 | | ✅ | +| [TT21100](https://components.espressif.com/components/espressif/esp_lcd_touch_tt21100) | 1.1.0~1 | ✅ | | +| [XPT2046](https://components.espressif.com/components/atanisoft/esp_lcd_touch_xpt2046) | 1.0.5 | | ✅ | diff --git a/docs/envs/use_with_arduino.md b/docs/envs/use_with_arduino.md index e87086dd..c127a60e 100644 --- a/docs/envs/use_with_arduino.md +++ b/docs/envs/use_with_arduino.md @@ -31,10 +31,11 @@ - [How to install ESP32\_Display\_Panel in Arduino IDE?](#how-to-install-esp32_display_panel-in-arduino-ide) - [How to select and configure supported boards in Arduino IDE?](#how-to-select-and-configure-supported-boards-in-arduino-ide) - [How to use SquareLine exported UI source files in Arduino IDE?](#how-to-use-squareline-exported-ui-source-files-in-arduino-ide) - - [Screen not working in Arduino IDE, how to debug?](#screen-not-working-in-arduino-ide-how-to-debug) - - [Can't see log messages or messages are incomplete in Arduino IDE's Serial Monitor, how to fix?](#cant-see-log-messages-or-messages-are-incomplete-in-arduino-ides-serial-monitor-how-to-fix) + - [How to debug when the screen doesn't light up using the library in Arduino IDE?](#how-to-debug-when-the-screen-doesnt-light-up-using-the-library-in-arduino-ide) + - [How to fix the issue that log messages are missing or incomplete in Arduino IDE's Serial Monitor?](#how-to-fix-the-issue-that-log-messages-are-missing-or-incomplete-in-arduino-ides-serial-monitor) - [Solution for screen drift issue when using ESP32-S3 to drive RGB LCD in Arduino IDE](#solution-for-screen-drift-issue-when-using-esp32-s3-to-drive-rgb-lcd-in-arduino-ide) - [How to reduce Flash usage and speed up compilation when using ESP32\_Display\_Panel in Arduino IDE?](#how-to-reduce-flash-usage-and-speed-up-compilation-when-using-esp32_display_panel-in-arduino-ide) + - [How to avoid I2C re-initialization when using ESP32\_Display\_Panel in Arduino IDE (e.g., when using Wire library)?](#how-to-avoid-i2c-re-initialization-when-using-esp32_display_panel-in-arduino-ide-eg-when-using-wire-library) ## Quick Start @@ -49,9 +50,11 @@ - Open Arduino IDE - Navigate to `File` > `Preferences` - Add to `Additional boards manager URLs`: - ``` - https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json - ``` + + ``` + https://espressif.github.io/arduino-esp32/package_esp32_index.json + ``` + - Navigate to `Tools` > `Board` > `Boards Manager` - Search for `esp32` by `Espressif Systems` and install the required version (see [SDK & Dependencies](#sdk--dependencies)) @@ -65,7 +68,7 @@ 1. **Select and Configure Board** -- Navigate to `Tools` > `Board` > `ESP32` +- Navigate to `Tools` > `Board` > `esp32` - Select your board model. If you can't find a matching model, refer to: - If using a [supported board](../../README.md#supported-boards), see [Configuring Arduino IDE](#configuring-arduino-ide) @@ -74,7 +77,7 @@ 2. **Open Example** - Navigate to `File` > `Examples` > `ESP32_Display_Panel` -- Select `Board` > [`board_static_config`](../../examples/arduino/board/board_static_config/) +- Select `Arduino` > `board` > [`board_static_config`](../../examples/arduino/board/board_static_config/) 3. **Modify Code** @@ -503,7 +506,7 @@ Please refer to [Configuring Arduino IDE](#configuring-arduino-ide). Please refer to [Porting SquareLine Projects](#porting-squareline-projects). -### Screen not working in Arduino IDE, how to debug? +### How to debug when the screen doesn't light up using the library in Arduino IDE? Please follow these steps to troubleshoot: @@ -512,7 +515,7 @@ Please follow these steps to troubleshoot: 3. Check detailed log information through the serial monitor to analyze the problem. 4. If the problem still cannot be solved through the above steps, please submit an issue report on [GitHub Issues](https://github.com/esp-arduino-libs/ESP32_Display_Panel/issues) with complete log information. -### Can't see log messages or messages are incomplete in Arduino IDE's Serial Monitor, how to fix? +### How to fix the issue that log messages are missing or incomplete in Arduino IDE's Serial Monitor? Please follow these steps to resolve: @@ -550,7 +553,7 @@ Please follow these steps to resolve: c. **Configure LVGL Task** - - If using LVGL, setting the task that executes `lv_timer_handler()` to run on the same core as the RGB LCD initialization task can help mitigate the screen drift issue + - If using LVGL, setting the task that executes `lv_timer_handler()` to run on the same core as the task that executes `board->begin()` can help mitigate the screen drift issue 3. **Example Code** @@ -615,3 +618,44 @@ Please follow these steps: ``` - For detailed configuration, please refer to [Configuring esp-lib-utils](#configuring-esp-lib-utils) + +### How to avoid I2C re-initialization when using ESP32_Display_Panel in Arduino IDE (e.g., when using Wire library)? + +If you need to use ESP32_Display_Panel's I2C bus functionality, such as `I2C IO_Expander` or `I2C Touch` drivers, while your project is already using the `Wire` library, errors may occur due to I2C bus re-initialization. To avoid this, initialize `Wire` before creating the `Board` object, then follow these steps to configure ESP32_Display_Panel to skip I2C initialization: + +1. By modifying the *esp_panel_board_custom_conf.h* configuration file (only applicable for [custom boards](#loading-of-custom-boards)): + +- For `I2C Touch` driver: + + ```c + ... + #define ESP_PANEL_BOARD_LCD_BUS_SKIP_INIT_HOST (1) // 0/1 + ... + ``` + +- For `I2C IO_Expander` driver: + + ```c + ... + #define ESP_PANEL_BOARD_EXPANDER_SKIP_INIT_HOST (1) // 0/1 + ... + ``` + +2. By using code (applicable for both [supported boards](#loading-of-supported-boards) and [custom boards](#loading-of-custom-boards)): + + ```c + ... + esp_panel::board::Board *board = new esp_panel::board::Board(); + board->init(); + ... + /** + * Should be called after `board->init()` and before `board->begin()` + */ + // For I2C Touch + static_cast(board->getTouch()->getBus())->configI2C_HostSkipInit(); + // For I2C IO_Expander + board->getIO_Expander()->skipInitHost(); + ... + board->begin(); + ... + ``` diff --git a/docs/envs/use_with_arduino_cn.md b/docs/envs/use_with_arduino_cn.md index 9a55b32d..87f9bea0 100644 --- a/docs/envs/use_with_arduino_cn.md +++ b/docs/envs/use_with_arduino_cn.md @@ -35,6 +35,7 @@ - [在 Arduino IDE 中打开串口调试器看不到日志信息或日志信息显示不全,如何解决?](#在-arduino-ide-中打开串口调试器看不到日志信息或日志信息显示不全如何解决) - [在 Arduino IDE 中使用 ESP32-S3 驱动 RGB LCD 时出现画面漂移问题的解决方案](#在-arduino-ide-中使用-esp32-s3-驱动-rgb-lcd-时出现画面漂移问题的解决方案) - [在 Arduino IDE 中使用 ESP32\_Display\_Panel 时,如何降低其 Flash 占用及加快编译速度?](#在-arduino-ide-中使用-esp32_display_panel-时如何降低其-flash-占用及加快编译速度) + - [在 Arduino IDE 中使用 ESP32\_Display\_Panel 时,如何避免 I2C 重复初始化(如使用 Wire 库)?](#在-arduino-ide-中使用-esp32_display_panel-时如何避免-i2c-重复初始化如使用-wire-库) ## 快速入门 @@ -49,9 +50,11 @@ - 打开 Arduino IDE - 导航到 `File` > `Preferences` - 在 `Additional boards manager URLs` 中添加: - ``` - https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json - ``` + + ``` + https://espressif.github.io/arduino-esp32/package_esp32_index.json + ``` + - 导航到 `Tools` > `Board` > `Boards Manager` - 搜索 `esp32` by `Espressif Systems` 并安装符合要求的版本(参阅 [SDK 及依赖库](#sdk-及依赖库)) @@ -65,7 +68,7 @@ 1. **选择和配置开发板** -- 导航到 `Tools` > `Board` > `ESP32` +- 导航到 `Tools` > `Board` > `esp32` - 选择您的开发板型号。如果未找到匹配的型号,请参考以下信息: * 如果您正在使用 [支持的开发板](../../README_CN.md#支持的开发板),可以参阅 [配置 Arduino IDE](#配置-arduino-ide) @@ -74,7 +77,7 @@ 2. **打开示例** - 导航到 `File` > `Examples` > `ESP32_Display_Panel` -- 选择 `Board` > [`board_static_config`](../../examples/arduino/board/board_static_config/) +- 选择 `Arduino` > `board` > [`board_static_config`](../../examples/arduino/board/board_static_config/) 3. **修改代码** @@ -550,7 +553,7 @@ arduino-esp32 v3.x 版本的 SDK 位于默认安装路径下的 `tools > esp32-a c. **配置 LVGL 任务** - - 如果使用 LVGL,设置执行 `lv_timer_handler()` 任务与执行 RGB LCD 初始化任务在同一个核心上运行可以缓解画面漂移问题 + - 如果使用 LVGL,设置执行 `lv_timer_handler()` 的任务与执行 `board->begin()` 的任务在同一个核心上运行可以缓解画面漂移问题 3. **示例代码** @@ -615,3 +618,44 @@ arduino-esp32 v3.x 版本的 SDK 位于默认安装路径下的 `tools > esp32-a ``` - 详细配置方法请参阅 [配置 esp-lib-utils](#配置-esp-lib-utils) + +### 在 Arduino IDE 中使用 ESP32_Display_Panel 时,如何避免 I2C 重复初始化(如使用 Wire 库)? + +如果您需要使用 ESP32_Display_Panel 的 I2C 总线功能,如使用 `I2C IO_Expander` 或 `I2C Touch` 等驱动,而您的项目中已经使用了 `Wire` 库,可能会因为 I2C 总线重复初始化导致错误。为了避免这种情况,请在创建 `Board` 对象之前初始化 `Wire`,然后参考以下步骤设置 ESP32_Display_Panel 跳过初始化 I2C: + +1. 通过修改 *esp_panel_board_custom_conf.h* 配置文件的方法(仅适用于 [自定义开发板](#加载自定义开发板)): + +- 对于 `I2C Touch` 驱动: + + ```c + ... + #define ESP_PANEL_BOARD_LCD_BUS_SKIP_INIT_HOST (1) // 0/1 + ... + ``` + +- 对于 `I2C IO_Expander` 驱动: + + ```c + ... + #define ESP_PANEL_BOARD_EXPANDER_SKIP_INIT_HOST (1) // 0/1 + ... + ``` + +2. 通过代码的方法(适用于 [支持的开发板](#加载支持的开发板) 以及 [自定义开发板](#加载自定义开发板)): + + ```c + ... + esp_panel::board::Board *board = new esp_panel::board::Board(); + board->init(); + ... + /** + * Should be called after `board->init()` and before `board->begin()` + */ + // For I2C Touch + static_cast(board->getTouch()->getBus())->configI2C_HostSkipInit(); + // For I2C IO_Expander + board->getIO_Expander()->skipInitHost(); + ... + board->begin(); + ... + ``` diff --git a/docs/envs/use_with_idf.md b/docs/envs/use_with_idf.md index 25537644..727a9838 100644 --- a/docs/envs/use_with_idf.md +++ b/docs/envs/use_with_idf.md @@ -9,6 +9,7 @@ - [SDK \& Dependencies](#sdk--dependencies) - [Adding to Project](#adding-to-project) - [Configuration Guide](#configuration-guide) + - [Using `esp_panel_board_custom_conf.h` with ESP\_IDF](#using-esp_panel_board_custom_confh-with-esp_idf) - [Example Description](#example-description) - [FAQ](#faq) - [Solution for screen drift issue when using ESP32-S3 to drive RGB LCD in ESP-IDF](#solution-for-screen-drift-issue-when-using-esp32-s3-to-drive-rgb-lcd-in-esp-idf) @@ -71,6 +72,36 @@ Additionally, since ESP32_Display_Panel depends on the `esp-lib-utils` component > * Run `idf.py save-defconfig` to save the current project's `menuconfig` configuration and generate a *sdkconfig.defaults* default configuration file in the project directory. > * To discard the current project's menuconfig configuration and load default settings, first delete the *sdkconfig* file in the project directory, then run `idf.py reconfigure`. +## Using `esp_panel_board_custom_conf.h` with ESP_IDF + +It can be justified to not use `menuconfig` to set up a custom board with the `esp_panel_board_custom_conf.h` file instead, for example to be able to easily define macros that will execute between the board components initialisation steps, or to tinker with advanced vendor commands. + +Because of the component-centric philosophy of ESP-IDF, it is not as simple as dropping the configuration file in the `main` folder and including it in your main app source file. + +Instead, you need to follow these steps : + +1. Run the command `idf.py menuconfig` and make sure that the option *Enable to skip `esp_panel_board_*.h`* is **unchecked**. If you don't see this option, make sure you have added the library as a component to your project first ! +2. Copy your `esp_panel_board_custom_conf.h` file to a folder *inside your project folder*. For those instructions, we will assume that the file is correctly configured and copied inside a folder located at `/main/conf/` like so : +``` +Project Folder - | + | - CMakeLists.txt + | - main - | + | | - main.c + | | - conf - | + | | | - esp_panel_board_custom_conf.h + | | | ... + | | ... + | ... +``` +3. Edith the **project** `CMakeLists.txt` by adding the following line *before* the `project` instruction, like so : +``` +... +include_directories(${CMAKE_CURRENT_LIST_DIR}/main/conf) +project(... +``` + +This will have the effect of loading the macros way before compilation, making it similar to use as under the PlatformIO IDE or Arduino framework. + ## Example Description * [lvgl_v8_port](../../examples/esp_idf/lvgl_v8_port/): This example demonstrates how to port `LVGL v8`. And it runs LVGL's internal demos include `Music Player`, `Widgets`, `Stress` and `Benchmark`. @@ -106,7 +137,7 @@ Please follow these steps to resolve: c. **Configure LVGL Task** - - If using LVGL, setting the task that executes `lv_timer_handler()` to run on the same core as the RGB LCD initialization task can help mitigate the screen drift issue + - If using LVGL, setting the task that executes `lv_timer_handler()` to run on the same core as the task that executes `board->begin()` can help mitigate the screen drift issue 3. **Example Code** diff --git a/docs/envs/use_with_idf_cn.md b/docs/envs/use_with_idf_cn.md index 44d0c3fa..996e6a48 100644 --- a/docs/envs/use_with_idf_cn.md +++ b/docs/envs/use_with_idf_cn.md @@ -9,6 +9,7 @@ - [SDK 及依赖组件](#sdk-及依赖组件) - [添加到工程](#添加到工程) - [配置说明](#配置说明) + - [在 ESP-IDF 中使用 `esp_panel_board_custom_conf.h`](#在-esp-idf-中使用-esp_panel_board_custom_confh) - [示例说明](#示例说明) - [常见问题及解答](#常见问题及解答) - [在 ESP-IDF 中使用 ESP32-S3 驱动 RGB LCD 时出现画面漂移问题的解决方案](#在-esp-idf-中使用-esp32-s3-驱动-rgb-lcd-时出现画面漂移问题的解决方案) @@ -71,6 +72,36 @@ ESP32_Display_Panel 已上传到 [Espressif 组件库](https://components.espres > * 运行 `idf.py save-defconfig` 即可保存当前工程的 `menuconfig` 配置,并在工程目录下生成 *sdkconfig.defaults* 默认配置文件。 > * 如果想要舍弃当前工程 menuconfig 配置并加载默认配置,请先删除工程目录下的 *sdkconfig* 文件,然后再运行 `idf.py reconfigure` 即可。 +## 在 ESP-IDF 中使用 `esp_panel_board_custom_conf.h` + +有时我们希望不通过 `menuconfig` 配置自定义开发板,而是直接使用 `esp_panel_board_custom_conf.h` 文件。例如,这样可以方便地定义一些宏,在各个板级组件初始化步骤之间执行,或者便于调试和尝试高级厂商命令。 + +由于 ESP-IDF 的组件化设计,不能像 Arduino 或 PlatformIO 那样,直接把配置文件放在 `main` 目录下并在主程序中包含即可生效。 + +需要按照如下步骤操作: + +1. 运行 `idf.py menuconfig`,确保 *Enable to skip `esp_panel_board_*.h`* 选项**未勾选**。如果没有看到该选项,请先确保已经将本库作为组件添加到工程中! +2. 将你的 `esp_panel_board_custom_conf.h` 文件复制到**工程目录下的某个文件夹**。本例假设你已正确配置好该文件,并将其放在 `/main/conf/` 目录下,结构如下: +``` +工程目录 - | + | - CMakeLists.txt + | - main - | + | | - main.c + | | - conf - | + | | | - esp_panel_board_custom_conf.h + | | | ... + | | ... + | ... +``` +3. 编辑 **项目** `CMakeLists.txt`,在 `project` 指令之前添加以下行: +``` +... +include_directories(${CMAKE_CURRENT_LIST_DIR}/main/conf) +project(... +``` + +这样,宏会在编译之前加载,使用方法与在 PlatformIO 或 Arduino 框架中类似。 + ## 示例说明 * [lvgl_v8_port](../../examples/esp_idf/lvgl_v8_port/): 该示例演示了如何移植 `LVGL v8`,并且运行了 LVGL 的内部 Demos,包括 `Music Player`、`Widgets`、`Stress` 和 `Benchmark`。 @@ -106,7 +137,7 @@ ESP32_Display_Panel 已上传到 [Espressif 组件库](https://components.espres c. **配置 LVGL 任务** - - 如果使用 LVGL,设置执行 `lv_timer_handler()` 任务与执行 RGB LCD 初始化任务在同一个核心上运行可以缓解画面漂移问题 + - 如果使用 LVGL,设置执行 `lv_timer_handler()` 的任务与执行 `board->begin()` 的任务在同一个核心上运行可以缓解画面漂移问题 3. **示例代码** diff --git a/docs/envs/use_with_micropython.md b/docs/envs/use_with_micropython.md new file mode 100644 index 00000000..eaa64d2e --- /dev/null +++ b/docs/envs/use_with_micropython.md @@ -0,0 +1,193 @@ +# Using with micropython + +This is an example of how to integrate this library into micropython. It's written for an ESP32-S3, however it should be easy to adapt to different supported ESP-Chips. Please note, that you'll need at least 4mb of flash. + +## Step-by-Step instructions + +1. Install IDF and micropython + + ```bash + mkdir ~/esp32build + pushd ~/esp32build + git clone -b v5.2.2 --recursive https://github.com/espressif/esp-idf.git + pushd esp-idf + ./install.sh esp32 + source export.sh + popd + git clone https://github.com/micropython/micropython.git + pushd micropython + git submodule update --init --recursive + pushd mpy-cross + make + popd + ``` + +2. Ensure, you can build a working firmware + + ```bash + make BOARD=ESP32_GENERIC_S3 BOARD_VARIANT=SPIRAM_OCT -C ports/esp32 + pushd ports/esp32 + python -m esptool --port /dev/ttyACM0 --chip esp32s3 -b 460800 --before default_reset --after hard_reset write_flash --flash_mode dio --flash_size 4MB --flash_freq 80m 0x0 build-ESP32_GENERIC_S3-SPIRAM_OCT/bootloader/bootloader.bin 0x8000 build-ESP32_GENERIC_S3-SPIRAM_OCT/partition_table/partition-table.bin 0x10000 build-ESP32_GENERIC_S3-SPIRAM_OCT/micropython.bin + popd + popd + ``` + Now, test the board and ensure your build of micropython works. + +3. Download ESP32_Display_Panel and it's dependencies + + ```bash + git clone https://github.com/esp-arduino-libs/ESP32_Display_Panel.git + git clone https://github.com/esp-arduino-libs/esp-lib-utils.git + git clone https://github.com/esp-arduino-libs/ESP32_IO_Expander.git + ``` + +4. Create a custom user-module definition + + ```bash + cat > micropython.cmake << EOF + include(~/esp32build/ESP32_Display_Panel/micropython.cmake) + include(~/esp32build/esp-lib-utils/micropython.cmake) + include(~/esp32build/ESP32_IO_Expander/micropython.cmake) + EOF + ``` + +5. Copy some header-files + + ```bash + cp esp-idf/components/esp_lcd/include/esp_lcd_panel_commands.h ESP32_Display_Panel/mpy_support/ + cp esp-idf/components/esp_lcd/interface/esp_lcd_panel_interface.h ESP32_Display_Panel/mpy_support/ + cp esp-idf/components/esp_lcd/include/esp_lcd_panel_io.h ESP32_Display_Panel/mpy_support/ + cp esp-idf/components/esp_lcd/interface/esp_lcd_panel_io_interface.h ESP32_Display_Panel/mpy_support/ + cp esp-idf/components/esp_lcd/include/esp_lcd_panel_ops.h ESP32_Display_Panel/mpy_support/ + cp esp-idf/components/esp_lcd/include/esp_lcd_panel_rgb.h ESP32_Display_Panel/mpy_support/ + cp esp-idf/components/esp_lcd/include/esp_lcd_panel_vendor.h ESP32_Display_Panel/mpy_support/ + cp esp-idf/components/esp_lcd/include/esp_lcd_types.h ESP32_Display_Panel/mpy_support/ + ``` + +6. Rebuild micropython to include the new modules + + ```bash + pushd micropython + make BOARD=ESP32_GENERIC_S3 BOARD_VARIANT=SPIRAM_OCT USER_C_MODULES=~/esp32build/micropython.cmake -C ports/esp32 + pushd ports/esp32 + python -m esptool --port /dev/ttyACM0 --chip esp32s3 -b 460800 --before default_reset --after hard_reset write_flash --flash_mode dio --flash_size 4MB --flash_freq 80m 0x0 build-ESP32_GENERIC_S3-SPIRAM_OCT/bootloader/bootloader.bin 0x8000 build-ESP32_GENERIC_S3-SPIRAM_OCT/partition_table/partition-table.bin 0x10000 build-ESP32_GENERIC_S3-SPIRAM_OCT/micropython.bin + popd + popd + ``` + + This may fail if your chip has a small flash size, in this case you have to increase the size of the application partition. E.g. for a 4mb flash chip edit *micropython/ports/esp32/partitions-4MiB.csv* and change the last two lines from: + + ```csv + factory, app, factory, 0x10000, 0x1F0000, + vfs, data, fat, 0x200000, 0x200000, + ``` + + to + + ```csv + factory, app, factory, 0x10000, 0x2F0000, + vfs, data, fat, 0x300000, 0x100000, + ``` + +7. Test the module + + Connect to your board and run: + + ```python + from esp_panel import Board + board = Board() + board.init() + ``` + + `board.init()` should return False, as we yet have to define a board. + +8. Define your Board + + Edit *ESP32_Display_Panel/mpy_support/esp_panel_mp_board.cpp*. Add a Board definition: + + ```c++ + const BoardConfig BOARD_EXTERNAL_CONFIG = { + /* General */ + .name = "ESP_PANEL_BOARD_NAME", + .lcd = BoardConfig::LCD_Config{ + .bus_config = esp_panel::drivers::BusSPI::Config{ + .host_id = 1, + // Host + .host = esp_panel::drivers::BusSPI::HostPartialConfig{ + .mosi_io_num = 6, //ESP_PANEL_BOARD_LCD_SPI_IO_MOSI, + .miso_io_num = 8, //ESP_PANEL_BOARD_LCD_SPI_IO_MISO, + .sclk_io_num = 7, //ESP_PANEL_BOARD_LCD_SPI_IO_SCK, + }, + // Control Panel + .control_panel = esp_panel::drivers::BusSPI::ControlPanelPartialConfig{ + .cs_gpio_num = 5, //ESP_PANEL_BOARD_LCD_SPI_IO_CS, + .dc_gpio_num = 4, //ESP_PANEL_BOARD_LCD_SPI_IO_DC, + .spi_mode = 0, //ESP_PANEL_BOARD_LCD_SPI_MODE, + .pclk_hz = 40 * 1000 * 1000, //ESP_PANEL_BOARD_LCD_SPI_CLK_HZ, + .lcd_cmd_bits = 8, //ESP_PANEL_BOARD_LCD_SPI_CMD_BITS, + .lcd_param_bits = 8, //ESP_PANEL_BOARD_LCD_SPI_PARAM_BITS, + }, + }, + .device_name = "ILI9341", + .device_config = { + // Device + .device = esp_panel::drivers::LCD::DevicePartialConfig{ + .reset_gpio_num = 48, //ESP_PANEL_BOARD_LCD_RST_IO, + .rgb_ele_order = 0, //ESP_PANEL_BOARD_LCD_COLOR_BGR_ORDER, + .bits_per_pixel = 18, //ESP_PANEL_BOARD_LCD_COLOR_BITS, 16/18/24 + .flags_reset_active_high = 0, //ESP_PANEL_BOARD_LCD_RST_LEVEL, + }, + // Vendor + .vendor = esp_panel::drivers::LCD::VendorPartialConfig{ + .hor_res = 320, //ESP_PANEL_BOARD_WIDTH, + .ver_res = 480, //ESP_PANEL_BOARD_HEIGHT, + }, + }, + .pre_process = { + .invert_color = 0, //ESP_PANEL_BOARD_LCD_COLOR_INEVRT_BIT, + }, + }, + }; + ``` + + Then replace the constructor + + ```c++ + self->board = utils::make_shared() + ``` + + with + + ```c++ + self->board = utils::make_shared(BOARD_EXTERNAL_CONFIG); + ``` + +9. Edit esp_panel_drivers_conf.h + + Edit *ESP32_Display_Panel/esp_panel_drivers_conf.h* and ensure, the drivers referenced in your board config are being + build. **Warning**: `ESP_PANEL_DRIVERS_BUS_USE_ALL` does not seem to work. Set to 0 and manually include the bus driver + you need. Same goes for `ESP_PANEL_DRIVERS_BUS_COMPILE_UNUSED_DRIVERS`. + +10. Repeat **Step 6** to rebuild micropython + +11. Test your display + + Connect to your board and run: + + ```python + from esp_panel import Board + board = Board() + board.init() + board.begin() + board.color_bar_test() + ``` + +12. Profit! :) + + To include touch support, see *ESP32_Display_Panel/examples/arduino/board/board_dynamic_config/board_external_config.cpp* for an example touch definition. + +## Known Pitfalls + +1. When `board.init()` returns false, likely your driver-definition in *esp_panel_drivers_conf.h* does not match. +2. `board.begin()` crashes, if you rely on `ESP_PANEL_DRIVERS_BUS_USE_ALL` +3. If you edit *ESP32_Display_Panel/esp_panel_drivers_conf.h*, also modify *ESP32_Display_Panel/mpy_support/esp_panel_mp_board.cpp* (like add or remove an empty line). Otherwise, changes to *esp_panel_drivers_conf.h* will not be recognized. diff --git a/docs/envs/use_with_micropython_cn.md b/docs/envs/use_with_micropython_cn.md new file mode 100644 index 00000000..4e476f50 --- /dev/null +++ b/docs/envs/use_with_micropython_cn.md @@ -0,0 +1,193 @@ +# 在 micropython 中使用 + +这是一个如何将此库集成到 micropython 的示例。它是为 ESP32-S3 编写的,但应该很容易适应不同的受支持的 ESP 芯片。请注意,您至少需要 4MB 的闪存。 + +## 逐步说明 + +1. 安装 IDF 和 micropython + + ```bash + mkdir ~/esp32build + pushd ~/esp32build + git clone -b v5.2.2 --recursive https://github.com/espressif/esp-idf.git + pushd esp-idf + ./install.sh esp32 + source export.sh + popd + git clone https://github.com/micropython/micropython.git + pushd micropython + git submodule update --init --recursive + pushd mpy-cross + make + popd + ``` + +2. 确保您可以构建一个可工作的固件 + + ```bash + make BOARD=ESP32_GENERIC_S3 BOARD_VARIANT=SPIRAM_OCT -C ports/esp32 + pushd ports/esp32 + python -m esptool --port /dev/ttyACM0 --chip esp32s3 -b 460800 --before default_reset --after hard_reset write_flash --flash_mode dio --flash_size 4MB --flash_freq 80m 0x0 build-ESP32_GENERIC_S3-SPIRAM_OCT/bootloader/bootloader.bin 0x8000 build-ESP32_GENERIC_S3-SPIRAM_OCT/partition_table/partition-table.bin 0x10000 build-ESP32_GENERIC_S3-SPIRAM_OCT/micropython.bin + popd + popd + ``` + 现在,测试开发板并确保您构建的 micropython 可以正常工作。 + +3. 下载 ESP32_Display_Panel 及其依赖项 + + ```bash + git clone https://github.com/esp-arduino-libs/ESP32_Display_Panel.git + git clone https://github.com/esp-arduino-libs/esp-lib-utils.git + git clone https://github.com/esp-arduino-libs/ESP32_IO_Expander.git + ``` + +4. 创建自定义用户模块定义 + + ```bash + cat > micropython.cmake << EOF + include(~/esp32build/ESP32_Display_Panel/micropython.cmake) + include(~/esp32build/esp-lib-utils/micropython.cmake) + include(~/esp32build/ESP32_IO_Expander/micropython.cmake) + EOF + ``` + +5. 复制一些头文件 + + ```bash + cp esp-idf/components/esp_lcd/include/esp_lcd_panel_commands.h ESP32_Display_Panel/mpy_support/ + cp esp-idf/components/esp_lcd/interface/esp_lcd_panel_interface.h ESP32_Display_Panel/mpy_support/ + cp esp-idf/components/esp_lcd/include/esp_lcd_panel_io.h ESP32_Display_Panel/mpy_support/ + cp esp-idf/components/esp_lcd/interface/esp_lcd_panel_io_interface.h ESP32_Display_Panel/mpy_support/ + cp esp-idf/components/esp_lcd/include/esp_lcd_panel_ops.h ESP32_Display_Panel/mpy_support/ + cp esp-idf/components/esp_lcd/include/esp_lcd_panel_rgb.h ESP32_Display_Panel/mpy_support/ + cp esp-idf/components/esp_lcd/include/esp_lcd_panel_vendor.h ESP32_Display_Panel/mpy_support/ + cp esp-idf/components/esp_lcd/include/esp_lcd_types.h ESP32_Display_Panel/mpy_support/ + ``` + +6. 重新构建 micropython 以包含新模块 + + ```bash + pushd micropython + make BOARD=ESP32_GENERIC_S3 BOARD_VARIANT=SPIRAM_OCT USER_C_MODULES=~/esp32build/micropython.cmake -C ports/esp32 + pushd ports/esp32 + python -m esptool --port /dev/ttyACM0 --chip esp32s3 -b 460800 --before default_reset --after hard_reset write_flash --flash_mode dio --flash_size 4MB --flash_freq 80m 0x0 build-ESP32_GENERIC_S3-SPIRAM_OCT/bootloader/bootloader.bin 0x8000 build-ESP32_GENERIC_S3-SPIRAM_OCT/partition_table/partition-table.bin 0x10000 build-ESP32_GENERIC_S3-SPIRAM_OCT/micropython.bin + popd + popd + ``` + + 如果您的芯片闪存大小较小,这可能会失败,在这种情况下,您必须增加应用程序分区的大小。例如,对于 4MB 闪存芯片,编辑 *micropython/ports/esp32/partitions-4MiB.csv* 并将最后两行从: + + ```csv + factory, app, factory, 0x10000, 0x1F0000, + vfs, data, fat, 0x200000, 0x200000, + ``` + + 改为: + + ```csv + factory, app, factory, 0x10000, 0x2F0000, + vfs, data, fat, 0x300000, 0x100000, + ``` + +7. 测试模块 + + 连接到您的开发板并运行: + + ```python + from esp_panel import Board + board = Board() + board.init() + ``` + + `board.init()` 应该返回 False,因为我们还需要定义一个开发板。 + +8. 定义您的开发板 + + 编辑 *ESP32_Display_Panel/mpy_support/esp_panel_mp_board.cpp*。添加一个开发板定义: + + ```c++ + const BoardConfig BOARD_EXTERNAL_CONFIG = { + /* General */ + .name = "ESP_PANEL_BOARD_NAME", + .lcd = BoardConfig::LCD_Config{ + .bus_config = esp_panel::drivers::BusSPI::Config{ + .host_id = 1, + // Host + .host = esp_panel::drivers::BusSPI::HostPartialConfig{ + .mosi_io_num = 6, //ESP_PANEL_BOARD_LCD_SPI_IO_MOSI, + .miso_io_num = 8, //ESP_PANEL_BOARD_LCD_SPI_IO_MISO, + .sclk_io_num = 7, //ESP_PANEL_BOARD_LCD_SPI_IO_SCK, + }, + // Control Panel + .control_panel = esp_panel::drivers::BusSPI::ControlPanelPartialConfig{ + .cs_gpio_num = 5, //ESP_PANEL_BOARD_LCD_SPI_IO_CS, + .dc_gpio_num = 4, //ESP_PANEL_BOARD_LCD_SPI_IO_DC, + .spi_mode = 0, //ESP_PANEL_BOARD_LCD_SPI_MODE, + .pclk_hz = 40 * 1000 * 1000, //ESP_PANEL_BOARD_LCD_SPI_CLK_HZ, + .lcd_cmd_bits = 8, //ESP_PANEL_BOARD_LCD_SPI_CMD_BITS, + .lcd_param_bits = 8, //ESP_PANEL_BOARD_LCD_SPI_PARAM_BITS, + }, + }, + .device_name = "ILI9341", + .device_config = { + // Device + .device = esp_panel::drivers::LCD::DevicePartialConfig{ + .reset_gpio_num = 48, //ESP_PANEL_BOARD_LCD_RST_IO, + .rgb_ele_order = 0, //ESP_PANEL_BOARD_LCD_COLOR_BGR_ORDER, + .bits_per_pixel = 18, //ESP_PANEL_BOARD_LCD_COLOR_BITS, 16/18/24 + .flags_reset_active_high = 0, //ESP_PANEL_BOARD_LCD_RST_LEVEL, + }, + // Vendor + .vendor = esp_panel::drivers::LCD::VendorPartialConfig{ + .hor_res = 320, //ESP_PANEL_BOARD_WIDTH, + .ver_res = 480, //ESP_PANEL_BOARD_HEIGHT, + }, + }, + .pre_process = { + .invert_color = 0, //ESP_PANEL_BOARD_LCD_COLOR_INEVRT_BIT, + }, + }, + }; + ``` + + 然后替换构造函数 + + ```c++ + self->board = utils::make_shared() + ``` + + 为 + + ```c++ + self->board = utils::make_shared(BOARD_EXTERNAL_CONFIG); + ``` + +9. 编辑 esp_panel_drivers_conf.h + + 编辑 *ESP32_Display_Panel/esp_panel_drivers_conf.h* 并确保在您的开发板配置中引用的驱动程序被构建。 + **警告**:`ESP_PANEL_DRIVERS_BUS_USE_ALL` 似乎不起作用。设置为 0 并手动包含您需要的总线驱动程序。 + `ESP_PANEL_DRIVERS_BUS_COMPILE_UNUSED_DRIVERS` 也是如此。 + +10. 重复 **步骤 6** 重新构建 micropython + +11. 测试您的显示屏 + + 连接到您的开发板并运行: + + ```python + from esp_panel import Board + board = Board() + board.init() + board.begin() + board.color_bar_test() + ``` + +12. 大功告成!:) + + 要包含触摸支持,请参阅 *ESP32_Display_Panel/examples/arduino/board/board_dynamic_config/board_external_config.cpp* 获取触摸定义示例。 + +## 已知陷阱 + +1. 当 `board.init()` 返回 false 时,很可能是您在 *esp_panel_drivers_conf.h* 中的驱动程序定义不匹配。 +2. 如果您依赖 `ESP_PANEL_DRIVERS_BUS_USE_ALL`,`board.begin()` 会崩溃。 +3. 如果您编辑 *ESP32_Display_Panel/esp_panel_drivers_conf.h*,还需要修改 *ESP32_Display_Panel/mpy_support/esp_panel_mp_board.cpp*(比如添加或删除一个空行)。否则,对 *esp_panel_drivers_conf.h* 的更改将不会被识别。 diff --git a/docs/faq_others.md b/docs/faq_others.md new file mode 100644 index 00000000..a951f7c8 --- /dev/null +++ b/docs/faq_others.md @@ -0,0 +1,9 @@ +# Other FAQs + +## Can't find drivers for the same model of LCD/Touch device? + +For **LCD**, devices with the same interface type (SPI, QSPI, etc.) have similar or even identical driving methods. For example, ILI9341 and GC9A01 have almost identical driver code when using the SPI interface. Therefore, you can try using drivers for other devices with the same interface type. + +For **Touch**, drivers for some devices in the same series are compatible, such as CST816S, CST816D, and CST820 having compatible driver code. Therefore, you can check the technical manuals of devices in the same series to determine if there is compatibility (devices with the same I2C address are usually compatible). + +If the above methods cannot solve your problem, you can create a [Github Issue](https://github.com/esp-arduino-libs/ESP32_Display_Panel/issues) to request adding a driver. diff --git a/docs/faq_others_cn.md b/docs/faq_others_cn.md new file mode 100644 index 00000000..f19a27f2 --- /dev/null +++ b/docs/faq_others_cn.md @@ -0,0 +1,9 @@ +# 其他 FAQ + +## 找不到相同型号的 LCD/Touch 设备驱动? + +对于 **LCD**,具有相同接口类型(SPI、QSPI 等)的设备的驱动方式是类似的,甚至是相同的,例如 ILI9341 和 GC9A01 在使用 SPI 接口时,驱动代码几乎相同。因此,您可以尝试使用其他相同接口类型的设备驱动。 + +对于 **Touch**,部分相同系列设备的驱动是兼容的,如 CST816S 和 CST816D 以及 CST820 的驱动代码是兼容的。因此,您可以查阅相同系列设备的技术手册判断是否存在兼容性(如具有相同的 I2C 地址的设备通常是兼容的)。 + +如果上述方法无法解决问题,您可以创建 [Github Issue](https://github.com/esp-arduino-libs/ESP32_Display_Panel/issues) 请求添加驱动。 diff --git a/esp_panel_board_custom_conf.h b/esp_panel_board_custom_conf.h index 3b65e300..b86014e0 100644 --- a/esp_panel_board_custom_conf.h +++ b/esp_panel_board_custom_conf.h @@ -162,8 +162,8 @@ #define ESP_PANEL_BOARD_LCD_RGB_SPI_SCL_USE_EXPNADER (0) // Set to 1 if the signal is controlled by an IO expander #define ESP_PANEL_BOARD_LCD_RGB_SPI_SDA_USE_EXPNADER (0) // Set to 1 if the signal is controlled by an IO expander #define ESP_PANEL_BOARD_LCD_RGB_SPI_MODE (0) // 0-3, typically set to 0 - #define ESP_PANEL_BOARD_LCD_RGB_SPI_CMD_BYTES (1) // Typically set to 8 - #define ESP_PANEL_BOARD_LCD_RGB_SPI_PARAM_BYTES (1) // Typically set to 8 + #define ESP_PANEL_BOARD_LCD_RGB_SPI_CMD_BYTES (1) // Typically set to 1 + #define ESP_PANEL_BOARD_LCD_RGB_SPI_PARAM_BYTES (1) // Typically set to 1 #define ESP_PANEL_BOARD_LCD_RGB_SPI_USE_DC_BIT (1) // 0/1. Typically set to 1 #endif // ESP_PANEL_BOARD_LCD_RGB_USE_CONTROL_PANEL /* For refresh panel (RGB) */ @@ -347,6 +347,7 @@ * - `AXS15231B` * - `CHSC6540` * - `CST816S` + * - `CST820` * - `FT5x06` * - `GT911`, `GT1151` * - `SPD2010` @@ -476,6 +477,22 @@ #define ESP_PANEL_BOARD_BACKLIGHT_IO (38) // Output GPIO pin number #define ESP_PANEL_BOARD_BACKLIGHT_ON_LEVEL (1) // Active level, 0: low, 1: high +#if ESP_PANEL_BOARD_BACKLIGHT_TYPE == ESP_PANEL_BACKLIGHT_TYPE_PWM_LEDC + /** + * @brief PWM parameters configuration + */ + #define ESP_PANEL_BOARD_BACKLIGHT_PWM_FREQ_HZ (5000) // LEDC timer frequency. + // Different backlight driver chips may have different + // frequency limits, please refer to the datasheet of + // the specific chip. + // https://github.com/esp-arduino-libs/ESP32_Display_Panel/issues/188 + + #define ESP_PANEL_BOARD_BACKLIGHT_PWM_DUTY_RESOLUTION (10) // LEDC timer duty resolution. + // The frequency and duty resolution of the LEDC timer + // need to be properly matched, please refer to: + // https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/ledc.html#supported-range-of-frequency-and-duty-resolutions +#endif + #elif ESP_PANEL_BOARD_BACKLIGHT_TYPE == ESP_PANEL_BACKLIGHT_TYPE_CUSTOM /** @@ -735,9 +752,9 @@ * 3. Patch version mismatch: No impact on functionality */ #define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MAJOR 1 -#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MINOR 0 +#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MINOR 2 #define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_PATCH 0 -#endif // ESP_PANEL_BOARD_USE_CUSTOM +#endif // ESP_PANEL_BOARD_DEFAULT_USE_CUSTOM // *INDENT-ON* diff --git a/esp_panel_board_supported_conf.h b/esp_panel_board_supported_conf.h index 3eb9292a..b25171bb 100644 --- a/esp_panel_board_supported_conf.h +++ b/esp_panel_board_supported_conf.h @@ -93,7 +93,9 @@ * Waveshare Supported Boards (https://www.waveshare.com/): * * -BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_1_85 (ESP32_S3_Touch_LCD_1_85): https://www.waveshare.com/esp32-s3-touch-lcd-1.85.htm + * -BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_1_85_C (ESP32_S3_Touch_LCD_1_85_C): https://www.waveshare.com/esp32-s3-touch-lcd-1.85c.htm * -BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_2_1 (ESP32_S3_Touch_LCD_2_1): https://www.waveshare.com/esp32-s3-touch-lcd-2.1.htm + * -BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_2_8_C (ESP32_S3_Touch_LCD_2_8_C): https://www.waveshare.com/esp32-s3-touch-lcd-2.8c.htm * -BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_4_3 (ESP32_S3_Touch_LCD_4_3): https://www.waveshare.com/esp32-s3-touch-lcd-4.3.htm * -BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_4_3_B (ESP32_S3_Touch_LCD_4_3_B): https://www.waveshare.com/esp32-s3-touch-lcd-4.3B.htm * -BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_5 (ESP32_S3_Touch_LCD_5): https://www.waveshare.com/esp32-s3-touch-lcd-5.htm?sku=28117 @@ -102,7 +104,9 @@ * -BOARD_WAVESHARE_ESP32_P4_NANO (ESP32_P4_NANO): https://www.waveshare.com/esp32-p4-nano.htm */ // #define BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_1_85 +// #define BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_1_85_C // #define BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_2_1 +// #define BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_2_8_C // #define BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_4_3 // #define BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_4_3_B // #define BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_5 @@ -123,24 +127,39 @@ * +------------------- Horizontal resolution: 240 * So UEDX24320024E means: 240x320 resolution & 2.4 inch display * + * - BOARD_VIEWE_SMARTRING (SMARTRING): https://github.com/VIEWESMART/VIEWE-SMARTRING + * - BOARD_VIEWE_UEDX24240013_MD50E (UEDX24240013-MD50E): https://github.com/VIEWESMART/UEDX24240013-MD50ESP32_1.3inch-Knob * - BOARD_VIEWE_UEDX24320024E_WB_A (UEDX24320024E-WB-A): https://viewedisplay.com/product/esp32-2-4-inch-240x320-rgb-ips-tft-display-touch-screen-arduino-lvgl-wifi-ble-uart-smart-module/ * - BOARD_VIEWE_UEDX24320028E_WB_A (UEDX24320028E-WB-A): https://viewedisplay.com/product/esp32-2-8-inch-240x320-mcu-ips-tft-display-touch-screen-arduino-lvgl-wifi-ble-uart-smart-module/ * - BOARD_VIEWE_UEDX24320035E_WB_A (UEDX24320035E-WB-A): https://viewedisplay.com/product/esp32-3-5-inch-240x320-mcu-ips-tft-display-touch-screen-arduino-lvgl-wifi-ble-uart-smart-module/ * - BOARD_VIEWE_UEDX32480035E_WB_A (UEDX32480035E-WB-A): https://github.com/VIEWESMART/Product-Specification-and-Schematic/blob/main/ESP32/3.5inch/320480/UEDX32480035E-WB-A%20SPEC.pdf + * - BOARD_VIEWE_UEDX46460015_MD50ET (UEDX46460015-MD50ET): https://github.com/VIEWESMART/UEDX46460015-MD50ESP32-1.5inch-Touch-Knob-Display * - BOARD_VIEWE_UEDX48270043E_WB_A (UEDX48270043E-WB-A): https://github.com/VIEWESMART/Product-Specification-and-Schematic/blob/main/ESP32/4.3inch/Low-Resolution_480272/UEDX48270043E-WB-A%20SPEC.pdf + * - BOARD_VIEWE_UEDX48480021_MD80E_V2 (UEDX48480021-MD80E(T)): https://github.com/VIEWESMART/UEDX48480021-MD80ESP32_2.1inch-Knob + * - BOARD_VIEWE_UEDX48480021_MD80E (UEDX48480021-MD80E): https://github.com/VIEWESMART/UEDX48480021-MD80ESP32_2.1inch-Knob + * - BOARD_VIEWE_UEDX48480021_MD80ET (UEDX48480021-MD80ET): https://github.com/VIEWESMART/UEDX48480021-MD80ESP32-2.1inch-Touch-Knob-Display * - BOARD_VIEWE_UEDX48480040E_WB_A (UEDX48480040E-WB-A): https://viewedisplay.com/product/esp32-4-inch-tft-display-touch-screen-arduino-lvgl/ * - BOARD_VIEWE_UEDX80480043E_WB_A (UEDX80480043E-WB-A): https://viewedisplay.com/product/esp32-4-3-inch-800x480-rgb-ips-tft-display-touch-screen-arduino-lvgl/ + * - BOARD_VIEWE_UEDX80480050E_AC_A (UEDX80480050E-AC-A): https://viewedisplay.com/product/esp32-5-inch-800x480-rgb-ips-tft-display-touch-screen-arduino-lvgl/ * - BOARD_VIEWE_UEDX80480050E_WB_A (UEDX80480050E-WB-A): https://viewedisplay.com/product/esp32-5-inch-800x480-rgb-ips-tft-display-touch-screen-arduino-lvgl/ * - BOARD_VIEWE_UEDX80480050E_WB_A_2 (UEDX80480050E-WB-A): https://viewedisplay.com/product/esp32-5-inch-800x480-rgb-ips-tft-display-touch-screen-arduino-lvgl/ * - BOARD_VIEWE_UEDX80480070E_WB_A (UEDX80480070E-WB-A): https://viewedisplay.com/product/esp32-7-inch-800x480-rgb-ips-tft-display-touch-screen-arduino-lvgl-uart/ */ +// #define BOARD_VIEWE_SMARTRING +// #define BOARD_VIEWE_UEDX24240013_MD50E // #define BOARD_VIEWE_UEDX24320024E_WB_A // #define BOARD_VIEWE_UEDX24320028E_WB_A // #define BOARD_VIEWE_UEDX24320035E_WB_A // #define BOARD_VIEWE_UEDX32480035E_WB_A +// #define BOARD_VIEWE_UEDX46460015_MD50ET // #define BOARD_VIEWE_UEDX48270043E_WB_A +// #define BOARD_VIEWE_UEDX48480021_MD80E_V2 +// #define BOARD_VIEWE_UEDX48480021_MD80E +// #define BOARD_VIEWE_UEDX48480021_MD80ET +// #define BOARD_VIEWE_UEDX48480028_MD80ET // #define BOARD_VIEWE_UEDX48480040E_WB_A // #define BOARD_VIEWE_UEDX80480043E_WB_A +// #define BOARD_VIEWE_UEDX80480050E_AC_A // #define BOARD_VIEWE_UEDX80480050E_WB_A // #define BOARD_VIEWE_UEDX80480050E_WB_A_2 // #define BOARD_VIEWE_UEDX80480070E_WB_A @@ -156,7 +175,7 @@ * 3. Patch version mismatch: No impact on functionality */ #define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MAJOR 1 -#define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MINOR 0 +#define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MINOR 2 #define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_PATCH 0 #endif diff --git a/esp_panel_drivers_conf.h b/esp_panel_drivers_conf.h index fe0aecca..a1cef666 100644 --- a/esp_panel_drivers_conf.h +++ b/esp_panel_drivers_conf.h @@ -126,6 +126,7 @@ #define ESP_PANEL_DRIVERS_TOUCH_USE_AXS15231B (0) #define ESP_PANEL_DRIVERS_TOUCH_USE_CHSC6540 (0) #define ESP_PANEL_DRIVERS_TOUCH_USE_CST816S (0) + #define ESP_PANEL_DRIVERS_TOUCH_USE_CST820 (0) #define ESP_PANEL_DRIVERS_TOUCH_USE_FT5x06 (0) #define ESP_PANEL_DRIVERS_TOUCH_USE_GT911 (0) #define ESP_PANEL_DRIVERS_TOUCH_USE_GT1151 (0) @@ -260,7 +261,7 @@ * 3. Patch version mismatch: No impact on functionality */ #define ESP_PANEL_DRIVERS_CONF_FILE_VERSION_MAJOR 1 -#define ESP_PANEL_DRIVERS_CONF_FILE_VERSION_MINOR 0 +#define ESP_PANEL_DRIVERS_CONF_FILE_VERSION_MINOR 1 #define ESP_PANEL_DRIVERS_CONF_FILE_VERSION_PATCH 0 // *INDENT-ON* diff --git a/examples/arduino/board/board_dynamic_config/esp_panel_drivers_conf.h b/examples/arduino/board/board_dynamic_config/esp_panel_drivers_conf.h index bbf5d8b7..fbe4d5bf 100644 --- a/examples/arduino/board/board_dynamic_config/esp_panel_drivers_conf.h +++ b/examples/arduino/board/board_dynamic_config/esp_panel_drivers_conf.h @@ -126,6 +126,7 @@ #define ESP_PANEL_DRIVERS_TOUCH_USE_AXS15231B (0) #define ESP_PANEL_DRIVERS_TOUCH_USE_CHSC6540 (0) #define ESP_PANEL_DRIVERS_TOUCH_USE_CST816S (0) + #define ESP_PANEL_DRIVERS_TOUCH_USE_CST820 (0) #define ESP_PANEL_DRIVERS_TOUCH_USE_FT5x06 (0) #define ESP_PANEL_DRIVERS_TOUCH_USE_GT911 (0) #define ESP_PANEL_DRIVERS_TOUCH_USE_GT1151 (0) @@ -260,7 +261,7 @@ * 3. Patch version mismatch: No impact on functionality */ #define ESP_PANEL_DRIVERS_CONF_FILE_VERSION_MAJOR 1 -#define ESP_PANEL_DRIVERS_CONF_FILE_VERSION_MINOR 0 +#define ESP_PANEL_DRIVERS_CONF_FILE_VERSION_MINOR 1 #define ESP_PANEL_DRIVERS_CONF_FILE_VERSION_PATCH 0 // *INDENT-ON* diff --git a/examples/arduino/board/board_static_config/esp_panel_board_custom_conf.h b/examples/arduino/board/board_static_config/esp_panel_board_custom_conf.h index 3b65e300..b86014e0 100644 --- a/examples/arduino/board/board_static_config/esp_panel_board_custom_conf.h +++ b/examples/arduino/board/board_static_config/esp_panel_board_custom_conf.h @@ -162,8 +162,8 @@ #define ESP_PANEL_BOARD_LCD_RGB_SPI_SCL_USE_EXPNADER (0) // Set to 1 if the signal is controlled by an IO expander #define ESP_PANEL_BOARD_LCD_RGB_SPI_SDA_USE_EXPNADER (0) // Set to 1 if the signal is controlled by an IO expander #define ESP_PANEL_BOARD_LCD_RGB_SPI_MODE (0) // 0-3, typically set to 0 - #define ESP_PANEL_BOARD_LCD_RGB_SPI_CMD_BYTES (1) // Typically set to 8 - #define ESP_PANEL_BOARD_LCD_RGB_SPI_PARAM_BYTES (1) // Typically set to 8 + #define ESP_PANEL_BOARD_LCD_RGB_SPI_CMD_BYTES (1) // Typically set to 1 + #define ESP_PANEL_BOARD_LCD_RGB_SPI_PARAM_BYTES (1) // Typically set to 1 #define ESP_PANEL_BOARD_LCD_RGB_SPI_USE_DC_BIT (1) // 0/1. Typically set to 1 #endif // ESP_PANEL_BOARD_LCD_RGB_USE_CONTROL_PANEL /* For refresh panel (RGB) */ @@ -347,6 +347,7 @@ * - `AXS15231B` * - `CHSC6540` * - `CST816S` + * - `CST820` * - `FT5x06` * - `GT911`, `GT1151` * - `SPD2010` @@ -476,6 +477,22 @@ #define ESP_PANEL_BOARD_BACKLIGHT_IO (38) // Output GPIO pin number #define ESP_PANEL_BOARD_BACKLIGHT_ON_LEVEL (1) // Active level, 0: low, 1: high +#if ESP_PANEL_BOARD_BACKLIGHT_TYPE == ESP_PANEL_BACKLIGHT_TYPE_PWM_LEDC + /** + * @brief PWM parameters configuration + */ + #define ESP_PANEL_BOARD_BACKLIGHT_PWM_FREQ_HZ (5000) // LEDC timer frequency. + // Different backlight driver chips may have different + // frequency limits, please refer to the datasheet of + // the specific chip. + // https://github.com/esp-arduino-libs/ESP32_Display_Panel/issues/188 + + #define ESP_PANEL_BOARD_BACKLIGHT_PWM_DUTY_RESOLUTION (10) // LEDC timer duty resolution. + // The frequency and duty resolution of the LEDC timer + // need to be properly matched, please refer to: + // https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/ledc.html#supported-range-of-frequency-and-duty-resolutions +#endif + #elif ESP_PANEL_BOARD_BACKLIGHT_TYPE == ESP_PANEL_BACKLIGHT_TYPE_CUSTOM /** @@ -735,9 +752,9 @@ * 3. Patch version mismatch: No impact on functionality */ #define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MAJOR 1 -#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MINOR 0 +#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MINOR 2 #define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_PATCH 0 -#endif // ESP_PANEL_BOARD_USE_CUSTOM +#endif // ESP_PANEL_BOARD_DEFAULT_USE_CUSTOM // *INDENT-ON* diff --git a/examples/arduino/board/board_static_config/esp_panel_board_supported_conf.h b/examples/arduino/board/board_static_config/esp_panel_board_supported_conf.h index 3eb9292a..b25171bb 100644 --- a/examples/arduino/board/board_static_config/esp_panel_board_supported_conf.h +++ b/examples/arduino/board/board_static_config/esp_panel_board_supported_conf.h @@ -93,7 +93,9 @@ * Waveshare Supported Boards (https://www.waveshare.com/): * * -BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_1_85 (ESP32_S3_Touch_LCD_1_85): https://www.waveshare.com/esp32-s3-touch-lcd-1.85.htm + * -BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_1_85_C (ESP32_S3_Touch_LCD_1_85_C): https://www.waveshare.com/esp32-s3-touch-lcd-1.85c.htm * -BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_2_1 (ESP32_S3_Touch_LCD_2_1): https://www.waveshare.com/esp32-s3-touch-lcd-2.1.htm + * -BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_2_8_C (ESP32_S3_Touch_LCD_2_8_C): https://www.waveshare.com/esp32-s3-touch-lcd-2.8c.htm * -BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_4_3 (ESP32_S3_Touch_LCD_4_3): https://www.waveshare.com/esp32-s3-touch-lcd-4.3.htm * -BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_4_3_B (ESP32_S3_Touch_LCD_4_3_B): https://www.waveshare.com/esp32-s3-touch-lcd-4.3B.htm * -BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_5 (ESP32_S3_Touch_LCD_5): https://www.waveshare.com/esp32-s3-touch-lcd-5.htm?sku=28117 @@ -102,7 +104,9 @@ * -BOARD_WAVESHARE_ESP32_P4_NANO (ESP32_P4_NANO): https://www.waveshare.com/esp32-p4-nano.htm */ // #define BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_1_85 +// #define BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_1_85_C // #define BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_2_1 +// #define BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_2_8_C // #define BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_4_3 // #define BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_4_3_B // #define BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_5 @@ -123,24 +127,39 @@ * +------------------- Horizontal resolution: 240 * So UEDX24320024E means: 240x320 resolution & 2.4 inch display * + * - BOARD_VIEWE_SMARTRING (SMARTRING): https://github.com/VIEWESMART/VIEWE-SMARTRING + * - BOARD_VIEWE_UEDX24240013_MD50E (UEDX24240013-MD50E): https://github.com/VIEWESMART/UEDX24240013-MD50ESP32_1.3inch-Knob * - BOARD_VIEWE_UEDX24320024E_WB_A (UEDX24320024E-WB-A): https://viewedisplay.com/product/esp32-2-4-inch-240x320-rgb-ips-tft-display-touch-screen-arduino-lvgl-wifi-ble-uart-smart-module/ * - BOARD_VIEWE_UEDX24320028E_WB_A (UEDX24320028E-WB-A): https://viewedisplay.com/product/esp32-2-8-inch-240x320-mcu-ips-tft-display-touch-screen-arduino-lvgl-wifi-ble-uart-smart-module/ * - BOARD_VIEWE_UEDX24320035E_WB_A (UEDX24320035E-WB-A): https://viewedisplay.com/product/esp32-3-5-inch-240x320-mcu-ips-tft-display-touch-screen-arduino-lvgl-wifi-ble-uart-smart-module/ * - BOARD_VIEWE_UEDX32480035E_WB_A (UEDX32480035E-WB-A): https://github.com/VIEWESMART/Product-Specification-and-Schematic/blob/main/ESP32/3.5inch/320480/UEDX32480035E-WB-A%20SPEC.pdf + * - BOARD_VIEWE_UEDX46460015_MD50ET (UEDX46460015-MD50ET): https://github.com/VIEWESMART/UEDX46460015-MD50ESP32-1.5inch-Touch-Knob-Display * - BOARD_VIEWE_UEDX48270043E_WB_A (UEDX48270043E-WB-A): https://github.com/VIEWESMART/Product-Specification-and-Schematic/blob/main/ESP32/4.3inch/Low-Resolution_480272/UEDX48270043E-WB-A%20SPEC.pdf + * - BOARD_VIEWE_UEDX48480021_MD80E_V2 (UEDX48480021-MD80E(T)): https://github.com/VIEWESMART/UEDX48480021-MD80ESP32_2.1inch-Knob + * - BOARD_VIEWE_UEDX48480021_MD80E (UEDX48480021-MD80E): https://github.com/VIEWESMART/UEDX48480021-MD80ESP32_2.1inch-Knob + * - BOARD_VIEWE_UEDX48480021_MD80ET (UEDX48480021-MD80ET): https://github.com/VIEWESMART/UEDX48480021-MD80ESP32-2.1inch-Touch-Knob-Display * - BOARD_VIEWE_UEDX48480040E_WB_A (UEDX48480040E-WB-A): https://viewedisplay.com/product/esp32-4-inch-tft-display-touch-screen-arduino-lvgl/ * - BOARD_VIEWE_UEDX80480043E_WB_A (UEDX80480043E-WB-A): https://viewedisplay.com/product/esp32-4-3-inch-800x480-rgb-ips-tft-display-touch-screen-arduino-lvgl/ + * - BOARD_VIEWE_UEDX80480050E_AC_A (UEDX80480050E-AC-A): https://viewedisplay.com/product/esp32-5-inch-800x480-rgb-ips-tft-display-touch-screen-arduino-lvgl/ * - BOARD_VIEWE_UEDX80480050E_WB_A (UEDX80480050E-WB-A): https://viewedisplay.com/product/esp32-5-inch-800x480-rgb-ips-tft-display-touch-screen-arduino-lvgl/ * - BOARD_VIEWE_UEDX80480050E_WB_A_2 (UEDX80480050E-WB-A): https://viewedisplay.com/product/esp32-5-inch-800x480-rgb-ips-tft-display-touch-screen-arduino-lvgl/ * - BOARD_VIEWE_UEDX80480070E_WB_A (UEDX80480070E-WB-A): https://viewedisplay.com/product/esp32-7-inch-800x480-rgb-ips-tft-display-touch-screen-arduino-lvgl-uart/ */ +// #define BOARD_VIEWE_SMARTRING +// #define BOARD_VIEWE_UEDX24240013_MD50E // #define BOARD_VIEWE_UEDX24320024E_WB_A // #define BOARD_VIEWE_UEDX24320028E_WB_A // #define BOARD_VIEWE_UEDX24320035E_WB_A // #define BOARD_VIEWE_UEDX32480035E_WB_A +// #define BOARD_VIEWE_UEDX46460015_MD50ET // #define BOARD_VIEWE_UEDX48270043E_WB_A +// #define BOARD_VIEWE_UEDX48480021_MD80E_V2 +// #define BOARD_VIEWE_UEDX48480021_MD80E +// #define BOARD_VIEWE_UEDX48480021_MD80ET +// #define BOARD_VIEWE_UEDX48480028_MD80ET // #define BOARD_VIEWE_UEDX48480040E_WB_A // #define BOARD_VIEWE_UEDX80480043E_WB_A +// #define BOARD_VIEWE_UEDX80480050E_AC_A // #define BOARD_VIEWE_UEDX80480050E_WB_A // #define BOARD_VIEWE_UEDX80480050E_WB_A_2 // #define BOARD_VIEWE_UEDX80480070E_WB_A @@ -156,7 +175,7 @@ * 3. Patch version mismatch: No impact on functionality */ #define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MAJOR 1 -#define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MINOR 0 +#define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MINOR 2 #define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_PATCH 0 #endif diff --git a/examples/arduino/board/board_static_config/esp_panel_drivers_conf.h b/examples/arduino/board/board_static_config/esp_panel_drivers_conf.h index fe0aecca..a1cef666 100644 --- a/examples/arduino/board/board_static_config/esp_panel_drivers_conf.h +++ b/examples/arduino/board/board_static_config/esp_panel_drivers_conf.h @@ -126,6 +126,7 @@ #define ESP_PANEL_DRIVERS_TOUCH_USE_AXS15231B (0) #define ESP_PANEL_DRIVERS_TOUCH_USE_CHSC6540 (0) #define ESP_PANEL_DRIVERS_TOUCH_USE_CST816S (0) + #define ESP_PANEL_DRIVERS_TOUCH_USE_CST820 (0) #define ESP_PANEL_DRIVERS_TOUCH_USE_FT5x06 (0) #define ESP_PANEL_DRIVERS_TOUCH_USE_GT911 (0) #define ESP_PANEL_DRIVERS_TOUCH_USE_GT1151 (0) @@ -260,7 +261,7 @@ * 3. Patch version mismatch: No impact on functionality */ #define ESP_PANEL_DRIVERS_CONF_FILE_VERSION_MAJOR 1 -#define ESP_PANEL_DRIVERS_CONF_FILE_VERSION_MINOR 0 +#define ESP_PANEL_DRIVERS_CONF_FILE_VERSION_MINOR 1 #define ESP_PANEL_DRIVERS_CONF_FILE_VERSION_PATCH 0 // *INDENT-ON* diff --git a/examples/arduino/drivers/lcd/lcd_3wire_spi_rgb/esp_panel_drivers_conf.h b/examples/arduino/drivers/lcd/lcd_3wire_spi_rgb/esp_panel_drivers_conf.h index fe0aecca..a1cef666 100644 --- a/examples/arduino/drivers/lcd/lcd_3wire_spi_rgb/esp_panel_drivers_conf.h +++ b/examples/arduino/drivers/lcd/lcd_3wire_spi_rgb/esp_panel_drivers_conf.h @@ -126,6 +126,7 @@ #define ESP_PANEL_DRIVERS_TOUCH_USE_AXS15231B (0) #define ESP_PANEL_DRIVERS_TOUCH_USE_CHSC6540 (0) #define ESP_PANEL_DRIVERS_TOUCH_USE_CST816S (0) + #define ESP_PANEL_DRIVERS_TOUCH_USE_CST820 (0) #define ESP_PANEL_DRIVERS_TOUCH_USE_FT5x06 (0) #define ESP_PANEL_DRIVERS_TOUCH_USE_GT911 (0) #define ESP_PANEL_DRIVERS_TOUCH_USE_GT1151 (0) @@ -260,7 +261,7 @@ * 3. Patch version mismatch: No impact on functionality */ #define ESP_PANEL_DRIVERS_CONF_FILE_VERSION_MAJOR 1 -#define ESP_PANEL_DRIVERS_CONF_FILE_VERSION_MINOR 0 +#define ESP_PANEL_DRIVERS_CONF_FILE_VERSION_MINOR 1 #define ESP_PANEL_DRIVERS_CONF_FILE_VERSION_PATCH 0 // *INDENT-ON* diff --git a/examples/arduino/drivers/lcd/lcd_mipi_dsi/esp_panel_drivers_conf.h b/examples/arduino/drivers/lcd/lcd_mipi_dsi/esp_panel_drivers_conf.h index fe0aecca..a1cef666 100644 --- a/examples/arduino/drivers/lcd/lcd_mipi_dsi/esp_panel_drivers_conf.h +++ b/examples/arduino/drivers/lcd/lcd_mipi_dsi/esp_panel_drivers_conf.h @@ -126,6 +126,7 @@ #define ESP_PANEL_DRIVERS_TOUCH_USE_AXS15231B (0) #define ESP_PANEL_DRIVERS_TOUCH_USE_CHSC6540 (0) #define ESP_PANEL_DRIVERS_TOUCH_USE_CST816S (0) + #define ESP_PANEL_DRIVERS_TOUCH_USE_CST820 (0) #define ESP_PANEL_DRIVERS_TOUCH_USE_FT5x06 (0) #define ESP_PANEL_DRIVERS_TOUCH_USE_GT911 (0) #define ESP_PANEL_DRIVERS_TOUCH_USE_GT1151 (0) @@ -260,7 +261,7 @@ * 3. Patch version mismatch: No impact on functionality */ #define ESP_PANEL_DRIVERS_CONF_FILE_VERSION_MAJOR 1 -#define ESP_PANEL_DRIVERS_CONF_FILE_VERSION_MINOR 0 +#define ESP_PANEL_DRIVERS_CONF_FILE_VERSION_MINOR 1 #define ESP_PANEL_DRIVERS_CONF_FILE_VERSION_PATCH 0 // *INDENT-ON* diff --git a/examples/arduino/drivers/lcd/lcd_qspi/esp_panel_drivers_conf.h b/examples/arduino/drivers/lcd/lcd_qspi/esp_panel_drivers_conf.h index fe0aecca..a1cef666 100644 --- a/examples/arduino/drivers/lcd/lcd_qspi/esp_panel_drivers_conf.h +++ b/examples/arduino/drivers/lcd/lcd_qspi/esp_panel_drivers_conf.h @@ -126,6 +126,7 @@ #define ESP_PANEL_DRIVERS_TOUCH_USE_AXS15231B (0) #define ESP_PANEL_DRIVERS_TOUCH_USE_CHSC6540 (0) #define ESP_PANEL_DRIVERS_TOUCH_USE_CST816S (0) + #define ESP_PANEL_DRIVERS_TOUCH_USE_CST820 (0) #define ESP_PANEL_DRIVERS_TOUCH_USE_FT5x06 (0) #define ESP_PANEL_DRIVERS_TOUCH_USE_GT911 (0) #define ESP_PANEL_DRIVERS_TOUCH_USE_GT1151 (0) @@ -260,7 +261,7 @@ * 3. Patch version mismatch: No impact on functionality */ #define ESP_PANEL_DRIVERS_CONF_FILE_VERSION_MAJOR 1 -#define ESP_PANEL_DRIVERS_CONF_FILE_VERSION_MINOR 0 +#define ESP_PANEL_DRIVERS_CONF_FILE_VERSION_MINOR 1 #define ESP_PANEL_DRIVERS_CONF_FILE_VERSION_PATCH 0 // *INDENT-ON* diff --git a/examples/arduino/drivers/lcd/lcd_single_rgb/esp_panel_drivers_conf.h b/examples/arduino/drivers/lcd/lcd_single_rgb/esp_panel_drivers_conf.h index fe0aecca..a1cef666 100644 --- a/examples/arduino/drivers/lcd/lcd_single_rgb/esp_panel_drivers_conf.h +++ b/examples/arduino/drivers/lcd/lcd_single_rgb/esp_panel_drivers_conf.h @@ -126,6 +126,7 @@ #define ESP_PANEL_DRIVERS_TOUCH_USE_AXS15231B (0) #define ESP_PANEL_DRIVERS_TOUCH_USE_CHSC6540 (0) #define ESP_PANEL_DRIVERS_TOUCH_USE_CST816S (0) + #define ESP_PANEL_DRIVERS_TOUCH_USE_CST820 (0) #define ESP_PANEL_DRIVERS_TOUCH_USE_FT5x06 (0) #define ESP_PANEL_DRIVERS_TOUCH_USE_GT911 (0) #define ESP_PANEL_DRIVERS_TOUCH_USE_GT1151 (0) @@ -260,7 +261,7 @@ * 3. Patch version mismatch: No impact on functionality */ #define ESP_PANEL_DRIVERS_CONF_FILE_VERSION_MAJOR 1 -#define ESP_PANEL_DRIVERS_CONF_FILE_VERSION_MINOR 0 +#define ESP_PANEL_DRIVERS_CONF_FILE_VERSION_MINOR 1 #define ESP_PANEL_DRIVERS_CONF_FILE_VERSION_PATCH 0 // *INDENT-ON* diff --git a/examples/arduino/drivers/lcd/lcd_single_rgb/lcd_single_rgb.ino b/examples/arduino/drivers/lcd/lcd_single_rgb/lcd_single_rgb.ino index c530ee1e..f1af1b3d 100644 --- a/examples/arduino/drivers/lcd/lcd_single_rgb/lcd_single_rgb.ino +++ b/examples/arduino/drivers/lcd/lcd_single_rgb/lcd_single_rgb.ino @@ -13,8 +13,8 @@ using namespace esp_panel::drivers; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /** * Currently, the library supports the following RGB (without 3-wire SPI) LCDs: - * - ST7262 * - EK9716B + * - ST7262 */ #define EXAMPLE_LCD_NAME ST7262 #define EXAMPLE_LCD_WIDTH (800) diff --git a/examples/arduino/drivers/lcd/lcd_spi/esp_panel_drivers_conf.h b/examples/arduino/drivers/lcd/lcd_spi/esp_panel_drivers_conf.h index fe0aecca..a1cef666 100644 --- a/examples/arduino/drivers/lcd/lcd_spi/esp_panel_drivers_conf.h +++ b/examples/arduino/drivers/lcd/lcd_spi/esp_panel_drivers_conf.h @@ -126,6 +126,7 @@ #define ESP_PANEL_DRIVERS_TOUCH_USE_AXS15231B (0) #define ESP_PANEL_DRIVERS_TOUCH_USE_CHSC6540 (0) #define ESP_PANEL_DRIVERS_TOUCH_USE_CST816S (0) + #define ESP_PANEL_DRIVERS_TOUCH_USE_CST820 (0) #define ESP_PANEL_DRIVERS_TOUCH_USE_FT5x06 (0) #define ESP_PANEL_DRIVERS_TOUCH_USE_GT911 (0) #define ESP_PANEL_DRIVERS_TOUCH_USE_GT1151 (0) @@ -260,7 +261,7 @@ * 3. Patch version mismatch: No impact on functionality */ #define ESP_PANEL_DRIVERS_CONF_FILE_VERSION_MAJOR 1 -#define ESP_PANEL_DRIVERS_CONF_FILE_VERSION_MINOR 0 +#define ESP_PANEL_DRIVERS_CONF_FILE_VERSION_MINOR 1 #define ESP_PANEL_DRIVERS_CONF_FILE_VERSION_PATCH 0 // *INDENT-ON* diff --git a/examples/arduino/drivers/touch/touch_i2c/esp_panel_drivers_conf.h b/examples/arduino/drivers/touch/touch_i2c/esp_panel_drivers_conf.h index fe0aecca..a1cef666 100644 --- a/examples/arduino/drivers/touch/touch_i2c/esp_panel_drivers_conf.h +++ b/examples/arduino/drivers/touch/touch_i2c/esp_panel_drivers_conf.h @@ -126,6 +126,7 @@ #define ESP_PANEL_DRIVERS_TOUCH_USE_AXS15231B (0) #define ESP_PANEL_DRIVERS_TOUCH_USE_CHSC6540 (0) #define ESP_PANEL_DRIVERS_TOUCH_USE_CST816S (0) + #define ESP_PANEL_DRIVERS_TOUCH_USE_CST820 (0) #define ESP_PANEL_DRIVERS_TOUCH_USE_FT5x06 (0) #define ESP_PANEL_DRIVERS_TOUCH_USE_GT911 (0) #define ESP_PANEL_DRIVERS_TOUCH_USE_GT1151 (0) @@ -260,7 +261,7 @@ * 3. Patch version mismatch: No impact on functionality */ #define ESP_PANEL_DRIVERS_CONF_FILE_VERSION_MAJOR 1 -#define ESP_PANEL_DRIVERS_CONF_FILE_VERSION_MINOR 0 +#define ESP_PANEL_DRIVERS_CONF_FILE_VERSION_MINOR 1 #define ESP_PANEL_DRIVERS_CONF_FILE_VERSION_PATCH 0 // *INDENT-ON* diff --git a/examples/arduino/drivers/touch/touch_spi/esp_panel_drivers_conf.h b/examples/arduino/drivers/touch/touch_spi/esp_panel_drivers_conf.h index fe0aecca..a1cef666 100644 --- a/examples/arduino/drivers/touch/touch_spi/esp_panel_drivers_conf.h +++ b/examples/arduino/drivers/touch/touch_spi/esp_panel_drivers_conf.h @@ -126,6 +126,7 @@ #define ESP_PANEL_DRIVERS_TOUCH_USE_AXS15231B (0) #define ESP_PANEL_DRIVERS_TOUCH_USE_CHSC6540 (0) #define ESP_PANEL_DRIVERS_TOUCH_USE_CST816S (0) + #define ESP_PANEL_DRIVERS_TOUCH_USE_CST820 (0) #define ESP_PANEL_DRIVERS_TOUCH_USE_FT5x06 (0) #define ESP_PANEL_DRIVERS_TOUCH_USE_GT911 (0) #define ESP_PANEL_DRIVERS_TOUCH_USE_GT1151 (0) @@ -260,7 +261,7 @@ * 3. Patch version mismatch: No impact on functionality */ #define ESP_PANEL_DRIVERS_CONF_FILE_VERSION_MAJOR 1 -#define ESP_PANEL_DRIVERS_CONF_FILE_VERSION_MINOR 0 +#define ESP_PANEL_DRIVERS_CONF_FILE_VERSION_MINOR 1 #define ESP_PANEL_DRIVERS_CONF_FILE_VERSION_PATCH 0 // *INDENT-ON* diff --git a/examples/arduino/gui/lvgl_v8/simple_port/esp_panel_board_custom_conf.h b/examples/arduino/gui/lvgl_v8/simple_port/esp_panel_board_custom_conf.h index 3b65e300..b86014e0 100644 --- a/examples/arduino/gui/lvgl_v8/simple_port/esp_panel_board_custom_conf.h +++ b/examples/arduino/gui/lvgl_v8/simple_port/esp_panel_board_custom_conf.h @@ -162,8 +162,8 @@ #define ESP_PANEL_BOARD_LCD_RGB_SPI_SCL_USE_EXPNADER (0) // Set to 1 if the signal is controlled by an IO expander #define ESP_PANEL_BOARD_LCD_RGB_SPI_SDA_USE_EXPNADER (0) // Set to 1 if the signal is controlled by an IO expander #define ESP_PANEL_BOARD_LCD_RGB_SPI_MODE (0) // 0-3, typically set to 0 - #define ESP_PANEL_BOARD_LCD_RGB_SPI_CMD_BYTES (1) // Typically set to 8 - #define ESP_PANEL_BOARD_LCD_RGB_SPI_PARAM_BYTES (1) // Typically set to 8 + #define ESP_PANEL_BOARD_LCD_RGB_SPI_CMD_BYTES (1) // Typically set to 1 + #define ESP_PANEL_BOARD_LCD_RGB_SPI_PARAM_BYTES (1) // Typically set to 1 #define ESP_PANEL_BOARD_LCD_RGB_SPI_USE_DC_BIT (1) // 0/1. Typically set to 1 #endif // ESP_PANEL_BOARD_LCD_RGB_USE_CONTROL_PANEL /* For refresh panel (RGB) */ @@ -347,6 +347,7 @@ * - `AXS15231B` * - `CHSC6540` * - `CST816S` + * - `CST820` * - `FT5x06` * - `GT911`, `GT1151` * - `SPD2010` @@ -476,6 +477,22 @@ #define ESP_PANEL_BOARD_BACKLIGHT_IO (38) // Output GPIO pin number #define ESP_PANEL_BOARD_BACKLIGHT_ON_LEVEL (1) // Active level, 0: low, 1: high +#if ESP_PANEL_BOARD_BACKLIGHT_TYPE == ESP_PANEL_BACKLIGHT_TYPE_PWM_LEDC + /** + * @brief PWM parameters configuration + */ + #define ESP_PANEL_BOARD_BACKLIGHT_PWM_FREQ_HZ (5000) // LEDC timer frequency. + // Different backlight driver chips may have different + // frequency limits, please refer to the datasheet of + // the specific chip. + // https://github.com/esp-arduino-libs/ESP32_Display_Panel/issues/188 + + #define ESP_PANEL_BOARD_BACKLIGHT_PWM_DUTY_RESOLUTION (10) // LEDC timer duty resolution. + // The frequency and duty resolution of the LEDC timer + // need to be properly matched, please refer to: + // https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/ledc.html#supported-range-of-frequency-and-duty-resolutions +#endif + #elif ESP_PANEL_BOARD_BACKLIGHT_TYPE == ESP_PANEL_BACKLIGHT_TYPE_CUSTOM /** @@ -735,9 +752,9 @@ * 3. Patch version mismatch: No impact on functionality */ #define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MAJOR 1 -#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MINOR 0 +#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MINOR 2 #define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_PATCH 0 -#endif // ESP_PANEL_BOARD_USE_CUSTOM +#endif // ESP_PANEL_BOARD_DEFAULT_USE_CUSTOM // *INDENT-ON* diff --git a/examples/arduino/gui/lvgl_v8/simple_port/esp_panel_board_supported_conf.h b/examples/arduino/gui/lvgl_v8/simple_port/esp_panel_board_supported_conf.h index 3eb9292a..b25171bb 100644 --- a/examples/arduino/gui/lvgl_v8/simple_port/esp_panel_board_supported_conf.h +++ b/examples/arduino/gui/lvgl_v8/simple_port/esp_panel_board_supported_conf.h @@ -93,7 +93,9 @@ * Waveshare Supported Boards (https://www.waveshare.com/): * * -BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_1_85 (ESP32_S3_Touch_LCD_1_85): https://www.waveshare.com/esp32-s3-touch-lcd-1.85.htm + * -BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_1_85_C (ESP32_S3_Touch_LCD_1_85_C): https://www.waveshare.com/esp32-s3-touch-lcd-1.85c.htm * -BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_2_1 (ESP32_S3_Touch_LCD_2_1): https://www.waveshare.com/esp32-s3-touch-lcd-2.1.htm + * -BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_2_8_C (ESP32_S3_Touch_LCD_2_8_C): https://www.waveshare.com/esp32-s3-touch-lcd-2.8c.htm * -BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_4_3 (ESP32_S3_Touch_LCD_4_3): https://www.waveshare.com/esp32-s3-touch-lcd-4.3.htm * -BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_4_3_B (ESP32_S3_Touch_LCD_4_3_B): https://www.waveshare.com/esp32-s3-touch-lcd-4.3B.htm * -BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_5 (ESP32_S3_Touch_LCD_5): https://www.waveshare.com/esp32-s3-touch-lcd-5.htm?sku=28117 @@ -102,7 +104,9 @@ * -BOARD_WAVESHARE_ESP32_P4_NANO (ESP32_P4_NANO): https://www.waveshare.com/esp32-p4-nano.htm */ // #define BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_1_85 +// #define BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_1_85_C // #define BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_2_1 +// #define BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_2_8_C // #define BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_4_3 // #define BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_4_3_B // #define BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_5 @@ -123,24 +127,39 @@ * +------------------- Horizontal resolution: 240 * So UEDX24320024E means: 240x320 resolution & 2.4 inch display * + * - BOARD_VIEWE_SMARTRING (SMARTRING): https://github.com/VIEWESMART/VIEWE-SMARTRING + * - BOARD_VIEWE_UEDX24240013_MD50E (UEDX24240013-MD50E): https://github.com/VIEWESMART/UEDX24240013-MD50ESP32_1.3inch-Knob * - BOARD_VIEWE_UEDX24320024E_WB_A (UEDX24320024E-WB-A): https://viewedisplay.com/product/esp32-2-4-inch-240x320-rgb-ips-tft-display-touch-screen-arduino-lvgl-wifi-ble-uart-smart-module/ * - BOARD_VIEWE_UEDX24320028E_WB_A (UEDX24320028E-WB-A): https://viewedisplay.com/product/esp32-2-8-inch-240x320-mcu-ips-tft-display-touch-screen-arduino-lvgl-wifi-ble-uart-smart-module/ * - BOARD_VIEWE_UEDX24320035E_WB_A (UEDX24320035E-WB-A): https://viewedisplay.com/product/esp32-3-5-inch-240x320-mcu-ips-tft-display-touch-screen-arduino-lvgl-wifi-ble-uart-smart-module/ * - BOARD_VIEWE_UEDX32480035E_WB_A (UEDX32480035E-WB-A): https://github.com/VIEWESMART/Product-Specification-and-Schematic/blob/main/ESP32/3.5inch/320480/UEDX32480035E-WB-A%20SPEC.pdf + * - BOARD_VIEWE_UEDX46460015_MD50ET (UEDX46460015-MD50ET): https://github.com/VIEWESMART/UEDX46460015-MD50ESP32-1.5inch-Touch-Knob-Display * - BOARD_VIEWE_UEDX48270043E_WB_A (UEDX48270043E-WB-A): https://github.com/VIEWESMART/Product-Specification-and-Schematic/blob/main/ESP32/4.3inch/Low-Resolution_480272/UEDX48270043E-WB-A%20SPEC.pdf + * - BOARD_VIEWE_UEDX48480021_MD80E_V2 (UEDX48480021-MD80E(T)): https://github.com/VIEWESMART/UEDX48480021-MD80ESP32_2.1inch-Knob + * - BOARD_VIEWE_UEDX48480021_MD80E (UEDX48480021-MD80E): https://github.com/VIEWESMART/UEDX48480021-MD80ESP32_2.1inch-Knob + * - BOARD_VIEWE_UEDX48480021_MD80ET (UEDX48480021-MD80ET): https://github.com/VIEWESMART/UEDX48480021-MD80ESP32-2.1inch-Touch-Knob-Display * - BOARD_VIEWE_UEDX48480040E_WB_A (UEDX48480040E-WB-A): https://viewedisplay.com/product/esp32-4-inch-tft-display-touch-screen-arduino-lvgl/ * - BOARD_VIEWE_UEDX80480043E_WB_A (UEDX80480043E-WB-A): https://viewedisplay.com/product/esp32-4-3-inch-800x480-rgb-ips-tft-display-touch-screen-arduino-lvgl/ + * - BOARD_VIEWE_UEDX80480050E_AC_A (UEDX80480050E-AC-A): https://viewedisplay.com/product/esp32-5-inch-800x480-rgb-ips-tft-display-touch-screen-arduino-lvgl/ * - BOARD_VIEWE_UEDX80480050E_WB_A (UEDX80480050E-WB-A): https://viewedisplay.com/product/esp32-5-inch-800x480-rgb-ips-tft-display-touch-screen-arduino-lvgl/ * - BOARD_VIEWE_UEDX80480050E_WB_A_2 (UEDX80480050E-WB-A): https://viewedisplay.com/product/esp32-5-inch-800x480-rgb-ips-tft-display-touch-screen-arduino-lvgl/ * - BOARD_VIEWE_UEDX80480070E_WB_A (UEDX80480070E-WB-A): https://viewedisplay.com/product/esp32-7-inch-800x480-rgb-ips-tft-display-touch-screen-arduino-lvgl-uart/ */ +// #define BOARD_VIEWE_SMARTRING +// #define BOARD_VIEWE_UEDX24240013_MD50E // #define BOARD_VIEWE_UEDX24320024E_WB_A // #define BOARD_VIEWE_UEDX24320028E_WB_A // #define BOARD_VIEWE_UEDX24320035E_WB_A // #define BOARD_VIEWE_UEDX32480035E_WB_A +// #define BOARD_VIEWE_UEDX46460015_MD50ET // #define BOARD_VIEWE_UEDX48270043E_WB_A +// #define BOARD_VIEWE_UEDX48480021_MD80E_V2 +// #define BOARD_VIEWE_UEDX48480021_MD80E +// #define BOARD_VIEWE_UEDX48480021_MD80ET +// #define BOARD_VIEWE_UEDX48480028_MD80ET // #define BOARD_VIEWE_UEDX48480040E_WB_A // #define BOARD_VIEWE_UEDX80480043E_WB_A +// #define BOARD_VIEWE_UEDX80480050E_AC_A // #define BOARD_VIEWE_UEDX80480050E_WB_A // #define BOARD_VIEWE_UEDX80480050E_WB_A_2 // #define BOARD_VIEWE_UEDX80480070E_WB_A @@ -156,7 +175,7 @@ * 3. Patch version mismatch: No impact on functionality */ #define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MAJOR 1 -#define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MINOR 0 +#define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MINOR 2 #define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_PATCH 0 #endif diff --git a/examples/arduino/gui/lvgl_v8/simple_port/esp_panel_drivers_conf.h b/examples/arduino/gui/lvgl_v8/simple_port/esp_panel_drivers_conf.h index fe0aecca..a1cef666 100644 --- a/examples/arduino/gui/lvgl_v8/simple_port/esp_panel_drivers_conf.h +++ b/examples/arduino/gui/lvgl_v8/simple_port/esp_panel_drivers_conf.h @@ -126,6 +126,7 @@ #define ESP_PANEL_DRIVERS_TOUCH_USE_AXS15231B (0) #define ESP_PANEL_DRIVERS_TOUCH_USE_CHSC6540 (0) #define ESP_PANEL_DRIVERS_TOUCH_USE_CST816S (0) + #define ESP_PANEL_DRIVERS_TOUCH_USE_CST820 (0) #define ESP_PANEL_DRIVERS_TOUCH_USE_FT5x06 (0) #define ESP_PANEL_DRIVERS_TOUCH_USE_GT911 (0) #define ESP_PANEL_DRIVERS_TOUCH_USE_GT1151 (0) @@ -260,7 +261,7 @@ * 3. Patch version mismatch: No impact on functionality */ #define ESP_PANEL_DRIVERS_CONF_FILE_VERSION_MAJOR 1 -#define ESP_PANEL_DRIVERS_CONF_FILE_VERSION_MINOR 0 +#define ESP_PANEL_DRIVERS_CONF_FILE_VERSION_MINOR 1 #define ESP_PANEL_DRIVERS_CONF_FILE_VERSION_PATCH 0 // *INDENT-ON* diff --git a/examples/arduino/gui/lvgl_v8/simple_port/lv_conf.h b/examples/arduino/gui/lvgl_v8/simple_port/lv_conf.h index 57b48ac8..e27d5834 100644 --- a/examples/arduino/gui/lvgl_v8/simple_port/lv_conf.h +++ b/examples/arduino/gui/lvgl_v8/simple_port/lv_conf.h @@ -360,7 +360,7 @@ *===================*/ /*Montserrat fonts with ASCII range and some symbols using bpp = 4 - *https://fonts.google.com/specimen/Montserrat*/ + *https://fonts.google.com/specimen/Montserrat */ #define LV_FONT_MONTSERRAT_8 1 #define LV_FONT_MONTSERRAT_10 1 #define LV_FONT_MONTSERRAT_12 1 @@ -451,7 +451,7 @@ /*Support bidirectional texts. Allows mixing Left-to-Right and Right-to-Left texts. *The direction will be processed according to the Unicode Bidirectional Algorithm: - *https://www.w3.org/International/articles/inline-bidi-markup/uba-basics*/ + *https://www.w3.org/International/articles/inline-bidi-markup/uba-basics */ #define LV_USE_BIDI 0 #if LV_USE_BIDI /*Set the default direction. Supported values: @@ -469,7 +469,7 @@ * WIDGET USAGE *================*/ -/*Documentation of the widgets: https://docs.lvgl.io/latest/en/html/widgets/index.html*/ +/*Documentation of the widgets: https://docs.lvgl.io/latest/en/html/widgets/index.html */ #define LV_USE_ARC 1 diff --git a/examples/arduino/gui/lvgl_v8/simple_port/lvgl_v8_port.cpp b/examples/arduino/gui/lvgl_v8/simple_port/lvgl_v8_port.cpp index 8c6042f3..e9f71dca 100644 --- a/examples/arduino/gui/lvgl_v8/simple_port/lvgl_v8_port.cpp +++ b/examples/arduino/gui/lvgl_v8/simple_port/lvgl_v8_port.cpp @@ -4,6 +4,8 @@ * SPDX-License-Identifier: CC0-1.0 */ +#include "freertos/FreeRTOS.h" + #include "esp_timer.h" #undef ESP_UTILS_LOG_TAG #define ESP_UTILS_LOG_TAG "LvPort" @@ -638,10 +640,18 @@ static lv_disp_t *display_init(LCD *lcd) return lv_disp_drv_register(&disp_drv); } +static SemaphoreHandle_t touch_detected; + static void touchpad_read(lv_indev_drv_t *indev_drv, lv_indev_data_t *data) { Touch *tp = (Touch *)indev_drv->user_data; TouchPoint point; + data->state = LV_INDEV_STATE_RELEASED; + + /* if we are interrupt driven wait for the ISR to fire */ + if ( tp->isInterruptEnabled() && (xSemaphoreTake( touch_detected, 0 ) == pdFALSE) ) { + return; + } /* Read data from touch controller */ int read_touch_result = tp->readPoints(&point, 1, 0); @@ -649,11 +659,17 @@ static void touchpad_read(lv_indev_drv_t *indev_drv, lv_indev_data_t *data) data->point.x = point.x; data->point.y = point.y; data->state = LV_INDEV_STATE_PRESSED; - } else { - data->state = LV_INDEV_STATE_RELEASED; } } +static bool onTouchInterruptCallback(void *user_data) +{ + BaseType_t xHigherPriorityTaskWoken = pdFALSE; + xSemaphoreGiveFromISR( touch_detected, &xHigherPriorityTaskWoken ); + portYIELD_FROM_ISR( xHigherPriorityTaskWoken ); + return false; +} + static lv_indev_t *indev_init(Touch *tp) { ESP_UTILS_CHECK_FALSE_RETURN(tp != nullptr, nullptr, "Invalid touch device"); @@ -661,6 +677,10 @@ static lv_indev_t *indev_init(Touch *tp) static lv_indev_drv_t indev_drv_tp; + if (tp->isInterruptEnabled()) { + touch_detected = xSemaphoreCreateBinary(); + tp->attachInterruptCallback(onTouchInterruptCallback, tp); + } ESP_UTILS_LOGD("Register input driver to LVGL"); lv_indev_drv_init(&indev_drv_tp); indev_drv_tp.type = LV_INDEV_TYPE_POINTER; diff --git a/examples/arduino/gui/lvgl_v8/simple_rotation/esp_panel_board_custom_conf.h b/examples/arduino/gui/lvgl_v8/simple_rotation/esp_panel_board_custom_conf.h index 3b65e300..b86014e0 100644 --- a/examples/arduino/gui/lvgl_v8/simple_rotation/esp_panel_board_custom_conf.h +++ b/examples/arduino/gui/lvgl_v8/simple_rotation/esp_panel_board_custom_conf.h @@ -162,8 +162,8 @@ #define ESP_PANEL_BOARD_LCD_RGB_SPI_SCL_USE_EXPNADER (0) // Set to 1 if the signal is controlled by an IO expander #define ESP_PANEL_BOARD_LCD_RGB_SPI_SDA_USE_EXPNADER (0) // Set to 1 if the signal is controlled by an IO expander #define ESP_PANEL_BOARD_LCD_RGB_SPI_MODE (0) // 0-3, typically set to 0 - #define ESP_PANEL_BOARD_LCD_RGB_SPI_CMD_BYTES (1) // Typically set to 8 - #define ESP_PANEL_BOARD_LCD_RGB_SPI_PARAM_BYTES (1) // Typically set to 8 + #define ESP_PANEL_BOARD_LCD_RGB_SPI_CMD_BYTES (1) // Typically set to 1 + #define ESP_PANEL_BOARD_LCD_RGB_SPI_PARAM_BYTES (1) // Typically set to 1 #define ESP_PANEL_BOARD_LCD_RGB_SPI_USE_DC_BIT (1) // 0/1. Typically set to 1 #endif // ESP_PANEL_BOARD_LCD_RGB_USE_CONTROL_PANEL /* For refresh panel (RGB) */ @@ -347,6 +347,7 @@ * - `AXS15231B` * - `CHSC6540` * - `CST816S` + * - `CST820` * - `FT5x06` * - `GT911`, `GT1151` * - `SPD2010` @@ -476,6 +477,22 @@ #define ESP_PANEL_BOARD_BACKLIGHT_IO (38) // Output GPIO pin number #define ESP_PANEL_BOARD_BACKLIGHT_ON_LEVEL (1) // Active level, 0: low, 1: high +#if ESP_PANEL_BOARD_BACKLIGHT_TYPE == ESP_PANEL_BACKLIGHT_TYPE_PWM_LEDC + /** + * @brief PWM parameters configuration + */ + #define ESP_PANEL_BOARD_BACKLIGHT_PWM_FREQ_HZ (5000) // LEDC timer frequency. + // Different backlight driver chips may have different + // frequency limits, please refer to the datasheet of + // the specific chip. + // https://github.com/esp-arduino-libs/ESP32_Display_Panel/issues/188 + + #define ESP_PANEL_BOARD_BACKLIGHT_PWM_DUTY_RESOLUTION (10) // LEDC timer duty resolution. + // The frequency and duty resolution of the LEDC timer + // need to be properly matched, please refer to: + // https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/ledc.html#supported-range-of-frequency-and-duty-resolutions +#endif + #elif ESP_PANEL_BOARD_BACKLIGHT_TYPE == ESP_PANEL_BACKLIGHT_TYPE_CUSTOM /** @@ -735,9 +752,9 @@ * 3. Patch version mismatch: No impact on functionality */ #define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MAJOR 1 -#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MINOR 0 +#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MINOR 2 #define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_PATCH 0 -#endif // ESP_PANEL_BOARD_USE_CUSTOM +#endif // ESP_PANEL_BOARD_DEFAULT_USE_CUSTOM // *INDENT-ON* diff --git a/examples/arduino/gui/lvgl_v8/simple_rotation/esp_panel_board_supported_conf.h b/examples/arduino/gui/lvgl_v8/simple_rotation/esp_panel_board_supported_conf.h index 3eb9292a..b25171bb 100644 --- a/examples/arduino/gui/lvgl_v8/simple_rotation/esp_panel_board_supported_conf.h +++ b/examples/arduino/gui/lvgl_v8/simple_rotation/esp_panel_board_supported_conf.h @@ -93,7 +93,9 @@ * Waveshare Supported Boards (https://www.waveshare.com/): * * -BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_1_85 (ESP32_S3_Touch_LCD_1_85): https://www.waveshare.com/esp32-s3-touch-lcd-1.85.htm + * -BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_1_85_C (ESP32_S3_Touch_LCD_1_85_C): https://www.waveshare.com/esp32-s3-touch-lcd-1.85c.htm * -BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_2_1 (ESP32_S3_Touch_LCD_2_1): https://www.waveshare.com/esp32-s3-touch-lcd-2.1.htm + * -BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_2_8_C (ESP32_S3_Touch_LCD_2_8_C): https://www.waveshare.com/esp32-s3-touch-lcd-2.8c.htm * -BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_4_3 (ESP32_S3_Touch_LCD_4_3): https://www.waveshare.com/esp32-s3-touch-lcd-4.3.htm * -BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_4_3_B (ESP32_S3_Touch_LCD_4_3_B): https://www.waveshare.com/esp32-s3-touch-lcd-4.3B.htm * -BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_5 (ESP32_S3_Touch_LCD_5): https://www.waveshare.com/esp32-s3-touch-lcd-5.htm?sku=28117 @@ -102,7 +104,9 @@ * -BOARD_WAVESHARE_ESP32_P4_NANO (ESP32_P4_NANO): https://www.waveshare.com/esp32-p4-nano.htm */ // #define BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_1_85 +// #define BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_1_85_C // #define BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_2_1 +// #define BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_2_8_C // #define BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_4_3 // #define BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_4_3_B // #define BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_5 @@ -123,24 +127,39 @@ * +------------------- Horizontal resolution: 240 * So UEDX24320024E means: 240x320 resolution & 2.4 inch display * + * - BOARD_VIEWE_SMARTRING (SMARTRING): https://github.com/VIEWESMART/VIEWE-SMARTRING + * - BOARD_VIEWE_UEDX24240013_MD50E (UEDX24240013-MD50E): https://github.com/VIEWESMART/UEDX24240013-MD50ESP32_1.3inch-Knob * - BOARD_VIEWE_UEDX24320024E_WB_A (UEDX24320024E-WB-A): https://viewedisplay.com/product/esp32-2-4-inch-240x320-rgb-ips-tft-display-touch-screen-arduino-lvgl-wifi-ble-uart-smart-module/ * - BOARD_VIEWE_UEDX24320028E_WB_A (UEDX24320028E-WB-A): https://viewedisplay.com/product/esp32-2-8-inch-240x320-mcu-ips-tft-display-touch-screen-arduino-lvgl-wifi-ble-uart-smart-module/ * - BOARD_VIEWE_UEDX24320035E_WB_A (UEDX24320035E-WB-A): https://viewedisplay.com/product/esp32-3-5-inch-240x320-mcu-ips-tft-display-touch-screen-arduino-lvgl-wifi-ble-uart-smart-module/ * - BOARD_VIEWE_UEDX32480035E_WB_A (UEDX32480035E-WB-A): https://github.com/VIEWESMART/Product-Specification-and-Schematic/blob/main/ESP32/3.5inch/320480/UEDX32480035E-WB-A%20SPEC.pdf + * - BOARD_VIEWE_UEDX46460015_MD50ET (UEDX46460015-MD50ET): https://github.com/VIEWESMART/UEDX46460015-MD50ESP32-1.5inch-Touch-Knob-Display * - BOARD_VIEWE_UEDX48270043E_WB_A (UEDX48270043E-WB-A): https://github.com/VIEWESMART/Product-Specification-and-Schematic/blob/main/ESP32/4.3inch/Low-Resolution_480272/UEDX48270043E-WB-A%20SPEC.pdf + * - BOARD_VIEWE_UEDX48480021_MD80E_V2 (UEDX48480021-MD80E(T)): https://github.com/VIEWESMART/UEDX48480021-MD80ESP32_2.1inch-Knob + * - BOARD_VIEWE_UEDX48480021_MD80E (UEDX48480021-MD80E): https://github.com/VIEWESMART/UEDX48480021-MD80ESP32_2.1inch-Knob + * - BOARD_VIEWE_UEDX48480021_MD80ET (UEDX48480021-MD80ET): https://github.com/VIEWESMART/UEDX48480021-MD80ESP32-2.1inch-Touch-Knob-Display * - BOARD_VIEWE_UEDX48480040E_WB_A (UEDX48480040E-WB-A): https://viewedisplay.com/product/esp32-4-inch-tft-display-touch-screen-arduino-lvgl/ * - BOARD_VIEWE_UEDX80480043E_WB_A (UEDX80480043E-WB-A): https://viewedisplay.com/product/esp32-4-3-inch-800x480-rgb-ips-tft-display-touch-screen-arduino-lvgl/ + * - BOARD_VIEWE_UEDX80480050E_AC_A (UEDX80480050E-AC-A): https://viewedisplay.com/product/esp32-5-inch-800x480-rgb-ips-tft-display-touch-screen-arduino-lvgl/ * - BOARD_VIEWE_UEDX80480050E_WB_A (UEDX80480050E-WB-A): https://viewedisplay.com/product/esp32-5-inch-800x480-rgb-ips-tft-display-touch-screen-arduino-lvgl/ * - BOARD_VIEWE_UEDX80480050E_WB_A_2 (UEDX80480050E-WB-A): https://viewedisplay.com/product/esp32-5-inch-800x480-rgb-ips-tft-display-touch-screen-arduino-lvgl/ * - BOARD_VIEWE_UEDX80480070E_WB_A (UEDX80480070E-WB-A): https://viewedisplay.com/product/esp32-7-inch-800x480-rgb-ips-tft-display-touch-screen-arduino-lvgl-uart/ */ +// #define BOARD_VIEWE_SMARTRING +// #define BOARD_VIEWE_UEDX24240013_MD50E // #define BOARD_VIEWE_UEDX24320024E_WB_A // #define BOARD_VIEWE_UEDX24320028E_WB_A // #define BOARD_VIEWE_UEDX24320035E_WB_A // #define BOARD_VIEWE_UEDX32480035E_WB_A +// #define BOARD_VIEWE_UEDX46460015_MD50ET // #define BOARD_VIEWE_UEDX48270043E_WB_A +// #define BOARD_VIEWE_UEDX48480021_MD80E_V2 +// #define BOARD_VIEWE_UEDX48480021_MD80E +// #define BOARD_VIEWE_UEDX48480021_MD80ET +// #define BOARD_VIEWE_UEDX48480028_MD80ET // #define BOARD_VIEWE_UEDX48480040E_WB_A // #define BOARD_VIEWE_UEDX80480043E_WB_A +// #define BOARD_VIEWE_UEDX80480050E_AC_A // #define BOARD_VIEWE_UEDX80480050E_WB_A // #define BOARD_VIEWE_UEDX80480050E_WB_A_2 // #define BOARD_VIEWE_UEDX80480070E_WB_A @@ -156,7 +175,7 @@ * 3. Patch version mismatch: No impact on functionality */ #define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MAJOR 1 -#define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MINOR 0 +#define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MINOR 2 #define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_PATCH 0 #endif diff --git a/examples/arduino/gui/lvgl_v8/simple_rotation/esp_panel_drivers_conf.h b/examples/arduino/gui/lvgl_v8/simple_rotation/esp_panel_drivers_conf.h index fe0aecca..a1cef666 100644 --- a/examples/arduino/gui/lvgl_v8/simple_rotation/esp_panel_drivers_conf.h +++ b/examples/arduino/gui/lvgl_v8/simple_rotation/esp_panel_drivers_conf.h @@ -126,6 +126,7 @@ #define ESP_PANEL_DRIVERS_TOUCH_USE_AXS15231B (0) #define ESP_PANEL_DRIVERS_TOUCH_USE_CHSC6540 (0) #define ESP_PANEL_DRIVERS_TOUCH_USE_CST816S (0) + #define ESP_PANEL_DRIVERS_TOUCH_USE_CST820 (0) #define ESP_PANEL_DRIVERS_TOUCH_USE_FT5x06 (0) #define ESP_PANEL_DRIVERS_TOUCH_USE_GT911 (0) #define ESP_PANEL_DRIVERS_TOUCH_USE_GT1151 (0) @@ -260,7 +261,7 @@ * 3. Patch version mismatch: No impact on functionality */ #define ESP_PANEL_DRIVERS_CONF_FILE_VERSION_MAJOR 1 -#define ESP_PANEL_DRIVERS_CONF_FILE_VERSION_MINOR 0 +#define ESP_PANEL_DRIVERS_CONF_FILE_VERSION_MINOR 1 #define ESP_PANEL_DRIVERS_CONF_FILE_VERSION_PATCH 0 // *INDENT-ON* diff --git a/examples/arduino/gui/lvgl_v8/simple_rotation/lv_conf.h b/examples/arduino/gui/lvgl_v8/simple_rotation/lv_conf.h index 57b48ac8..e27d5834 100644 --- a/examples/arduino/gui/lvgl_v8/simple_rotation/lv_conf.h +++ b/examples/arduino/gui/lvgl_v8/simple_rotation/lv_conf.h @@ -360,7 +360,7 @@ *===================*/ /*Montserrat fonts with ASCII range and some symbols using bpp = 4 - *https://fonts.google.com/specimen/Montserrat*/ + *https://fonts.google.com/specimen/Montserrat */ #define LV_FONT_MONTSERRAT_8 1 #define LV_FONT_MONTSERRAT_10 1 #define LV_FONT_MONTSERRAT_12 1 @@ -451,7 +451,7 @@ /*Support bidirectional texts. Allows mixing Left-to-Right and Right-to-Left texts. *The direction will be processed according to the Unicode Bidirectional Algorithm: - *https://www.w3.org/International/articles/inline-bidi-markup/uba-basics*/ + *https://www.w3.org/International/articles/inline-bidi-markup/uba-basics */ #define LV_USE_BIDI 0 #if LV_USE_BIDI /*Set the default direction. Supported values: @@ -469,7 +469,7 @@ * WIDGET USAGE *================*/ -/*Documentation of the widgets: https://docs.lvgl.io/latest/en/html/widgets/index.html*/ +/*Documentation of the widgets: https://docs.lvgl.io/latest/en/html/widgets/index.html */ #define LV_USE_ARC 1 diff --git a/examples/arduino/gui/lvgl_v8/simple_rotation/lvgl_v8_port.cpp b/examples/arduino/gui/lvgl_v8/simple_rotation/lvgl_v8_port.cpp index 8c6042f3..e9f71dca 100644 --- a/examples/arduino/gui/lvgl_v8/simple_rotation/lvgl_v8_port.cpp +++ b/examples/arduino/gui/lvgl_v8/simple_rotation/lvgl_v8_port.cpp @@ -4,6 +4,8 @@ * SPDX-License-Identifier: CC0-1.0 */ +#include "freertos/FreeRTOS.h" + #include "esp_timer.h" #undef ESP_UTILS_LOG_TAG #define ESP_UTILS_LOG_TAG "LvPort" @@ -638,10 +640,18 @@ static lv_disp_t *display_init(LCD *lcd) return lv_disp_drv_register(&disp_drv); } +static SemaphoreHandle_t touch_detected; + static void touchpad_read(lv_indev_drv_t *indev_drv, lv_indev_data_t *data) { Touch *tp = (Touch *)indev_drv->user_data; TouchPoint point; + data->state = LV_INDEV_STATE_RELEASED; + + /* if we are interrupt driven wait for the ISR to fire */ + if ( tp->isInterruptEnabled() && (xSemaphoreTake( touch_detected, 0 ) == pdFALSE) ) { + return; + } /* Read data from touch controller */ int read_touch_result = tp->readPoints(&point, 1, 0); @@ -649,11 +659,17 @@ static void touchpad_read(lv_indev_drv_t *indev_drv, lv_indev_data_t *data) data->point.x = point.x; data->point.y = point.y; data->state = LV_INDEV_STATE_PRESSED; - } else { - data->state = LV_INDEV_STATE_RELEASED; } } +static bool onTouchInterruptCallback(void *user_data) +{ + BaseType_t xHigherPriorityTaskWoken = pdFALSE; + xSemaphoreGiveFromISR( touch_detected, &xHigherPriorityTaskWoken ); + portYIELD_FROM_ISR( xHigherPriorityTaskWoken ); + return false; +} + static lv_indev_t *indev_init(Touch *tp) { ESP_UTILS_CHECK_FALSE_RETURN(tp != nullptr, nullptr, "Invalid touch device"); @@ -661,6 +677,10 @@ static lv_indev_t *indev_init(Touch *tp) static lv_indev_drv_t indev_drv_tp; + if (tp->isInterruptEnabled()) { + touch_detected = xSemaphoreCreateBinary(); + tp->attachInterruptCallback(onTouchInterruptCallback, tp); + } ESP_UTILS_LOGD("Register input driver to LVGL"); lv_indev_drv_init(&indev_drv_tp); indev_drv_tp.type = LV_INDEV_TYPE_POINTER; diff --git a/examples/arduino/gui/lvgl_v8/squareline_port/esp_panel_board_custom_conf.h b/examples/arduino/gui/lvgl_v8/squareline_port/esp_panel_board_custom_conf.h index 3b65e300..b86014e0 100644 --- a/examples/arduino/gui/lvgl_v8/squareline_port/esp_panel_board_custom_conf.h +++ b/examples/arduino/gui/lvgl_v8/squareline_port/esp_panel_board_custom_conf.h @@ -162,8 +162,8 @@ #define ESP_PANEL_BOARD_LCD_RGB_SPI_SCL_USE_EXPNADER (0) // Set to 1 if the signal is controlled by an IO expander #define ESP_PANEL_BOARD_LCD_RGB_SPI_SDA_USE_EXPNADER (0) // Set to 1 if the signal is controlled by an IO expander #define ESP_PANEL_BOARD_LCD_RGB_SPI_MODE (0) // 0-3, typically set to 0 - #define ESP_PANEL_BOARD_LCD_RGB_SPI_CMD_BYTES (1) // Typically set to 8 - #define ESP_PANEL_BOARD_LCD_RGB_SPI_PARAM_BYTES (1) // Typically set to 8 + #define ESP_PANEL_BOARD_LCD_RGB_SPI_CMD_BYTES (1) // Typically set to 1 + #define ESP_PANEL_BOARD_LCD_RGB_SPI_PARAM_BYTES (1) // Typically set to 1 #define ESP_PANEL_BOARD_LCD_RGB_SPI_USE_DC_BIT (1) // 0/1. Typically set to 1 #endif // ESP_PANEL_BOARD_LCD_RGB_USE_CONTROL_PANEL /* For refresh panel (RGB) */ @@ -347,6 +347,7 @@ * - `AXS15231B` * - `CHSC6540` * - `CST816S` + * - `CST820` * - `FT5x06` * - `GT911`, `GT1151` * - `SPD2010` @@ -476,6 +477,22 @@ #define ESP_PANEL_BOARD_BACKLIGHT_IO (38) // Output GPIO pin number #define ESP_PANEL_BOARD_BACKLIGHT_ON_LEVEL (1) // Active level, 0: low, 1: high +#if ESP_PANEL_BOARD_BACKLIGHT_TYPE == ESP_PANEL_BACKLIGHT_TYPE_PWM_LEDC + /** + * @brief PWM parameters configuration + */ + #define ESP_PANEL_BOARD_BACKLIGHT_PWM_FREQ_HZ (5000) // LEDC timer frequency. + // Different backlight driver chips may have different + // frequency limits, please refer to the datasheet of + // the specific chip. + // https://github.com/esp-arduino-libs/ESP32_Display_Panel/issues/188 + + #define ESP_PANEL_BOARD_BACKLIGHT_PWM_DUTY_RESOLUTION (10) // LEDC timer duty resolution. + // The frequency and duty resolution of the LEDC timer + // need to be properly matched, please refer to: + // https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/ledc.html#supported-range-of-frequency-and-duty-resolutions +#endif + #elif ESP_PANEL_BOARD_BACKLIGHT_TYPE == ESP_PANEL_BACKLIGHT_TYPE_CUSTOM /** @@ -735,9 +752,9 @@ * 3. Patch version mismatch: No impact on functionality */ #define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MAJOR 1 -#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MINOR 0 +#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MINOR 2 #define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_PATCH 0 -#endif // ESP_PANEL_BOARD_USE_CUSTOM +#endif // ESP_PANEL_BOARD_DEFAULT_USE_CUSTOM // *INDENT-ON* diff --git a/examples/arduino/gui/lvgl_v8/squareline_port/esp_panel_board_supported_conf.h b/examples/arduino/gui/lvgl_v8/squareline_port/esp_panel_board_supported_conf.h index 3eb9292a..b25171bb 100644 --- a/examples/arduino/gui/lvgl_v8/squareline_port/esp_panel_board_supported_conf.h +++ b/examples/arduino/gui/lvgl_v8/squareline_port/esp_panel_board_supported_conf.h @@ -93,7 +93,9 @@ * Waveshare Supported Boards (https://www.waveshare.com/): * * -BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_1_85 (ESP32_S3_Touch_LCD_1_85): https://www.waveshare.com/esp32-s3-touch-lcd-1.85.htm + * -BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_1_85_C (ESP32_S3_Touch_LCD_1_85_C): https://www.waveshare.com/esp32-s3-touch-lcd-1.85c.htm * -BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_2_1 (ESP32_S3_Touch_LCD_2_1): https://www.waveshare.com/esp32-s3-touch-lcd-2.1.htm + * -BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_2_8_C (ESP32_S3_Touch_LCD_2_8_C): https://www.waveshare.com/esp32-s3-touch-lcd-2.8c.htm * -BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_4_3 (ESP32_S3_Touch_LCD_4_3): https://www.waveshare.com/esp32-s3-touch-lcd-4.3.htm * -BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_4_3_B (ESP32_S3_Touch_LCD_4_3_B): https://www.waveshare.com/esp32-s3-touch-lcd-4.3B.htm * -BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_5 (ESP32_S3_Touch_LCD_5): https://www.waveshare.com/esp32-s3-touch-lcd-5.htm?sku=28117 @@ -102,7 +104,9 @@ * -BOARD_WAVESHARE_ESP32_P4_NANO (ESP32_P4_NANO): https://www.waveshare.com/esp32-p4-nano.htm */ // #define BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_1_85 +// #define BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_1_85_C // #define BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_2_1 +// #define BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_2_8_C // #define BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_4_3 // #define BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_4_3_B // #define BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_5 @@ -123,24 +127,39 @@ * +------------------- Horizontal resolution: 240 * So UEDX24320024E means: 240x320 resolution & 2.4 inch display * + * - BOARD_VIEWE_SMARTRING (SMARTRING): https://github.com/VIEWESMART/VIEWE-SMARTRING + * - BOARD_VIEWE_UEDX24240013_MD50E (UEDX24240013-MD50E): https://github.com/VIEWESMART/UEDX24240013-MD50ESP32_1.3inch-Knob * - BOARD_VIEWE_UEDX24320024E_WB_A (UEDX24320024E-WB-A): https://viewedisplay.com/product/esp32-2-4-inch-240x320-rgb-ips-tft-display-touch-screen-arduino-lvgl-wifi-ble-uart-smart-module/ * - BOARD_VIEWE_UEDX24320028E_WB_A (UEDX24320028E-WB-A): https://viewedisplay.com/product/esp32-2-8-inch-240x320-mcu-ips-tft-display-touch-screen-arduino-lvgl-wifi-ble-uart-smart-module/ * - BOARD_VIEWE_UEDX24320035E_WB_A (UEDX24320035E-WB-A): https://viewedisplay.com/product/esp32-3-5-inch-240x320-mcu-ips-tft-display-touch-screen-arduino-lvgl-wifi-ble-uart-smart-module/ * - BOARD_VIEWE_UEDX32480035E_WB_A (UEDX32480035E-WB-A): https://github.com/VIEWESMART/Product-Specification-and-Schematic/blob/main/ESP32/3.5inch/320480/UEDX32480035E-WB-A%20SPEC.pdf + * - BOARD_VIEWE_UEDX46460015_MD50ET (UEDX46460015-MD50ET): https://github.com/VIEWESMART/UEDX46460015-MD50ESP32-1.5inch-Touch-Knob-Display * - BOARD_VIEWE_UEDX48270043E_WB_A (UEDX48270043E-WB-A): https://github.com/VIEWESMART/Product-Specification-and-Schematic/blob/main/ESP32/4.3inch/Low-Resolution_480272/UEDX48270043E-WB-A%20SPEC.pdf + * - BOARD_VIEWE_UEDX48480021_MD80E_V2 (UEDX48480021-MD80E(T)): https://github.com/VIEWESMART/UEDX48480021-MD80ESP32_2.1inch-Knob + * - BOARD_VIEWE_UEDX48480021_MD80E (UEDX48480021-MD80E): https://github.com/VIEWESMART/UEDX48480021-MD80ESP32_2.1inch-Knob + * - BOARD_VIEWE_UEDX48480021_MD80ET (UEDX48480021-MD80ET): https://github.com/VIEWESMART/UEDX48480021-MD80ESP32-2.1inch-Touch-Knob-Display * - BOARD_VIEWE_UEDX48480040E_WB_A (UEDX48480040E-WB-A): https://viewedisplay.com/product/esp32-4-inch-tft-display-touch-screen-arduino-lvgl/ * - BOARD_VIEWE_UEDX80480043E_WB_A (UEDX80480043E-WB-A): https://viewedisplay.com/product/esp32-4-3-inch-800x480-rgb-ips-tft-display-touch-screen-arduino-lvgl/ + * - BOARD_VIEWE_UEDX80480050E_AC_A (UEDX80480050E-AC-A): https://viewedisplay.com/product/esp32-5-inch-800x480-rgb-ips-tft-display-touch-screen-arduino-lvgl/ * - BOARD_VIEWE_UEDX80480050E_WB_A (UEDX80480050E-WB-A): https://viewedisplay.com/product/esp32-5-inch-800x480-rgb-ips-tft-display-touch-screen-arduino-lvgl/ * - BOARD_VIEWE_UEDX80480050E_WB_A_2 (UEDX80480050E-WB-A): https://viewedisplay.com/product/esp32-5-inch-800x480-rgb-ips-tft-display-touch-screen-arduino-lvgl/ * - BOARD_VIEWE_UEDX80480070E_WB_A (UEDX80480070E-WB-A): https://viewedisplay.com/product/esp32-7-inch-800x480-rgb-ips-tft-display-touch-screen-arduino-lvgl-uart/ */ +// #define BOARD_VIEWE_SMARTRING +// #define BOARD_VIEWE_UEDX24240013_MD50E // #define BOARD_VIEWE_UEDX24320024E_WB_A // #define BOARD_VIEWE_UEDX24320028E_WB_A // #define BOARD_VIEWE_UEDX24320035E_WB_A // #define BOARD_VIEWE_UEDX32480035E_WB_A +// #define BOARD_VIEWE_UEDX46460015_MD50ET // #define BOARD_VIEWE_UEDX48270043E_WB_A +// #define BOARD_VIEWE_UEDX48480021_MD80E_V2 +// #define BOARD_VIEWE_UEDX48480021_MD80E +// #define BOARD_VIEWE_UEDX48480021_MD80ET +// #define BOARD_VIEWE_UEDX48480028_MD80ET // #define BOARD_VIEWE_UEDX48480040E_WB_A // #define BOARD_VIEWE_UEDX80480043E_WB_A +// #define BOARD_VIEWE_UEDX80480050E_AC_A // #define BOARD_VIEWE_UEDX80480050E_WB_A // #define BOARD_VIEWE_UEDX80480050E_WB_A_2 // #define BOARD_VIEWE_UEDX80480070E_WB_A @@ -156,7 +175,7 @@ * 3. Patch version mismatch: No impact on functionality */ #define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MAJOR 1 -#define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MINOR 0 +#define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MINOR 2 #define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_PATCH 0 #endif diff --git a/examples/arduino/gui/lvgl_v8/squareline_port/esp_panel_drivers_conf.h b/examples/arduino/gui/lvgl_v8/squareline_port/esp_panel_drivers_conf.h index fe0aecca..a1cef666 100644 --- a/examples/arduino/gui/lvgl_v8/squareline_port/esp_panel_drivers_conf.h +++ b/examples/arduino/gui/lvgl_v8/squareline_port/esp_panel_drivers_conf.h @@ -126,6 +126,7 @@ #define ESP_PANEL_DRIVERS_TOUCH_USE_AXS15231B (0) #define ESP_PANEL_DRIVERS_TOUCH_USE_CHSC6540 (0) #define ESP_PANEL_DRIVERS_TOUCH_USE_CST816S (0) + #define ESP_PANEL_DRIVERS_TOUCH_USE_CST820 (0) #define ESP_PANEL_DRIVERS_TOUCH_USE_FT5x06 (0) #define ESP_PANEL_DRIVERS_TOUCH_USE_GT911 (0) #define ESP_PANEL_DRIVERS_TOUCH_USE_GT1151 (0) @@ -260,7 +261,7 @@ * 3. Patch version mismatch: No impact on functionality */ #define ESP_PANEL_DRIVERS_CONF_FILE_VERSION_MAJOR 1 -#define ESP_PANEL_DRIVERS_CONF_FILE_VERSION_MINOR 0 +#define ESP_PANEL_DRIVERS_CONF_FILE_VERSION_MINOR 1 #define ESP_PANEL_DRIVERS_CONF_FILE_VERSION_PATCH 0 // *INDENT-ON* diff --git a/examples/arduino/gui/lvgl_v8/squareline_port/lv_conf.h b/examples/arduino/gui/lvgl_v8/squareline_port/lv_conf.h index 57b48ac8..e27d5834 100644 --- a/examples/arduino/gui/lvgl_v8/squareline_port/lv_conf.h +++ b/examples/arduino/gui/lvgl_v8/squareline_port/lv_conf.h @@ -360,7 +360,7 @@ *===================*/ /*Montserrat fonts with ASCII range and some symbols using bpp = 4 - *https://fonts.google.com/specimen/Montserrat*/ + *https://fonts.google.com/specimen/Montserrat */ #define LV_FONT_MONTSERRAT_8 1 #define LV_FONT_MONTSERRAT_10 1 #define LV_FONT_MONTSERRAT_12 1 @@ -451,7 +451,7 @@ /*Support bidirectional texts. Allows mixing Left-to-Right and Right-to-Left texts. *The direction will be processed according to the Unicode Bidirectional Algorithm: - *https://www.w3.org/International/articles/inline-bidi-markup/uba-basics*/ + *https://www.w3.org/International/articles/inline-bidi-markup/uba-basics */ #define LV_USE_BIDI 0 #if LV_USE_BIDI /*Set the default direction. Supported values: @@ -469,7 +469,7 @@ * WIDGET USAGE *================*/ -/*Documentation of the widgets: https://docs.lvgl.io/latest/en/html/widgets/index.html*/ +/*Documentation of the widgets: https://docs.lvgl.io/latest/en/html/widgets/index.html */ #define LV_USE_ARC 1 diff --git a/examples/arduino/gui/lvgl_v8/squareline_port/lvgl_v8_port.cpp b/examples/arduino/gui/lvgl_v8/squareline_port/lvgl_v8_port.cpp index 8c6042f3..e9f71dca 100644 --- a/examples/arduino/gui/lvgl_v8/squareline_port/lvgl_v8_port.cpp +++ b/examples/arduino/gui/lvgl_v8/squareline_port/lvgl_v8_port.cpp @@ -4,6 +4,8 @@ * SPDX-License-Identifier: CC0-1.0 */ +#include "freertos/FreeRTOS.h" + #include "esp_timer.h" #undef ESP_UTILS_LOG_TAG #define ESP_UTILS_LOG_TAG "LvPort" @@ -638,10 +640,18 @@ static lv_disp_t *display_init(LCD *lcd) return lv_disp_drv_register(&disp_drv); } +static SemaphoreHandle_t touch_detected; + static void touchpad_read(lv_indev_drv_t *indev_drv, lv_indev_data_t *data) { Touch *tp = (Touch *)indev_drv->user_data; TouchPoint point; + data->state = LV_INDEV_STATE_RELEASED; + + /* if we are interrupt driven wait for the ISR to fire */ + if ( tp->isInterruptEnabled() && (xSemaphoreTake( touch_detected, 0 ) == pdFALSE) ) { + return; + } /* Read data from touch controller */ int read_touch_result = tp->readPoints(&point, 1, 0); @@ -649,11 +659,17 @@ static void touchpad_read(lv_indev_drv_t *indev_drv, lv_indev_data_t *data) data->point.x = point.x; data->point.y = point.y; data->state = LV_INDEV_STATE_PRESSED; - } else { - data->state = LV_INDEV_STATE_RELEASED; } } +static bool onTouchInterruptCallback(void *user_data) +{ + BaseType_t xHigherPriorityTaskWoken = pdFALSE; + xSemaphoreGiveFromISR( touch_detected, &xHigherPriorityTaskWoken ); + portYIELD_FROM_ISR( xHigherPriorityTaskWoken ); + return false; +} + static lv_indev_t *indev_init(Touch *tp) { ESP_UTILS_CHECK_FALSE_RETURN(tp != nullptr, nullptr, "Invalid touch device"); @@ -661,6 +677,10 @@ static lv_indev_t *indev_init(Touch *tp) static lv_indev_drv_t indev_drv_tp; + if (tp->isInterruptEnabled()) { + touch_detected = xSemaphoreCreateBinary(); + tp->attachInterruptCallback(onTouchInterruptCallback, tp); + } ESP_UTILS_LOGD("Register input driver to LVGL"); lv_indev_drv_init(&indev_drv_tp); indev_drv_tp.type = LV_INDEV_TYPE_POINTER; diff --git a/examples/arduino/gui/lvgl_v8/squareline_wifi_clock/esp_panel_board_custom_conf.h b/examples/arduino/gui/lvgl_v8/squareline_wifi_clock/esp_panel_board_custom_conf.h index 3b65e300..b86014e0 100644 --- a/examples/arduino/gui/lvgl_v8/squareline_wifi_clock/esp_panel_board_custom_conf.h +++ b/examples/arduino/gui/lvgl_v8/squareline_wifi_clock/esp_panel_board_custom_conf.h @@ -162,8 +162,8 @@ #define ESP_PANEL_BOARD_LCD_RGB_SPI_SCL_USE_EXPNADER (0) // Set to 1 if the signal is controlled by an IO expander #define ESP_PANEL_BOARD_LCD_RGB_SPI_SDA_USE_EXPNADER (0) // Set to 1 if the signal is controlled by an IO expander #define ESP_PANEL_BOARD_LCD_RGB_SPI_MODE (0) // 0-3, typically set to 0 - #define ESP_PANEL_BOARD_LCD_RGB_SPI_CMD_BYTES (1) // Typically set to 8 - #define ESP_PANEL_BOARD_LCD_RGB_SPI_PARAM_BYTES (1) // Typically set to 8 + #define ESP_PANEL_BOARD_LCD_RGB_SPI_CMD_BYTES (1) // Typically set to 1 + #define ESP_PANEL_BOARD_LCD_RGB_SPI_PARAM_BYTES (1) // Typically set to 1 #define ESP_PANEL_BOARD_LCD_RGB_SPI_USE_DC_BIT (1) // 0/1. Typically set to 1 #endif // ESP_PANEL_BOARD_LCD_RGB_USE_CONTROL_PANEL /* For refresh panel (RGB) */ @@ -347,6 +347,7 @@ * - `AXS15231B` * - `CHSC6540` * - `CST816S` + * - `CST820` * - `FT5x06` * - `GT911`, `GT1151` * - `SPD2010` @@ -476,6 +477,22 @@ #define ESP_PANEL_BOARD_BACKLIGHT_IO (38) // Output GPIO pin number #define ESP_PANEL_BOARD_BACKLIGHT_ON_LEVEL (1) // Active level, 0: low, 1: high +#if ESP_PANEL_BOARD_BACKLIGHT_TYPE == ESP_PANEL_BACKLIGHT_TYPE_PWM_LEDC + /** + * @brief PWM parameters configuration + */ + #define ESP_PANEL_BOARD_BACKLIGHT_PWM_FREQ_HZ (5000) // LEDC timer frequency. + // Different backlight driver chips may have different + // frequency limits, please refer to the datasheet of + // the specific chip. + // https://github.com/esp-arduino-libs/ESP32_Display_Panel/issues/188 + + #define ESP_PANEL_BOARD_BACKLIGHT_PWM_DUTY_RESOLUTION (10) // LEDC timer duty resolution. + // The frequency and duty resolution of the LEDC timer + // need to be properly matched, please refer to: + // https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/ledc.html#supported-range-of-frequency-and-duty-resolutions +#endif + #elif ESP_PANEL_BOARD_BACKLIGHT_TYPE == ESP_PANEL_BACKLIGHT_TYPE_CUSTOM /** @@ -735,9 +752,9 @@ * 3. Patch version mismatch: No impact on functionality */ #define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MAJOR 1 -#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MINOR 0 +#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MINOR 2 #define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_PATCH 0 -#endif // ESP_PANEL_BOARD_USE_CUSTOM +#endif // ESP_PANEL_BOARD_DEFAULT_USE_CUSTOM // *INDENT-ON* diff --git a/examples/arduino/gui/lvgl_v8/squareline_wifi_clock/esp_panel_board_supported_conf.h b/examples/arduino/gui/lvgl_v8/squareline_wifi_clock/esp_panel_board_supported_conf.h index 3eb9292a..b25171bb 100644 --- a/examples/arduino/gui/lvgl_v8/squareline_wifi_clock/esp_panel_board_supported_conf.h +++ b/examples/arduino/gui/lvgl_v8/squareline_wifi_clock/esp_panel_board_supported_conf.h @@ -93,7 +93,9 @@ * Waveshare Supported Boards (https://www.waveshare.com/): * * -BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_1_85 (ESP32_S3_Touch_LCD_1_85): https://www.waveshare.com/esp32-s3-touch-lcd-1.85.htm + * -BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_1_85_C (ESP32_S3_Touch_LCD_1_85_C): https://www.waveshare.com/esp32-s3-touch-lcd-1.85c.htm * -BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_2_1 (ESP32_S3_Touch_LCD_2_1): https://www.waveshare.com/esp32-s3-touch-lcd-2.1.htm + * -BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_2_8_C (ESP32_S3_Touch_LCD_2_8_C): https://www.waveshare.com/esp32-s3-touch-lcd-2.8c.htm * -BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_4_3 (ESP32_S3_Touch_LCD_4_3): https://www.waveshare.com/esp32-s3-touch-lcd-4.3.htm * -BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_4_3_B (ESP32_S3_Touch_LCD_4_3_B): https://www.waveshare.com/esp32-s3-touch-lcd-4.3B.htm * -BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_5 (ESP32_S3_Touch_LCD_5): https://www.waveshare.com/esp32-s3-touch-lcd-5.htm?sku=28117 @@ -102,7 +104,9 @@ * -BOARD_WAVESHARE_ESP32_P4_NANO (ESP32_P4_NANO): https://www.waveshare.com/esp32-p4-nano.htm */ // #define BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_1_85 +// #define BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_1_85_C // #define BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_2_1 +// #define BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_2_8_C // #define BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_4_3 // #define BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_4_3_B // #define BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_5 @@ -123,24 +127,39 @@ * +------------------- Horizontal resolution: 240 * So UEDX24320024E means: 240x320 resolution & 2.4 inch display * + * - BOARD_VIEWE_SMARTRING (SMARTRING): https://github.com/VIEWESMART/VIEWE-SMARTRING + * - BOARD_VIEWE_UEDX24240013_MD50E (UEDX24240013-MD50E): https://github.com/VIEWESMART/UEDX24240013-MD50ESP32_1.3inch-Knob * - BOARD_VIEWE_UEDX24320024E_WB_A (UEDX24320024E-WB-A): https://viewedisplay.com/product/esp32-2-4-inch-240x320-rgb-ips-tft-display-touch-screen-arduino-lvgl-wifi-ble-uart-smart-module/ * - BOARD_VIEWE_UEDX24320028E_WB_A (UEDX24320028E-WB-A): https://viewedisplay.com/product/esp32-2-8-inch-240x320-mcu-ips-tft-display-touch-screen-arduino-lvgl-wifi-ble-uart-smart-module/ * - BOARD_VIEWE_UEDX24320035E_WB_A (UEDX24320035E-WB-A): https://viewedisplay.com/product/esp32-3-5-inch-240x320-mcu-ips-tft-display-touch-screen-arduino-lvgl-wifi-ble-uart-smart-module/ * - BOARD_VIEWE_UEDX32480035E_WB_A (UEDX32480035E-WB-A): https://github.com/VIEWESMART/Product-Specification-and-Schematic/blob/main/ESP32/3.5inch/320480/UEDX32480035E-WB-A%20SPEC.pdf + * - BOARD_VIEWE_UEDX46460015_MD50ET (UEDX46460015-MD50ET): https://github.com/VIEWESMART/UEDX46460015-MD50ESP32-1.5inch-Touch-Knob-Display * - BOARD_VIEWE_UEDX48270043E_WB_A (UEDX48270043E-WB-A): https://github.com/VIEWESMART/Product-Specification-and-Schematic/blob/main/ESP32/4.3inch/Low-Resolution_480272/UEDX48270043E-WB-A%20SPEC.pdf + * - BOARD_VIEWE_UEDX48480021_MD80E_V2 (UEDX48480021-MD80E(T)): https://github.com/VIEWESMART/UEDX48480021-MD80ESP32_2.1inch-Knob + * - BOARD_VIEWE_UEDX48480021_MD80E (UEDX48480021-MD80E): https://github.com/VIEWESMART/UEDX48480021-MD80ESP32_2.1inch-Knob + * - BOARD_VIEWE_UEDX48480021_MD80ET (UEDX48480021-MD80ET): https://github.com/VIEWESMART/UEDX48480021-MD80ESP32-2.1inch-Touch-Knob-Display * - BOARD_VIEWE_UEDX48480040E_WB_A (UEDX48480040E-WB-A): https://viewedisplay.com/product/esp32-4-inch-tft-display-touch-screen-arduino-lvgl/ * - BOARD_VIEWE_UEDX80480043E_WB_A (UEDX80480043E-WB-A): https://viewedisplay.com/product/esp32-4-3-inch-800x480-rgb-ips-tft-display-touch-screen-arduino-lvgl/ + * - BOARD_VIEWE_UEDX80480050E_AC_A (UEDX80480050E-AC-A): https://viewedisplay.com/product/esp32-5-inch-800x480-rgb-ips-tft-display-touch-screen-arduino-lvgl/ * - BOARD_VIEWE_UEDX80480050E_WB_A (UEDX80480050E-WB-A): https://viewedisplay.com/product/esp32-5-inch-800x480-rgb-ips-tft-display-touch-screen-arduino-lvgl/ * - BOARD_VIEWE_UEDX80480050E_WB_A_2 (UEDX80480050E-WB-A): https://viewedisplay.com/product/esp32-5-inch-800x480-rgb-ips-tft-display-touch-screen-arduino-lvgl/ * - BOARD_VIEWE_UEDX80480070E_WB_A (UEDX80480070E-WB-A): https://viewedisplay.com/product/esp32-7-inch-800x480-rgb-ips-tft-display-touch-screen-arduino-lvgl-uart/ */ +// #define BOARD_VIEWE_SMARTRING +// #define BOARD_VIEWE_UEDX24240013_MD50E // #define BOARD_VIEWE_UEDX24320024E_WB_A // #define BOARD_VIEWE_UEDX24320028E_WB_A // #define BOARD_VIEWE_UEDX24320035E_WB_A // #define BOARD_VIEWE_UEDX32480035E_WB_A +// #define BOARD_VIEWE_UEDX46460015_MD50ET // #define BOARD_VIEWE_UEDX48270043E_WB_A +// #define BOARD_VIEWE_UEDX48480021_MD80E_V2 +// #define BOARD_VIEWE_UEDX48480021_MD80E +// #define BOARD_VIEWE_UEDX48480021_MD80ET +// #define BOARD_VIEWE_UEDX48480028_MD80ET // #define BOARD_VIEWE_UEDX48480040E_WB_A // #define BOARD_VIEWE_UEDX80480043E_WB_A +// #define BOARD_VIEWE_UEDX80480050E_AC_A // #define BOARD_VIEWE_UEDX80480050E_WB_A // #define BOARD_VIEWE_UEDX80480050E_WB_A_2 // #define BOARD_VIEWE_UEDX80480070E_WB_A @@ -156,7 +175,7 @@ * 3. Patch version mismatch: No impact on functionality */ #define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MAJOR 1 -#define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MINOR 0 +#define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MINOR 2 #define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_PATCH 0 #endif diff --git a/examples/arduino/gui/lvgl_v8/squareline_wifi_clock/esp_panel_drivers_conf.h b/examples/arduino/gui/lvgl_v8/squareline_wifi_clock/esp_panel_drivers_conf.h index fe0aecca..a1cef666 100644 --- a/examples/arduino/gui/lvgl_v8/squareline_wifi_clock/esp_panel_drivers_conf.h +++ b/examples/arduino/gui/lvgl_v8/squareline_wifi_clock/esp_panel_drivers_conf.h @@ -126,6 +126,7 @@ #define ESP_PANEL_DRIVERS_TOUCH_USE_AXS15231B (0) #define ESP_PANEL_DRIVERS_TOUCH_USE_CHSC6540 (0) #define ESP_PANEL_DRIVERS_TOUCH_USE_CST816S (0) + #define ESP_PANEL_DRIVERS_TOUCH_USE_CST820 (0) #define ESP_PANEL_DRIVERS_TOUCH_USE_FT5x06 (0) #define ESP_PANEL_DRIVERS_TOUCH_USE_GT911 (0) #define ESP_PANEL_DRIVERS_TOUCH_USE_GT1151 (0) @@ -260,7 +261,7 @@ * 3. Patch version mismatch: No impact on functionality */ #define ESP_PANEL_DRIVERS_CONF_FILE_VERSION_MAJOR 1 -#define ESP_PANEL_DRIVERS_CONF_FILE_VERSION_MINOR 0 +#define ESP_PANEL_DRIVERS_CONF_FILE_VERSION_MINOR 1 #define ESP_PANEL_DRIVERS_CONF_FILE_VERSION_PATCH 0 // *INDENT-ON* diff --git a/examples/arduino/gui/lvgl_v8/squareline_wifi_clock/lv_conf.h b/examples/arduino/gui/lvgl_v8/squareline_wifi_clock/lv_conf.h index 57b48ac8..e27d5834 100644 --- a/examples/arduino/gui/lvgl_v8/squareline_wifi_clock/lv_conf.h +++ b/examples/arduino/gui/lvgl_v8/squareline_wifi_clock/lv_conf.h @@ -360,7 +360,7 @@ *===================*/ /*Montserrat fonts with ASCII range and some symbols using bpp = 4 - *https://fonts.google.com/specimen/Montserrat*/ + *https://fonts.google.com/specimen/Montserrat */ #define LV_FONT_MONTSERRAT_8 1 #define LV_FONT_MONTSERRAT_10 1 #define LV_FONT_MONTSERRAT_12 1 @@ -451,7 +451,7 @@ /*Support bidirectional texts. Allows mixing Left-to-Right and Right-to-Left texts. *The direction will be processed according to the Unicode Bidirectional Algorithm: - *https://www.w3.org/International/articles/inline-bidi-markup/uba-basics*/ + *https://www.w3.org/International/articles/inline-bidi-markup/uba-basics */ #define LV_USE_BIDI 0 #if LV_USE_BIDI /*Set the default direction. Supported values: @@ -469,7 +469,7 @@ * WIDGET USAGE *================*/ -/*Documentation of the widgets: https://docs.lvgl.io/latest/en/html/widgets/index.html*/ +/*Documentation of the widgets: https://docs.lvgl.io/latest/en/html/widgets/index.html */ #define LV_USE_ARC 1 diff --git a/examples/arduino/gui/lvgl_v8/squareline_wifi_clock/lvgl_v8_port.cpp b/examples/arduino/gui/lvgl_v8/squareline_wifi_clock/lvgl_v8_port.cpp index 8c6042f3..e9f71dca 100644 --- a/examples/arduino/gui/lvgl_v8/squareline_wifi_clock/lvgl_v8_port.cpp +++ b/examples/arduino/gui/lvgl_v8/squareline_wifi_clock/lvgl_v8_port.cpp @@ -4,6 +4,8 @@ * SPDX-License-Identifier: CC0-1.0 */ +#include "freertos/FreeRTOS.h" + #include "esp_timer.h" #undef ESP_UTILS_LOG_TAG #define ESP_UTILS_LOG_TAG "LvPort" @@ -638,10 +640,18 @@ static lv_disp_t *display_init(LCD *lcd) return lv_disp_drv_register(&disp_drv); } +static SemaphoreHandle_t touch_detected; + static void touchpad_read(lv_indev_drv_t *indev_drv, lv_indev_data_t *data) { Touch *tp = (Touch *)indev_drv->user_data; TouchPoint point; + data->state = LV_INDEV_STATE_RELEASED; + + /* if we are interrupt driven wait for the ISR to fire */ + if ( tp->isInterruptEnabled() && (xSemaphoreTake( touch_detected, 0 ) == pdFALSE) ) { + return; + } /* Read data from touch controller */ int read_touch_result = tp->readPoints(&point, 1, 0); @@ -649,11 +659,17 @@ static void touchpad_read(lv_indev_drv_t *indev_drv, lv_indev_data_t *data) data->point.x = point.x; data->point.y = point.y; data->state = LV_INDEV_STATE_PRESSED; - } else { - data->state = LV_INDEV_STATE_RELEASED; } } +static bool onTouchInterruptCallback(void *user_data) +{ + BaseType_t xHigherPriorityTaskWoken = pdFALSE; + xSemaphoreGiveFromISR( touch_detected, &xHigherPriorityTaskWoken ); + portYIELD_FROM_ISR( xHigherPriorityTaskWoken ); + return false; +} + static lv_indev_t *indev_init(Touch *tp) { ESP_UTILS_CHECK_FALSE_RETURN(tp != nullptr, nullptr, "Invalid touch device"); @@ -661,6 +677,10 @@ static lv_indev_t *indev_init(Touch *tp) static lv_indev_drv_t indev_drv_tp; + if (tp->isInterruptEnabled()) { + touch_detected = xSemaphoreCreateBinary(); + tp->attachInterruptCallback(onTouchInterruptCallback, tp); + } ESP_UTILS_LOGD("Register input driver to LVGL"); lv_indev_drv_init(&indev_drv_tp); indev_drv_tp.type = LV_INDEV_TYPE_POINTER; diff --git a/examples/esp_idf/lvgl_v8_port/main/lvgl_v8_port.cpp b/examples/esp_idf/lvgl_v8_port/main/lvgl_v8_port.cpp index 8c6042f3..e9f71dca 100644 --- a/examples/esp_idf/lvgl_v8_port/main/lvgl_v8_port.cpp +++ b/examples/esp_idf/lvgl_v8_port/main/lvgl_v8_port.cpp @@ -4,6 +4,8 @@ * SPDX-License-Identifier: CC0-1.0 */ +#include "freertos/FreeRTOS.h" + #include "esp_timer.h" #undef ESP_UTILS_LOG_TAG #define ESP_UTILS_LOG_TAG "LvPort" @@ -638,10 +640,18 @@ static lv_disp_t *display_init(LCD *lcd) return lv_disp_drv_register(&disp_drv); } +static SemaphoreHandle_t touch_detected; + static void touchpad_read(lv_indev_drv_t *indev_drv, lv_indev_data_t *data) { Touch *tp = (Touch *)indev_drv->user_data; TouchPoint point; + data->state = LV_INDEV_STATE_RELEASED; + + /* if we are interrupt driven wait for the ISR to fire */ + if ( tp->isInterruptEnabled() && (xSemaphoreTake( touch_detected, 0 ) == pdFALSE) ) { + return; + } /* Read data from touch controller */ int read_touch_result = tp->readPoints(&point, 1, 0); @@ -649,11 +659,17 @@ static void touchpad_read(lv_indev_drv_t *indev_drv, lv_indev_data_t *data) data->point.x = point.x; data->point.y = point.y; data->state = LV_INDEV_STATE_PRESSED; - } else { - data->state = LV_INDEV_STATE_RELEASED; } } +static bool onTouchInterruptCallback(void *user_data) +{ + BaseType_t xHigherPriorityTaskWoken = pdFALSE; + xSemaphoreGiveFromISR( touch_detected, &xHigherPriorityTaskWoken ); + portYIELD_FROM_ISR( xHigherPriorityTaskWoken ); + return false; +} + static lv_indev_t *indev_init(Touch *tp) { ESP_UTILS_CHECK_FALSE_RETURN(tp != nullptr, nullptr, "Invalid touch device"); @@ -661,6 +677,10 @@ static lv_indev_t *indev_init(Touch *tp) static lv_indev_drv_t indev_drv_tp; + if (tp->isInterruptEnabled()) { + touch_detected = xSemaphoreCreateBinary(); + tp->attachInterruptCallback(onTouchInterruptCallback, tp); + } ESP_UTILS_LOGD("Register input driver to LVGL"); lv_indev_drv_init(&indev_drv_tp); indev_drv_tp.type = LV_INDEV_TYPE_POINTER; diff --git a/examples/esp_idf/lvgl_v8_port/main/main.cpp b/examples/esp_idf/lvgl_v8_port/main/main.cpp index b5b734a6..6e822257 100644 --- a/examples/esp_idf/lvgl_v8_port/main/main.cpp +++ b/examples/esp_idf/lvgl_v8_port/main/main.cpp @@ -11,10 +11,21 @@ #include "lvgl_v8_port.h" #include "lv_demos.h" +#define EXAMPLE_LCD_USE_EXTERNAL_INIT_CMD (0) + using namespace esp_panel::drivers; using namespace esp_panel::board; static const char *TAG = "example"; +#if EXAMPLE_LCD_USE_EXTERNAL_INIT_CMD +static const esp_panel_lcd_vendor_init_cmd_t external_init_cmd[] = { +// {cmd, { data }, data_size, delay_ms} + // {0xFF, (uint8_t []){0x77, 0x01, 0x00, 0x00, 0x13}, 5, 0}, + // {0xEF, (uint8_t []){0x08}, 1, 0}, + // {0xFF, (uint8_t []){0x77, 0x01, 0x00, 0x00, 0x10}, 5, 0}, + // ... +}; +#endif // EXAMPLE_LCD_USE_EXTERNAL_INIT_CMD extern "C" void app_main() { @@ -23,22 +34,41 @@ extern "C" void app_main() ESP_LOGI(TAG, "Initializing board"); ESP_UTILS_CHECK_FALSE_EXIT(board->init(), "Board init failed"); + #if LVGL_PORT_AVOID_TEARING_MODE - auto lcd = board->getLCD(); - // When avoid tearing function is enabled, the frame buffer number should be set in the board driver - lcd->configFrameBufferNumber(LVGL_PORT_DISP_BUFFER_NUM); -#if ESP_PANEL_DRIVERS_BUS_ENABLE_RGB && CONFIG_IDF_TARGET_ESP32S3 - auto lcd_bus = lcd->getBus(); + { + auto lcd = board->getLCD(); + // When avoid tearing function is enabled, the frame buffer number should be set in the board driver + lcd->configFrameBufferNumber(LVGL_PORT_DISP_BUFFER_NUM); +# if ESP_PANEL_DRIVERS_BUS_ENABLE_RGB && CONFIG_IDF_TARGET_ESP32S3 + auto lcd_bus = lcd->getBus(); + /** + * As the anti-tearing feature typically consumes more PSRAM bandwidth, for the ESP32-S3, we need to utilize the + * "bounce buffer" functionality to enhance the RGB data bandwidth. + * This feature will consume `bounce_buffer_size * bytes_per_pixel * 2` of SRAM memory. + */ + if (lcd_bus->getBasicAttributes().type == ESP_PANEL_BUS_TYPE_RGB) { + static_cast(lcd_bus)->configRGB_BounceBufferSize(lcd->getFrameWidth() * 10); + } +# endif + } +#endif // LVGL_PORT_AVOID_TEARING_MODE + +#if EXAMPLE_LCD_USE_EXTERNAL_INIT_CMD + ESP_LOGI(TAG, "Using external LCD init command"); + { + auto lcd = board->getLCD(); + ESP_UTILS_CHECK_FALSE_EXIT( + lcd->configVendorCommands(external_init_cmd, sizeof(external_init_cmd) / sizeof(external_init_cmd[0])), + "LCD init failed" + ); + } /** - * As the anti-tearing feature typically consumes more PSRAM bandwidth, for the ESP32-S3, we need to utilize the - * "bounce buffer" functionality to enhance the RGB data bandwidth. - * This feature will consume `bounce_buffer_size * bytes_per_pixel * 2` of SRAM memory. + * In addition, you can also get handles to any other devices (like touch) and use `config*()` functions to + * configure or replace default parameters, but this must be completed before `board->begin()` */ - if (lcd_bus->getBasicAttributes().type == ESP_PANEL_BUS_TYPE_RGB) { - static_cast(lcd_bus)->configRGB_BounceBufferSize(lcd->getFrameWidth() * 10); - } -#endif -#endif +#endif // EXAMPLE_LCD_USE_EXTERNAL_INIT_CMD + ESP_UTILS_CHECK_FALSE_EXIT(board->begin(), "Board begin failed"); ESP_LOGI(TAG, "Initializing LVGL"); diff --git a/examples/esp_idf/lvgl_v8_port/sdkconfig.defaults b/examples/esp_idf/lvgl_v8_port/sdkconfig.defaults index 1cd128bb..8f3d26ec 100644 --- a/examples/esp_idf/lvgl_v8_port/sdkconfig.defaults +++ b/examples/esp_idf/lvgl_v8_port/sdkconfig.defaults @@ -1,4 +1,3 @@ -CONFIG_ESP_TASK_WDT_EN=n CONFIG_FREERTOS_HZ=1000 CONFIG_COMPILER_CXX_EXCEPTIONS=y diff --git a/examples/esp_idf/lvgl_v8_port/sdkconfig.defaults.esp32s3 b/examples/esp_idf/lvgl_v8_port/sdkconfig.defaults.esp32s3 index 8770213f..4a53adb8 100644 --- a/examples/esp_idf/lvgl_v8_port/sdkconfig.defaults.esp32s3 +++ b/examples/esp_idf/lvgl_v8_port/sdkconfig.defaults.esp32s3 @@ -1,3 +1,5 @@ +CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y + CONFIG_COMPILER_OPTIMIZATION_PERF=y CONFIG_SPIRAM=y diff --git a/examples/platformio/lvgl_v8_port/README.md b/examples/platformio/lvgl_v8_port/README.md index f70a2f4e..b3e25b6a 100644 --- a/examples/platformio/lvgl_v8_port/README.md +++ b/examples/platformio/lvgl_v8_port/README.md @@ -13,7 +13,7 @@ This example demonstrates how to port `LVGL v8`. And for `RGB/MIPI-DSI` interfac - [Optional] `ESP32_Display_Panel`: - - This example already has the [esp_panel_drivers_conf.h](./src/esp_panel_drivers_conf.h) configuration file in the project directory. Edit this file as needed + - This example already has the [esp_panel_board_custom_conf.h](./src/esp_panel_board_custom_conf.h) and [esp_panel_drivers_conf.h](./src/esp_panel_drivers_conf.h) configuration files in the project directory. Edit these files as needed - see [Board Configuration Guide](../../../docs/envs/use_with_arduino.md#configuration-guide) for more information - [Optional] `esp-lib-utils` : @@ -65,6 +65,7 @@ This example demonstrates how to port `LVGL v8`. And for `RGB/MIPI-DSI` interfac - Modify the [BOARD_CUSTOM.json](./boards/BOARD_CUSTOM.json) board file by referring to a supported board file which has the same chip as your board. - Modify the `[env:BOARD_CUSTOM]` board env in the *platformio.ini* file as needed + - Modify the *esp_panel_board_custom_conf.h* file and set `ESP_PANEL_BOARD_DEFAULT_USE_CUSTOM` to `1`. Then change other configurations as needed in the file - See [PlatformIO Docs](https://docs.platformio.org/en/latest/projectconf/index.html) for more information diff --git a/examples/platformio/lvgl_v8_port/src/esp_panel_board_custom_conf.h b/examples/platformio/lvgl_v8_port/src/esp_panel_board_custom_conf.h index 3b65e300..b86014e0 100644 --- a/examples/platformio/lvgl_v8_port/src/esp_panel_board_custom_conf.h +++ b/examples/platformio/lvgl_v8_port/src/esp_panel_board_custom_conf.h @@ -162,8 +162,8 @@ #define ESP_PANEL_BOARD_LCD_RGB_SPI_SCL_USE_EXPNADER (0) // Set to 1 if the signal is controlled by an IO expander #define ESP_PANEL_BOARD_LCD_RGB_SPI_SDA_USE_EXPNADER (0) // Set to 1 if the signal is controlled by an IO expander #define ESP_PANEL_BOARD_LCD_RGB_SPI_MODE (0) // 0-3, typically set to 0 - #define ESP_PANEL_BOARD_LCD_RGB_SPI_CMD_BYTES (1) // Typically set to 8 - #define ESP_PANEL_BOARD_LCD_RGB_SPI_PARAM_BYTES (1) // Typically set to 8 + #define ESP_PANEL_BOARD_LCD_RGB_SPI_CMD_BYTES (1) // Typically set to 1 + #define ESP_PANEL_BOARD_LCD_RGB_SPI_PARAM_BYTES (1) // Typically set to 1 #define ESP_PANEL_BOARD_LCD_RGB_SPI_USE_DC_BIT (1) // 0/1. Typically set to 1 #endif // ESP_PANEL_BOARD_LCD_RGB_USE_CONTROL_PANEL /* For refresh panel (RGB) */ @@ -347,6 +347,7 @@ * - `AXS15231B` * - `CHSC6540` * - `CST816S` + * - `CST820` * - `FT5x06` * - `GT911`, `GT1151` * - `SPD2010` @@ -476,6 +477,22 @@ #define ESP_PANEL_BOARD_BACKLIGHT_IO (38) // Output GPIO pin number #define ESP_PANEL_BOARD_BACKLIGHT_ON_LEVEL (1) // Active level, 0: low, 1: high +#if ESP_PANEL_BOARD_BACKLIGHT_TYPE == ESP_PANEL_BACKLIGHT_TYPE_PWM_LEDC + /** + * @brief PWM parameters configuration + */ + #define ESP_PANEL_BOARD_BACKLIGHT_PWM_FREQ_HZ (5000) // LEDC timer frequency. + // Different backlight driver chips may have different + // frequency limits, please refer to the datasheet of + // the specific chip. + // https://github.com/esp-arduino-libs/ESP32_Display_Panel/issues/188 + + #define ESP_PANEL_BOARD_BACKLIGHT_PWM_DUTY_RESOLUTION (10) // LEDC timer duty resolution. + // The frequency and duty resolution of the LEDC timer + // need to be properly matched, please refer to: + // https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/ledc.html#supported-range-of-frequency-and-duty-resolutions +#endif + #elif ESP_PANEL_BOARD_BACKLIGHT_TYPE == ESP_PANEL_BACKLIGHT_TYPE_CUSTOM /** @@ -735,9 +752,9 @@ * 3. Patch version mismatch: No impact on functionality */ #define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MAJOR 1 -#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MINOR 0 +#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MINOR 2 #define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_PATCH 0 -#endif // ESP_PANEL_BOARD_USE_CUSTOM +#endif // ESP_PANEL_BOARD_DEFAULT_USE_CUSTOM // *INDENT-ON* diff --git a/examples/platformio/lvgl_v8_port/src/esp_panel_drivers_conf.h b/examples/platformio/lvgl_v8_port/src/esp_panel_drivers_conf.h index fe0aecca..a1cef666 100644 --- a/examples/platformio/lvgl_v8_port/src/esp_panel_drivers_conf.h +++ b/examples/platformio/lvgl_v8_port/src/esp_panel_drivers_conf.h @@ -126,6 +126,7 @@ #define ESP_PANEL_DRIVERS_TOUCH_USE_AXS15231B (0) #define ESP_PANEL_DRIVERS_TOUCH_USE_CHSC6540 (0) #define ESP_PANEL_DRIVERS_TOUCH_USE_CST816S (0) + #define ESP_PANEL_DRIVERS_TOUCH_USE_CST820 (0) #define ESP_PANEL_DRIVERS_TOUCH_USE_FT5x06 (0) #define ESP_PANEL_DRIVERS_TOUCH_USE_GT911 (0) #define ESP_PANEL_DRIVERS_TOUCH_USE_GT1151 (0) @@ -260,7 +261,7 @@ * 3. Patch version mismatch: No impact on functionality */ #define ESP_PANEL_DRIVERS_CONF_FILE_VERSION_MAJOR 1 -#define ESP_PANEL_DRIVERS_CONF_FILE_VERSION_MINOR 0 +#define ESP_PANEL_DRIVERS_CONF_FILE_VERSION_MINOR 1 #define ESP_PANEL_DRIVERS_CONF_FILE_VERSION_PATCH 0 // *INDENT-ON* diff --git a/examples/platformio/lvgl_v8_port/src/lv_conf.h b/examples/platformio/lvgl_v8_port/src/lv_conf.h index e310ce1e..ef8bd20b 100644 --- a/examples/platformio/lvgl_v8_port/src/lv_conf.h +++ b/examples/platformio/lvgl_v8_port/src/lv_conf.h @@ -362,7 +362,7 @@ *===================*/ /*Montserrat fonts with ASCII range and some symbols using bpp = 4 - *https://fonts.google.com/specimen/Montserrat*/ + *https://fonts.google.com/specimen/Montserrat */ #define LV_FONT_MONTSERRAT_8 1 #define LV_FONT_MONTSERRAT_10 1 #define LV_FONT_MONTSERRAT_12 1 @@ -453,7 +453,7 @@ /*Support bidirectional texts. Allows mixing Left-to-Right and Right-to-Left texts. *The direction will be processed according to the Unicode Bidirectional Algorithm: - *https://www.w3.org/International/articles/inline-bidi-markup/uba-basics*/ + *https://www.w3.org/International/articles/inline-bidi-markup/uba-basics */ #define LV_USE_BIDI 0 #if LV_USE_BIDI /*Set the default direction. Supported values: @@ -471,7 +471,7 @@ * WIDGET USAGE *================*/ -/*Documentation of the widgets: https://docs.lvgl.io/latest/en/html/widgets/index.html*/ +/*Documentation of the widgets: https://docs.lvgl.io/latest/en/html/widgets/index.html */ #define LV_USE_ARC 1 diff --git a/examples/platformio/lvgl_v8_port/src/lvgl_v8_port.cpp b/examples/platformio/lvgl_v8_port/src/lvgl_v8_port.cpp index 8c6042f3..e9f71dca 100644 --- a/examples/platformio/lvgl_v8_port/src/lvgl_v8_port.cpp +++ b/examples/platformio/lvgl_v8_port/src/lvgl_v8_port.cpp @@ -4,6 +4,8 @@ * SPDX-License-Identifier: CC0-1.0 */ +#include "freertos/FreeRTOS.h" + #include "esp_timer.h" #undef ESP_UTILS_LOG_TAG #define ESP_UTILS_LOG_TAG "LvPort" @@ -638,10 +640,18 @@ static lv_disp_t *display_init(LCD *lcd) return lv_disp_drv_register(&disp_drv); } +static SemaphoreHandle_t touch_detected; + static void touchpad_read(lv_indev_drv_t *indev_drv, lv_indev_data_t *data) { Touch *tp = (Touch *)indev_drv->user_data; TouchPoint point; + data->state = LV_INDEV_STATE_RELEASED; + + /* if we are interrupt driven wait for the ISR to fire */ + if ( tp->isInterruptEnabled() && (xSemaphoreTake( touch_detected, 0 ) == pdFALSE) ) { + return; + } /* Read data from touch controller */ int read_touch_result = tp->readPoints(&point, 1, 0); @@ -649,11 +659,17 @@ static void touchpad_read(lv_indev_drv_t *indev_drv, lv_indev_data_t *data) data->point.x = point.x; data->point.y = point.y; data->state = LV_INDEV_STATE_PRESSED; - } else { - data->state = LV_INDEV_STATE_RELEASED; } } +static bool onTouchInterruptCallback(void *user_data) +{ + BaseType_t xHigherPriorityTaskWoken = pdFALSE; + xSemaphoreGiveFromISR( touch_detected, &xHigherPriorityTaskWoken ); + portYIELD_FROM_ISR( xHigherPriorityTaskWoken ); + return false; +} + static lv_indev_t *indev_init(Touch *tp) { ESP_UTILS_CHECK_FALSE_RETURN(tp != nullptr, nullptr, "Invalid touch device"); @@ -661,6 +677,10 @@ static lv_indev_t *indev_init(Touch *tp) static lv_indev_drv_t indev_drv_tp; + if (tp->isInterruptEnabled()) { + touch_detected = xSemaphoreCreateBinary(); + tp->attachInterruptCallback(onTouchInterruptCallback, tp); + } ESP_UTILS_LOGD("Register input driver to LVGL"); lv_indev_drv_init(&indev_drv_tp); indev_drv_tp.type = LV_INDEV_TYPE_POINTER; diff --git a/idf_component.yml b/idf_component.yml index 44dd6619..b3b9e60f 100644 --- a/idf_component.yml +++ b/idf_component.yml @@ -1,4 +1,4 @@ -version: "1.0.0" +version: "1.0.4" description: ESP32_Display_Panel is a display driver and GUI porting library designed by Espressif specifically for ESP series SoCs (ESP32, ESP32-S3, ESP32-P4, etc.) url: https://github.com/esp-arduino-libs/ESP32_Display_Panel repository: https://github.com/esp-arduino-libs/ESP32_Display_Panel.git diff --git a/library.properties b/library.properties index 823a9220..478f3731 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=ESP32_Display_Panel -version=1.0.0 +version=1.0.4 author=espressif maintainer=espressif sentence=ESP32_Display_Panel is a display driver and GUI porting library designed by Espressif specifically for ESP series SoCs (ESP32, ESP32-S3, ESP32-P4, etc.) @@ -8,4 +8,4 @@ category=Display architectures=esp32 url=https://github.com/esp-arduino-libs/ESP32_Display_Panel includes=esp_display_panel.hpp -depends=ESP32_IO_Expander (>=1.0.0 && <2.0.0), esp-lib-utils (>=0.1.0 && <0.2.0) +depends=ESP32_IO_Expander (>=1.0.0 && <2.0.0), esp-lib-utils (>=0.2.0 && <0.3.0) diff --git a/src/board/custom/Kconfig.board_custom.backlight b/src/board/custom/Kconfig.board_custom.backlight index 9411de34..ffa5f5e5 100644 --- a/src/board/custom/Kconfig.board_custom.backlight +++ b/src/board/custom/Kconfig.board_custom.backlight @@ -57,6 +57,23 @@ if ESP_PANEL_BOARD_USE_BACKLIGHT Active level for backlight control. endmenu + menu "PWM parameters" + depends on ESP_PANEL_BOARD_BACKLIGHT_TYPE_PWM_LEDC + + config ESP_PANEL_BOARD_BACKLIGHT_PWM_FREQ_HZ + int "Frequency" + default 5000 + help + Frequency for PWM control. + + config ESP_PANEL_BOARD_BACKLIGHT_PWM_DUTY_RESOLUTION + int "Duty resolution" + default 10 + range 1 20 + help + Duty resolution for PWM control. + endmenu + config ESP_PANEL_BOARD_BACKLIGHT_IDLE_OFF bool "Idle off" default n diff --git a/src/board/custom/Kconfig.board_custom.touch b/src/board/custom/Kconfig.board_custom.touch index 456b6d1b..4c574793 100644 --- a/src/board/custom/Kconfig.board_custom.touch +++ b/src/board/custom/Kconfig.board_custom.touch @@ -15,6 +15,9 @@ if ESP_PANEL_BOARD_USE_TOUCH config ESP_PANEL_BOARD_TOUCH_CONTROLLER_CST816S bool "CST816S" + config ESP_PANEL_BOARD_TOUCH_CONTROLLER_CST820 + bool "CST820" + config ESP_PANEL_BOARD_TOUCH_CONTROLLER_FT5x06 bool "FT5x06" diff --git a/src/board/custom/esp_panel_board_kconfig_custom_backlight.h b/src/board/custom/esp_panel_board_kconfig_custom_backlight.h index c9501fd5..ba6c8f94 100644 --- a/src/board/custom/esp_panel_board_kconfig_custom_backlight.h +++ b/src/board/custom/esp_panel_board_kconfig_custom_backlight.h @@ -42,6 +42,26 @@ #error "Missing configuration: ESP_PANEL_BOARD_BACKLIGHT_ON_LEVEL" #endif #endif + + #if (ESP_PANEL_BOARD_BACKLIGHT_TYPE == ESP_PANEL_BACKLIGHT_TYPE_PWM_LEDC) + #ifndef ESP_PANEL_BOARD_BACKLIGHT_PWM_FREQ_HZ + #ifdef CONFIG_ESP_PANEL_BOARD_BACKLIGHT_PWM_FREQ_HZ + #define ESP_PANEL_BOARD_BACKLIGHT_PWM_FREQ_HZ CONFIG_ESP_PANEL_BOARD_BACKLIGHT_PWM_FREQ_HZ + #else + #define ESP_PANEL_BOARD_BACKLIGHT_PWM_FREQ_HZ 5000 // Keep the backward compatibility + #endif + #endif + #endif + + #if (ESP_PANEL_BOARD_BACKLIGHT_TYPE == ESP_PANEL_BACKLIGHT_TYPE_PWM_LEDC) + #ifndef ESP_PANEL_BOARD_BACKLIGHT_PWM_DUTY_RESOLUTION + #ifdef CONFIG_ESP_PANEL_BOARD_BACKLIGHT_PWM_DUTY_RESOLUTION + #define ESP_PANEL_BOARD_BACKLIGHT_PWM_DUTY_RESOLUTION CONFIG_ESP_PANEL_BOARD_BACKLIGHT_PWM_DUTY_RESOLUTION + #else + #define ESP_PANEL_BOARD_BACKLIGHT_PWM_DUTY_RESOLUTION 10 // Keep the backward compatibility + #endif + #endif + #endif #endif #ifndef ESP_PANEL_BOARD_BACKLIGHT_IDLE_OFF diff --git a/src/board/custom/esp_panel_board_kconfig_custom_touch.h b/src/board/custom/esp_panel_board_kconfig_custom_touch.h index d01c30be..d257ccd7 100644 --- a/src/board/custom/esp_panel_board_kconfig_custom_touch.h +++ b/src/board/custom/esp_panel_board_kconfig_custom_touch.h @@ -23,6 +23,8 @@ #define ESP_PANEL_BOARD_TOUCH_CONTROLLER AXS15231B #elif defined(CONFIG_ESP_PANEL_BOARD_TOUCH_CONTROLLER_CST816S) #define ESP_PANEL_BOARD_TOUCH_CONTROLLER CST816S + #elif defined(CONFIG_ESP_PANEL_BOARD_TOUCH_CONTROLLER_CST820) + #define ESP_PANEL_BOARD_TOUCH_CONTROLLER CST820 #elif defined(CONFIG_ESP_PANEL_BOARD_TOUCH_CONTROLLER_FT5x06) #define ESP_PANEL_BOARD_TOUCH_CONTROLLER FT5x06 #elif defined(CONFIG_ESP_PANEL_BOARD_TOUCH_CONTROLLER_GT911) diff --git a/src/board/esp_panel_board.hpp b/src/board/esp_panel_board.hpp index 8df1822c..b04ffa68 100644 --- a/src/board/esp_panel_board.hpp +++ b/src/board/esp_panel_board.hpp @@ -75,7 +75,7 @@ class Board { * @brief Initialize the panel device * * Creates objects for the LCD, Touch, Backlight, and other devices based on the configuration. - * The initialization sequence is: `LCD -> Touch -> Backlight -> IO Expander` + * The creation sequence is: `LCD -> Touch -> Backlight -> IO Expander` * * @return `true` if successful, `false` otherwise */ diff --git a/src/board/esp_panel_board_default_config.cpp b/src/board/esp_panel_board_default_config.cpp index d94da7e3..9733e64d 100644 --- a/src/board/esp_panel_board_default_config.cpp +++ b/src/board/esp_panel_board_default_config.cpp @@ -247,10 +247,10 @@ const BoardConfig ESP_PANEL_BOARD_DEFAULT_CONFIG = { }, #endif // ESP_PANEL_BOARD_TOUCH_BUS_SKIP_INIT_HOST // Control Panel - .control_panel = ESP_PANEL_TOUCH_SPI_CONTROL_PANEL_CONFIG( - ESP_PANEL_BOARD_TOUCH_CONTROLLER, ESP_PANEL_BOARD_TOUCH_SPI_IO_CS - ), - .use_complete_io_config = true, + .control_panel = BusSPI::ControlPanelFullConfig + ESP_PANEL_TOUCH_SPI_CONTROL_PANEL_CONFIG( + ESP_PANEL_BOARD_TOUCH_CONTROLLER, ESP_PANEL_BOARD_TOUCH_SPI_IO_CS + ), }, #endif // ESP_PANEL_BOARD_TOUCH_BUS_TYPE .device_name = TO_STR(ESP_PANEL_BOARD_TOUCH_CONTROLLER), @@ -293,6 +293,10 @@ const BoardConfig ESP_PANEL_BOARD_DEFAULT_CONFIG = { }, #elif ESP_PANEL_BOARD_BACKLIGHT_TYPE == ESP_PANEL_BACKLIGHT_TYPE_PWM_LEDC .config = BacklightPWM_LEDC::Config{ + .ledc_timer = BacklightPWM_LEDC::LEDC_TimerPartialConfig{ + .freq_hz = ESP_PANEL_BOARD_BACKLIGHT_PWM_FREQ_HZ, + .duty_resolution = ESP_PANEL_BOARD_BACKLIGHT_PWM_DUTY_RESOLUTION, + }, .ledc_channel = BacklightPWM_LEDC::LEDC_ChannelPartialConfig{ .io_num = ESP_PANEL_BOARD_BACKLIGHT_IO, .on_level = ESP_PANEL_BOARD_BACKLIGHT_ON_LEVEL, diff --git a/src/board/supported/esp_panel_board_config_supported.h b/src/board/supported/esp_panel_board_config_supported.h index 502d28a0..fd919212 100644 --- a/src/board/supported/esp_panel_board_config_supported.h +++ b/src/board/supported/esp_panel_board_config_supported.h @@ -92,7 +92,9 @@ + defined(BOARD_JINGCAI_JC8048W550C) \ /* Waveshare */ \ + defined(BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_1_85) \ + + defined(BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_1_85_C) \ + defined(BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_2_1) \ + + defined(BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_2_8_C) \ + defined(BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_4_3) \ + defined(BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_4_3_B) \ + defined(BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_5) \ @@ -100,6 +102,13 @@ + defined(BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_7) \ + defined(BOARD_WAVESHARE_ESP32_P4_NANO) \ /* Viewe */ \ + + defined(BOARD_VIEWE_SMARTRING) \ + + defined(BOARD_VIEWE_UEDX24240013_MD50E) \ + + defined(BOARD_VIEWE_UEDX46460015_MD50ET) \ + + defined(BOARD_VIEWE_UEDX48480021_MD80E) \ + + defined(BOARD_VIEWE_UEDX48480021_MD80E_V2) \ + + defined(BOARD_VIEWE_UEDX48480021_MD80ET) \ + + defined(BOARD_VIEWE_UEDX48480028_MD80ET) \ + defined(BOARD_VIEWE_UEDX24320024E_WB_A) \ + defined(BOARD_VIEWE_UEDX24320028E_WB_A) \ + defined(BOARD_VIEWE_UEDX24320035E_WB_A) \ @@ -109,6 +118,7 @@ + defined(BOARD_VIEWE_UEDX80480043E_WB_A) \ + defined(BOARD_VIEWE_UEDX80480050E_WB_A) \ + defined(BOARD_VIEWE_UEDX80480050E_WB_A_2) \ + + defined(BOARD_VIEWE_UEDX80480050E_AC_A) \ + defined(BOARD_VIEWE_UEDX80480070E_WB_A) \ > 1 #error "Multiple boards enabled! Please check file `esp_panel_board_supported_conf.h` and make sure only one board is enabled." @@ -160,8 +170,12 @@ /* Waveshare */ #elif defined(BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_1_85) #include "waveshare/BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_1_85.h" + #elif defined(BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_1_85_C) + #include "waveshare/BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_1_85_C.h" #elif defined(BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_2_1) #include "waveshare/BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_2_1.h" + #elif defined(BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_2_8_C) + #include "waveshare/BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_2_8_C.h" #elif defined(BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_4_3) #include "waveshare/BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_4_3.h" #elif defined(BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_4_3_B) @@ -175,6 +189,20 @@ #elif defined(BOARD_WAVESHARE_ESP32_P4_NANO) #include "waveshare/BOARD_WAVESHARE_ESP32_P4_NANO.h" /* Viewe */ + #elif defined(BOARD_VIEWE_SMARTRING) + #include "viewe/BOARD_VIEWE_SMARTRING.h" + #elif defined(BOARD_VIEWE_UEDX24240013_MD50E) + #include "viewe/BOARD_VIEWE_UEDX24240013_MD50E.h" + #elif defined(BOARD_VIEWE_UEDX46460015_MD50ET) + #include "viewe/BOARD_VIEWE_UEDX46460015_MD50ET.h" + #elif defined(BOARD_VIEWE_UEDX48480021_MD80E) + #include "viewe/BOARD_VIEWE_UEDX48480021_MD80E.h" + #elif defined(BOARD_VIEWE_UEDX48480021_MD80E_V2) + #include "viewe/BOARD_VIEWE_UEDX48480021_MD80E_V2.h" + #elif defined(BOARD_VIEWE_UEDX48480021_MD80ET) + #include "viewe/BOARD_VIEWE_UEDX48480021_MD80ET.h" + #elif defined(BOARD_VIEWE_UEDX48480028_MD80ET) + #include "viewe/BOARD_VIEWE_UEDX48480028_MD80ET.h" #elif defined(BOARD_VIEWE_UEDX24320024E_WB_A) #include "viewe/BOARD_VIEWE_UEDX24320024E_WB_A.h" #elif defined(BOARD_VIEWE_UEDX24320028E_WB_A) @@ -193,6 +221,8 @@ #include "viewe/BOARD_VIEWE_UEDX80480050E_WB_A.h" #elif defined(BOARD_VIEWE_UEDX80480050E_WB_A_2) #include "viewe/BOARD_VIEWE_UEDX80480050E_WB_A_2.h" + #elif defined(BOARD_VIEWE_UEDX80480050E_AC_A) + #include "viewe/BOARD_VIEWE_UEDX80480050E_AC_A.h" #elif defined(BOARD_VIEWE_UEDX80480070E_WB_A) #include "viewe/BOARD_VIEWE_UEDX80480070E_WB_A.h" #else diff --git a/src/board/supported/esp_panel_board_kconfig_supported.h b/src/board/supported/esp_panel_board_kconfig_supported.h index 9d9a1789..ad9f9165 100644 --- a/src/board/supported/esp_panel_board_kconfig_supported.h +++ b/src/board/supported/esp_panel_board_kconfig_supported.h @@ -118,11 +118,21 @@ #define BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_1_85 CONFIG_BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_1_85 #endif #endif +#ifndef BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_1_85_C + #ifdef CONFIG_BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_1_85_C + #define BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_1_85_C CONFIG_BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_1_85_C + #endif +#endif #ifndef BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_2_1 #ifdef CONFIG_BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_2_1 #define BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_2_1 CONFIG_BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_2_1 #endif #endif +#ifndef BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_2_8_C + #ifdef CONFIG_BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_2_8_C + #define BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_2_8_C CONFIG_BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_2_8_C + #endif +#endif #ifndef BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_4_3 #ifdef CONFIG_BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_4_3 #define BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_4_3 CONFIG_BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_4_3 @@ -155,6 +165,48 @@ #endif // VIEWE +#ifndef BOARD_VIEWE_SMARTRING + #ifdef CONFIG_BOARD_VIEWE_SMARTRING + #define BOARD_VIEWE_SMARTRING CONFIG_BOARD_VIEWE_SMARTRING + #endif +#endif + +#ifndef BOARD_VIEWE_UEDX24240013_MD50E + #ifdef CONFIG_BOARD_VIEWE_UEDX24240013_MD50E + #define BOARD_VIEWE_UEDX24240013_MD50E CONFIG_BOARD_VIEWE_UEDX24240013_MD50E + #endif +#endif + +#ifndef BOARD_VIEWE_UEDX46460015_MD50ET + #ifdef CONFIG_BOARD_VIEWE_UEDX46460015_MD50ET + #define BOARD_VIEWE_UEDX46460015_MD50ET CONFIG_BOARD_VIEWE_UEDX46460015_MD50ET + #endif +#endif + +#ifndef BOARD_VIEWE_UEDX48480021_MD80E + #ifdef CONFIG_BOARD_VIEWE_UEDX48480021_MD80E + #define BOARD_VIEWE_UEDX48480021_MD80E CONFIG_BOARD_VIEWE_UEDX48480021_MD80E + #endif +#endif + +#ifndef BOARD_VIEWE_UEDX48480021_MD80E_V2 + #ifdef CONFIG_BOARD_VIEWE_UEDX48480021_MD80E_V2 + #define BOARD_VIEWE_UEDX48480021_MD80E_V2 CONFIG_BOARD_VIEWE_UEDX48480021_MD80E_V2 + #endif +#endif + +#ifndef BOARD_VIEWE_UEDX48480021_MD80ET + #ifdef CONFIG_BOARD_VIEWE_UEDX48480021_MD80ET + #define BOARD_VIEWE_UEDX48480021_MD80ET CONFIG_BOARD_VIEWE_UEDX48480021_MD80ET + #endif +#endif + +#ifndef BOARD_VIEWE_UEDX48480028_MD80ET + #ifdef CONFIG_BOARD_VIEWE_UEDX48480028_MD80ET + #define BOARD_VIEWE_UEDX48480028_MD80ET CONFIG_BOARD_VIEWE_UEDX48480028_MD80ET + #endif +#endif + #ifndef BOARD_VIEWE_UEDX24320024E_WB_A #ifdef CONFIG_BOARD_VIEWE_UEDX24320024E_WB_A #define BOARD_VIEWE_UEDX24320024E_WB_A CONFIG_BOARD_VIEWE_UEDX24320024E_WB_A @@ -209,6 +261,12 @@ #endif #endif +#ifndef BOARD_VIEWE_UEDX80480050E_AC_A + #ifdef CONFIG_BOARD_VIEWE_UEDX80480050E_AC_A + #define BOARD_VIEWE_UEDX80480050E_AC_A CONFIG_BOARD_VIEWE_UEDX80480050E_AC_A + #endif +#endif + #ifndef BOARD_VIEWE_UEDX80480070E_WB_A #ifdef CONFIG_BOARD_VIEWE_UEDX80480070E_WB_A #define BOARD_VIEWE_UEDX80480070E_WB_A CONFIG_BOARD_VIEWE_UEDX80480070E_WB_A diff --git a/src/board/supported/jingcai/BOARD_JINGCAI_ESP32_4848S040C_I_Y_3.h b/src/board/supported/jingcai/BOARD_JINGCAI_ESP32_4848S040C_I_Y_3.h index 20e78e1f..ec2c2004 100644 --- a/src/board/supported/jingcai/BOARD_JINGCAI_ESP32_4848S040C_I_Y_3.h +++ b/src/board/supported/jingcai/BOARD_JINGCAI_ESP32_4848S040C_I_Y_3.h @@ -345,6 +345,23 @@ #define ESP_PANEL_BOARD_BACKLIGHT_IO (38) // Output GPIO pin number #define ESP_PANEL_BOARD_BACKLIGHT_ON_LEVEL (1) // Active level, 0: low, 1: high + +#if ESP_PANEL_BOARD_BACKLIGHT_TYPE == ESP_PANEL_BACKLIGHT_TYPE_PWM_LEDC + /** + * @brief PWM parameters configuration + */ + #define ESP_PANEL_BOARD_BACKLIGHT_PWM_FREQ_HZ (1000) // LEDC timer frequency. + // Different backlight driver chips may have different + // frequency limits, please refer to the datasheet of + // the specific chip. + // https://github.com/esp-arduino-libs/ESP32_Display_Panel/issues/188 + + #define ESP_PANEL_BOARD_BACKLIGHT_PWM_DUTY_RESOLUTION (10) // LEDC timer duty resolution. + // The frequency and duty resolution of the LEDC timer + // need to be properly matched, please refer to: + // https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/ledc.html#supported-range-of-frequency-and-duty-resolutions +#endif + #endif // ESP_PANEL_BOARD_BACKLIGHT_TYPE /** @@ -381,7 +398,7 @@ * 3. Patch version mismatch: No impact on functionality */ #define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MAJOR 1 -#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MINOR 0 +#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MINOR 1 #define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_PATCH 0 // *INDENT-ON* diff --git a/src/board/supported/jingcai/BOARD_JINGCAI_JC8048W550C.h b/src/board/supported/jingcai/BOARD_JINGCAI_JC8048W550C.h index 48cffb59..b793037a 100644 --- a/src/board/supported/jingcai/BOARD_JINGCAI_JC8048W550C.h +++ b/src/board/supported/jingcai/BOARD_JINGCAI_JC8048W550C.h @@ -102,11 +102,11 @@ // |------|--------------|--------------------------| // | LCD: | RGB888 | RGB565 | RGB666 | RGB888 | // ┗------|--------------|--------|--------|--------| - #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA0 (45) // | D0 | B0 | B0-1 | B0-3 | - #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA1 (48) // | D1 | B1 | B2 | B4 | - #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA2 (47) // | D2 | B2 | B3 | B5 | - #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA3 (21) // | D3 | B3 | B4 | B6 | - #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA4 (14) // | D4 | B4 | B5 | B7 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA0 (8) // | D0 | B0 | B0-1 | B0-3 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA1 (3) // | D1 | B1 | B2 | B4 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA2 (46) // | D2 | B2 | B3 | B5 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA3 (9) // | D3 | B3 | B4 | B6 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA4 (1) // | D4 | B4 | B5 | B7 | #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA5 (5) // | D5 | G0 | G0 | G0-2 | #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA6 (6) // | D6 | G1 | G1 | G3 | #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA7 (7) // | D7 | G2 | G2 | G4 | @@ -114,11 +114,11 @@ #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA8 (15) // | G3 | G3 | G5 | #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA9 (16) // | G4 | G4 | G6 | #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA10 (4) // | G5 | G5 | G7 | - #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA11 (8) // | R0 | R0-1 | R0-3 | - #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA12 (3) // | R1 | R2 | R4 | - #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA13 (46) // | R2 | R3 | R5 | - #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA14 (9) // | R3 | R4 | R6 | - #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA15 (1) // | R4 | R5 | R7 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA11 (45) // | R0 | R0-1 | R0-3 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA12 (48) // | R1 | R2 | R4 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA13 (47) // | R2 | R3 | R5 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA14 (21) // | R3 | R4 | R6 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA15 (14) // | R4 | R5 | R7 | // ┗--------┻--------┻--------┛ #endif // ESP_PANEL_BOARD_LCD_RGB_DATA_WIDTH @@ -282,6 +282,22 @@ #define ESP_PANEL_BOARD_BACKLIGHT_IO (2) // Output GPIO pin number #define ESP_PANEL_BOARD_BACKLIGHT_ON_LEVEL (1) // Active level, 0: low, 1: high +#if ESP_PANEL_BOARD_BACKLIGHT_TYPE == ESP_PANEL_BACKLIGHT_TYPE_PWM_LEDC + /** + * @brief PWM parameters configuration + */ + #define ESP_PANEL_BOARD_BACKLIGHT_PWM_FREQ_HZ (1000) // LEDC timer frequency. + // Different backlight driver chips may have different + // frequency limits, please refer to the datasheet of + // the specific chip. + // https://github.com/esp-arduino-libs/ESP32_Display_Panel/issues/188 + + #define ESP_PANEL_BOARD_BACKLIGHT_PWM_DUTY_RESOLUTION (10) // LEDC timer duty resolution. + // The frequency and duty resolution of the LEDC timer + // need to be properly matched, please refer to: + // https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/ledc.html#supported-range-of-frequency-and-duty-resolutions +#endif + #endif // ESP_PANEL_BOARD_BACKLIGHT_TYPE /** @@ -485,7 +501,7 @@ * 3. Patch version mismatch: No impact on functionality */ #define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MAJOR 1 -#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MINOR 0 +#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MINOR 1 #define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_PATCH 0 // *INDENT-ON* diff --git a/src/board/supported/viewe/BOARD_VIEWE_SMARTRING.h b/src/board/supported/viewe/BOARD_VIEWE_SMARTRING.h new file mode 100644 index 00000000..25cff59c --- /dev/null +++ b/src/board/supported/viewe/BOARD_VIEWE_SMARTRING.h @@ -0,0 +1,300 @@ +/* + * SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +/** + * @file BOARD_VIEWE_SMARTRING.h + * @brief Configuration file for Viewe SMARTRING + * @author Viewe@VIEWESMART + * @link https://github.com/VIEWESMART/VIEWE-SMARTRING + */ + +#pragma once + +// *INDENT-OFF* + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////// Please update the following macros to configure general panel ///////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/** + * @brief Board name + */ +#define ESP_PANEL_BOARD_NAME "Viewe:SMARTRING" + +/** + * @brief Panel resolution configuration in pixels + */ +#define ESP_PANEL_BOARD_WIDTH (472) // Panel width (horizontal, in pixels) +#define ESP_PANEL_BOARD_HEIGHT (466) // Panel height (vertical, in pixels) + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////// Please update the following macros to configure the LCD panel ///////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/** + * @brief LCD panel configuration flag (0/1) + * + * Set to `1` to enable LCD panel support, `0` to disable + */ +#define ESP_PANEL_BOARD_USE_LCD (1) + +#if ESP_PANEL_BOARD_USE_LCD +/** + * @brief LCD controller selection + */ +#define ESP_PANEL_BOARD_LCD_CONTROLLER SH8601 + +/** + * @brief LCD bus type selection + * + * Supported bus types: + * - `ESP_PANEL_BUS_TYPE_SPI` + * - `ESP_PANEL_BUS_TYPE_QSPI` + * - `ESP_PANEL_BUS_TYPE_RGB` (ESP32-S3 only) + * - `ESP_PANEL_BUS_TYPE_MIPI_DSI` (ESP32-P4 only) + */ +#define ESP_PANEL_BOARD_LCD_BUS_TYPE (ESP_PANEL_BUS_TYPE_QSPI) + +#if (ESP_PANEL_BOARD_LCD_BUS_TYPE == ESP_PANEL_BUS_TYPE_SPI) || \ + (ESP_PANEL_BOARD_LCD_BUS_TYPE == ESP_PANEL_BUS_TYPE_QSPI) +/** + * If set to 1, the bus will skip to initialize the corresponding host. Users need to initialize the host in advance. + * + * For drivers which created by this library, even if they use the same host, the host will be initialized only once. + * So it is not necessary to set the macro to `1`. For other drivers (like `Wire`), please set the macro to `1` + * ensure that the host is initialized only once. + */ +#define ESP_PANEL_BOARD_LCD_BUS_SKIP_INIT_HOST (0) // 0/1. Typically set to 0 +#endif + +/** + * @brief LCD bus parameters configuration + * + * Configure parameters based on the selected bus type. Parameters for other bus types will be ignored. + * For detailed parameter explanations, see: + * https://docs.espressif.com/projects/esp-idf/en/v5.3.1/esp32s3/api-reference/peripherals/lcd/index.html + * https://docs.espressif.com/projects/esp-iot-solution/en/latest/display/lcd/index.html + */ +#if ESP_PANEL_BOARD_LCD_BUS_TYPE == ESP_PANEL_BUS_TYPE_QSPI + +/** + * @brief QSPI bus + */ +/* For general */ +#define ESP_PANEL_BOARD_LCD_QSPI_HOST_ID (1) // Typically set to 1 +#if !ESP_PANEL_BOARD_LCD_BUS_SKIP_INIT_HOST +/* For host */ +#define ESP_PANEL_BOARD_LCD_QSPI_IO_SCK (13) +#define ESP_PANEL_BOARD_LCD_QSPI_IO_DATA0 (12) +#define ESP_PANEL_BOARD_LCD_QSPI_IO_DATA1 (8) +#define ESP_PANEL_BOARD_LCD_QSPI_IO_DATA2 (14) +#define ESP_PANEL_BOARD_LCD_QSPI_IO_DATA3 (9) +#endif // ESP_PANEL_BOARD_LCD_BUS_SKIP_INIT_HOST +/* For panel */ +#define ESP_PANEL_BOARD_LCD_QSPI_IO_CS (7) // -1 if not used +#define ESP_PANEL_BOARD_LCD_QSPI_MODE (0) // 0-3, typically set to 0 +#define ESP_PANEL_BOARD_LCD_QSPI_CLK_HZ (40 * 1000 * 1000) + // Should be an integer divisor of 80M, typically set to 40M +#define ESP_PANEL_BOARD_LCD_QSPI_CMD_BITS (32) // Typically set to 32 +#define ESP_PANEL_BOARD_LCD_QSPI_PARAM_BITS (8) // Typically set to 8 + +#endif // ESP_PANEL_BOARD_LCD_BUS_TYPE + +/** + * @brief LCD vendor initialization commands + * + * Vendor specific initialization can be different between manufacturers, should consult the LCD supplier for + * initialization sequence code. Please uncomment and change the following macro definitions. Otherwise, the LCD driver + * will use the default initialization sequence code. + * + * The initialization sequence can be specified in two formats: + * 1. Raw format: + * {command, (uint8_t []){data0, data1, ...}, data_size, delay_ms} + * 2. Helper macros: + * - ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(delay_ms, command, {data0, data1, ...}) + * - ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(delay_ms, command) + */ +#define ESP_PANEL_BOARD_LCD_VENDOR_INIT_CMD() \ +{ \ + {0xFE, (uint8_t []){0x00}, 0, 0}, \ + {0xC4, (uint8_t []){0x80}, 1, 0}, \ + {0x3A, (uint8_t []){0x55}, 1, 0}, \ + {0x35, (uint8_t []){0x00}, 0, 10}, \ + {0x53, (uint8_t []){0x20}, 1, 10}, \ + {0x51, (uint8_t []){0xFF}, 1, 10}, \ + {0x63, (uint8_t []){0xFF}, 1, 10}, \ + {0x2A, (uint8_t []){0x00,0x06,0x01,0xDD}, 4, 0}, \ + {0x2B, (uint8_t []){0x00,0x00,0x01,0xD1}, 4, 0}, \ + {0x11, (uint8_t []){0x00}, 0, 60}, \ + {0x29, (uint8_t []){0x00}, 0, 0}, \ +} +/** + * @brief LCD color configuration + */ +#define ESP_PANEL_BOARD_LCD_COLOR_BITS (ESP_PANEL_LCD_COLOR_BITS_RGB565) + // ESP_PANEL_LCD_COLOR_BITS_RGB565/RGB666/RGB888 +#define ESP_PANEL_BOARD_LCD_COLOR_BGR_ORDER (0) // 0: RGB, 1: BGR +#define ESP_PANEL_BOARD_LCD_COLOR_INEVRT_BIT (0) // 0/1 + +/** + * @brief LCD transformation configuration + */ +#define ESP_PANEL_BOARD_LCD_SWAP_XY (0) // 0/1 +#define ESP_PANEL_BOARD_LCD_MIRROR_X (0) // 0/1 +#define ESP_PANEL_BOARD_LCD_MIRROR_Y (0) // 0/1 +#define ESP_PANEL_BOARD_LCD_GAP_X (0) // [0, ESP_PANEL_BOARD_WIDTH] +#define ESP_PANEL_BOARD_LCD_GAP_Y (0) // [0, ESP_PANEL_BOARD_HEIGHT] + +/** + * @brief LCD reset pin configuration + */ +#define ESP_PANEL_BOARD_LCD_RST_IO (11) // Reset pin, -1 if not used +#define ESP_PANEL_BOARD_LCD_RST_LEVEL (0) // Reset active level, 0: low, 1: high + +#endif // ESP_PANEL_BOARD_USE_LCD + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////// Please update the following macros to configure the touch panel /////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/** + * @brief Touch panel configuration flag (0/1) + * + * Set to `1` to enable touch panel support, `0` to disable + */ +#define ESP_PANEL_BOARD_USE_TOUCH (1) + +#if ESP_PANEL_BOARD_USE_TOUCH +/** + * @brief Touch controller selection + */ +#define ESP_PANEL_BOARD_TOUCH_CONTROLLER CST820 + +/** + * @brief Touch bus type selection + * - `ESP_PANEL_BUS_TYPE_SPI` + */ +#define ESP_PANEL_BOARD_TOUCH_BUS_TYPE (ESP_PANEL_BUS_TYPE_I2C) + +#if (ESP_PANEL_BOARD_TOUCH_BUS_TYPE == ESP_PANEL_BUS_TYPE_I2C) || \ + (ESP_PANEL_BOARD_TOUCH_BUS_TYPE == ESP_PANEL_BUS_TYPE_SPI) +/** + * If set to 1, the bus will skip to initialize the corresponding host. Users need to initialize the host in advance. + * + * For drivers which created by this library, even if they use the same host, the host will be initialized only once. + * So it is not necessary to set the macro to `1`. For other drivers (like `Wire`), please set the macro to `1` + * ensure that the host is initialized only once. + */ +#define ESP_PANEL_BOARD_TOUCH_BUS_SKIP_INIT_HOST (0) // 0/1. Typically set to 0 +#endif + +/** + * @brief Touch bus parameters configuration + */ +#if ESP_PANEL_BOARD_TOUCH_BUS_TYPE == ESP_PANEL_BUS_TYPE_I2C + + /** + * @brief I2C bus + */ + /* For general */ + #define ESP_PANEL_BOARD_TOUCH_I2C_HOST_ID (1) // Typically set to 0 +#if !ESP_PANEL_BOARD_TOUCH_BUS_SKIP_INIT_HOST + /* For host */ + #define ESP_PANEL_BOARD_TOUCH_I2C_CLK_HZ (400 * 1000) + // Typically set to 400K + #define ESP_PANEL_BOARD_TOUCH_I2C_SCL_PULLUP (1) // 0/1. Typically set to 1 + #define ESP_PANEL_BOARD_TOUCH_I2C_SDA_PULLUP (1) // 0/1. Typically set to 1 + #define ESP_PANEL_BOARD_TOUCH_I2C_IO_SCL (45) + #define ESP_PANEL_BOARD_TOUCH_I2C_IO_SDA (41) +#endif + /* For panel */ + #define ESP_PANEL_BOARD_TOUCH_I2C_ADDRESS (0) // Typically set to 0 to use the default address. + // - For touchs with only one address, set to 0 + // - For touchs with multiple addresses, set to 0 or + // the address. Like GT911, there are two addresses: + // 0x5D(default) and 0x14 + +#endif // ESP_PANEL_BOARD_TOUCH_BUS_TYPE + +/** + * @brief Touch panel transformation flags + */ +#define ESP_PANEL_BOARD_TOUCH_SWAP_XY (0) // 0/1 +#define ESP_PANEL_BOARD_TOUCH_MIRROR_X (0) // 0/1 +#define ESP_PANEL_BOARD_TOUCH_MIRROR_Y (0) // 0/1 + +/** + * @brief Touch panel control pins + */ +#define ESP_PANEL_BOARD_TOUCH_RST_IO (46) // Reset pin, -1 if not used +#define ESP_PANEL_BOARD_TOUCH_RST_LEVEL (0) // Reset active level, 0: low, 1: high +#define ESP_PANEL_BOARD_TOUCH_INT_IO (42) // Interrupt pin, -1 if not used +#define ESP_PANEL_BOARD_TOUCH_INT_LEVEL (0) // Interrupt active level, 0: low, 1: high + +#endif // ESP_PANEL_BOARD_USE_TOUCH + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +///////////////////////////// Please update the following macros to configure the backlight //////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/** + * @brief Backlight configuration flag (0/1) + * + * Set to `1` to enable backlight support, `0` to disable + */ +#define ESP_PANEL_BOARD_USE_BACKLIGHT (1) + +#if ESP_PANEL_BOARD_USE_BACKLIGHT +/** + * @brief Backlight control type selection + */ +#define ESP_PANEL_BOARD_BACKLIGHT_TYPE (ESP_PANEL_BACKLIGHT_TYPE_PWM_LEDC) + +#if (ESP_PANEL_BOARD_BACKLIGHT_TYPE == ESP_PANEL_BACKLIGHT_TYPE_SWITCH_GPIO) || \ + (ESP_PANEL_BOARD_BACKLIGHT_TYPE == ESP_PANEL_BACKLIGHT_TYPE_SWITCH_EXPANDER) || \ + (ESP_PANEL_BOARD_BACKLIGHT_TYPE == ESP_PANEL_BACKLIGHT_TYPE_PWM_LEDC) + + /** + * @brief Backlight control pin configuration + */ + #define ESP_PANEL_BOARD_BACKLIGHT_IO (40) // Output GPIO pin number + #define ESP_PANEL_BOARD_BACKLIGHT_ON_LEVEL (1) // Active level, 0: low, 1: high + +#endif // ESP_PANEL_BOARD_BACKLIGHT_TYPE + +/** + * @brief Backlight idle state configuration (0/1) + * + * Set to 1 if want to turn off the backlight after initializing. Otherwise, the backlight will be on. + */ +#define ESP_PANEL_BOARD_BACKLIGHT_IDLE_OFF (0) + +#endif // ESP_PANEL_BOARD_USE_BACKLIGHT + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +///////////////////////////// Please update the following macros to configure the IO expander ////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/** + * @brief IO expander configuration flag (0/1) + * + * Set to `1` to enable IO expander support, `0` to disable + */ +#define ESP_PANEL_BOARD_USE_EXPANDER (0) + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////// Please utilize the following macros to execute any additional code if required ///////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////// File Version /////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/** + * Do not change the following versions. These version numbers are used to check compatibility between this + * configuration file and the library. Rules for version numbers: + * 1. Major version mismatch: Configurations are incompatible, must use library version + * 2. Minor version mismatch: May be missing new configurations, recommended to update + * 3. Patch version mismatch: No impact on functionality + */ +#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MAJOR 1 +#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MINOR 0 +#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_PATCH 0 + +// *INDENT-ON* diff --git a/src/board/supported/viewe/BOARD_VIEWE_UEDX24240013_MD50E.h b/src/board/supported/viewe/BOARD_VIEWE_UEDX24240013_MD50E.h new file mode 100644 index 00000000..660988dd --- /dev/null +++ b/src/board/supported/viewe/BOARD_VIEWE_UEDX24240013_MD50E.h @@ -0,0 +1,359 @@ +/* + * SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +/** + * @file BOARD_VIEWE_UEDX24320013_MD50E.h + * @brief Configuration file for Viewe UEDX24320013-MD50E + * @author Viewe@VIEWESMART + * @link https://github.com/VIEWESMART/UEDX24240013-MD50ESP32_1.3inch-Knob + */ + +#pragma once + +// *INDENT-OFF* + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////// Please update the following macros to configure general panel ///////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/** + * @brief Board name + */ +#define ESP_PANEL_BOARD_NAME "Viewe:UEDX24240013-MD50E" + +/** + * @brief Panel resolution configuration in pixels + */ +#define ESP_PANEL_BOARD_WIDTH (240) // Panel width (horizontal, in pixels) +#define ESP_PANEL_BOARD_HEIGHT (240) // Panel height (vertical, in pixels) + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////// Please update the following macros to configure the LCD panel ///////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/** + * @brief LCD panel configuration flag (0/1) + * + * Set to `1` to enable LCD panel support, `0` to disable + */ +#define ESP_PANEL_BOARD_USE_LCD (1) + +#if ESP_PANEL_BOARD_USE_LCD +/** + * @brief LCD controller selection + */ +#define ESP_PANEL_BOARD_LCD_CONTROLLER GC9A01 + +/** + * @brief LCD bus type selection + * + * Supported bus types: + * - `ESP_PANEL_BUS_TYPE_SPI` + * - `ESP_PANEL_BUS_TYPE_QSPI` + * - `ESP_PANEL_BUS_TYPE_RGB` (ESP32-S3 only) + * - `ESP_PANEL_BUS_TYPE_MIPI_DSI` (ESP32-P4 only) + */ +#define ESP_PANEL_BOARD_LCD_BUS_TYPE (ESP_PANEL_BUS_TYPE_SPI) + +#if (ESP_PANEL_BOARD_LCD_BUS_TYPE == ESP_PANEL_BUS_TYPE_SPI) || \ + (ESP_PANEL_BOARD_LCD_BUS_TYPE == ESP_PANEL_BUS_TYPE_QSPI) +/** + * If set to 1, the bus will skip to initialize the corresponding host. Users need to initialize the host in advance. + * + * For drivers which created by this library, even if they use the same host, the host will be initialized only once. + * So it is not necessary to set the macro to `1`. For other drivers (like `Wire`), please set the macro to `1` + * ensure that the host is initialized only once. + */ +#define ESP_PANEL_BOARD_LCD_BUS_SKIP_INIT_HOST (0) // 0/1. Typically set to 0 +#endif + +/** + * @brief LCD bus parameters configuration + * + * Configure parameters based on the selected bus type. Parameters for other bus types will be ignored. + * For detailed parameter explanations, see: + * https://docs.espressif.com/projects/esp-idf/en/v5.3.1/esp32s3/api-reference/peripherals/lcd/index.html + * https://docs.espressif.com/projects/esp-iot-solution/en/latest/display/lcd/index.html + */ +#if ESP_PANEL_BOARD_LCD_BUS_TYPE == ESP_PANEL_BUS_TYPE_SPI + + /** + * @brief SPI bus + */ + /* For general */ + #define ESP_PANEL_BOARD_LCD_SPI_HOST_ID (1) // Typically set to 1 +#if !ESP_PANEL_BOARD_LCD_BUS_SKIP_INIT_HOST + /* For host */ + #define ESP_PANEL_BOARD_LCD_SPI_IO_SCK (1) + #define ESP_PANEL_BOARD_LCD_SPI_IO_MOSI (0) + #define ESP_PANEL_BOARD_LCD_SPI_IO_MISO (-1) // -1 if not used +#endif // ESP_PANEL_BOARD_LCD_BUS_SKIP_INIT_HOST + /* For panel */ + #define ESP_PANEL_BOARD_LCD_SPI_IO_CS (10) // -1 if not used + #define ESP_PANEL_BOARD_LCD_SPI_IO_DC (4) + #define ESP_PANEL_BOARD_LCD_SPI_MODE (0) // 0-3. Typically set to 0 + #define ESP_PANEL_BOARD_LCD_SPI_CLK_HZ (40 * 1000 * 1000) + // Should be an integer divisor of 80M, typically set to 40M + #define ESP_PANEL_BOARD_LCD_SPI_CMD_BITS (8) // Typically set to 8 + #define ESP_PANEL_BOARD_LCD_SPI_PARAM_BITS (8) // Typically set to 8 + +#endif // ESP_PANEL_BOARD_LCD_BUS_TYPE + +/** + * @brief LCD vendor initialization commands + * + * Vendor specific initialization can be different between manufacturers, should consult the LCD supplier for + * initialization sequence code. Please uncomment and change the following macro definitions. Otherwise, the LCD driver + * will use the default initialization sequence code. + * + * The initialization sequence can be specified in two formats: + * 1. Raw format: + * {command, (uint8_t []){data0, data1, ...}, data_size, delay_ms} + * 2. Helper macros: + * - ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(delay_ms, command, {data0, data1, ...}) + * - ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(delay_ms, command) + */ +#define ESP_PANEL_BOARD_LCD_VENDOR_INIT_CMD() \ +{ \ + {0xfe, (uint8_t []){0x00}, 0, 0}, \ + {0xef, (uint8_t []){0x00}, 0, 0}, \ + {0xeb, (uint8_t []){0x14}, 1, 0}, \ + {0x84, (uint8_t []){0x60}, 1, 0}, \ + {0x85, (uint8_t []){0xFF}, 1, 0}, \ + {0x86, (uint8_t []){0xFF}, 1, 0}, \ + {0x87, (uint8_t []){0xFF}, 1, 0}, \ + {0x8e, (uint8_t []){0xFF}, 1, 0}, \ + {0x8f, (uint8_t []){0xFF}, 1, 0}, \ + {0x88, (uint8_t []){0x0A}, 1, 0}, \ + {0x89, (uint8_t []){0x21}, 1, 0}, \ + {0x8a, (uint8_t []){0x00}, 1, 0}, \ + {0x8b, (uint8_t []){0x80}, 1, 0}, \ + {0x8c, (uint8_t []){0x01}, 1, 0}, \ + {0x8d, (uint8_t []){0x03}, 1, 0}, \ + {0xb5, (uint8_t []){0x08, 0x09, 0x14, 0x08}, 4, 0}, \ + {0xb6, (uint8_t []){0x00, 0x00}, 2, 0}, \ + {0x36, (uint8_t []){0x48}, 1, 0}, \ + {0x3a, (uint8_t []){0x05}, 1, 0}, \ + {0x90, (uint8_t []){0x08, 0x08, 0x08, 0x08}, 4, 0}, \ + {0xbd, (uint8_t []){0x06}, 1, 0}, \ + {0xba, (uint8_t []){0x01}, 1, 0}, \ + {0xbc, (uint8_t []){0x00}, 1, 0}, \ + {0xff, (uint8_t []){0x60, 0x01, 0x04}, 3, 0}, \ + {0xc3, (uint8_t []){0x13}, 1, 0}, \ + {0xc4, (uint8_t []){0x13}, 1, 0}, \ + {0xc9, (uint8_t []){0x25}, 1, 0}, \ + {0xbe, (uint8_t []){0x11}, 1, 0}, \ + {0xe1, (uint8_t []){0x10, 0x0e}, 2, 0}, \ + {0xdf, (uint8_t []){0x21, 0x0c, 0x02}, 3, 0}, \ + {0xf0, (uint8_t []){0x45, 0x09, 0x08, 0x08, 0x26, 0x2a}, 6, 0}, \ + {0xf1, (uint8_t []){0x43, 0x70, 0x72, 0x36, 0x37, 0x6f}, 6, 0}, \ + {0xf2, (uint8_t []){0x45, 0x09, 0x08, 0x08, 0x26, 0x2a}, 6, 0}, \ + {0xf3, (uint8_t []){0x43, 0x70, 0x72, 0x36, 0x37, 0x6f}, 6, 0}, \ + {0xed, (uint8_t []){0x1b, 0x0b}, 2, 0}, \ + {0xae, (uint8_t []){0x77}, 1, 0}, \ + {0xcd, (uint8_t []){0x63}, 1, 0}, \ + {0x70, (uint8_t []){0x07, 0x07, 0x04, 0x0e, 0x0f, 0x09, 0x07, 0x08, 0x03}, 9, 0}, \ + {0xe8, (uint8_t []){0x34}, 1, 0}, \ + {0x62, (uint8_t []){0x18, 0x0d, 0x71, 0xed, 0x70, 0x70, 0x18, 0x0f, 0x71, 0xef, 0x70, 0x70}, 12, 0}, \ + {0x63, (uint8_t []){0x18, 0x11, 0x71, 0xf1, 0x70, 0x70, 0x18, 0x13, 0x71, 0xf3, 0x70, 0x70}, 12, 0}, \ + {0x64, (uint8_t []){0x28, 0x29, 0xf1, 0x01, 0xf1, 0x00, 0x07}, 7, 0}, \ + {0x66, (uint8_t []){0x3c, 0x00, 0xcd, 0x67, 0x45, 0x45, 0x10, 0x00, 0x00, 0x00}, 10, 0}, \ + {0x67, (uint8_t []){0x00, 0x3c, 0x00, 0x00, 0x00, 0x01, 0x54, 0x10, 0x32, 0x98}, 10, 0}, \ + {0x74, (uint8_t []){0x10, 0x85, 0x80, 0x00, 0x00, 0x4e, 0x00}, 7, 0}, \ + {0x98, (uint8_t []){0x3e, 0x07}, 2, 0}, \ + {0x99, (uint8_t []){0x3e, 0x07}, 2, 0}, \ + {0x35, (uint8_t []){0x00}, 1, 0}, \ + {0x44, (uint8_t []){0x00, 0x4a}, 2, 0}, \ + {0x21, (uint8_t []){0x00}, 0, 0}, \ + {0x2a, (uint8_t []){0x00, 0x00, 0x00, 0xef}, 4, 0}, \ + {0x2b, (uint8_t []){0x00, 0x00, 0x00, 0xef}, 4, 0}, \ + {0x2c, (uint8_t []){0x00}, 0, 0}, \ + {0x11, (uint8_t []){0x00}, 0, 120}, \ + {0x29, (uint8_t []){0x00}, 0, 20}, \ +} +/** + * @brief LCD color configuration + */ +#define ESP_PANEL_BOARD_LCD_COLOR_BITS (ESP_PANEL_LCD_COLOR_BITS_RGB565) + // ESP_PANEL_LCD_COLOR_BITS_RGB565/RGB666/RGB888 +#define ESP_PANEL_BOARD_LCD_COLOR_BGR_ORDER (1) // 0: RGB, 1: BGR +#define ESP_PANEL_BOARD_LCD_COLOR_INEVRT_BIT (1) // 0/1 + +/** + * @brief LCD transformation configuration + */ +#define ESP_PANEL_BOARD_LCD_SWAP_XY (0) // 0/1 +#define ESP_PANEL_BOARD_LCD_MIRROR_X (1) // 0/1 +#define ESP_PANEL_BOARD_LCD_MIRROR_Y (0) // 0/1 +#define ESP_PANEL_BOARD_LCD_GAP_X (0) // [0, ESP_PANEL_BOARD_WIDTH] +#define ESP_PANEL_BOARD_LCD_GAP_Y (0) // [0, ESP_PANEL_BOARD_HEIGHT] + +/** + * @brief LCD reset pin configuration + */ +#define ESP_PANEL_BOARD_LCD_RST_IO (-1) // Reset pin, -1 if not used +#define ESP_PANEL_BOARD_LCD_RST_LEVEL (0) // Reset active level, 0: low, 1: high + +#endif // ESP_PANEL_BOARD_USE_LCD + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////// Please update the following macros to configure the touch panel /////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/** + * @brief Touch panel configuration flag (0/1) + * + * Set to `1` to enable touch panel support, `0` to disable + */ +#define ESP_PANEL_BOARD_USE_TOUCH (0) + +#if ESP_PANEL_BOARD_USE_TOUCH +/** + * @brief Touch controller selection + */ +#define ESP_PANEL_BOARD_TOUCH_CONTROLLER CHSC6540 + +/** + * @brief Touch bus type selection + * - `ESP_PANEL_BUS_TYPE_SPI` + */ +#define ESP_PANEL_BOARD_TOUCH_BUS_TYPE (ESP_PANEL_BUS_TYPE_I2C) + +#if (ESP_PANEL_BOARD_TOUCH_BUS_TYPE == ESP_PANEL_BUS_TYPE_I2C) || \ + (ESP_PANEL_BOARD_TOUCH_BUS_TYPE == ESP_PANEL_BUS_TYPE_SPI) +/** + * If set to 1, the bus will skip to initialize the corresponding host. Users need to initialize the host in advance. + * + * For drivers which created by this library, even if they use the same host, the host will be initialized only once. + * So it is not necessary to set the macro to `1`. For other drivers (like `Wire`), please set the macro to `1` + * ensure that the host is initialized only once. + */ +#define ESP_PANEL_BOARD_TOUCH_BUS_SKIP_INIT_HOST (0) // 0/1. Typically set to 0 +#endif + +/** + * @brief Touch bus parameters configuration + */ +#if ESP_PANEL_BOARD_TOUCH_BUS_TYPE == ESP_PANEL_BUS_TYPE_I2C + + /** + * @brief I2C bus + */ + /* For general */ + #define ESP_PANEL_BOARD_TOUCH_I2C_HOST_ID (0) // Typically set to 0 +#if !ESP_PANEL_BOARD_TOUCH_BUS_SKIP_INIT_HOST + /* For host */ + #define ESP_PANEL_BOARD_TOUCH_I2C_CLK_HZ (400 * 1000) + // Typically set to 400K + #define ESP_PANEL_BOARD_TOUCH_I2C_SCL_PULLUP (1) // 0/1. Typically set to 1 + #define ESP_PANEL_BOARD_TOUCH_I2C_SDA_PULLUP (1) // 0/1. Typically set to 1 + #define ESP_PANEL_BOARD_TOUCH_I2C_IO_SCL (3) + #define ESP_PANEL_BOARD_TOUCH_I2C_IO_SDA (1) +#endif + /* For panel */ + #define ESP_PANEL_BOARD_TOUCH_I2C_ADDRESS (0) // Typically set to 0 to use the default address. + // - For touchs with only one address, set to 0 + // - For touchs with multiple addresses, set to 0 or + // the address. Like GT911, there are two addresses: + // 0x5D(default) and 0x14 + +#endif // ESP_PANEL_BOARD_TOUCH_BUS_TYPE + +/** + * @brief Touch panel transformation flags + */ +#define ESP_PANEL_BOARD_TOUCH_SWAP_XY (0) // 0/1 +#define ESP_PANEL_BOARD_TOUCH_MIRROR_X (0) // 0/1 +#define ESP_PANEL_BOARD_TOUCH_MIRROR_Y (0) // 0/1 + +/** + * @brief Touch panel control pins + */ +#define ESP_PANEL_BOARD_TOUCH_RST_IO (-1) // Reset pin, -1 if not used +#define ESP_PANEL_BOARD_TOUCH_RST_LEVEL (0) // Reset active level, 0: low, 1: high +#define ESP_PANEL_BOARD_TOUCH_INT_IO (-1) // Interrupt pin, -1 if not used +#define ESP_PANEL_BOARD_TOUCH_INT_LEVEL (0) // Interrupt active level, 0: low, 1: high + +#endif // ESP_PANEL_BOARD_USE_TOUCH + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +///////////////////////////// Please update the following macros to configure the backlight //////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/** + * @brief Backlight configuration flag (0/1) + * + * Set to `1` to enable backlight support, `0` to disable + */ +#define ESP_PANEL_BOARD_USE_BACKLIGHT (1) + +#if ESP_PANEL_BOARD_USE_BACKLIGHT +/** + * @brief Backlight control type selection + */ +#define ESP_PANEL_BOARD_BACKLIGHT_TYPE (ESP_PANEL_BACKLIGHT_TYPE_PWM_LEDC) + +#if (ESP_PANEL_BOARD_BACKLIGHT_TYPE == ESP_PANEL_BACKLIGHT_TYPE_SWITCH_GPIO) || \ + (ESP_PANEL_BOARD_BACKLIGHT_TYPE == ESP_PANEL_BACKLIGHT_TYPE_SWITCH_EXPANDER) || \ + (ESP_PANEL_BOARD_BACKLIGHT_TYPE == ESP_PANEL_BACKLIGHT_TYPE_PWM_LEDC) + + /** + * @brief Backlight control pin configuration + */ + #define ESP_PANEL_BOARD_BACKLIGHT_IO (8) // Output GPIO pin number + #define ESP_PANEL_BOARD_BACKLIGHT_ON_LEVEL (1) // Active level, 0: low, 1: high + +#endif // ESP_PANEL_BOARD_BACKLIGHT_TYPE + +/** + * @brief Backlight idle state configuration (0/1) + * + * Set to 1 if want to turn off the backlight after initializing. Otherwise, the backlight will be on. + */ +#define ESP_PANEL_BOARD_BACKLIGHT_IDLE_OFF (1) + +#endif // ESP_PANEL_BOARD_USE_BACKLIGHT + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +///////////////////////////// Please update the following macros to configure the IO expander ////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/** + * @brief IO expander configuration flag (0/1) + * + * Set to `1` to enable IO expander support, `0` to disable + */ +#define ESP_PANEL_BOARD_USE_EXPANDER (0) + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////// Please utilize the following macros to execute any additional code if required ///////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/** + * @brief Pre-begin function for board initialization + * + * @param[in] p Pointer to the board object + * @return true on success, false on failure + */ +// #define ESP_PANEL_BOARD_PRE_BEGIN_FUNCTION(p) \ +// { \ +// constexpr gpio_num_t IM0 = static_cast(47); \ +// constexpr gpio_num_t IM1 = static_cast(48); \ +// gpio_set_direction(IM0, GPIO_MODE_OUTPUT); \ +// gpio_set_direction(IM1, GPIO_MODE_OUTPUT); \ +// gpio_set_level(IM0, 0); \ +// gpio_set_level(IM1, 1); \ +// return true; \ +// } + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////// File Version /////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/** + * Do not change the following versions. These version numbers are used to check compatibility between this + * configuration file and the library. Rules for version numbers: + * 1. Major version mismatch: Configurations are incompatible, must use library version + * 2. Minor version mismatch: May be missing new configurations, recommended to update + * 3. Patch version mismatch: No impact on functionality + */ +#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MAJOR 1 +#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MINOR 0 +#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_PATCH 0 + +// *INDENT-ON* diff --git a/src/board/supported/viewe/BOARD_VIEWE_UEDX46460015_MD50ET.h b/src/board/supported/viewe/BOARD_VIEWE_UEDX46460015_MD50ET.h new file mode 100644 index 00000000..d846d5fd --- /dev/null +++ b/src/board/supported/viewe/BOARD_VIEWE_UEDX46460015_MD50ET.h @@ -0,0 +1,313 @@ +/* + * SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +/** + * @file BOARD_VIEWE_UEDX46460015_MD50ET.h + * @brief Configuration file for Viewe UEDX46460015-MD50ET + * @author Viewe@VIEWESMART + * @link https://github.com/VIEWESMART/UEDX46460015-MD50ESP32-1.5inch-Touch-Knob-Display + */ + +#pragma once + +// *INDENT-OFF* + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////// Please update the following macros to configure general panel ///////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/** + * @brief Board name + */ +#define ESP_PANEL_BOARD_NAME "Viewe:UEDX46460015-MD50ET" + +/** + * @brief Panel resolution configuration in pixels + */ +#define ESP_PANEL_BOARD_WIDTH (472) // Panel width (horizontal, in pixels) +#define ESP_PANEL_BOARD_HEIGHT (466) // Panel height (vertical, in pixels) + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////// Please update the following macros to configure the LCD panel ///////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/** + * @brief LCD panel configuration flag (0/1) + * + * Set to `1` to enable LCD panel support, `0` to disable + */ +#define ESP_PANEL_BOARD_USE_LCD (1) + +#if ESP_PANEL_BOARD_USE_LCD +/** + * @brief LCD controller selection + */ +#define ESP_PANEL_BOARD_LCD_CONTROLLER SH8601 + +/** + * @brief LCD bus type selection + * + * Supported bus types: + * - `ESP_PANEL_BUS_TYPE_SPI` + * - `ESP_PANEL_BUS_TYPE_QSPI` + * - `ESP_PANEL_BUS_TYPE_RGB` (ESP32-S3 only) + * - `ESP_PANEL_BUS_TYPE_MIPI_DSI` (ESP32-P4 only) + */ +#define ESP_PANEL_BOARD_LCD_BUS_TYPE (ESP_PANEL_BUS_TYPE_QSPI) + +#if (ESP_PANEL_BOARD_LCD_BUS_TYPE == ESP_PANEL_BUS_TYPE_SPI) || \ + (ESP_PANEL_BOARD_LCD_BUS_TYPE == ESP_PANEL_BUS_TYPE_QSPI) +/** + * If set to 1, the bus will skip to initialize the corresponding host. Users need to initialize the host in advance. + * + * For drivers which created by this library, even if they use the same host, the host will be initialized only once. + * So it is not necessary to set the macro to `1`. For other drivers (like `Wire`), please set the macro to `1` + * ensure that the host is initialized only once. + */ +#define ESP_PANEL_BOARD_LCD_BUS_SKIP_INIT_HOST (0) // 0/1. Typically set to 0 +#endif + +/** + * @brief LCD bus parameters configuration + * + * Configure parameters based on the selected bus type. Parameters for other bus types will be ignored. + * For detailed parameter explanations, see: + * https://docs.espressif.com/projects/esp-idf/en/v5.3.1/esp32s3/api-reference/peripherals/lcd/index.html + * https://docs.espressif.com/projects/esp-iot-solution/en/latest/display/lcd/index.html + */ +#if ESP_PANEL_BOARD_LCD_BUS_TYPE == ESP_PANEL_BUS_TYPE_QSPI + +/** + * @brief QSPI bus + */ +/* For general */ +#define ESP_PANEL_BOARD_LCD_QSPI_HOST_ID (1) // Typically set to 1 +#if !ESP_PANEL_BOARD_LCD_BUS_SKIP_INIT_HOST +/* For host */ +#define ESP_PANEL_BOARD_LCD_QSPI_IO_SCK (10) +#define ESP_PANEL_BOARD_LCD_QSPI_IO_DATA0 (13) +#define ESP_PANEL_BOARD_LCD_QSPI_IO_DATA1 (11) +#define ESP_PANEL_BOARD_LCD_QSPI_IO_DATA2 (14) +#define ESP_PANEL_BOARD_LCD_QSPI_IO_DATA3 (9) +#endif // ESP_PANEL_BOARD_LCD_BUS_SKIP_INIT_HOST +/* For panel */ +#define ESP_PANEL_BOARD_LCD_QSPI_IO_CS (12) // -1 if not used +#define ESP_PANEL_BOARD_LCD_QSPI_MODE (0) // 0-3, typically set to 0 +#define ESP_PANEL_BOARD_LCD_QSPI_CLK_HZ (40 * 1000 * 1000) + // Should be an integer divisor of 80M, typically set to 40M +#define ESP_PANEL_BOARD_LCD_QSPI_CMD_BITS (32) // Typically set to 32 +#define ESP_PANEL_BOARD_LCD_QSPI_PARAM_BITS (8) // Typically set to 8 + +#endif // ESP_PANEL_BOARD_LCD_BUS_TYPE + +/** + * @brief LCD vendor initialization commands + * + * Vendor specific initialization can be different between manufacturers, should consult the LCD supplier for + * initialization sequence code. Please uncomment and change the following macro definitions. Otherwise, the LCD driver + * will use the default initialization sequence code. + * + * The initialization sequence can be specified in two formats: + * 1. Raw format: + * {command, (uint8_t []){data0, data1, ...}, data_size, delay_ms} + * 2. Helper macros: + * - ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(delay_ms, command, {data0, data1, ...}) + * - ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(delay_ms, command) + */ +#define ESP_PANEL_BOARD_LCD_VENDOR_INIT_CMD() \ +{ \ + {0xFE, (uint8_t []){0x00}, 0, 0}, \ + {0xC4, (uint8_t []){0x80}, 1, 0}, \ + {0x3A, (uint8_t []){0x55}, 1, 0}, \ + {0x35, (uint8_t []){0x00}, 0, 10}, \ + {0x53, (uint8_t []){0x20}, 1, 10}, \ + {0x51, (uint8_t []){0xFF}, 1, 10}, \ + {0x63, (uint8_t []){0xFF}, 1, 10}, \ + {0x2A, (uint8_t []){0x00,0x06,0x01,0xDD}, 4, 0}, \ + {0x2B, (uint8_t []){0x00,0x00,0x01,0xD1}, 4, 0}, \ + {0x11, (uint8_t []){0x00}, 0, 60}, \ + {0x29, (uint8_t []){0x00}, 0, 0}, \ +} +/** + * @brief LCD color configuration + */ +#define ESP_PANEL_BOARD_LCD_COLOR_BITS (ESP_PANEL_LCD_COLOR_BITS_RGB565) + // ESP_PANEL_LCD_COLOR_BITS_RGB565/RGB666/RGB888 +#define ESP_PANEL_BOARD_LCD_COLOR_BGR_ORDER (0) // 0: RGB, 1: BGR +#define ESP_PANEL_BOARD_LCD_COLOR_INEVRT_BIT (0) // 0/1 + +/** + * @brief LCD transformation configuration + */ +#define ESP_PANEL_BOARD_LCD_SWAP_XY (0) // 0/1 +#define ESP_PANEL_BOARD_LCD_MIRROR_X (0) // 0/1 +#define ESP_PANEL_BOARD_LCD_MIRROR_Y (0) // 0/1 +#define ESP_PANEL_BOARD_LCD_GAP_X (0) // [0, ESP_PANEL_BOARD_WIDTH] +#define ESP_PANEL_BOARD_LCD_GAP_Y (0) // [0, ESP_PANEL_BOARD_HEIGHT] + +/** + * @brief LCD reset pin configuration + */ +#define ESP_PANEL_BOARD_LCD_RST_IO (8) // Reset pin, -1 if not used +#define ESP_PANEL_BOARD_LCD_RST_LEVEL (0) // Reset active level, 0: low, 1: high + +#endif // ESP_PANEL_BOARD_USE_LCD + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////// Please update the following macros to configure the touch panel /////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/** + * @brief Touch panel configuration flag (0/1) + * + * Set to `1` to enable touch panel support, `0` to disable + */ +#define ESP_PANEL_BOARD_USE_TOUCH (1) + +#if ESP_PANEL_BOARD_USE_TOUCH +/** + * @brief Touch controller selection + */ +#define ESP_PANEL_BOARD_TOUCH_CONTROLLER CST820 + +/** + * @brief Touch bus type selection + * - `ESP_PANEL_BUS_TYPE_SPI` + */ +#define ESP_PANEL_BOARD_TOUCH_BUS_TYPE (ESP_PANEL_BUS_TYPE_I2C) + +#if (ESP_PANEL_BOARD_TOUCH_BUS_TYPE == ESP_PANEL_BUS_TYPE_I2C) || \ + (ESP_PANEL_BOARD_TOUCH_BUS_TYPE == ESP_PANEL_BUS_TYPE_SPI) +/** + * If set to 1, the bus will skip to initialize the corresponding host. Users need to initialize the host in advance. + * + * For drivers which created by this library, even if they use the same host, the host will be initialized only once. + * So it is not necessary to set the macro to `1`. For other drivers (like `Wire`), please set the macro to `1` + * ensure that the host is initialized only once. + */ +#define ESP_PANEL_BOARD_TOUCH_BUS_SKIP_INIT_HOST (0) // 0/1. Typically set to 0 +#endif + +/** + * @brief Touch bus parameters configuration + */ +#if ESP_PANEL_BOARD_TOUCH_BUS_TYPE == ESP_PANEL_BUS_TYPE_I2C + + /** + * @brief I2C bus + */ + /* For general */ + #define ESP_PANEL_BOARD_TOUCH_I2C_HOST_ID (1) // Typically set to 0 +#if !ESP_PANEL_BOARD_TOUCH_BUS_SKIP_INIT_HOST + /* For host */ + #define ESP_PANEL_BOARD_TOUCH_I2C_CLK_HZ (400 * 1000) + // Typically set to 400K + #define ESP_PANEL_BOARD_TOUCH_I2C_SCL_PULLUP (1) // 0/1. Typically set to 1 + #define ESP_PANEL_BOARD_TOUCH_I2C_SDA_PULLUP (1) // 0/1. Typically set to 1 + #define ESP_PANEL_BOARD_TOUCH_I2C_IO_SCL (3) + #define ESP_PANEL_BOARD_TOUCH_I2C_IO_SDA (1) +#endif + /* For panel */ + #define ESP_PANEL_BOARD_TOUCH_I2C_ADDRESS (0) // Typically set to 0 to use the default address. + // - For touchs with only one address, set to 0 + // - For touchs with multiple addresses, set to 0 or + // the address. Like GT911, there are two addresses: + // 0x5D(default) and 0x14 + +#endif // ESP_PANEL_BOARD_TOUCH_BUS_TYPE + +/** + * @brief Touch panel transformation flags + */ +#define ESP_PANEL_BOARD_TOUCH_SWAP_XY (0) // 0/1 +#define ESP_PANEL_BOARD_TOUCH_MIRROR_X (0) // 0/1 +#define ESP_PANEL_BOARD_TOUCH_MIRROR_Y (0) // 0/1 + +/** + * @brief Touch panel control pins + */ +#define ESP_PANEL_BOARD_TOUCH_RST_IO (-1) // Reset pin, -1 if not used +#define ESP_PANEL_BOARD_TOUCH_RST_LEVEL (0) // Reset active level, 0: low, 1: high +#define ESP_PANEL_BOARD_TOUCH_INT_IO (-1) // Interrupt pin, -1 if not used +#define ESP_PANEL_BOARD_TOUCH_INT_LEVEL (0) // Interrupt active level, 0: low, 1: high + +#endif // ESP_PANEL_BOARD_USE_TOUCH + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +///////////////////////////// Please update the following macros to configure the backlight //////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/** + * @brief Backlight configuration flag (0/1) + * + * Set to `1` to enable backlight support, `0` to disable + */ +#define ESP_PANEL_BOARD_USE_BACKLIGHT (0) + +#if ESP_PANEL_BOARD_USE_BACKLIGHT +/** + * @brief Backlight control type selection + */ +#define ESP_PANEL_BOARD_BACKLIGHT_TYPE (ESP_PANEL_BACKLIGHT_TYPE_PWM_LEDC) + +#if (ESP_PANEL_BOARD_BACKLIGHT_TYPE == ESP_PANEL_BACKLIGHT_TYPE_SWITCH_GPIO) || \ + (ESP_PANEL_BOARD_BACKLIGHT_TYPE == ESP_PANEL_BACKLIGHT_TYPE_SWITCH_EXPANDER) || \ + (ESP_PANEL_BOARD_BACKLIGHT_TYPE == ESP_PANEL_BACKLIGHT_TYPE_PWM_LEDC) + + /** + * @brief Backlight control pin configuration + */ + #define ESP_PANEL_BOARD_BACKLIGHT_IO (17) // Output GPIO pin number + #define ESP_PANEL_BOARD_BACKLIGHT_ON_LEVEL (1) // Active level, 0: low, 1: high + +#endif // ESP_PANEL_BOARD_BACKLIGHT_TYPE + +/** + * @brief Backlight idle state configuration (0/1) + * + * Set to 1 if want to turn off the backlight after initializing. Otherwise, the backlight will be on. + */ +#define ESP_PANEL_BOARD_BACKLIGHT_IDLE_OFF (1) + +#endif // ESP_PANEL_BOARD_USE_BACKLIGHT + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +///////////////////////////// Please update the following macros to configure the IO expander ////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/** + * @brief IO expander configuration flag (0/1) + * + * Set to `1` to enable IO expander support, `0` to disable + */ +#define ESP_PANEL_BOARD_USE_EXPANDER (0) + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////// Please utilize the following macros to execute any additional code if required ///////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/** + * @brief Pre-begin function for board initialization + * + * @param[in] p Pointer to the board object + * @return true on success, false on failure + */ +#define ESP_PANEL_BOARD_PRE_BEGIN_FUNCTION(p) \ + { \ + constexpr gpio_num_t BL = static_cast(17); \ + gpio_set_direction(BL, GPIO_MODE_OUTPUT); \ + gpio_set_level(BL, 1); \ + return true; \ + } + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////// File Version /////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/** + * Do not change the following versions. These version numbers are used to check compatibility between this + * configuration file and the library. Rules for version numbers: + * 1. Major version mismatch: Configurations are incompatible, must use library version + * 2. Minor version mismatch: May be missing new configurations, recommended to update + * 3. Patch version mismatch: No impact on functionality + */ +#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MAJOR 1 +#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MINOR 0 +#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_PATCH 0 + +// *INDENT-ON* diff --git a/src/board/supported/viewe/BOARD_VIEWE_UEDX48480021_MD80E.h b/src/board/supported/viewe/BOARD_VIEWE_UEDX48480021_MD80E.h new file mode 100644 index 00000000..bff0f4f7 --- /dev/null +++ b/src/board/supported/viewe/BOARD_VIEWE_UEDX48480021_MD80E.h @@ -0,0 +1,369 @@ +/* + * SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +/** + * @file BOARD_VIEWE_UEDX48480021_MD80E.h + * @brief Configuration file for Viewe UEDX48480021-MD80E + * @author Viewe@VIEWESMART + * @link https://github.com/VIEWESMART/UEDX48480021-MD80ESP32_2.1inch-Knob + */ + +#pragma once + +// *INDENT-OFF* + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////// Please update the following macros to configure general panel ///////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/** + * @brief Board name + */ +#define ESP_PANEL_BOARD_NAME "Viewe:UEDX48480021-MD80E" + +/** + * @brief Panel resolution configuration in pixels + */ +#define ESP_PANEL_BOARD_WIDTH (480) // Panel width (horizontal, in pixels) +#define ESP_PANEL_BOARD_HEIGHT (480) // Panel height (vertical, in pixels) + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////// Please update the following macros to configure the LCD panel ///////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/** + * @brief LCD panel configuration flag (0/1) + * + * Set to `1` to enable LCD panel support, `0` to disable + */ +#define ESP_PANEL_BOARD_USE_LCD (1) + +#if ESP_PANEL_BOARD_USE_LCD +/** + * @brief LCD controller selection + */ +#define ESP_PANEL_BOARD_LCD_CONTROLLER GC9503 + +/** + * @brief LCD bus type selection + */ +#define ESP_PANEL_BOARD_LCD_BUS_TYPE (ESP_PANEL_BUS_TYPE_RGB) + +/** + * @brief LCD bus parameters configuration + * + * Configure parameters based on the selected bus type. Parameters for other bus types will be ignored. + * For detailed parameter explanations, see: + * https://docs.espressif.com/projects/esp-idf/en/v5.3.1/esp32s3/api-reference/peripherals/lcd/index.html + * https://docs.espressif.com/projects/esp-iot-solution/en/latest/display/lcd/index.html + */ +#if ESP_PANEL_BOARD_LCD_BUS_TYPE == ESP_PANEL_BUS_TYPE_RGB + + /** + * @brief RGB bus + */ + /** + * Set to 0 if using simple "RGB" interface which does not contain "3-wire SPI" interface. + */ + #define ESP_PANEL_BOARD_LCD_RGB_USE_CONTROL_PANEL (1) // 0/1. Typically set to 1 + +#if ESP_PANEL_BOARD_LCD_RGB_USE_CONTROL_PANEL + /* For control panel (3wire-SPI) */ + #define ESP_PANEL_BOARD_LCD_RGB_SPI_IO_CS (18) + #define ESP_PANEL_BOARD_LCD_RGB_SPI_IO_SCK (13) + #define ESP_PANEL_BOARD_LCD_RGB_SPI_IO_SDA (12) + #define ESP_PANEL_BOARD_LCD_RGB_SPI_CS_USE_EXPNADER (0) // Set to 1 if the signal is controlled by an IO expander + #define ESP_PANEL_BOARD_LCD_RGB_SPI_SCL_USE_EXPNADER (0) // Set to 1 if the signal is controlled by an IO expander + #define ESP_PANEL_BOARD_LCD_RGB_SPI_SDA_USE_EXPNADER (0) // Set to 1 if the signal is controlled by an IO expander + #define ESP_PANEL_BOARD_LCD_RGB_SPI_MODE (0) // 0-3, typically set to 0 + #define ESP_PANEL_BOARD_LCD_RGB_SPI_CMD_BYTES (1) // Typically set to 8 + #define ESP_PANEL_BOARD_LCD_RGB_SPI_PARAM_BYTES (1) // Typically set to 8 + #define ESP_PANEL_BOARD_LCD_RGB_SPI_USE_DC_BIT (1) // 0/1. Typically set to 1 +#endif // ESP_PANEL_BOARD_LCD_RGB_USE_CONTROL_PANEL + /* For refresh panel (RGB) */ + #define ESP_PANEL_BOARD_LCD_RGB_CLK_HZ (16 * 1000 * 1000) + // To increase the upper limit of the PCLK, see: https://docs.espressif.com/projects/esp-faq/en/latest/software-framework/peripherals/lcd.html#how-can-i-increase-the-upper-limit-of-pclk-settings-on-esp32-s3-while-ensuring-normal-rgb-screen-display + #define ESP_PANEL_BOARD_LCD_RGB_HPW (8) + #define ESP_PANEL_BOARD_LCD_RGB_HBP (20) + #define ESP_PANEL_BOARD_LCD_RGB_HFP (40) + #define ESP_PANEL_BOARD_LCD_RGB_VPW (8) + #define ESP_PANEL_BOARD_LCD_RGB_VBP (20) + #define ESP_PANEL_BOARD_LCD_RGB_VFP (50) + #define ESP_PANEL_BOARD_LCD_RGB_PCLK_ACTIVE_NEG (0) // 0: rising edge, 1: falling edge. Typically set to 0 + // The following sheet shows the valid combinations of + // data width and pixel bits: + // ┏---------------------------------┳- -------------------------------┓ + #define ESP_PANEL_BOARD_LCD_RGB_DATA_WIDTH (16) // | 16 | 8 | + #define ESP_PANEL_BOARD_LCD_RGB_PIXEL_BITS (ESP_PANEL_LCD_COLOR_BITS_RGB565) // | ESP_PANEL_LCD_COLOR_BITS_RGB565 | ESP_PANEL_LCD_COLOR_BITS_RGB888 | + // ┗---------------------------------┻---------------------------------┛ + // To understand color format of RGB LCD, see: https://docs.espressif.com/projects/esp-iot-solution/en/latest/display/lcd/rgb_lcd.html#color-formats + #define ESP_PANEL_BOARD_LCD_RGB_BOUNCE_BUF_SIZE (ESP_PANEL_BOARD_WIDTH * 10) + // Bounce buffer size in bytes. It is used to avoid screen drift + // for ESP32-S3. Typically set to `ESP_PANEL_BOARD_WIDTH * 10` + // The size should satisfy `size * N = LCD_width * LCD_height`, + // where N is an even number. + // For more details, see: https://github.com/esp-arduino-libs/ESP32_Display_Panel/blob/master/docs/FAQ.md#how-to-fix-screen-drift-issue-when-driving-rgb-lcd-with-esp32-s3 + #define ESP_PANEL_BOARD_LCD_RGB_IO_HSYNC (46) + #define ESP_PANEL_BOARD_LCD_RGB_IO_VSYNC (3) + #define ESP_PANEL_BOARD_LCD_RGB_IO_DE (17) // -1 if not used + #define ESP_PANEL_BOARD_LCD_RGB_IO_PCLK (9) + #define ESP_PANEL_BOARD_LCD_RGB_IO_DISP (-1) // -1 if not used. Typically set to -1 + + // The following sheet shows the mapping of ESP GPIOs to + // LCD data pins with different data width and color format: + // ┏------┳- ------------┳--------------------------┓ + // | ESP: | 8-bit RGB888 | 16-bit RGB565 | + // |------|--------------|--------------------------| + // | LCD: | RGB888 | RGB565 | RGB666 | RGB888 | + // ┗------|--------------|--------|--------|--------| + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA0 (10) // | D0 | B0 | B0-1 | B0-3 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA1 (11) // | D1 | B1 | B2 | B4 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA2 (12) // | D2 | B2 | B3 | B5 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA3 (13) // | D3 | B3 | B4 | B6 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA4 (14) // | D4 | B4 | B5 | B7 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA5 (21) // | D5 | G0 | G0 | G0-2 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA6 (47) // | D6 | G1 | G1 | G3 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA7 (48) // | D7 | G2 | G2 | G4 | +#if ESP_PANEL_BOARD_LCD_RGB_DATA_WIDTH > 8 // ┗--------------┫--------|--------|--------| + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA8 (45) // | G3 | G3 | G5 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA9 (38) // | G4 | G4 | G6 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA10 (39) // | G5 | G5 | G7 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA11 (40) // | R0 | R0-1 | R0-3 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA12 (41) // | R1 | R2 | R4 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA13 (42) // | R2 | R3 | R5 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA14 (2) // | R3 | R4 | R6 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA15 (1) // | R4 | R5 | R7 | + // ┗--------┻--------┻--------┛ +#endif // ESP_PANEL_BOARD_LCD_RGB_DATA_WIDTH + +#endif // ESP_PANEL_BOARD_LCD_BUS_TYPE + +#define ESP_PANEL_BOARD_LCD_VENDOR_INIT_CMD() \ +{ \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xF0, {0x55, 0xAA, 0x52, 0x08, 0x00}), \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xF6, {0x5A, 0x87}), \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC1, {0x3F}), \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xCD, {0x25}), \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xCD, {0x00}), \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC9, {0x10}), \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xF8, {0x8A}), \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xAC, {0x45}), \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xA7, {0x47}), \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xA0, {0xDD}), \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0x87, {0x04, 0x03, 0x66}), \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0x86, {0x99, 0xa3, 0xa3, 0x51}), \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xFA, {0x08, 0x08, 0x08, 0x04}), \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0x9A, {0x8a}), \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0x9B, {0x62}), \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0x82, {0x48, 0x48}), \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xB1, {0x10}), \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0x7A, {0x13, 0x1A}), \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0x7B, {0x13, 0x1A}), \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0x6D, {0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x02, 0x0b, 0x01, 0x00, 0x1f, 0x1e, 0x09, 0x0f, 0x1e, 0x1e, 0x1e, 0x1e, 0x10, 0x0a, 0x1e, 0x1f, 0x00, 0x08, 0x0b, 0x02, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e}), \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0x64, {0x18, 0x07, 0x01, 0xE7, 0x03, 0x03, 0x18, 0x06, 0x01, 0xE6, 0x03, 0x03, 0x7a, 0x7a, 0x7a, 0x7a}), \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0x65, {0x58, 0x26, 0x18, 0x2c, 0x03, 0x03, 0x58, 0x26, 0x18, 0x2c, 0x03, 0x03, 0x7a, 0x7a, 0x7a, 0x7a}), \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0x66, {0x58, 0x26, 0x18, 0x2c, 0x03, 0x03, 0x58, 0x26, 0x18, 0x2c, 0x03, 0x03, 0x7a, 0x7a, 0x7a, 0x7a}), \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0x67, {0x18, 0x05, 0x01, 0xE5, 0x03, 0x03, 0x18, 0x04, 0x01, 0xE4, 0x03, 0x03, 0x7a, 0x7a, 0x7a, 0x7a}), \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0x60, {0x18, 0x09, 0x7A, 0x7A, 0x51, 0xF1, 0x7A, 0x7A}), \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0x63, {0x51, 0xF1, 0x7A, 0x7A, 0x18, 0x08, 0x7A, 0x7A}), \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xD1, {0x00, 0x00, 0x00, 0x0E, 0x00, 0x31, 0x00, 0x4E, 0x00, 0x67, 0x00, 0x92, 0x00, 0xB5, 0x00, 0xED, 0x01, 0x1C, 0x01, 0x66, 0x01, 0xA4, 0x02, 0x04, 0x02, 0x53, 0x02, 0x56, 0x02, 0x9F, 0x02, 0xF3, 0x03, 0x29, 0x03, 0x73, 0x03, 0xA1, 0x03, 0xB9, 0x03, 0xC8, 0x03, 0xDB, 0x03, 0xE7, 0x03, 0xF4, 0x03, 0xFB, 0x03, 0XFF}), \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xD2, {0x00, 0x00, 0x00, 0x0E, 0x00, 0x31, 0x00, 0x4E, 0x00, 0x67, 0x00, 0x92, 0x00, 0xB5, 0x00, 0xED, 0x01, 0x1C, 0x01, 0x66, 0x01, 0xA4, 0x02, 0x04, 0x02, 0x53, 0x02, 0x56, 0x02, 0x9F, 0x02, 0xF3, 0x03, 0x29, 0x03, 0x73, 0x03, 0xA1, 0x03, 0xB9, 0x03, 0xC8, 0x03, 0xDB, 0x03, 0xE7, 0x03, 0xF4, 0x03, 0xFB, 0x03, 0XFF}), \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xD3, {0x00, 0x00, 0x00, 0x0E, 0x00, 0x31, 0x00, 0x4E, 0x00, 0x67, 0x00, 0x92, 0x00, 0xB5, 0x00, 0xED, 0x01, 0x1C, 0x01, 0x66, 0x01, 0xA4, 0x02, 0x04, 0x02, 0x53, 0x02, 0x56, 0x02, 0x9F, 0x02, 0xF3, 0x03, 0x29, 0x03, 0x73, 0x03, 0xA1, 0x03, 0xB9, 0x03, 0xC8, 0x03, 0xDB, 0x03, 0xE7, 0x03, 0xF4, 0x03, 0xFB, 0x03, 0XFF}), \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xD4, {0x00, 0x00, 0x00, 0x0E, 0x00, 0x31, 0x00, 0x4E, 0x00, 0x67, 0x00, 0x92, 0x00, 0xB5, 0x00, 0xED, 0x01, 0x1C, 0x01, 0x66, 0x01, 0xA4, 0x02, 0x04, 0x02, 0x53, 0x02, 0x56, 0x02, 0x9F, 0x02, 0xF3, 0x03, 0x29, 0x03, 0x73, 0x03, 0xA1, 0x03, 0xB9, 0x03, 0xC8, 0x03, 0xDB, 0x03, 0xE7, 0x03, 0xF4, 0x03, 0xFB, 0x03, 0XFF}), \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xD5, {0x00, 0x00, 0x00, 0x0E, 0x00, 0x31, 0x00, 0x4E, 0x00, 0x67, 0x00, 0x92, 0x00, 0xB5, 0x00, 0xED, 0x01, 0x1C, 0x01, 0x66, 0x01, 0xA4, 0x02, 0x04, 0x02, 0x53, 0x02, 0x56, 0x02, 0x9F, 0x02, 0xF3, 0x03, 0x29, 0x03, 0x73, 0x03, 0xA1, 0x03, 0xB9, 0x03, 0xC8, 0x03, 0xDB, 0x03, 0xE7, 0x03, 0xF4, 0x03, 0xFB, 0x03, 0XFF}), \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xD6, {0x00, 0x00, 0x00, 0x0E, 0x00, 0x31, 0x00, 0x4E, 0x00, 0x67, 0x00, 0x92, 0x00, 0xB5, 0x00, 0xED, 0x01, 0x1C, 0x01, 0x66, 0x01, 0xA4, 0x02, 0x04, 0x02, 0x53, 0x02, 0x56, 0x02, 0x9F, 0x02, 0xF3, 0x03, 0x29, 0x03, 0x73, 0x03, 0xA1, 0x03, 0xB9, 0x03, 0xC8, 0x03, 0xDB, 0x03, 0xE7, 0x03, 0xF4, 0x03, 0xFB, 0x03, 0XFF}), \ + ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(120, 0x11), \ + ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(120, 0x29), \ +} + +/** + * @brief LCD specific flags configuration + * + * These flags are specific to the "3-wire SPI + RGB" bus. + */ +#if (ESP_PANEL_BOARD_LCD_BUS_TYPE == ESP_PANEL_BUS_TYPE_RGB) && ESP_PANEL_BOARD_LCD_RGB_USE_CONTROL_PANEL +/** + * @brief Enable IO multiplex + * + * Set to 1 if the 3-wire SPI pins are sharing other pins of the RGB interface to save GPIOs. Then, the control panel + * and its pins (except CS signal) will be released after LCD call `init()`. All `*_by_cmd` flags will be invalid. + */ +#define ESP_PANEL_BOARD_LCD_FLAGS_ENABLE_IO_MULTIPLEX (1) // typically set to 0 +/** + * @brief Mirror by command + * + * Set to 1 if the `mirror()` function will be implemented by LCD command. Otherwise, the function will be implemented by + * software. Only valid when `ESP_PANEL_BOARD_LCD_FLAGS_ENABLE_IO_MULTIPLEX` is 0. + */ +#define ESP_PANEL_BOARD_LCD_FLAGS_MIRROR_BY_CMD (!ESP_PANEL_BOARD_LCD_FLAGS_ENABLE_IO_MULTIPLEX) +#endif // ESP_PANEL_BOARD_LCD_RGB_USE_CONTROL_PANEL + +/** + * @brief LCD color configuration + */ +#define ESP_PANEL_BOARD_LCD_COLOR_BITS (ESP_PANEL_LCD_COLOR_BITS_RGB888) + // ESP_PANEL_LCD_COLOR_BITS_RGB565/RGB666/RGB888 +#define ESP_PANEL_BOARD_LCD_COLOR_BGR_ORDER (0) // 0: RGB, 1: BGR +#define ESP_PANEL_BOARD_LCD_COLOR_INEVRT_BIT (0) // 0/1 + +/** + * @brief LCD transformation configuration + */ +#define ESP_PANEL_BOARD_LCD_SWAP_XY (0) // 0/1 +#define ESP_PANEL_BOARD_LCD_MIRROR_X (0) // 0/1 +#define ESP_PANEL_BOARD_LCD_MIRROR_Y (0) // 0/1 +#define ESP_PANEL_BOARD_LCD_GAP_X (0) // [0, ESP_PANEL_BOARD_WIDTH] +#define ESP_PANEL_BOARD_LCD_GAP_Y (0) // [0, ESP_PANEL_BOARD_HEIGHT] + +/** + * @brief LCD reset pin configuration + */ +#define ESP_PANEL_BOARD_LCD_RST_IO (8) // Reset pin, -1 if not used +#define ESP_PANEL_BOARD_LCD_RST_LEVEL (0) // Reset active level, 0: low, 1: high + +#endif // ESP_PANEL_BOARD_USE_LCD + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////// Please update the following macros to configure the touch panel /////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/** + * @brief Touch panel configuration flag (0/1) + * + * Set to `1` to enable touch panel support, `0` to disable + */ +#define ESP_PANEL_BOARD_USE_TOUCH (0) + +#if ESP_PANEL_BOARD_USE_TOUCH +/** + * @brief Touch controller selection + */ +#define ESP_PANEL_BOARD_TOUCH_CONTROLLER FT5x06 + +/** + * @brief Touch bus type selection + */ +#define ESP_PANEL_BOARD_TOUCH_BUS_TYPE (ESP_PANEL_BUS_TYPE_I2C) + +#if (ESP_PANEL_BOARD_TOUCH_BUS_TYPE == ESP_PANEL_BUS_TYPE_I2C) || \ + (ESP_PANEL_BOARD_TOUCH_BUS_TYPE == ESP_PANEL_BUS_TYPE_SPI) +/** + * If set to 1, the bus will skip to initialize the corresponding host. Users need to initialize the host in advance. + * + * For drivers which created by this library, even if they use the same host, the host will be initialized only once. + * So it is not necessary to set the macro to `1`. For other drivers (like `Wire`), please set the macro to `1` + * ensure that the host is initialized only once. + */ +#define ESP_PANEL_BOARD_TOUCH_BUS_SKIP_INIT_HOST (0) // 0/1. Typically set to 0 +#endif + +/** + * @brief Touch bus parameters configuration + */ +#if ESP_PANEL_BOARD_TOUCH_BUS_TYPE == ESP_PANEL_BUS_TYPE_I2C + + /** + * @brief I2C bus + */ + /* For general */ + #define ESP_PANEL_BOARD_TOUCH_I2C_HOST_ID (0) // Typically set to 0 +#if !ESP_PANEL_BOARD_TOUCH_BUS_SKIP_INIT_HOST + /* For host */ + #define ESP_PANEL_BOARD_TOUCH_I2C_CLK_HZ (400 * 1000) + // Typically set to 400K + #define ESP_PANEL_BOARD_TOUCH_I2C_SCL_PULLUP (1) // 0/1. Typically set to 1 + #define ESP_PANEL_BOARD_TOUCH_I2C_SDA_PULLUP (1) // 0/1. Typically set to 1 + #define ESP_PANEL_BOARD_TOUCH_I2C_IO_SCL (41) + #define ESP_PANEL_BOARD_TOUCH_I2C_IO_SDA (40) +#endif + /* For panel */ + #define ESP_PANEL_BOARD_TOUCH_I2C_ADDRESS (0) // Typically set to 0 to use the default address. + // - For touchs with only one address, set to 0 + // - For touchs with multiple addresses, set to 0 or + // the address. Like GT911, there are two addresses: + // 0x5D(default) and 0x14 + +#endif // ESP_PANEL_BOARD_TOUCH_BUS_TYPE + +/** + * @brief Touch panel transformation flags + */ +#define ESP_PANEL_BOARD_TOUCH_SWAP_XY (0) // 0/1 +#define ESP_PANEL_BOARD_TOUCH_MIRROR_X (0) // 0/1 +#define ESP_PANEL_BOARD_TOUCH_MIRROR_Y (0) // 0/1 + +/** + * @brief Touch panel control pins + */ +#define ESP_PANEL_BOARD_TOUCH_RST_IO (-1) // Reset pin, -1 if not used +#define ESP_PANEL_BOARD_TOUCH_RST_LEVEL (0) // Reset active level, 0: low, 1: high +#define ESP_PANEL_BOARD_TOUCH_INT_IO (-1) // Interrupt pin, -1 if not used +#define ESP_PANEL_BOARD_TOUCH_INT_LEVEL (0) // Interrupt active level, 0: low, 1: high + +#endif // ESP_PANEL_BOARD_USE_TOUCH + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +///////////////////////////// Please update the following macros to configure the backlight //////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/** + * @brief Backlight configuration flag (0/1) + * + * Set to `1` to enable backlight support, `0` to disable + */ +#define ESP_PANEL_BOARD_USE_BACKLIGHT (1) + +#if ESP_PANEL_BOARD_USE_BACKLIGHT +/** + * @brief Backlight control type selection + */ +#define ESP_PANEL_BOARD_BACKLIGHT_TYPE (ESP_PANEL_BACKLIGHT_TYPE_PWM_LEDC) + +#if (ESP_PANEL_BOARD_BACKLIGHT_TYPE == ESP_PANEL_BACKLIGHT_TYPE_SWITCH_GPIO) || \ + (ESP_PANEL_BOARD_BACKLIGHT_TYPE == ESP_PANEL_BACKLIGHT_TYPE_SWITCH_EXPANDER) || \ + (ESP_PANEL_BOARD_BACKLIGHT_TYPE == ESP_PANEL_BACKLIGHT_TYPE_PWM_LEDC) + + /** + * @brief Backlight control pin configuration + */ + #define ESP_PANEL_BOARD_BACKLIGHT_IO (7) // Output GPIO pin number + #define ESP_PANEL_BOARD_BACKLIGHT_ON_LEVEL (0) // Active level, 0: low, 1: high + +#endif // ESP_PANEL_BOARD_BACKLIGHT_TYPE + +/** + * @brief Backlight idle state configuration (0/1) + * + * Set to 1 if want to turn off the backlight after initializing. Otherwise, the backlight will be on. + */ +#define ESP_PANEL_BOARD_BACKLIGHT_IDLE_OFF (0) + +#endif // ESP_PANEL_BOARD_USE_BACKLIGHT + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +///////////////////////////// Please update the following macros to configure the IO expander ////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/** + * @brief IO expander configuration flag (0/1) + * + * Set to `1` to enable IO expander support, `0` to disable + */ +#define ESP_PANEL_BOARD_USE_EXPANDER (0) + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////// Please utilize the following macros to execute any additional code if required ///////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////// File Version /////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/** + * Do not change the following versions. These version numbers are used to check compatibility between this + * configuration file and the library. Rules for version numbers: + * 1. Major version mismatch: Configurations are incompatible, must use library version + * 2. Minor version mismatch: May be missing new configurations, recommended to update + * 3. Patch version mismatch: No impact on functionality + */ +#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MAJOR 1 +#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MINOR 0 +#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_PATCH 0 + +// *INDENT-ON* diff --git a/src/board/supported/viewe/BOARD_VIEWE_UEDX48480021_MD80ET.h b/src/board/supported/viewe/BOARD_VIEWE_UEDX48480021_MD80ET.h new file mode 100644 index 00000000..9b1e6dcf --- /dev/null +++ b/src/board/supported/viewe/BOARD_VIEWE_UEDX48480021_MD80ET.h @@ -0,0 +1,382 @@ +/* + * SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +/** + * @file BOARD_VIEWE_UEDX48480021_MD80ET.h + * @brief Configuration file for Viewe UEDX48480021-MD80ET + * @author Viewe@VIEWESMART + * @link https://github.com/VIEWESMART/UEDX48480021-MD80ESP32-2.1inch-Touch-Knob-Display + */ + +#pragma once + +// *INDENT-OFF* + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////// Please update the following macros to configure general panel ///////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/** + * @brief Board name + */ +#define ESP_PANEL_BOARD_NAME "Viewe:UEDX48480021-MD80ET" + +/** + * @brief Panel resolution configuration in pixels + */ +#define ESP_PANEL_BOARD_WIDTH (480) // Panel width (horizontal, in pixels) +#define ESP_PANEL_BOARD_HEIGHT (480) // Panel height (vertical, in pixels) + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////// Please update the following macros to configure the LCD panel ///////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/** + * @brief LCD panel configuration flag (0/1) + * + * Set to `1` to enable LCD panel support, `0` to disable + */ +#define ESP_PANEL_BOARD_USE_LCD (1) + +#if ESP_PANEL_BOARD_USE_LCD +/** + * @brief LCD controller selection + */ +#define ESP_PANEL_BOARD_LCD_CONTROLLER GC9503 + +/** + * @brief LCD bus type selection + */ +#define ESP_PANEL_BOARD_LCD_BUS_TYPE (ESP_PANEL_BUS_TYPE_RGB) + +/** + * @brief LCD bus parameters configuration + * + * Configure parameters based on the selected bus type. Parameters for other bus types will be ignored. + * For detailed parameter explanations, see: + * https://docs.espressif.com/projects/esp-idf/en/v5.3.1/esp32s3/api-reference/peripherals/lcd/index.html + * https://docs.espressif.com/projects/esp-iot-solution/en/latest/display/lcd/index.html + */ +#if ESP_PANEL_BOARD_LCD_BUS_TYPE == ESP_PANEL_BUS_TYPE_RGB + + /** + * @brief RGB bus + */ + /** + * Set to 0 if using simple "RGB" interface which does not contain "3-wire SPI" interface. + */ + #define ESP_PANEL_BOARD_LCD_RGB_USE_CONTROL_PANEL (1) // 0/1. Typically set to 1 + + #if ESP_PANEL_BOARD_LCD_RGB_USE_CONTROL_PANEL + /* For control panel (3wire-SPI) */ + #define ESP_PANEL_BOARD_LCD_RGB_SPI_IO_CS (18) + #define ESP_PANEL_BOARD_LCD_RGB_SPI_IO_SCK (13) + #define ESP_PANEL_BOARD_LCD_RGB_SPI_IO_SDA (12) + #define ESP_PANEL_BOARD_LCD_RGB_SPI_CS_USE_EXPNADER (0) // Set to 1 if the signal is controlled by an IO expander + #define ESP_PANEL_BOARD_LCD_RGB_SPI_SCL_USE_EXPNADER (0) // Set to 1 if the signal is controlled by an IO expander + #define ESP_PANEL_BOARD_LCD_RGB_SPI_SDA_USE_EXPNADER (0) // Set to 1 if the signal is controlled by an IO expander + #define ESP_PANEL_BOARD_LCD_RGB_SPI_MODE (0) // 0-3, typically set to 0 + #define ESP_PANEL_BOARD_LCD_RGB_SPI_CMD_BYTES (1) // Typically set to 8 + #define ESP_PANEL_BOARD_LCD_RGB_SPI_PARAM_BYTES (1) // Typically set to 8 + #define ESP_PANEL_BOARD_LCD_RGB_SPI_USE_DC_BIT (1) // 0/1. Typically set to 1 +#endif // ESP_PANEL_BOARD_LCD_RGB_USE_CONTROL_PANEL + /* For refresh panel (RGB) */ + #define ESP_PANEL_BOARD_LCD_RGB_CLK_HZ (16 * 1000 * 1000) + // To increase the upper limit of the PCLK, see: https://docs.espressif.com/projects/esp-faq/en/latest/software-framework/peripherals/lcd.html#how-can-i-increase-the-upper-limit-of-pclk-settings-on-esp32-s3-while-ensuring-normal-rgb-screen-display + #define ESP_PANEL_BOARD_LCD_RGB_HPW (8) + #define ESP_PANEL_BOARD_LCD_RGB_HBP (20) + #define ESP_PANEL_BOARD_LCD_RGB_HFP (40) + #define ESP_PANEL_BOARD_LCD_RGB_VPW (8) + #define ESP_PANEL_BOARD_LCD_RGB_VBP (20) + #define ESP_PANEL_BOARD_LCD_RGB_VFP (50) + #define ESP_PANEL_BOARD_LCD_RGB_PCLK_ACTIVE_NEG (0) // 0: rising edge, 1: falling edge. Typically set to 0 + // The following sheet shows the valid combinations of + // data width and pixel bits: + // ┏---------------------------------┳- -------------------------------┓ + #define ESP_PANEL_BOARD_LCD_RGB_DATA_WIDTH (16) // | 16 | 8 | + #define ESP_PANEL_BOARD_LCD_RGB_PIXEL_BITS (ESP_PANEL_LCD_COLOR_BITS_RGB565) // | ESP_PANEL_LCD_COLOR_BITS_RGB565 | ESP_PANEL_LCD_COLOR_BITS_RGB888 | + // ┗---------------------------------┻---------------------------------┛ + // To understand color format of RGB LCD, see: https://docs.espressif.com/projects/esp-iot-solution/en/latest/display/lcd/rgb_lcd.html#color-formats + #define ESP_PANEL_BOARD_LCD_RGB_BOUNCE_BUF_SIZE (ESP_PANEL_BOARD_WIDTH * 10) + // Bounce buffer size in bytes. It is used to avoid screen drift + // for ESP32-S3. Typically set to `ESP_PANEL_BOARD_WIDTH * 10` + // The size should satisfy `size * N = LCD_width * LCD_height`, + // where N is an even number. + // For more details, see: https://github.com/esp-arduino-libs/ESP32_Display_Panel/blob/master/docs/FAQ.md#how-to-fix-screen-drift-issue-when-driving-rgb-lcd-with-esp32-s3 + #define ESP_PANEL_BOARD_LCD_RGB_IO_HSYNC (46) + #define ESP_PANEL_BOARD_LCD_RGB_IO_VSYNC (3) + #define ESP_PANEL_BOARD_LCD_RGB_IO_DE (17) // -1 if not used + #define ESP_PANEL_BOARD_LCD_RGB_IO_PCLK (9) + #define ESP_PANEL_BOARD_LCD_RGB_IO_DISP (-1) // -1 if not used. Typically set to -1 + + // The following sheet shows the mapping of ESP GPIOs to + // LCD data pins with different data width and color format: + // ┏------┳- ------------┳--------------------------┓ + // | ESP: | 8-bit RGB888 | 16-bit RGB565 | + // |------|--------------|--------------------------| + // | LCD: | RGB888 | RGB565 | RGB666 | RGB888 | + // ┗------|--------------|--------|--------|--------| + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA0 (10) // | D0 | B0 | B0-1 | B0-3 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA1 (11) // | D1 | B1 | B2 | B4 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA2 (12) // | D2 | B2 | B3 | B5 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA3 (13) // | D3 | B3 | B4 | B6 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA4 (14) // | D4 | B4 | B5 | B7 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA5 (21) // | D5 | G0 | G0 | G0-2 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA6 (47) // | D6 | G1 | G1 | G3 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA7 (48) // | D7 | G2 | G2 | G4 | +#if ESP_PANEL_BOARD_LCD_RGB_DATA_WIDTH > 8 // ┗--------------┫--------|--------|--------| + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA8 (45) // | G3 | G3 | G5 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA9 (38) // | G4 | G4 | G6 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA10 (39) // | G5 | G5 | G7 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA11 (40) // | R0 | R0-1 | R0-3 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA12 (41) // | R1 | R2 | R4 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA13 (42) // | R2 | R3 | R5 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA14 (2) // | R3 | R4 | R6 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA15 (1) // | R4 | R5 | R7 | + // ┗--------┻--------┻--------┛ +#endif // ESP_PANEL_BOARD_LCD_RGB_DATA_WIDTH + +#endif // ESP_PANEL_BOARD_LCD_BUS_TYPE + +#define ESP_PANEL_BOARD_LCD_VENDOR_INIT_CMD() \ + { \ + {0xFF, (uint8_t[]){0x77, 0x01, 0x00, 0x00, 0x13}, 5, 0}, \ + {0xEF, (uint8_t[]){0x08}, 1, 0}, \ + {0xFF, (uint8_t[]){0x77, 0x01, 0x00, 0x00, 0x10}, 5, 0}, \ + {0xC0, (uint8_t[]){0x3B, 0x00}, 2, 0}, \ + {0xC1, (uint8_t[]){0x0B, 0x02}, 2, 0}, \ + {0xC2, (uint8_t[]){0x07, 0x02}, 2, 0}, \ + {0xC7, (uint8_t[]){0x00}, 1, 0}, \ + {0xCC, (uint8_t[]){0x10}, 1, 0}, \ + {0xCD, (uint8_t[]){0x08}, 1, 0}, \ + {0xB0, (uint8_t[]){0x00, 0x11, 0x16, 0x0E, 0x11, 0x06, 0x05, 0x09, 0x08, 0x21, 0x06, 0x13, 0x10, 0x29, 0x31, 0x18}, 16, 0}, \ + {0xB1, (uint8_t[]){0x00, 0x11, 0x16, 0x0E, 0x11, 0x07, 0x05, 0x09, 0x09, 0x21, 0x05, 0x13, 0x11, 0x2A, 0x31, 0x18}, 16, 0}, \ + {0xFF, (uint8_t[]){0x77, 0x01, 0x00, 0x00, 0x11}, 5, 0}, \ + {0xB0, (uint8_t[]){0x6D}, 1, 0}, \ + {0xB1, (uint8_t[]){0x37}, 1, 0}, \ + {0xB2, (uint8_t[]){0x8B}, 1, 0}, \ + {0xB3, (uint8_t[]){0x80}, 1, 0}, \ + {0xB5, (uint8_t[]){0x43}, 1, 0}, \ + {0xB7, (uint8_t[]){0x85}, 1, 0}, \ + {0xB8, (uint8_t[]){0x20}, 1, 0}, \ + {0xC0, (uint8_t[]){0x09}, 1, 0}, \ + {0xC1, (uint8_t[]){0x78}, 1, 0}, \ + {0xC2, (uint8_t[]){0x78}, 1, 0}, \ + {0xD0, (uint8_t[]){0x88}, 1, 0}, \ + {0xE0, (uint8_t[]){0x00, 0x00, 0x02}, 3, 0}, \ + {0xE1, (uint8_t[]){0x03, 0xA0, 0x00, 0x00, 0x04, 0xA0, 0x00, 0x00, 0x00, 0x20, 0x20}, 11, 0}, \ + {0xE2, (uint8_t[]){0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 13, 0}, \ + {0xE3, (uint8_t[]){0x00, 0x00, 0x11, 0x00}, 4, 0}, \ + {0xE4, (uint8_t[]){0x22, 0x00}, 2, 0}, \ + {0xE5, (uint8_t[]){0x05, 0xEC, 0xF6, 0xCA, 0x07, 0xEE, 0xF6, 0xCA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 16, 0}, \ + {0xE6, (uint8_t[]){0x00, 0x00, 0x11, 0x00}, 4, 0}, \ + {0xE7, (uint8_t[]){0x22, 0x00}, 2, 0}, \ + {0xE8, (uint8_t[]){0x06, 0xED, 0xF6, 0xCA, 0x08, 0xEF, 0xF6, 0xCA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 16, 0}, \ + {0xE9, (uint8_t[]){0x36, 0x00}, 2, 0}, \ + {0xEB, (uint8_t[]){0x00, 0x00, 0x40, 0x40, 0x00, 0x00, 0x00}, 1, 0}, \ + {0xED, (uint8_t[]){0xFF, 0xFF, 0xFF, 0xBA, 0x0A, 0xFF, 0x45, 0xFF, 0xFF, 0x54, 0xFF, 0xA0, 0xAB, 0xFF, 0xFF, 0xFF}, 16, 0}, \ + {0xEF, (uint8_t[]){0x08, 0x08, 0x08, 0x45, 0x3F, 0x54}, 6, 0}, \ + {0xFF, (uint8_t[]){0x77, 0x01, 0x00, 0x00, 0x13}, 5, 0}, \ + {0xE8, (uint8_t[]){0x00, 0x0E}, 2, 0}, \ + {0xFF, (uint8_t[]){0x77, 0x01, 0x00, 0x00, 0x00}, 5, 0}, \ + {0x11, (uint8_t[]){0x00}, 1, 0}, \ + {0xFF, (uint8_t[]){0x77, 0x01, 0x00, 0x00, 0x13}, 5, 0}, \ + {0xE8, (uint8_t[]){0x00, 0x0C}, 2, 0}, \ + {0xE8, (uint8_t[]){0x00, 0x00}, 2, 0}, \ + {0xFF, (uint8_t[]){0x77, 0x01, 0x00, 0x00, 0x00}, 5, 0}, \ + {0x36, (uint8_t[]){0x00}, 1, 0}, \ + {0x3A, (uint8_t[]){0x66}, 1, 0}, \ + {0x29, (uint8_t[]){0x00}, 1, 0},\ + } + +/** + * @brief LCD specific flags configuration + * + * These flags are specific to the "3-wire SPI + RGB" bus. + */ +#if (ESP_PANEL_BOARD_LCD_BUS_TYPE == ESP_PANEL_BUS_TYPE_RGB) && ESP_PANEL_BOARD_LCD_RGB_USE_CONTROL_PANEL +/** + * @brief Enable IO multiplex + * + * Set to 1 if the 3-wire SPI pins are sharing other pins of the RGB interface to save GPIOs. Then, the control panel + * and its pins (except CS signal) will be released after LCD call `init()`. All `*_by_cmd` flags will be invalid. + */ +#define ESP_PANEL_BOARD_LCD_FLAGS_ENABLE_IO_MULTIPLEX (1) // typically set to 0 +/** + * @brief Mirror by command + * + * Set to 1 if the `mirror()` function will be implemented by LCD command. Otherwise, the function will be implemented by + * software. Only valid when `ESP_PANEL_BOARD_LCD_FLAGS_ENABLE_IO_MULTIPLEX` is 0. + */ +#define ESP_PANEL_BOARD_LCD_FLAGS_MIRROR_BY_CMD (!ESP_PANEL_BOARD_LCD_FLAGS_ENABLE_IO_MULTIPLEX) +#endif // ESP_PANEL_BOARD_LCD_RGB_USE_CONTROL_PANEL + +/** + * @brief LCD color configuration + */ +#define ESP_PANEL_BOARD_LCD_COLOR_BITS (ESP_PANEL_LCD_COLOR_BITS_RGB888) + // ESP_PANEL_LCD_COLOR_BITS_RGB565/RGB666/RGB888 +#define ESP_PANEL_BOARD_LCD_COLOR_BGR_ORDER (0) // 0: RGB, 1: BGR +#define ESP_PANEL_BOARD_LCD_COLOR_INEVRT_BIT (0) // 0/1 + +/** + * @brief LCD transformation configuration + */ +#define ESP_PANEL_BOARD_LCD_SWAP_XY (0) // 0/1 +#define ESP_PANEL_BOARD_LCD_MIRROR_X (0) // 0/1 +#define ESP_PANEL_BOARD_LCD_MIRROR_Y (0) // 0/1 +#define ESP_PANEL_BOARD_LCD_GAP_X (0) // [0, ESP_PANEL_BOARD_WIDTH] +#define ESP_PANEL_BOARD_LCD_GAP_Y (0) // [0, ESP_PANEL_BOARD_HEIGHT] + +/** + * @brief LCD reset pin configuration + */ +#define ESP_PANEL_BOARD_LCD_RST_IO (8) // Reset pin, -1 if not used +#define ESP_PANEL_BOARD_LCD_RST_LEVEL (0) // Reset active level, 0: low, 1: high + +#endif // ESP_PANEL_BOARD_USE_LCD + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////// Please update the following macros to configure the touch panel /////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/** + * @brief Touch panel configuration flag (0/1) + * + * Set to `1` to enable touch panel support, `0` to disable + */ +#define ESP_PANEL_BOARD_USE_TOUCH (1) + +#if ESP_PANEL_BOARD_USE_TOUCH +/** + * @brief Touch controller selection + */ +#define ESP_PANEL_BOARD_TOUCH_CONTROLLER CST820 + +/** + * @brief Touch bus type selection + */ +#define ESP_PANEL_BOARD_TOUCH_BUS_TYPE (ESP_PANEL_BUS_TYPE_I2C) + +#if (ESP_PANEL_BOARD_TOUCH_BUS_TYPE == ESP_PANEL_BUS_TYPE_I2C) || \ + (ESP_PANEL_BOARD_TOUCH_BUS_TYPE == ESP_PANEL_BUS_TYPE_SPI) +/** + * If set to 1, the bus will skip to initialize the corresponding host. Users need to initialize the host in advance. + * + * For drivers which created by this library, even if they use the same host, the host will be initialized only once. + * So it is not necessary to set the macro to `1`. For other drivers (like `Wire`), please set the macro to `1` + * ensure that the host is initialized only once. + */ +#define ESP_PANEL_BOARD_TOUCH_BUS_SKIP_INIT_HOST (0) // 0/1. Typically set to 0 +#endif + +/** + * @brief Touch bus parameters configuration + */ +#if ESP_PANEL_BOARD_TOUCH_BUS_TYPE == ESP_PANEL_BUS_TYPE_I2C + + /** + * @brief I2C bus + */ + /* For general */ + #define ESP_PANEL_BOARD_TOUCH_I2C_HOST_ID (0) // Typically set to 0 +#if !ESP_PANEL_BOARD_TOUCH_BUS_SKIP_INIT_HOST + /* For host */ + #define ESP_PANEL_BOARD_TOUCH_I2C_CLK_HZ (400 * 1000) + // Typically set to 400K + #define ESP_PANEL_BOARD_TOUCH_I2C_SCL_PULLUP (1) // 0/1. Typically set to 1 + #define ESP_PANEL_BOARD_TOUCH_I2C_SDA_PULLUP (1) // 0/1. Typically set to 1 + #define ESP_PANEL_BOARD_TOUCH_I2C_IO_SCL (15) + #define ESP_PANEL_BOARD_TOUCH_I2C_IO_SDA (16) +#endif + /* For panel */ + #define ESP_PANEL_BOARD_TOUCH_I2C_ADDRESS (0) // Typically set to 0 to use the default address. + // - For touchs with only one address, set to 0 + // - For touchs with multiple addresses, set to 0 or + // the address. Like GT911, there are two addresses: + // 0x5D(default) and 0x14 + +#endif // ESP_PANEL_BOARD_TOUCH_BUS_TYPE + +/** + * @brief Touch panel transformation flags + */ +#define ESP_PANEL_BOARD_TOUCH_SWAP_XY (0) // 0/1 +#define ESP_PANEL_BOARD_TOUCH_MIRROR_X (0) // 0/1 +#define ESP_PANEL_BOARD_TOUCH_MIRROR_Y (0) // 0/1 + +/** + * @brief Touch panel control pins + */ +#define ESP_PANEL_BOARD_TOUCH_RST_IO (-1) // Reset pin, -1 if not used +#define ESP_PANEL_BOARD_TOUCH_RST_LEVEL (0) // Reset active level, 0: low, 1: high +#define ESP_PANEL_BOARD_TOUCH_INT_IO (-1) // Interrupt pin, -1 if not used +#define ESP_PANEL_BOARD_TOUCH_INT_LEVEL (0) // Interrupt active level, 0: low, 1: high + +#endif // ESP_PANEL_BOARD_USE_TOUCH + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +///////////////////////////// Please update the following macros to configure the backlight //////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/** + * @brief Backlight configuration flag (0/1) + * + * Set to `1` to enable backlight support, `0` to disable + */ +#define ESP_PANEL_BOARD_USE_BACKLIGHT (1) + +#if ESP_PANEL_BOARD_USE_BACKLIGHT +/** + * @brief Backlight control type selection + */ +#define ESP_PANEL_BOARD_BACKLIGHT_TYPE (ESP_PANEL_BACKLIGHT_TYPE_PWM_LEDC) + +#if (ESP_PANEL_BOARD_BACKLIGHT_TYPE == ESP_PANEL_BACKLIGHT_TYPE_SWITCH_GPIO) || \ + (ESP_PANEL_BOARD_BACKLIGHT_TYPE == ESP_PANEL_BACKLIGHT_TYPE_SWITCH_EXPANDER) || \ + (ESP_PANEL_BOARD_BACKLIGHT_TYPE == ESP_PANEL_BACKLIGHT_TYPE_PWM_LEDC) + + /** + * @brief Backlight control pin configuration + */ + #define ESP_PANEL_BOARD_BACKLIGHT_IO (7) // Output GPIO pin number + #define ESP_PANEL_BOARD_BACKLIGHT_ON_LEVEL (0) // Active level, 0: low, 1: high + +#endif // ESP_PANEL_BOARD_BACKLIGHT_TYPE + +/** + * @brief Backlight idle state configuration (0/1) + * + * Set to 1 if want to turn off the backlight after initializing. Otherwise, the backlight will be on. + */ +#define ESP_PANEL_BOARD_BACKLIGHT_IDLE_OFF (0) + +#endif // ESP_PANEL_BOARD_USE_BACKLIGHT + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +///////////////////////////// Please update the following macros to configure the IO expander ////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/** + * @brief IO expander configuration flag (0/1) + * + * Set to `1` to enable IO expander support, `0` to disable + */ +#define ESP_PANEL_BOARD_USE_EXPANDER (0) + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////// Please utilize the following macros to execute any additional code if required ///////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////// File Version /////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/** + * Do not change the following versions. These version numbers are used to check compatibility between this + * configuration file and the library. Rules for version numbers: + * 1. Major version mismatch: Configurations are incompatible, must use library version + * 2. Minor version mismatch: May be missing new configurations, recommended to update + * 3. Patch version mismatch: No impact on functionality + */ +#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MAJOR 1 +#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MINOR 0 +#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_PATCH 0 + +// *INDENT-ON* diff --git a/src/board/supported/viewe/BOARD_VIEWE_UEDX48480021_MD80E_V2.h b/src/board/supported/viewe/BOARD_VIEWE_UEDX48480021_MD80E_V2.h new file mode 100644 index 00000000..2cb05e80 --- /dev/null +++ b/src/board/supported/viewe/BOARD_VIEWE_UEDX48480021_MD80E_V2.h @@ -0,0 +1,382 @@ +/* + * SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +/** + * @file BOARD_VIEWE_UEDX48480021_MD80E_V2.h + * @brief Configuration file for Viewe UEDX48480021-MD80E-V2 + * @author Viewe@VIEWESMART + * @link https://github.com/VIEWESMART/UEDX48480021-MD80ESP32_2.1inch-Knob + */ + +#pragma once + +// *INDENT-OFF* + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////// Please update the following macros to configure general panel ///////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/** + * @brief Board name + */ +#define ESP_PANEL_BOARD_NAME "Viewe:UEDX48480021-MD80E-V2" + +/** + * @brief Panel resolution configuration in pixels + */ +#define ESP_PANEL_BOARD_WIDTH (480) // Panel width (horizontal, in pixels) +#define ESP_PANEL_BOARD_HEIGHT (480) // Panel height (vertical, in pixels) + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////// Please update the following macros to configure the LCD panel ///////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/** + * @brief LCD panel configuration flag (0/1) + * + * Set to `1` to enable LCD panel support, `0` to disable + */ +#define ESP_PANEL_BOARD_USE_LCD (1) + +#if ESP_PANEL_BOARD_USE_LCD +/** + * @brief LCD controller selection + */ +#define ESP_PANEL_BOARD_LCD_CONTROLLER GC9503 + +/** + * @brief LCD bus type selection + */ +#define ESP_PANEL_BOARD_LCD_BUS_TYPE (ESP_PANEL_BUS_TYPE_RGB) + +/** + * @brief LCD bus parameters configuration + * + * Configure parameters based on the selected bus type. Parameters for other bus types will be ignored. + * For detailed parameter explanations, see: + * https://docs.espressif.com/projects/esp-idf/en/v5.3.1/esp32s3/api-reference/peripherals/lcd/index.html + * https://docs.espressif.com/projects/esp-iot-solution/en/latest/display/lcd/index.html + */ +#if ESP_PANEL_BOARD_LCD_BUS_TYPE == ESP_PANEL_BUS_TYPE_RGB + + /** + * @brief RGB bus + */ + /** + * Set to 0 if using simple "RGB" interface which does not contain "3-wire SPI" interface. + */ + #define ESP_PANEL_BOARD_LCD_RGB_USE_CONTROL_PANEL (1) // 0/1. Typically set to 1 + + #if ESP_PANEL_BOARD_LCD_RGB_USE_CONTROL_PANEL + /* For control panel (3wire-SPI) */ + #define ESP_PANEL_BOARD_LCD_RGB_SPI_IO_CS (18) + #define ESP_PANEL_BOARD_LCD_RGB_SPI_IO_SCK (13) + #define ESP_PANEL_BOARD_LCD_RGB_SPI_IO_SDA (12) + #define ESP_PANEL_BOARD_LCD_RGB_SPI_CS_USE_EXPNADER (0) // Set to 1 if the signal is controlled by an IO expander + #define ESP_PANEL_BOARD_LCD_RGB_SPI_SCL_USE_EXPNADER (0) // Set to 1 if the signal is controlled by an IO expander + #define ESP_PANEL_BOARD_LCD_RGB_SPI_SDA_USE_EXPNADER (0) // Set to 1 if the signal is controlled by an IO expander + #define ESP_PANEL_BOARD_LCD_RGB_SPI_MODE (0) // 0-3, typically set to 0 + #define ESP_PANEL_BOARD_LCD_RGB_SPI_CMD_BYTES (1) // Typically set to 8 + #define ESP_PANEL_BOARD_LCD_RGB_SPI_PARAM_BYTES (1) // Typically set to 8 + #define ESP_PANEL_BOARD_LCD_RGB_SPI_USE_DC_BIT (1) // 0/1. Typically set to 1 +#endif // ESP_PANEL_BOARD_LCD_RGB_USE_CONTROL_PANEL + /* For refresh panel (RGB) */ + #define ESP_PANEL_BOARD_LCD_RGB_CLK_HZ (16 * 1000 * 1000) + // To increase the upper limit of the PCLK, see: https://docs.espressif.com/projects/esp-faq/en/latest/software-framework/peripherals/lcd.html#how-can-i-increase-the-upper-limit-of-pclk-settings-on-esp32-s3-while-ensuring-normal-rgb-screen-display + #define ESP_PANEL_BOARD_LCD_RGB_HPW (8) + #define ESP_PANEL_BOARD_LCD_RGB_HBP (20) + #define ESP_PANEL_BOARD_LCD_RGB_HFP (40) + #define ESP_PANEL_BOARD_LCD_RGB_VPW (8) + #define ESP_PANEL_BOARD_LCD_RGB_VBP (20) + #define ESP_PANEL_BOARD_LCD_RGB_VFP (50) + #define ESP_PANEL_BOARD_LCD_RGB_PCLK_ACTIVE_NEG (0) // 0: rising edge, 1: falling edge. Typically set to 0 + // The following sheet shows the valid combinations of + // data width and pixel bits: + // ┏---------------------------------┳- -------------------------------┓ + #define ESP_PANEL_BOARD_LCD_RGB_DATA_WIDTH (16) // | 16 | 8 | + #define ESP_PANEL_BOARD_LCD_RGB_PIXEL_BITS (ESP_PANEL_LCD_COLOR_BITS_RGB565) // | ESP_PANEL_LCD_COLOR_BITS_RGB565 | ESP_PANEL_LCD_COLOR_BITS_RGB888 | + // ┗---------------------------------┻---------------------------------┛ + // To understand color format of RGB LCD, see: https://docs.espressif.com/projects/esp-iot-solution/en/latest/display/lcd/rgb_lcd.html#color-formats + #define ESP_PANEL_BOARD_LCD_RGB_BOUNCE_BUF_SIZE (ESP_PANEL_BOARD_WIDTH * 10) + // Bounce buffer size in bytes. It is used to avoid screen drift + // for ESP32-S3. Typically set to `ESP_PANEL_BOARD_WIDTH * 10` + // The size should satisfy `size * N = LCD_width * LCD_height`, + // where N is an even number. + // For more details, see: https://github.com/esp-arduino-libs/ESP32_Display_Panel/blob/master/docs/FAQ.md#how-to-fix-screen-drift-issue-when-driving-rgb-lcd-with-esp32-s3 + #define ESP_PANEL_BOARD_LCD_RGB_IO_HSYNC (46) + #define ESP_PANEL_BOARD_LCD_RGB_IO_VSYNC (3) + #define ESP_PANEL_BOARD_LCD_RGB_IO_DE (17) // -1 if not used + #define ESP_PANEL_BOARD_LCD_RGB_IO_PCLK (9) + #define ESP_PANEL_BOARD_LCD_RGB_IO_DISP (-1) // -1 if not used. Typically set to -1 + + // The following sheet shows the mapping of ESP GPIOs to + // LCD data pins with different data width and color format: + // ┏------┳- ------------┳--------------------------┓ + // | ESP: | 8-bit RGB888 | 16-bit RGB565 | + // |------|--------------|--------------------------| + // | LCD: | RGB888 | RGB565 | RGB666 | RGB888 | + // ┗------|--------------|--------|--------|--------| + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA0 (10) // | D0 | B0 | B0-1 | B0-3 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA1 (11) // | D1 | B1 | B2 | B4 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA2 (12) // | D2 | B2 | B3 | B5 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA3 (13) // | D3 | B3 | B4 | B6 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA4 (14) // | D4 | B4 | B5 | B7 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA5 (21) // | D5 | G0 | G0 | G0-2 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA6 (47) // | D6 | G1 | G1 | G3 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA7 (48) // | D7 | G2 | G2 | G4 | +#if ESP_PANEL_BOARD_LCD_RGB_DATA_WIDTH > 8 // ┗--------------┫--------|--------|--------| + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA8 (45) // | G3 | G3 | G5 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA9 (38) // | G4 | G4 | G6 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA10 (39) // | G5 | G5 | G7 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA11 (40) // | R0 | R0-1 | R0-3 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA12 (41) // | R1 | R2 | R4 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA13 (42) // | R2 | R3 | R5 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA14 (2) // | R3 | R4 | R6 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA15 (1) // | R4 | R5 | R7 | + // ┗--------┻--------┻--------┛ +#endif // ESP_PANEL_BOARD_LCD_RGB_DATA_WIDTH + +#endif // ESP_PANEL_BOARD_LCD_BUS_TYPE + +#define ESP_PANEL_BOARD_LCD_VENDOR_INIT_CMD() \ + { \ + {0xFF, (uint8_t[]){0x77, 0x01, 0x00, 0x00, 0x13}, 5, 0}, \ + {0xEF, (uint8_t[]){0x08}, 1, 0}, \ + {0xFF, (uint8_t[]){0x77, 0x01, 0x00, 0x00, 0x10}, 5, 0}, \ + {0xC0, (uint8_t[]){0x3B, 0x00}, 2, 0}, \ + {0xC1, (uint8_t[]){0x0B, 0x02}, 2, 0}, \ + {0xC2, (uint8_t[]){0x07, 0x02}, 2, 0}, \ + {0xC7, (uint8_t[]){0x00}, 1, 0}, \ + {0xCC, (uint8_t[]){0x10}, 1, 0}, \ + {0xCD, (uint8_t[]){0x08}, 1, 0}, \ + {0xB0, (uint8_t[]){0x00, 0x11, 0x16, 0x0E, 0x11, 0x06, 0x05, 0x09, 0x08, 0x21, 0x06, 0x13, 0x10, 0x29, 0x31, 0x18}, 16, 0}, \ + {0xB1, (uint8_t[]){0x00, 0x11, 0x16, 0x0E, 0x11, 0x07, 0x05, 0x09, 0x09, 0x21, 0x05, 0x13, 0x11, 0x2A, 0x31, 0x18}, 16, 0}, \ + {0xFF, (uint8_t[]){0x77, 0x01, 0x00, 0x00, 0x11}, 5, 0}, \ + {0xB0, (uint8_t[]){0x6D}, 1, 0}, \ + {0xB1, (uint8_t[]){0x37}, 1, 0}, \ + {0xB2, (uint8_t[]){0x8B}, 1, 0}, \ + {0xB3, (uint8_t[]){0x80}, 1, 0}, \ + {0xB5, (uint8_t[]){0x43}, 1, 0}, \ + {0xB7, (uint8_t[]){0x85}, 1, 0}, \ + {0xB8, (uint8_t[]){0x20}, 1, 0}, \ + {0xC0, (uint8_t[]){0x09}, 1, 0}, \ + {0xC1, (uint8_t[]){0x78}, 1, 0}, \ + {0xC2, (uint8_t[]){0x78}, 1, 0}, \ + {0xD0, (uint8_t[]){0x88}, 1, 0}, \ + {0xE0, (uint8_t[]){0x00, 0x00, 0x02}, 3, 0}, \ + {0xE1, (uint8_t[]){0x03, 0xA0, 0x00, 0x00, 0x04, 0xA0, 0x00, 0x00, 0x00, 0x20, 0x20}, 11, 0}, \ + {0xE2, (uint8_t[]){0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 13, 0}, \ + {0xE3, (uint8_t[]){0x00, 0x00, 0x11, 0x00}, 4, 0}, \ + {0xE4, (uint8_t[]){0x22, 0x00}, 2, 0}, \ + {0xE5, (uint8_t[]){0x05, 0xEC, 0xF6, 0xCA, 0x07, 0xEE, 0xF6, 0xCA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 16, 0}, \ + {0xE6, (uint8_t[]){0x00, 0x00, 0x11, 0x00}, 4, 0}, \ + {0xE7, (uint8_t[]){0x22, 0x00}, 2, 0}, \ + {0xE8, (uint8_t[]){0x06, 0xED, 0xF6, 0xCA, 0x08, 0xEF, 0xF6, 0xCA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 16, 0}, \ + {0xE9, (uint8_t[]){0x36, 0x00}, 2, 0}, \ + {0xEB, (uint8_t[]){0x00, 0x00, 0x40, 0x40, 0x00, 0x00, 0x00}, 1, 0}, \ + {0xED, (uint8_t[]){0xFF, 0xFF, 0xFF, 0xBA, 0x0A, 0xFF, 0x45, 0xFF, 0xFF, 0x54, 0xFF, 0xA0, 0xAB, 0xFF, 0xFF, 0xFF}, 16, 0}, \ + {0xEF, (uint8_t[]){0x08, 0x08, 0x08, 0x45, 0x3F, 0x54}, 6, 0}, \ + {0xFF, (uint8_t[]){0x77, 0x01, 0x00, 0x00, 0x13}, 5, 0}, \ + {0xE8, (uint8_t[]){0x00, 0x0E}, 2, 0}, \ + {0xFF, (uint8_t[]){0x77, 0x01, 0x00, 0x00, 0x00}, 5, 0}, \ + {0x11, (uint8_t[]){0x00}, 1, 0}, \ + {0xFF, (uint8_t[]){0x77, 0x01, 0x00, 0x00, 0x13}, 5, 0}, \ + {0xE8, (uint8_t[]){0x00, 0x0C}, 2, 0}, \ + {0xE8, (uint8_t[]){0x00, 0x00}, 2, 0}, \ + {0xFF, (uint8_t[]){0x77, 0x01, 0x00, 0x00, 0x00}, 5, 0}, \ + {0x36, (uint8_t[]){0x00}, 1, 0}, \ + {0x3A, (uint8_t[]){0x66}, 1, 0}, \ + {0x29, (uint8_t[]){0x00}, 1, 0},\ + } + +/** + * @brief LCD specific flags configuration + * + * These flags are specific to the "3-wire SPI + RGB" bus. + */ +#if (ESP_PANEL_BOARD_LCD_BUS_TYPE == ESP_PANEL_BUS_TYPE_RGB) && ESP_PANEL_BOARD_LCD_RGB_USE_CONTROL_PANEL +/** + * @brief Enable IO multiplex + * + * Set to 1 if the 3-wire SPI pins are sharing other pins of the RGB interface to save GPIOs. Then, the control panel + * and its pins (except CS signal) will be released after LCD call `init()`. All `*_by_cmd` flags will be invalid. + */ +#define ESP_PANEL_BOARD_LCD_FLAGS_ENABLE_IO_MULTIPLEX (1) // typically set to 0 +/** + * @brief Mirror by command + * + * Set to 1 if the `mirror()` function will be implemented by LCD command. Otherwise, the function will be implemented by + * software. Only valid when `ESP_PANEL_BOARD_LCD_FLAGS_ENABLE_IO_MULTIPLEX` is 0. + */ +#define ESP_PANEL_BOARD_LCD_FLAGS_MIRROR_BY_CMD (!ESP_PANEL_BOARD_LCD_FLAGS_ENABLE_IO_MULTIPLEX) +#endif // ESP_PANEL_BOARD_LCD_RGB_USE_CONTROL_PANEL + +/** + * @brief LCD color configuration + */ +#define ESP_PANEL_BOARD_LCD_COLOR_BITS (ESP_PANEL_LCD_COLOR_BITS_RGB888) + // ESP_PANEL_LCD_COLOR_BITS_RGB565/RGB666/RGB888 +#define ESP_PANEL_BOARD_LCD_COLOR_BGR_ORDER (0) // 0: RGB, 1: BGR +#define ESP_PANEL_BOARD_LCD_COLOR_INEVRT_BIT (0) // 0/1 + +/** + * @brief LCD transformation configuration + */ +#define ESP_PANEL_BOARD_LCD_SWAP_XY (0) // 0/1 +#define ESP_PANEL_BOARD_LCD_MIRROR_X (0) // 0/1 +#define ESP_PANEL_BOARD_LCD_MIRROR_Y (0) // 0/1 +#define ESP_PANEL_BOARD_LCD_GAP_X (0) // [0, ESP_PANEL_BOARD_WIDTH] +#define ESP_PANEL_BOARD_LCD_GAP_Y (0) // [0, ESP_PANEL_BOARD_HEIGHT] + +/** + * @brief LCD reset pin configuration + */ +#define ESP_PANEL_BOARD_LCD_RST_IO (8) // Reset pin, -1 if not used +#define ESP_PANEL_BOARD_LCD_RST_LEVEL (0) // Reset active level, 0: low, 1: high + +#endif // ESP_PANEL_BOARD_USE_LCD + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////// Please update the following macros to configure the touch panel /////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/** + * @brief Touch panel configuration flag (0/1) + * + * Set to `1` to enable touch panel support, `0` to disable + */ +#define ESP_PANEL_BOARD_USE_TOUCH (0) + +#if ESP_PANEL_BOARD_USE_TOUCH +/** + * @brief Touch controller selection + */ +#define ESP_PANEL_BOARD_TOUCH_CONTROLLER CST816S + +/** + * @brief Touch bus type selection + */ +#define ESP_PANEL_BOARD_TOUCH_BUS_TYPE (ESP_PANEL_BUS_TYPE_I2C) + +#if (ESP_PANEL_BOARD_TOUCH_BUS_TYPE == ESP_PANEL_BUS_TYPE_I2C) || \ + (ESP_PANEL_BOARD_TOUCH_BUS_TYPE == ESP_PANEL_BUS_TYPE_SPI) +/** + * If set to 1, the bus will skip to initialize the corresponding host. Users need to initialize the host in advance. + * + * For drivers which created by this library, even if they use the same host, the host will be initialized only once. + * So it is not necessary to set the macro to `1`. For other drivers (like `Wire`), please set the macro to `1` + * ensure that the host is initialized only once. + */ +#define ESP_PANEL_BOARD_TOUCH_BUS_SKIP_INIT_HOST (0) // 0/1. Typically set to 0 +#endif + +/** + * @brief Touch bus parameters configuration + */ +#if ESP_PANEL_BOARD_TOUCH_BUS_TYPE == ESP_PANEL_BUS_TYPE_I2C + + /** + * @brief I2C bus + */ + /* For general */ + #define ESP_PANEL_BOARD_TOUCH_I2C_HOST_ID (0) // Typically set to 0 +#if !ESP_PANEL_BOARD_TOUCH_BUS_SKIP_INIT_HOST + /* For host */ + #define ESP_PANEL_BOARD_TOUCH_I2C_CLK_HZ (400 * 1000) + // Typically set to 400K + #define ESP_PANEL_BOARD_TOUCH_I2C_SCL_PULLUP (1) // 0/1. Typically set to 1 + #define ESP_PANEL_BOARD_TOUCH_I2C_SDA_PULLUP (1) // 0/1. Typically set to 1 + #define ESP_PANEL_BOARD_TOUCH_I2C_IO_SCL (15) + #define ESP_PANEL_BOARD_TOUCH_I2C_IO_SDA (16) +#endif + /* For panel */ + #define ESP_PANEL_BOARD_TOUCH_I2C_ADDRESS (0) // Typically set to 0 to use the default address. + // - For touchs with only one address, set to 0 + // - For touchs with multiple addresses, set to 0 or + // the address. Like GT911, there are two addresses: + // 0x5D(default) and 0x14 + +#endif // ESP_PANEL_BOARD_TOUCH_BUS_TYPE + +/** + * @brief Touch panel transformation flags + */ +#define ESP_PANEL_BOARD_TOUCH_SWAP_XY (0) // 0/1 +#define ESP_PANEL_BOARD_TOUCH_MIRROR_X (0) // 0/1 +#define ESP_PANEL_BOARD_TOUCH_MIRROR_Y (0) // 0/1 + +/** + * @brief Touch panel control pins + */ +#define ESP_PANEL_BOARD_TOUCH_RST_IO (-1) // Reset pin, -1 if not used +#define ESP_PANEL_BOARD_TOUCH_RST_LEVEL (0) // Reset active level, 0: low, 1: high +#define ESP_PANEL_BOARD_TOUCH_INT_IO (-1) // Interrupt pin, -1 if not used +#define ESP_PANEL_BOARD_TOUCH_INT_LEVEL (0) // Interrupt active level, 0: low, 1: high + +#endif // ESP_PANEL_BOARD_USE_TOUCH + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +///////////////////////////// Please update the following macros to configure the backlight //////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/** + * @brief Backlight configuration flag (0/1) + * + * Set to `1` to enable backlight support, `0` to disable + */ +#define ESP_PANEL_BOARD_USE_BACKLIGHT (1) + +#if ESP_PANEL_BOARD_USE_BACKLIGHT +/** + * @brief Backlight control type selection + */ +#define ESP_PANEL_BOARD_BACKLIGHT_TYPE (ESP_PANEL_BACKLIGHT_TYPE_PWM_LEDC) + +#if (ESP_PANEL_BOARD_BACKLIGHT_TYPE == ESP_PANEL_BACKLIGHT_TYPE_SWITCH_GPIO) || \ + (ESP_PANEL_BOARD_BACKLIGHT_TYPE == ESP_PANEL_BACKLIGHT_TYPE_SWITCH_EXPANDER) || \ + (ESP_PANEL_BOARD_BACKLIGHT_TYPE == ESP_PANEL_BACKLIGHT_TYPE_PWM_LEDC) + + /** + * @brief Backlight control pin configuration + */ + #define ESP_PANEL_BOARD_BACKLIGHT_IO (7) // Output GPIO pin number + #define ESP_PANEL_BOARD_BACKLIGHT_ON_LEVEL (0) // Active level, 0: low, 1: high + +#endif // ESP_PANEL_BOARD_BACKLIGHT_TYPE + +/** + * @brief Backlight idle state configuration (0/1) + * + * Set to 1 if want to turn off the backlight after initializing. Otherwise, the backlight will be on. + */ +#define ESP_PANEL_BOARD_BACKLIGHT_IDLE_OFF (0) + +#endif // ESP_PANEL_BOARD_USE_BACKLIGHT + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +///////////////////////////// Please update the following macros to configure the IO expander ////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/** + * @brief IO expander configuration flag (0/1) + * + * Set to `1` to enable IO expander support, `0` to disable + */ +#define ESP_PANEL_BOARD_USE_EXPANDER (0) + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////// Please utilize the following macros to execute any additional code if required ///////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////// File Version /////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/** + * Do not change the following versions. These version numbers are used to check compatibility between this + * configuration file and the library. Rules for version numbers: + * 1. Major version mismatch: Configurations are incompatible, must use library version + * 2. Minor version mismatch: May be missing new configurations, recommended to update + * 3. Patch version mismatch: No impact on functionality + */ +#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MAJOR 1 +#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MINOR 0 +#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_PATCH 0 + +// *INDENT-ON* diff --git a/src/board/supported/viewe/BOARD_VIEWE_UEDX48480028_MD80ET.h b/src/board/supported/viewe/BOARD_VIEWE_UEDX48480028_MD80ET.h new file mode 100644 index 00000000..c09e851b --- /dev/null +++ b/src/board/supported/viewe/BOARD_VIEWE_UEDX48480028_MD80ET.h @@ -0,0 +1,378 @@ +/* + * SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +/** + * @file BOARD_UEDX48480028_MD80ET.h + * @brief Configuration file for Viewe UEDX48480028-MD80ET + * @author Viewe@VIEWESMART + * @link + */ + +#pragma once + +// *INDENT-OFF* + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////// Please update the following macros to configure general panel ///////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/** + * @brief Board name + */ +#define ESP_PANEL_BOARD_NAME "Viewe:UEDX48480028-MD80ET" + +/** + * @brief Panel resolution configuration in pixels + */ +#define ESP_PANEL_BOARD_WIDTH (480) // Panel width (horizontal, in pixels) +#define ESP_PANEL_BOARD_HEIGHT (480) // Panel height (vertical, in pixels) + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////// Please update the following macros to configure the LCD panel ///////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/** + * @brief LCD panel configuration flag (0/1) + * + * Set to `1` to enable LCD panel support, `0` to disable + */ +#define ESP_PANEL_BOARD_USE_LCD (1) + +#if ESP_PANEL_BOARD_USE_LCD +/** + * @brief LCD controller selection + */ +#define ESP_PANEL_BOARD_LCD_CONTROLLER GC9503 + +/** + * @brief LCD bus type selection + */ +#define ESP_PANEL_BOARD_LCD_BUS_TYPE (ESP_PANEL_BUS_TYPE_RGB) + +/** + * @brief LCD bus parameters configuration + * + * Configure parameters based on the selected bus type. Parameters for other bus types will be ignored. + * For detailed parameter explanations, see: + * https://docs.espressif.com/projects/esp-idf/en/v5.3.1/esp32s3/api-reference/peripherals/lcd/index.html + * https://docs.espressif.com/projects/esp-iot-solution/en/latest/display/lcd/index.html + */ +#if ESP_PANEL_BOARD_LCD_BUS_TYPE == ESP_PANEL_BUS_TYPE_RGB + + /** + * @brief RGB bus + */ + /** + * Set to 0 if using simple "RGB" interface which does not contain "3-wire SPI" interface. + */ + #define ESP_PANEL_BOARD_LCD_RGB_USE_CONTROL_PANEL (1) // 0/1. Typically set to 1 + + #if ESP_PANEL_BOARD_LCD_RGB_USE_CONTROL_PANEL + /* For control panel (3wire-SPI) */ + #define ESP_PANEL_BOARD_LCD_RGB_SPI_IO_CS (18) + #define ESP_PANEL_BOARD_LCD_RGB_SPI_IO_SCK (13) + #define ESP_PANEL_BOARD_LCD_RGB_SPI_IO_SDA (12) + #define ESP_PANEL_BOARD_LCD_RGB_SPI_CS_USE_EXPNADER (0) // Set to 1 if the signal is controlled by an IO expander + #define ESP_PANEL_BOARD_LCD_RGB_SPI_SCL_USE_EXPNADER (0) // Set to 1 if the signal is controlled by an IO expander + #define ESP_PANEL_BOARD_LCD_RGB_SPI_SDA_USE_EXPNADER (0) // Set to 1 if the signal is controlled by an IO expander + #define ESP_PANEL_BOARD_LCD_RGB_SPI_MODE (0) // 0-3, typically set to 0 + #define ESP_PANEL_BOARD_LCD_RGB_SPI_CMD_BYTES (1) // Typically set to 8 + #define ESP_PANEL_BOARD_LCD_RGB_SPI_PARAM_BYTES (1) // Typically set to 8 + #define ESP_PANEL_BOARD_LCD_RGB_SPI_USE_DC_BIT (1) // 0/1. Typically set to 1 +#endif // ESP_PANEL_BOARD_LCD_RGB_USE_CONTROL_PANEL + /* For refresh panel (RGB) */ + #define ESP_PANEL_BOARD_LCD_RGB_CLK_HZ (16 * 1000 * 1000) + // To increase the upper limit of the PCLK, see: https://docs.espressif.com/projects/esp-faq/en/latest/software-framework/peripherals/lcd.html#how-can-i-increase-the-upper-limit-of-pclk-settings-on-esp32-s3-while-ensuring-normal-rgb-screen-display + #define ESP_PANEL_BOARD_LCD_RGB_HPW (8) + #define ESP_PANEL_BOARD_LCD_RGB_HBP (20) + #define ESP_PANEL_BOARD_LCD_RGB_HFP (40) + #define ESP_PANEL_BOARD_LCD_RGB_VPW (8) + #define ESP_PANEL_BOARD_LCD_RGB_VBP (20) + #define ESP_PANEL_BOARD_LCD_RGB_VFP (50) + #define ESP_PANEL_BOARD_LCD_RGB_PCLK_ACTIVE_NEG (0) // 0: rising edge, 1: falling edge. Typically set to 0 + // The following sheet shows the valid combinations of + // data width and pixel bits: + // ┏---------------------------------┳- -------------------------------┓ + #define ESP_PANEL_BOARD_LCD_RGB_DATA_WIDTH (16) // | 16 | 8 | + #define ESP_PANEL_BOARD_LCD_RGB_PIXEL_BITS (ESP_PANEL_LCD_COLOR_BITS_RGB565) // | ESP_PANEL_LCD_COLOR_BITS_RGB565 | ESP_PANEL_LCD_COLOR_BITS_RGB888 | + // ┗---------------------------------┻---------------------------------┛ + // To understand color format of RGB LCD, see: https://docs.espressif.com/projects/esp-iot-solution/en/latest/display/lcd/rgb_lcd.html#color-formats + #define ESP_PANEL_BOARD_LCD_RGB_BOUNCE_BUF_SIZE (ESP_PANEL_BOARD_WIDTH * 10) + // Bounce buffer size in bytes. It is used to avoid screen drift + // for ESP32-S3. Typically set to `ESP_PANEL_BOARD_WIDTH * 10` + // The size should satisfy `size * N = LCD_width * LCD_height`, + // where N is an even number. + // For more details, see: https://github.com/esp-arduino-libs/ESP32_Display_Panel/blob/master/docs/FAQ.md#how-to-fix-screen-drift-issue-when-driving-rgb-lcd-with-esp32-s3 + #define ESP_PANEL_BOARD_LCD_RGB_IO_HSYNC (46) + #define ESP_PANEL_BOARD_LCD_RGB_IO_VSYNC (3) + #define ESP_PANEL_BOARD_LCD_RGB_IO_DE (17) // -1 if not used + #define ESP_PANEL_BOARD_LCD_RGB_IO_PCLK (9) + #define ESP_PANEL_BOARD_LCD_RGB_IO_DISP (-1) // -1 if not used. Typically set to -1 + + // The following sheet shows the mapping of ESP GPIOs to + // LCD data pins with different data width and color format: + // ┏------┳- ------------┳--------------------------┓ + // | ESP: | 8-bit RGB888 | 16-bit RGB565 | + // |------|--------------|--------------------------| + // | LCD: | RGB888 | RGB565 | RGB666 | RGB888 | + // ┗------|--------------|--------|--------|--------| + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA0 (10) // | D0 | B0 | B0-1 | B0-3 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA1 (11) // | D1 | B1 | B2 | B4 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA2 (12) // | D2 | B2 | B3 | B5 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA3 (13) // | D3 | B3 | B4 | B6 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA4 (14) // | D4 | B4 | B5 | B7 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA5 (21) // | D5 | G0 | G0 | G0-2 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA6 (47) // | D6 | G1 | G1 | G3 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA7 (48) // | D7 | G2 | G2 | G4 | +#if ESP_PANEL_BOARD_LCD_RGB_DATA_WIDTH > 8 // ┗--------------┫--------|--------|--------| + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA8 (45) // | G3 | G3 | G5 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA9 (38) // | G4 | G4 | G6 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA10 (39) // | G5 | G5 | G7 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA11 (40) // | R0 | R0-1 | R0-3 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA12 (41) // | R1 | R2 | R4 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA13 (42) // | R2 | R3 | R5 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA14 (2) // | R3 | R4 | R6 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA15 (1) // | R4 | R5 | R7 | + // ┗--------┻--------┻--------┛ +#endif // ESP_PANEL_BOARD_LCD_RGB_DATA_WIDTH + +#endif // ESP_PANEL_BOARD_LCD_BUS_TYPE + +#define ESP_PANEL_BOARD_LCD_VENDOR_INIT_CMD() \ + { \ + {0xFF, (uint8_t []){0x77,0x01,0x00,0x00,0x13}, 5, 0},\ + {0xEF, (uint8_t []){0x08}, 1, 0},\ + {0xFF, (uint8_t []){0x77,0x01,0x00,0x00,0x10}, 5, 0},\ + {0xC0, (uint8_t []){0x3B,0x00}, 2, 0},\ + {0xC1, (uint8_t []){0x10,0x0C}, 2, 0},\ + {0xC2, (uint8_t []){0x07,0x0A}, 2, 0},\ + {0xC7, (uint8_t []){0x00}, 1, 0},\ + {0xCC, (uint8_t []){0x10}, 1, 0},\ + {0xCD, (uint8_t []){0x08}, 1, 0},\ + {0xB0, (uint8_t []){0x05,0x12,0x98,0x0E,0x0F,0x07,0x07,0x09,0x09,0x23,0x05,0x52,0x0F,0x67,0x2C,0x11} , 16, 0},\ + {0xB1, (uint8_t []){0x0B,0x11,0x97,0x0C,0x12,0x06,0x06,0x08,0x08,0x22,0x03,0x51,0x11,0x66,0x2B,0x0F} , 16, 0},\ + {0xFF, (uint8_t []){0x77,0x01,0x00,0x00,0x11}, 5, 0},\ + {0xB0, (uint8_t []){0x5D}, 1, 0},\ + {0xB1, (uint8_t []){0x2D}, 1, 0},\ + {0xB2, (uint8_t []){0x81}, 1, 0},\ + {0xB3, (uint8_t []){0x80}, 1, 0},\ + {0xB5, (uint8_t []){0x4E}, 1, 0},\ + {0xB7, (uint8_t []){0x85}, 1, 0},\ + {0xB8, (uint8_t []){0x20}, 1, 0},\ + {0xC0, (uint8_t []){0x09}, 1, 0},\ + {0xC1, (uint8_t []){0x78}, 1, 0},\ + {0xC2, (uint8_t []){0x78}, 1, 0},\ + {0xD0, (uint8_t []){0x88}, 1, 0},\ + {0xE0, (uint8_t []){0x00,0x00,0x02}, 3, 0},\ + {0xE1, (uint8_t []){0x06,0x30,0x08,0x30,0x05,0x30,0x07,0x30,0x00,0x33,0x33}, 11, 0},\ + {0xE2, (uint8_t []){0x11,0x11,0x33,0x33,0xF4,0x00,0x00,0x00,0xF4,0x00,0x00,0x00}, 12, 0},\ + {0xE3, (uint8_t []){0x00,0x00,0x11,0x11}, 4, 0},\ + {0xE4, (uint8_t []){0x44,0x44}, 2, 0},\ + {0xE5, (uint8_t []){0x0D,0xF5,0x30,0xF0,0x0F,0xF7,0x30,0xF0,0x09,0xF1,0x30,0xF0,0x0B,0xF3,0x30,0xF0}, 16, 0},\ + {0xE6, (uint8_t []){0x00,0x00,0x11,0x11}, 4, 0},\ + {0xE7, (uint8_t []){0x44,0x44}, 2, 0},\ + {0xE8, (uint8_t []){0x0C,0xF4,0x30,0xF0,0x0E,0xF6,0x30,0xF0,0x08,0xF0,0x30,0xF0,0x0A,0xF2,0x30,0xF0}, 16, 0},\ + {0xE9, (uint8_t []){0x36, 0x01}, 2, 0},\ + {0xEB, (uint8_t []){0x00,0x01,0xE4,0xE4,0x44,0x88,0x40}, 7, 0},\ + {0xED, (uint8_t []){0xFF,0x10,0xAF,0x76,0x54,0x2B,0xCF,0xFF,0xFF,0xFC,0xB2,0x45,0x67,0xFA,0x01,0xFF} , 16, 0},\ + {0xEF, (uint8_t []){0x08,0x08,0x08,0x45,0x3F,0x54}, 6, 0},\ + {0xFF, (uint8_t []){0x77,0x01,0x00,0x00,0x00}, 5, 0},\ + {0x11, (uint8_t []){0X00}, 1, 0},\ + {0x3A, (uint8_t []){0x66}, 1, 0},\ + {0x36, (uint8_t []){0x00}, 1, 0},\ + {0x35, (uint8_t []){0x00}, 1, 0},\ + {0x29, (uint8_t []){0x00}, 1, 0},\ + {0x00, (uint8_t []){0x00}, 0xff},\ + } + +/** + * @brief LCD specific flags configuration + * + * These flags are specific to the "3-wire SPI + RGB" bus. + */ +#if (ESP_PANEL_BOARD_LCD_BUS_TYPE == ESP_PANEL_BUS_TYPE_RGB) && ESP_PANEL_BOARD_LCD_RGB_USE_CONTROL_PANEL +/** + * @brief Enable IO multiplex + * + * Set to 1 if the 3-wire SPI pins are sharing other pins of the RGB interface to save GPIOs. Then, the control panel + * and its pins (except CS signal) will be released after LCD call `init()`. All `*_by_cmd` flags will be invalid. + */ +#define ESP_PANEL_BOARD_LCD_FLAGS_ENABLE_IO_MULTIPLEX (1) // typically set to 0 +/** + * @brief Mirror by command + * + * Set to 1 if the `mirror()` function will be implemented by LCD command. Otherwise, the function will be implemented by + * software. Only valid when `ESP_PANEL_BOARD_LCD_FLAGS_ENABLE_IO_MULTIPLEX` is 0. + */ +#define ESP_PANEL_BOARD_LCD_FLAGS_MIRROR_BY_CMD (!ESP_PANEL_BOARD_LCD_FLAGS_ENABLE_IO_MULTIPLEX) +#endif // ESP_PANEL_BOARD_LCD_RGB_USE_CONTROL_PANEL + +/** + * @brief LCD color configuration + */ +#define ESP_PANEL_BOARD_LCD_COLOR_BITS (ESP_PANEL_LCD_COLOR_BITS_RGB888) + // ESP_PANEL_LCD_COLOR_BITS_RGB565/RGB666/RGB888 +#define ESP_PANEL_BOARD_LCD_COLOR_BGR_ORDER (0) // 0: RGB, 1: BGR +#define ESP_PANEL_BOARD_LCD_COLOR_INEVRT_BIT (0) // 0/1 + +/** + * @brief LCD transformation configuration + */ +#define ESP_PANEL_BOARD_LCD_SWAP_XY (0) // 0/1 +#define ESP_PANEL_BOARD_LCD_MIRROR_X (0) // 0/1 +#define ESP_PANEL_BOARD_LCD_MIRROR_Y (0) // 0/1 +#define ESP_PANEL_BOARD_LCD_GAP_X (0) // [0, ESP_PANEL_BOARD_WIDTH] +#define ESP_PANEL_BOARD_LCD_GAP_Y (0) // [0, ESP_PANEL_BOARD_HEIGHT] + +/** + * @brief LCD reset pin configuration + */ +#define ESP_PANEL_BOARD_LCD_RST_IO (8) // Reset pin, -1 if not used +#define ESP_PANEL_BOARD_LCD_RST_LEVEL (0) // Reset active level, 0: low, 1: high + +#endif // ESP_PANEL_BOARD_USE_LCD + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////// Please update the following macros to configure the touch panel /////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/** + * @brief Touch panel configuration flag (0/1) + * + * Set to `1` to enable touch panel support, `0` to disable + */ +#define ESP_PANEL_BOARD_USE_TOUCH (1) + +#if ESP_PANEL_BOARD_USE_TOUCH +/** + * @brief Touch controller selection + */ +#define ESP_PANEL_BOARD_TOUCH_CONTROLLER CST820 + +/** + * @brief Touch bus type selection + */ +#define ESP_PANEL_BOARD_TOUCH_BUS_TYPE (ESP_PANEL_BUS_TYPE_I2C) + +#if (ESP_PANEL_BOARD_TOUCH_BUS_TYPE == ESP_PANEL_BUS_TYPE_I2C) || \ + (ESP_PANEL_BOARD_TOUCH_BUS_TYPE == ESP_PANEL_BUS_TYPE_SPI) +/** + * If set to 1, the bus will skip to initialize the corresponding host. Users need to initialize the host in advance. + * + * For drivers which created by this library, even if they use the same host, the host will be initialized only once. + * So it is not necessary to set the macro to `1`. For other drivers (like `Wire`), please set the macro to `1` + * ensure that the host is initialized only once. + */ +#define ESP_PANEL_BOARD_TOUCH_BUS_SKIP_INIT_HOST (0) // 0/1. Typically set to 0 +#endif + +/** + * @brief Touch bus parameters configuration + */ +#if ESP_PANEL_BOARD_TOUCH_BUS_TYPE == ESP_PANEL_BUS_TYPE_I2C + + /** + * @brief I2C bus + */ + /* For general */ + #define ESP_PANEL_BOARD_TOUCH_I2C_HOST_ID (0) // Typically set to 0 +#if !ESP_PANEL_BOARD_TOUCH_BUS_SKIP_INIT_HOST + /* For host */ + #define ESP_PANEL_BOARD_TOUCH_I2C_CLK_HZ (400 * 1000) + // Typically set to 400K + #define ESP_PANEL_BOARD_TOUCH_I2C_SCL_PULLUP (1) // 0/1. Typically set to 1 + #define ESP_PANEL_BOARD_TOUCH_I2C_SDA_PULLUP (1) // 0/1. Typically set to 1 + #define ESP_PANEL_BOARD_TOUCH_I2C_IO_SCL (15) + #define ESP_PANEL_BOARD_TOUCH_I2C_IO_SDA (16) +#endif + /* For panel */ + #define ESP_PANEL_BOARD_TOUCH_I2C_ADDRESS (0) // Typically set to 0 to use the default address. + // - For touchs with only one address, set to 0 + // - For touchs with multiple addresses, set to 0 or + // the address. Like GT911, there are two addresses: + // 0x5D(default) and 0x14 + +#endif // ESP_PANEL_BOARD_TOUCH_BUS_TYPE + +/** + * @brief Touch panel transformation flags + */ +#define ESP_PANEL_BOARD_TOUCH_SWAP_XY (0) // 0/1 +#define ESP_PANEL_BOARD_TOUCH_MIRROR_X (0) // 0/1 +#define ESP_PANEL_BOARD_TOUCH_MIRROR_Y (0) // 0/1 + +/** + * @brief Touch panel control pins + */ +#define ESP_PANEL_BOARD_TOUCH_RST_IO (-1) // Reset pin, -1 if not used +#define ESP_PANEL_BOARD_TOUCH_RST_LEVEL (0) // Reset active level, 0: low, 1: high +#define ESP_PANEL_BOARD_TOUCH_INT_IO (-1) // Interrupt pin, -1 if not used +#define ESP_PANEL_BOARD_TOUCH_INT_LEVEL (0) // Interrupt active level, 0: low, 1: high + +#endif // ESP_PANEL_BOARD_USE_TOUCH + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +///////////////////////////// Please update the following macros to configure the backlight //////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/** + * @brief Backlight configuration flag (0/1) + * + * Set to `1` to enable backlight support, `0` to disable + */ +#define ESP_PANEL_BOARD_USE_BACKLIGHT (1) + +#if ESP_PANEL_BOARD_USE_BACKLIGHT +/** + * @brief Backlight control type selection + */ +#define ESP_PANEL_BOARD_BACKLIGHT_TYPE (ESP_PANEL_BACKLIGHT_TYPE_PWM_LEDC) + +#if (ESP_PANEL_BOARD_BACKLIGHT_TYPE == ESP_PANEL_BACKLIGHT_TYPE_SWITCH_GPIO) || \ + (ESP_PANEL_BOARD_BACKLIGHT_TYPE == ESP_PANEL_BACKLIGHT_TYPE_SWITCH_EXPANDER) || \ + (ESP_PANEL_BOARD_BACKLIGHT_TYPE == ESP_PANEL_BACKLIGHT_TYPE_PWM_LEDC) + + /** + * @brief Backlight control pin configuration + */ + #define ESP_PANEL_BOARD_BACKLIGHT_IO (7) // Output GPIO pin number + #define ESP_PANEL_BOARD_BACKLIGHT_ON_LEVEL (0) // Active level, 0: low, 1: high + +#endif // ESP_PANEL_BOARD_BACKLIGHT_TYPE + +/** + * @brief Backlight idle state configuration (0/1) + * + * Set to 1 if want to turn off the backlight after initializing. Otherwise, the backlight will be on. + */ +#define ESP_PANEL_BOARD_BACKLIGHT_IDLE_OFF (0) + +#endif // ESP_PANEL_BOARD_USE_BACKLIGHT + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +///////////////////////////// Please update the following macros to configure the IO expander ////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/** + * @brief IO expander configuration flag (0/1) + * + * Set to `1` to enable IO expander support, `0` to disable + */ +#define ESP_PANEL_BOARD_USE_EXPANDER (0) + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////// Please utilize the following macros to execute any additional code if required ///////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////// File Version /////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/** + * Do not change the following versions. These version numbers are used to check compatibility between this + * configuration file and the library. Rules for version numbers: + * 1. Major version mismatch: Configurations are incompatible, must use library version + * 2. Minor version mismatch: May be missing new configurations, recommended to update + * 3. Patch version mismatch: No impact on functionality + */ +#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MAJOR 1 +#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MINOR 0 +#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_PATCH 0 + +// *INDENT-ON* diff --git a/src/board/supported/viewe/BOARD_VIEWE_UEDX80480050E_AC_A.h b/src/board/supported/viewe/BOARD_VIEWE_UEDX80480050E_AC_A.h new file mode 100644 index 00000000..6f30ea6e --- /dev/null +++ b/src/board/supported/viewe/BOARD_VIEWE_UEDX80480050E_AC_A.h @@ -0,0 +1,296 @@ +/* + * SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +/** + * @file BOARD_UEDX80480050E_AC_A.h + * @brief Configuration file for Viewe UEDX80480050E-AC-A + * @author Viewe@VIEWESMART + * @link https://viewedisplay.com/product/esp32-5-inch-800x480-rgb-ips-tft-display-touch-screen-arduino-lvgl/ + */ + +#pragma once + +// *INDENT-OFF* + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////// Please update the following macros to configure general panel ///////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/** + * @brief Board name + */ +#define ESP_PANEL_BOARD_NAME "Viewe:UEDX80480050E-AC-A" + +/** + * @brief Panel resolution configuration in pixels + */ +#define ESP_PANEL_BOARD_WIDTH (800) // Panel width (horizontal, in pixels) +#define ESP_PANEL_BOARD_HEIGHT (480) // Panel height (vertical, in pixels) + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////// Please update the following macros to configure the LCD panel ///////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/** + * @brief LCD panel configuration flag (0/1) + * + * Set to `1` to enable LCD panel support, `0` to disable + */ +#define ESP_PANEL_BOARD_USE_LCD (1) + +#if ESP_PANEL_BOARD_USE_LCD +/** + * @brief LCD controller selection + */ +#define ESP_PANEL_BOARD_LCD_CONTROLLER ST7262 + +/** + * @brief LCD bus type selection + */ +#define ESP_PANEL_BOARD_LCD_BUS_TYPE (ESP_PANEL_BUS_TYPE_RGB) + +/** + * @brief LCD bus parameters configuration + * + * Configure parameters based on the selected bus type. Parameters for other bus types will be ignored. + * For detailed parameter explanations, see: + * https://docs.espressif.com/projects/esp-idf/en/v5.3.1/esp32s3/api-reference/peripherals/lcd/index.html + * https://docs.espressif.com/projects/esp-iot-solution/en/latest/display/lcd/index.html + */ +#if ESP_PANEL_BOARD_LCD_BUS_TYPE == ESP_PANEL_BUS_TYPE_RGB + + /** + * @brief RGB bus + */ + /** + * Set to 0 if using simple "RGB" interface which does not contain "3-wire SPI" interface. + */ + #define ESP_PANEL_BOARD_LCD_RGB_USE_CONTROL_PANEL (0) // 0/1. Typically set to 1 + + /* For refresh panel (RGB) */ + #define ESP_PANEL_BOARD_LCD_RGB_CLK_HZ (20 * 1000 * 1000) + // To increase the upper limit of the PCLK, see: https://docs.espressif.com/projects/esp-faq/en/latest/software-framework/peripherals/lcd.html#how-can-i-increase-the-upper-limit-of-pclk-settings-on-esp32-s3-while-ensuring-normal-rgb-screen-display + #define ESP_PANEL_BOARD_LCD_RGB_HPW (1) + #define ESP_PANEL_BOARD_LCD_RGB_HBP (42) + #define ESP_PANEL_BOARD_LCD_RGB_HFP (20) + #define ESP_PANEL_BOARD_LCD_RGB_VPW (10) + #define ESP_PANEL_BOARD_LCD_RGB_VBP (12) + #define ESP_PANEL_BOARD_LCD_RGB_VFP (4) + #define ESP_PANEL_BOARD_LCD_RGB_PCLK_ACTIVE_NEG (1) // 0: rising edge, 1: falling edge. Typically set to 0 + // The following sheet shows the valid combinations of + // data width and pixel bits: + // ┏---------------------------------┳- -------------------------------┓ + #define ESP_PANEL_BOARD_LCD_RGB_DATA_WIDTH (16) // | 16 | 8 | + #define ESP_PANEL_BOARD_LCD_RGB_PIXEL_BITS (ESP_PANEL_LCD_COLOR_BITS_RGB565) // | ESP_PANEL_LCD_COLOR_BITS_RGB565 | ESP_PANEL_LCD_COLOR_BITS_RGB888 | + // ┗---------------------------------┻---------------------------------┛ + // To understand color format of RGB LCD, see: https://docs.espressif.com/projects/esp-iot-solution/en/latest/display/lcd/rgb_lcd.html#color-formats + #define ESP_PANEL_BOARD_LCD_RGB_BOUNCE_BUF_SIZE (ESP_PANEL_BOARD_WIDTH * 10) + // Bounce buffer size in bytes. It is used to avoid screen drift + // for ESP32-S3. Typically set to `ESP_PANEL_BOARD_WIDTH * 10` + // The size should satisfy `size * N = LCD_width * LCD_height`, + // where N is an even number. + // For more details, see: https://github.com/esp-arduino-libs/ESP32_Display_Panel/blob/master/docs/FAQ.md#how-to-fix-screen-drift-issue-when-driving-rgb-lcd-with-esp32-s3 + #define ESP_PANEL_BOARD_LCD_RGB_IO_HSYNC (6) + #define ESP_PANEL_BOARD_LCD_RGB_IO_VSYNC (5) + #define ESP_PANEL_BOARD_LCD_RGB_IO_DE (4) // -1 if not used + #define ESP_PANEL_BOARD_LCD_RGB_IO_PCLK (7) + #define ESP_PANEL_BOARD_LCD_RGB_IO_DISP (39) // -1 if not used. Typically set to -1 + + // The following sheet shows the mapping of ESP GPIOs to + // LCD data pins with different data width and color format: + // ┏------┳- ------------┳--------------------------┓ + // | ESP: | 8-bit RGB888 | 16-bit RGB565 | + // |------|--------------|--------------------------| + // | LCD: | RGB888 | RGB565 | RGB666 | RGB888 | + // ┗------|--------------|--------|--------|--------| + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA0 (14) // | D0 | B0 | B0-1 | B0-3 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA1 (13) // | D1 | B1 | B2 | B4 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA2 (12) // | D2 | B2 | B3 | B5 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA3 (9) // | D3 | B3 | B4 | B6 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA4 (8) // | D4 | B4 | B5 | B7 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA5 (20) // | D5 | G0 | G0 | G0-2 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA6 (19) // | D6 | G1 | G1 | G3 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA7 (18) // | D7 | G2 | G2 | G4 | +#if ESP_PANEL_BOARD_LCD_RGB_DATA_WIDTH > 8 // ┗--------------┫--------|--------|--------| + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA8 (17) // | G3 | G3 | G5 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA9 (16) // | G4 | G4 | G6 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA10 (15) // | G5 | G5 | G7 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA11 (38) // | R0 | R0-1 | R0-3 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA12 (47) // | R1 | R2 | R4 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA13 (48) // | R2 | R3 | R5 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA14 (41) // | R3 | R4 | R6 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA15 (21) // | R4 | R5 | R7 | + // ┗--------┻--------┻--------┛ +#endif // ESP_PANEL_BOARD_LCD_RGB_DATA_WIDTH + +#endif // ESP_PANEL_BOARD_LCD_BUS_TYPE + +/** + * @brief LCD color configuration + */ +#define ESP_PANEL_BOARD_LCD_COLOR_BITS (ESP_PANEL_LCD_COLOR_BITS_RGB888) + // ESP_PANEL_LCD_COLOR_BITS_RGB565/RGB666/RGB888 +#define ESP_PANEL_BOARD_LCD_COLOR_BGR_ORDER (0) // 0: RGB, 1: BGR +#define ESP_PANEL_BOARD_LCD_COLOR_INEVRT_BIT (0) // 0/1 + +/** + * @brief LCD transformation configuration + */ +#define ESP_PANEL_BOARD_LCD_SWAP_XY (0) // 0/1 +#define ESP_PANEL_BOARD_LCD_MIRROR_X (0) // 0/1 +#define ESP_PANEL_BOARD_LCD_MIRROR_Y (0) // 0/1 +#define ESP_PANEL_BOARD_LCD_GAP_X (0) // [0, ESP_PANEL_BOARD_WIDTH] +#define ESP_PANEL_BOARD_LCD_GAP_Y (0) // [0, ESP_PANEL_BOARD_HEIGHT] + +/** + * @brief LCD reset pin configuration + */ +#define ESP_PANEL_BOARD_LCD_RST_IO (-1) // Reset pin, -1 if not used +#define ESP_PANEL_BOARD_LCD_RST_LEVEL (0) // Reset active level, 0: low, 1: high + +#endif // ESP_PANEL_BOARD_USE_LCD + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////// Please update the following macros to configure the touch panel /////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/** + * @brief Touch panel configuration flag (0/1) + * + * Set to `1` to enable touch panel support, `0` to disable + */ +#define ESP_PANEL_BOARD_USE_TOUCH (0) + +#if ESP_PANEL_BOARD_USE_TOUCH +/** + * @brief Touch controller selection + */ +#define ESP_PANEL_BOARD_TOUCH_CONTROLLER GT911 + +/** + * @brief Touch bus type selection + */ +#define ESP_PANEL_BOARD_TOUCH_BUS_TYPE (ESP_PANEL_BUS_TYPE_I2C) + +#if (ESP_PANEL_BOARD_TOUCH_BUS_TYPE == ESP_PANEL_BUS_TYPE_I2C) || \ + (ESP_PANEL_BOARD_TOUCH_BUS_TYPE == ESP_PANEL_BUS_TYPE_SPI) +/** + * If set to 1, the bus will skip to initialize the corresponding host. Users need to initialize the host in advance. + * + * For drivers which created by this library, even if they use the same host, the host will be initialized only once. + * So it is not necessary to set the macro to `1`. For other drivers (like `Wire`), please set the macro to `1` + * ensure that the host is initialized only once. + */ +#define ESP_PANEL_BOARD_TOUCH_BUS_SKIP_INIT_HOST (0) // 0/1. Typically set to 0 +#endif + +/** + * @brief Touch bus parameters configuration + */ +#if ESP_PANEL_BOARD_TOUCH_BUS_TYPE == ESP_PANEL_BUS_TYPE_I2C + + /** + * @brief I2C bus + */ + /* For general */ + #define ESP_PANEL_BOARD_TOUCH_I2C_HOST_ID (0) // Typically set to 0 +#if !ESP_PANEL_BOARD_TOUCH_BUS_SKIP_INIT_HOST + /* For host */ + #define ESP_PANEL_BOARD_TOUCH_I2C_CLK_HZ (400 * 1000) + // Typically set to 400K + #define ESP_PANEL_BOARD_TOUCH_I2C_SCL_PULLUP (1) // 0/1. Typically set to 1 + #define ESP_PANEL_BOARD_TOUCH_I2C_SDA_PULLUP (1) // 0/1. Typically set to 1 + #define ESP_PANEL_BOARD_TOUCH_I2C_IO_SCL (20) + #define ESP_PANEL_BOARD_TOUCH_I2C_IO_SDA (19) +#endif + /* For panel */ + #define ESP_PANEL_BOARD_TOUCH_I2C_ADDRESS (0) // Typically set to 0 to use the default address. + // - For touchs with only one address, set to 0 + // - For touchs with multiple addresses, set to 0 or + // the address. Like GT911, there are two addresses: + // 0x5D(default) and 0x14 + +#endif // ESP_PANEL_BOARD_TOUCH_BUS_TYPE + +/** + * @brief Touch panel transformation flags + */ +#define ESP_PANEL_BOARD_TOUCH_SWAP_XY (0) // 0/1 +#define ESP_PANEL_BOARD_TOUCH_MIRROR_X (0) // 0/1 +#define ESP_PANEL_BOARD_TOUCH_MIRROR_Y (0) // 0/1 + +/** + * @brief Touch panel control pins + */ +#define ESP_PANEL_BOARD_TOUCH_RST_IO (-1) // Reset pin, -1 if not used +#define ESP_PANEL_BOARD_TOUCH_RST_LEVEL (0) // Reset active level, 0: low, 1: high +#define ESP_PANEL_BOARD_TOUCH_INT_IO (-1) // Interrupt pin, -1 if not used +#define ESP_PANEL_BOARD_TOUCH_INT_LEVEL (0) // Interrupt active level, 0: low, 1: high + +#endif // ESP_PANEL_BOARD_USE_TOUCH + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +///////////////////////////// Please update the following macros to configure the backlight //////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/** + * @brief Backlight configuration flag (0/1) + * + * Set to `1` to enable backlight support, `0` to disable + */ +#define ESP_PANEL_BOARD_USE_BACKLIGHT (1) + +#if ESP_PANEL_BOARD_USE_BACKLIGHT +/** + * @brief Backlight control type selection + */ +#define ESP_PANEL_BOARD_BACKLIGHT_TYPE (ESP_PANEL_BACKLIGHT_TYPE_PWM_LEDC) + +#if (ESP_PANEL_BOARD_BACKLIGHT_TYPE == ESP_PANEL_BACKLIGHT_TYPE_SWITCH_GPIO) || \ + (ESP_PANEL_BOARD_BACKLIGHT_TYPE == ESP_PANEL_BACKLIGHT_TYPE_SWITCH_EXPANDER) || \ + (ESP_PANEL_BOARD_BACKLIGHT_TYPE == ESP_PANEL_BACKLIGHT_TYPE_PWM_LEDC) + + /** + * @brief Backlight control pin configuration + */ + #define ESP_PANEL_BOARD_BACKLIGHT_IO (40) // Output GPIO pin number + #define ESP_PANEL_BOARD_BACKLIGHT_ON_LEVEL (1) // Active level, 0: low, 1: high + +#endif // ESP_PANEL_BOARD_BACKLIGHT_TYPE + +/** + * @brief Backlight idle state configuration (0/1) + * + * Set to 1 if want to turn off the backlight after initializing. Otherwise, the backlight will be on. + */ +#define ESP_PANEL_BOARD_BACKLIGHT_IDLE_OFF (0) + +#endif // ESP_PANEL_BOARD_USE_BACKLIGHT + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +///////////////////////////// Please update the following macros to configure the IO expander ////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/** + * @brief IO expander configuration flag (0/1) + * + * Set to `1` to enable IO expander support, `0` to disable + */ +#define ESP_PANEL_BOARD_USE_EXPANDER (0) + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////// Please utilize the following macros to execute any additional code if required ///////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////// File Version /////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/** + * Do not change the following versions. These version numbers are used to check compatibility between this + * configuration file and the library. Rules for version numbers: + * 1. Major version mismatch: Configurations are incompatible, must use library version + * 2. Minor version mismatch: May be missing new configurations, recommended to update + * 3. Patch version mismatch: No impact on functionality + */ +#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MAJOR 1 +#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MINOR 0 +#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_PATCH 0 + +// *INDENT-ON* diff --git a/src/board/supported/viewe/Kconfig.viewe b/src/board/supported/viewe/Kconfig.viewe index b7e51b28..82c4ed66 100644 --- a/src/board/supported/viewe/Kconfig.viewe +++ b/src/board/supported/viewe/Kconfig.viewe @@ -1,3 +1,36 @@ +config BOARD_VIEWE_SMARTRING + bool "SMARTRING" + help + https://github.com/VIEWESMART/SMARTRING/tree/main/information + +config BOARD_VIEWE_UEDX24240013_MD50E + bool "UEDX24240013-MD50E" + help + https://github.com/VIEWESMART/UEDX24240013-MD50ESP32_1.3inch-Knob/tree/main/information + +config BOARD_VIEWE_UEDX46460015_MD50ET + bool "UEDX46460015-MD50ET" + help + https://github.com/VIEWESMART/UEDX46460015-MD50ESP32-1.5inch-Touch-Knob-Display/tree/main/datasheet + +config BOARD_VIEWE_UEDX48480021_MD80E + bool "UEDX48480021_MD80E" + help + https://github.com/VIEWESMART/UEDX48480021-MD80ESP32_2.1inch-Knob/tree/main/information + +config BOARD_VIEWE_UEDX48480021_MD80E_V2 + bool "UEDX48480021_MD80E_V2" + help + https://github.com/VIEWESMART/UEDX48480021-MD80ESP32_2.1inch-Knob/tree/main/information + +config BOARD_VIEWE_UEDX48480021_MD80ET + bool "UEDX48480021_MD80ET" + help + https://github.com/VIEWESMART/UEDX48480021-MD80ESP32-2.1inch-Touch-Knob-Display/tree/main/information + +config BOARD_VIEWE_UEDX48480028_MD80ET + bool "UEDX48480028_MD80ET" + config BOARD_VIEWE_UEDX24320024E_WB_A bool "UEDX24320024E-WB-A" help @@ -38,6 +71,11 @@ config BOARD_VIEWE_UEDX80480050E_WB_A help https://viewedisplay.com/product/esp32-5-inch-800x480-rgb-ips-tft-display-touch-screen-arduino-lvgl/ +config BOARD_VIEWE_UEDX80480050E_AC_A + bool "UEDX80480050E-AC-A" + help + https://viewedisplay.com/product/esp32-5-inch-800x480-rgb-ips-tft-display-touch-screen-arduino-lvgl/ + config BOARD_VIEWE_UEDX80480050E_WB_A_2 bool "UEDX80480050E-WB-A-2" help diff --git a/src/board/supported/waveshare/BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_1_85_C.h b/src/board/supported/waveshare/BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_1_85_C.h new file mode 100644 index 00000000..ed055636 --- /dev/null +++ b/src/board/supported/waveshare/BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_1_85_C.h @@ -0,0 +1,338 @@ +/* + * SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +/** + * @file BOARD_ESP32_S3_TOUCH_LCD_1_85_C.h + * @brief Configuration file for Waveshare ESP32_S3_TOUCH_LCD_1_85_C + * @author @martinroger & Waveshare@H-sw123 + * @link https://www.waveshare.com/esp32-s3-touch-lcd-1.85c.htm + */ + +#pragma once + +// *INDENT-OFF* + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////// Please update the following macros to configure general panel ///////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/** + * @brief Board name + */ +#define ESP_PANEL_BOARD_NAME "Waveshare:ESP32_S3_TOUCH_LCD_1_85_C" + +/** + * @brief Panel resolution configuration in pixels + */ +#define ESP_PANEL_BOARD_WIDTH (360) // Panel width (horizontal, in pixels) +#define ESP_PANEL_BOARD_HEIGHT (360) // Panel height (vertical, in pixels) + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////// Please update the following macros to configure the LCD panel ///////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/** + * @brief LCD panel configuration flag (0/1) + * + * Set to `1` to enable LCD panel support, `0` to disable + */ +#define ESP_PANEL_BOARD_USE_LCD (1) + +#if ESP_PANEL_BOARD_USE_LCD +/** + * @brief LCD controller selection + */ +#define ESP_PANEL_BOARD_LCD_CONTROLLER ST77916 + +/** + * @brief LCD bus type selection + */ +#define ESP_PANEL_BOARD_LCD_BUS_TYPE (ESP_PANEL_BUS_TYPE_QSPI) + +#if (ESP_PANEL_BOARD_LCD_BUS_TYPE == ESP_PANEL_BUS_TYPE_SPI) || \ + (ESP_PANEL_BOARD_LCD_BUS_TYPE == ESP_PANEL_BUS_TYPE_QSPI) +/** + * If set to 1, the bus will skip to initialize the corresponding host. Users need to initialize the host in advance. + * + * For drivers which created by this library, even if they use the same host, the host will be initialized only once. + * So it is not necessary to set the macro to `1`. For other drivers (like `Wire`), please set the macro to `1` + * ensure that the host is initialized only once. + */ +#define ESP_PANEL_BOARD_LCD_BUS_SKIP_INIT_HOST (0) // 0/1. Typically set to 0 +#endif + +/** + * @brief LCD bus parameters configuration + * + * Configure parameters based on the selected bus type. Parameters for other bus types will be ignored. + * For detailed parameter explanations, see: + * https://docs.espressif.com/projects/esp-idf/en/v5.3.1/esp32s3/api-reference/peripherals/lcd/index.html + * https://docs.espressif.com/projects/esp-iot-solution/en/latest/display/lcd/index.html + */ +#if ESP_PANEL_BOARD_LCD_BUS_TYPE == ESP_PANEL_BUS_TYPE_QSPI + + /** + * @brief QSPI bus + */ + /* For general */ + #define ESP_PANEL_BOARD_LCD_QSPI_HOST_ID (2) +#if !ESP_PANEL_BOARD_LCD_BUS_SKIP_INIT_HOST + /* For host */ + #define ESP_PANEL_BOARD_LCD_QSPI_IO_SCK (40) + #define ESP_PANEL_BOARD_LCD_QSPI_IO_DATA0 (46) + #define ESP_PANEL_BOARD_LCD_QSPI_IO_DATA1 (45) + #define ESP_PANEL_BOARD_LCD_QSPI_IO_DATA2 (42) + #define ESP_PANEL_BOARD_LCD_QSPI_IO_DATA3 (41) +#endif // ESP_PANEL_BOARD_LCD_BUS_SKIP_INIT_HOST + /* For panel */ + #define ESP_PANEL_BOARD_LCD_QSPI_IO_CS (21) // -1 if not used + #define ESP_PANEL_BOARD_LCD_QSPI_MODE (0) // 0-3, typically set to 0 + #define ESP_PANEL_BOARD_LCD_QSPI_CLK_HZ (80 * 1000 * 1000) + // Should be an integer divisor of 80M, typically set to 40M + #define ESP_PANEL_BOARD_LCD_QSPI_CMD_BITS (32) // Typically set to 32 + #define ESP_PANEL_BOARD_LCD_QSPI_PARAM_BITS (8) // Typically set to 8 + +#endif // ESP_PANEL_BOARD_LCD_BUS_TYPE + +/** + * @brief LCD color configuration + */ +#define ESP_PANEL_BOARD_LCD_COLOR_BITS (ESP_PANEL_LCD_COLOR_BITS_RGB565) + // ESP_PANEL_LCD_COLOR_BITS_RGB565/RGB666/RGB888 +#define ESP_PANEL_BOARD_LCD_COLOR_BGR_ORDER (0) // 0: RGB, 1: BGR +#define ESP_PANEL_BOARD_LCD_COLOR_INEVRT_BIT (1) // 0/1 + +/** + * @brief LCD transformation configuration + */ +#define ESP_PANEL_BOARD_LCD_SWAP_XY (0) // 0/1 +#define ESP_PANEL_BOARD_LCD_MIRROR_X (0) // 0/1 +#define ESP_PANEL_BOARD_LCD_MIRROR_Y (0) // 0/1 +#define ESP_PANEL_BOARD_LCD_GAP_X (0) // [0, ESP_PANEL_BOARD_WIDTH] +#define ESP_PANEL_BOARD_LCD_GAP_Y (0) // [0, ESP_PANEL_BOARD_HEIGHT] + +/** + * @brief LCD reset pin configuration + */ +#define ESP_PANEL_BOARD_LCD_RST_IO (-1) // Reset pin, -1 if not used +#define ESP_PANEL_BOARD_LCD_RST_LEVEL (0) // Reset active level, 0: low, 1: high + +#endif // ESP_PANEL_BOARD_USE_LCD + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////// Please update the following macros to configure the touch panel /////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/** + * @brief Touch panel configuration flag (0/1) + * + * Set to `1` to enable touch panel support, `0` to disable + */ +#define ESP_PANEL_BOARD_USE_TOUCH (1) + +#if ESP_PANEL_BOARD_USE_TOUCH +/** + * @brief Touch controller selection + */ +#define ESP_PANEL_BOARD_TOUCH_CONTROLLER CST816S + +/** + * @brief Touch bus type selection + */ +#define ESP_PANEL_BOARD_TOUCH_BUS_TYPE (ESP_PANEL_BUS_TYPE_I2C) + +#if (ESP_PANEL_BOARD_TOUCH_BUS_TYPE == ESP_PANEL_BUS_TYPE_I2C) || \ + (ESP_PANEL_BOARD_TOUCH_BUS_TYPE == ESP_PANEL_BUS_TYPE_SPI) +/** + * If set to 1, the bus will skip to initialize the corresponding host. Users need to initialize the host in advance. + * + * For drivers which created by this library, even if they use the same host, the host will be initialized only once. + * So it is not necessary to set the macro to `1`. For other drivers (like `Wire`), please set the macro to `1` + * ensure that the host is initialized only once. + */ +#define ESP_PANEL_BOARD_TOUCH_BUS_SKIP_INIT_HOST (0) // 0/1. Typically set to 0 +#endif + +/** + * @brief Touch bus parameters configuration + */ +#if ESP_PANEL_BOARD_TOUCH_BUS_TYPE == ESP_PANEL_BUS_TYPE_I2C + + /** + * @brief I2C bus + */ + /* For general */ + #define ESP_PANEL_BOARD_TOUCH_I2C_HOST_ID (1) // Typically set to 0 +#if !ESP_PANEL_BOARD_TOUCH_BUS_SKIP_INIT_HOST + /* For host */ + #define ESP_PANEL_BOARD_TOUCH_I2C_CLK_HZ (400 * 1000) + // Typically set to 400K + #define ESP_PANEL_BOARD_TOUCH_I2C_SCL_PULLUP (1) // 0/1. Typically set to 1 + #define ESP_PANEL_BOARD_TOUCH_I2C_SDA_PULLUP (1) // 0/1. Typically set to 1 + #define ESP_PANEL_BOARD_TOUCH_I2C_IO_SCL (10) + #define ESP_PANEL_BOARD_TOUCH_I2C_IO_SDA (11) +#endif + /* For panel */ + #define ESP_PANEL_BOARD_TOUCH_I2C_ADDRESS (0) // Typically set to 0 to use the default address. + // - For touchs with only one address, set to 0 + // - For touchs with multiple addresses, set to 0 or + // the address. Like GT911, there are two addresses: + // 0x5D(default) and 0x14 + +#endif // ESP_PANEL_BOARD_TOUCH_BUS_TYPE + +/** + * @brief Touch panel transformation flags + */ +#define ESP_PANEL_BOARD_TOUCH_SWAP_XY (0) // 0/1 +#define ESP_PANEL_BOARD_TOUCH_MIRROR_X (0) // 0/1 +#define ESP_PANEL_BOARD_TOUCH_MIRROR_Y (0) // 0/1 + +/** + * @brief Touch panel control pins + */ +#define ESP_PANEL_BOARD_TOUCH_RST_IO (-1) // Reset pin, -1 if not used +#define ESP_PANEL_BOARD_TOUCH_RST_LEVEL (0) // Reset active level, 0: low, 1: high +#define ESP_PANEL_BOARD_TOUCH_INT_IO (4) // Interrupt pin, -1 if not used +#define ESP_PANEL_BOARD_TOUCH_INT_LEVEL (0) // Interrupt active level, 0: low, 1: high + +#endif // ESP_PANEL_BOARD_USE_TOUCH + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +///////////////////////////// Please update the following macros to configure the backlight //////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/** + * @brief Backlight configuration flag (0/1) + * + * Set to `1` to enable backlight support, `0` to disable + */ +#define ESP_PANEL_BOARD_USE_BACKLIGHT (1) + +#if ESP_PANEL_BOARD_USE_BACKLIGHT +/** + * @brief Backlight control type selection + */ +#define ESP_PANEL_BOARD_BACKLIGHT_TYPE (ESP_PANEL_BACKLIGHT_TYPE_PWM_LEDC) + +#if (ESP_PANEL_BOARD_BACKLIGHT_TYPE == ESP_PANEL_BACKLIGHT_TYPE_SWITCH_GPIO) || \ + (ESP_PANEL_BOARD_BACKLIGHT_TYPE == ESP_PANEL_BACKLIGHT_TYPE_SWITCH_EXPANDER) || \ + (ESP_PANEL_BOARD_BACKLIGHT_TYPE == ESP_PANEL_BACKLIGHT_TYPE_PWM_LEDC) + + /** + * @brief Backlight control pin configuration + */ + #define ESP_PANEL_BOARD_BACKLIGHT_IO (5) // Output GPIO pin number + #define ESP_PANEL_BOARD_BACKLIGHT_ON_LEVEL (1) // Active level, 0: low, 1: high + +#endif // ESP_PANEL_BOARD_BACKLIGHT_TYPE + +/** + * @brief Backlight idle state configuration (0/1) + * + * Set to 1 if want to turn off the backlight after initializing. Otherwise, the backlight will be on. + */ +#define ESP_PANEL_BOARD_BACKLIGHT_IDLE_OFF (0) + +#endif // ESP_PANEL_BOARD_USE_BACKLIGHT + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +///////////////////////////// Please update the following macros to configure the IO expander ////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/** + * @brief IO expander configuration flag (0/1) + * + * Set to `1` to enable IO expander support, `0` to disable + */ +#define ESP_PANEL_BOARD_USE_EXPANDER (1) + +#if ESP_PANEL_BOARD_USE_EXPANDER +/** + * @brief IO expander chip selection + */ +#define ESP_PANEL_BOARD_EXPANDER_CHIP TCA95XX_8BIT + +/** + * @brief IO expander I2C bus parameters configuration + */ +/** + * If set to 1, the bus will skip to initialize the corresponding host. Users need to initialize the host in advance. + * + * For drivers which created by this library, even if they use the same host, the host will be initialized only once. + * So it is not necessary to set the macro to `1`. For other devices, please set the macro to `1` ensure that the + * host is initialized only once. + */ +#define ESP_PANEL_BOARD_EXPANDER_SKIP_INIT_HOST (0) // 0/1 +/* For general */ +#define ESP_PANEL_BOARD_EXPANDER_I2C_HOST_ID (0) // Typically set to 0 +/* For host */ +#if !ESP_PANEL_BOARD_EXPANDER_SKIP_INIT_HOST +#define ESP_PANEL_BOARD_EXPANDER_I2C_CLK_HZ (400 * 1000) + // Typically set to 400K +#define ESP_PANEL_BOARD_EXPANDER_I2C_SCL_PULLUP (0) // 0/1. Typically set to 1 +#define ESP_PANEL_BOARD_EXPANDER_I2C_SDA_PULLUP (0) // 0/1. Typically set to 1 +#define ESP_PANEL_BOARD_EXPANDER_I2C_IO_SCL (10) +#define ESP_PANEL_BOARD_EXPANDER_I2C_IO_SDA (11) +#endif // ESP_PANEL_BOARD_EXPANDER_SKIP_INIT_HOST +/* For device */ +#define ESP_PANEL_BOARD_EXPANDER_I2C_ADDRESS (0x20) // The actual I2C address. Even for the same model of IC, + // the I2C address may be different, and confirmation based on + // the actual hardware connection is required +#endif // ESP_PANEL_BOARD_USE_EXPANDER + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////// Please utilize the following macros to execute any additional code if required ///////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/** + * @brief Pre-begin function for LCD initialization + * + * @param[in] p Pointer to the board object + * @return true on success, false on failure + */ +#define ESP_PANEL_BOARD_LCD_PRE_BEGIN_FUNCTION(p) \ + { \ + constexpr int LCD_RST = 1; \ + auto board = static_cast(p); \ + auto expander = board->getIO_Expander()->getBase(); \ + /* LCD reset */ \ + expander->pinMode(LCD_RST, OUTPUT); \ + expander->digitalWrite(LCD_RST, LOW); \ + vTaskDelay(pdMS_TO_TICKS(10)); \ + expander->digitalWrite(LCD_RST, HIGH); \ + vTaskDelay(pdMS_TO_TICKS(100)); \ + return true; \ + } + +/** + * @brief Pre-begin function for touch panel initialization + * + * @param[in] p Pointer to the board object + * @return true on success, false on failure + */ +#define ESP_PANEL_BOARD_TOUCH_PRE_BEGIN_FUNCTION(p) \ + { \ + constexpr int TP_RST = 0; \ + auto board = static_cast(p); \ + auto expander = board->getIO_Expander()->getBase(); \ + /* Touch reset */ \ + expander->pinMode(TP_RST, OUTPUT); \ + expander->digitalWrite(TP_RST, LOW); \ + vTaskDelay(pdMS_TO_TICKS(30)); \ + expander->digitalWrite(TP_RST, HIGH); \ + vTaskDelay(pdMS_TO_TICKS(50)); \ + return true; \ + } + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////// File Version /////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/** + * Do not change the following versions. These version numbers are used to check compatibility between this + * configuration file and the library. Rules for version numbers: + * 1. Major version mismatch: Configurations are incompatible, must use library version + * 2. Minor version mismatch: May be missing new configurations, recommended to update + * 3. Patch version mismatch: No impact on functionality + */ +#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MAJOR 1 +#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MINOR 0 +#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_PATCH 0 + +// *INDENT-ON* diff --git a/src/board/supported/waveshare/BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_2_1.h b/src/board/supported/waveshare/BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_2_1.h index dcd6dbf1..38756503 100644 --- a/src/board/supported/waveshare/BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_2_1.h +++ b/src/board/supported/waveshare/BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_2_1.h @@ -265,7 +265,6 @@ /** * @brief Touch bus type selection - * - `ESP_PANEL_BUS_TYPE_SPI` */ #define ESP_PANEL_BOARD_TOUCH_BUS_TYPE (ESP_PANEL_BUS_TYPE_I2C) diff --git a/src/board/supported/waveshare/BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_2_8_C.h b/src/board/supported/waveshare/BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_2_8_C.h new file mode 100644 index 00000000..7cfd5c6f --- /dev/null +++ b/src/board/supported/waveshare/BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_2_8_C.h @@ -0,0 +1,464 @@ +/* + * SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +/** + * @file BOARD_ESP32_S3_TOUCH_LCD_2_8_C.h + * @brief Configuration file for Waveshare ESP32_S3_TOUCH_LCD_2_8_C + * @author @martinroger + * @link https://www.waveshare.com/esp32-s3-touch-lcd-2.8c.htm + */ + +#pragma once + +// *INDENT-OFF* + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +///////////////////////// Please update the following macros to configure general parameters /////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/** + * @brief Board name (format: "Manufacturer:Model") + */ +#define ESP_PANEL_BOARD_NAME "Waveshare:ESP32_S3_TOUCH_LCD_2_8_C" + +/** + * @brief Panel resolution configuration in pixels + */ +#define ESP_PANEL_BOARD_WIDTH (480) // Panel width (horizontal, in pixels) +#define ESP_PANEL_BOARD_HEIGHT (480) // Panel height (vertical, in pixels) + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////// Please update the following macros to configure the LCD panel ///////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/** + * @brief LCD panel configuration flag (0/1) + * + * Set to `1` to enable LCD panel support, `0` to disable + */ +#define ESP_PANEL_BOARD_USE_LCD (1) + +#if ESP_PANEL_BOARD_USE_LCD +/** + * @brief LCD controller selection + */ +#define ESP_PANEL_BOARD_LCD_CONTROLLER ST7701 + +/** + * @brief LCD bus type selection + */ +#define ESP_PANEL_BOARD_LCD_BUS_TYPE (ESP_PANEL_BUS_TYPE_RGB) + +/** + * @brief LCD bus parameters configuration + * + * Configure parameters based on the selected bus type. Parameters for other bus types will be ignored. + * For detailed parameter explanations, see: + * https://docs.espressif.com/projects/esp-idf/en/v5.3.1/esp32s3/api-reference/peripherals/lcd/index.html + * https://docs.espressif.com/projects/esp-iot-solution/en/latest/display/lcd/index.html + */ +#if ESP_PANEL_BOARD_LCD_BUS_TYPE == ESP_PANEL_BUS_TYPE_RGB + + /** + * @brief RGB bus + */ + /** + * Set to 0 if using simple "RGB" interface which does not contain "3-wire SPI" interface. + */ + #define ESP_PANEL_BOARD_LCD_RGB_USE_CONTROL_PANEL (1) // 0/1. Typically set to 1 + +#if ESP_PANEL_BOARD_LCD_RGB_USE_CONTROL_PANEL + /* For control panel (3wire-SPI) */ + #define ESP_PANEL_BOARD_LCD_RGB_SPI_IO_CS (2) + #define ESP_PANEL_BOARD_LCD_RGB_SPI_IO_SCK (2) + #define ESP_PANEL_BOARD_LCD_RGB_SPI_IO_SDA (1) + #define ESP_PANEL_BOARD_LCD_RGB_SPI_CS_USE_EXPNADER (1) // Set to 1 if the signal is controlled by an IO expander + #define ESP_PANEL_BOARD_LCD_RGB_SPI_SCL_USE_EXPNADER (0) // Set to 1 if the signal is controlled by an IO expander + #define ESP_PANEL_BOARD_LCD_RGB_SPI_SDA_USE_EXPNADER (0) // Set to 1 if the signal is controlled by an IO expander + #define ESP_PANEL_BOARD_LCD_RGB_SPI_MODE (0) // 0-3, typically set to 0 + #define ESP_PANEL_BOARD_LCD_RGB_SPI_CMD_BYTES (1) // Typically set to 1 + #define ESP_PANEL_BOARD_LCD_RGB_SPI_PARAM_BYTES (1) // Typically set to 1 + #define ESP_PANEL_BOARD_LCD_RGB_SPI_USE_DC_BIT (1) // 0/1. Typically set to 1 +#endif // ESP_PANEL_BOARD_LCD_RGB_USE_CONTROL_PANEL + /* For refresh panel (RGB) */ + #define ESP_PANEL_BOARD_LCD_RGB_CLK_HZ (18 * 1000 * 1000) + // To increase the upper limit of the PCLK, see: https://docs.espressif.com/projects/esp-faq/en/latest/software-framework/peripherals/lcd.html#how-can-i-increase-the-upper-limit-of-pclk-settings-on-esp32-s3-while-ensuring-normal-rgb-screen-display + #define ESP_PANEL_BOARD_LCD_RGB_HPW (8) + #define ESP_PANEL_BOARD_LCD_RGB_HBP (10) + #define ESP_PANEL_BOARD_LCD_RGB_HFP (50) + #define ESP_PANEL_BOARD_LCD_RGB_VPW (2) + #define ESP_PANEL_BOARD_LCD_RGB_VBP (18) + #define ESP_PANEL_BOARD_LCD_RGB_VFP (8) + #define ESP_PANEL_BOARD_LCD_RGB_PCLK_ACTIVE_NEG (0) // 0: rising edge, 1: falling edge. Typically set to 0 + // The following sheet shows the valid combinations of + // data width and pixel bits: + // ┏---------------------------------┳- -------------------------------┓ + #define ESP_PANEL_BOARD_LCD_RGB_DATA_WIDTH (16) // | 16 | 8 | + #define ESP_PANEL_BOARD_LCD_RGB_PIXEL_BITS (ESP_PANEL_LCD_COLOR_BITS_RGB565) // | ESP_PANEL_LCD_COLOR_BITS_RGB565 | ESP_PANEL_LCD_COLOR_BITS_RGB888 | + // ┗---------------------------------┻---------------------------------┛ + // To understand color format of RGB LCD, see: https://docs.espressif.com/projects/esp-iot-solution/en/latest/display/lcd/rgb_lcd.html#color-formats + #define ESP_PANEL_BOARD_LCD_RGB_BOUNCE_BUF_SIZE (ESP_PANEL_BOARD_WIDTH * 10) + // Bounce buffer size in bytes. It is used to avoid screen drift + // for ESP32-S3. Typically set to `ESP_PANEL_BOARD_WIDTH * 10` + // The size should satisfy `size * N = LCD_width * LCD_height`, + // where N is an even number. + // For more details, see: https://github.com/esp-arduino-libs/ESP32_Display_Panel/blob/master/docs/FAQ.md#how-to-fix-screen-drift-issue-when-driving-rgb-lcd-with-esp32-s3 + #define ESP_PANEL_BOARD_LCD_RGB_IO_HSYNC (38) + #define ESP_PANEL_BOARD_LCD_RGB_IO_VSYNC (39) + #define ESP_PANEL_BOARD_LCD_RGB_IO_DE (40) // -1 if not used + #define ESP_PANEL_BOARD_LCD_RGB_IO_PCLK (41) + #define ESP_PANEL_BOARD_LCD_RGB_IO_DISP (-1) // -1 if not used. Typically set to -1 + + // The following sheet shows the mapping of ESP GPIOs to + // LCD data pins with different data width and color format: + // ┏------┳- ------------┳--------------------------┓ + // | ESP: | 8-bit RGB888 | 16-bit RGB565 | + // |------|--------------|--------------------------| + // | LCD: | RGB888 | RGB565 | RGB666 | RGB888 | + // ┗------|--------------|--------|--------|--------| + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA0 (5) // | D0 | B0 | B0-1 | B0-3 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA1 (45) // | D1 | B1 | B2 | B4 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA2 (48) // | D2 | B2 | B3 | B5 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA3 (47) // | D3 | B3 | B4 | B6 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA4 (21) // | D4 | B4 | B5 | B7 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA5 (14) // | D5 | G0 | G0 | G0-2 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA6 (13) // | D6 | G1 | G1 | G3 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA7 (12) // | D7 | G2 | G2 | G4 | +#if ESP_PANEL_BOARD_LCD_RGB_DATA_WIDTH > 8 // ┗--------------┫--------|--------|--------| + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA8 (11) // | G3 | G3 | G5 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA9 (10) // | G4 | G4 | G6 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA10 (9) // | G5 | G5 | G7 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA11 (46) // | R0 | R0-1 | R0-3 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA12 (3) // | R1 | R2 | R4 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA13 (8) // | R2 | R3 | R5 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA14 (18) // | R3 | R4 | R6 | + #define ESP_PANEL_BOARD_LCD_RGB_IO_DATA15 (17) // | R4 | R5 | R7 | + // ┗--------┻--------┻--------┛ +#endif // ESP_PANEL_BOARD_LCD_RGB_DATA_WIDTH + +#endif // ESP_PANEL_BOARD_LCD_BUS_TYPE + +/** + * @brief LCD specific flags configuration + * + * These flags are specific to the "3-wire SPI + RGB" bus. + */ +#if (ESP_PANEL_BOARD_LCD_BUS_TYPE == ESP_PANEL_BUS_TYPE_RGB) && ESP_PANEL_BOARD_LCD_RGB_USE_CONTROL_PANEL +/** + * @brief Enable IO multiplex + * + * Set to 1 if the 3-wire SPI pins are sharing other pins of the RGB interface to save GPIOs. Then, the control panel + * and its pins (except CS signal) will be released after LCD call `init()`. All `*_by_cmd` flags will be invalid. + */ +#define ESP_PANEL_BOARD_LCD_FLAGS_ENABLE_IO_MULTIPLEX (0) // typically set to 0 +/** + * @brief Mirror by command + * + * Set to 1 if the `mirror()` function will be implemented by LCD command. Otherwise, the function will be implemented by + * software. Only valid when `ESP_PANEL_BOARD_LCD_FLAGS_ENABLE_IO_MULTIPLEX` is 0. + */ +#define ESP_PANEL_BOARD_LCD_FLAGS_MIRROR_BY_CMD (!ESP_PANEL_BOARD_LCD_FLAGS_ENABLE_IO_MULTIPLEX) +#endif // ESP_PANEL_BOARD_LCD_RGB_USE_CONTROL_PANEL + +/** + * @brief LCD vendor initialization commands + * + * Vendor specific initialization can be different between manufacturers, should consult the LCD supplier for + * initialization sequence code. Please uncomment and change the following macro definitions. Otherwise, the LCD driver + * will use the default initialization sequence code. + * + * The initialization sequence can be specified in two formats: + * 1. Raw format: + * {command, (uint8_t []){data0, data1, ...}, data_size, delay_ms} + * 2. Helper macros: + * - ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(delay_ms, command, {data0, data1, ...}) + * - ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(delay_ms, command) + */ +#define ESP_PANEL_BOARD_LCD_VENDOR_INIT_CMD() \ + { \ + {0xFF, (uint8_t []){0x77, 0x01, 0x00, 0x00, 0x13}, 5, 0},\ + {0xEF, (uint8_t []){0x08}, 1, 0},\ + {0xFF, (uint8_t []){0x77, 0x01, 0x00, 0x00, 0x10}, 5, 0},\ + {0xC0, (uint8_t []){0x3B, 0x00}, 2, 0},\ + {0xC1, (uint8_t []){0x10, 0x0C}, 2, 0},\ + {0xC2, (uint8_t []){0x07, 0x0A}, 2, 0},\ + {0xC7, (uint8_t []){0x00}, 1, 0},\ + {0xCC, (uint8_t []){0x10}, 1, 0},\ + {0xCD, (uint8_t []){0x08}, 1, 0},\ + {0xB0, (uint8_t []){0x05, 0x12, 0x98, 0x0E, 0x0F, 0x07, 0x07, 0x09, 0x09, 0x23, 0x05, 0x52, 0x0F, 0x67, 0x2C, 0x11}, 16, 0},\ + {0xB1, (uint8_t []){0x0B, 0x11, 0x97, 0x0C, 0x12, 0x06, 0x06, 0x08, 0x08, 0x22, 0x03, 0x51, 0x11, 0x66, 0x2B, 0x0F}, 16, 0},\ + {0xFF, (uint8_t []){0x77, 0x01, 0x00, 0x00, 0x11}, 5, 0},\ + {0xB0, (uint8_t []){0x5D}, 1, 0},\ + {0xB1, (uint8_t []){0x3E}, 1, 0},\ + {0xB2, (uint8_t []){0x81}, 1, 0},\ + {0xB3, (uint8_t []){0x80}, 1, 0},\ + {0xB5, (uint8_t []){0x4E}, 1, 0},\ + {0xB7, (uint8_t []){0x85}, 1, 0},\ + {0xB8, (uint8_t []){0x20}, 1, 0},\ + {0xC1, (uint8_t []){0x78}, 1, 0},\ + {0xC2, (uint8_t []){0x78}, 1, 0},\ + {0xD0, (uint8_t []){0x88}, 1, 0},\ + {0xE0, (uint8_t []){0x00, 0x00, 0x02}, 3, 0},\ + {0xE1, (uint8_t []){0x06, 0x30, 0x08, 0x30, 0x05, 0x30, 0x07, 0x30, 0x00, 0x33, 0x33}, 11, 0},\ + {0xE2, (uint8_t []){0x11, 0x11, 0x33, 0x33, 0xF4, 0x00, 0x00, 0x00, 0xF4, 0x00, 0x00, 0x00}, 12, 0},\ + {0xE3, (uint8_t []){0x00, 0x00, 0x11, 0x11}, 4, 0},\ + {0xE4, (uint8_t []){0x44, 0x44}, 2, 0},\ + {0xE5, (uint8_t []){0x0D, 0xF5, 0x30, 0xF0, 0x0F, 0xF7, 0x30, 0xF0, 0x09, 0xF1, 0x30, 0xF0, 0x0B, 0xF3, 0x30, 0xF0}, 16, 0},\ + {0xE6, (uint8_t []){0x00, 0x00, 0x11, 0x11}, 4, 0},\ + {0xE7, (uint8_t []){0x44, 0x44}, 2, 0},\ + {0xE8, (uint8_t []){0x0C, 0xF4, 0x30, 0xF0, 0x0E, 0xF6, 0x30, 0xF0, 0x08, 0xF0, 0x30, 0xF0, 0x0A, 0xF2, 0x30, 0xF0}, 16, 0},\ + {0xE9, (uint8_t []){0x36, 0x01}, 2, 0},\ + {0xEB, (uint8_t []){0x00, 0x01, 0xE4, 0xE4, 0x44, 0x88, 0x40}, 7, 0},\ + {0xED, (uint8_t []){0xFF, 0x10, 0xAF, 0x76, 0x54, 0x2B, 0xCF, 0xFF, 0xFF, 0xFC, 0xB2, 0x45, 0x67, 0xFA, 0x01, 0xFF}, 16, 0},\ + {0xEF, (uint8_t []){0x08, 0x08, 0x08, 0x45, 0x3F, 0x54}, 6, 0},\ + {0xFF, (uint8_t []){0x77, 0x01, 0x00, 0x00, 0x00}, 5, 0},\ + {0x11, (uint8_t []){0x00}, 0, 120},\ + {0x3A, (uint8_t []){0x66}, 1, 0},\ + {0x36, (uint8_t []){0x00}, 1, 0},\ + {0x35, (uint8_t []){0x00}, 1, 0},\ + {0x29, (uint8_t []){0x00}, 0, 0},\ + } + +/** + * @brief LCD color configuration + */ +#define ESP_PANEL_BOARD_LCD_COLOR_BITS (ESP_PANEL_LCD_COLOR_BITS_RGB565) + // ESP_PANEL_LCD_COLOR_BITS_RGB565/RGB666/RGB888 +#define ESP_PANEL_BOARD_LCD_COLOR_BGR_ORDER (0) // 0: RGB, 1: BGR +#define ESP_PANEL_BOARD_LCD_COLOR_INEVRT_BIT (0) // 0/1 + +/** + * @brief LCD transformation configuration + */ +#define ESP_PANEL_BOARD_LCD_SWAP_XY (0) // 0/1 +#define ESP_PANEL_BOARD_LCD_MIRROR_X (0) // 0/1 +#define ESP_PANEL_BOARD_LCD_MIRROR_Y (0) // 0/1 +#define ESP_PANEL_BOARD_LCD_GAP_X (0) // [0, ESP_PANEL_BOARD_WIDTH] +#define ESP_PANEL_BOARD_LCD_GAP_Y (0) // [0, ESP_PANEL_BOARD_HEIGHT] + +/** + * @brief LCD reset pin configuration + */ +#define ESP_PANEL_BOARD_LCD_RST_IO (-1) // Reset pin, -1 if not used +#define ESP_PANEL_BOARD_LCD_RST_LEVEL (0) // Reset active level, 0: low, 1: high + +#endif // ESP_PANEL_BOARD_USE_LCD + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////// Please update the following macros to configure the touch panel /////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/** + * @brief Touch panel configuration flag (0/1) + * + * Set to `1` to enable touch panel support, `0` to disable + */ +#define ESP_PANEL_BOARD_USE_TOUCH (1) + +#if ESP_PANEL_BOARD_USE_TOUCH +/** + * @brief Touch controller selection + */ +#define ESP_PANEL_BOARD_TOUCH_CONTROLLER GT911 + +/** + * @brief Touch bus type selection + */ +#define ESP_PANEL_BOARD_TOUCH_BUS_TYPE (ESP_PANEL_BUS_TYPE_I2C) + +#if (ESP_PANEL_BOARD_TOUCH_BUS_TYPE == ESP_PANEL_BUS_TYPE_I2C) || \ + (ESP_PANEL_BOARD_TOUCH_BUS_TYPE == ESP_PANEL_BUS_TYPE_SPI) +/** + * If set to 1, the bus will skip to initialize the corresponding host. Users need to initialize the host in advance. + * + * For drivers which created by this library, even if they use the same host, the host will be initialized only once. + * So it is not necessary to set the macro to `1`. For other drivers (like `Wire`), please set the macro to `1` + * ensure that the host is initialized only once. + */ +#define ESP_PANEL_BOARD_TOUCH_BUS_SKIP_INIT_HOST (0) // 0/1. Typically set to 0 +#endif + +/** + * @brief Touch bus parameters configuration + */ +#if ESP_PANEL_BOARD_TOUCH_BUS_TYPE == ESP_PANEL_BUS_TYPE_I2C + + /** + * @brief I2C bus + */ + /* For general */ + #define ESP_PANEL_BOARD_TOUCH_I2C_HOST_ID (0) // Typically set to 0 +#if !ESP_PANEL_BOARD_TOUCH_BUS_SKIP_INIT_HOST + /* For host */ + #define ESP_PANEL_BOARD_TOUCH_I2C_CLK_HZ (400 * 1000) + // Typically set to 400K + #define ESP_PANEL_BOARD_TOUCH_I2C_SCL_PULLUP (1) // 0/1. Typically set to 1 + #define ESP_PANEL_BOARD_TOUCH_I2C_SDA_PULLUP (1) // 0/1. Typically set to 1 + #define ESP_PANEL_BOARD_TOUCH_I2C_IO_SCL (7) + #define ESP_PANEL_BOARD_TOUCH_I2C_IO_SDA (15) +#endif + /* For panel */ + #define ESP_PANEL_BOARD_TOUCH_I2C_ADDRESS (0) // Typically set to 0 to use the default address. + // - For touchs with only one address, set to 0 + // - For touchs with multiple addresses, set to 0 or + // the address. Like GT911, there are two addresses: + // 0x5D(default) and 0x14 + +#endif // ESP_PANEL_BOARD_TOUCH_BUS_TYPE + +/** + * @brief Touch panel transformation flags + */ +#define ESP_PANEL_BOARD_TOUCH_SWAP_XY (0) // 0/1 +#define ESP_PANEL_BOARD_TOUCH_MIRROR_X (0) // 0/1 +#define ESP_PANEL_BOARD_TOUCH_MIRROR_Y (0) // 0/1 + +/** + * @brief Touch panel control pins + */ +#define ESP_PANEL_BOARD_TOUCH_RST_IO (-1) // Reset pin, -1 if not used +#define ESP_PANEL_BOARD_TOUCH_RST_LEVEL (0) // Reset active level, 0: low, 1: high +#define ESP_PANEL_BOARD_TOUCH_INT_IO (16) // Interrupt pin, -1 if not used +#define ESP_PANEL_BOARD_TOUCH_INT_LEVEL (0) // Interrupt active level, 0: low, 1: high + +#endif // ESP_PANEL_BOARD_USE_TOUCH + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +///////////////////////////// Please update the following macros to configure the backlight //////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/** + * @brief Backlight configuration flag (0/1) + * + * Set to `1` to enable backlight support, `0` to disable + */ +#define ESP_PANEL_BOARD_USE_BACKLIGHT (1) + +#if ESP_PANEL_BOARD_USE_BACKLIGHT +/** + * @brief Backlight control type selection + */ +#define ESP_PANEL_BOARD_BACKLIGHT_TYPE (ESP_PANEL_BACKLIGHT_TYPE_PWM_LEDC) + +#if (ESP_PANEL_BOARD_BACKLIGHT_TYPE == ESP_PANEL_BACKLIGHT_TYPE_SWITCH_GPIO) || \ + (ESP_PANEL_BOARD_BACKLIGHT_TYPE == ESP_PANEL_BACKLIGHT_TYPE_SWITCH_EXPANDER) || \ + (ESP_PANEL_BOARD_BACKLIGHT_TYPE == ESP_PANEL_BACKLIGHT_TYPE_PWM_LEDC) + + /** + * @brief Backlight control pin configuration + */ + #define ESP_PANEL_BOARD_BACKLIGHT_IO (6) // Output GPIO pin number + #define ESP_PANEL_BOARD_BACKLIGHT_ON_LEVEL (1) // Active level, 0: low, 1: high + +#if ESP_PANEL_BOARD_BACKLIGHT_TYPE == ESP_PANEL_BACKLIGHT_TYPE_PWM_LEDC + /** + * @brief PWM parameters configuration + */ + #define ESP_PANEL_BOARD_BACKLIGHT_PWM_FREQ_HZ (5000) // LEDC timer frequency. + // Different backlight driver chips may have different + // frequency limits, please refer to the datasheet of + // the specific chip. + // https://github.com/esp-arduino-libs/ESP32_Display_Panel/issues/188 + + #define ESP_PANEL_BOARD_BACKLIGHT_PWM_DUTY_RESOLUTION (10) // LEDC timer duty resolution. + // The frequency and duty resolution of the LEDC timer + // need to be properly matched, please refer to: + // https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/ledc.html#supported-range-of-frequency-and-duty-resolutions +#endif + +#endif // ESP_PANEL_BOARD_BACKLIGHT_TYPE + +/** + * @brief Backlight idle state configuration (0/1) + * + * Set to 1 if want to turn off the backlight after initializing. Otherwise, the backlight will be on. + */ +#define ESP_PANEL_BOARD_BACKLIGHT_IDLE_OFF (0) + +#endif // ESP_PANEL_BOARD_USE_BACKLIGHT + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +///////////////////////////// Please update the following macros to configure the IO expander ////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/** + * @brief IO expander configuration flag (0/1) + * + * Set to `1` to enable IO expander support, `0` to disable + */ +#define ESP_PANEL_BOARD_USE_EXPANDER (1) + +#if ESP_PANEL_BOARD_USE_EXPANDER +/** + * @brief IO expander chip selection + */ +#define ESP_PANEL_BOARD_EXPANDER_CHIP TCA95XX_8BIT + +/** + * @brief IO expander I2C bus parameters configuration + */ +/** + * If set to 1, the bus will skip to initialize the corresponding host. Users need to initialize the host in advance. + * + * For drivers which created by this library, even if they use the same host, the host will be initialized only once. + * So it is not necessary to set the macro to `1`. For other devices, please set the macro to `1` ensure that the + * host is initialized only once. + */ +#define ESP_PANEL_BOARD_EXPANDER_SKIP_INIT_HOST (0) // 0/1 +/* For general */ +#define ESP_PANEL_BOARD_EXPANDER_I2C_HOST_ID (0) // Typically set to 0 +/* For host */ +#if !ESP_PANEL_BOARD_EXPANDER_SKIP_INIT_HOST +#define ESP_PANEL_BOARD_EXPANDER_I2C_CLK_HZ (400 * 1000) + // Typically set to 400K +#define ESP_PANEL_BOARD_EXPANDER_I2C_SCL_PULLUP (1) // 0/1. Typically set to 1 +#define ESP_PANEL_BOARD_EXPANDER_I2C_SDA_PULLUP (1) // 0/1. Typically set to 1 +#define ESP_PANEL_BOARD_EXPANDER_I2C_IO_SCL (7) +#define ESP_PANEL_BOARD_EXPANDER_I2C_IO_SDA (15) +#endif // ESP_PANEL_BOARD_EXPANDER_SKIP_INIT_HOST +/* For device */ +#define ESP_PANEL_BOARD_EXPANDER_I2C_ADDRESS (0x20) // The actual I2C address. Even for the same model of IC, + // the I2C address may be different, and confirmation based on + // the actual hardware connection is required +#endif // ESP_PANEL_BOARD_USE_EXPANDER + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////// Please utilize the following macros to execute any additional code if required ///////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/** + * @brief Post-begin function for touch panel initialization + * + * @param[in] p Pointer to the board object + * @return true on success, false on failure + */ +#define ESP_PANEL_BOARD_TOUCH_PRE_BEGIN_FUNCTION(p) \ + { \ + constexpr gpio_num_t TP_INT = static_cast(ESP_PANEL_BOARD_TOUCH_INT_IO); \ + constexpr int TP_RST = 1; \ + auto board = static_cast(p); \ + auto expander = board->getIO_Expander()->getBase(); \ + expander->pinMode(TP_RST,OUTPUT); \ + gpio_set_direction(TP_INT, GPIO_MODE_OUTPUT); \ + gpio_set_level(TP_INT, 0); \ + vTaskDelay(pdMS_TO_TICKS(10)); \ + expander->digitalWrite(TP_RST, 0); \ + vTaskDelay(pdMS_TO_TICKS(10)); \ + expander->digitalWrite(TP_RST, 1); \ + vTaskDelay(pdMS_TO_TICKS(200)); \ + gpio_set_level(TP_INT, 1); \ + gpio_reset_pin(TP_INT); \ + return true; \ + } + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////// File Version /////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/** + * Do not change the following versions. These version numbers are used to check compatibility between this + * configuration file and the library. Rules for version numbers: + * 1. Major version mismatch: Configurations are incompatible, must use library version + * 2. Minor version mismatch: May be missing new configurations, recommended to update + * 3. Patch version mismatch: No impact on functionality + */ +#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MAJOR 1 +#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MINOR 1 +#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_PATCH 0 + +// *INDENT-ON* diff --git a/src/board/supported/waveshare/Kconfig.waveshare b/src/board/supported/waveshare/Kconfig.waveshare index e993d3aa..2653f050 100644 --- a/src/board/supported/waveshare/Kconfig.waveshare +++ b/src/board/supported/waveshare/Kconfig.waveshare @@ -3,11 +3,21 @@ config BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_1_85 help https://www.waveshare.com/esp32-s3-touch-lcd-1.85.htm +config BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_1_85_C + bool "ESP32_S3_TOUCH_LCD_1_85_C" + help + https://www.waveshare.com/esp32-s3-touch-lcd-1.85c.htm + config BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_2_1 bool "ESP32_S3_TOUCH_LCD_2_1" help https://www.waveshare.com/esp32-s3-touch-lcd-2.1.htm +config BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_2_8_C + bool "ESP32_S3_TOUCH_LCD_2_8_C" + help + https://www.waveshare.com/esp32-s3-touch-lcd-2.8c.htm + config BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_4_3 bool "ESP32_S3_TOUCH_LCD_4_3" help diff --git a/src/drivers/io_expander/esp_panel_io_expander_adapter.hpp b/src/drivers/io_expander/esp_panel_io_expander_adapter.hpp index 0c463cc8..521ffda8 100644 --- a/src/drivers/io_expander/esp_panel_io_expander_adapter.hpp +++ b/src/drivers/io_expander/esp_panel_io_expander_adapter.hpp @@ -5,7 +5,6 @@ */ #pragma once -#include #include "utils/esp_panel_utils_log.h" #include "utils/esp_panel_utils_cxx.hpp" #include "drivers/host/esp_panel_host_i2c.hpp" diff --git a/src/drivers/lcd/esp_panel_lcd_st7701.cpp b/src/drivers/lcd/esp_panel_lcd_st7701.cpp index 0c07c499..c999b920 100644 --- a/src/drivers/lcd/esp_panel_lcd_st7701.cpp +++ b/src/drivers/lcd/esp_panel_lcd_st7701.cpp @@ -61,7 +61,7 @@ bool LCD_ST7701::init() // Process the device on initialization ESP_UTILS_CHECK_FALSE_RETURN(processDeviceOnInit(_bus_specifications), false, "Process device on init failed"); -#if ESP_PANEL_DRIVERS_BUS_ENABLE_RGB +#if ESP_PANEL_DRIVERS_BUS_ENABLE_RGB || ESP_PANEL_DRIVERS_BUS_ENABLE_MIPI_DSI // Create refresh panel ESP_UTILS_CHECK_ERROR_RETURN( esp_lcd_new_panel_st7701( @@ -70,8 +70,8 @@ bool LCD_ST7701::init() ); ESP_UTILS_LOGD("Create refresh panel(@%p)", refresh_panel); #else - ESP_UTILS_CHECK_FALSE_RETURN(false, false, "MIPI-DSI is not supported"); -#endif // ESP_PANEL_DRIVERS_BUS_ENABLE_RGB + ESP_UTILS_CHECK_FALSE_RETURN(false, false, "Neither RGB nor MIPI-DSI is supported"); +#endif // ESP_PANEL_DRIVERS_BUS_ENABLE_RGB || ESP_PANEL_DRIVERS_BUS_ENABLE_MIPI_DSI /* Disable control panel if enable `auto_del_panel_io/enable_io_multiplex` flag */ if (getConfig().getVendorFullConfig()->flags.auto_del_panel_io) { diff --git a/src/drivers/lcd/port/esp_lcd_st7701_rgb.c b/src/drivers/lcd/port/esp_lcd_st7701_rgb.c index d14a3cd0..36c26fb4 100644 --- a/src/drivers/lcd/port/esp_lcd_st7701_rgb.c +++ b/src/drivers/lcd/port/esp_lcd_st7701_rgb.c @@ -348,9 +348,20 @@ static esp_err_t panel_st7701_mirror(esp_lcd_panel_t *panel, bool mirror_x, bool } else { st7701->madctl_val &= ~LCD_CMD_ML_BIT; } + + // Enable the Command2 BK0 + ESP_RETURN_ON_ERROR(esp_lcd_panel_io_tx_param(io, ST7701_CMD_CND2BKxSEL, (uint8_t []) { + ST7701_CMD_BKxSEL_BYTE0, ST7701_CMD_BKxSEL_BYTE1, ST7701_CMD_BKxSEL_BYTE2, ST7701_CMD_BKxSEL_BYTE3, + ST7701_CMD_BKxSEL_BK0 | ST7701_CMD_CN2_BIT, + }, 5), TAG, "send command failed"); ESP_RETURN_ON_ERROR(esp_lcd_panel_io_tx_param(io, ST7701_CMD_SDIR, (uint8_t[]) { sdir_val, }, 1), TAG, "send command failed");; + + // Disable Command2 + ESP_RETURN_ON_ERROR(esp_lcd_panel_io_tx_param(io, ST7701_CMD_CND2BKxSEL, (uint8_t []) { + ST7701_CMD_BKxSEL_BYTE0, ST7701_CMD_BKxSEL_BYTE1, ST7701_CMD_BKxSEL_BYTE2, ST7701_CMD_BKxSEL_BYTE3, 0, + }, 5), TAG, "send command failed"); ESP_RETURN_ON_ERROR(esp_lcd_panel_io_tx_param(io, LCD_CMD_MADCTL, (uint8_t[]) { st7701->madctl_val, }, 1), TAG, "send command failed");; diff --git a/src/drivers/touch/Kconfig.touch b/src/drivers/touch/Kconfig.touch index 3b47060d..de8afa9d 100644 --- a/src/drivers/touch/Kconfig.touch +++ b/src/drivers/touch/Kconfig.touch @@ -31,6 +31,10 @@ menu "Touch" bool "Use CST816S" default n + config ESP_PANEL_DRIVERS_TOUCH_USE_CST820 + bool "Use CST820" + default n + config ESP_PANEL_DRIVERS_TOUCH_USE_FT5x06 bool "Use FT5x06" default n diff --git a/src/drivers/touch/esp_panel_touch.cpp b/src/drivers/touch/esp_panel_touch.cpp index 6e07a68a..a4b59efb 100644 --- a/src/drivers/touch/esp_panel_touch.cpp +++ b/src/drivers/touch/esp_panel_touch.cpp @@ -304,8 +304,10 @@ bool Touch::readRawData(int points_num, int buttons_num, int timeout_ms) // Get the points ESP_UTILS_CHECK_FALSE_RETURN(readRawDataPoints(points_num), false, "Read points failed"); +#if CONFIG_ESP_LCD_TOUCH_MAX_BUTTONS > 0 // Get the buttons ESP_UTILS_CHECK_FALSE_RETURN(readRawDataButtons(buttons_num), false, "Read buttons failed"); +#endif ESP_UTILS_LOG_TRACE_EXIT_WITH_THIS(); @@ -610,10 +612,10 @@ bool Touch::readRawDataButtons(int buttons_num) } // Limit the max buttons number if (buttons_num > BUTTONS_MAX_NUM) { - buttons_num = BUTTONS_MAX_NUM; ESP_UTILS_LOGW( "The target buttons number(%d) out of range, use the max number(%d) instead", buttons_num, BUTTONS_MAX_NUM ); + buttons_num = BUTTONS_MAX_NUM; } if (buttons_num <= 0) { ESP_UTILS_LOGD("Ignore to read buttons"); @@ -627,13 +629,14 @@ bool Touch::readRawDataButtons(int buttons_num) for (int i = 0; i < buttons_num; i++) { button_state = 0; +#if CONFIG_ESP_LCD_TOUCH_MAX_BUTTONS > 0 auto ret = esp_lcd_touch_get_button_state(touch_panel, i, &button_state); if (ret == ESP_ERR_INVALID_ARG) { ESP_UTILS_LOGD("Button(%d) is not supported", i); break; } ESP_UTILS_CHECK_ERROR_RETURN(ret, false, "Get button(%d) state failed", i); - +#endif buttons.emplace_back(i, button_state); } diff --git a/src/drivers/touch/esp_panel_touch_conf_internal.h b/src/drivers/touch/esp_panel_touch_conf_internal.h index df2ad46b..28659aaf 100644 --- a/src/drivers/touch/esp_panel_touch_conf_internal.h +++ b/src/drivers/touch/esp_panel_touch_conf_internal.h @@ -226,6 +226,14 @@ #endif #endif +#ifndef ESP_PANEL_DRIVERS_TOUCH_ENABLE_CST820 + #if ESP_PANEL_DRIVERS_TOUCH_COMPILE_UNUSED_DRIVERS || ESP_PANEL_DRIVERS_TOUCH_USE_CST820 + #define ESP_PANEL_DRIVERS_TOUCH_ENABLE_CST820 (1) + #else + #define ESP_PANEL_DRIVERS_TOUCH_ENABLE_CST820 (0) + #endif +#endif + #ifndef ESP_PANEL_DRIVERS_TOUCH_ENABLE_FT5x06 #if ESP_PANEL_DRIVERS_TOUCH_COMPILE_UNUSED_DRIVERS || ESP_PANEL_DRIVERS_TOUCH_USE_FT5x06 #define ESP_PANEL_DRIVERS_TOUCH_ENABLE_FT5x06 (1) diff --git a/src/drivers/touch/esp_panel_touch_cst820.cpp b/src/drivers/touch/esp_panel_touch_cst820.cpp new file mode 100644 index 00000000..0464701d --- /dev/null +++ b/src/drivers/touch/esp_panel_touch_cst820.cpp @@ -0,0 +1,52 @@ +/* + * SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "esp_panel_touch_conf_internal.h" +#if ESP_PANEL_DRIVERS_TOUCH_ENABLE_CST820 + +#include "utils/esp_panel_utils_log.h" +#include "esp_panel_touch_cst820.hpp" + +namespace esp_panel::drivers { + +TouchCST820::~TouchCST820() +{ + ESP_UTILS_LOG_TRACE_ENTER_WITH_THIS(); + + ESP_UTILS_CHECK_FALSE_EXIT(del(), "Delete failed"); + + ESP_UTILS_LOG_TRACE_EXIT_WITH_THIS(); +} + +bool TouchCST820::begin() +{ + ESP_UTILS_LOG_TRACE_ENTER_WITH_THIS(); + + ESP_UTILS_CHECK_FALSE_RETURN(!isOverState(State::BEGIN), false, "Already begun"); + + // Initialize the touch if not initialized + if (!isOverState(State::INIT)) { + ESP_UTILS_CHECK_FALSE_RETURN(init(), false, "Init failed"); + } + + // Create touch panel + ESP_UTILS_CHECK_ERROR_RETURN( + esp_lcd_touch_new_i2c_cst820( + getBus()->getControlPanelHandle(), getConfig().getDeviceFullConfig(), &touch_panel + ), false, "Create touch panel failed" + ); + ESP_UTILS_LOGD("Create touch panel(@%p)", touch_panel); + + setState(State::BEGIN); + + ESP_UTILS_LOG_TRACE_EXIT_WITH_THIS(); + + return true; +} + +} // namespace esp_panel::drivers + +#endif // ESP_PANEL_DRIVERS_TOUCH_ENABLE_CST820 diff --git a/src/drivers/touch/esp_panel_touch_cst820.hpp b/src/drivers/touch/esp_panel_touch_cst820.hpp new file mode 100644 index 00000000..324f848f --- /dev/null +++ b/src/drivers/touch/esp_panel_touch_cst820.hpp @@ -0,0 +1,80 @@ +/* + * SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#pragma once + +#include "port/esp_lcd_touch_cst820.h" +#include "esp_panel_touch_conf_internal.h" +#include "esp_panel_touch.hpp" + +namespace esp_panel::drivers { + +/** + * @brief CST820 touch controller + * + * This class provides implementation for CST820 touch controller, inheriting from + * the base Touch class to provide common touch functionality + */ +class TouchCST820 : public Touch { +public: + /** + * @brief Default basic attributes for CST820 + */ + static constexpr BasicAttributes BASIC_ATTRIBUTES_DEFAULT = { + .name = "CST820", + .max_points_num = 1, + }; + + /** + * @brief Construct a touch device instance with individual configuration parameters + * + * @param bus Bus interface for communicating with the touch device + * @param width Panel width in pixels + * @param height Panel height in pixels + * @param rst_io Reset GPIO pin number (-1 if unused) + * @param int_io Interrupt GPIO pin number (-1 if unused) + */ + TouchCST820(Bus *bus, uint16_t width, uint16_t height, int rst_io = -1, int int_io = -1): + Touch(BASIC_ATTRIBUTES_DEFAULT, bus, width, height, rst_io, int_io) + { + } + + /** + * @brief Construct a touch device instance with configuration + * + * @param[in] bus Pointer to the bus interface for communicating with the touch device + * @param[in] config Configuration structure containing device settings and parameters + */ + TouchCST820(Bus *bus, const Config &config): Touch(BASIC_ATTRIBUTES_DEFAULT, bus, config) {} + + /** + * @brief Construct a touch device instance with bus configuration and device configuration + * + * @param[in] bus_config Bus configuration + * @param[in] touch_config Touch configuration + * @note This constructor creates a new bus instance using the provided bus configuration + */ + TouchCST820(const BusFactory::Config &bus_config, const Config &touch_config): + Touch(BASIC_ATTRIBUTES_DEFAULT, bus_config, touch_config) + { + } + + /** + * @brief Destruct touch device + */ + ~TouchCST820() override; + + /** + * @brief Startup the touch device + * + * @return `true` if success, otherwise false + * + * @note This function should be called after `init()` + */ + bool begin() override; +}; + +} // namespace esp_panel::drivers diff --git a/src/drivers/touch/esp_panel_touch_factory.cpp b/src/drivers/touch/esp_panel_touch_factory.cpp index 19999f02..331c0412 100644 --- a/src/drivers/touch/esp_panel_touch_factory.cpp +++ b/src/drivers/touch/esp_panel_touch_factory.cpp @@ -33,6 +33,9 @@ const utils::unordered_map To #if ESP_PANEL_DRIVERS_TOUCH_USE_CST816S MAP_ITEM(CST816S), #endif // CONFIG_ESP_PANEL_TOUCH_CST816S +#if ESP_PANEL_DRIVERS_TOUCH_USE_CST820 + MAP_ITEM(CST820), +#endif // CONFIG_ESP_PANEL_TOUCH_CST820 #if ESP_PANEL_DRIVERS_TOUCH_USE_FT5x06 MAP_ITEM(FT5x06), #endif // CONFIG_ESP_PANEL_TOUCH_FT5x06 diff --git a/src/drivers/touch/esp_panel_touch_factory.hpp b/src/drivers/touch/esp_panel_touch_factory.hpp index 901e8386..565245d2 100644 --- a/src/drivers/touch/esp_panel_touch_factory.hpp +++ b/src/drivers/touch/esp_panel_touch_factory.hpp @@ -13,6 +13,7 @@ #include "esp_panel_touch_axs15231b.hpp" #include "esp_panel_touch_chsc6540.hpp" #include "esp_panel_touch_cst816s.hpp" +#include "esp_panel_touch_cst820.hpp" #include "esp_panel_touch_ft5x06.hpp" #include "esp_panel_touch_gt911.hpp" #include "esp_panel_touch_gt1151.hpp" diff --git a/src/drivers/touch/port/esp_lcd_touch_cst820.c b/src/drivers/touch/port/esp_lcd_touch_cst820.c new file mode 100644 index 00000000..70f7e72e --- /dev/null +++ b/src/drivers/touch/port/esp_lcd_touch_cst820.c @@ -0,0 +1,214 @@ +/* + * SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * @file esp_lcd_touch_cst820.c + * @brief ESP LCD touch: CST820 + * @author Viewe@VIEWESMART + */ + +#include "../esp_panel_touch_conf_internal.h" +#if ESP_PANEL_DRIVERS_TOUCH_ENABLE_CST820 + +#include +#include +#include +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" +#include "driver/gpio.h" +#include "esp_system.h" +#include "esp_err.h" +#include "esp_log.h" +#include "esp_check.h" +#include "esp_lcd_panel_io.h" +#include "esp_lcd_touch.h" + +#include "utils/esp_panel_utils_log.h" +#include "esp_utils_helpers.h" +#include "esp_lcd_touch_cst820.h" + +#define POINT_NUM_MAX (1) + +#define DATA_START_REG (0x00) +#define CHIP_ID_REG (0xA7) + +static const char *TAG = "CST820"; + +static esp_err_t read_data(esp_lcd_touch_handle_t tp); +static bool get_xy(esp_lcd_touch_handle_t tp, uint16_t *x, uint16_t *y, uint16_t *strength, uint8_t *point_num, uint8_t max_point_num); +static esp_err_t del(esp_lcd_touch_handle_t tp); + +static esp_err_t i2c_read_bytes(esp_lcd_touch_handle_t tp, uint16_t reg, uint8_t *data, uint8_t len); + +static esp_err_t reset(esp_lcd_touch_handle_t tp); +static esp_err_t read_id(esp_lcd_touch_handle_t tp); + +esp_err_t esp_lcd_touch_new_i2c_cst820(const esp_lcd_panel_io_handle_t io, const esp_lcd_touch_config_t *config, esp_lcd_touch_handle_t *tp) +{ + ESP_LOGI(TAG, "version: %d.%d.%d", ESP_LCD_TOUCH_CST820_VER_MAJOR, ESP_LCD_TOUCH_CST820_VER_MINOR, + ESP_LCD_TOUCH_CST820_VER_PATCH); + ESP_RETURN_ON_FALSE(io, ESP_ERR_INVALID_ARG, TAG, "Invalid io"); + ESP_RETURN_ON_FALSE(config, ESP_ERR_INVALID_ARG, TAG, "Invalid config"); + ESP_RETURN_ON_FALSE(tp, ESP_ERR_INVALID_ARG, TAG, "Invalid touch handle"); + + /* Prepare main structure */ + esp_err_t ret = ESP_OK; + esp_lcd_touch_handle_t cst820 = calloc(1, sizeof(esp_lcd_touch_t)); + ESP_GOTO_ON_FALSE(cst820, ESP_ERR_NO_MEM, err, TAG, "Touch handle malloc failed"); + + /* Communication interface */ + cst820->io = io; + /* Only supported callbacks are set */ + cst820->read_data = read_data; + cst820->get_xy = get_xy; + cst820->del = del; + /* Mutex */ + cst820->data.lock.owner = portMUX_FREE_VAL; + /* Save config */ + memcpy(&cst820->config, config, sizeof(esp_lcd_touch_config_t)); + + /* Prepare pin for touch interrupt */ + if (cst820->config.int_gpio_num != GPIO_NUM_NC) { + const gpio_config_t int_gpio_config = { + .mode = GPIO_MODE_INPUT, + .intr_type = (cst820->config.levels.interrupt ? GPIO_INTR_POSEDGE : GPIO_INTR_NEGEDGE), + .pin_bit_mask = BIT64(cst820->config.int_gpio_num) + }; + ESP_GOTO_ON_ERROR(gpio_config(&int_gpio_config), err, TAG, "GPIO intr config failed"); + + /* Register interrupt callback */ + if (cst820->config.interrupt_callback) { + esp_lcd_touch_register_interrupt_callback(cst820, cst820->config.interrupt_callback); + } + } + /* Prepare pin for touch controller reset */ + if (cst820->config.rst_gpio_num != GPIO_NUM_NC) { + const gpio_config_t rst_gpio_config = { + .mode = GPIO_MODE_OUTPUT, + .pin_bit_mask = BIT64(cst820->config.rst_gpio_num) + }; + ESP_GOTO_ON_ERROR(gpio_config(&rst_gpio_config), err, TAG, "GPIO reset config failed"); + } + /* Reset controller */ + ESP_GOTO_ON_ERROR(reset(cst820), err, TAG, "Reset failed"); + /* Read product id */ + ESP_GOTO_ON_ERROR(read_id(cst820), err, TAG, "Read version failed"); + *tp = cst820; + + return ESP_OK; +err: + if (cst820) { + del(cst820); + } + ESP_LOGE(TAG, "Initialization failed!"); + return ret; +} + +static esp_err_t read_data(esp_lcd_touch_handle_t tp) +{ + typedef struct { + uint8_t num; + uint8_t x_h : 4; + uint8_t : 4; + uint8_t x_l; + uint8_t y_h : 4; + uint8_t : 4; + uint8_t y_l; + } data_t; + + data_t point; + // ESP_RETURN_ON_ERROR(i2c_read_bytes(tp, DATA_START_REG, (uint8_t *)&point, sizeof(data_t)), TAG, "I2C read failed"); + + /*CST820 */ + uint8_t lvalue[15] = {0}; + // uint8_t gesture_id=0; + uint16_t x = 0; + uint16_t y = 0; + ESP_RETURN_ON_ERROR(i2c_read_bytes(tp, DATA_START_REG, (uint8_t *)lvalue, sizeof(lvalue)), TAG, "I2C read failed"); + // gesture_id = lvalue[1]; + point.num = lvalue[2]; + x = (((uint16_t)(lvalue[3] & 0x0f)) << 8) | lvalue[4]; + y = (((uint16_t)(lvalue[5] & 0x0f)) << 8) | lvalue[6]; + + portENTER_CRITICAL(&tp->data.lock); + point.num = (point.num > POINT_NUM_MAX ? POINT_NUM_MAX : point.num); + tp->data.points = point.num; + /* Fill all coordinates */ + for (int i = 0; i < tp->data.points ; i++) { + tp->data.coords[i].x = x; + tp->data.coords[i].y = y; + } + portEXIT_CRITICAL(&tp->data.lock); + + return ESP_OK; +} + +static bool get_xy(esp_lcd_touch_handle_t tp, uint16_t *x, uint16_t *y, uint16_t *strength, uint8_t *point_num, uint8_t max_point_num) +{ + portENTER_CRITICAL(&tp->data.lock); + /* Count of points */ + *point_num = (tp->data.points > max_point_num ? max_point_num : tp->data.points); + for (size_t i = 0; i < *point_num; i++) { + x[i] = tp->data.coords[i].x; + y[i] = tp->data.coords[i].y; + + if (strength) { + strength[i] = tp->data.coords[i].strength; + } + } + /* Invalidate */ + tp->data.points = 0; + portEXIT_CRITICAL(&tp->data.lock); + + return (*point_num > 0); +} + +static esp_err_t del(esp_lcd_touch_handle_t tp) +{ + /* Reset GPIO pin settings */ + if (tp->config.int_gpio_num != GPIO_NUM_NC) { + gpio_reset_pin(tp->config.int_gpio_num); + if (tp->config.interrupt_callback) { + gpio_isr_handler_remove(tp->config.int_gpio_num); + } + } + if (tp->config.rst_gpio_num != GPIO_NUM_NC) { + gpio_reset_pin(tp->config.rst_gpio_num); + } + /* Release memory */ + free(tp); + + return ESP_OK; +} + +static esp_err_t reset(esp_lcd_touch_handle_t tp) +{ + if (tp->config.rst_gpio_num != GPIO_NUM_NC) { + ESP_RETURN_ON_ERROR(gpio_set_level(tp->config.rst_gpio_num, tp->config.levels.reset), TAG, "GPIO set level failed"); + vTaskDelay(pdMS_TO_TICKS(200)); + ESP_RETURN_ON_ERROR(gpio_set_level(tp->config.rst_gpio_num, !tp->config.levels.reset), TAG, "GPIO set level failed"); + vTaskDelay(pdMS_TO_TICKS(200)); + } + + return ESP_OK; +} + +static esp_err_t read_id(esp_lcd_touch_handle_t tp) +{ + uint8_t id; + ESP_RETURN_ON_ERROR(i2c_read_bytes(tp, CHIP_ID_REG, &id, 1), TAG, "I2C read failed"); + ESP_LOGI(TAG, "IC id: %d", id); + return ESP_OK; +} + +static esp_err_t i2c_read_bytes(esp_lcd_touch_handle_t tp, uint16_t reg, uint8_t *data, uint8_t len) +{ + ESP_RETURN_ON_FALSE(data, ESP_ERR_INVALID_ARG, TAG, "Invalid data"); + + return esp_lcd_panel_io_rx_param(tp->io, reg, data, len); +} + +#endif // ESP_PANEL_DRIVERS_TOUCH_ENABLE_CST820 diff --git a/src/drivers/touch/port/esp_lcd_touch_cst820.h b/src/drivers/touch/port/esp_lcd_touch_cst820.h new file mode 100644 index 00000000..cbde1d9a --- /dev/null +++ b/src/drivers/touch/port/esp_lcd_touch_cst820.h @@ -0,0 +1,62 @@ +/* + * SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/** + * @file esp_lcd_touch_cst820.h + * @brief ESP LCD touch: CST820 + * @author Viewe@VIEWESMART + */ + +#pragma once + +#include "esp_lcd_touch.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define ESP_LCD_TOUCH_CST820_VER_MAJOR (0) +#define ESP_LCD_TOUCH_CST820_VER_MINOR (1) +#define ESP_LCD_TOUCH_CST820_VER_PATCH (0) + +/** + * @brief Create a new CST820 touch driver + * + * @note The I2C communication should be initialized before use this function. + * + * @param io LCD panel IO handle, it should be created by `esp_lcd_new_panel_io_i2c()` + * @param config Touch panel configuration + * @param tp Touch panel handle + * @return + * - ESP_OK: on success + */ +esp_err_t esp_lcd_touch_new_i2c_cst820(const esp_lcd_panel_io_handle_t io, const esp_lcd_touch_config_t *config, esp_lcd_touch_handle_t *tp); + +/** + * @brief I2C address of the CST820 controller + * + */ +#define ESP_LCD_TOUCH_IO_I2C_CST820_ADDRESS (0x15) + +/** + * @brief Touch IO configuration structure + * + */ +#define ESP_LCD_TOUCH_IO_I2C_CST820_CONFIG() \ + { \ + .dev_addr = ESP_LCD_TOUCH_IO_I2C_CST820_ADDRESS, \ + .control_phase_bytes = 1, \ + .dc_bit_offset = 0, \ + .lcd_cmd_bits = 8, \ + .flags = \ + { \ + .disable_control_phase = 1, \ + } \ + } + +#ifdef __cplusplus +} +#endif diff --git a/src/esp_panel_versions.h b/src/esp_panel_versions.h index 65ba696c..fc8b1b36 100644 --- a/src/esp_panel_versions.h +++ b/src/esp_panel_versions.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2024-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -8,19 +8,19 @@ /* Library Version */ #define ESP_PANEL_VERSION_MAJOR 1 #define ESP_PANEL_VERSION_MINOR 0 -#define ESP_PANEL_VERSION_PATCH 0 +#define ESP_PANEL_VERSION_PATCH 4 /* File `esp_panel_drivers_conf.h` */ #define ESP_PANEL_DRIVERS_CONF_VERSION_MAJOR 1 -#define ESP_PANEL_DRIVERS_CONF_VERSION_MINOR 0 +#define ESP_PANEL_DRIVERS_CONF_VERSION_MINOR 1 #define ESP_PANEL_DRIVERS_CONF_VERSION_PATCH 0 /* File `esp_panel_board_custom_conf.h` */ #define ESP_PANEL_BOARD_CUSTOM_VERSION_MAJOR 1 -#define ESP_PANEL_BOARD_CUSTOM_VERSION_MINOR 0 +#define ESP_PANEL_BOARD_CUSTOM_VERSION_MINOR 2 #define ESP_PANEL_BOARD_CUSTOM_VERSION_PATCH 0 /* File `esp_panel_board_supported_conf.h` */ #define ESP_PANEL_BOARD_SUPPORTED_VERSION_MAJOR 1 -#define ESP_PANEL_BOARD_SUPPORTED_VERSION_MINOR 0 +#define ESP_PANEL_BOARD_SUPPORTED_VERSION_MINOR 2 #define ESP_PANEL_BOARD_SUPPORTED_VERSION_PATCH 0 diff --git a/template_files/lv_conf.h b/template_files/lv_conf.h index 57b48ac8..e27d5834 100644 --- a/template_files/lv_conf.h +++ b/template_files/lv_conf.h @@ -360,7 +360,7 @@ *===================*/ /*Montserrat fonts with ASCII range and some symbols using bpp = 4 - *https://fonts.google.com/specimen/Montserrat*/ + *https://fonts.google.com/specimen/Montserrat */ #define LV_FONT_MONTSERRAT_8 1 #define LV_FONT_MONTSERRAT_10 1 #define LV_FONT_MONTSERRAT_12 1 @@ -451,7 +451,7 @@ /*Support bidirectional texts. Allows mixing Left-to-Right and Right-to-Left texts. *The direction will be processed according to the Unicode Bidirectional Algorithm: - *https://www.w3.org/International/articles/inline-bidi-markup/uba-basics*/ + *https://www.w3.org/International/articles/inline-bidi-markup/uba-basics */ #define LV_USE_BIDI 0 #if LV_USE_BIDI /*Set the default direction. Supported values: @@ -469,7 +469,7 @@ * WIDGET USAGE *================*/ -/*Documentation of the widgets: https://docs.lvgl.io/latest/en/html/widgets/index.html*/ +/*Documentation of the widgets: https://docs.lvgl.io/latest/en/html/widgets/index.html */ #define LV_USE_ARC 1 diff --git a/template_files/lvgl_v8_port.cpp b/template_files/lvgl_v8_port.cpp index 8c6042f3..e9f71dca 100644 --- a/template_files/lvgl_v8_port.cpp +++ b/template_files/lvgl_v8_port.cpp @@ -4,6 +4,8 @@ * SPDX-License-Identifier: CC0-1.0 */ +#include "freertos/FreeRTOS.h" + #include "esp_timer.h" #undef ESP_UTILS_LOG_TAG #define ESP_UTILS_LOG_TAG "LvPort" @@ -638,10 +640,18 @@ static lv_disp_t *display_init(LCD *lcd) return lv_disp_drv_register(&disp_drv); } +static SemaphoreHandle_t touch_detected; + static void touchpad_read(lv_indev_drv_t *indev_drv, lv_indev_data_t *data) { Touch *tp = (Touch *)indev_drv->user_data; TouchPoint point; + data->state = LV_INDEV_STATE_RELEASED; + + /* if we are interrupt driven wait for the ISR to fire */ + if ( tp->isInterruptEnabled() && (xSemaphoreTake( touch_detected, 0 ) == pdFALSE) ) { + return; + } /* Read data from touch controller */ int read_touch_result = tp->readPoints(&point, 1, 0); @@ -649,11 +659,17 @@ static void touchpad_read(lv_indev_drv_t *indev_drv, lv_indev_data_t *data) data->point.x = point.x; data->point.y = point.y; data->state = LV_INDEV_STATE_PRESSED; - } else { - data->state = LV_INDEV_STATE_RELEASED; } } +static bool onTouchInterruptCallback(void *user_data) +{ + BaseType_t xHigherPriorityTaskWoken = pdFALSE; + xSemaphoreGiveFromISR( touch_detected, &xHigherPriorityTaskWoken ); + portYIELD_FROM_ISR( xHigherPriorityTaskWoken ); + return false; +} + static lv_indev_t *indev_init(Touch *tp) { ESP_UTILS_CHECK_FALSE_RETURN(tp != nullptr, nullptr, "Invalid touch device"); @@ -661,6 +677,10 @@ static lv_indev_t *indev_init(Touch *tp) static lv_indev_drv_t indev_drv_tp; + if (tp->isInterruptEnabled()) { + touch_detected = xSemaphoreCreateBinary(); + tp->attachInterruptCallback(onTouchInterruptCallback, tp); + } ESP_UTILS_LOGD("Register input driver to LVGL"); lv_indev_drv_init(&indev_drv_tp); indev_drv_tp.type = LV_INDEV_TYPE_POINTER; diff --git a/test_apps/board/common/sdkconfig.ci.custom.touch_spi_xpt2046 b/test_apps/board/common/sdkconfig.ci.custom.touch_spi_xpt2046 new file mode 100644 index 00000000..02c7698f --- /dev/null +++ b/test_apps/board/common/sdkconfig.ci.custom.touch_spi_xpt2046 @@ -0,0 +1,4 @@ +CONFIG_ESP_PANEL_BOARD_DEFAULT_USE_CUSTOM=y +CONFIG_ESP_PANEL_BOARD_USE_TOUCH=y +CONFIG_ESP_PANEL_BOARD_TOUCH_CONTROLLER_XPT2046=y +CONFIG_ESP_PANEL_BOARD_TOUCH_BUS_TYPE_SPI=y diff --git a/test_apps/board/waveshare/sdkconfig.ci.BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_1_85_C b/test_apps/board/waveshare/sdkconfig.ci.BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_1_85_C new file mode 100644 index 00000000..553f654a --- /dev/null +++ b/test_apps/board/waveshare/sdkconfig.ci.BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_1_85_C @@ -0,0 +1,5 @@ +CONFIG_IDF_TARGET="esp32s3" +CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG=y +CONFIG_SPIRAM_MODE_OCT=y + +CONFIG_BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_1_85_C=y diff --git a/test_apps/board/waveshare/sdkconfig.ci.BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_2_8_C b/test_apps/board/waveshare/sdkconfig.ci.BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_2_8_C new file mode 100644 index 00000000..210569b5 --- /dev/null +++ b/test_apps/board/waveshare/sdkconfig.ci.BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_2_8_C @@ -0,0 +1,5 @@ +CONFIG_IDF_TARGET="esp32s3" +CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG=y +CONFIG_SPIRAM_MODE_OCT=y + +CONFIG_BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_2_8_C=y diff --git a/test_apps/drivers/touch/i2c/main/test_i2c_touch.cpp b/test_apps/drivers/touch/i2c/main/test_i2c_touch.cpp index 35cba6b7..cbbbf19f 100644 --- a/test_apps/drivers/touch/i2c/main/test_i2c_touch.cpp +++ b/test_apps/drivers/touch/i2c/main/test_i2c_touch.cpp @@ -142,6 +142,7 @@ decltype(auto) create_touch_impl(Bus *bus, std::nullptr_t) CREATE_TEST_CASE(AXS15231B) CREATE_TEST_CASE(CHSC6540) CREATE_TEST_CASE(CST816S) +CREATE_TEST_CASE(CST820) CREATE_TEST_CASE(FT5x06) CREATE_TEST_CASE(GT1151) CREATE_TEST_CASE(GT911) diff --git a/test_apps/gui/lvgl_v8_port/main/lvgl_v8_port.cpp b/test_apps/gui/lvgl_v8_port/main/lvgl_v8_port.cpp index 8c6042f3..e9f71dca 100644 --- a/test_apps/gui/lvgl_v8_port/main/lvgl_v8_port.cpp +++ b/test_apps/gui/lvgl_v8_port/main/lvgl_v8_port.cpp @@ -4,6 +4,8 @@ * SPDX-License-Identifier: CC0-1.0 */ +#include "freertos/FreeRTOS.h" + #include "esp_timer.h" #undef ESP_UTILS_LOG_TAG #define ESP_UTILS_LOG_TAG "LvPort" @@ -638,10 +640,18 @@ static lv_disp_t *display_init(LCD *lcd) return lv_disp_drv_register(&disp_drv); } +static SemaphoreHandle_t touch_detected; + static void touchpad_read(lv_indev_drv_t *indev_drv, lv_indev_data_t *data) { Touch *tp = (Touch *)indev_drv->user_data; TouchPoint point; + data->state = LV_INDEV_STATE_RELEASED; + + /* if we are interrupt driven wait for the ISR to fire */ + if ( tp->isInterruptEnabled() && (xSemaphoreTake( touch_detected, 0 ) == pdFALSE) ) { + return; + } /* Read data from touch controller */ int read_touch_result = tp->readPoints(&point, 1, 0); @@ -649,11 +659,17 @@ static void touchpad_read(lv_indev_drv_t *indev_drv, lv_indev_data_t *data) data->point.x = point.x; data->point.y = point.y; data->state = LV_INDEV_STATE_PRESSED; - } else { - data->state = LV_INDEV_STATE_RELEASED; } } +static bool onTouchInterruptCallback(void *user_data) +{ + BaseType_t xHigherPriorityTaskWoken = pdFALSE; + xSemaphoreGiveFromISR( touch_detected, &xHigherPriorityTaskWoken ); + portYIELD_FROM_ISR( xHigherPriorityTaskWoken ); + return false; +} + static lv_indev_t *indev_init(Touch *tp) { ESP_UTILS_CHECK_FALSE_RETURN(tp != nullptr, nullptr, "Invalid touch device"); @@ -661,6 +677,10 @@ static lv_indev_t *indev_init(Touch *tp) static lv_indev_drv_t indev_drv_tp; + if (tp->isInterruptEnabled()) { + touch_detected = xSemaphoreCreateBinary(); + tp->attachInterruptCallback(onTouchInterruptCallback, tp); + } ESP_UTILS_LOGD("Register input driver to LVGL"); lv_indev_drv_init(&indev_drv_tp); indev_drv_tp.type = LV_INDEV_TYPE_POINTER; diff --git a/.gitlab/tools/check_executables.py b/tools/check_executables.py similarity index 96% rename from .gitlab/tools/check_executables.py rename to tools/check_executables.py index 64260f86..d959fa5f 100755 --- a/.gitlab/tools/check_executables.py +++ b/tools/check_executables.py @@ -25,7 +25,7 @@ def _strip_each_item(iterable: Iterable) -> List: COMPONENT_PATH = os.getenv('COMPONENT_PATH', os.getcwd()) -EXECUTABLE_LIST_FN = os.path.join(COMPONENT_PATH, '.gitlab/tools/executable-list.txt') +EXECUTABLE_LIST_FN = os.path.join(COMPONENT_PATH, 'tools/executable-list.txt') known_executables = _strip_each_item(open(EXECUTABLE_LIST_FN).readlines()) diff --git a/tools/check_file_version.py b/tools/check_file_version.py index 4f88afe3..b6f02c4d 100644 --- a/tools/check_file_version.py +++ b/tools/check_file_version.py @@ -7,6 +7,7 @@ exclude_dirs = [ './build', + './examples/platformio/lvgl_v8_port/.pio' ] internal_version_file = 'src/esp_panel_versions.h' include_files = [ @@ -85,7 +86,7 @@ def is_in_directory(file_path, directory): def extract_file_version(file_path, version_dict): file_contents = [] content_str = '' - with open(file_path, 'r') as file: + with open(file_path, 'r', encoding='utf-8') as file: file_contents.append(file.readlines()) for content in file_contents: content_str = ''.join(content) @@ -104,7 +105,7 @@ def extract_file_version(file_path, version_dict): def extract_arduino_version(file_path): file_contents = [] content_str = '' - with open(file_path, 'r') as file: + with open(file_path, 'r', encoding='utf-8') as file: file_contents.append(file.readlines()) for content in file_contents: content_str = ''.join(content) diff --git a/.github/scripts/check_lib_versions.sh b/tools/check_lib_versions.sh similarity index 100% rename from .github/scripts/check_lib_versions.sh rename to tools/check_lib_versions.sh diff --git a/tools/executable-list.txt b/tools/executable-list.txt new file mode 100644 index 00000000..120e11ce --- /dev/null +++ b/tools/executable-list.txt @@ -0,0 +1,7 @@ +.gitlab/tools/check_readme_links.py +.gitlab/tools/push_to_github.sh + +tools/check_executables.py +tools/check_file_version.py +tools/check_lib_versions.sh +tools/sync_conf_files.py diff --git a/.gitlab/tools/idf_ci_utils.py b/tools/idf_ci_utils.py similarity index 100% rename from .gitlab/tools/idf_ci_utils.py rename to tools/idf_ci_utils.py diff --git a/tools/sync_conf_files.py b/tools/sync_conf_files.py index e14c6090..2238c093 100644 --- a/tools/sync_conf_files.py +++ b/tools/sync_conf_files.py @@ -10,8 +10,8 @@ './examples/platformio/lvgl_v8_port/src/lv_conf.h', ] exclude_dirs = [ - './build', - './examples/platformio/lvgl_v8_port/.pio', + r'.*build.*', + r'.*pio.*', ] @@ -25,14 +25,22 @@ def is_same_path(path1, path2): def is_in_directory(file_path, directory): - directory = os.path.realpath(directory) + import re file_path = os.path.realpath(file_path) - return file_path.startswith(directory) + # Check if the file path matches any of the exclude directory patterns + for pattern in exclude_dirs: + if re.search(pattern, file_path): + return True + return False def is_same_file(file1, file2): - with open(file1, 'r') as f1, open(file2, 'r') as f2: + # Check if both files exist + if not os.path.exists(file1) or not os.path.exists(file2): + return False + + with open(file1, 'r', encoding='utf-8') as f1, open(file2, 'r', encoding='utf-8') as f2: file1_content = f1.read() file2_content = f2.read() @@ -53,7 +61,7 @@ def replace_files(template_directory, search_directory, file_path): filename = os.path.basename(file_path) src_file = os.path.join(template_directory, filename) - if is_exclude_file(file_path): + if is_exclude_file(file_path) or not os.path.exists(src_file): print(f"Skip '{file_path}'") return