diff --git a/.build-rules.yml b/.build-rules.yml new file mode 100644 index 00000000..ffc33692 --- /dev/null +++ b/.build-rules.yml @@ -0,0 +1,44 @@ +# Note: All operators are binary operators. For more than two operands, you may use the nested parentheses trick. +# For example: +# * A == 1 or (B == 2 and C in [1,2,3]) +# * (A == 1 and B == 2) or (C not in ["3", "4", 5]) + +# Test apps +test_apps/lcd/3wire_spi_rgb: + disable: + - if: SOC_LCD_RGB_SUPPORTED != 1 + - if: IDF_TARGET == "esp32p4" + temporary: true + reason: not ready + +test_apps/lcd/qspi: + disable: + - if: SOC_GPSPI_SUPPORTED != 1 + +test_apps/lcd/rgb: + disable: + - if: SOC_LCD_RGB_SUPPORTED != 1 + - if: IDF_TARGET == "esp32p4" + temporary: true + reason: not ready + +test_apps/lcd/spi: + disable: + - if: SOC_GPSPI_SUPPORTED != 1 + +test_apps/panel: + enable: + - if: INCLUDE_DEFAULT == 1 + +test_apps/touch/i2c: + disable: + - if: SOC_I2C_SUPPORTED != 1 + +test_apps/touch/spi: + disable: + - if: SOC_GPSPI_SUPPORTED != 1 + +# Examples +# examples/esp_idf/esp_brookesia_phone_m5stace_core_s3: +# enable: +# - if: IDF_TARGET in ["esp32s3"] diff --git a/.codespellrc b/.codespellrc new file mode 100644 index 00000000..0a3c74da --- /dev/null +++ b/.codespellrc @@ -0,0 +1,2 @@ +[codespell] +skip = ./src/touch/base/esp_lcd_touch_xpt2046.c diff --git a/.github/scripts/check_lib_versions.sh b/.github/scripts/check_lib_versions.sh old mode 100644 new mode 100755 index d458178c..8c636650 --- a/.github/scripts/check_lib_versions.sh +++ b/.github/scripts/check_lib_versions.sh @@ -15,7 +15,7 @@ check_version_format() { if [ $# -lt 1 ]; then latest_version="0.0.0" - echo "Don't get the lastest version, use \"0.0.0\" as default" + echo "Don't get the latest version, use \"0.0.0\" as default" else # Get the first input parameter as the version to be compared latest_version="$1" diff --git a/.github/workflows/check_lib_versions.yml b/.github/workflows/check_lib_versions.yml index a70f5403..0d3959da 100644 --- a/.github/workflows/check_lib_versions.yml +++ b/.github/workflows/check_lib_versions.yml @@ -27,4 +27,3 @@ jobs: echo "url: ${{ steps.last_release.outputs.url }}" - name: Check & Compare versions run: bash ./.github/scripts/check_lib_versions.sh ${{ steps.last_release.outputs.tag_name }} - diff --git a/.github/workflows/issue_comment.yml b/.github/workflows/issue_comment.yml new file mode 100644 index 00000000..3b6fcc19 --- /dev/null +++ b/.github/workflows/issue_comment.yml @@ -0,0 +1,24 @@ +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 new file mode 100644 index 00000000..f0fa4025 --- /dev/null +++ b/.github/workflows/new_issues.yml @@ -0,0 +1,24 @@ +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 new file mode 100644 index 00000000..01d7fe26 --- /dev/null +++ b/.github/workflows/new_prs.yml @@ -0,0 +1,29 @@ +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/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 00000000..36c31d52 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,28 @@ +stages: + - pre_check + - build + - deploy + +workflow: + rules: + # Disable those non-protected push triggered pipelines + - if: '$CI_COMMIT_REF_NAME != "master" && $CI_COMMIT_BRANCH !~ /^release\/v/ && $CI_COMMIT_TAG !~ /^v\d+\.\d+(\.\d+)?($|-)/ && $CI_PIPELINE_SOURCE == "push"' + when: never + # when running merged result pipelines, it would create a temp commit id. use $CI_MERGE_REQUEST_SOURCE_BRANCH_SHA instead of $CI_COMMIT_SHA. + # Please use PIPELINE_COMMIT_SHA at all places that require a commit sha + - if: $CI_OPEN_MERGE_REQUESTS != null + variables: + PIPELINE_COMMIT_SHA: $CI_MERGE_REQUEST_SOURCE_BRANCH_SHA + - if: $CI_OPEN_MERGE_REQUESTS == null + variables: + PIPELINE_COMMIT_SHA: $CI_COMMIT_SHA + - when: always + +variables: + COMPONENT_PATH: "$CI_PROJECT_DIR" + +include: + - '.gitlab/ci/rules.yml' + - '.gitlab/ci/pre_check.yml' + - '.gitlab/ci/build.yml' + - '.gitlab/ci/deploy.yml' diff --git a/.gitlab/ci/build.yml b/.gitlab/ci/build.yml new file mode 100644 index 00000000..22deba4e --- /dev/null +++ b/.gitlab/ci/build.yml @@ -0,0 +1,117 @@ +.build_template: &build_template + stage: build + tags: + - build + image: ${IMAGE} + variables: + # Enable ccache for all build jobs. See configure_ci_environment.sh for more ccache related settings. + IDF_CCACHE_ENABLE: "1" + BATCH_BUILD: "1" + V: "0" + WARNING_STR: "" + +.build_examples_template: &build_examples_template + <<: *build_template + artifacts: + when: always + paths: + - "**/build*/size.json" + - "**/build*/build_log.txt" + - "**/build*/*.bin" + # upload to s3 server to save the artifacts size + - "**/build*/*.map" + - "**/build*/*.elf" + - "**/build*/flasher_args.json" + - "**/build*/flash_args" + - "**/build*/flash_project_args" + - "**/build*/config/sdkconfig.json" + - "**/build*/bootloader/*.bin" + - "**/build*/bootloader/*.elf" + - "**/build*/partition_table/*.bin" + - "**/build*/mmap_build/*.bin" + - "**/build*/**/*.bin" + - size_info.txt + expire_in: 1 week + variables: + IDF_CI_BUILD: "1" + # By configuring this macro, you can append the compiled configuration file. + # For example, using "sdkconf.etc=default" specifies the default sdkconfig file. + EXAMPLE_CONFIG: "=" + script: + - pip install "idf-component-manager" + - pip install idf_build_apps + - python .gitlab/tools/build_apps.py ${EXAMPLE_DIR} --config ${EXAMPLE_CONFIG} -t all -vv + +# Target ESP-IDF versions +.build_idf_active_release_version: + parallel: + matrix: + - IMAGE: espressif/idf:release-v5.1 + - IMAGE: espressif/idf:release-v5.2 + - IMAGE: espressif/idf:release-v5.3 + +# Test apps +build_test_apps_lcd_3wire_spi_rgb: + extends: + - .build_examples_template + - .build_idf_active_release_version + - .rules:build:test_apps_lcd_3wire_spi_rgb + variables: + EXAMPLE_DIR: test_apps/lcd/3wire_spi_rgb + +build_test_apps_lcd_qspi: + extends: + - .build_examples_template + - .build_idf_active_release_version + - .rules:build:test_apps_lcd_qspi + variables: + EXAMPLE_DIR: test_apps/lcd/qspi + +build_test_apps_lcd_rgb: + extends: + - .build_examples_template + - .build_idf_active_release_version + - .rules:build:test_apps_lcd_rgb + variables: + EXAMPLE_DIR: test_apps/lcd/rgb + +build_test_apps_lcd_spi: + extends: + - .build_examples_template + - .build_idf_active_release_version + - .rules:build:test_apps_lcd_spi + variables: + EXAMPLE_DIR: test_apps/lcd/spi + +build_test_apps_panel: + extends: + - .build_examples_template + - .build_idf_active_release_version + - .rules:build:test_apps_panel + variables: + EXAMPLE_DIR: test_apps/panel + +build_test_apps_touch_i2c: + extends: + - .build_examples_template + - .build_idf_active_release_version + - .rules:build:test_apps_touch_i2c + variables: + EXAMPLE_DIR: test_apps/touch/i2c + +build_test_apps_touch_spi: + extends: + - .build_examples_template + - .build_idf_active_release_version + - .rules:build:test_apps_touch_spi + variables: + EXAMPLE_DIR: test_apps/touch/spi + +# Examples +# build_example_esp_brookesia_phone_m5stace_core_s3: +# extends: +# - .build_examples_template +# - .build_esp32_s3_idf_release_version +# - .rules:build:example_esp_brookesia_phone_m5stace_core_s3 +# variables: +# EXAMPLE_DIR: examples/esp_idf/esp_brookesia_phone_m5stace_core_s3 diff --git a/.gitlab/ci/deploy.yml b/.gitlab/ci/deploy.yml new file mode 100644 index 00000000..7447498c --- /dev/null +++ b/.gitlab/ci/deploy.yml @@ -0,0 +1,25 @@ +push_to_github: + stage: deploy + only: + - master + - /^release\/v/ +# when: on_success + image: $CI_DOCKER_REGISTRY/esp32-ci-env + tags: + - github_sync + variables: + GIT_STRATEGY: clone + SUBMODULES_TO_FETCH: "none" + dependencies: [] + before_script: + - echo "skip default before_script" + script: + - mkdir -p ~/.ssh + - chmod 700 ~/.ssh + - echo -n $GH_PUSH_KEY > ~/.ssh/id_rsa_base64 + - base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa + - chmod 600 ~/.ssh/id_rsa + - echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config + - git remote remove github &>/dev/null || true + - git remote add github git@github.com:esp-arduino-libs/ESP32_Display_Panel.git + - ${COMPONENT_PATH}/.gitlab/tools/push_to_github.sh diff --git a/.gitlab/ci/pre_check.yml b/.gitlab/ci/pre_check.yml new file mode 100644 index 00000000..392e3566 --- /dev/null +++ b/.gitlab/ci/pre_check.yml @@ -0,0 +1,21 @@ +.pre_check_template: + stage: pre_check + image: python:3.9 + tags: ["build", "amd64", "internet"] + dependencies: [] + +check_pre_commit: + extends: + - .pre_check_template + before_script: + - pip install pre-commit + script: + - pre-commit run --show-diff-on-failure --color=always --all-files + +check_readme_links: + extends: + - .pre_check_template + - .rules:pre_check:readme + allow_failure: true + script: + - python ${CI_PROJECT_DIR}/.gitlab/tools/check_readme_links.py diff --git a/.gitlab/ci/rules.yml b/.gitlab/ci/rules.yml new file mode 100644 index 00000000..065c0ff9 --- /dev/null +++ b/.gitlab/ci/rules.yml @@ -0,0 +1,193 @@ +############ +# Patterns # +############ + +# build system, if changed, build all apps +.patterns-build_system: &patterns-build_system + # For test + - ".gitlab/**/*" + - ".build-rules.yml" + - "conftest.py" + - "pytest.ini" + +# component folder +.patterns-component: &patterns-component + - "src/**/*" + - "CMakeLists.txt" + - "esp_brookesia_conf.h" + - "idf_component.yml" + - "Kconfig" + +# docs folder +.patterns-docs_md: &patterns-docs_md + - "**/*.md" + +# test_apps folder +.patterns-test_apps_lcd_3wire_spi_rgb: &patterns-test_apps_lcd_3wire_spi_rgb + - "test_apps/lcd/3wire_spi_rgb/**/*" + +.patterns-test_apps_lcd_qspi: &patterns-test_apps_lcd_qspi + - "test_apps/lcd/qspi/**/*" + +.patterns-test_apps_lcd_rgb: &patterns-test_apps_lcd_rgb + - "test_apps/lcd/rgb/**/*" + +.patterns-test_apps_lcd_spi: &patterns-test_apps_lcd_spi + - "test_apps/lcd/spi/**/*" + +.patterns-test_apps_panel: &patterns-test_apps_panel + - "test_apps/panel/**/*" + +.patterns-test_apps_touch_i2c: &patterns-test_apps_touch_i2c + - "test_apps/touch/i2c/**/*" + +.patterns-test_apps_touch_spi: &patterns-test_apps_touch_spi + - "test_apps/touch/spi/**/*" + +# examples folder +# .patterns-example_esp_brookesia_phone_m5stace_core_s3: &patterns-example_esp_brookesia_phone_m5stace_core_s3 +# - "examples/esp_idf/esp_brookesia_phone_m5stace_core_s3/**/*" + +############## +# if anchors # +############## +.if-protected: &if-protected + if: '($CI_COMMIT_REF_NAME == "master" || $CI_COMMIT_BRANCH =~ /^release\/v/ || $CI_COMMIT_TAG =~ /^v\d+\.\d+(\.\d+)?($|-)/)' + +.if-dev-push: &if-dev-push + if: '$CI_COMMIT_REF_NAME != "master" && $CI_COMMIT_BRANCH !~ /^release\/v/ && $CI_COMMIT_TAG !~ /^v\d+\.\d+(\.\d+)?($|-)/ && ($CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "merge_request_event")' + +################## +# Auto Generated # +################## +.if-trigger-job: &if-trigger-job + if: '$BOT_DYNAMIC_TEST_JOBS && $BOT_DYNAMIC_TEST_JOBS =~ $CI_JOB_NAME' + +.if-label-build: &if-label-build + if: '$BOT_LABEL_BUILD || $CI_MERGE_REQUEST_LABELS =~ /^(?:[^,\n\r]+,)*build(?:,[^,\n\r]+)*$/i' + +.if-label-target_test: &if-label-target_test + if: '$BOT_LABEL_TARGET_TEST || $CI_MERGE_REQUEST_LABELS =~ /^(?:[^,\n\r]+,)*target_test(?:,[^,\n\r]+)*$/i' + +.if-label-pre_check: &if-label-pre_check + if: '$BOT_LABEL_PRE_CHECK || $CI_MERGE_REQUEST_LABELS =~ /^(?:[^,\n\r]+,)*pre_check(?:,[^,\n\r]+)*$/i' + +.if_label-deploy: &if-label-deploy + if: '$BOT_LABEL_DEPLOY || $CI_MERGE_REQUEST_LABELS =~ /^(?:[^,\n\r]+,)*deploy(?:,[^,\n\r]+)*$/i' + +# rules for readme +.rules:pre_check:readme: + rules: + - <<: *if-protected + - <<: *if-label-pre_check + - <<: *if-trigger-job + - <<: *if-dev-push + changes: *patterns-docs_md + - <<: *if-dev-push + changes: *patterns-build_system + +# rules for test_apps +.rules:build:test_apps_lcd_3wire_spi_rgb: + rules: + - <<: *if-protected + - <<: *if-label-build + - <<: *if-label-target_test + - <<: *if-trigger-job + - <<: *if-dev-push + changes: *patterns-build_system + - <<: *if-dev-push + changes: *patterns-component + - <<: *if-dev-push + changes: *patterns-test_apps_lcd_3wire_spi_rgb + +.rules:build:test_apps_lcd_qspi: + rules: + - <<: *if-protected + - <<: *if-label-build + - <<: *if-label-target_test + - <<: *if-trigger-job + - <<: *if-dev-push + changes: *patterns-build_system + - <<: *if-dev-push + changes: *patterns-component + - <<: *if-dev-push + changes: *patterns-test_apps_lcd_qspi + +.rules:build:test_apps_lcd_rgb: + rules: + - <<: *if-protected + - <<: *if-label-build + - <<: *if-label-target_test + - <<: *if-trigger-job + - <<: *if-dev-push + changes: *patterns-build_system + - <<: *if-dev-push + changes: *patterns-component + - <<: *if-dev-push + changes: *patterns-test_apps_lcd_rgb + +.rules:build:test_apps_lcd_spi: + rules: + - <<: *if-protected + - <<: *if-label-build + - <<: *if-label-target_test + - <<: *if-trigger-job + - <<: *if-dev-push + changes: *patterns-build_system + - <<: *if-dev-push + changes: *patterns-component + - <<: *if-dev-push + changes: *patterns-test_apps_lcd_spi + +.rules:build:test_apps_panel: + rules: + - <<: *if-protected + - <<: *if-label-build + - <<: *if-label-target_test + - <<: *if-trigger-job + - <<: *if-dev-push + changes: *patterns-build_system + - <<: *if-dev-push + changes: *patterns-component + - <<: *if-dev-push + changes: *patterns-test_apps_panel + +.rules:build:test_apps_touch_i2c: + rules: + - <<: *if-protected + - <<: *if-label-build + - <<: *if-label-target_test + - <<: *if-trigger-job + - <<: *if-dev-push + changes: *patterns-build_system + - <<: *if-dev-push + changes: *patterns-component + - <<: *if-dev-push + changes: *patterns-test_apps_touch_i2c + +.rules:build:test_apps_touch_spi: + rules: + - <<: *if-protected + - <<: *if-label-build + - <<: *if-label-target_test + - <<: *if-trigger-job + - <<: *if-dev-push + changes: *patterns-build_system + - <<: *if-dev-push + changes: *patterns-component + - <<: *if-dev-push + changes: *patterns-test_apps_touch_spi + +# rules for examples +# .rules:build:example_esp_brookesia_phone_m5stace_core_s3: +# rules: +# - <<: *if-protected +# - <<: *if-label-build +# - <<: *if-label-target_test +# - <<: *if-trigger-job +# - <<: *if-dev-push +# changes: *patterns-component +# - <<: *if-dev-push +# changes: *patterns-example_esp_brookesia_phone_m5stace_core_s3 +# - <<: *if-dev-push +# changes: *patterns-build_system diff --git a/.gitlab/tools/build_apps.py b/.gitlab/tools/build_apps.py new file mode 100644 index 00000000..e6265711 --- /dev/null +++ b/.gitlab/tools/build_apps.py @@ -0,0 +1,170 @@ +# SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD +# +# SPDX-License-Identifier: Apache-2.0 + +""" +This file is used in CI generate binary files for different kinds of apps +""" + +import argparse +import sys +import os +import re +import logging +from pathlib import Path +from typing import List + +from idf_build_apps import App, build_apps, find_apps, setup_logging + +logger = logging.getLogger('idf_build_apps') + +PROJECT_ROOT = Path(__file__).parent.parent.parent.absolute() +APPS_BUILD_PER_JOB = 30 +IGNORE_WARNINGS = [ +] + + +def _get_idf_version(): + if os.environ.get('IDF_VERSION'): + return os.environ.get('IDF_VERSION') + version_path = os.path.join(os.environ['IDF_PATH'], 'tools/cmake/version.cmake') + regex = re.compile(r'^\s*set\s*\(\s*IDF_VERSION_([A-Z]{5})\s+(\d+)') + ver = {} + with open(version_path) as f: + for line in f: + m = regex.match(line) + if m: + ver[m.group(1)] = m.group(2) + return '{}.{}'.format(int(ver['MAJOR']), int(ver['MINOR'])) + + +def get_cmake_apps( + paths, + target, + config_rules_str, + default_build_targets, +): # type: (List[str], str, List[str]) -> List[App] + idf_ver = _get_idf_version() + apps = find_apps( + paths, + recursive=True, + target=target, + build_dir=f'{idf_ver}/build_@t_@w', + config_rules_str=config_rules_str, + build_log_filename='build_log.txt', + size_json_filename='size.json', + check_warnings=True, + default_build_targets=default_build_targets, + manifest_files=[ + str(Path(PROJECT_ROOT) / '.build-rules.yml'), + ], + ) + return apps + + +def main(args): # type: (argparse.Namespace) -> None + default_build_targets = args.default_build_targets.split(',') if args.default_build_targets else None + apps = get_cmake_apps(args.paths, args.target, args.config, default_build_targets) + if args.find: + if args.output: + os.makedirs(os.path.dirname(os.path.realpath(args.output)), exist_ok=True) + with open(args.output, 'w') as fw: + for app in apps: + fw.write(app.to_json() + '\n') + else: + for app in apps: + print(app) + + sys.exit(0) + + if args.exclude_apps: + apps_to_build = [app for app in apps if app.name not in args.exclude_apps] + else: + apps_to_build = apps[:] + + logger.info('Found %d apps after filtering', len(apps_to_build)) + logger.info( + 'Suggest setting the parallel count to %d for this build job', + len(apps_to_build) // APPS_BUILD_PER_JOB + 1, + ) + + ret_code = build_apps( + apps_to_build, + parallel_count=args.parallel_count, + parallel_index=args.parallel_index, + dry_run=False, + collect_size_info=args.collect_size_info, + keep_going=True, + ignore_warning_strs=IGNORE_WARNINGS, + copy_sdkconfig=True + ) + + sys.exit(ret_code) + + +if __name__ == '__main__': + parser = argparse.ArgumentParser( + description='Build all the apps for different test types. Will auto remove those non-test apps binaries', + formatter_class=argparse.ArgumentDefaultsHelpFormatter, + ) + parser.add_argument('paths', nargs='*', help='Paths to the apps to build.') + parser.add_argument( + '-t', '--target', + default='all', + help='Build apps for given target. could pass "all" to get apps for all targets', + ) + parser.add_argument( + '--config', + default=['sdkconfig.ci=default', 'sdkconfig.ci.*=', '=default'], + action='append', + help='Adds configurations (sdkconfig file names) to build. This can either be ' + 'FILENAME[=NAME] or FILEPATTERN. FILENAME is the name of the sdkconfig file, ' + 'relative to the project directory, to be used. Optional NAME can be specified, ' + 'which can be used as a name of this configuration. FILEPATTERN is the name of ' + 'the sdkconfig file, relative to the project directory, with at most one wildcard. ' + 'The part captured by the wildcard is used as the name of the configuration.', + ) + parser.add_argument( + '--parallel-count', default=1, type=int, help='Number of parallel build jobs.' + ) + parser.add_argument( + '--parallel-index', + default=1, + type=int, + help='Index (1-based) of the job, out of the number specified by --parallel-count.', + ) + parser.add_argument( + '--collect-size-info', + type=argparse.FileType('w'), + help='If specified, the test case name and size info json will be written to this file', + ) + parser.add_argument( + '--exclude-apps', + nargs='*', + help='Exclude build apps', + ) + parser.add_argument( + '--default-build-targets', + default=None, + help='default build targets used in manifest files', + ) + parser.add_argument( + '-v', '--verbose', + action='count', default=0, + help='Show verbose log message', + ) + parser.add_argument( + '--find', + action='store_true', + help='Find the buildable applications. If enable this option, build options will be ignored.', + ) + parser.add_argument( + '-o', '--output', + help='Print the found apps to the specified file instead of stdout' + ) + + arguments = parser.parse_args() + if not arguments.paths: + arguments.paths = [PROJECT_ROOT] + setup_logging(verbose=arguments.verbose) # Info + main(arguments) diff --git a/.gitlab/tools/check_executables.py b/.gitlab/tools/check_executables.py new file mode 100755 index 00000000..64260f86 --- /dev/null +++ b/.gitlab/tools/check_executables.py @@ -0,0 +1,74 @@ +#!/usr/bin/env python +# +# SPDX-FileCopyrightText: 2020-2024 Espressif Systems (Shanghai) CO LTD +# SPDX-License-Identifier: Apache-2.0 + +import argparse +import os +import sys +from typing import Iterable, List + +try: + from idf_ci_utils import is_executable +except ImportError: + sys.path.append(os.path.join(os.path.dirname(__file__))) + + from idf_ci_utils import is_executable + + +def _strip_each_item(iterable: Iterable) -> List: + res = [] + for item in iterable: + if item: + res.append(item.strip()) + return res + + +COMPONENT_PATH = os.getenv('COMPONENT_PATH', os.getcwd()) +EXECUTABLE_LIST_FN = os.path.join(COMPONENT_PATH, '.gitlab/tools/executable-list.txt') +known_executables = _strip_each_item(open(EXECUTABLE_LIST_FN).readlines()) + + +def check_executable_list() -> int: + ret = 0 + for index, fn in enumerate(known_executables): + if not os.path.exists(os.path.join(COMPONENT_PATH, fn)): + print('{}:{} {} not exists. Please remove it manually'.format(EXECUTABLE_LIST_FN, index + 1, fn)) + ret = 1 + return ret + + +def check_executables(files: List) -> int: + ret = 0 + for fn in files: + fn_executable = is_executable(fn) + fn_in_list = fn in known_executables + if fn_executable and not fn_in_list: + print('"{}" is not in {}'.format(fn, EXECUTABLE_LIST_FN)) + ret = 1 + if not fn_executable and fn_in_list: + print('"{}" is not executable but is in {}'.format(fn, EXECUTABLE_LIST_FN)) + ret = 1 + return ret + + +def check() -> int: + parser = argparse.ArgumentParser() + parser.add_argument('--action', choices=['executables', 'list'], required=True, + help='if "executables", pass all your executables to see if it\'s in the list.' + 'if "list", check if all items on your list exist') + parser.add_argument('filenames', nargs='*', help='Filenames to check.') + args = parser.parse_args() + + if args.action == 'executables': + ret = check_executables(args.filenames) + elif args.action == 'list': + ret = check_executable_list() + else: + raise ValueError + + return ret + + +if __name__ == '__main__': + sys.exit(check()) diff --git a/.gitlab/tools/check_readme_links.py b/.gitlab/tools/check_readme_links.py new file mode 100755 index 00000000..efe9523e --- /dev/null +++ b/.gitlab/tools/check_readme_links.py @@ -0,0 +1,165 @@ +#!/usr/bin/env python +# +# Checks that all links in the readme markdown files are valid +# +# SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD +# SPDX-License-Identifier: Apache-2.0 +# + +import argparse +import concurrent.futures +import os +import os.path +import re +import sys +import urllib.error +import urllib.request +from collections import defaultdict, namedtuple +from pathlib import Path +from typing import List + +EXCLUDE_DOCS_LIST = [] + +# The apple apps links are not accessible from the company network for some reason +EXCLUDE_URL_LIST = [ + 'https://squareline.io/', + 'https://m5stack.com/', + 'https://docs.m5stack.com/en/core/CoreS3', + 'https://docs.m5stack.com/en/core/M5Dial', + 'https://docs.m5stack.com/en/core/M5Dial', + 'https://img.shields.io/github/v/release/esp-arduino-libs/ESP32_Display_Panel', + 'https://www.displaysmodule.com/sale-41828962-experience-the-power-of-the-esp32-display-module-sku-esp32-4848s040c-i-y-3.html', + 'https://www.displaysmodule.com/', + 'https://www.waveshare.com/', + 'https://www.waveshare.com/esp32-s3-touch-lcd-4.3.htm', + 'https://www.waveshare.com/esp32-s3-touch-lcd-2.1.htm', + 'https://www.waveshare.com/esp32-s3-touch-lcd-1.85.htm', +] + +Link = namedtuple('Link', ['file', 'url']) + + +class ReadmeLinkError(Exception): + def __init__(self, file: str, url: str) -> None: + self.file = file + self.url = url + + +class RelativeLinkError(ReadmeLinkError): + def __str__(self) -> str: + return 'Relative link error, file - {} not found, linked from {}'.format(self.url, self.file) + + +class UrlLinkError(ReadmeLinkError): + def __init__(self, file: str, url: str, error_code: str): + self.error_code = error_code + super().__init__(file, url) + + def __str__(self) -> str: + files = [str(f) for f in self.file] + return 'URL error, url - {} in files - {} is not accessible, request returned {}'.format(self.url, ', '.join(files), self.error_code) + + +# we do not want a failed test just due to bad network conditions, for non 404 errors we simply print a warning +def check_url(url: str, files: str, timeout: float) -> None: + try: + with urllib.request.urlopen(url, timeout=timeout): + return + except urllib.error.HTTPError as e: + if e.code == 404: + raise UrlLinkError(files, url, str(e)) + else: + print('Unable to access {}, err = {}'.format(url, str(e))) + except Exception as e: + print('Unable to access {}, err = {}'.format(url, str(e))) + + +def check_web_links(web_links: defaultdict) -> List: + + with concurrent.futures.ThreadPoolExecutor(max_workers=10) as executor: + errors = [] + future_to_url = {executor.submit(check_url, url, files, timeout=30): (url, files) for url, files in web_links.items()} + for future in concurrent.futures.as_completed(future_to_url): + try: + future.result() + except UrlLinkError as e: + errors.append(e) + + return errors + + +def check_file_links(file_links: List) -> List: + errors = [] + + for link in file_links: + link_path = link.file.parent / link.url + + if not Path.exists(link_path): + errors.append(RelativeLinkError(link.file, link.url)) + + print('Found {} errors with relative links'.format(len(errors))) + return errors + + +def get_md_links(folder: str) -> List: + MD_LINK_RE = r'\[.+?\]\((.+?)(#.+)?\)' + + idf_path_str = os.getenv('COMPONENT_PATH') + if idf_path_str is None: + raise RuntimeError("Environment variable 'COMPONENT_PATH' wasn't set.") + idf_path = Path(idf_path_str) + links = [] + + for path in (idf_path / folder).rglob('*.md'): + with path.open(encoding='utf8') as f: + content = f.read() + + for url in re.findall(MD_LINK_RE, content): + link = Link(path, url[0].lstrip()) + # Ignore "local" links + if not link.url.startswith('#'): + links.append(link) + + return links + + +def check_readme_links(args: argparse.Namespace) -> int: + + links = get_md_links('') + print('Found {} links'.format(len(links))) + + errors = [] + + web_links = defaultdict(list) + file_links = [] + + # Sort links into file and web links + for link in links: + if link.url.startswith('http'): + web_links[link.url].append(link.file) + else: + file_links.append(link) + + for url in EXCLUDE_URL_LIST: + if url in web_links: + del web_links[url] + + errors.extend(check_file_links(file_links)) + + if not args.skip_weburl: + errors.extend(check_web_links(web_links)) + + print('Found {} errors:'.format(len(errors))) + for e in errors: + print(e) + + return 1 if len(errors) > 0 else 0 + + +if __name__ == '__main__': + + parser = argparse.ArgumentParser(description='check_readme_links.py: Checks for dead links in example READMEs', prog='check_readme_links.py') + parser.add_argument('--skip-weburl', '-w', action='store_true', help='Skip checking of web URLs, only check links to local files') + args = parser.parse_args() + + sys.exit(check_readme_links(args)) diff --git a/.gitlab/tools/executable-list.txt b/.gitlab/tools/executable-list.txt new file mode 100644 index 00000000..22439eee --- /dev/null +++ b/.gitlab/tools/executable-list.txt @@ -0,0 +1,4 @@ +.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/.gitlab/tools/idf_ci_utils.py b/.gitlab/tools/idf_ci_utils.py new file mode 100644 index 00000000..3e541fa5 --- /dev/null +++ b/.gitlab/tools/idf_ci_utils.py @@ -0,0 +1,112 @@ +# SPDX-FileCopyrightText: 2020-2024 Espressif Systems (Shanghai) CO LTD +# SPDX-License-Identifier: Apache-2.0 + +# internal use only for CI +# some CI related util functions + +import logging +import os +import subprocess +import sys +from typing import Any, List + +IDF_PATH = os.path.abspath(os.getenv('IDF_PATH', os.path.join(os.path.dirname(__file__), '..', '..'))) + + +def get_submodule_dirs(full_path: bool = False) -> List[str]: + """ + To avoid issue could be introduced by multi-os or additional dependency, + we use python and git to get this output + :return: List of submodule dirs + """ + dirs = [] + try: + lines = ( + subprocess.check_output( + [ + 'git', + 'config', + '--file', + os.path.realpath(os.path.join(IDF_PATH, '.gitmodules')), + '--get-regexp', + 'path', + ] + ) + .decode('utf8') + .strip() + .split('\n') + ) + for line in lines: + _, path = line.split(' ') + if full_path: + dirs.append(os.path.join(IDF_PATH, path)) + else: + dirs.append(path) + except Exception as e: # pylint: disable=W0703 + logging.warning(str(e)) + + return dirs + + +def _check_git_filemode(full_path: str) -> bool: + try: + stdout = subprocess.check_output(['git', 'ls-files', '--stage', full_path]).strip().decode('utf-8') + except subprocess.CalledProcessError: + return True + + mode = stdout.split(' ', 1)[0] # e.g. 100644 for a rw-r--r-- + if any([int(i, 8) & 1 for i in mode[-3:]]): + return True + return False + + +def is_executable(full_path: str) -> bool: + """ + os.X_OK will always return true on windows. Use git to check file mode. + :param full_path: file full path + :return: True is it's an executable file + """ + if sys.platform == 'win32': + return _check_git_filemode(full_path) + return os.access(full_path, os.X_OK) + + +def get_git_files(path: str = IDF_PATH, full_path: bool = False) -> List[str]: + """ + Get the result of git ls-files + :param path: path to run git ls-files + :param full_path: return full path if set to True + :return: list of file paths + """ + try: + # this is a workaround when using under worktree + # if you're using worktree, when running git commit a new environment variable GIT_DIR would be declared, + # the value should be /.git/worktrees/ + # This would affect the return value of `git ls-files`, unset this would use the `cwd`value or its parent + # folder if no `.git` folder found in `cwd`. + workaround_env = os.environ.copy() + workaround_env.pop('GIT_DIR', None) + files = ( + subprocess.check_output(['git', 'ls-files'], cwd=path, env=workaround_env) + .decode('utf8') + .strip() + .split('\n') + ) + except Exception as e: # pylint: disable=W0703 + logging.warning(str(e)) + files = [] + return [os.path.join(path, f) for f in files] if full_path else files + + +def is_in_directory(file_path: str, folder: str) -> bool: + return os.path.realpath(file_path).startswith(os.path.realpath(folder) + os.sep) + + +def to_list(s: Any) -> List[Any]: + if isinstance(s, (set, tuple)): + return list(s) + + if isinstance(s, list): + return s + + return [s] diff --git a/.gitlab/tools/push_to_github.sh b/.gitlab/tools/push_to_github.sh new file mode 100755 index 00000000..f161f5c6 --- /dev/null +++ b/.gitlab/tools/push_to_github.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +# gitlab-ci script to push current tested revision (tag or branch) to github + +set -ex + +if [ -n "${CI_COMMIT_TAG}" ]; then + # for tags + git push github "${CI_COMMIT_TAG}" +else + # for branches + git push github "${CI_COMMIT_SHA}:refs/heads/${CI_COMMIT_REF_NAME}" +fi diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6ab8eed5..38e47856 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -23,17 +23,70 @@ repos: args: ['--config=.flake8', '--tee', '--benchmark'] - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.3.0 + rev: v4.6.0 hooks: - id: trailing-whitespace - types_or: [c, c++] + # note: whitespace exclusions use multiline regex, see https://pre-commit.com/#regular-expressions + # items are: + # 1 - some file extensions + # 2 - any file matching *test*/*expected* (for host tests, if possible use this naming pattern always) + # 3 - any file with known-warnings in the name + # 4 - any directory named 'testdata' + # 5 - protobuf auto-generated files + exclude: &whitespace_excludes | + (?x)^( + .+\.(md|rst|map|bin)| + .+test.*\/.*expected.*| + .+known-warnings.*| + .+\/testdata\/.+| + .*_pb2.py| + .*.pb-c.h| + .*.pb-c.c| + .*.yuv + )$ - id: end-of-file-fixer - types_or: [c, c++] - - id: check-merge-conflict + exclude: *whitespace_excludes + - id: check-executables-have-shebangs + - id: check-shebang-scripts-are-executable - id: mixed-line-ending - types_or: [c, c++, text] - args: ['--fix=lf'] - description: Forces to replace line ending by the UNIX 'lf' character + args: ['-f=lf'] + - id: double-quote-string-fixer + - id: no-commit-to-branch + name: Do not use more than one slash in the branch name + args: ['--pattern', '^[^/]*/[^/]*/'] + - id: no-commit-to-branch + name: Do not use uppercase letters in the branch name + args: ['--pattern', '^[^A-Z]*[A-Z]'] + + - repo: https://github.com/espressif/conventional-precommit-linter + rev: v1.8.0 + hooks: + - id: conventional-precommit-linter + stages: [commit-msg] + args: + - --subject-min-length=15 + - --body-max-line-length=200 + + - repo: https://github.com/codespell-project/codespell + rev: v2.3.0 + hooks: + - id: codespell + args: ['-w' , '--config', '.codespellrc'] + + - repo: local + hooks: + - id: check-executables + name: Check File Permissions + entry: .gitlab/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 + language: python + pass_filenames: false + always_run: true - repo: local hooks: diff --git a/CHANGELOG.md b/CHANGELOG.md index 383ddd80..8f93459f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,7 +30,7 @@ * fix(examples): fix WiFiClock wrong name `ScreenPassord` by @lboue (#82) * fix(examples): fix LCD using `configVendorCommands()` before `init()` * fix(examples): fix `LV_USE_DEMO_WIDGETS` typo by @lboue (#98) -* fix(examples): fix `Tearing fucntion` typo by @lboue (#96) +* fix(examples): fix `Tearing function` typo by @lboue (#96) * fix(examples): fix WiFiClock log HTTP error code to serial console by @lboue (#97) * fix(examples): fix WiFiClock description * fix(gt911): allow to set the GT911 touch device address by @lboue (#86) diff --git a/CMakeLists.txt b/CMakeLists.txt index 13cc6736..4061d68a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,14 +5,11 @@ file(GLOB_RECURSE C_SRCS "${SRCS_DIR}/*.c") idf_component_register( SRCS - ${C_SRCS} - ${CPP_SRCS} + ${C_SRCS} ${CPP_SRCS} INCLUDE_DIRS ${SRCS_DIR} REQUIRES - driver - esp_lcd - esp-io-expander + driver esp_lcd ) target_compile_options(${COMPONENT_LIB} PRIVATE -Wno-missing-field-initializers -Wno-narrowing) diff --git a/ESP_Panel_Board_Custom.h b/ESP_Panel_Board_Custom.h index 5ed0f923..3ae31b50 100644 --- a/ESP_Panel_Board_Custom.h +++ b/ESP_Panel_Board_Custom.h @@ -173,21 +173,23 @@ * * There are two formats for the sequence code: * 1. Raw data: {command, (uint8_t []){ data0, data1, ... }, data_size, delay_ms} - * 2. Formater: ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(delay_ms, command, { data0, data1, ... }) and + * 2. Formatter: ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(delay_ms, command, { data0, data1, ... }) and * ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(delay_ms, command) */ -// #define ESP_PANEL_LCD_VENDOR_INIT_CMD() \ -// { \ -// {0xFF, (uint8_t []){0x77, 0x01, 0x00, 0x00, 0x10}, 5, 0}, \ -// {0xC0, (uint8_t []){0x3B, 0x00}, 2, 0}, \ -// {0xC1, (uint8_t []){0x0D, 0x02}, 2, 0}, \ -// {0x29, (uint8_t []){0x00}, 0, 120}, \ -// or \ -// ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xFF, {0x77, 0x01, 0x00, 0x00, 0x10}), \ -// ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC0, {0x3B, 0x00}), \ -// ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC1, {0x0D, 0x02}), \ -// ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(120, 0x29), \ -// } +/* +#define ESP_PANEL_LCD_VENDOR_INIT_CMD() \ + { \ + {0xFF, (uint8_t []){0x77, 0x01, 0x00, 0x00, 0x10}, 5, 0}, \ + {0xC0, (uint8_t []){0x3B, 0x00}, 2, 0}, \ + {0xC1, (uint8_t []){0x0D, 0x02}, 2, 0}, \ + {0x29, (uint8_t []){0x00}, 0, 120}, \ + or \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xFF, {0x77, 0x01, 0x00, 0x00, 0x10}), \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC0, {0x3B, 0x00}), \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC1, {0x0D, 0x02}), \ + ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(120, 0x29), \ + } +*/ /* LCD Color Settings */ /* LCD color depth in bits */ @@ -379,7 +381,7 @@ */ #define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MAJOR 0 #define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MINOR 2 -#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_PATCH 2 +#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_PATCH 3 #endif /* ESP_PANEL_USE_CUSTOM_BOARD */ diff --git a/ESP_Panel_Board_Supported.h b/ESP_Panel_Board_Supported.h index 4c58e5a4..603e59bd 100644 --- a/ESP_Panel_Board_Supported.h +++ b/ESP_Panel_Board_Supported.h @@ -26,9 +26,9 @@ * - BOARD_ESP32_S3_BOX_LITE (ESP32-S3-Box-Lite): https://github.com/espressif/esp-box/tree/master * - BOARD_ESP32_S3_EYE (ESP32-S3-EYE): https://github.com/espressif/esp-who/blob/master/docs/en/get-started/ESP32-S3-EYE_Getting_Started_Guide.md * - BOARD_ESP32_S3_KORVO_2 (ESP32-S3-Korvo-2): https://docs.espressif.com/projects/esp-adf/en/latest/design-guide/dev-boards/user-guide-esp32-s3-korvo-2.html - * - BOARD_ESP32_S3_LCD_EV_BOARD (ESP32-S3-LCD-EV-Board): https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32s3/esp32-s3-lcd-ev-board/user_guide_v1.4.html + * - BOARD_ESP32_S3_LCD_EV_BOARD (ESP32-S3-LCD-EV-Board(v1.1-v1.4)): https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32s3/esp32-s3-lcd-ev-board/user_guide_v1.4.html * - BOARD_ESP32_S3_LCD_EV_BOARD_V1_5 (ESP32-S3-LCD-EV-Board(v1.5)): https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32s3/esp32-s3-lcd-ev-board/user_guide.html - * - BOARD_ESP32_S3_LCD_EV_BOARD_2 (ESP32-S3-LCD-EV-Board-2)): https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32s3/esp32-s3-lcd-ev-board/user_guide_v1.4.html + * - BOARD_ESP32_S3_LCD_EV_BOARD_2 (ESP32-S3-LCD-EV-Board-2(v1.1-v1.4))): https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32s3/esp32-s3-lcd-ev-board/user_guide_v1.4.html * - BOARD_ESP32_S3_LCD_EV_BOARD_2_V1_5 (ESP32-S3-LCD-EV-Board-2(v1.5)): https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32s3/esp32-s3-lcd-ev-board/user_guide.html * - BOARD_ESP32_S3_USB_OTG (ESP32-S3-USB-OTG): https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32s3/esp32-s3-usb-otg/index.html * @@ -56,9 +56,9 @@ /* * M5Stack (https://m5stack.com/): * - * - BOARD_M5STACK_M5CORE2 (M5STACK_M5CORE2): https://docs.m5stack.com/zh_CN/core/core2 - * - BOARD_M5STACK_M5DIAL (M5STACK_M5DIAL): https://docs.m5stack.com/zh_CN/core/M5Dial - * - BOARD_M5STACK_M5CORES3 (M5STACK_M5CORES3): https://docs.m5stack.com/zh_CN/core/CoreS3 + * - BOARD_M5STACK_M5CORE2 (M5STACK_M5CORE2): https://docs.m5stack.com/en/core/core2 + * - BOARD_M5STACK_M5DIAL (M5STACK_M5DIAL): https://docs.m5stack.com/en/core/M5Dial + * - BOARD_M5STACK_M5CORES3 (M5STACK_M5CORES3): https://docs.m5stack.com/en/core/CoreS3 */ // #define BOARD_M5STACK_M5CORE2 // #define BOARD_M5STACK_M5DIAL @@ -102,6 +102,6 @@ */ #define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MAJOR 0 #define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MINOR 5 -#define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_PATCH 0 +#define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_PATCH 1 #endif diff --git a/Kconfig b/Kconfig new file mode 100644 index 00000000..845625b3 --- /dev/null +++ b/Kconfig @@ -0,0 +1,26 @@ +menu "ESP Panel Configurations" + config ESP_PANEL_CONF_FILE_SKIP + bool "Unckeck this to ignore `ESP_Panel_Conf.h`" + default y + + config ESP_PANEL_BOARD_FILE_SKIP + bool "Unckeck this to ignore `ESP_Panel_Board_*.h`" + default y + + config ESP_PANEL_CHECK_RESULT_ASSERT + bool "Assert on error" + default n + help + If enabled, the driver will assert on error. Otherwise, the driver will return error code on error. + + config ESP_PANEL_ENABLE_LOG + bool "Enable output debug log" + default n + help + If enabled, the driver will output log for debugging. + + orsource "./src/touch/Kconfig.touch" + + orsource "./src/board/Kconfig.board" + +endmenu diff --git a/README.md b/README.md index 68585eab..5d3f6015 100644 --- a/README.md +++ b/README.md @@ -217,7 +217,7 @@ Here is a snippet of the modified `ESP_Panel_Board_Custom.h` file: * * There are two formats for the sequence code: * 1. Raw data: {command, (uint8_t []){ data0, data1, ... }, data_size, delay_ms} - * 2. Formater: ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(delay_ms, command, { data0, data1, ... }) and + * 2. Formatter: ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(delay_ms, command, { data0, data1, ... }) and * ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(delay_ms, command) */ #define ESP_PANEL_LCD_VENDOR_INIT_CMD() \ diff --git a/README_CN.md b/README_CN.md index d88e6f9a..ba8cf910 100644 --- a/README_CN.md +++ b/README_CN.md @@ -217,7 +217,7 @@ ESP32_Display_Panel 会根据 [ESP_Panel_Board_Custom.h](./ESP_Panel_Board_Custo * * There are two formats for the sequence code: * 1. Raw data: {command, (uint8_t []){ data0, data1, ... }, data_size, delay_ms} - * 2. Formater: ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(delay_ms, command, { data0, data1, ... }) and + * 2. Formatter: ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(delay_ms, command, { data0, data1, ... }) and * ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(delay_ms, command) */ #define ESP_PANEL_LCD_VENDOR_INIT_CMD() \ @@ -428,17 +428,17 @@ arduino-esp32 v3.x.x 版本的 SDK 位于默认安装路径下的 `tools > esp32 - **Step1**:从 [arduino-esp32-sdk](https://github.com/esp-arduino-libs/arduino-esp32-sdk) 下载 "high_perf" 版本的 SDK,并将其替换到 [arduino-esp32 的安装目录](#arduino-eps32-的安装目录以及-sdk-的目录在哪儿)中。 - - **Step2**:如果您使用的是支持的开发板,则通常无需修改代码,因为它们默认设置了 `ESP_PANEL_LCD_RGB_BOUNCE_BUF_SIZE` 为 `(ESP_PANEL_LCD_WIDTH * 10)`。如果问题仍然存在,请参考下面的示例代码来增大 `Bounce Bufer` 的大小。 + - **Step2**:如果您使用的是支持的开发板,则通常无需修改代码,因为它们默认设置了 `ESP_PANEL_LCD_RGB_BOUNCE_BUF_SIZE` 为 `(ESP_PANEL_LCD_WIDTH * 10)`。如果问题仍然存在,请参考下面的示例代码来增大 `Bounce Buffer` 的大小。 - - **Step3**:如果您使用的是自定义的开发板,请在 `ESP_Panel_Board_Custom.h` 文件中确认 `ESP_PANEL_LCD_RGB_BOUNCE_BUF_SIZE` 是否设置为非 0。如果问题仍然存在,请增大 `Bounce Bufer` 的大小。 + - **Step3**:如果您使用的是自定义的开发板,请在 `ESP_Panel_Board_Custom.h` 文件中确认 `ESP_PANEL_LCD_RGB_BOUNCE_BUF_SIZE` 是否设置为非 0。如果问题仍然存在,请增大 `Bounce Buffer` 的大小。 - - **Step4**:如果您使用的是独立的驱动,请参考下面的示例代码来设置 `Bounce Bufer` 的大小。 + - **Step4**:如果您使用的是独立的驱动,请参考下面的示例代码来设置 `Bounce Buffer` 的大小。 - **Step5**:如果您正在开发 LVGL 应用,将执行 RGB 外设初始化的任务与执行 LVGL lv_timer_handler() 的任务分配在同一个核上,请参考 [代码](./examples/LVGL/v8/Porting/lvgl_port_v8.h#L53)。 -3. **示例代码**:以下示例代码展示了如何通过 `ESP_Panel` 驱动或独立的驱动来修改 `Bounce Bufer` 的大小: +3. **示例代码**:以下示例代码展示了如何通过 `ESP_Panel` 驱动或独立的驱动来修改 `Bounce Buffer` 的大小: - **Example1**:使用 `ESP_Panel` 驱动修改 `Bounce Bufer` 大小: + **Example1**:使用 `ESP_Panel` 驱动修改 `Bounce Buffer` 大小: ```c ... @@ -453,7 +453,7 @@ arduino-esp32 v3.x.x 版本的 SDK 位于默认安装路径下的 `tools > esp32 ... ``` - **Example2**:使用独立的驱动修改 `Bounce Bufer` 大小: + **Example2**:使用独立的驱动修改 `Bounce Buffer` 大小: ```c ... diff --git a/conftest.py b/conftest.py new file mode 100644 index 00000000..8e415863 --- /dev/null +++ b/conftest.py @@ -0,0 +1,217 @@ +# SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD +# +# SPDX-License-Identifier: Apache-2.0 + +import logging +import os +import pathlib +import re +import sys +from datetime import datetime +from typing import Callable, List, Optional, Tuple + +import pytest +from pytest import Config, FixtureRequest, Function, Session +from pytest_embedded.plugin import multi_dut_argument, multi_dut_fixture + +IDF_VERSION = os.environ.get('IDF_VERSION') +PYTEST_ROOT_DIR = str(pathlib.Path(__file__).parent) +logging.info(f'Pytest root dir: {PYTEST_ROOT_DIR}') + + +@pytest.fixture(scope='session', autouse=True) +def idf_version() -> str: + if os.environ.get('IDF_VERSION'): + return os.environ.get('IDF_VERSION') + idf_path = os.environ.get('IDF_PATH') + if not idf_path: + logging.warning('Failed to get IDF_VERSION!') + return '' + version_path = os.path.join(os.environ['IDF_PATH'], 'tools/cmake/version.cmake') + regex = re.compile(r'^\s*set\s*\(\s*IDF_VERSION_([A-Z]{5})\s+(\d+)') + ver = {} + with open(version_path) as f: + for line in f: + m = regex.match(line) + if m: + ver[m.group(1)] = m.group(2) + return '{}.{}'.format(int(ver['MAJOR']), int(ver['MINOR'])) + + +@pytest.fixture(scope='session', autouse=True) +def session_tempdir() -> str: + _tmpdir = os.path.join( + os.path.dirname(__file__), + 'pytest_log', + datetime.now().strftime('%Y-%m-%d_%H-%M-%S'), + ) + os.makedirs(_tmpdir, exist_ok=True) + return _tmpdir + + +@pytest.fixture +@multi_dut_argument +def config(request: FixtureRequest) -> str: + config_marker = list(request.node.iter_markers(name='config')) + return config_marker[0].args[0] if config_marker else 'defaults' + + +@pytest.fixture +@multi_dut_argument +def app_path(request: FixtureRequest, test_file_path: str) -> str: + config_marker = list(request.node.iter_markers(name='app_path')) + if config_marker: + return config_marker[0].args[0] + else: + # compatible with old pytest-embedded parametrize --app_path + return request.config.getoption('app_path', None) or os.path.dirname(test_file_path) + + +@pytest.fixture +def test_case_name(request: FixtureRequest, target: str, config: str) -> str: + if not isinstance(target, str): + target = '|'.join(sorted(list(set(target)))) + if not isinstance(config, str): + config = '|'.join(sorted(list(config))) + return f'{target}.{config}.{request.node.originalname}' + + +@pytest.fixture +@multi_dut_fixture +def build_dir( + app_path: str, + target: Optional[str], + config: Optional[str], + idf_version: str +) -> Optional[str]: + """ + Check local build dir with the following priority: + + 1. /${IDF_VERSION}/build__ + 2. /${IDF_VERSION}/build_ + 3. /build__ + 4. /build + 5. + + Args: + app_path: app path + target: target + config: config + + Returns: + valid build directory + """ + + assert target + assert config + check_dirs = [] + if idf_version: + check_dirs.append(os.path.join(idf_version, f'build_{target}_{config}')) + check_dirs.append(os.path.join(idf_version, f'build_{target}')) + check_dirs.append(f'build_{target}_{config}') + check_dirs.append('build') + check_dirs.append('.') + for check_dir in check_dirs: + binary_path = os.path.join(app_path, check_dir) + if os.path.isdir(binary_path): + logging.info(f'find valid binary path: {binary_path}') + return check_dir + + logging.warning( + f'checking binary path: {binary_path} ... missing ... try another place') + + logging.error( + f'no build dir. Please build the binary "python .gitlab/tools/build_apps.py {app_path}" and run pytest again') + sys.exit(1) + + +@pytest.fixture(autouse=True) +@multi_dut_fixture +def junit_properties( + test_case_name: str, record_xml_attribute: Callable[[str, object], None] +) -> None: + """ + This fixture is autoused and will modify the junit report test case name to .. + """ + record_xml_attribute('name', test_case_name) + + +################## +# Hook functions # +################## +_idf_pytest_embedded_key = pytest.StashKey['IdfPytestEmbedded'] + + +def pytest_addoption(parser: pytest.Parser) -> None: + base_group = parser.getgroup('idf') + base_group.addoption( + '--env', + help='only run tests matching the environment NAME.', + ) + + +def pytest_configure(config: Config) -> None: + # Require cli option "--target" + help_commands = ['--help', '--fixtures', '--markers', '--version'] + for cmd in help_commands: + if cmd in config.invocation_params.args: + target = 'unneeded' + break + else: + target = config.getoption('target') + if not target: + raise ValueError('Please specify one target marker via "--target [TARGET]"') + + config.stash[_idf_pytest_embedded_key] = IdfPytestEmbedded( + target=target, + env_name=config.getoption('env'), + ) + config.pluginmanager.register(config.stash[_idf_pytest_embedded_key]) + + +def pytest_unconfigure(config: Config) -> None: + _pytest_embedded = config.stash.get(_idf_pytest_embedded_key, None) + if _pytest_embedded: + del config.stash[_idf_pytest_embedded_key] + config.pluginmanager.unregister(_pytest_embedded) + + +class IdfPytestEmbedded: + def __init__( + self, + target: Optional[str] = None, + env_name: Optional[str] = None, + ): + # CLI options to filter the test cases + self.target = target + self.env_name = env_name + + self._failed_cases: List[ + Tuple[str, bool, bool] + ] = [] # (test_case_name, is_known_failure_cases, is_xfail) + + @pytest.hookimpl(tryfirst=True) + def pytest_sessionstart(self, session: Session) -> None: + if self.target: + self.target = self.target.lower() + session.config.option.target = self.target + + # @pytest.hookimpl(tryfirst=True) + def pytest_collection_modifyitems(self, items: List[Function]) -> None: + # set default timeout 10 minutes for each case + for item in items: + # default timeout 5 mins + if 'timeout' not in item.keywords: + item.add_marker(pytest.mark.timeout(5 * 60)) + + # filter all the test cases with "--target" + if self.target: + def item_targets(item): + return [m.args[0] for m in item.iter_markers(name='target')] + items[:] = [item for item in items if self.target in item_targets(item)] + + # filter all the test cases with "--env" + if self.env_name: + def item_envs(item): + return [m.args[0] for m in item.iter_markers(name='env')] + items[:] = [item for item in items if self.env_name in item_envs(item)] diff --git a/examples/LCD/3wireSPI_RGB/3wireSPI_RGB.ino b/examples/LCD/3wireSPI_RGB/3wireSPI_RGB.ino index d3ef2ea2..d90f64ed 100644 --- a/examples/LCD/3wireSPI_RGB/3wireSPI_RGB.ino +++ b/examples/LCD/3wireSPI_RGB/3wireSPI_RGB.ino @@ -77,7 +77,7 @@ * * There are two formats for the sequence code: * 1. Raw data: {command, (uint8_t []){ data0, data1, ... }, data_size, delay_ms} - * 2. Formater: ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(delay_ms, command, { data0, data1, ... }) and + * 2. Formatter: ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(delay_ms, command, { data0, data1, ... }) and * ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(delay_ms, command) */ const esp_lcd_panel_vendor_init_cmd_t lcd_init_cmd[] = { @@ -214,10 +214,18 @@ void setup() // Configure external initialization commands, should called before `init()` lcd->configVendorCommands(lcd_init_cmd, sizeof(lcd_init_cmd)/sizeof(lcd_init_cmd[0])); #endif + // lcd->configAutoReleaseBus(true); // If the "3-wire SPI" interface are sharing pins of the "RGB" interface to + // save GPIOs, please enable this function to release the bus object and pins + // (except CS signal). And then, the "3-wire SPI" interface cannot be used to + // transmit commands any more. + // lcd->configMirrorByCommand(true); // This function is conflict with `configAutoReleaseBus(true)`, please don't + // enable them at the same time lcd->init(); - lcd->reset(); + lcd->reset(); // If the `configAutoReleaseBus(true)` is called, here should not call `reset()` + // to deinit the LCD device lcd->begin(); - lcd->displayOn(); + lcd->displayOn(); // This function is conflict with `configAutoReleaseBus(true)`, please don't + // enable them at the same time #if EXAMPLE_ENABLE_PRINT_LCD_FPS lcd->attachRefreshFinishCallback(onVsyncEndCallback, nullptr); #endif diff --git a/examples/LCD/QSPI/QSPI.ino b/examples/LCD/QSPI/QSPI.ino index 40a8b9ec..e242bcb7 100644 --- a/examples/LCD/QSPI/QSPI.ino +++ b/examples/LCD/QSPI/QSPI.ino @@ -84,7 +84,7 @@ * * There are two formats for the sequence code: * 1. Raw data: {command, (uint8_t []){ data0, data1, ... }, data_size, delay_ms} - * 2. Formater: ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(delay_ms, command, { data0, data1, ... }) and + * 2. Formatter: ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(delay_ms, command, { data0, data1, ... }) and * ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(delay_ms, command) */ const esp_lcd_panel_vendor_init_cmd_t lcd_init_cmd[] = { diff --git a/examples/LCD/SPI/SPI.ino b/examples/LCD/SPI/SPI.ino index 91582307..36463a56 100644 --- a/examples/LCD/SPI/SPI.ino +++ b/examples/LCD/SPI/SPI.ino @@ -86,7 +86,7 @@ * * There are two formats for the sequence code: * 1. Raw data: {command, (uint8_t []){ data0, data1, ... }, data_size, delay_ms} - * 2. Formater: ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(delay_ms, command, { data0, data1, ... }) and + * 2. Formatter: ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(delay_ms, command, { data0, data1, ... }) and * ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(delay_ms, command) */ const esp_lcd_panel_vendor_init_cmd_t lcd_init_cmd[] = { @@ -113,7 +113,6 @@ const esp_lcd_panel_vendor_init_cmd_t lcd_init_cmd[] = { #define EXAMPLE_LCD_PIN_NUM_RST (-1) // Set to -1 if not used #define EXAMPLE_LCD_PIN_NUM_BK_LIGHT (45) // Set to -1 if not used #define EXAMPLE_LCD_BK_LIGHT_ON_LEVEL (1) - #define EXAMPLE_LCD_BK_LIGHT_OFF_LEVEL !EXAMPLE_LCD_BK_LIGHT_ON_LEVEL /* Enable or disable the attachment of a callback function that is called after each bitmap drawing is completed */ diff --git a/examples/LVGL/v8/Porting/ESP_Panel_Board_Custom.h b/examples/LVGL/v8/Porting/ESP_Panel_Board_Custom.h index 5ed0f923..3ae31b50 100644 --- a/examples/LVGL/v8/Porting/ESP_Panel_Board_Custom.h +++ b/examples/LVGL/v8/Porting/ESP_Panel_Board_Custom.h @@ -173,21 +173,23 @@ * * There are two formats for the sequence code: * 1. Raw data: {command, (uint8_t []){ data0, data1, ... }, data_size, delay_ms} - * 2. Formater: ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(delay_ms, command, { data0, data1, ... }) and + * 2. Formatter: ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(delay_ms, command, { data0, data1, ... }) and * ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(delay_ms, command) */ -// #define ESP_PANEL_LCD_VENDOR_INIT_CMD() \ -// { \ -// {0xFF, (uint8_t []){0x77, 0x01, 0x00, 0x00, 0x10}, 5, 0}, \ -// {0xC0, (uint8_t []){0x3B, 0x00}, 2, 0}, \ -// {0xC1, (uint8_t []){0x0D, 0x02}, 2, 0}, \ -// {0x29, (uint8_t []){0x00}, 0, 120}, \ -// or \ -// ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xFF, {0x77, 0x01, 0x00, 0x00, 0x10}), \ -// ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC0, {0x3B, 0x00}), \ -// ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC1, {0x0D, 0x02}), \ -// ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(120, 0x29), \ -// } +/* +#define ESP_PANEL_LCD_VENDOR_INIT_CMD() \ + { \ + {0xFF, (uint8_t []){0x77, 0x01, 0x00, 0x00, 0x10}, 5, 0}, \ + {0xC0, (uint8_t []){0x3B, 0x00}, 2, 0}, \ + {0xC1, (uint8_t []){0x0D, 0x02}, 2, 0}, \ + {0x29, (uint8_t []){0x00}, 0, 120}, \ + or \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xFF, {0x77, 0x01, 0x00, 0x00, 0x10}), \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC0, {0x3B, 0x00}), \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC1, {0x0D, 0x02}), \ + ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(120, 0x29), \ + } +*/ /* LCD Color Settings */ /* LCD color depth in bits */ @@ -379,7 +381,7 @@ */ #define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MAJOR 0 #define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MINOR 2 -#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_PATCH 2 +#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_PATCH 3 #endif /* ESP_PANEL_USE_CUSTOM_BOARD */ diff --git a/examples/LVGL/v8/Porting/ESP_Panel_Board_Supported.h b/examples/LVGL/v8/Porting/ESP_Panel_Board_Supported.h index 4c58e5a4..603e59bd 100644 --- a/examples/LVGL/v8/Porting/ESP_Panel_Board_Supported.h +++ b/examples/LVGL/v8/Porting/ESP_Panel_Board_Supported.h @@ -26,9 +26,9 @@ * - BOARD_ESP32_S3_BOX_LITE (ESP32-S3-Box-Lite): https://github.com/espressif/esp-box/tree/master * - BOARD_ESP32_S3_EYE (ESP32-S3-EYE): https://github.com/espressif/esp-who/blob/master/docs/en/get-started/ESP32-S3-EYE_Getting_Started_Guide.md * - BOARD_ESP32_S3_KORVO_2 (ESP32-S3-Korvo-2): https://docs.espressif.com/projects/esp-adf/en/latest/design-guide/dev-boards/user-guide-esp32-s3-korvo-2.html - * - BOARD_ESP32_S3_LCD_EV_BOARD (ESP32-S3-LCD-EV-Board): https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32s3/esp32-s3-lcd-ev-board/user_guide_v1.4.html + * - BOARD_ESP32_S3_LCD_EV_BOARD (ESP32-S3-LCD-EV-Board(v1.1-v1.4)): https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32s3/esp32-s3-lcd-ev-board/user_guide_v1.4.html * - BOARD_ESP32_S3_LCD_EV_BOARD_V1_5 (ESP32-S3-LCD-EV-Board(v1.5)): https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32s3/esp32-s3-lcd-ev-board/user_guide.html - * - BOARD_ESP32_S3_LCD_EV_BOARD_2 (ESP32-S3-LCD-EV-Board-2)): https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32s3/esp32-s3-lcd-ev-board/user_guide_v1.4.html + * - BOARD_ESP32_S3_LCD_EV_BOARD_2 (ESP32-S3-LCD-EV-Board-2(v1.1-v1.4))): https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32s3/esp32-s3-lcd-ev-board/user_guide_v1.4.html * - BOARD_ESP32_S3_LCD_EV_BOARD_2_V1_5 (ESP32-S3-LCD-EV-Board-2(v1.5)): https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32s3/esp32-s3-lcd-ev-board/user_guide.html * - BOARD_ESP32_S3_USB_OTG (ESP32-S3-USB-OTG): https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32s3/esp32-s3-usb-otg/index.html * @@ -56,9 +56,9 @@ /* * M5Stack (https://m5stack.com/): * - * - BOARD_M5STACK_M5CORE2 (M5STACK_M5CORE2): https://docs.m5stack.com/zh_CN/core/core2 - * - BOARD_M5STACK_M5DIAL (M5STACK_M5DIAL): https://docs.m5stack.com/zh_CN/core/M5Dial - * - BOARD_M5STACK_M5CORES3 (M5STACK_M5CORES3): https://docs.m5stack.com/zh_CN/core/CoreS3 + * - BOARD_M5STACK_M5CORE2 (M5STACK_M5CORE2): https://docs.m5stack.com/en/core/core2 + * - BOARD_M5STACK_M5DIAL (M5STACK_M5DIAL): https://docs.m5stack.com/en/core/M5Dial + * - BOARD_M5STACK_M5CORES3 (M5STACK_M5CORES3): https://docs.m5stack.com/en/core/CoreS3 */ // #define BOARD_M5STACK_M5CORE2 // #define BOARD_M5STACK_M5DIAL @@ -102,6 +102,6 @@ */ #define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MAJOR 0 #define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MINOR 5 -#define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_PATCH 0 +#define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_PATCH 1 #endif diff --git a/examples/LVGL/v8/Porting/lvgl_port_v8.cpp b/examples/LVGL/v8/Porting/lvgl_port_v8.cpp index 08cc35ab..cfd9f29d 100644 --- a/examples/LVGL/v8/Porting/lvgl_port_v8.cpp +++ b/examples/LVGL/v8/Porting/lvgl_port_v8.cpp @@ -198,7 +198,7 @@ static void flush_callback(lv_disp_drv_t *drv, const lv_area_t *area, lv_color_t /* Reset flag */ drv->full_refresh = 0; - // Roate and copy data from the whole screen LVGL's buffer to the next frame buffer + // Rotate and copy data from the whole screen LVGL's buffer to the next frame buffer next_fb = flush_get_next_buf(lcd); rotate_copy_pixel((lv_color_t *)color_map, (lv_color_t *)next_fb, offsetx1, offsety1, offsetx2, offsety2, LV_HOR_RES, LV_VER_RES, LVGL_PORT_ROTATION_DEGREE); diff --git a/examples/LVGL/v8/Porting/lvgl_port_v8.h b/examples/LVGL/v8/Porting/lvgl_port_v8.h index 41014e0a..c7b7cdf2 100644 --- a/examples/LVGL/v8/Porting/lvgl_port_v8.h +++ b/examples/LVGL/v8/Porting/lvgl_port_v8.h @@ -83,7 +83,7 @@ #define LVGL_PORT_RGB_BOUNCE_BUFFER_SIZE (LVGL_PORT_DISP_WIDTH * 10) /** * When avoid tearing is enabled, the LVGL software rotation `lv_disp_set_rotation()` is not supported. - * But users can set the rotation degree(0/90/180/270) here, but this funciton will extremely reduce FPS. + * But users can set the rotation degree(0/90/180/270) here, but this function will extremely reduce FPS. * So it is recommended to be used when using a low resolution display. * * Set the rotation degree: @@ -151,7 +151,7 @@ bool lvgl_port_init(ESP_PanelLcd *lcd, ESP_PanelTouch *tp); * * @param timeout_ms The timeout of the mutex lock, in milliseconds. If the timeout is set to `-1`, it will wait indefinitely. * - * @return ture if success, otherwise false + * @return true if success, otherwise false */ bool lvgl_port_lock(int timeout_ms); @@ -159,7 +159,7 @@ bool lvgl_port_lock(int timeout_ms); * @brief Unlock the LVGL mutex. This function should be called after using LVGL APIs when not in LVGL task, and the * `lvgl_port_lock()` function should be called before. * - * @return ture if success, otherwise false + * @return true if success, otherwise false */ bool lvgl_port_unlock(void); diff --git a/examples/LVGL/v8/Rotation/ESP_Panel_Board_Custom.h b/examples/LVGL/v8/Rotation/ESP_Panel_Board_Custom.h index 5ed0f923..3ae31b50 100644 --- a/examples/LVGL/v8/Rotation/ESP_Panel_Board_Custom.h +++ b/examples/LVGL/v8/Rotation/ESP_Panel_Board_Custom.h @@ -173,21 +173,23 @@ * * There are two formats for the sequence code: * 1. Raw data: {command, (uint8_t []){ data0, data1, ... }, data_size, delay_ms} - * 2. Formater: ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(delay_ms, command, { data0, data1, ... }) and + * 2. Formatter: ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(delay_ms, command, { data0, data1, ... }) and * ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(delay_ms, command) */ -// #define ESP_PANEL_LCD_VENDOR_INIT_CMD() \ -// { \ -// {0xFF, (uint8_t []){0x77, 0x01, 0x00, 0x00, 0x10}, 5, 0}, \ -// {0xC0, (uint8_t []){0x3B, 0x00}, 2, 0}, \ -// {0xC1, (uint8_t []){0x0D, 0x02}, 2, 0}, \ -// {0x29, (uint8_t []){0x00}, 0, 120}, \ -// or \ -// ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xFF, {0x77, 0x01, 0x00, 0x00, 0x10}), \ -// ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC0, {0x3B, 0x00}), \ -// ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC1, {0x0D, 0x02}), \ -// ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(120, 0x29), \ -// } +/* +#define ESP_PANEL_LCD_VENDOR_INIT_CMD() \ + { \ + {0xFF, (uint8_t []){0x77, 0x01, 0x00, 0x00, 0x10}, 5, 0}, \ + {0xC0, (uint8_t []){0x3B, 0x00}, 2, 0}, \ + {0xC1, (uint8_t []){0x0D, 0x02}, 2, 0}, \ + {0x29, (uint8_t []){0x00}, 0, 120}, \ + or \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xFF, {0x77, 0x01, 0x00, 0x00, 0x10}), \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC0, {0x3B, 0x00}), \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC1, {0x0D, 0x02}), \ + ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(120, 0x29), \ + } +*/ /* LCD Color Settings */ /* LCD color depth in bits */ @@ -379,7 +381,7 @@ */ #define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MAJOR 0 #define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MINOR 2 -#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_PATCH 2 +#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_PATCH 3 #endif /* ESP_PANEL_USE_CUSTOM_BOARD */ diff --git a/examples/LVGL/v8/Rotation/ESP_Panel_Board_Supported.h b/examples/LVGL/v8/Rotation/ESP_Panel_Board_Supported.h index 4c58e5a4..603e59bd 100644 --- a/examples/LVGL/v8/Rotation/ESP_Panel_Board_Supported.h +++ b/examples/LVGL/v8/Rotation/ESP_Panel_Board_Supported.h @@ -26,9 +26,9 @@ * - BOARD_ESP32_S3_BOX_LITE (ESP32-S3-Box-Lite): https://github.com/espressif/esp-box/tree/master * - BOARD_ESP32_S3_EYE (ESP32-S3-EYE): https://github.com/espressif/esp-who/blob/master/docs/en/get-started/ESP32-S3-EYE_Getting_Started_Guide.md * - BOARD_ESP32_S3_KORVO_2 (ESP32-S3-Korvo-2): https://docs.espressif.com/projects/esp-adf/en/latest/design-guide/dev-boards/user-guide-esp32-s3-korvo-2.html - * - BOARD_ESP32_S3_LCD_EV_BOARD (ESP32-S3-LCD-EV-Board): https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32s3/esp32-s3-lcd-ev-board/user_guide_v1.4.html + * - BOARD_ESP32_S3_LCD_EV_BOARD (ESP32-S3-LCD-EV-Board(v1.1-v1.4)): https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32s3/esp32-s3-lcd-ev-board/user_guide_v1.4.html * - BOARD_ESP32_S3_LCD_EV_BOARD_V1_5 (ESP32-S3-LCD-EV-Board(v1.5)): https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32s3/esp32-s3-lcd-ev-board/user_guide.html - * - BOARD_ESP32_S3_LCD_EV_BOARD_2 (ESP32-S3-LCD-EV-Board-2)): https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32s3/esp32-s3-lcd-ev-board/user_guide_v1.4.html + * - BOARD_ESP32_S3_LCD_EV_BOARD_2 (ESP32-S3-LCD-EV-Board-2(v1.1-v1.4))): https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32s3/esp32-s3-lcd-ev-board/user_guide_v1.4.html * - BOARD_ESP32_S3_LCD_EV_BOARD_2_V1_5 (ESP32-S3-LCD-EV-Board-2(v1.5)): https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32s3/esp32-s3-lcd-ev-board/user_guide.html * - BOARD_ESP32_S3_USB_OTG (ESP32-S3-USB-OTG): https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32s3/esp32-s3-usb-otg/index.html * @@ -56,9 +56,9 @@ /* * M5Stack (https://m5stack.com/): * - * - BOARD_M5STACK_M5CORE2 (M5STACK_M5CORE2): https://docs.m5stack.com/zh_CN/core/core2 - * - BOARD_M5STACK_M5DIAL (M5STACK_M5DIAL): https://docs.m5stack.com/zh_CN/core/M5Dial - * - BOARD_M5STACK_M5CORES3 (M5STACK_M5CORES3): https://docs.m5stack.com/zh_CN/core/CoreS3 + * - BOARD_M5STACK_M5CORE2 (M5STACK_M5CORE2): https://docs.m5stack.com/en/core/core2 + * - BOARD_M5STACK_M5DIAL (M5STACK_M5DIAL): https://docs.m5stack.com/en/core/M5Dial + * - BOARD_M5STACK_M5CORES3 (M5STACK_M5CORES3): https://docs.m5stack.com/en/core/CoreS3 */ // #define BOARD_M5STACK_M5CORE2 // #define BOARD_M5STACK_M5DIAL @@ -102,6 +102,6 @@ */ #define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MAJOR 0 #define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MINOR 5 -#define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_PATCH 0 +#define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_PATCH 1 #endif diff --git a/examples/LVGL/v8/Rotation/lvgl_port_v8.cpp b/examples/LVGL/v8/Rotation/lvgl_port_v8.cpp index 08cc35ab..cfd9f29d 100644 --- a/examples/LVGL/v8/Rotation/lvgl_port_v8.cpp +++ b/examples/LVGL/v8/Rotation/lvgl_port_v8.cpp @@ -198,7 +198,7 @@ static void flush_callback(lv_disp_drv_t *drv, const lv_area_t *area, lv_color_t /* Reset flag */ drv->full_refresh = 0; - // Roate and copy data from the whole screen LVGL's buffer to the next frame buffer + // Rotate and copy data from the whole screen LVGL's buffer to the next frame buffer next_fb = flush_get_next_buf(lcd); rotate_copy_pixel((lv_color_t *)color_map, (lv_color_t *)next_fb, offsetx1, offsety1, offsetx2, offsety2, LV_HOR_RES, LV_VER_RES, LVGL_PORT_ROTATION_DEGREE); diff --git a/examples/LVGL/v8/Rotation/lvgl_port_v8.h b/examples/LVGL/v8/Rotation/lvgl_port_v8.h index 41014e0a..c7b7cdf2 100644 --- a/examples/LVGL/v8/Rotation/lvgl_port_v8.h +++ b/examples/LVGL/v8/Rotation/lvgl_port_v8.h @@ -83,7 +83,7 @@ #define LVGL_PORT_RGB_BOUNCE_BUFFER_SIZE (LVGL_PORT_DISP_WIDTH * 10) /** * When avoid tearing is enabled, the LVGL software rotation `lv_disp_set_rotation()` is not supported. - * But users can set the rotation degree(0/90/180/270) here, but this funciton will extremely reduce FPS. + * But users can set the rotation degree(0/90/180/270) here, but this function will extremely reduce FPS. * So it is recommended to be used when using a low resolution display. * * Set the rotation degree: @@ -151,7 +151,7 @@ bool lvgl_port_init(ESP_PanelLcd *lcd, ESP_PanelTouch *tp); * * @param timeout_ms The timeout of the mutex lock, in milliseconds. If the timeout is set to `-1`, it will wait indefinitely. * - * @return ture if success, otherwise false + * @return true if success, otherwise false */ bool lvgl_port_lock(int timeout_ms); @@ -159,7 +159,7 @@ bool lvgl_port_lock(int timeout_ms); * @brief Unlock the LVGL mutex. This function should be called after using LVGL APIs when not in LVGL task, and the * `lvgl_port_lock()` function should be called before. * - * @return ture if success, otherwise false + * @return true if success, otherwise false */ bool lvgl_port_unlock(void); diff --git a/examples/Panel/PanelTest/ESP_Panel_Board_Custom.h b/examples/Panel/PanelTest/ESP_Panel_Board_Custom.h index 5ed0f923..3ae31b50 100644 --- a/examples/Panel/PanelTest/ESP_Panel_Board_Custom.h +++ b/examples/Panel/PanelTest/ESP_Panel_Board_Custom.h @@ -173,21 +173,23 @@ * * There are two formats for the sequence code: * 1. Raw data: {command, (uint8_t []){ data0, data1, ... }, data_size, delay_ms} - * 2. Formater: ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(delay_ms, command, { data0, data1, ... }) and + * 2. Formatter: ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(delay_ms, command, { data0, data1, ... }) and * ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(delay_ms, command) */ -// #define ESP_PANEL_LCD_VENDOR_INIT_CMD() \ -// { \ -// {0xFF, (uint8_t []){0x77, 0x01, 0x00, 0x00, 0x10}, 5, 0}, \ -// {0xC0, (uint8_t []){0x3B, 0x00}, 2, 0}, \ -// {0xC1, (uint8_t []){0x0D, 0x02}, 2, 0}, \ -// {0x29, (uint8_t []){0x00}, 0, 120}, \ -// or \ -// ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xFF, {0x77, 0x01, 0x00, 0x00, 0x10}), \ -// ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC0, {0x3B, 0x00}), \ -// ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC1, {0x0D, 0x02}), \ -// ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(120, 0x29), \ -// } +/* +#define ESP_PANEL_LCD_VENDOR_INIT_CMD() \ + { \ + {0xFF, (uint8_t []){0x77, 0x01, 0x00, 0x00, 0x10}, 5, 0}, \ + {0xC0, (uint8_t []){0x3B, 0x00}, 2, 0}, \ + {0xC1, (uint8_t []){0x0D, 0x02}, 2, 0}, \ + {0x29, (uint8_t []){0x00}, 0, 120}, \ + or \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xFF, {0x77, 0x01, 0x00, 0x00, 0x10}), \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC0, {0x3B, 0x00}), \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC1, {0x0D, 0x02}), \ + ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(120, 0x29), \ + } +*/ /* LCD Color Settings */ /* LCD color depth in bits */ @@ -379,7 +381,7 @@ */ #define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MAJOR 0 #define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MINOR 2 -#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_PATCH 2 +#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_PATCH 3 #endif /* ESP_PANEL_USE_CUSTOM_BOARD */ diff --git a/examples/Panel/PanelTest/ESP_Panel_Board_Supported.h b/examples/Panel/PanelTest/ESP_Panel_Board_Supported.h index 4c58e5a4..603e59bd 100644 --- a/examples/Panel/PanelTest/ESP_Panel_Board_Supported.h +++ b/examples/Panel/PanelTest/ESP_Panel_Board_Supported.h @@ -26,9 +26,9 @@ * - BOARD_ESP32_S3_BOX_LITE (ESP32-S3-Box-Lite): https://github.com/espressif/esp-box/tree/master * - BOARD_ESP32_S3_EYE (ESP32-S3-EYE): https://github.com/espressif/esp-who/blob/master/docs/en/get-started/ESP32-S3-EYE_Getting_Started_Guide.md * - BOARD_ESP32_S3_KORVO_2 (ESP32-S3-Korvo-2): https://docs.espressif.com/projects/esp-adf/en/latest/design-guide/dev-boards/user-guide-esp32-s3-korvo-2.html - * - BOARD_ESP32_S3_LCD_EV_BOARD (ESP32-S3-LCD-EV-Board): https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32s3/esp32-s3-lcd-ev-board/user_guide_v1.4.html + * - BOARD_ESP32_S3_LCD_EV_BOARD (ESP32-S3-LCD-EV-Board(v1.1-v1.4)): https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32s3/esp32-s3-lcd-ev-board/user_guide_v1.4.html * - BOARD_ESP32_S3_LCD_EV_BOARD_V1_5 (ESP32-S3-LCD-EV-Board(v1.5)): https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32s3/esp32-s3-lcd-ev-board/user_guide.html - * - BOARD_ESP32_S3_LCD_EV_BOARD_2 (ESP32-S3-LCD-EV-Board-2)): https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32s3/esp32-s3-lcd-ev-board/user_guide_v1.4.html + * - BOARD_ESP32_S3_LCD_EV_BOARD_2 (ESP32-S3-LCD-EV-Board-2(v1.1-v1.4))): https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32s3/esp32-s3-lcd-ev-board/user_guide_v1.4.html * - BOARD_ESP32_S3_LCD_EV_BOARD_2_V1_5 (ESP32-S3-LCD-EV-Board-2(v1.5)): https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32s3/esp32-s3-lcd-ev-board/user_guide.html * - BOARD_ESP32_S3_USB_OTG (ESP32-S3-USB-OTG): https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32s3/esp32-s3-usb-otg/index.html * @@ -56,9 +56,9 @@ /* * M5Stack (https://m5stack.com/): * - * - BOARD_M5STACK_M5CORE2 (M5STACK_M5CORE2): https://docs.m5stack.com/zh_CN/core/core2 - * - BOARD_M5STACK_M5DIAL (M5STACK_M5DIAL): https://docs.m5stack.com/zh_CN/core/M5Dial - * - BOARD_M5STACK_M5CORES3 (M5STACK_M5CORES3): https://docs.m5stack.com/zh_CN/core/CoreS3 + * - BOARD_M5STACK_M5CORE2 (M5STACK_M5CORE2): https://docs.m5stack.com/en/core/core2 + * - BOARD_M5STACK_M5DIAL (M5STACK_M5DIAL): https://docs.m5stack.com/en/core/M5Dial + * - BOARD_M5STACK_M5CORES3 (M5STACK_M5CORES3): https://docs.m5stack.com/en/core/CoreS3 */ // #define BOARD_M5STACK_M5CORE2 // #define BOARD_M5STACK_M5DIAL @@ -102,6 +102,6 @@ */ #define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MAJOR 0 #define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MINOR 5 -#define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_PATCH 0 +#define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_PATCH 1 #endif diff --git a/examples/Panel/PanelTest/PanelTest.ino b/examples/Panel/PanelTest/PanelTest.ino index 7c086272..97a2c202 100644 --- a/examples/Panel/PanelTest/PanelTest.ino +++ b/examples/Panel/PanelTest/PanelTest.ino @@ -61,7 +61,7 @@ IRAM_ATTR bool onRefreshFinishCallback(void *user_data) } #endif -#if EXAMPLE_TOUCH_ENABLE_ATTACH_CALLBACK +#if TEST_TOUCH_ENABLE_ATTACH_CALLBACK && (ESP_PANEL_TOUCH_IO_INT >= 0) IRAM_ATTR bool onTouchInterruptCallback(void *user_data) { esp_rom_printf("Touch interrupt callback\n"); @@ -107,15 +107,15 @@ void setup() backlight->on(); } - if (touch != nullptr) { + if ((touch != nullptr) && touch->isInterruptEnabled()) { #if EXAMPLE_TOUCH_ENABLE_ATTACH_CALLBACK - touch->attachInterruptCallback(onTouchInterruptCallback, NULL); + touch->attachInterruptCallback(onTouchInterruptCallback, NULL); #endif + Serial.println("Reading touch_device point..."); } else { Serial.println("Touch is not available"); + Serial.println("Panel test example end"); } - - Serial.println("Panel test example end"); } void loop() diff --git a/examples/PlatformIO/README.md b/examples/PlatformIO/README.md index fac6aa2a..ce780c1e 100644 --- a/examples/PlatformIO/README.md +++ b/examples/PlatformIO/README.md @@ -17,7 +17,7 @@ Follow the steps below to configure: 2. For **lvgl**: - Follow the [steps](../../README.md#configuring-lvgl) to add *lv_conf.h* file and change the configurations. - - Modify the macros in the [lvgl_port_v8.h](./lvgl_port_v8.h) file to configure the LVGL porting parameters. + - Modify the macros in the [lvgl_port_v8.h](./src/lvgl_port_v8.h) file to configure the LVGL porting parameters. 3. Navigate to the `Tools` menu in the Arduino IDE to choose a ESP board and configure its parameters. For supported boards, please refter to [Configuring Supported Development Boards](../../README.md#configuring-supported-development-boards) 4. Verify and upload the example to your ESP board. diff --git a/examples/PlatformIO/platformio.ini b/examples/PlatformIO/platformio.ini index 810db2cc..fd3b4b11 100644 --- a/examples/PlatformIO/platformio.ini +++ b/examples/PlatformIO/platformio.ini @@ -19,4 +19,3 @@ lib_deps = https://github.com/esp-arduino-libs/ESP32_Display_Panel.git https://github.com/esp-arduino-libs/ESP32_IO_Expander.git https://github.com/lvgl/lvgl.git#release/v8.3 - diff --git a/examples/PlatformIO/src/ESP_Panel_Board_Custom.h b/examples/PlatformIO/src/ESP_Panel_Board_Custom.h index 5ed0f923..3ae31b50 100644 --- a/examples/PlatformIO/src/ESP_Panel_Board_Custom.h +++ b/examples/PlatformIO/src/ESP_Panel_Board_Custom.h @@ -173,21 +173,23 @@ * * There are two formats for the sequence code: * 1. Raw data: {command, (uint8_t []){ data0, data1, ... }, data_size, delay_ms} - * 2. Formater: ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(delay_ms, command, { data0, data1, ... }) and + * 2. Formatter: ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(delay_ms, command, { data0, data1, ... }) and * ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(delay_ms, command) */ -// #define ESP_PANEL_LCD_VENDOR_INIT_CMD() \ -// { \ -// {0xFF, (uint8_t []){0x77, 0x01, 0x00, 0x00, 0x10}, 5, 0}, \ -// {0xC0, (uint8_t []){0x3B, 0x00}, 2, 0}, \ -// {0xC1, (uint8_t []){0x0D, 0x02}, 2, 0}, \ -// {0x29, (uint8_t []){0x00}, 0, 120}, \ -// or \ -// ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xFF, {0x77, 0x01, 0x00, 0x00, 0x10}), \ -// ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC0, {0x3B, 0x00}), \ -// ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC1, {0x0D, 0x02}), \ -// ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(120, 0x29), \ -// } +/* +#define ESP_PANEL_LCD_VENDOR_INIT_CMD() \ + { \ + {0xFF, (uint8_t []){0x77, 0x01, 0x00, 0x00, 0x10}, 5, 0}, \ + {0xC0, (uint8_t []){0x3B, 0x00}, 2, 0}, \ + {0xC1, (uint8_t []){0x0D, 0x02}, 2, 0}, \ + {0x29, (uint8_t []){0x00}, 0, 120}, \ + or \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xFF, {0x77, 0x01, 0x00, 0x00, 0x10}), \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC0, {0x3B, 0x00}), \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC1, {0x0D, 0x02}), \ + ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(120, 0x29), \ + } +*/ /* LCD Color Settings */ /* LCD color depth in bits */ @@ -379,7 +381,7 @@ */ #define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MAJOR 0 #define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MINOR 2 -#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_PATCH 2 +#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_PATCH 3 #endif /* ESP_PANEL_USE_CUSTOM_BOARD */ diff --git a/examples/PlatformIO/src/ESP_Panel_Board_Supported.h b/examples/PlatformIO/src/ESP_Panel_Board_Supported.h index 4c58e5a4..603e59bd 100644 --- a/examples/PlatformIO/src/ESP_Panel_Board_Supported.h +++ b/examples/PlatformIO/src/ESP_Panel_Board_Supported.h @@ -26,9 +26,9 @@ * - BOARD_ESP32_S3_BOX_LITE (ESP32-S3-Box-Lite): https://github.com/espressif/esp-box/tree/master * - BOARD_ESP32_S3_EYE (ESP32-S3-EYE): https://github.com/espressif/esp-who/blob/master/docs/en/get-started/ESP32-S3-EYE_Getting_Started_Guide.md * - BOARD_ESP32_S3_KORVO_2 (ESP32-S3-Korvo-2): https://docs.espressif.com/projects/esp-adf/en/latest/design-guide/dev-boards/user-guide-esp32-s3-korvo-2.html - * - BOARD_ESP32_S3_LCD_EV_BOARD (ESP32-S3-LCD-EV-Board): https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32s3/esp32-s3-lcd-ev-board/user_guide_v1.4.html + * - BOARD_ESP32_S3_LCD_EV_BOARD (ESP32-S3-LCD-EV-Board(v1.1-v1.4)): https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32s3/esp32-s3-lcd-ev-board/user_guide_v1.4.html * - BOARD_ESP32_S3_LCD_EV_BOARD_V1_5 (ESP32-S3-LCD-EV-Board(v1.5)): https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32s3/esp32-s3-lcd-ev-board/user_guide.html - * - BOARD_ESP32_S3_LCD_EV_BOARD_2 (ESP32-S3-LCD-EV-Board-2)): https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32s3/esp32-s3-lcd-ev-board/user_guide_v1.4.html + * - BOARD_ESP32_S3_LCD_EV_BOARD_2 (ESP32-S3-LCD-EV-Board-2(v1.1-v1.4))): https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32s3/esp32-s3-lcd-ev-board/user_guide_v1.4.html * - BOARD_ESP32_S3_LCD_EV_BOARD_2_V1_5 (ESP32-S3-LCD-EV-Board-2(v1.5)): https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32s3/esp32-s3-lcd-ev-board/user_guide.html * - BOARD_ESP32_S3_USB_OTG (ESP32-S3-USB-OTG): https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32s3/esp32-s3-usb-otg/index.html * @@ -56,9 +56,9 @@ /* * M5Stack (https://m5stack.com/): * - * - BOARD_M5STACK_M5CORE2 (M5STACK_M5CORE2): https://docs.m5stack.com/zh_CN/core/core2 - * - BOARD_M5STACK_M5DIAL (M5STACK_M5DIAL): https://docs.m5stack.com/zh_CN/core/M5Dial - * - BOARD_M5STACK_M5CORES3 (M5STACK_M5CORES3): https://docs.m5stack.com/zh_CN/core/CoreS3 + * - BOARD_M5STACK_M5CORE2 (M5STACK_M5CORE2): https://docs.m5stack.com/en/core/core2 + * - BOARD_M5STACK_M5DIAL (M5STACK_M5DIAL): https://docs.m5stack.com/en/core/M5Dial + * - BOARD_M5STACK_M5CORES3 (M5STACK_M5CORES3): https://docs.m5stack.com/en/core/CoreS3 */ // #define BOARD_M5STACK_M5CORE2 // #define BOARD_M5STACK_M5DIAL @@ -102,6 +102,6 @@ */ #define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MAJOR 0 #define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MINOR 5 -#define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_PATCH 0 +#define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_PATCH 1 #endif diff --git a/examples/PlatformIO/src/lvgl_port_v8.cpp b/examples/PlatformIO/src/lvgl_port_v8.cpp index 08cc35ab..cfd9f29d 100644 --- a/examples/PlatformIO/src/lvgl_port_v8.cpp +++ b/examples/PlatformIO/src/lvgl_port_v8.cpp @@ -198,7 +198,7 @@ static void flush_callback(lv_disp_drv_t *drv, const lv_area_t *area, lv_color_t /* Reset flag */ drv->full_refresh = 0; - // Roate and copy data from the whole screen LVGL's buffer to the next frame buffer + // Rotate and copy data from the whole screen LVGL's buffer to the next frame buffer next_fb = flush_get_next_buf(lcd); rotate_copy_pixel((lv_color_t *)color_map, (lv_color_t *)next_fb, offsetx1, offsety1, offsetx2, offsety2, LV_HOR_RES, LV_VER_RES, LVGL_PORT_ROTATION_DEGREE); diff --git a/examples/PlatformIO/src/lvgl_port_v8.h b/examples/PlatformIO/src/lvgl_port_v8.h index 0a01155d..b0e25ee1 100644 --- a/examples/PlatformIO/src/lvgl_port_v8.h +++ b/examples/PlatformIO/src/lvgl_port_v8.h @@ -80,7 +80,7 @@ #define LVGL_PORT_RGB_BOUNCE_BUFFER_SIZE (LVGL_PORT_DISP_WIDTH * 10) /** * When avoid tearing is enabled, the LVGL software rotation `lv_disp_set_rotation()` is not supported. - * But users can set the rotation degree(0/90/180/270) here, but this funciton will extremely reduce FPS. + * But users can set the rotation degree(0/90/180/270) here, but this function will extremely reduce FPS. * So it is recommended to be used when using a low resolution display. * * Set the rotation degree: @@ -148,7 +148,7 @@ bool lvgl_port_init(ESP_PanelLcd *lcd, ESP_PanelTouch *tp); * * @param timeout_ms The timeout of the mutex lock, in milliseconds. If the timeout is set to `-1`, it will wait indefinitely. * - * @return ture if success, otherwise false + * @return true if success, otherwise false */ bool lvgl_port_lock(int timeout_ms); @@ -156,7 +156,7 @@ bool lvgl_port_lock(int timeout_ms); * @brief Unlock the LVGL mutex. This function should be called after using LVGL APIs when not in LVGL task, and the * `lvgl_port_lock()` function should be called before. * - * @return ture if success, otherwise false + * @return true if success, otherwise false */ bool lvgl_port_unlock(void); diff --git a/examples/SquareLine/v8/Porting/ESP_Panel_Board_Custom.h b/examples/SquareLine/v8/Porting/ESP_Panel_Board_Custom.h index 5ed0f923..3ae31b50 100644 --- a/examples/SquareLine/v8/Porting/ESP_Panel_Board_Custom.h +++ b/examples/SquareLine/v8/Porting/ESP_Panel_Board_Custom.h @@ -173,21 +173,23 @@ * * There are two formats for the sequence code: * 1. Raw data: {command, (uint8_t []){ data0, data1, ... }, data_size, delay_ms} - * 2. Formater: ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(delay_ms, command, { data0, data1, ... }) and + * 2. Formatter: ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(delay_ms, command, { data0, data1, ... }) and * ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(delay_ms, command) */ -// #define ESP_PANEL_LCD_VENDOR_INIT_CMD() \ -// { \ -// {0xFF, (uint8_t []){0x77, 0x01, 0x00, 0x00, 0x10}, 5, 0}, \ -// {0xC0, (uint8_t []){0x3B, 0x00}, 2, 0}, \ -// {0xC1, (uint8_t []){0x0D, 0x02}, 2, 0}, \ -// {0x29, (uint8_t []){0x00}, 0, 120}, \ -// or \ -// ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xFF, {0x77, 0x01, 0x00, 0x00, 0x10}), \ -// ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC0, {0x3B, 0x00}), \ -// ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC1, {0x0D, 0x02}), \ -// ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(120, 0x29), \ -// } +/* +#define ESP_PANEL_LCD_VENDOR_INIT_CMD() \ + { \ + {0xFF, (uint8_t []){0x77, 0x01, 0x00, 0x00, 0x10}, 5, 0}, \ + {0xC0, (uint8_t []){0x3B, 0x00}, 2, 0}, \ + {0xC1, (uint8_t []){0x0D, 0x02}, 2, 0}, \ + {0x29, (uint8_t []){0x00}, 0, 120}, \ + or \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xFF, {0x77, 0x01, 0x00, 0x00, 0x10}), \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC0, {0x3B, 0x00}), \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC1, {0x0D, 0x02}), \ + ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(120, 0x29), \ + } +*/ /* LCD Color Settings */ /* LCD color depth in bits */ @@ -379,7 +381,7 @@ */ #define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MAJOR 0 #define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MINOR 2 -#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_PATCH 2 +#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_PATCH 3 #endif /* ESP_PANEL_USE_CUSTOM_BOARD */ diff --git a/examples/SquareLine/v8/Porting/ESP_Panel_Board_Supported.h b/examples/SquareLine/v8/Porting/ESP_Panel_Board_Supported.h index 4c58e5a4..603e59bd 100644 --- a/examples/SquareLine/v8/Porting/ESP_Panel_Board_Supported.h +++ b/examples/SquareLine/v8/Porting/ESP_Panel_Board_Supported.h @@ -26,9 +26,9 @@ * - BOARD_ESP32_S3_BOX_LITE (ESP32-S3-Box-Lite): https://github.com/espressif/esp-box/tree/master * - BOARD_ESP32_S3_EYE (ESP32-S3-EYE): https://github.com/espressif/esp-who/blob/master/docs/en/get-started/ESP32-S3-EYE_Getting_Started_Guide.md * - BOARD_ESP32_S3_KORVO_2 (ESP32-S3-Korvo-2): https://docs.espressif.com/projects/esp-adf/en/latest/design-guide/dev-boards/user-guide-esp32-s3-korvo-2.html - * - BOARD_ESP32_S3_LCD_EV_BOARD (ESP32-S3-LCD-EV-Board): https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32s3/esp32-s3-lcd-ev-board/user_guide_v1.4.html + * - BOARD_ESP32_S3_LCD_EV_BOARD (ESP32-S3-LCD-EV-Board(v1.1-v1.4)): https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32s3/esp32-s3-lcd-ev-board/user_guide_v1.4.html * - BOARD_ESP32_S3_LCD_EV_BOARD_V1_5 (ESP32-S3-LCD-EV-Board(v1.5)): https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32s3/esp32-s3-lcd-ev-board/user_guide.html - * - BOARD_ESP32_S3_LCD_EV_BOARD_2 (ESP32-S3-LCD-EV-Board-2)): https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32s3/esp32-s3-lcd-ev-board/user_guide_v1.4.html + * - BOARD_ESP32_S3_LCD_EV_BOARD_2 (ESP32-S3-LCD-EV-Board-2(v1.1-v1.4))): https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32s3/esp32-s3-lcd-ev-board/user_guide_v1.4.html * - BOARD_ESP32_S3_LCD_EV_BOARD_2_V1_5 (ESP32-S3-LCD-EV-Board-2(v1.5)): https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32s3/esp32-s3-lcd-ev-board/user_guide.html * - BOARD_ESP32_S3_USB_OTG (ESP32-S3-USB-OTG): https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32s3/esp32-s3-usb-otg/index.html * @@ -56,9 +56,9 @@ /* * M5Stack (https://m5stack.com/): * - * - BOARD_M5STACK_M5CORE2 (M5STACK_M5CORE2): https://docs.m5stack.com/zh_CN/core/core2 - * - BOARD_M5STACK_M5DIAL (M5STACK_M5DIAL): https://docs.m5stack.com/zh_CN/core/M5Dial - * - BOARD_M5STACK_M5CORES3 (M5STACK_M5CORES3): https://docs.m5stack.com/zh_CN/core/CoreS3 + * - BOARD_M5STACK_M5CORE2 (M5STACK_M5CORE2): https://docs.m5stack.com/en/core/core2 + * - BOARD_M5STACK_M5DIAL (M5STACK_M5DIAL): https://docs.m5stack.com/en/core/M5Dial + * - BOARD_M5STACK_M5CORES3 (M5STACK_M5CORES3): https://docs.m5stack.com/en/core/CoreS3 */ // #define BOARD_M5STACK_M5CORE2 // #define BOARD_M5STACK_M5DIAL @@ -102,6 +102,6 @@ */ #define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MAJOR 0 #define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MINOR 5 -#define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_PATCH 0 +#define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_PATCH 1 #endif diff --git a/examples/SquareLine/v8/Porting/lvgl_port_v8.cpp b/examples/SquareLine/v8/Porting/lvgl_port_v8.cpp index 08cc35ab..cfd9f29d 100644 --- a/examples/SquareLine/v8/Porting/lvgl_port_v8.cpp +++ b/examples/SquareLine/v8/Porting/lvgl_port_v8.cpp @@ -198,7 +198,7 @@ static void flush_callback(lv_disp_drv_t *drv, const lv_area_t *area, lv_color_t /* Reset flag */ drv->full_refresh = 0; - // Roate and copy data from the whole screen LVGL's buffer to the next frame buffer + // Rotate and copy data from the whole screen LVGL's buffer to the next frame buffer next_fb = flush_get_next_buf(lcd); rotate_copy_pixel((lv_color_t *)color_map, (lv_color_t *)next_fb, offsetx1, offsety1, offsetx2, offsety2, LV_HOR_RES, LV_VER_RES, LVGL_PORT_ROTATION_DEGREE); diff --git a/examples/SquareLine/v8/Porting/lvgl_port_v8.h b/examples/SquareLine/v8/Porting/lvgl_port_v8.h index 41014e0a..c7b7cdf2 100644 --- a/examples/SquareLine/v8/Porting/lvgl_port_v8.h +++ b/examples/SquareLine/v8/Porting/lvgl_port_v8.h @@ -83,7 +83,7 @@ #define LVGL_PORT_RGB_BOUNCE_BUFFER_SIZE (LVGL_PORT_DISP_WIDTH * 10) /** * When avoid tearing is enabled, the LVGL software rotation `lv_disp_set_rotation()` is not supported. - * But users can set the rotation degree(0/90/180/270) here, but this funciton will extremely reduce FPS. + * But users can set the rotation degree(0/90/180/270) here, but this function will extremely reduce FPS. * So it is recommended to be used when using a low resolution display. * * Set the rotation degree: @@ -151,7 +151,7 @@ bool lvgl_port_init(ESP_PanelLcd *lcd, ESP_PanelTouch *tp); * * @param timeout_ms The timeout of the mutex lock, in milliseconds. If the timeout is set to `-1`, it will wait indefinitely. * - * @return ture if success, otherwise false + * @return true if success, otherwise false */ bool lvgl_port_lock(int timeout_ms); @@ -159,7 +159,7 @@ bool lvgl_port_lock(int timeout_ms); * @brief Unlock the LVGL mutex. This function should be called after using LVGL APIs when not in LVGL task, and the * `lvgl_port_lock()` function should be called before. * - * @return ture if success, otherwise false + * @return true if success, otherwise false */ bool lvgl_port_unlock(void); diff --git a/examples/SquareLine/v8/WiFiClock/ESP_Panel_Board_Custom.h b/examples/SquareLine/v8/WiFiClock/ESP_Panel_Board_Custom.h index 5ed0f923..3ae31b50 100644 --- a/examples/SquareLine/v8/WiFiClock/ESP_Panel_Board_Custom.h +++ b/examples/SquareLine/v8/WiFiClock/ESP_Panel_Board_Custom.h @@ -173,21 +173,23 @@ * * There are two formats for the sequence code: * 1. Raw data: {command, (uint8_t []){ data0, data1, ... }, data_size, delay_ms} - * 2. Formater: ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(delay_ms, command, { data0, data1, ... }) and + * 2. Formatter: ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(delay_ms, command, { data0, data1, ... }) and * ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(delay_ms, command) */ -// #define ESP_PANEL_LCD_VENDOR_INIT_CMD() \ -// { \ -// {0xFF, (uint8_t []){0x77, 0x01, 0x00, 0x00, 0x10}, 5, 0}, \ -// {0xC0, (uint8_t []){0x3B, 0x00}, 2, 0}, \ -// {0xC1, (uint8_t []){0x0D, 0x02}, 2, 0}, \ -// {0x29, (uint8_t []){0x00}, 0, 120}, \ -// or \ -// ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xFF, {0x77, 0x01, 0x00, 0x00, 0x10}), \ -// ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC0, {0x3B, 0x00}), \ -// ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC1, {0x0D, 0x02}), \ -// ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(120, 0x29), \ -// } +/* +#define ESP_PANEL_LCD_VENDOR_INIT_CMD() \ + { \ + {0xFF, (uint8_t []){0x77, 0x01, 0x00, 0x00, 0x10}, 5, 0}, \ + {0xC0, (uint8_t []){0x3B, 0x00}, 2, 0}, \ + {0xC1, (uint8_t []){0x0D, 0x02}, 2, 0}, \ + {0x29, (uint8_t []){0x00}, 0, 120}, \ + or \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xFF, {0x77, 0x01, 0x00, 0x00, 0x10}), \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC0, {0x3B, 0x00}), \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC1, {0x0D, 0x02}), \ + ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(120, 0x29), \ + } +*/ /* LCD Color Settings */ /* LCD color depth in bits */ @@ -379,7 +381,7 @@ */ #define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MAJOR 0 #define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MINOR 2 -#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_PATCH 2 +#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_PATCH 3 #endif /* ESP_PANEL_USE_CUSTOM_BOARD */ diff --git a/examples/SquareLine/v8/WiFiClock/ESP_Panel_Board_Supported.h b/examples/SquareLine/v8/WiFiClock/ESP_Panel_Board_Supported.h index 4c58e5a4..603e59bd 100644 --- a/examples/SquareLine/v8/WiFiClock/ESP_Panel_Board_Supported.h +++ b/examples/SquareLine/v8/WiFiClock/ESP_Panel_Board_Supported.h @@ -26,9 +26,9 @@ * - BOARD_ESP32_S3_BOX_LITE (ESP32-S3-Box-Lite): https://github.com/espressif/esp-box/tree/master * - BOARD_ESP32_S3_EYE (ESP32-S3-EYE): https://github.com/espressif/esp-who/blob/master/docs/en/get-started/ESP32-S3-EYE_Getting_Started_Guide.md * - BOARD_ESP32_S3_KORVO_2 (ESP32-S3-Korvo-2): https://docs.espressif.com/projects/esp-adf/en/latest/design-guide/dev-boards/user-guide-esp32-s3-korvo-2.html - * - BOARD_ESP32_S3_LCD_EV_BOARD (ESP32-S3-LCD-EV-Board): https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32s3/esp32-s3-lcd-ev-board/user_guide_v1.4.html + * - BOARD_ESP32_S3_LCD_EV_BOARD (ESP32-S3-LCD-EV-Board(v1.1-v1.4)): https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32s3/esp32-s3-lcd-ev-board/user_guide_v1.4.html * - BOARD_ESP32_S3_LCD_EV_BOARD_V1_5 (ESP32-S3-LCD-EV-Board(v1.5)): https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32s3/esp32-s3-lcd-ev-board/user_guide.html - * - BOARD_ESP32_S3_LCD_EV_BOARD_2 (ESP32-S3-LCD-EV-Board-2)): https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32s3/esp32-s3-lcd-ev-board/user_guide_v1.4.html + * - BOARD_ESP32_S3_LCD_EV_BOARD_2 (ESP32-S3-LCD-EV-Board-2(v1.1-v1.4))): https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32s3/esp32-s3-lcd-ev-board/user_guide_v1.4.html * - BOARD_ESP32_S3_LCD_EV_BOARD_2_V1_5 (ESP32-S3-LCD-EV-Board-2(v1.5)): https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32s3/esp32-s3-lcd-ev-board/user_guide.html * - BOARD_ESP32_S3_USB_OTG (ESP32-S3-USB-OTG): https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32s3/esp32-s3-usb-otg/index.html * @@ -56,9 +56,9 @@ /* * M5Stack (https://m5stack.com/): * - * - BOARD_M5STACK_M5CORE2 (M5STACK_M5CORE2): https://docs.m5stack.com/zh_CN/core/core2 - * - BOARD_M5STACK_M5DIAL (M5STACK_M5DIAL): https://docs.m5stack.com/zh_CN/core/M5Dial - * - BOARD_M5STACK_M5CORES3 (M5STACK_M5CORES3): https://docs.m5stack.com/zh_CN/core/CoreS3 + * - BOARD_M5STACK_M5CORE2 (M5STACK_M5CORE2): https://docs.m5stack.com/en/core/core2 + * - BOARD_M5STACK_M5DIAL (M5STACK_M5DIAL): https://docs.m5stack.com/en/core/M5Dial + * - BOARD_M5STACK_M5CORES3 (M5STACK_M5CORES3): https://docs.m5stack.com/en/core/CoreS3 */ // #define BOARD_M5STACK_M5CORE2 // #define BOARD_M5STACK_M5DIAL @@ -102,6 +102,6 @@ */ #define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MAJOR 0 #define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MINOR 5 -#define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_PATCH 0 +#define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_PATCH 1 #endif diff --git a/examples/SquareLine/v8/WiFiClock/lvgl_port_v8.cpp b/examples/SquareLine/v8/WiFiClock/lvgl_port_v8.cpp index 08cc35ab..cfd9f29d 100644 --- a/examples/SquareLine/v8/WiFiClock/lvgl_port_v8.cpp +++ b/examples/SquareLine/v8/WiFiClock/lvgl_port_v8.cpp @@ -198,7 +198,7 @@ static void flush_callback(lv_disp_drv_t *drv, const lv_area_t *area, lv_color_t /* Reset flag */ drv->full_refresh = 0; - // Roate and copy data from the whole screen LVGL's buffer to the next frame buffer + // Rotate and copy data from the whole screen LVGL's buffer to the next frame buffer next_fb = flush_get_next_buf(lcd); rotate_copy_pixel((lv_color_t *)color_map, (lv_color_t *)next_fb, offsetx1, offsety1, offsetx2, offsety2, LV_HOR_RES, LV_VER_RES, LVGL_PORT_ROTATION_DEGREE); diff --git a/examples/SquareLine/v8/WiFiClock/lvgl_port_v8.h b/examples/SquareLine/v8/WiFiClock/lvgl_port_v8.h index 41014e0a..c7b7cdf2 100644 --- a/examples/SquareLine/v8/WiFiClock/lvgl_port_v8.h +++ b/examples/SquareLine/v8/WiFiClock/lvgl_port_v8.h @@ -83,7 +83,7 @@ #define LVGL_PORT_RGB_BOUNCE_BUFFER_SIZE (LVGL_PORT_DISP_WIDTH * 10) /** * When avoid tearing is enabled, the LVGL software rotation `lv_disp_set_rotation()` is not supported. - * But users can set the rotation degree(0/90/180/270) here, but this funciton will extremely reduce FPS. + * But users can set the rotation degree(0/90/180/270) here, but this function will extremely reduce FPS. * So it is recommended to be used when using a low resolution display. * * Set the rotation degree: @@ -151,7 +151,7 @@ bool lvgl_port_init(ESP_PanelLcd *lcd, ESP_PanelTouch *tp); * * @param timeout_ms The timeout of the mutex lock, in milliseconds. If the timeout is set to `-1`, it will wait indefinitely. * - * @return ture if success, otherwise false + * @return true if success, otherwise false */ bool lvgl_port_lock(int timeout_ms); @@ -159,7 +159,7 @@ bool lvgl_port_lock(int timeout_ms); * @brief Unlock the LVGL mutex. This function should be called after using LVGL APIs when not in LVGL task, and the * `lvgl_port_lock()` function should be called before. * - * @return ture if success, otherwise false + * @return true if success, otherwise false */ bool lvgl_port_unlock(void); diff --git a/idf_component.yml b/idf_component.yml new file mode 100644 index 00000000..5488559d --- /dev/null +++ b/idf_component.yml @@ -0,0 +1,10 @@ +version: "0.2.0" +description: ESP32_Display_Panel is an library designed for ESP SoCs to drive display panels and facilitate rapid GUI development. +url: https://github.com/esp-arduino-libs/ESP32_Display_Panel +repository: https://github.com/esp-arduino-libs/ESP32_Display_Panel.git +issues: https://github.com/esp-arduino-libs/ESP32_Display_Panel/issues +dependencies: + idf: ">=5.1" + esp-arduino-libs/esp-io-expander: + git: https://github.com/esp-arduino-libs/ESP32_IO_Expander.git + public: true diff --git a/library.properties b/library.properties index 932480c0..97ee5217 100644 --- a/library.properties +++ b/library.properties @@ -1,11 +1,11 @@ name=ESP32_Display_Panel -version=0.1.9 +version=0.2.0 author=espressif maintainer=espressif -sentence=ESP32_Display_Panel is an Arduino library designed for ESP SoCs to drive display panels and facilitate rapid GUI development. +sentence=ESP32_Display_Panel is an library designed for ESP SoCs to drive display panels and facilitate rapid GUI development. paragraph=Currently supported boards:ESP32-C3-LCDkit,ESP32-S3-BOX,ESP32-S3-BOX-3,ESP32-S3-BOX-3B,ESP32-S3-BOX-3(beta),ESP32-S3-BOX-Lite,ESP32-S3-EYE,ESP32-S3-Korvo-2,ESP32-S3-LCD-EV-Board,ESP32-S3-LCD-EV-Board-2,ESP32-S3-USB-OTG,M5STACK-M5CORE2,M5STACK-M5DIAL,M5STACK-M5CORES3,ESP32-4848S040C_I_Y_3,ESP32-S3-Touch-LCD-4.3,ESP32-S3-Touch-LCD-1.85,ESP32-S3-Touch-LCD-2.1. Currently supported devices: Bus,LCD,Touch,Backlight,IO expander. Currently supported Bus: I2C,SPI,QSPI,3-wire SPI + RGB. Currently supported LCD controllers: EK9716B,GC9A01,GC9B71,GC9503,ILI9341,NV3022B,ST7262,ST7701,ST7789,ST7796,ST77916,ST77922. Currently supported Touch controllers: CST816S,FT5x06,GT1151,GT911,ST7123,TT21100,XPT2046. category=Other architectures=esp32 url=https://github.com/esp-arduino-libs/ESP32_Display_Panel includes=ESP_Panel_Library.h -depends=ESP32_IO_Expander (>=0.0.1 && <0.1.0) +depends=ESP32_IO_Expander (>=0.1.0 && <0.2.0) diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 00000000..8026cc74 --- /dev/null +++ b/pytest.ini @@ -0,0 +1,42 @@ +[pytest] +# exclude examples/ota/simple_ota_example/pytest_simple_ota.py +norecursedirs = examples/ota/* +# only the files with prefix `pytest_` would be recognized as pytest test scripts. +python_files = pytest_*.py + +# set traceback to "short" to prevent the overwhelming tracebacks +addopts = + -s + --embedded-services esp,idf + --tb short + --skip-check-coredump y + +# ignore PytestExperimentalApiWarning for record_xml_attribute +filterwarnings = + ignore::_pytest.warning_types.PytestExperimentalApiWarning + + +markers = + # target markers + target: target chip name (--target) + # env markers + env: target test env name (--env) + # config markers + config: choose specific bins built by `sdkconfig.ci.` + # app_path markers + app_path: choose specific app_path, [/build_xxx] + + +# log related +log_cli = True +log_cli_level = INFO +log_cli_format = %(asctime)s %(levelname)s %(message)s +log_cli_date_format = %Y-%m-%d %H:%M:%S + +# junit related +junit_family = xunit1 + + +## log all to `system-out` when case fail +junit_logging = stdout +junit_log_passing_tests = False diff --git a/src/ESP_Panel.cpp b/src/ESP_Panel.cpp index a8ee00be..b4eaaf35 100644 --- a/src/ESP_Panel.cpp +++ b/src/ESP_Panel.cpp @@ -17,7 +17,7 @@ using namespace std; * Macros for adding host of bus * */ -#define _ADD_HOST(name, host, config, id) host.addHost##name(config, id) +#define _ADD_HOST(name, host, config, id) host->addHost##name(config, id) #define ADD_HOST(name, host, config, id) _ADD_HOST(name, host, config, id) /** * Macros for creating panel bus @@ -58,10 +58,11 @@ ESP_Panel::ESP_Panel(): _is_initialed(false), _use_external_expander(false), _lcd_bus_ptr(nullptr), - _lcd_ptr(nullptr), _touch_bus_ptr(nullptr), + _lcd_ptr(nullptr), _touch_ptr(nullptr), _backlight_ptr(nullptr), + _host_ptr(nullptr), _expander_ptr(nullptr) { } @@ -98,13 +99,13 @@ bool ESP_Panel::init(void) { ESP_PANEL_ENABLE_TAG_DEBUG_LOG(); - ESP_PanelHost host; + shared_ptr host_ptr = make_shared(); shared_ptr lcd_bus_ptr = nullptr; shared_ptr lcd_ptr = nullptr; shared_ptr touch_bus_ptr = nullptr; shared_ptr touch_ptr = nullptr; - shared_ptr expander_ptr = _expander_ptr; shared_ptr backlight_ptr = nullptr; + shared_ptr expander_ptr = _expander_ptr; ESP_LOGD(TAG, "Panel init start"); @@ -310,7 +311,7 @@ bool ESP_Panel::init(void) #else /* For non-RGB LCD, should use `ADD_HOST()` to init host when `ESP_PANEL_LCD_BUS_SKIP_INIT_HOST` enabled */ #if !ESP_PANEL_LCD_BUS_SKIP_INIT_HOST - ESP_PANEL_CHECK_FALSE_RET(ADD_HOST(ESP_PANEL_LCD_BUS_NAME, host, lcd_bus_host_config, ESP_PANEL_LCD_BUS_HOST), + ESP_PANEL_CHECK_FALSE_RET(ADD_HOST(ESP_PANEL_LCD_BUS_NAME, host_ptr, lcd_bus_host_config, ESP_PANEL_LCD_BUS_HOST), false, "Add host failed"); #endif lcd_bus_ptr = CREATE_BUS_SKIP_HOST(ESP_PANEL_LCD_BUS_NAME, lcd_panel_io_config, ESP_PANEL_LCD_BUS_HOST); @@ -403,7 +404,7 @@ bool ESP_Panel::init(void) }; #if !ESP_PANEL_TOUCH_BUS_SKIP_INIT_HOST - ESP_PANEL_CHECK_FALSE_RET(ADD_HOST(ESP_PANEL_TOUCH_BUS_NAME, host, touch_host_config, ESP_PANEL_TOUCH_BUS_HOST), + ESP_PANEL_CHECK_FALSE_RET(ADD_HOST(ESP_PANEL_TOUCH_BUS_NAME, host_ptr, touch_host_config, ESP_PANEL_TOUCH_BUS_HOST), false, "Add host failed"); #endif @@ -440,7 +441,7 @@ bool ESP_Panel::init(void) }, .clk_flags = I2C_SCLK_SRC_FLAG_FOR_NOMAL, }; - ESP_PANEL_CHECK_FALSE_RET(ADD_HOST(I2C, host, expander_host_config, ESP_PANEL_EXPANDER_HOST), false, + ESP_PANEL_CHECK_FALSE_RET(ADD_HOST(I2C, host_ptr, expander_host_config, ESP_PANEL_EXPANDER_HOST), false, "Add host failed"); #endif expander_ptr = CREATE_EXPANDER(ESP_PANEL_EXPANDER_NAME, ESP_PANEL_EXPANDER_HOST, ESP_PANEL_EXPANDER_I2C_ADDRESS); @@ -448,7 +449,7 @@ bool ESP_Panel::init(void) #endif /* ESP_PANEL_USE_EXPANDER */ ESP_LOGD(TAG, "Initialize host"); - ESP_PANEL_CHECK_FALSE_RET(host.begin(), false, "Initialize host failed"); + ESP_PANEL_CHECK_FALSE_RET(host_ptr->begin(), false, "Initialize host failed"); // Save the created devices _lcd_bus_ptr = lcd_bus_ptr; @@ -456,6 +457,7 @@ bool ESP_Panel::init(void) _touch_bus_ptr = touch_bus_ptr; _touch_ptr = touch_ptr; _backlight_ptr = backlight_ptr; + _host_ptr = host_ptr; _expander_ptr = expander_ptr; _is_initialed = true; @@ -625,6 +627,11 @@ bool ESP_Panel::del(void) _expander_ptr = nullptr; } + if (_host_ptr != nullptr) { + ESP_LOGD(TAG, "Delete host"); + _host_ptr = nullptr; + } + _is_initialed = false; ESP_LOGD(TAG, "Delete panel"); diff --git a/src/ESP_Panel.h b/src/ESP_Panel.h index 479866c9..d6797d82 100644 --- a/src/ESP_Panel.h +++ b/src/ESP_Panel.h @@ -77,8 +77,22 @@ class ESP_Panel { * @brief Here are the functions to get the some parameters of the devices * */ - uint16_t getLcdWidth(void); - uint16_t getLcdHeight(void); + uint16_t getLcdWidth(void) + { +#ifdef ESP_PANEL_LCD_WIDTH + return ESP_PANEL_LCD_WIDTH; +#else + return 0; +#endif + } + uint16_t getLcdHeight(void) + { +#ifdef ESP_PANEL_LCD_HEIGHT + return ESP_PANEL_LCD_HEIGHT; +#else + return 0; +#endif + } private: bool _is_initialed; @@ -88,25 +102,8 @@ class ESP_Panel { std::shared_ptr _lcd_ptr; std::shared_ptr _touch_ptr; std::shared_ptr _backlight_ptr; + std::shared_ptr _host_ptr; std::shared_ptr _expander_ptr; }; -inline uint16_t ESP_Panel::getLcdWidth(void) -{ -#ifdef ESP_PANEL_LCD_WIDTH - return ESP_PANEL_LCD_WIDTH; -#else - return 0; -#endif -} - -inline uint16_t ESP_Panel::getLcdHeight(void) -{ -#ifdef ESP_PANEL_LCD_HEIGHT - return ESP_PANEL_LCD_HEIGHT; -#else - return 0; -#endif -} - #endif /* ESP_PANEL_USE_BOARD */ diff --git a/src/ESP_PanelLog.h b/src/ESP_PanelLog.h index 1cc6706b..9d1387d1 100644 --- a/src/ESP_PanelLog.h +++ b/src/ESP_PanelLog.h @@ -8,6 +8,9 @@ #include #include "ESP_Panel_Conf_Internal.h" #if ESP_PANEL_ENABLE_LOG +#ifdef LOG_LOCAL_LEVEL +#undef LOG_LOCAL_LEVEL +#endif #define LOG_LOCAL_LEVEL ESP_LOG_DEBUG #endif #include "esp_log.h" diff --git a/src/ESP_PanelTypes.h b/src/ESP_PanelTypes.h index 66cab144..c6532daf 100644 --- a/src/ESP_PanelTypes.h +++ b/src/ESP_PanelTypes.h @@ -6,7 +6,6 @@ #pragma once -#include "esp_lcd_panel_rgb.h" #include "soc/soc_caps.h" #include "sdkconfig.h" @@ -61,7 +60,7 @@ #define ESP_PANEL_TOUCH_SPI_PANEL_IO_CONFIG(name, cs_io) _ESP_PANEL_TOUCH_SPI_PANEL_IO_CONFIG(name, cs_io) /** - * @brief Formater for single LCD vendor command with 8-bit parameter + * @brief Formatter for single LCD vendor command with 8-bit parameter * * @param[in] delay_ms Delay in milliseconds after this command * @param[in] command LCD command @@ -71,7 +70,7 @@ #define ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(delay_ms, command, ...) {command, (uint8_t []) __VA_ARGS__, sizeof((uint8_t []) \ __VA_ARGS__), delay_ms} /** - * @brief Formater for single LCD vendor command with no parameter + * @brief Formatter for single LCD vendor command with no parameter * * @param[in] delay_ms Delay in milliseconds after this command * @param[in] command LCD command diff --git a/src/ESP_PanelVersions.h b/src/ESP_PanelVersions.h index 5c154e33..f8338218 100644 --- a/src/ESP_PanelVersions.h +++ b/src/ESP_PanelVersions.h @@ -10,8 +10,8 @@ /* Library Version */ #define ESP_PANEL_VERSION_MAJOR 0 -#define ESP_PANEL_VERSION_MINOR 1 -#define ESP_PANEL_VERSION_PATCH 9 +#define ESP_PANEL_VERSION_MINOR 2 +#define ESP_PANEL_VERSION_PATCH 0 /* File `ESP_Panel_Conf.h` */ #define ESP_PANEL_CONF_VERSION_MAJOR 0 @@ -21,70 +21,76 @@ /* File `ESP_Panel_Board_Custom.h` */ #define ESP_PANEL_BOARD_CUSTOM_VERSION_MAJOR 0 #define ESP_PANEL_BOARD_CUSTOM_VERSION_MINOR 2 -#define ESP_PANEL_BOARD_CUSTOM_VERSION_PATCH 2 +#define ESP_PANEL_BOARD_CUSTOM_VERSION_PATCH 3 /* File `ESP_Panel_Board_Supported.h` */ #define ESP_PANEL_BOARD_SUPPORTED_VERSION_MAJOR 0 #define ESP_PANEL_BOARD_SUPPORTED_VERSION_MINOR 5 -#define ESP_PANEL_BOARD_SUPPORTED_VERSION_PATCH 0 +#define ESP_PANEL_BOARD_SUPPORTED_VERSION_PATCH 1 -/* Check if the current configuration file version is compatible with the library version */ -// File `ESP_Panel_Conf.h` -// If the version is not defined, set it to `0.1.0` -#if !defined(ESP_PANEL_CONF_FILE_VERSION_MAJOR) && \ - !defined(ESP_PANEL_CONF_FILE_VERSION_MINOR) && \ - !defined(ESP_PANEL_CONF_FILE_VERSION_PATCH) -#define ESP_PANEL_CONF_FILE_VERSION_MAJOR 0 -#define ESP_PANEL_CONF_FILE_VERSION_MINOR 1 -#define ESP_PANEL_CONF_FILE_VERSION_PATCH 0 -#endif -// Check if the current configuration file version is compatible with the library version -#if ESP_PANEL_CONF_FILE_VERSION_MAJOR != ESP_PANEL_CONF_VERSION_MAJOR -#error "The file `ESP_Panel_Conf.h` version is not compatible. Please update it with the file from the library" -#elif ESP_PANEL_CONF_FILE_VERSION_MINOR < ESP_PANEL_CONF_VERSION_MINOR -#warning "The file `ESP_Panel_Conf.h` version is outdated. Some new configurations are missing" -#elif ESP_PANEL_CONF_FILE_VERSION_PATCH > ESP_PANEL_VERSION_PATCH -#warning "The file `ESP_Panel_Conf.h` version is newer than the library. Some new configurations are not supported" -#endif /* ESP_PANEL_CONF_INCLUDE_INSIDE */ +// *INDENT-OFF* -// File `ESP_Panel_Board_Custom.h` & `ESP_Panel_Board_Supported.h` -#ifdef ESP_PANEL_USE_BOARD -/* For using a supported board */ -#if CONFIG_ESP_PANEL_USE_SUPPORTED_BOARD || ESP_PANEL_USE_SUPPORTED_BOARD -// If the version is not defined, set it to `0.1.0` -#if !defined(ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MAJOR) && \ - !defined(ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MINOR) && \ - !defined(ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_PATCH) -#define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MAJOR 0 -#define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MINOR 1 -#define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_PATCH 0 -#endif -// Check if the current configuration file version is compatible with the library version -#if ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MAJOR != ESP_PANEL_BOARD_SUPPORTED_VERSION_MAJOR -#error "The file `ESP_Panel_Board_Supported.h` version is not compatible. Please update it with the file from the library" -#elif ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MINOR < ESP_PANEL_BOARD_SUPPORTED_VERSION_MINOR -#warning "The file `ESP_Panel_Board_Supported.h` version is outdated. Some new configurations are missing" -#elif ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_PATCH > ESP_PANEL_BOARD_SUPPORTED_VERSION_MINOR -#warning "The file `ESP_Panel_Board_Supported.h` version is newer than the library. Some new configurations are not supported" -#endif +#ifndef ESP_PANEL_CONF_FILE_SKIP + /* Check if the current configuration file version is compatible with the library version */ + // File `ESP_Panel_Conf.h` + // If the version is not defined, set it to `0.1.0` + #if !defined(ESP_PANEL_CONF_FILE_VERSION_MAJOR) && \ + !defined(ESP_PANEL_CONF_FILE_VERSION_MINOR) && \ + !defined(ESP_PANEL_CONF_FILE_VERSION_PATCH) + #define ESP_PANEL_CONF_FILE_VERSION_MAJOR 0 + #define ESP_PANEL_CONF_FILE_VERSION_MINOR 1 + #define ESP_PANEL_CONF_FILE_VERSION_PATCH 0 + #endif + // Check if the current configuration file version is compatible with the library version + #if ESP_PANEL_CONF_FILE_VERSION_MAJOR != ESP_PANEL_CONF_VERSION_MAJOR + #error "The file `ESP_Panel_Conf.h` version is not compatible. Please update it with the file from the library" + #elif ESP_PANEL_CONF_FILE_VERSION_MINOR < ESP_PANEL_CONF_VERSION_MINOR + #warning "The file `ESP_Panel_Conf.h` version is outdated. Some new configurations are missing" + #elif ESP_PANEL_CONF_FILE_VERSION_PATCH > ESP_PANEL_VERSION_PATCH + #warning "The file `ESP_Panel_Conf.h` version is newer than the library. Some new configurations are not supported" + #endif /* ESP_PANEL_CONF_INCLUDE_INSIDE */ +#endif /* ESP_PANEL_CONF_FILE_SKIP */ -#else /* For using a custom board */ +#ifndef ESP_PANEL_BOARD_FILE_SKIP + // File `ESP_Panel_Board_Custom.h` & `ESP_Panel_Board_Supported.h` + #ifdef ESP_PANEL_USE_BOARD + /* For using a supported board */ + #if ESP_PANEL_USE_SUPPORTED_BOARD + // If the version is not defined, set it to `0.1.0` + #if !defined(ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MAJOR) && \ + !defined(ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MINOR) && \ + !defined(ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_PATCH) + #define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MAJOR 0 + #define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MINOR 1 + #define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_PATCH 0 + #endif + // Check if the current configuration file version is compatible with the library version + #if ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MAJOR != ESP_PANEL_BOARD_SUPPORTED_VERSION_MAJOR + #error "The file `ESP_Panel_Board_Supported.h` version is not compatible. Please update it with the file from the library" + #elif ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MINOR < ESP_PANEL_BOARD_SUPPORTED_VERSION_MINOR + #warning "The file `ESP_Panel_Board_Supported.h` version is outdated. Some new configurations are missing" + #elif ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MINOR > ESP_PANEL_BOARD_SUPPORTED_VERSION_MINOR + #warning "The file `ESP_Panel_Board_Supported.h` version is newer than the library. Some new configurations are not supported" + #endif + #else /* For using a custom board */ + // If the version is not defined, set it to `0.1.0` + #if !defined(ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MAJOR) && \ + !defined(ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MINOR) && \ + !defined(ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_PATCH) + #define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MAJOR 0 + #define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MINOR 1 + #define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_PATCH 0 + #endif + // Check if the current configuration file version is compatible with the library version + #if ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MAJOR != ESP_PANEL_BOARD_CUSTOM_VERSION_MAJOR + #error "The file `ESP_Panel_Board_Custom.h` version is not compatible. Please update it with the file from the library" + #elif ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MINOR < ESP_PANEL_BOARD_CUSTOM_VERSION_MINOR + #warning "The file `ESP_Panel_Board_Custom.h` version is outdated. Some new configurations are missing" + #elif ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MINOR > ESP_PANEL_BOARD_CUSTOM_VERSION_PATCH + #warning "The file `ESP_Panel_Board_Custom.h` version is newer than the library. Some new configurations are not supported" + #endif + #endif /* CONFIG_ESP_PANEL_USE_SUPPORTED_BOARD || ESP_PANEL_USE_SUPPORTED_BOARD */ + #endif /* ESP_PANEL_USE_BOARD */ +#endif /* ESP_PANEL_BOARD_FILE_SKIP */ -// If the version is not defined, set it to `0.1.0` -#if !defined(ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MAJOR) && \ - !defined(ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MINOR) && \ - !defined(ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_PATCH) -#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MAJOR 0 -#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MINOR 1 -#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_PATCH 0 -#endif -// Check if the current configuration file version is compatible with the library version -#if ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MAJOR != ESP_PANEL_BOARD_CUSTOM_VERSION_MAJOR -#error "The file `ESP_Panel_Board_Custom.h` version is not compatible. Please update it with the file from the library" -#elif ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MINOR < ESP_PANEL_BOARD_CUSTOM_VERSION_MINOR -#warning "The file `ESP_Panel_Board_Custom.h` version is outdated. Some new configurations are missing" -#elif ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_PATCH > ESP_PANEL_BOARD_CUSTOM_VERSION_PATCH -#warning "The file `ESP_Panel_Board_Custom.h` version is newer than the library. Some new configurations are not supported" -#endif -#endif /* CONFIG_ESP_PANEL_USE_SUPPORTED_BOARD || ESP_PANEL_USE_SUPPORTED_BOARD */ -#endif /* ESP_PANEL_USE_BOARD */ +// *INDENT-OFF* diff --git a/src/ESP_Panel_Board_Internal.h b/src/ESP_Panel_Board_Internal.h index e1d53bb6..91527867 100644 --- a/src/ESP_Panel_Board_Internal.h +++ b/src/ESP_Panel_Board_Internal.h @@ -11,37 +11,47 @@ /* Handle special Kconfig options */ #ifndef ESP_PANEL_KCONFIG_IGNORE #include "sdkconfig.h" - #ifdef CONFIG_ESP_PANEL_CONF_SKIP - #define ESP_PANEL_CONF_SKIP + #ifdef CONFIG_ESP_PANEL_BOARD_FILE_SKIP + #define ESP_PANEL_BOARD_FILE_SKIP #endif #endif #include "ESP_PanelTypes.h" -/* If "ESP_Panel_*_Board.h" are available from here, try to use them later */ -#ifdef __has_include - #if __has_include("ESP_Panel_Board_Supported.h") - #ifndef ESP_PANEL_SUPPORTED_BOARD_INCLUDE_SIMPLE - #define ESP_PANEL_SUPPORTED_BOARD_INCLUDE_SIMPLE +#ifndef ESP_PANEL_BOARD_FILE_SKIP + /* If "ESP_Panel_*_Board.h" are available from here, try to use them later */ + #ifdef __has_include + #if __has_include("ESP_Panel_Board_Supported.h") + #ifndef ESP_PANEL_SUPPORTED_BOARD_INCLUDE_SIMPLE + #define ESP_PANEL_SUPPORTED_BOARD_INCLUDE_SIMPLE + #endif + #elif __has_include("../../ESP_Panel_Board_Supported.h") + #ifndef ESP_PANEL_SUPPORTED_BOARD_INCLUDE_OUTSIDE + #define ESP_PANEL_SUPPORTED_BOARD_INCLUDE_OUTSIDE + #endif + #else + #ifndef ESP_PANEL_SUPPORTED_BOARD_INCLUDE_INSIDE + #define ESP_PANEL_SUPPORTED_BOARD_INCLUDE_INSIDE + #endif #endif - #elif __has_include("../../ESP_Panel_Board_Supported.h") - #ifndef ESP_PANEL_SUPPORTED_BOARD_INCLUDE_OUTSIDE - #define ESP_PANEL_SUPPORTED_BOARD_INCLUDE_OUTSIDE - #endif - #endif - #if __has_include("ESP_Panel_Board_Custom.h") - #ifndef ESP_PANEL_CUSTOM_BOARD_INCLUDE_SIMPLE - #define ESP_PANEL_CUSTOM_BOARD_INCLUDE_SIMPLE - #endif - #elif __has_include("../../ESP_Panel_Board_Custom.h") - #ifndef ESP_PANEL_CUSTOM_BOARD_INCLUDE_OUTSIDE - #define ESP_PANEL_CUSTOM_BOARD_INCLUDE_OUTSIDE + #if __has_include("ESP_Panel_Board_Custom.h") + #ifndef ESP_PANEL_CUSTOM_BOARD_INCLUDE_SIMPLE + #define ESP_PANEL_CUSTOM_BOARD_INCLUDE_SIMPLE + #endif + #elif __has_include("../../ESP_Panel_Board_Custom.h") + #ifndef ESP_PANEL_CUSTOM_BOARD_INCLUDE_OUTSIDE + #define ESP_PANEL_CUSTOM_BOARD_INCLUDE_OUTSIDE + #endif + #else + #ifndef ESP_PANEL_CUSTOM_BOARD_INCLUDE_INSIDE + #define ESP_PANEL_CUSTOM_BOARD_INCLUDE_INSIDE + #endif #endif #endif #endif -/* If "ESP_Panel_Board_*.h" are not skipped, include them */ -#ifndef ESP_PANEL_CONF_SKIP +#ifndef ESP_PANEL_CONF_FILE_SKIP + /* If "ESP_Panel_Board_*.h" are not skipped, include them */ #ifdef ESP_PANEL_SUPPORTED_BOARD_PATH /* If there is a path defined for "ESP_Panel_Board_Supported.h", use it */ #define __TO_STR_AUX(x) #x #define __TO_STR(x) __TO_STR_AUX(x) @@ -66,81 +76,88 @@ #endif #endif +#if !defined(ESP_PANEL_SUPPORTED_BOARD_INCLUDE_INSIDE) && !defined(ESP_PANEL_CUSTOM_BOARD_INCLUDE_INSIDE) + /** + * There are two purposes to include the this file: + * 1. Convert configuration items starting with `CONFIG_` to the required configuration items. + * 2. Define default values for configuration items that are not defined to keep compatibility. + * + */ + #include "ESP_Panel_Board_Kconfig.h" +#endif + /* Check if select both custom and supported board */ -#if (CONFIG_ESP_PANEL_USE_SUPPORTED_BOARD || ESP_PANEL_USE_SUPPORTED_BOARD) && \ - (CONFIG_ESP_PANEL_USE_CUSTOM_BOARD || ESP_PANEL_USE_CUSTOM_BOARD) +#if ESP_PANEL_USE_SUPPORTED_BOARD && ESP_PANEL_USE_CUSTOM_BOARD #error "Please select either a custom or a supported development board, cannot enable both simultaneously" #endif /* Check if use board */ -#if CONFIG_ESP_PANEL_USE_SUPPORTED_BOARD || ESP_PANEL_USE_SUPPORTED_BOARD || \ - CONFIG_ESP_PANEL_USE_CUSTOM_BOARD || ESP_PANEL_USE_CUSTOM_BOARD +#if ESP_PANEL_USE_SUPPORTED_BOARD || ESP_PANEL_USE_CUSTOM_BOARD #define ESP_PANEL_USE_BOARD #endif #ifdef ESP_PANEL_USE_BOARD -/* For using a supported board */ -#if CONFIG_ESP_PANEL_USE_SUPPORTED_BOARD || ESP_PANEL_USE_SUPPORTED_BOARD -// Include the supported board header file -#include "board/ESP_PanelBoard.h" -#endif + /* For using a supported board, include the supported board header file */ + #if ESP_PANEL_USE_SUPPORTED_BOARD + #include "board/ESP_PanelBoard.h" + #endif -/* Define some special macros for devices */ -/*-------------------------------- LCD Related --------------------------------*/ -#if ESP_PANEL_USE_LCD - #if ESP_PANEL_LCD_BUS_TYPE == ESP_PANEL_BUS_TYPE_SPI + /* Define some special macros for devices */ + /*-------------------------------- LCD Related --------------------------------*/ + #if ESP_PANEL_USE_LCD + #if ESP_PANEL_LCD_BUS_TYPE == ESP_PANEL_BUS_TYPE_SPI - #include "hal/spi_types.h" - #define ESP_PANEL_LCD_BUS_NAME SPI - #define ESP_PANEL_LCD_BUS_HOST ((spi_host_device_t)ESP_PANEL_LCD_BUS_HOST_ID) + #include "hal/spi_types.h" + #define ESP_PANEL_LCD_BUS_NAME SPI + #define ESP_PANEL_LCD_BUS_HOST ((spi_host_device_t)ESP_PANEL_LCD_BUS_HOST_ID) - #elif ESP_PANEL_LCD_BUS_TYPE == ESP_PANEL_BUS_TYPE_QSPI + #elif ESP_PANEL_LCD_BUS_TYPE == ESP_PANEL_BUS_TYPE_QSPI - #include "hal/spi_types.h" - #define ESP_PANEL_LCD_BUS_NAME QSPI - #define ESP_PANEL_LCD_BUS_HOST ((spi_host_device_t)ESP_PANEL_LCD_BUS_HOST_ID) + #include "hal/spi_types.h" + #define ESP_PANEL_LCD_BUS_NAME QSPI + #define ESP_PANEL_LCD_BUS_HOST ((spi_host_device_t)ESP_PANEL_LCD_BUS_HOST_ID) - #elif ESP_PANEL_LCD_BUS_TYPE == ESP_PANEL_BUS_TYPE_RGB + #elif ESP_PANEL_LCD_BUS_TYPE == ESP_PANEL_BUS_TYPE_RGB - #ifndef SOC_LCD_RGB_SUPPORTED - #error "LCD RGB is only supported for ESP32-S3, please select the correct board." - #endif - #define ESP_PANEL_LCD_BUS_NAME RGB - #define ESP_PANEL_LCD_BUS_HOST (-1) + #ifndef SOC_LCD_RGB_SUPPORTED + #error "RGB is not supported for current SoC, please select the correct board." + #endif + #define ESP_PANEL_LCD_BUS_NAME RGB + #define ESP_PANEL_LCD_BUS_HOST (-1) - #else + #else - #error "Unkonw LCD panel bus type selected, please refer to the README for supported bus types" + #error "Unknown LCD panel bus type selected, please refer to the README for supported bus types" - #endif /* ESP_PANEL_LCD_BUS_TYPE */ -#endif /* ESP_PANEL_USE_LCD */ -/*-------------------------------- Touch Related --------------------------------*/ -#if ESP_PANEL_USE_TOUCH - #if ESP_PANEL_TOUCH_BUS_TYPE == ESP_PANEL_BUS_TYPE_I2C + #endif /* ESP_PANEL_LCD_BUS_TYPE */ + #endif /* ESP_PANEL_USE_LCD */ + /*-------------------------------- Touch Related --------------------------------*/ + #if ESP_PANEL_USE_TOUCH + #if ESP_PANEL_TOUCH_BUS_TYPE == ESP_PANEL_BUS_TYPE_I2C - #include "hal/i2c_types.h" - #define ESP_PANEL_TOUCH_BUS_NAME I2C - #define ESP_PANEL_TOUCH_BUS_HOST ((i2c_port_t)ESP_PANEL_TOUCH_BUS_HOST_ID) + #include "hal/i2c_types.h" + #define ESP_PANEL_TOUCH_BUS_NAME I2C + #define ESP_PANEL_TOUCH_BUS_HOST ((i2c_port_t)ESP_PANEL_TOUCH_BUS_HOST_ID) - #elif ESP_PANEL_TOUCH_BUS_TYPE == ESP_PANEL_BUS_TYPE_SPI + #elif ESP_PANEL_TOUCH_BUS_TYPE == ESP_PANEL_BUS_TYPE_SPI - #include "hal/spi_types.h" - #define ESP_PANEL_TOUCH_BUS_NAME SPI - #define ESP_PANEL_TOUCH_BUS_HOST ((spi_host_device_t)ESP_PANEL_TOUCH_BUS_HOST_ID) + #include "hal/spi_types.h" + #define ESP_PANEL_TOUCH_BUS_NAME SPI + #define ESP_PANEL_TOUCH_BUS_HOST ((spi_host_device_t)ESP_PANEL_TOUCH_BUS_HOST_ID) - #else + #else - #error "Unkonw Touch bus type selected, please refer to the README for supported bus types." + #error "Unknown Touch bus type selected, please refer to the README for supported bus types." - #endif /* ESP_PANEL_TOUCH_BUS_TYPE */ -#endif /* ESP_PANEL_USE_TOUCH */ -/*-------------------------------- IO Expander Related --------------------------------*/ -#if ESP_PANEL_USE_EXPANDER + #endif /* ESP_PANEL_TOUCH_BUS_TYPE */ + #endif /* ESP_PANEL_USE_TOUCH */ + /*-------------------------------- IO Expander Related --------------------------------*/ + #if ESP_PANEL_USE_EXPANDER - #include "hal/i2c_types.h" - #define ESP_PANEL_EXPANDER_HOST ((i2c_port_t)ESP_PANEL_EXPANDER_HOST_ID) + #include "hal/i2c_types.h" + #define ESP_PANEL_EXPANDER_HOST ((i2c_port_t)ESP_PANEL_EXPANDER_HOST_ID) -#endif /* ESP_PANEL_USE_EXPANDER */ + #endif /* ESP_PANEL_USE_EXPANDER */ #endif /* ESP_PANEL_USE_BOARD */ // *INDENT-OFF* diff --git a/src/ESP_Panel_Board_Kconfig.h b/src/ESP_Panel_Board_Kconfig.h new file mode 100644 index 00000000..34054e9d --- /dev/null +++ b/src/ESP_Panel_Board_Kconfig.h @@ -0,0 +1,1102 @@ +/* + * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +#pragma once + +#include "ESP_PanelTypes.h" + +// *INDENT-OFF* + +#ifndef ESP_PANEL_USE_SUPPORTED_BOARD + #ifdef CONFIG_ESP_PANEL_USE_SUPPORTED_BOARD + #define ESP_PANEL_USE_SUPPORTED_BOARD CONFIG_ESP_PANEL_USE_SUPPORTED_BOARD + #else + #define ESP_PANEL_USE_SUPPORTED_BOARD 0 + #endif +#endif + +#ifndef ESP_PANEL_USE_CUSTOM_BOARD + #ifdef CONFIG_ESP_PANEL_USE_CUSTOM_BOARD + #define ESP_PANEL_USE_CUSTOM_BOARD CONFIG_ESP_PANEL_USE_CUSTOM_BOARD + #else + #define ESP_PANEL_USE_CUSTOM_BOARD 0 + #endif +#endif + +/** + * Supported Board + * + */ +#if ESP_PANEL_USE_SUPPORTED_BOARD + // Espressif + #ifndef BOARD_ESP32_C3_LCDKIT + #ifdef CONFIG_BOARD_ESP32_C3_LCDKIT + #define BOARD_ESP32_C3_LCDKIT CONFIG_BOARD_ESP32_C3_LCDKIT + #endif + #endif + #ifndef BOARD_ESP32_S3_BOX + #ifdef CONFIG_BOARD_ESP32_S3_BOX + #define BOARD_ESP32_S3_BOX CONFIG_BOARD_ESP32_S3_BOX + #endif + #endif + #ifndef BOARD_ESP32_S3_BOX_3 + #ifdef CONFIG_BOARD_ESP32_S3_BOX_3 + #define BOARD_ESP32_S3_BOX_3 CONFIG_BOARD_ESP32_S3_BOX_3 + #endif + #endif + #ifndef BOARD_ESP32_S3_BOX_3_BETA + #ifdef CONFIG_BOARD_ESP32_S3_BOX_3_BETA + #define BOARD_ESP32_S3_BOX_3_BETA CONFIG_BOARD_ESP32_S3_BOX_3_BETA + #endif + #endif + #ifndef BOARD_ESP32_S3_BOX_LITE + #ifdef CONFIG_BOARD_ESP32_S3_BOX_LITE + #define BOARD_ESP32_S3_BOX_LITE CONFIG_BOARD_ESP32_S3_BOX_LITE + #endif + #endif + #ifndef BOARD_ESP32_S3_EYE + #ifdef CONFIG_BOARD_ESP32_S3_EYE + #define BOARD_ESP32_S3_EYE CONFIG_BOARD_ESP32_S3_EYE + #endif + #endif + #ifndef BOARD_ESP32_S3_KORVO_2 + #ifdef CONFIG_BOARD_ESP32_S3_KORVO_2 + #define BOARD_ESP32_S3_KORVO_2 CONFIG_BOARD_ESP32_S3_KORVO_2 + #endif + #endif + #ifndef BOARD_ESP32_S3_LCD_EV_BOARD + #ifdef CONFIG_BOARD_ESP32_S3_LCD_EV_BOARD + #define BOARD_ESP32_S3_LCD_EV_BOARD CONFIG_BOARD_ESP32_S3_LCD_EV_BOARD + #endif + #endif + #ifndef BOARD_ESP32_S3_LCD_EV_BOARD_V1_5 + #ifdef CONFIG_BOARD_ESP32_S3_LCD_EV_BOARD_V1_5 + #define BOARD_ESP32_S3_LCD_EV_BOARD_V1_5 CONFIG_BOARD_ESP32_S3_LCD_EV_BOARD_V1_5 + #endif + #endif + #ifndef BOARD_ESP32_S3_LCD_EV_BOARD_2 + #ifdef CONFIG_BOARD_ESP32_S3_LCD_EV_BOARD_2 + #define BOARD_ESP32_S3_LCD_EV_BOARD_2 CONFIG_BOARD_ESP32_S3_LCD_EV_BOARD_2 + #endif + #endif + #ifndef BOARD_ESP32_S3_LCD_EV_BOARD_2_V1_5 + #ifdef CONFIG_BOARD_ESP32_S3_LCD_EV_BOARD_2_V1_5 + #define BOARD_ESP32_S3_LCD_EV_BOARD_2_V1_5 CONFIG_BOARD_ESP32_S3_LCD_EV_BOARD_2_V1_5 + #endif + #endif + #ifndef BOARD_ESP32_S3_USB_OTG + #ifdef CONFIG_BOARD_ESP32_S3_USB_OTG + #define BOARD_ESP32_S3_USB_OTG CONFIG_BOARD_ESP32_S3_USB_OTG + #endif + #endif + // Elecrow + #ifndef BOARD_ELECROW_CROWPANEL_7_0 + #ifdef CONFIG_BOARD_ELECROW_CROWPANEL_7_0 + #define BOARD_ELECROW_CROWPANEL_7_0 CONFIG_BOARD_ELECROW_CROWPANEL_7_0 + #endif + #endif + // M5Stack + #ifndef BOARD_M5STACK_M5CORE2 + #ifdef CONFIG_BOARD_M5STACK_M5CORE2 + #define BOARD_M5STACK_M5CORE2 CONFIG_BOARD_M5STACK_M5CORE2 + #endif + #endif + #ifndef BOARD_M5STACK_M5DIAL + #ifdef CONFIG_BOARD_M5STACK_M5DIAL + #define BOARD_M5STACK_M5DIAL CONFIG_BOARD_M5STACK_M5DIAL + #endif + #endif + #ifndef BOARD_M5STACK_M5CORES3 + #ifdef CONFIG_BOARD_M5STACK_M5CORES3 + #define BOARD_M5STACK_M5CORES3 CONFIG_BOARD_M5STACK_M5CORES3 + #endif + #endif + // Jingcai + #ifndef BOARD_ESP32_4848S040C_I_Y_3 + #ifdef CONFIG_BOARD_ESP32_4848S040C_I_Y_3 + #define BOARD_ESP32_4848S040C_I_Y_3 CONFIG_BOARD_ESP32_4848S040C_I_Y_3 + #endif + #endif + // Waveshare + #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 + #endif + #endif + #ifndef BOARD_WAVESHARE_ESP32_S3_Touch_LCD_1_85 + #ifdef CONFIG_BOARD_WAVESHARE_ESP32_S3_Touch_LCD_1_85 + #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_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 +#endif /* ESP_PANEL_USE_SUPPORTED_BOARD */ + +/** + * Custom Board + * + */ +#if ESP_PANEL_USE_CUSTOM_BOARD + // LCD + #ifndef ESP_PANEL_USE_LCD + #ifdef CONFIG_ESP_PANEL_USE_LCD + #define ESP_PANEL_USE_LCD CONFIG_ESP_PANEL_USE_LCD + #else + #define ESP_PANEL_USE_LCD 0 + #endif + #endif + #if ESP_PANEL_USE_LCD + // Controller + #ifndef ESP_PANEL_LCD_CONTROLLER_EK9716B + #ifdef CONFIG_ESP_PANEL_LCD_CONTROLLER_EK9716B + #define ESP_PANEL_LCD_NAME EK9716B + #endif + #endif + #ifndef ESP_PANEL_LCD_CONTROLLER_GC9A01 + #ifdef CONFIG_ESP_PANEL_LCD_CONTROLLER_GC9A01 + #define ESP_PANEL_LCD_NAME GC9A01 + #endif + #endif + #ifndef ESP_PANEL_LCD_CONTROLLER_GC9B71 + #ifdef CONFIG_ESP_PANEL_LCD_CONTROLLER_GC9B71 + #define ESP_PANEL_LCD_NAME GC9B71 + #endif + #endif + #ifndef ESP_PANEL_LCD_CONTROLLER_GC9503 + #ifdef CONFIG_ESP_PANEL_LCD_CONTROLLER_GC9503 + #define ESP_PANEL_LCD_NAME GC9503 + #endif + #endif + #ifndef ESP_PANEL_LCD_CONTROLLER_ILI9341 + #ifdef CONFIG_ESP_PANEL_LCD_CONTROLLER_ILI9341 + #define ESP_PANEL_LCD_NAME ILI9341 + #endif + #endif + #ifndef ESP_PANEL_LCD_CONTROLLER_NV3022B + #ifdef CONFIG_ESP_PANEL_LCD_CONTROLLER_NV3022B + #define ESP_PANEL_LCD_NAME NV3022B + #endif + #endif + #ifndef ESP_PANEL_LCD_CONTROLLER_SH8601 + #ifdef CONFIG_ESP_PANEL_LCD_CONTROLLER_SH8601 + #define ESP_PANEL_LCD_NAME SH8601 + #endif + #endif + #ifndef ESP_PANEL_LCD_CONTROLLER_SPD2010 + #ifdef CONFIG_ESP_PANEL_LCD_CONTROLLER_SPD2010 + #define ESP_PANEL_LCD_NAME SPD2010 + #endif + #endif + #ifndef ESP_PANEL_LCD_CONTROLLER_ST7262 + #ifdef CONFIG_ESP_PANEL_LCD_CONTROLLER_ST7262 + #define ESP_PANEL_LCD_NAME ST7262 + #endif + #endif + #ifndef ESP_PANEL_LCD_CONTROLLER_ST7701 + #ifdef CONFIG_ESP_PANEL_LCD_CONTROLLER_ST7701 + #define ESP_PANEL_LCD_NAME ST7701 + #endif + #endif + #ifndef ESP_PANEL_LCD_CONTROLLER_ST7789 + #ifdef CONFIG_ESP_PANEL_LCD_CONTROLLER_ST7789 + #define ESP_PANEL_LCD_NAME ST7789 + #endif + #endif + #ifndef ESP_PANEL_LCD_CONTROLLER_ST7796 + #ifdef CONFIG_ESP_PANEL_LCD_CONTROLLER_ST7796 + #define ESP_PANEL_LCD_NAME ST7796 + #endif + #endif + #ifndef ESP_PANEL_LCD_CONTROLLER_ST77916 + #ifdef CONFIG_ESP_PANEL_LCD_CONTROLLER_ST77916 + #define ESP_PANEL_LCD_NAME ST77916 + #endif + #endif + #ifndef ESP_PANEL_LCD_CONTROLLER_ST77922 + #ifdef CONFIG_ESP_PANEL_LCD_CONTROLLER_ST77922 + #define ESP_PANEL_LCD_NAME ST77922 + #endif + #endif + #ifndef ESP_PANEL_LCD_NAME + #error "Missing configuration: ESP_PANEL_LCD_NAME" + #endif + // Resolution + #ifndef ESP_PANEL_LCD_WIDTH + #ifdef CONFIG_ESP_PANEL_LCD_WIDTH + #define ESP_PANEL_LCD_WIDTH CONFIG_ESP_PANEL_LCD_WIDTH + #else + #error "Missing configuration: ESP_PANEL_LCD_WIDTH" + #endif + #endif + #ifndef ESP_PANEL_LCD_HEIGHT + #ifdef CONFIG_ESP_PANEL_LCD_HEIGHT + #define ESP_PANEL_LCD_HEIGHT CONFIG_ESP_PANEL_LCD_HEIGHT + #else + #error "Missing configuration: ESP_PANEL_LCD_HEIGHT" + #endif + #endif + // Bus + #ifndef ESP_PANEL_LCD_BUS_SKIP_INIT_HOST + #ifdef CONFIG_ESP_PANEL_LCD_BUS_SKIP_INIT_HOST + #define ESP_PANEL_LCD_BUS_SKIP_INIT_HOST CONFIG_ESP_PANEL_LCD_BUS_SKIP_INIT_HOST + #else + #define ESP_PANEL_LCD_BUS_SKIP_INIT_HOST 0 + #endif + #endif + #ifndef ESP_PANEL_LCD_BUS_TYPE + #ifdef CONFIG_ESP_PANEL_LCD_BUS_TYPE + #define ESP_PANEL_LCD_BUS_TYPE CONFIG_ESP_PANEL_LCD_BUS_TYPE + #else + #error "Missing configuration: ESP_PANEL_LCD_BUS_TYPE" + #endif + #endif + // SPI Bus + #if ESP_PANEL_LCD_BUS_TYPE == ESP_PANEL_BUS_TYPE_SPI + #ifndef ESP_PANEL_LCD_BUS_HOST_ID + #ifdef CONFIG_ESP_PANEL_LCD_BUS_HOST_ID + #define ESP_PANEL_LCD_BUS_HOST_ID CONFIG_ESP_PANEL_LCD_BUS_HOST_ID + #else + #error "Missing configuration: ESP_PANEL_LCD_BUS_HOST_ID" + #endif + #endif + #ifndef ESP_PANEL_LCD_SPI_MODE + #ifdef CONFIG_ESP_PANEL_LCD_SPI_MODE + #define ESP_PANEL_LCD_SPI_MODE CONFIG_ESP_PANEL_LCD_SPI_MODE + #else + #error "Missing configuration: ESP_PANEL_LCD_SPI_MODE" + #endif + #endif + #ifndef ESP_PANEL_LCD_SPI_CLK_HZ + #ifdef CONFIG_ESP_PANEL_LCD_SPI_CLK_HZ + #define ESP_PANEL_LCD_SPI_CLK_HZ CONFIG_ESP_PANEL_LCD_SPI_CLK_HZ + #else + #error "Missing configuration: ESP_PANEL_LCD_SPI_CLK_HZ" + #endif + #endif + #ifndef ESP_PANEL_LCD_SPI_TRANS_QUEUE_SZ + #ifdef CONFIG_ESP_PANEL_LCD_SPI_TRANS_QUEUE_SZ + #define ESP_PANEL_LCD_SPI_TRANS_QUEUE_SZ CONFIG_ESP_PANEL_LCD_SPI_TRANS_QUEUE_SZ + #else + #error "Missing configuration: CONFIG_ESP_PANEL_LCD_SPI_TRANS_QUEUE_SZ" + #endif + #endif + #ifndef ESP_PANEL_LCD_SPI_CMD_BITS + #ifdef CONFIG_ESP_PANEL_LCD_SPI_CMD_BITS + #define ESP_PANEL_LCD_SPI_CMD_BITS CONFIG_ESP_PANEL_LCD_SPI_CMD_BITS + #else + #error "Missing configuration: ESP_PANEL_LCD_SPI_CMD_BITS" + #endif + #endif + #ifndef ESP_PANEL_LCD_SPI_PARAM_BITS + #ifdef CONFIG_ESP_PANEL_LCD_SPI_PARAM_BITS + #define ESP_PANEL_LCD_SPI_PARAM_BITS CONFIG_ESP_PANEL_LCD_SPI_PARAM_BITS + #else + #error "Missing configuration: ESP_PANEL_LCD_SPI_PARAM_BITS" + #endif + #endif + #ifndef ESP_PANEL_LCD_SPI_IO_CS + #ifdef CONFIG_ESP_PANEL_LCD_SPI_IO_CS + #define ESP_PANEL_LCD_SPI_IO_CS CONFIG_ESP_PANEL_LCD_SPI_IO_CS + #else + #error "Missing configuration: ESP_PANEL_LCD_SPI_IO_CS" + #endif + #endif + #ifndef ESP_PANEL_LCD_SPI_IO_DC + #ifdef CONFIG_ESP_PANEL_LCD_SPI_IO_DC + #define ESP_PANEL_LCD_SPI_IO_DC CONFIG_ESP_PANEL_LCD_SPI_IO_DC + #else + #error "Missing configuration: ESP_PANEL_LCD_SPI_IO_DC" + #endif + #endif + #ifndef ESP_PANEL_LCD_SPI_IO_SCK + #ifdef CONFIG_ESP_PANEL_LCD_SPI_IO_SCK + #define ESP_PANEL_LCD_SPI_IO_SCK CONFIG_ESP_PANEL_LCD_SPI_IO_SCK + #else + #error "Missing configuration: ESP_PANEL_LCD_SPI_IO_SCK" + #endif + #endif + #ifndef ESP_PANEL_LCD_SPI_IO_MOSI + #ifdef CONFIG_ESP_PANEL_LCD_SPI_IO_MOSI + #define ESP_PANEL_LCD_SPI_IO_MOSI CONFIG_ESP_PANEL_LCD_SPI_IO_MOSI + #else + #error "Missing configuration: ESP_PANEL_LCD_SPI_IO_MOSI" + #endif + #endif + #ifndef ESP_PANEL_LCD_SPI_IO_MISO + #ifdef CONFIG_ESP_PANEL_LCD_SPI_IO_MISO + #define ESP_PANEL_LCD_SPI_IO_MISO CONFIG_ESP_PANEL_LCD_SPI_IO_MISO + #else + #error "Missing configuration: ESP_PANEL_LCD_SPI_IO_MISO" + #endif + #endif + // QSPI Bus + #elif ESP_PANEL_LCD_BUS_TYPE == ESP_PANEL_BUS_TYPE_QSPI + #ifndef ESP_PANEL_LCD_BUS_HOST_ID + #ifdef CONFIG_ESP_PANEL_LCD_BUS_HOST_ID + #define ESP_PANEL_LCD_BUS_HOST_ID CONFIG_ESP_PANEL_LCD_BUS_HOST_ID + #else + #error "Missing configuration: ESP_PANEL_LCD_BUS_HOST_ID" + #endif + #endif + #ifndef ESP_PANEL_LCD_SPI_MODE + #ifdef CONFIG_ESP_PANEL_LCD_SPI_MODE + #define ESP_PANEL_LCD_SPI_MODE CONFIG_ESP_PANEL_LCD_SPI_MODE + #else + #error "Missing configuration: ESP_PANEL_LCD_SPI_MODE" + #endif + #endif + #ifndef ESP_PANEL_LCD_SPI_CLK_HZ + #ifdef CONFIG_ESP_PANEL_LCD_SPI_CLK_HZ + #define ESP_PANEL_LCD_SPI_CLK_HZ CONFIG_ESP_PANEL_LCD_SPI_CLK_HZ + #else + #error "Missing configuration: ESP_PANEL_LCD_SPI_CLK_HZ" + #endif + #endif + #ifndef ESP_PANEL_LCD_SPI_TRANS_QUEUE_SZ + #ifdef CONFIG_ESP_PANEL_LCD_SPI_TRANS_QUEUE_SZ + #define ESP_PANEL_LCD_SPI_TRANS_QUEUE_SZ CONFIG_ESP_PANEL_LCD_SPI_TRANS_QUEUE_SZ + #else + #error "Missing configuration: CONFIG_ESP_PANEL_LCD_SPI_TRANS_QUEUE_SZ" + #endif + #endif + #ifndef ESP_PANEL_LCD_SPI_CMD_BITS + #ifdef CONFIG_ESP_PANEL_LCD_SPI_CMD_BITS + #define ESP_PANEL_LCD_SPI_CMD_BITS CONFIG_ESP_PANEL_LCD_SPI_CMD_BITS + #else + #error "Missing configuration: ESP_PANEL_LCD_SPI_CMD_BITS" + #endif + #endif + #ifndef ESP_PANEL_LCD_SPI_PARAM_BITS + #ifdef CONFIG_ESP_PANEL_LCD_SPI_PARAM_BITS + #define ESP_PANEL_LCD_SPI_PARAM_BITS CONFIG_ESP_PANEL_LCD_SPI_PARAM_BITS + #else + #error "Missing configuration: ESP_PANEL_LCD_SPI_PARAM_BITS" + #endif + #endif + #ifndef ESP_PANEL_LCD_SPI_IO_CS + #ifdef CONFIG_ESP_PANEL_LCD_SPI_IO_CS + #define ESP_PANEL_LCD_SPI_IO_CS CONFIG_ESP_PANEL_LCD_SPI_IO_CS + #else + #error "Missing configuration: ESP_PANEL_LCD_SPI_IO_CS" + #endif + #endif + #ifndef ESP_PANEL_LCD_SPI_IO_SCK + #ifdef CONFIG_ESP_PANEL_LCD_SPI_IO_SCK + #define ESP_PANEL_LCD_SPI_IO_SCK CONFIG_ESP_PANEL_LCD_SPI_IO_SCK + #else + #error "Missing configuration: ESP_PANEL_LCD_SPI_IO_SCK" + #endif + #endif + #ifndef ESP_PANEL_LCD_SPI_IO_DATA0 + #ifdef CONFIG_ESP_PANEL_LCD_SPI_IO_DATA0 + #define ESP_PANEL_LCD_SPI_IO_DATA0 CONFIG_ESP_PANEL_LCD_SPI_IO_DATA0 + #else + #error "Missing configuration: ESP_PANEL_LCD_SPI_IO_DATA0" + #endif + #endif + #ifndef ESP_PANEL_LCD_SPI_IO_DATA1 + #ifdef CONFIG_ESP_PANEL_LCD_SPI_IO_DATA1 + #define ESP_PANEL_LCD_SPI_IO_DATA1 CONFIG_ESP_PANEL_LCD_SPI_IO_DATA1 + #else + #error "Missing configuration: ESP_PANEL_LCD_SPI_IO_DATA1" + #endif + #endif + #ifndef ESP_PANEL_LCD_SPI_IO_DATA2 + #ifdef CONFIG_ESP_PANEL_LCD_SPI_IO_DATA2 + #define ESP_PANEL_LCD_SPI_IO_DATA2 CONFIG_ESP_PANEL_LCD_SPI_IO_DATA2 + #else + #error "Missing configuration: ESP_PANEL_LCD_SPI_IO_DATA2" + #endif + #endif + #ifndef ESP_PANEL_LCD_SPI_IO_DATA3 + #ifdef CONFIG_ESP_PANEL_LCD_SPI_IO_DATA3 + #define ESP_PANEL_LCD_SPI_IO_DATA3 CONFIG_ESP_PANEL_LCD_SPI_IO_DATA3 + #else + #error "Missing configuration: ESP_PANEL_LCD_SPI_IO_DATA3" + #endif + #endif + // RGB Bus + #elif ESP_PANEL_LCD_BUS_TYPE == ESP_PANEL_BUS_TYPE_RGB + #if !ESP_PANEL_LCD_BUS_SKIP_INIT_HOST + // 3-wire SPI Interface + #ifndef ESP_PANEL_LCD_3WIRE_SPI_CS_USE_EXPNADER + #ifdef CONFIG_ESP_PANEL_LCD_3WIRE_SPI_CS_USE_EXPNADER + #define ESP_PANEL_LCD_3WIRE_SPI_CS_USE_EXPNADER CONFIG_ESP_PANEL_LCD_3WIRE_SPI_CS_USE_EXPNADER + #else + #define ESP_PANEL_LCD_3WIRE_SPI_CS_USE_EXPNADER 0 + #endif + #endif + #ifndef ESP_PANEL_LCD_3WIRE_SPI_SCL_USE_EXPNADER + #ifdef CONFIG_ESP_PANEL_LCD_3WIRE_SPI_SCL_USE_EXPNADER + #define ESP_PANEL_LCD_3WIRE_SPI_SCL_USE_EXPNADER CONFIG_ESP_PANEL_LCD_3WIRE_SPI_SCL_USE_EXPNADER + #else + #define ESP_PANEL_LCD_3WIRE_SPI_SCL_USE_EXPNADER 0 + #endif + #endif + #ifndef ESP_PANEL_LCD_3WIRE_SPI_SDA_USE_EXPNADER + #ifdef CONFIG_ESP_PANEL_LCD_3WIRE_SPI_SDA_USE_EXPNADER + #define ESP_PANEL_LCD_3WIRE_SPI_SDA_USE_EXPNADER CONFIG_ESP_PANEL_LCD_3WIRE_SPI_SDA_USE_EXPNADER + #else + #define ESP_PANEL_LCD_3WIRE_SPI_SDA_USE_EXPNADER 0 + #endif + #endif + #ifndef ESP_PANEL_LCD_FLAGS_AUTO_DEL_PANEL_IO + #ifdef CONFIG_ESP_PANEL_LCD_FLAGS_AUTO_DEL_PANEL_IO + #define ESP_PANEL_LCD_FLAGS_AUTO_DEL_PANEL_IO CONFIG_ESP_PANEL_LCD_FLAGS_AUTO_DEL_PANEL_IO + #else + #define ESP_PANEL_LCD_FLAGS_AUTO_DEL_PANEL_IO 0 + #endif + #endif + #ifndef ESP_PANEL_LCD_FLAGS_MIRROR_BY_CMD + #ifdef CONFIG_ESP_PANEL_LCD_FLAGS_MIRROR_BY_CMD + #define ESP_PANEL_LCD_FLAGS_MIRROR_BY_CMD CONFIG_ESP_PANEL_LCD_FLAGS_MIRROR_BY_CMD + #else + #define ESP_PANEL_LCD_FLAGS_MIRROR_BY_CMD (!ESP_PANEL_LCD_FLAGS_AUTO_DEL_PANEL_IO) + #endif + #endif + #ifndef ESP_PANEL_LCD_3WIRE_SPI_IO_CS + #ifdef CONFIG_ESP_PANEL_LCD_3WIRE_SPI_IO_CS + #define ESP_PANEL_LCD_3WIRE_SPI_IO_CS CONFIG_ESP_PANEL_LCD_3WIRE_SPI_IO_CS + #else + #error "Missing configuration: ESP_PANEL_LCD_3WIRE_SPI_IO_CS" + #endif + #endif + #ifndef ESP_PANEL_LCD_3WIRE_SPI_IO_SCK + #ifdef CONFIG_ESP_PANEL_LCD_3WIRE_SPI_IO_SCK + #define ESP_PANEL_LCD_3WIRE_SPI_IO_SCK CONFIG_ESP_PANEL_LCD_3WIRE_SPI_IO_SCK + #else + #error "Missing configuration: ESP_PANEL_LCD_3WIRE_SPI_IO_SCK" + #endif + #endif + #ifndef ESP_PANEL_LCD_3WIRE_SPI_IO_SDA + #ifdef CONFIG_ESP_PANEL_LCD_3WIRE_SPI_IO_SDA + #define ESP_PANEL_LCD_3WIRE_SPI_IO_SDA CONFIG_ESP_PANEL_LCD_3WIRE_SPI_IO_SDA + #else + #error "Missing configuration: ESP_PANEL_LCD_3WIRE_SPI_IO_SDA" + #endif + #endif + #endif /* ESP_PANEL_LCD_BUS_SKIP_INIT_HOST */ + // RGB Interface + #ifndef ESP_PANEL_LCD_RGB_CLK_HZ + #ifdef CONFIG_ESP_PANEL_LCD_RGB_CLK_HZ + #define ESP_PANEL_LCD_RGB_CLK_HZ CONFIG_ESP_PANEL_LCD_RGB_CLK_HZ + #else + #error "Missing configuration: ESP_PANEL_LCD_RGB_CLK_HZ" + #endif + #endif + #ifndef ESP_PANEL_LCD_RGB_HPW + #ifdef CONFIG_ESP_PANEL_LCD_RGB_HPW + #define ESP_PANEL_LCD_RGB_HPW CONFIG_ESP_PANEL_LCD_RGB_HPW + #else + #error "Missing configuration: ESP_PANEL_LCD_RGB_HPW" + #endif + #endif + #ifndef ESP_PANEL_LCD_RGB_HBP + #ifdef CONFIG_ESP_PANEL_LCD_RGB_HBP + #define ESP_PANEL_LCD_RGB_HBP CONFIG_ESP_PANEL_LCD_RGB_HBP + #else + #error "Missing configuration: ESP_PANEL_LCD_RGB_HBP" + #endif + #endif + #ifndef ESP_PANEL_LCD_RGB_HFP + #ifdef CONFIG_ESP_PANEL_LCD_RGB_HFP + #define ESP_PANEL_LCD_RGB_HFP CONFIG_ESP_PANEL_LCD_RGB_HFP + #else + #error "Missing configuration: ESP_PANEL_LCD_RGB_HFP" + #endif + #endif + #ifndef ESP_PANEL_LCD_RGB_VPW + #ifdef CONFIG_ESP_PANEL_LCD_RGB_VPW + #define ESP_PANEL_LCD_RGB_VPW CONFIG_ESP_PANEL_LCD_RGB_VPW + #else + #error "Missing configuration: ESP_PANEL_LCD_RGB_VPW" + #endif + #endif + #ifndef ESP_PANEL_LCD_RGB_VBP + #ifdef CONFIG_ESP_PANEL_LCD_RGB_VBP + #define ESP_PANEL_LCD_RGB_VBP CONFIG_ESP_PANEL_LCD_RGB_VBP + #else + #error "Missing configuration: ESP_PANEL_LCD_RGB_VBP" + #endif + #endif + #ifndef ESP_PANEL_LCD_RGB_VFP + #ifdef CONFIG_ESP_PANEL_LCD_RGB_VFP + #define ESP_PANEL_LCD_RGB_VFP CONFIG_ESP_PANEL_LCD_RGB_VFP + #else + #error "Missing configuration: ESP_PANEL_LCD_RGB_VFP" + #endif + #endif + #ifndef ESP_PANEL_LCD_RGB_PCLK_ACTIVE_NEG + #ifdef CONFIG_ESP_PANEL_LCD_RGB_PCLK_ACTIVE_NEG + #define ESP_PANEL_LCD_RGB_PCLK_ACTIVE_NEG CONFIG_ESP_PANEL_LCD_RGB_PCLK_ACTIVE_NEG + #else + #define ESP_PANEL_LCD_RGB_PCLK_ACTIVE_NEG 0 + #endif + #endif + #ifndef ESP_PANEL_LCD_RGB_DATA_WIDTH + #ifdef CONFIG_ESP_PANEL_LCD_RGB_DATA_WIDTH + #define ESP_PANEL_LCD_RGB_DATA_WIDTH CONFIG_ESP_PANEL_LCD_RGB_DATA_WIDTH + #else + #error "Missing configuration: ESP_PANEL_LCD_RGB_DATA_WIDTH" + #endif + #endif + #ifndef ESP_PANEL_LCD_RGB_PIXEL_BITS + #ifdef CONFIG_ESP_PANEL_LCD_RGB_PIXEL_BITS + #define ESP_PANEL_LCD_RGB_PIXEL_BITS CONFIG_ESP_PANEL_LCD_RGB_PIXEL_BITS + #else + #error "Missing configuration: ESP_PANEL_LCD_RGB_PIXEL_BITS" + #endif + #endif + #ifndef ESP_PANEL_LCD_RGB_IO_HSYNC + #ifdef CONFIG_ESP_PANEL_LCD_RGB_IO_HSYNC + #define ESP_PANEL_LCD_RGB_IO_HSYNC CONFIG_ESP_PANEL_LCD_RGB_IO_HSYNC + #else + #error "Missing configuration: ESP_PANEL_LCD_RGB_IO_HSYNC" + #endif + #endif + #ifndef ESP_PANEL_LCD_RGB_IO_VSYNC + #ifdef CONFIG_ESP_PANEL_LCD_RGB_IO_VSYNC + #define ESP_PANEL_LCD_RGB_IO_VSYNC CONFIG_ESP_PANEL_LCD_RGB_IO_VSYNC + #else + #error "Missing configuration: ESP_PANEL_LCD_RGB_IO_VSYNC" + #endif + #endif + #ifndef ESP_PANEL_LCD_RGB_IO_DE + #ifdef CONFIG_ESP_PANEL_LCD_RGB_IO_DE + #define ESP_PANEL_LCD_RGB_IO_DE CONFIG_ESP_PANEL_LCD_RGB_IO_DE + #else + #error "Missing configuration: ESP_PANEL_LCD_RGB_IO_DE" + #endif + #endif + #ifndef ESP_PANEL_LCD_RGB_IO_PCLK + #ifdef CONFIG_ESP_PANEL_LCD_RGB_IO_PCLK + #define ESP_PANEL_LCD_RGB_IO_PCLK CONFIG_ESP_PANEL_LCD_RGB_IO_PCLK + #else + #error "Missing configuration: ESP_PANEL_LCD_RGB_IO_PCLK" + #endif + #endif + #ifndef ESP_PANEL_LCD_RGB_IO_DISP + #ifdef CONFIG_ESP_PANEL_LCD_RGB_IO_DISP + #define ESP_PANEL_LCD_RGB_IO_DISP CONFIG_ESP_PANEL_LCD_RGB_IO_DISP + #else + #error "Missing configuration: ESP_PANEL_LCD_RGB_IO_DISP" + #endif + #endif + #ifndef ESP_PANEL_LCD_RGB_IO_DATA0 + #ifdef CONFIG_ESP_PANEL_LCD_RGB_IO_DATA0 + #define ESP_PANEL_LCD_RGB_IO_DATA0 CONFIG_ESP_PANEL_LCD_RGB_IO_DATA0 + #else + #error "Missing configuration: ESP_PANEL_LCD_RGB_IO_DATA0" + #endif + #endif + #ifndef ESP_PANEL_LCD_RGB_IO_DATA1 + #ifdef CONFIG_ESP_PANEL_LCD_RGB_IO_DATA1 + #define ESP_PANEL_LCD_RGB_IO_DATA1 CONFIG_ESP_PANEL_LCD_RGB_IO_DATA1 + #else + #error "Missing configuration: ESP_PANEL_LCD_RGB_IO_DATA1" + #endif + #endif + #ifndef ESP_PANEL_LCD_RGB_IO_DATA2 + #ifdef CONFIG_ESP_PANEL_LCD_RGB_IO_DATA2 + #define ESP_PANEL_LCD_RGB_IO_DATA2 CONFIG_ESP_PANEL_LCD_RGB_IO_DATA2 + #else + #error "Missing configuration: ESP_PANEL_LCD_RGB_IO_DATA2" + #endif + #endif + #ifndef ESP_PANEL_LCD_RGB_IO_DATA3 + #ifdef CONFIG_ESP_PANEL_LCD_RGB_IO_DATA3 + #define ESP_PANEL_LCD_RGB_IO_DATA3 CONFIG_ESP_PANEL_LCD_RGB_IO_DATA3 + #else + #error "Missing configuration: ESP_PANEL_LCD_RGB_IO_DATA3" + #endif + #endif + #ifndef ESP_PANEL_LCD_RGB_IO_DATA4 + #ifdef CONFIG_ESP_PANEL_LCD_RGB_IO_DATA4 + #define ESP_PANEL_LCD_RGB_IO_DATA4 CONFIG_ESP_PANEL_LCD_RGB_IO_DATA4 + #else + #error "Missing configuration: ESP_PANEL_LCD_RGB_IO_DATA4" + #endif + #endif + #ifndef ESP_PANEL_LCD_RGB_IO_DATA5 + #ifdef CONFIG_ESP_PANEL_LCD_RGB_IO_DATA5 + #define ESP_PANEL_LCD_RGB_IO_DATA5 CONFIG_ESP_PANEL_LCD_RGB_IO_DATA5 + #else + #error "Missing configuration: ESP_PANEL_LCD_RGB_IO_DATA5" + #endif + #endif + #ifndef ESP_PANEL_LCD_RGB_IO_DATA6 + #ifdef CONFIG_ESP_PANEL_LCD_RGB_IO_DATA6 + #define ESP_PANEL_LCD_RGB_IO_DATA6 CONFIG_ESP_PANEL_LCD_RGB_IO_DATA6 + #else + #error "Missing configuration: ESP_PANEL_LCD_RGB_IO_DATA6" + #endif + #endif + #ifndef ESP_PANEL_LCD_RGB_IO_DATA7 + #ifdef CONFIG_ESP_PANEL_LCD_RGB_IO_DATA7 + #define ESP_PANEL_LCD_RGB_IO_DATA7 CONFIG_ESP_PANEL_LCD_RGB_IO_DATA7 + #else + #error "Missing configuration: ESP_PANEL_LCD_RGB_IO_DATA7" + #endif + #endif + #if ESP_PANEL_LCD_RGB_DATA_WIDTH > 8 + #ifndef ESP_PANEL_LCD_RGB_IO_DATA8 + #ifdef CONFIG_ESP_PANEL_LCD_RGB_IO_DATA8 + #define ESP_PANEL_LCD_RGB_IO_DATA8 CONFIG_ESP_PANEL_LCD_RGB_IO_DATA8 + #else + #error "Missing configuration: ESP_PANEL_LCD_RGB_IO_DATA8" + #endif + #endif + #ifndef ESP_PANEL_LCD_RGB_IO_DATA9 + #ifdef CONFIG_ESP_PANEL_LCD_RGB_IO_DATA9 + #define ESP_PANEL_LCD_RGB_IO_DATA9 CONFIG_ESP_PANEL_LCD_RGB_IO_DATA9 + #else + #error "Missing configuration: ESP_PANEL_LCD_RGB_IO_DATA9" + #endif + #endif + #ifndef ESP_PANEL_LCD_RGB_IO_DATA10 + #ifdef CONFIG_ESP_PANEL_LCD_RGB_IO_DATA10 + #define ESP_PANEL_LCD_RGB_IO_DATA10 CONFIG_ESP_PANEL_LCD_RGB_IO_DATA10 + #else + #error "Missing configuration: ESP_PANEL_LCD_RGB_IO_DATA10" + #endif + #endif + #ifndef ESP_PANEL_LCD_RGB_IO_DATA11 + #ifdef CONFIG_ESP_PANEL_LCD_RGB_IO_DATA11 + #define ESP_PANEL_LCD_RGB_IO_DATA11 CONFIG_ESP_PANEL_LCD_RGB_IO_DATA11 + #else + #error "Missing configuration: ESP_PANEL_LCD_RGB_IO_DATA11" + #endif + #endif + #ifndef ESP_PANEL_LCD_RGB_IO_DATA12 + #ifdef CONFIG_ESP_PANEL_LCD_RGB_IO_DATA12 + #define ESP_PANEL_LCD_RGB_IO_DATA12 CONFIG_ESP_PANEL_LCD_RGB_IO_DATA12 + #else + #error "Missing configuration: ESP_PANEL_LCD_RGB_IO_DATA12" + #endif + #endif + #ifndef ESP_PANEL_LCD_RGB_IO_DATA13 + #ifdef CONFIG_ESP_PANEL_LCD_RGB_IO_DATA13 + #define ESP_PANEL_LCD_RGB_IO_DATA13 CONFIG_ESP_PANEL_LCD_RGB_IO_DATA13 + #else + #error "Missing configuration: ESP_PANEL_LCD_RGB_IO_DATA13" + #endif + #endif + #ifndef ESP_PANEL_LCD_RGB_IO_DATA14 + #ifdef CONFIG_ESP_PANEL_LCD_RGB_IO_DATA14 + #define ESP_PANEL_LCD_RGB_IO_DATA14 CONFIG_ESP_PANEL_LCD_RGB_IO_DATA14 + #else + #error "Missing configuration: ESP_PANEL_LCD_RGB_IO_DATA14" + #endif + #endif + #ifndef ESP_PANEL_LCD_RGB_IO_DATA15 + #ifdef CONFIG_ESP_PANEL_LCD_RGB_IO_DATA15 + #define ESP_PANEL_LCD_RGB_IO_DATA15 CONFIG_ESP_PANEL_LCD_RGB_IO_DATA15 + #else + #error "Missing configuration: ESP_PANEL_LCD_RGB_IO_DATA15" + #endif + #endif + #endif /* ESP_PANEL_LCD_RGB_DATA_WIDTH */ + #else + #error "Invalid configuration: ESP_PANEL_LCD_BUS_TYPE" + #endif /* ESP_PANEL_LCD_BUS_TYPE */ + // Color Settings + #ifndef ESP_PANEL_LCD_COLOR_BITS + #ifdef CONFIG_ESP_PANEL_LCD_COLOR_BITS + #define ESP_PANEL_LCD_COLOR_BITS CONFIG_ESP_PANEL_LCD_COLOR_BITS + #else + #error "Missing configuration: ESP_PANEL_LCD_COLOR_BITS" + #endif + #endif + #ifndef ESP_PANEL_LCD_BGR_ORDER + #ifdef CONFIG_ESP_PANEL_LCD_BGR_ORDER + #define ESP_PANEL_LCD_BGR_ORDER CONFIG_ESP_PANEL_LCD_BGR_ORDER + #else + #define ESP_PANEL_LCD_BGR_ORDER 0 + #endif + #endif + #ifndef ESP_PANEL_LCD_INEVRT_COLOR + #ifdef CONFIG_ESP_PANEL_LCD_INEVRT_COLOR + #define ESP_PANEL_LCD_INEVRT_COLOR CONFIG_ESP_PANEL_LCD_INEVRT_COLOR + #else + #define ESP_PANEL_LCD_INEVRT_COLOR 0 + #endif + #endif + // Transformation settings + #ifndef ESP_PANEL_LCD_SWAP_XY + #ifdef CONFIG_ESP_PANEL_LCD_SWAP_XY + #define ESP_PANEL_LCD_SWAP_XY CONFIG_ESP_PANEL_LCD_SWAP_XY + #endif + #endif + #ifndef ESP_PANEL_LCD_MIRROR_X + #ifdef CONFIG_ESP_PANEL_LCD_MIRROR_X + #define ESP_PANEL_LCD_MIRROR_X CONFIG_ESP_PANEL_LCD_MIRROR_X + #endif + #endif + #ifndef ESP_PANEL_LCD_MIRROR_Y + #ifdef CONFIG_ESP_PANEL_LCD_MIRROR_Y + #define ESP_PANEL_LCD_MIRROR_Y CONFIG_ESP_PANEL_LCD_MIRROR_Y + #endif + #endif + #ifndef ESP_PANEL_LCD_IO_RST + #ifdef CONFIG_ESP_PANEL_LCD_IO_RST + #define ESP_PANEL_LCD_IO_RST CONFIG_ESP_PANEL_LCD_IO_RST + #else + #error "Missing configuration: ESP_PANEL_LCD_IO_RST" + #endif + #endif + #ifndef ESP_PANEL_LCD_RST_LEVEL + #ifdef CONFIG_ESP_PANEL_LCD_RST_LEVEL + #define ESP_PANEL_LCD_RST_LEVEL CONFIG_ESP_PANEL_LCD_RST_LEVEL + #else + #define ESP_PANEL_LCD_RST_LEVEL 0 + #endif + #endif + #endif /* ESP_PANEL_USE_LCD */ + + #ifndef ESP_PANEL_USE_TOUCH + #ifdef CONFIG_ESP_PANEL_USE_TOUCH + #define ESP_PANEL_USE_TOUCH CONFIG_ESP_PANEL_USE_TOUCH + #else + #define ESP_PANEL_USE_TOUCH 0 + #endif + #endif + // LCD Touch + #if ESP_PANEL_USE_TOUCH + // Controller + #ifndef ESP_PANEL_TOUCH_CONTROLLER_CST816S + #ifdef CONFIG_ESP_PANEL_TOUCH_CONTROLLER_CST816S + #define ESP_PANEL_TOUCH_NAME CST816S + #endif + #endif + #ifndef ESP_PANEL_TOUCH_CONTROLLER_FT5x06 + #ifdef CONFIG_ESP_PANEL_TOUCH_CONTROLLER_FT5X06 + #define ESP_PANEL_TOUCH_NAME FT5X06 + #endif + #endif + #ifndef ESP_PANEL_TOUCH_CONTROLLER_GT911 + #ifdef CONFIG_ESP_PANEL_TOUCH_CONTROLLER_GT911 + #define ESP_PANEL_TOUCH_NAME GT911 + #endif + #endif + #ifndef ESP_PANEL_TOUCH_CONTROLLER_GT1151 + #ifdef CONFIG_ESP_PANEL_TOUCH_CONTROLLER_GT1151 + #define ESP_PANEL_TOUCH_NAME GT1151 + #endif + #endif + #ifndef ESP_PANEL_TOUCH_CONTROLLER_ST1633 + #ifdef CONFIG_ESP_PANEL_TOUCH_CONTROLLER_ST1633 + #define ESP_PANEL_TOUCH_NAME ST1633 + #endif + #endif + #ifndef ESP_PANEL_TOUCH_CONTROLLER_ST7123 + #ifdef CONFIG_ESP_PANEL_TOUCH_CONTROLLER_ST7123 + #define ESP_PANEL_TOUCH_NAME ST7123 + #endif + #endif + #ifndef ESP_PANEL_TOUCH_CONTROLLER_TT21100 + #ifdef CONFIG_ESP_PANEL_TOUCH_CONTROLLER_TT21100 + #define ESP_PANEL_TOUCH_NAME TT21100 + #endif + #endif + #ifndef ESP_PANEL_TOUCH_CONTROLLER_STMPE610 + #ifdef CONFIG_ESP_PANEL_TOUCH_CONTROLLER_STMPE610 + #define ESP_PANEL_TOUCH_NAME STMPE610 + #endif + #endif + #ifndef ESP_PANEL_TOUCH_NAME + #error "Missing configuration: ESP_PANEL_TOUCH_NAME" + #endif + // Resolution + #ifndef ESP_PANEL_TOUCH_H_RES + #ifdef CONFIG_ESP_PANEL_TOUCH_H_RES + #define ESP_PANEL_TOUCH_H_RES CONFIG_ESP_PANEL_TOUCH_H_RES + #else + #error "Missing configuration: ESP_PANEL_TOUCH_H_RES" + #endif + #endif + #ifndef ESP_PANEL_TOUCH_V_RES + #ifdef CONFIG_ESP_PANEL_TOUCH_V_RES + #define ESP_PANEL_TOUCH_V_RES CONFIG_ESP_PANEL_TOUCH_V_RES + #else + #error "Missing configuration: ESP_PANEL_TOUCH_V_RES" + #endif + #endif + // Bus Settings + #ifndef ESP_PANEL_TOUCH_BUS_SKIP_INIT_HOST + #ifdef CONFIG_ESP_PANEL_TOUCH_BUS_SKIP_INIT_HOST + #define ESP_PANEL_TOUCH_BUS_SKIP_INIT_HOST CONFIG_ESP_PANEL_TOUCH_BUS_SKIP_INIT_HOST + #else + #define ESP_PANEL_TOUCH_BUS_SKIP_INIT_HOST 0 + #endif + #endif + #ifndef ESP_PANEL_TOUCH_BUS_TYPE + #ifdef CONFIG_ESP_PANEL_TOUCH_BUS_TYPE + #define ESP_PANEL_TOUCH_BUS_TYPE CONFIG_ESP_PANEL_TOUCH_BUS_TYPE + #else + #error "Missing configuration: ESP_PANEL_TOUCH_BUS_TYPE" + #endif + #endif + #if ESP_PANEL_TOUCH_BUS_TYPE == ESP_PANEL_BUS_TYPE_I2C + // I2C Bus + #ifndef ESP_PANEL_TOUCH_BUS_HOST_ID + #ifdef CONFIG_ESP_PANEL_TOUCH_BUS_HOST_ID + #define ESP_PANEL_TOUCH_BUS_HOST_ID CONFIG_ESP_PANEL_TOUCH_BUS_HOST_ID + #else + #error "Missing configuration: ESP_PANEL_TOUCH_BUS_HOST_ID" + #endif + #endif + #ifndef ESP_PANEL_TOUCH_I2C_ADDRESS + #ifdef CONFIG_ESP_PANEL_TOUCH_I2C_ADDRESS + #define ESP_PANEL_TOUCH_I2C_ADDRESS CONFIG_ESP_PANEL_TOUCH_I2C_ADDRESS + #else + #error "Missing configuration: ESP_PANEL_TOUCH_I2C_ADDRESS" + #endif + #endif + #ifndef ESP_PANEL_TOUCH_I2C_CLK_HZ + #ifdef CONFIG_ESP_PANEL_TOUCH_I2C_CLK_HZ + #define ESP_PANEL_TOUCH_I2C_CLK_HZ CONFIG_ESP_PANEL_TOUCH_I2C_CLK_HZ + #else + #error "Missing configuration: ESP_PANEL_TOUCH_I2C_CLK_HZ" + #endif + #endif + #ifndef ESP_PANEL_TOUCH_I2C_SCL_PULLUP + #ifdef CONFIG_ESP_PANEL_TOUCH_I2C_SCL_PULLUP + #define ESP_PANEL_TOUCH_I2C_SCL_PULLUP CONFIG_ESP_PANEL_TOUCH_I2C_SCL_PULLUP + #else + #define ESP_PANEL_TOUCH_I2C_SCL_PULLUP 0 + #endif + #endif + #ifndef ESP_PANEL_TOUCH_I2C_SDA_PULLUP + #ifdef CONFIG_ESP_PANEL_TOUCH_I2C_SDA_PULLUP + #define ESP_PANEL_TOUCH_I2C_SDA_PULLUP CONFIG_ESP_PANEL_TOUCH_I2C_SDA_PULLUP + #else + #define ESP_PANEL_TOUCH_I2C_SDA_PULLUP 0 + #endif + #endif + #ifndef ESP_PANEL_TOUCH_I2C_IO_SCL + #ifdef CONFIG_ESP_PANEL_TOUCH_I2C_IO_SCL + #define ESP_PANEL_TOUCH_I2C_IO_SCL CONFIG_ESP_PANEL_TOUCH_I2C_IO_SCL + #else + #error "Missing configuration: ESP_PANEL_TOUCH_I2C_IO_SCL" + #endif + #endif + #ifndef ESP_PANEL_TOUCH_I2C_IO_SDA + #ifdef CONFIG_ESP_PANEL_TOUCH_I2C_IO_SDA + #define ESP_PANEL_TOUCH_I2C_IO_SDA CONFIG_ESP_PANEL_TOUCH_I2C_IO_SDA + #else + #error "Missing configuration: ESP_PANEL_TOUCH_I2C_IO_SDA" + #endif + #endif + #elif ESP_PANEL_TOUCH_BUS_TYPE == ESP_PANEL_BUS_TYPE_SPI + #ifndef ESP_PANEL_TOUCH_BUS_HOST_ID + #ifdef CONFIG_ESP_PANEL_TOUCH_BUS_HOST_ID + #define ESP_PANEL_TOUCH_BUS_HOST_ID CONFIG_ESP_PANEL_TOUCH_BUS_HOST_ID + #else + #error "Missing configuration: ESP_PANEL_TOUCH_BUS_HOST_ID" + #endif + #endif + #ifndef ESP_PANEL_TOUCH_SPI_IO_CS + #ifdef CONFIG_ESP_PANEL_TOUCH_SPI_IO_CS + #define ESP_PANEL_TOUCH_SPI_IO_CS CONFIG_ESP_PANEL_TOUCH_SPI_IO_CS + #else + #error "Missing configuration: ESP_PANEL_TOUCH_SPI_IO_CS" + #endif + #endif + #ifndef ESP_PANEL_TOUCH_SPI_IO_SCK + #ifdef CONFIG_ESP_PANEL_TOUCH_SPI_IO_SCK + #define ESP_PANEL_TOUCH_SPI_IO_SCK CONFIG_ESP_PANEL_TOUCH_SPI_IO_SCK + #else + #error "Missing configuration: ESP_PANEL_TOUCH_SPI_IO_SCK" + #endif + #endif + #ifndef ESP_PANEL_TOUCH_SPI_IO_MOSI + #ifdef CONFIG_ESP_PANEL_TOUCH_SPI_IO_MOSI + #define ESP_PANEL_TOUCH_SPI_IO_MOSI CONFIG_ESP_PANEL_TOUCH_SPI_IO_MOSI + #else + #error "Missing configuration: ESP_PANEL_TOUCH_SPI_IO_MOSI" + #endif + #endif + #ifndef ESP_PANEL_TOUCH_SPI_IO_MISO + #ifdef CONFIG_ESP_PANEL_TOUCH_SPI_IO_MISO + #define ESP_PANEL_TOUCH_SPI_IO_MISO CONFIG_ESP_PANEL_TOUCH_SPI_IO_MISO + #else + #error "Missing configuration: ESP_PANEL_TOUCH_SPI_IO_MISO" + #endif + #endif + #else + #error "Invalid configuration: ESP_PANEL_TOUCH_BUS_TYPE" + #endif /* ESP_PANEL_TOUCH_BUS_TYPE */ + // Transformation Settings + #ifndef ESP_PANEL_TOUCH_SWAP_XY + #ifdef CONFIG_ESP_PANEL_TOUCH_SWAP_XY + #define ESP_PANEL_TOUCH_SWAP_XY CONFIG_ESP_PANEL_TOUCH_SWAP_XY + #endif + #endif + #ifndef ESP_PANEL_TOUCH_MIRROR_X + #ifdef CONFIG_ESP_PANEL_TOUCH_MIRROR_X + #define ESP_PANEL_TOUCH_MIRROR_X CONFIG_ESP_PANEL_TOUCH_MIRROR_X + #endif + #endif + #ifndef ESP_PANEL_TOUCH_MIRROR_Y + #ifdef CONFIG_ESP_PANEL_TOUCH_MIRROR_Y + #define ESP_PANEL_TOUCH_MIRROR_Y CONFIG_ESP_PANEL_TOUCH_MIRROR_Y + #endif + #endif + #ifndef ESP_PANEL_TOUCH_IO_RST + #ifdef CONFIG_ESP_PANEL_TOUCH_IO_RST + #define ESP_PANEL_TOUCH_IO_RST CONFIG_ESP_PANEL_TOUCH_IO_RST + #else + #error "Missing configuration: ESP_PANEL_TOUCH_IO_RST" + #endif + #endif + #ifndef ESP_PANEL_TOUCH_RST_LEVEL + #ifdef CONFIG_ESP_PANEL_TOUCH_RST_LEVEL + #define ESP_PANEL_TOUCH_RST_LEVEL CONFIG_ESP_PANEL_TOUCH_RST_LEVEL + #else + #define ESP_PANEL_TOUCH_RST_LEVEL 0 + #endif + #endif + #ifndef ESP_PANEL_TOUCH_IO_INT + #ifdef CONFIG_ESP_PANEL_TOUCH_IO_INT + #define ESP_PANEL_TOUCH_IO_INT CONFIG_ESP_PANEL_TOUCH_IO_INT + #else + #error "Missing configuration: ESP_PANEL_TOUCH_IO_INT" + #endif + #endif + #ifndef ESP_PANEL_TOUCH_INT_LEVEL + #ifdef CONFIG_ESP_PANEL_TOUCH_INT_LEVEL + #define ESP_PANEL_TOUCH_INT_LEVEL CONFIG_ESP_PANEL_TOUCH_INT_LEVEL + #else + #define ESP_PANEL_TOUCH_INT_LEVEL 0 + #endif + #endif + #endif /* ESP_PANEL_USE_TOUCH */ + + // Backlight + #ifndef ESP_PANEL_USE_BACKLIGHT + #ifdef CONFIG_ESP_PANEL_USE_BACKLIGHT + #define ESP_PANEL_USE_BACKLIGHT CONFIG_ESP_PANEL_USE_BACKLIGHT + #else + #define ESP_PANEL_USE_BACKLIGHT 0 + #endif + #endif + #if ESP_PANEL_USE_BACKLIGHT + #ifndef ESP_PANEL_BACKLIGHT_IO + #ifdef CONFIG_ESP_PANEL_BACKLIGHT_IO + #define ESP_PANEL_BACKLIGHT_IO CONFIG_ESP_PANEL_BACKLIGHT_IO + #else + #error "Missing configuration: ESP_PANEL_BACKLIGHT_IO" + #endif + #endif + #ifndef ESP_PANEL_BACKLIGHT_ON_LEVEL + #ifdef CONFIG_ESP_PANEL_BACKLIGHT_ON_LEVEL + #define ESP_PANEL_BACKLIGHT_ON_LEVEL CONFIG_ESP_PANEL_BACKLIGHT_ON_LEVEL + #else + #define ESP_PANEL_BACKLIGHT_ON_LEVEL 1 + #endif + #endif + #ifndef ESP_PANEL_BACKLIGHT_IDLE_OFF + #ifdef CONFIG_ESP_PANEL_BACKLIGHT_IDLE_OFF + #define ESP_PANEL_BACKLIGHT_IDLE_OFF CONFIG_ESP_PANEL_BACKLIGHT_IDLE_OFF + #else + #define ESP_PANEL_BACKLIGHT_IDLE_OFF 0 + #endif + #endif + #endif /* ESP_PANEL_USE_BACKLIGHT */ + + // IO Expander + #ifndef ESP_PANEL_USE_EXPANDER + #ifdef CONFIG_ESP_PANEL_USE_EXPANDER + #define ESP_PANEL_USE_EXPANDER CONFIG_ESP_PANEL_USE_EXPANDER + #else + #define ESP_PANEL_USE_EXPANDER 0 + #endif + #endif + #if ESP_PANEL_USE_EXPANDER + // CHIP + #ifndef ESP_PANEL_EXPANDER_CHIP_CH422G + #ifdef CONFIG_ESP_PANEL_EXPANDER_CHIP_CH422G + #define ESP_PANEL_EXPANDER_CHIP_NAME CH422G + #endif + #endif + #ifndef ESP_PANEL_EXPANDER_CHIP_HT8574 + #ifdef CONFIG_ESP_PANEL_EXPANDER_CHIP_HT8574 + #define ESP_PANEL_EXPANDER_CHIP_NAME HT8574 + #endif + #endif + #ifndef ESP_PANEL_EXPANDER_CHIP_TCA95xx_8bit + #ifdef CONFIG_ESP_PANEL_EXPANDER_CHIP_TCA95xx_8bit + #define ESP_PANEL_EXPANDER_CHIP_NAME TCA95xx_8bit + #endif + #endif + #ifndef ESP_PANEL_EXPANDER_TYPE_TCA95xx_16bit + #ifdef CONFIG_ESP_PANEL_EXPANDER_CHIP_TCA95xx_16bit + #define ESP_PANEL_EXPANDER_CHIP_NAME TCA95xx_16bit + #endif + #endif + #ifndef ESP_PANEL_EXPANDER_SKIP_INIT_HOST + #ifdef CONFIG_ESP_PANEL_EXPANDER_SKIP_INIT_HOST + #define ESP_PANEL_EXPANDER_SKIP_INIT_HOST CONFIG_ESP_PANEL_EXPANDER_SKIP_INIT_HOST + #else + #define ESP_PANEL_EXPANDER_SKIP_INIT_HOST 0 + #endif + #endif + // Bus Settings + #ifndef ESP_PANEL_EXPANDER_HOST_ID + #ifdef CONFIG_ESP_PANEL_EXPANDER_HOST_ID + #define ESP_PANEL_EXPANDER_HOST_ID CONFIG_ESP_PANEL_EXPANDER_HOST_ID + #else + #error "Missing configuration: ESP_PANEL_EXPANDER_HOST_ID" + #endif + #endif + #ifndef ESP_PANEL_EXPANDER_I2C_ADDRESS + #ifdef CONFIG_ESP_PANEL_EXPANDER_I2C_ADDRESS + #define ESP_PANEL_EXPANDER_I2C_ADDRESS CONFIG_ESP_PANEL_EXPANDER_I2C_ADDRESS + #else + #error "Missing configuration: ESP_PANEL_EXPANDER_I2C_ADDRESS" + #endif + #endif + #ifndef ESP_PANEL_EXPANDER_I2C_CLK_HZ + #ifdef CONFIG_ESP_PANEL_EXPANDER_I2C_CLK_HZ + #define ESP_PANEL_EXPANDER_I2C_CLK_HZ CONFIG_ESP_PANEL_EXPANDER_I2C_CLK_HZ + #else + #error "Missing configuration: ESP_PANEL_EXPANDER_I2C_CLK_HZ" + #endif + #endif + #ifndef ESP_PANEL_EXPANDER_I2C_SCL_PULLUP + #ifdef CONFIG_ESP_PANEL_EXPANDER_I2C_SCL_PULLUP + #define ESP_PANEL_EXPANDER_I2C_SCL_PULLUP CONFIG_ESP_PANEL_EXPANDER_I2C_SCL_PULLUP + #else + #define ESP_PANEL_EXPANDER_I2C_SCL_PULLUP 0 + #endif + #endif + #ifndef ESP_PANEL_EXPANDER_I2C_SDA_PULLUP + #ifdef CONFIG_ESP_PANEL_EXPANDER_I2C_SDA_PULLUP + #define ESP_PANEL_EXPANDER_I2C_SDA_PULLUP CONFIG_ESP_PANEL_EXPANDER_I2C_SDA_PULLUP + #else + #define ESP_PANEL_EXPANDER_I2C_SDA_PULLUP 0 + #endif + #endif + #ifndef ESP_PANEL_EXPANDER_I2C_IO_SCL + #ifdef CONFIG_ESP_PANEL_EXPANDER_I2C_IO_SCL + #define ESP_PANEL_EXPANDER_I2C_IO_SCL CONFIG_ESP_PANEL_EXPANDER_I2C_IO_SCL + #else + #error "Missing configuration: ESP_PANEL_EXPANDER_I2C_IO_SCL" + #endif + #endif + #ifndef ESP_PANEL_EXPANDER_I2C_IO_SDA + #ifdef CONFIG_ESP_PANEL_EXPANDER_I2C_IO_SDA + #define ESP_PANEL_EXPANDER_I2C_IO_SDA CONFIG_ESP_PANEL_EXPANDER_I2C_IO_SDA + #else + #error "Missing configuration: ESP_PANEL_EXPANDER_I2C_IO_SDA" + #endif + #endif + #endif /* ESP_PANEL_USE_EXPANDER */ +#endif /* ESP_PANEL_USE_CUSTOM_BOARD */ + +// *INDENT-OFF* diff --git a/src/ESP_Panel_Conf_Internal.h b/src/ESP_Panel_Conf_Internal.h index d45f004c..e446e10b 100644 --- a/src/ESP_Panel_Conf_Internal.h +++ b/src/ESP_Panel_Conf_Internal.h @@ -11,11 +11,12 @@ /* Handle special Kconfig options */ #ifndef ESP_PANEL_KCONFIG_IGNORE #include "sdkconfig.h" - #ifdef CONFIG_ESP_PANEL_CONF_SKIP - #define ESP_PANEL_CONF_SKIP + #ifdef CONFIG_ESP_PANEL_CONF_FILE_SKIP + #define ESP_PANEL_CONF_FILE_SKIP #endif #endif +#ifndef ESP_PANEL_CONF_FILE_SKIP /* If "ESP_Panel_Conf.h" is available from here, try to use it later */ #ifdef __has_include #if __has_include("ESP_Panel_Conf.h") @@ -30,9 +31,11 @@ #define ESP_PANEL_CONF_INCLUDE_INSIDE #endif #endif +#else +#endif /* If "ESP_Panel_Conf.h" is not skipped, include it */ -#ifndef ESP_PANEL_CONF_SKIP +#ifndef ESP_PANEL_CONF_FILE_SKIP #ifdef ESP_PANEL_CONF_PATH /* If there is a path defined for "ESP_Panel_Conf.h" use it */ #define __TO_STR_AUX(x) #x #define __TO_STR(x) __TO_STR_AUX(x) @@ -49,72 +52,13 @@ #endif #ifndef ESP_PANEL_CONF_INCLUDE_INSIDE -/* Supplement macro definitions based on sdkconfig, use default values if not defined */ -/*-------------------------------- Debug configurations --------------------------------*/ -#ifndef ESP_PANEL_CHECK_RESULT_ASSERT - #ifdef CONFIG_ESP_PANEL_CHECK_RESULT_ASSERT - #define ESP_PANEL_CHECK_RESULT_ASSERT CONFIG_ESP_PANEL_CHECK_RESULT_ASSERT - #else - #define ESP_PANEL_CHECK_RESULT_ASSERT (0) - #endif -#endif -#ifndef ESP_PANEL_ENABLE_LOG - #ifdef CONFIG_ESP_PANEL_ENABLE_LOG - #define ESP_PANEL_ENABLE_LOG CONFIG_ESP_PANEL_ENABLE_LOG - #else - #define ESP_PANEL_ENABLE_LOG (0) - #endif -#endif -/*----------------------------- Touch driver configurations -----------------------------*/ -#ifndef ESP_PANEL_TOUCH_MAX_POINTS - #ifdef CONFIG_ESP_PANEL_TOUCH_MAX_POINTS - #define ESP_PANEL_TOUCH_MAX_POINTS CONFIG_ESP_PANEL_TOUCH_MAX_POINTS - #else - #define ESP_PANEL_TOUCH_MAX_POINTS (5) - #endif -#endif -#ifndef ESP_PANEL_TOUCH_MAX_BUTTONS - #ifdef CONFIG_ESP_PANEL_TOUCH_MAX_BUTTONS - #define ESP_PANEL_TOUCH_MAX_BUTTONS CONFIG_ESP_PANEL_TOUCH_MAX_BUTTONS - #else - #define ESP_PANEL_TOUCH_MAX_BUTTONS (1) - #endif -#endif -#ifndef ESP_PANEL_TOUCH_XPT2046_Z_THRESHOLD - #ifdef CONFIG_ESP_PANEL_TOUCH_XPT2046_Z_THRESHOLD - #define ESP_PANEL_TOUCH_XPT2046_Z_THRESHOLD CONFIG_ESP_PANEL_TOUCH_XPT2046_Z_THRESHOLD - #else - #define ESP_PANEL_TOUCH_XPT2046_Z_THRESHOLD (400) - #endif -#endif -#ifndef ESP_PANEL_TOUCH_XPT2046_INTERRUPT_MODE - #ifdef CONFIG_ESP_PANEL_TOUCH_XPT2046_INTERRUPT_MODE - #define ESP_PANEL_TOUCH_XPT2046_INTERRUPT_MODE CONFIG_ESP_PANEL_TOUCH_XPT2046_INTERRUPT_MODE - #else - #define ESP_PANEL_TOUCH_XPT2046_INTERRUPT_MODE (0) - #endif -#endif -#ifndef ESP_PANEL_TOUCH_XPT2046_VREF_ON_MODE - #ifdef CONFIG_ESP_PANEL_TOUCH_XPT2046_VREF_ON_MODE - #define ESP_PANEL_TOUCH_XPT2046_VREF_ON_MODE CONFIG_ESP_PANEL_TOUCH_XPT2046_VREF_ON_MODE - #else - #define ESP_PANEL_TOUCH_XPT2046_VREF_ON_MODE (0) - #endif -#endif -#ifndef ESP_PANEL_TOUCH_XPT2046_CONVERT_ADC_TO_COORDS - #ifdef CONFIG_ESP_PANEL_TOUCH_XPT2046_CONVERT_ADC_TO_COORDS - #define ESP_PANEL_TOUCH_XPT2046_CONVERT_ADC_TO_COORDS CONFIG_ESP_PANEL_TOUCH_XPT2046_CONVERT_ADC_TO_COORDS - #else - #define ESP_PANEL_TOUCH_XPT2046_CONVERT_ADC_TO_COORDS (1) - #endif -#endif -#ifndef ESP_PANEL_TOUCH_XPT2046_ENABLE_LOCKING - #ifdef CONFIG_ESP_PANEL_TOUCH_XPT2046_ENABLE_LOCKING - #define ESP_PANEL_TOUCH_XPT2046_ENABLE_LOCKING CONFIG_ESP_PANEL_TOUCH_XPT2046_ENABLE_LOCKING - #else - #define ESP_PANEL_TOUCH_XPT2046_ENABLE_LOCKING (1) - #endif -#endif + /** + * There are two purposes to include the this file: + * 1. Convert configuration items starting with `CONFIG_` to the required configuration items. + * 2. Define default values for configuration items that are not defined to keep compatibility. + * + */ + #include "ESP_Panel_Conf_Kconfig.h" #endif // *INDENT-OFF* diff --git a/src/ESP_Panel_Conf_Kconfig.h b/src/ESP_Panel_Conf_Kconfig.h new file mode 100644 index 00000000..2d233856 --- /dev/null +++ b/src/ESP_Panel_Conf_Kconfig.h @@ -0,0 +1,71 @@ +/* + * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +/*----------------------------- General configurations -----------------------------*/ +#ifndef ESP_PANEL_CHECK_RESULT_ASSERT +#ifdef CONFIG_ESP_PANEL_CHECK_RESULT_ASSERT +#define ESP_PANEL_CHECK_RESULT_ASSERT CONFIG_ESP_PANEL_CHECK_RESULT_ASSERT +#else +#define ESP_PANEL_CHECK_RESULT_ASSERT (0) +#endif +#endif +#ifndef ESP_PANEL_ENABLE_LOG +#ifdef CONFIG_ESP_PANEL_ENABLE_LOG +#define ESP_PANEL_ENABLE_LOG CONFIG_ESP_PANEL_ENABLE_LOG +#else +#define ESP_PANEL_ENABLE_LOG (0) +#endif +#endif + +/*----------------------------- Touch driver configurations -----------------------------*/ +#ifndef ESP_PANEL_TOUCH_MAX_POINTS +#ifdef CONFIG_ESP_PANEL_TOUCH_MAX_POINTS +#define ESP_PANEL_TOUCH_MAX_POINTS CONFIG_ESP_PANEL_TOUCH_MAX_POINTS +#else +#define ESP_PANEL_TOUCH_MAX_POINTS (5) +#endif +#endif +#ifndef ESP_PANEL_TOUCH_MAX_BUTTONS +#ifdef CONFIG_ESP_PANEL_TOUCH_MAX_BUTTONS +#define ESP_PANEL_TOUCH_MAX_BUTTONS CONFIG_ESP_PANEL_TOUCH_MAX_BUTTONS +#else +#define ESP_PANEL_TOUCH_MAX_BUTTONS (1) +#endif +#endif +#ifndef ESP_PANEL_TOUCH_XPT2046_Z_THRESHOLD +#ifdef CONFIG_ESP_PANEL_TOUCH_XPT2046_Z_THRESHOLD +#define ESP_PANEL_TOUCH_XPT2046_Z_THRESHOLD CONFIG_ESP_PANEL_TOUCH_XPT2046_Z_THRESHOLD +#else +#define ESP_PANEL_TOUCH_XPT2046_Z_THRESHOLD (400) +#endif +#endif +#ifndef ESP_PANEL_TOUCH_XPT2046_INTERRUPT_MODE +#ifdef CONFIG_ESP_PANEL_TOUCH_XPT2046_INTERRUPT_MODE +#define ESP_PANEL_TOUCH_XPT2046_INTERRUPT_MODE CONFIG_ESP_PANEL_TOUCH_XPT2046_INTERRUPT_MODE +#else +#define ESP_PANEL_TOUCH_XPT2046_INTERRUPT_MODE (0) +#endif +#endif +#ifndef ESP_PANEL_TOUCH_XPT2046_VREF_ON_MODE +#ifdef CONFIG_ESP_PANEL_TOUCH_XPT2046_VREF_ON_MODE +#define ESP_PANEL_TOUCH_XPT2046_VREF_ON_MODE CONFIG_ESP_PANEL_TOUCH_XPT2046_VREF_ON_MODE +#else +#define ESP_PANEL_TOUCH_XPT2046_VREF_ON_MODE (0) +#endif +#endif +#ifndef ESP_PANEL_TOUCH_XPT2046_CONVERT_ADC_TO_COORDS +#ifdef CONFIG_ESP_PANEL_TOUCH_XPT2046_CONVERT_ADC_TO_COORDS +#define ESP_PANEL_TOUCH_XPT2046_CONVERT_ADC_TO_COORDS CONFIG_ESP_PANEL_TOUCH_XPT2046_CONVERT_ADC_TO_COORDS +#else +#define ESP_PANEL_TOUCH_XPT2046_CONVERT_ADC_TO_COORDS (1) +#endif +#endif +#ifndef ESP_PANEL_TOUCH_XPT2046_ENABLE_LOCKING +#ifdef CONFIG_ESP_PANEL_TOUCH_XPT2046_ENABLE_LOCKING +#define ESP_PANEL_TOUCH_XPT2046_ENABLE_LOCKING CONFIG_ESP_PANEL_TOUCH_XPT2046_ENABLE_LOCKING +#else +#define ESP_PANEL_TOUCH_XPT2046_ENABLE_LOCKING (1) +#endif +#endif diff --git a/src/ESP_Panel_Library.h b/src/ESP_Panel_Library.h index a602f15b..23d72bd0 100644 --- a/src/ESP_Panel_Library.h +++ b/src/ESP_Panel_Library.h @@ -29,6 +29,7 @@ #include "lcd/GC9A01.h" #include "lcd/GC9B71.h" #include "lcd/ILI9341.h" +#include "lcd/NV3022B.h" #include "lcd/SH8601.h" #include "lcd/SPD2010.h" #include "lcd/ST7262.h" diff --git a/src/backlight/Kconfig.in b/src/backlight/Kconfig.in new file mode 100644 index 00000000..a9e53baa --- /dev/null +++ b/src/backlight/Kconfig.in @@ -0,0 +1,20 @@ +menu "Backlight" + config ESP_PANEL_BACKLIGHT_IO + int "Pin num" + default 45 + range 0 100 + + config ESP_PANEL_BACKLIGHT_ON_LEVEL + bool "The level to turn on" + default y + + config ESP_PANEL_BACKLIGHT_IDLE_OFF + bool "Turn off after initializing the panel" + default n + help + Set to 1 if you want to turn off the backlight after initializing the panel; otherwise, set it to turn on + + config ESP_PANEL_LCD_BL_USE_PWM + bool "Use PWM to control the brightness" + default y +endmenu diff --git a/src/board/Kconfig.board b/src/board/Kconfig.board new file mode 100644 index 00000000..18a2a9d1 --- /dev/null +++ b/src/board/Kconfig.board @@ -0,0 +1,25 @@ +menu "Board" + choice + prompt "Select the board type" + default ESP_PANEL_USE_SUPPORTED_BOARD + + config ESP_PANEL_USE_SUPPORTED_BOARD + bool "Supported board" + help + Enable this option if you are using a supported board. + + config ESP_PANEL_USE_CUSTOM_BOARD + bool "Custom board" + help + Select this option if you are using a custom board. + endchoice + + if ESP_PANEL_USE_SUPPORTED_BOARD + orsource "./Kconfig.board_supported" + endif + + if ESP_PANEL_USE_CUSTOM_BOARD + orsource "./Kconfig.board_custom" + endif + +endmenu diff --git a/src/board/Kconfig.board_custom b/src/board/Kconfig.board_custom new file mode 100644 index 00000000..cb0298aa --- /dev/null +++ b/src/board/Kconfig.board_custom @@ -0,0 +1,803 @@ +menu "Custom board configurations" + config ESP_PANEL_USE_LCD + bool "Use LCD" + default n + help + Enable this option if you are using a LCD. + + menu "LCD settings" + depends on ESP_PANEL_USE_LCD + choice + prompt "Controller" + default ESP_PANEL_LCD_CONTROLLER_ILI9341 + + config ESP_PANEL_LCD_CONTROLLER_EK9716B + bool "EK9716B" + + config ESP_PANEL_LCD_CONTROLLER_GC9A01 + bool "GC9A01" + + config ESP_PANEL_LCD_CONTROLLER_GC9B71 + bool "GC9B71" + + config ESP_PANEL_LCD_CONTROLLER_GC9503 + bool "GC9503" + + config ESP_PANEL_LCD_CONTROLLER_ILI9341 + bool "ILI9341" + + config ESP_PANEL_LCD_CONTROLLER_NV3022B + bool "NV3022B" + + config ESP_PANEL_LCD_CONTROLLER_SH8601 + bool "SH8601" + + config ESP_PANEL_LCD_CONTROLLER_SPD2010 + bool "SPD2010" + + config ESP_PANEL_LCD_CONTROLLER_ST7262 + bool "ST7262" + + config ESP_PANEL_LCD_CONTROLLER_ST7701 + bool "ST7701" + + config ESP_PANEL_LCD_CONTROLLER_ST7789 + bool "ST7789" + + config ESP_PANEL_LCD_CONTROLLER_ST7796 + bool "ST7796" + + config ESP_PANEL_LCD_CONTROLLER_ST77916 + bool "ST77916" + + config ESP_PANEL_LCD_CONTROLLER_ST77922 + bool "ST77922" + endchoice + + config ESP_PANEL_LCD_WIDTH + int "Pixels in width (horizontal resolution)" + default 320 + range 1 10000 + + config ESP_PANEL_LCD_HEIGHT + int "Pixels in height (vertical resolution)" + default 240 + range 1 10000 + + menu "Bus settings" + config ESP_PANEL_LCD_BUS_SKIP_INIT_HOST + bool "Skip to initialize bus host" + default n + help + If set to 1, the bus will skip to initialize the corresponding host. Users need to initialize the host in advance. It is useful if other devices use the same host. Please ensure that the host is initialized only once. Set to 1 if only the RGB interface is used without the 3-wire SPI interface, + + choice + prompt "Bus type" + default ESP_PANEL_LCD_BUS_TYPE_SPI + + config ESP_PANEL_LCD_BUS_TYPE_SPI + bool "SPI" + + config ESP_PANEL_LCD_BUS_TYPE_QSPI + bool "QSPI" + + config ESP_PANEL_LCD_BUS_TYPE_RGB + bool "RGB" + endchoice + + config ESP_PANEL_LCD_BUS_TYPE + int + default 1 if ESP_PANEL_LCD_BUS_TYPE_SPI + default 2 if ESP_PANEL_LCD_BUS_TYPE_QSPI + default 3 if ESP_PANEL_LCD_BUS_TYPE_RGB + + menu "SPI bus settings" + depends on ESP_PANEL_LCD_BUS_TYPE_SPI + + config ESP_PANEL_LCD_BUS_HOST_ID + int "SPI host ID" + default 1 + range 1 3 + + config ESP_PANEL_LCD_SPI_MODE + int "SPI mode" + default 0 + range 0 3 + + config ESP_PANEL_LCD_SPI_CLK_HZ + int "SPI clock frequency (Hz)" + default 40000000 + range 1 80000000 + + config ESP_PANEL_LCD_SPI_TRANS_QUEUE_SZ + int "SPI transaction queue size" + default 10 + range 1 100 + + config ESP_PANEL_LCD_SPI_CMD_BITS + int "SPI command bit length" + default 8 + range 0 32 + + config ESP_PANEL_LCD_SPI_PARAM_BITS + int "SPI parameter bit length" + default 8 + range 0 32 + + menu "Pins" + config ESP_PANEL_LCD_SPI_IO_CS + int "CS" + default 5 + range -1 100 + + config ESP_PANEL_LCD_SPI_IO_DC + int "DC (RS)" + default 4 + range 0 100 + + config ESP_PANEL_LCD_SPI_IO_SCK + depends on !ESP_PANEL_LCD_BUS_SKIP_INIT_HOST + int "SCLK (SCL)" + default 7 + range 0 100 + + config ESP_PANEL_LCD_SPI_IO_MOSI + depends on !ESP_PANEL_LCD_BUS_SKIP_INIT_HOST + int "MOSI (SDA)" + default 6 + range 0 100 + + config ESP_PANEL_LCD_SPI_IO_MISO + depends on !ESP_PANEL_LCD_BUS_SKIP_INIT_HOST + int "MISO (SDO)" + default -1 + range -1 100 + endmenu + endmenu + + menu "QSPI bus settings" + depends on ESP_PANEL_LCD_BUS_TYPE_QSPI + + config ESP_PANEL_LCD_BUS_HOST_ID + int "SPI host ID" + default 1 + range 1 3 + + config ESP_PANEL_LCD_SPI_MODE + int "SPI mode" + default 0 + range 0 3 + + config ESP_PANEL_LCD_SPI_CLK_HZ + int "SPI clock frequency (Hz)" + default 40000000 + range 1 80000000 + + config ESP_PANEL_LCD_SPI_TRANS_QUEUE_SZ + int "SPI transaction queue size" + default 10 + range 1 100 + + config ESP_PANEL_LCD_SPI_CMD_BITS + int "SPI command bit length" + default 32 + range 0 32 + + config ESP_PANEL_LCD_SPI_PARAM_BITS + int "SPI parameter bit length" + default 8 + range 0 32 + + menu "Pins" + config ESP_PANEL_LCD_SPI_IO_CS + int "CS" + default 5 + range -1 100 + + config ESP_PANEL_LCD_SPI_IO_SCK + depends on !ESP_PANEL_LCD_BUS_SKIP_INIT_HOST + int "SCLK (SCL)" + default 9 + range 0 100 + + config ESP_PANEL_LCD_SPI_IO_DATA0 + depends on !ESP_PANEL_LCD_BUS_SKIP_INIT_HOST + int "DATA0 (SDA)" + default 10 + range 0 100 + + config ESP_PANEL_LCD_SPI_IO_DATA1 + depends on !ESP_PANEL_LCD_BUS_SKIP_INIT_HOST + int "DATA1" + default 11 + range 0 100 + + config ESP_PANEL_LCD_SPI_IO_DATA2 + depends on !ESP_PANEL_LCD_BUS_SKIP_INIT_HOST + int "DATA2" + default 12 + range 0 100 + + config ESP_PANEL_LCD_SPI_IO_DATA3 + depends on !ESP_PANEL_LCD_BUS_SKIP_INIT_HOST + int "DATA3" + default 13 + range 0 100 + endmenu + endmenu + + menu "RGB bus settings" + depends on ESP_PANEL_LCD_BUS_TYPE_RGB + + menu "3-wire SPI interface" + depends on !ESP_PANEL_LCD_BUS_SKIP_INIT_HOST + config ESP_PANEL_LCD_3WIRE_SPI_CS_USE_EXPNADER + bool "Use IO expander to control CS" + default n + + config ESP_PANEL_LCD_3WIRE_SPI_SCL_USE_EXPNADER + bool "Use IO expander to control SCL" + default n + + config ESP_PANEL_LCD_3WIRE_SPI_SDA_USE_EXPNADER + bool "Use IO expander to control SDA" + default n + + config ESP_PANEL_LCD_FLAGS_AUTO_DEL_PANEL_IO + bool "Auto delete panel IO instance" + default n + help + If set to 1, the panel IO instance will be deleted automatically when the panel is initialized. If the 3-wire SPI pins are sharing other pins of the RGB interface to save GPIOs, please set it to 1 to release the panel IO and its pins (except CS signal). + + config ESP_PANEL_LCD_FLAGS_MIRROR_BY_CMD + bool "Mirror by LCD command instead of software" + default n if ESP_PANEL_LCD_FLAGS_AUTO_DEL_PANEL_IO + default y if !ESP_PANEL_LCD_FLAGS_AUTO_DEL_PANEL_IO + help + if set to 1, the `mirror()` function will be implemented by LCD command (e.g. 36h) + + menu "Pins" + config ESP_PANEL_LCD_3WIRE_SPI_IO_CS + int "CS" + default 0 + range 0 100 + + config ESP_PANEL_LCD_3WIRE_SPI_IO_SCK + int "SCL" + default 1 + range 0 100 + + config ESP_PANEL_LCD_3WIRE_SPI_IO_SDA + int "SDA" + default 2 + range 0 100 + endmenu + endmenu + + menu "RGB interface" + config ESP_PANEL_LCD_RGB_CLK_HZ + int "RGB clock frequency (Hz)" + default 16000000 + range 1 40000000 + + config ESP_PANEL_LCD_RGB_HPW + int "HPW (Horizontal Pulse Width)" + default 10 + range 0 1000 + + config ESP_PANEL_LCD_RGB_HBP + int "HBP (Horizontal Back Porch)" + default 10 + range 1 1000 + + config ESP_PANEL_LCD_RGB_HFP + int "HFP (Horizontal Front Porch)" + default 20 + range 0 1000 + + config ESP_PANEL_LCD_RGB_VPW + int "VPW (Vertical Pulse Width)" + default 10 + range 0 1000 + + config ESP_PANEL_LCD_RGB_VBP + int "VBP (Vertical Back Porch)" + default 10 + range 0 1000 + + config ESP_PANEL_LCD_RGB_VFP + int "VFP (Vertical Front Porch)" + default 10 + range 0 1000 + + config ESP_PANEL_LCD_RGB_PCLK_ACTIVE_NEG + bool "PCLK active on the falling edge" + default n + + choice + prompt "Data width & pixel format" + default ESP_PANEL_LCD_RGB_DATA_WIDTH_16 + + config ESP_PANEL_LCD_RGB_DATA_WIDTH_8 + bool "8-bit & RGB888" + + config ESP_PANEL_LCD_RGB_DATA_WIDTH_16 + bool "16-bit & RGB565" + endchoice + + config ESP_PANEL_LCD_RGB_DATA_WIDTH + int + default 8 if ESP_PANEL_LCD_RGB_DATA_WIDTH_8 + default 16 if ESP_PANEL_LCD_RGB_DATA_WIDTH_16 + + config ESP_PANEL_LCD_RGB_PIXEL_BITS + int + default 24 if ESP_PANEL_LCD_RGB_DATA_WIDTH_8 + default 16 if ESP_PANEL_LCD_RGB_DATA_WIDTH_16 + + menu "Pins" + config ESP_PANEL_LCD_RGB_IO_HSYNC + int "HSYNC" + default 46 + range 0 100 + + config ESP_PANEL_LCD_RGB_IO_VSYNC + int "VSYNC" + default 3 + range 0 100 + + config ESP_PANEL_LCD_RGB_IO_DE + int "DE" + default 17 + range -1 100 + + config ESP_PANEL_LCD_RGB_IO_PCLK + int "PCLK" + default 9 + range 0 100 + + config ESP_PANEL_LCD_RGB_IO_DISP + int "DISP" + default -1 + range -1 100 + + config ESP_PANEL_LCD_RGB_IO_DATA0 + int "DATA0" + default 10 + range 0 100 + + config ESP_PANEL_LCD_RGB_IO_DATA1 + int "DATA1" + default 11 + range 0 100 + + config ESP_PANEL_LCD_RGB_IO_DATA2 + int "DATA2" + default 12 + range 0 100 + + config ESP_PANEL_LCD_RGB_IO_DATA3 + int "DATA3" + default 13 + range 0 100 + + config ESP_PANEL_LCD_RGB_IO_DATA4 + int "DATA4" + default 14 + range 0 100 + + config ESP_PANEL_LCD_RGB_IO_DATA5 + int "DATA5" + default 21 + range 0 100 + + config ESP_PANEL_LCD_RGB_IO_DATA6 + int "DATA6" + default 47 + range 0 100 + + config ESP_PANEL_LCD_RGB_IO_DATA7 + int "DATA7" + default 48 + range 0 100 + + config ESP_PANEL_LCD_RGB_IO_DATA8 + depends on ESP_PANEL_LCD_RGB_DATA_WIDTH_16 + int "DATA8" + default 45 + range 0 100 + + config ESP_PANEL_LCD_RGB_IO_DATA9 + depends on ESP_PANEL_LCD_RGB_DATA_WIDTH_16 + int "DATA9" + default 38 + range 0 100 + + config ESP_PANEL_LCD_RGB_IO_DATA10 + depends on ESP_PANEL_LCD_RGB_DATA_WIDTH_16 + int "DATA10" + default 39 + range 0 100 + + config ESP_PANEL_LCD_RGB_IO_DATA11 + depends on ESP_PANEL_LCD_RGB_DATA_WIDTH_16 + int "DATA11" + default 40 + range 0 100 + + config ESP_PANEL_LCD_RGB_IO_DATA12 + depends on ESP_PANEL_LCD_RGB_DATA_WIDTH_16 + int "DATA12" + default 41 + range 0 100 + + config ESP_PANEL_LCD_RGB_IO_DATA13 + depends on ESP_PANEL_LCD_RGB_DATA_WIDTH_16 + int "DATA13" + default 42 + range 0 100 + + config ESP_PANEL_LCD_RGB_IO_DATA14 + depends on ESP_PANEL_LCD_RGB_DATA_WIDTH_16 + int "DATA14" + default 2 + range 0 100 + + config ESP_PANEL_LCD_RGB_IO_DATA15 + depends on ESP_PANEL_LCD_RGB_DATA_WIDTH_16 + int "DATA15" + default 1 + range 0 100 + endmenu + endmenu + endmenu + endmenu + + menu "Color settings" + choice + prompt "Color bits" + default ESP_PANEL_LCD_COLOR_BITS_16 + + config ESP_PANEL_LCD_COLOR_BITS_8 + bool "8 bits" + + config ESP_PANEL_LCD_COLOR_BITS_16 + bool "16 bits" + endchoice + + config ESP_PANEL_LCD_COLOR_BITS + int + default 8 if ESP_PANEL_LCD_COLOR_BITS_8 + default 16 if ESP_PANEL_LCD_COLOR_BITS_16 + + choice + prompt "Color RGB element order" + default ESP_PANEL_LCD_COLOR_ORDER_RGB + + config ESP_PANEL_LCD_COLOR_ORDER_RGB + bool "RGB" + + config ESP_PANEL_LCD_COLOR_ORDER_BGR + bool "BGR" + endchoice + + config ESP_PANEL_LCD_BGR_ORDER + bool + default n if ESP_PANEL_LCD_COLOR_ORDER_RGB + default y if ESP_PANEL_LCD_COLOR_ORDER_BGR + + config ESP_PANEL_LCD_INEVRT_COLOR + bool "Invert color bit (0->1, 1->0)" + default n + endmenu + + menu "Transformation settings" + config ESP_PANEL_LCD_SWAP_XY + bool "Swap X and Y Axes" + default n + + config ESP_PANEL_LCD_MIRROR_X + bool "Mirror X Axes" + default n + + config ESP_PANEL_LCD_MIRROR_Y + bool "Mirror Y Axes" + default n + endmenu + + config ESP_PANEL_LCD_IO_RST + int "Reset pin" + default -1 + range -1 100 + + config ESP_PANEL_LCD_RST_LEVEL + depends on ESP_PANEL_LCD_IO_RST >= 0 + int "Reset level" + default 0 + range 0 1 + endmenu + + config ESP_PANEL_USE_TOUCH + bool "Use LCD touch" + default n + help + Enable this option if you are using a LCD touch. + + menu "LCD touch settings" + depends on ESP_PANEL_USE_TOUCH + choice + prompt "Controller" + default ESP_PANEL_TOUCH_CONTROLLER_TT21100 + + config ESP_PANEL_TOUCH_CONTROLLER_CST816S + bool "CST816S" + + config ESP_PANEL_TOUCH_CONTROLLER_FT5X06 + bool "FT5x06" + + config ESP_PANEL_TOUCH_CONTROLLER_GT911 + bool "GT911" + + config ESP_PANEL_TOUCH_CONTROLLER_GT1151 + bool "GT1151" + + config ESP_PANEL_TOUCH_CONTROLLER_ST1633 + bool "ST1633" + + config ESP_PANEL_TOUCH_CONTROLLER_ST7123 + bool "ST7123" + + config ESP_PANEL_TOUCH_CONTROLLER_TT21100 + bool "TT21100" + + config ESP_PANEL_TOUCH_CONTROLLER_STMPE610 + bool "STMPE610" + endchoice + + config ESP_PANEL_TOUCH_H_RES + int "Pixels in width (horizontal resolution)" + default ESP_PANEL_LCD_WIDTH if ESP_PANEL_USE_LCD + default 240 if !ESP_PANEL_USE_LCD + range 1 10000 + + config ESP_PANEL_TOUCH_V_RES + int "Pixels in height (vertical resolution)" + default ESP_PANEL_LCD_HEIGHT if ESP_PANEL_USE_LCD + default 240 if !ESP_PANEL_USE_LCD + range 1 10000 + + menu "Bus settings" + config ESP_PANEL_TOUCH_BUS_SKIP_INIT_HOST + bool "Skip to initialize bus host" + default n + help + If set to 1, the bus will skip to initialize the corresponding host. Users need to initialize the host in advance. It is useful if other devices use the same host. Please ensure that the host is initialized only once. Set to 1 if only the RGB interface is used without the 3-wire SPI interface, + + choice + prompt "Bus type" + default ESP_PANEL_TOUCH_BUS_TYPE_I2C + + config ESP_PANEL_TOUCH_BUS_TYPE_I2C + bool "I2C" + + config ESP_PANEL_TOUCH_BUS_TYPE_SPI + bool "SPI" + endchoice + + config ESP_PANEL_TOUCH_BUS_TYPE + int + default 1 if ESP_PANEL_TOUCH_BUS_TYPE_SPI + default 4 if ESP_PANEL_TOUCH_BUS_TYPE_I2C + + menu "I2C bus settings" + depends on ESP_PANEL_TOUCH_BUS_TYPE_I2C + + config ESP_PANEL_TOUCH_BUS_HOST_ID + int "I2C host ID" + default 0 + range 0 1 + + config ESP_PANEL_TOUCH_I2C_ADDRESS + int "I2C address (7-bit)" + default 0 + range 0 255 + help + 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 + + config ESP_PANEL_TOUCH_I2C_CLK_HZ + depends on !ESP_PANEL_TOUCH_BUS_SKIP_INIT_HOST + int "I2C clock frequency (Hz)" + default 400000 + range 1 400000 + + config ESP_PANEL_TOUCH_I2C_SCL_PULLUP + depends on !ESP_PANEL_TOUCH_BUS_SKIP_INIT_HOST + bool "Enable SCL Pull-up" + default y + + config ESP_PANEL_TOUCH_I2C_SDA_PULLUP + depends on !ESP_PANEL_TOUCH_BUS_SKIP_INIT_HOST + bool "Enable SDA Pull-up" + default y + + config ESP_PANEL_TOUCH_I2C_IO_SCL + depends on !ESP_PANEL_TOUCH_BUS_SKIP_INIT_HOST + int "SCL pin" + default 18 + range 0 100 + + config ESP_PANEL_TOUCH_I2C_IO_SDA + depends on !ESP_PANEL_TOUCH_BUS_SKIP_INIT_HOST + int "SDA pin" + default 8 + range 0 100 + endmenu + + menu "SPI bus settings" + depends on ESP_PANEL_TOUCH_BUS_TYPE_SPI + config ESP_PANEL_TOUCH_BUS_HOST_ID + int "SPI host ID" + default 1 + range 1 3 + + config ESP_PANEL_TOUCH_SPI_IO_CS + int "CS pin" + default 5 + range -1 100 + + config ESP_PANEL_TOUCH_SPI_IO_SCK + depends on !ESP_PANEL_TOUCH_BUS_SKIP_INIT_HOST + int "SCK (SCL) pin" + default 7 + range 0 100 + + config ESP_PANEL_TOUCH_SPI_IO_MOSI + depends on !ESP_PANEL_TOUCH_BUS_SKIP_INIT_HOST + int "MOSI (SDA) pin" + default 6 + range 0 100 + + config ESP_PANEL_TOUCH_SPI_IO_MISO + depends on !ESP_PANEL_TOUCH_BUS_SKIP_INIT_HOST + int "MISO (SDO) pin" + default 9 + range 0 100 + endmenu + endmenu + + menu "Transformation settings" + config ESP_PANEL_TOUCH_SWAP_XY + bool "Swap X and Y Axes" + default n + + config ESP_PANEL_TOUCH_MIRROR_X + bool "Mirror X Axes" + default n + + config ESP_PANEL_TOUCH_MIRROR_Y + bool "Mirror Y Axes" + default n + endmenu + + config ESP_PANEL_TOUCH_IO_RST + int "Reset pin" + default -1 + range -1 100 + + config ESP_PANEL_TOUCH_RST_LEVEL + depends on ESP_PANEL_TOUCH_IO_RST >= 0 + int "Reset level" + default 0 + range 0 1 + + config ESP_PANEL_TOUCH_IO_INT + int "Interrupt pin" + default -1 + range -1 100 + + config ESP_PANEL_TOUCH_INT_LEVEL + depends on ESP_PANEL_TOUCH_IO_INT >= 0 + int "Interrupt level" + default 0 + range 0 1 + endmenu + + config ESP_PANEL_USE_BACKLIGHT + bool "Use Backlight" + default n + help + Enable this option if you are using the backlight. + + menu "Backlight settings" + depends on ESP_PANEL_USE_BACKLIGHT + config ESP_PANEL_BACKLIGHT_IO + int "Pin" + default 45 + range 0 100 + + config ESP_PANEL_BACKLIGHT_ON_LEVEL + int "On level" + default 1 + range 0 1 + + config ESP_PANEL_BACKLIGHT_IDLE_OFF + bool "Idle off" + default n + help + Set to 1 if you want to turn off the backlight after initializing the panel; otherwise, set it to turn on. + endmenu + + config ESP_PANEL_USE_EXPANDER + bool "Use IO expander" + default n + help + Enable this option if you are using an IO expander. + + menu "IO expander settings" + depends on ESP_PANEL_USE_EXPANDER + choice + prompt "Chip" + default ESP_PANEL_EXPANDER_CHIP_TCA95xx_8bit + + config ESP_PANEL_EXPANDER_CHIP_CH422G + bool "CH422G" + + config ESP_PANEL_EXPANDER_CHIP_HT8574 + bool "HT8574" + + config ESP_PANEL_EXPANDER_CHIP_TCA95xx_8bit + bool "TCA95xx_8bit" + + config ESP_PANEL_EXPANDER_TYPE_TCA95xx_16bit + bool "TCA95xx_16bit" + endchoice + + config ESP_PANEL_EXPANDER_SKIP_INIT_HOST + bool "Skip to initialize bus host" + default n + help + If set to 1, the bus will skip to initialize the corresponding host. Users need to initialize the host in advance. It is useful if other devices use the same host. Please ensure that the host is initialized only once. Set to 1 if only the RGB interface is used without the 3-wire SPI interface, + + menu "I2C bus settings" + config ESP_PANEL_EXPANDER_HOST_ID + int "I2C host ID" + default 0 + range 0 1 + + config ESP_PANEL_EXPANDER_I2C_ADDRESS + int "I2C address (7-bit)" + default 0 + range 0 255 + help + 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. + + config ESP_PANEL_EXPANDER_I2C_CLK_HZ + depends on !ESP_PANEL_EXPANDER_BUS_SKIP_INIT_HOST + int "I2C clock frequency (Hz)" + default 400000 + range 1 400000 + + config ESP_PANEL_EXPANDER_I2C_SCL_PULLUP + depends on !ESP_PANEL_EXPANDER_BUS_SKIP_INIT_HOST + bool "Enable SCL Pull-up" + default y + + config ESP_PANEL_EXPANDER_I2C_SDA_PULLUP + depends on !ESP_PANEL_EXPANDER_BUS_SKIP_INIT_HOST + bool "Enable SDA Pull-up" + default y + + config ESP_PANEL_EXPANDER_I2C_IO_SCL + depends on !ESP_PANEL_EXPANDER_BUS_SKIP_INIT_HOST + int "SCL pin" + default 18 + range 0 100 + + config ESP_PANEL_EXPANDER_I2C_IO_SDA + depends on !ESP_PANEL_EXPANDER_BUS_SKIP_INIT_HOST + int "SDA pin" + default 8 + range 0 100 + endmenu + endmenu +endmenu diff --git a/src/board/Kconfig.board_supported b/src/board/Kconfig.board_supported new file mode 100644 index 00000000..9ec20df7 --- /dev/null +++ b/src/board/Kconfig.board_supported @@ -0,0 +1,60 @@ +menu "Supported board configurations" + choice + prompt "Select the manufacturer" + default BOARD_MANUFACTURER_ALL + + config BOARD_MANUFACTURER_ALL + bool "All" + help + Espressif, Elecrow, M5Stack, Shenzhen Jingcai Intelligent, Waveshare + + config BOARD_MANUFACTURER_ESPRESSIF + bool "Espressif" + help + https://www.espressif.com/en/products/devkits + + config BOARD_MANUFACTURER_ELECROW + bool "Elecrow" + help + https://www.elecrow.com + + config BOARD_MANUFACTURER_M5STACK + bool "M5Stack" + help + https://m5stack.com/ + + config BOARD_MANUFACTURER_JINGCAI + bool "Shenzhen Jingcai Intelligent" + help + https://www.displaysmodule.com/ + + config BOARD_MANUFACTURER_WAVESHARE + bool "Waveshare" + help + https://www.waveshare.com/ + endchoice + + choice + prompt "Select a target board" + + if BOARD_MANUFACTURER_ESPRESSIF || BOARD_MANUFACTURER_ALL + orsource "./espressif/Kconfig.espressif" + endif + + if BOARD_MANUFACTURER_ELECROW || BOARD_MANUFACTURER_ALL + orsource "./elecrow/Kconfig.elecrow" + endif + + if BOARD_MANUFACTURER_M5STACK || BOARD_MANUFACTURER_ALL + orsource "./m5stack/Kconfig.m5stack" + endif + + if BOARD_MANUFACTURER_JINGCAI || BOARD_MANUFACTURER_ALL + orsource "./jingcai/Kconfig.jingcai" + endif + + if BOARD_MANUFACTURER_WAVESHARE || BOARD_MANUFACTURER_ALL + orsource "./waveshare/Kconfig.waveshare" + endif + endchoice +endmenu diff --git a/src/board/elecrow/CROWPANEL_7_0.h b/src/board/elecrow/CROWPANEL_7_0.h index 98ff3f5e..46ba70a0 100644 --- a/src/board/elecrow/CROWPANEL_7_0.h +++ b/src/board/elecrow/CROWPANEL_7_0.h @@ -93,21 +93,23 @@ * * There are two formats for the sequence code: * 1. Raw data: {command, (uint8_t []){ data0, data1, ... }, data_size, delay_ms} - * 2. Formater: ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(delay_ms, command, { data0, data1, ... }) and + * 2. Formatter: ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(delay_ms, command, { data0, data1, ... }) and * ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(delay_ms, command) */ -// #define ESP_PANEL_LCD_VENDOR_INIT_CMD \ -// { \ -// {0xFF, (uint8_t []){0x77, 0x01, 0x00, 0x00, 0x10}, 5, 0}, \ -// {0xC0, (uint8_t []){0x3B, 0x00}, 2, 0}, \ -// {0xC1, (uint8_t []){0x0D, 0x02}, 2, 0}, \ -// {0x29, (uint8_t []){0x00}, 0, 120}, \ -// or \ -// ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xFF, {0x77, 0x01, 0x00, 0x00, 0x10}), \ -// ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC0, {0x3B, 0x00}), \ -// ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC1, {0x0D, 0x02}), \ -// ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(120, 0x29), \ -// } +/* +#define ESP_PANEL_LCD_VENDOR_INIT_CMD() \ + { \ + {0xFF, (uint8_t []){0x77, 0x01, 0x00, 0x00, 0x10}, 5, 0}, \ + {0xC0, (uint8_t []){0x3B, 0x00}, 2, 0}, \ + {0xC1, (uint8_t []){0x0D, 0x02}, 2, 0}, \ + {0x29, (uint8_t []){0x00}, 0, 120}, \ + or \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xFF, {0x77, 0x01, 0x00, 0x00, 0x10}), \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC0, {0x3B, 0x00}), \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC1, {0x0D, 0x02}), \ + ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(120, 0x29), \ + } +*/ /* LCD Color Settings */ /* LCD color depth in bits */ diff --git a/src/board/elecrow/Kconfig.elecrow b/src/board/elecrow/Kconfig.elecrow new file mode 100644 index 00000000..7f06eba4 --- /dev/null +++ b/src/board/elecrow/Kconfig.elecrow @@ -0,0 +1,4 @@ +config BOARD_ELECROW_CROWPANEL_7_0 + bool "ELECROW_CROWPANEL_7_0" + help + https://www.elecrow.com/esp32-display-7-inch-hmi-display-rgb-tft-lcd-touch-screen-support-lvgl.html diff --git a/src/board/espressif/ESP32_C3_LCDKIT.h b/src/board/espressif/ESP32_C3_LCDKIT.h index 0d51a199..99597d3f 100644 --- a/src/board/espressif/ESP32_C3_LCDKIT.h +++ b/src/board/espressif/ESP32_C3_LCDKIT.h @@ -69,21 +69,23 @@ * * There are two formats for the sequence code: * 1. Raw data: {command, (uint8_t []){ data0, data1, ... }, data_size, delay_ms} - * 2. Formater: ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(delay_ms, command, { data0, data1, ... }) and + * 2. Formatter: ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(delay_ms, command, { data0, data1, ... }) and * ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(delay_ms, command) */ -// #define ESP_PANEL_LCD_VENDOR_INIT_CMD \ -// { \ -// {0xFF, (uint8_t []){0x77, 0x01, 0x00, 0x00, 0x10}, 5, 0}, \ -// {0xC0, (uint8_t []){0x3B, 0x00}, 2, 0}, \ -// {0xC1, (uint8_t []){0x0D, 0x02}, 2, 0}, \ -// {0x29, (uint8_t []){0x00}, 0, 120}, \ -// or \ -// ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xFF, {0x77, 0x01, 0x00, 0x00, 0x10}), \ -// ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC0, {0x3B, 0x00}), \ -// ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC1, {0x0D, 0x02}), \ -// ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(120, 0x29), \ -// } +/* +#define ESP_PANEL_LCD_VENDOR_INIT_CMD \ + { \ + {0xFF, (uint8_t []){0x77, 0x01, 0x00, 0x00, 0x10}, 5, 0}, \ + {0xC0, (uint8_t []){0x3B, 0x00}, 2, 0}, \ + {0xC1, (uint8_t []){0x0D, 0x02}, 2, 0}, \ + {0x29, (uint8_t []){0x00}, 0, 120}, \ + or \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xFF, {0x77, 0x01, 0x00, 0x00, 0x10}), \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC0, {0x3B, 0x00}), \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC1, {0x0D, 0x02}), \ + ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(120, 0x29), \ + } +*/ /* LCD Color Settings */ /* LCD color depth in bits */ diff --git a/src/board/espressif/ESP32_S3_BOX.h b/src/board/espressif/ESP32_S3_BOX.h index 5142e3c0..801ddf16 100644 --- a/src/board/espressif/ESP32_S3_BOX.h +++ b/src/board/espressif/ESP32_S3_BOX.h @@ -69,21 +69,23 @@ * * There are two formats for the sequence code: * 1. Raw data: {command, (uint8_t []){ data0, data1, ... }, data_size, delay_ms} - * 2. Formater: ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(delay_ms, command, { data0, data1, ... }) and + * 2. Formatter: ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(delay_ms, command, { data0, data1, ... }) and * ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(delay_ms, command) */ -// #define ESP_PANEL_LCD_VENDOR_INIT_CMD \ -// { \ -// {0xFF, (uint8_t []){0x77, 0x01, 0x00, 0x00, 0x10}, 5, 0}, \ -// {0xC0, (uint8_t []){0x3B, 0x00}, 2, 0}, \ -// {0xC1, (uint8_t []){0x0D, 0x02}, 2, 0}, \ -// {0x29, (uint8_t []){0x00}, 0, 120}, \ -// or \ -// ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xFF, {0x77, 0x01, 0x00, 0x00, 0x10}), \ -// ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC0, {0x3B, 0x00}), \ -// ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC1, {0x0D, 0x02}), \ -// ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(120, 0x29), \ -// } +/* +#define ESP_PANEL_LCD_VENDOR_INIT_CMD() \ + { \ + {0xFF, (uint8_t []){0x77, 0x01, 0x00, 0x00, 0x10}, 5, 0}, \ + {0xC0, (uint8_t []){0x3B, 0x00}, 2, 0}, \ + {0xC1, (uint8_t []){0x0D, 0x02}, 2, 0}, \ + {0x29, (uint8_t []){0x00}, 0, 120}, \ + or \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xFF, {0x77, 0x01, 0x00, 0x00, 0x10}), \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC0, {0x3B, 0x00}), \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC1, {0x0D, 0x02}), \ + ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(120, 0x29), \ + } +*/ /* LCD Color Settings */ /* LCD color depth in bits */ diff --git a/src/board/espressif/ESP32_S3_BOX_3.h b/src/board/espressif/ESP32_S3_BOX_3.h index db765748..65ab88fc 100644 --- a/src/board/espressif/ESP32_S3_BOX_3.h +++ b/src/board/espressif/ESP32_S3_BOX_3.h @@ -69,7 +69,7 @@ * * There are two formats for the sequence code: * 1. Raw data: {command, (uint8_t []){ data0, data1, ... }, data_size, delay_ms} - * 2. Formater: ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(delay_ms, command, { data0, data1, ... }) + * 2. Formatter: 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_LCD_VENDOR_INIT_CMD() \ diff --git a/src/board/espressif/ESP32_S3_BOX_3_BETA.h b/src/board/espressif/ESP32_S3_BOX_3_BETA.h index 53f85005..8afc9757 100644 --- a/src/board/espressif/ESP32_S3_BOX_3_BETA.h +++ b/src/board/espressif/ESP32_S3_BOX_3_BETA.h @@ -69,21 +69,23 @@ * * There are two formats for the sequence code: * 1. Raw data: {command, (uint8_t []){ data0, data1, ... }, data_size, delay_ms} - * 2. Formater: ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(delay_ms, command, { data0, data1, ... }) + * 2. Formatter: 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_LCD_VENDOR_INIT_CMD \ -// { \ -// {0xFF, (uint8_t []){0x77, 0x01, 0x00, 0x00, 0x10}, 5, 0}, \ -// {0xC0, (uint8_t []){0x3B, 0x00}, 2, 0}, \ -// {0xC1, (uint8_t []){0x0D, 0x02}, 2, 0}, \ -// {0x29, (uint8_t []){0x00}, 0, 120}, \ -// or \ -// ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xFF, {0x77, 0x01, 0x00, 0x00, 0x10}), \ -// ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC0, {0x3B, 0x00}), \ -// ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC1, {0x0D, 0x02}), \ -// ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(120, 0x29), \ -// } +/* +#define ESP_PANEL_LCD_VENDOR_INIT_CMD() \ + { \ + {0xFF, (uint8_t []){0x77, 0x01, 0x00, 0x00, 0x10}, 5, 0}, \ + {0xC0, (uint8_t []){0x3B, 0x00}, 2, 0}, \ + {0xC1, (uint8_t []){0x0D, 0x02}, 2, 0}, \ + {0x29, (uint8_t []){0x00}, 0, 120}, \ + or \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xFF, {0x77, 0x01, 0x00, 0x00, 0x10}), \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC0, {0x3B, 0x00}), \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC1, {0x0D, 0x02}), \ + ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(120, 0x29), \ + } +*/ /* LCD Color Settings */ /* LCD color depth in bits */ diff --git a/src/board/espressif/ESP32_S3_BOX_LITE.h b/src/board/espressif/ESP32_S3_BOX_LITE.h index 196a9ce0..dc0efa75 100644 --- a/src/board/espressif/ESP32_S3_BOX_LITE.h +++ b/src/board/espressif/ESP32_S3_BOX_LITE.h @@ -69,21 +69,23 @@ * * There are two formats for the sequence code: * 1. Raw data: {command, (uint8_t []){ data0, data1, ... }, data_size, delay_ms} - * 2. Formater: ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(delay_ms, command, { data0, data1, ... }) and + * 2. Formatter: ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(delay_ms, command, { data0, data1, ... }) and * ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(delay_ms, command) */ -// #define ESP_PANEL_LCD_VENDOR_INIT_CMD \ -// { \ -// {0xFF, (uint8_t []){0x77, 0x01, 0x00, 0x00, 0x10}, 5, 0}, \ -// {0xC0, (uint8_t []){0x3B, 0x00}, 2, 0}, \ -// {0xC1, (uint8_t []){0x0D, 0x02}, 2, 0}, \ -// {0x29, (uint8_t []){0x00}, 0, 120}, \ -// or \ -// ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xFF, {0x77, 0x01, 0x00, 0x00, 0x10}), \ -// ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC0, {0x3B, 0x00}), \ -// ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC1, {0x0D, 0x02}), \ -// ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(120, 0x29), \ -// } +/* +#define ESP_PANEL_LCD_VENDOR_INIT_CMD() \ + { \ + {0xFF, (uint8_t []){0x77, 0x01, 0x00, 0x00, 0x10}, 5, 0}, \ + {0xC0, (uint8_t []){0x3B, 0x00}, 2, 0}, \ + {0xC1, (uint8_t []){0x0D, 0x02}, 2, 0}, \ + {0x29, (uint8_t []){0x00}, 0, 120}, \ + or \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xFF, {0x77, 0x01, 0x00, 0x00, 0x10}), \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC0, {0x3B, 0x00}), \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC1, {0x0D, 0x02}), \ + ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(120, 0x29), \ + } +*/ /* LCD Color Settings */ /* LCD color depth in bits */ diff --git a/src/board/espressif/ESP32_S3_EYE.h b/src/board/espressif/ESP32_S3_EYE.h index e4065e61..7b8ac7d4 100644 --- a/src/board/espressif/ESP32_S3_EYE.h +++ b/src/board/espressif/ESP32_S3_EYE.h @@ -69,21 +69,23 @@ * * There are two formats for the sequence code: * 1. Raw data: {command, (uint8_t []){ data0, data1, ... }, data_size, delay_ms} - * 2. Formater: ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(delay_ms, command, { data0, data1, ... }) and + * 2. Formatter: ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(delay_ms, command, { data0, data1, ... }) and * ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(delay_ms, command) */ -// #define ESP_PANEL_LCD_VENDOR_INIT_CMD \ -// { \ -// {0xFF, (uint8_t []){0x77, 0x01, 0x00, 0x00, 0x10}, 5, 0}, \ -// {0xC0, (uint8_t []){0x3B, 0x00}, 2, 0}, \ -// {0xC1, (uint8_t []){0x0D, 0x02}, 2, 0}, \ -// {0x29, (uint8_t []){0x00}, 0, 120}, \ -// or \ -// ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xFF, {0x77, 0x01, 0x00, 0x00, 0x10}), \ -// ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC0, {0x3B, 0x00}), \ -// ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC1, {0x0D, 0x02}), \ -// ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(120, 0x29), \ -// } +/* +#define ESP_PANEL_LCD_VENDOR_INIT_CMD() \ + { \ + {0xFF, (uint8_t []){0x77, 0x01, 0x00, 0x00, 0x10}, 5, 0}, \ + {0xC0, (uint8_t []){0x3B, 0x00}, 2, 0}, \ + {0xC1, (uint8_t []){0x0D, 0x02}, 2, 0}, \ + {0x29, (uint8_t []){0x00}, 0, 120}, \ + or \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xFF, {0x77, 0x01, 0x00, 0x00, 0x10}), \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC0, {0x3B, 0x00}), \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC1, {0x0D, 0x02}), \ + ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(120, 0x29), \ + } +*/ /* LCD Color Settings */ /* LCD color depth in bits */ diff --git a/src/board/espressif/ESP32_S3_KORVO_2.h b/src/board/espressif/ESP32_S3_KORVO_2.h index 000af5c2..a6262a99 100644 --- a/src/board/espressif/ESP32_S3_KORVO_2.h +++ b/src/board/espressif/ESP32_S3_KORVO_2.h @@ -69,21 +69,23 @@ * * There are two formats for the sequence code: * 1. Raw data: {command, (uint8_t []){ data0, data1, ... }, data_size, delay_ms} - * 2. Formater: ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(delay_ms, command, { data0, data1, ... }) and + * 2. Formatter: ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(delay_ms, command, { data0, data1, ... }) and * ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(delay_ms, command) */ -// #define ESP_PANEL_LCD_VENDOR_INIT_CMD \ -// { \ -// {0xFF, (uint8_t []){0x77, 0x01, 0x00, 0x00, 0x10}, 5, 0}, \ -// {0xC0, (uint8_t []){0x3B, 0x00}, 2, 0}, \ -// {0xC1, (uint8_t []){0x0D, 0x02}, 2, 0}, \ -// {0x29, (uint8_t []){0x00}, 0, 120}, \ -// or \ -// ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xFF, {0x77, 0x01, 0x00, 0x00, 0x10}), \ -// ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC0, {0x3B, 0x00}), \ -// ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC1, {0x0D, 0x02}), \ -// ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(120, 0x29), \ -// } +/* +#define ESP_PANEL_LCD_VENDOR_INIT_CMD() \ + { \ + {0xFF, (uint8_t []){0x77, 0x01, 0x00, 0x00, 0x10}, 5, 0}, \ + {0xC0, (uint8_t []){0x3B, 0x00}, 2, 0}, \ + {0xC1, (uint8_t []){0x0D, 0x02}, 2, 0}, \ + {0x29, (uint8_t []){0x00}, 0, 120}, \ + or \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xFF, {0x77, 0x01, 0x00, 0x00, 0x10}), \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC0, {0x3B, 0x00}), \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC1, {0x0D, 0x02}), \ + ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(120, 0x29), \ + } +*/ /* LCD Color Settings */ /* LCD color depth in bits */ diff --git a/src/board/espressif/ESP32_S3_LCD_EV_BOARD.h b/src/board/espressif/ESP32_S3_LCD_EV_BOARD.h index 16e933c7..7fd47cc4 100644 --- a/src/board/espressif/ESP32_S3_LCD_EV_BOARD.h +++ b/src/board/espressif/ESP32_S3_LCD_EV_BOARD.h @@ -109,21 +109,23 @@ * * There are two formats for the sequence code: * 1. Raw data: {command, (uint8_t []){ data0, data1, ... }, data_size, delay_ms} - * 2. Formater: ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(delay_ms, command, { data0, data1, ... }) and + * 2. Formatter: ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(delay_ms, command, { data0, data1, ... }) and * ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(delay_ms, command) */ -// #define ESP_PANEL_LCD_VENDOR_INIT_CMD \ -// { \ -// {0xFF, (uint8_t []){0x77, 0x01, 0x00, 0x00, 0x10}, 5, 0}, \ -// {0xC0, (uint8_t []){0x3B, 0x00}, 2, 0}, \ -// {0xC1, (uint8_t []){0x0D, 0x02}, 2, 0}, \ -// {0x29, (uint8_t []){0x00}, 0, 120}, \ -// or \ -// ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xFF, {0x77, 0x01, 0x00, 0x00, 0x10}), \ -// ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC0, {0x3B, 0x00}), \ -// ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC1, {0x0D, 0x02}), \ -// ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(120, 0x29), \ -// } +/* +#define ESP_PANEL_LCD_VENDOR_INIT_CMD() \ + { \ + {0xFF, (uint8_t []){0x77, 0x01, 0x00, 0x00, 0x10}, 5, 0}, \ + {0xC0, (uint8_t []){0x3B, 0x00}, 2, 0}, \ + {0xC1, (uint8_t []){0x0D, 0x02}, 2, 0}, \ + {0x29, (uint8_t []){0x00}, 0, 120}, \ + or \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xFF, {0x77, 0x01, 0x00, 0x00, 0x10}), \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC0, {0x3B, 0x00}), \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC1, {0x0D, 0x02}), \ + ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(120, 0x29), \ + } +*/ /* LCD Color Settings */ /* LCD color depth in bits */ diff --git a/src/board/espressif/ESP32_S3_LCD_EV_BOARD_2.h b/src/board/espressif/ESP32_S3_LCD_EV_BOARD_2.h index ebe7cd3d..e909972c 100644 --- a/src/board/espressif/ESP32_S3_LCD_EV_BOARD_2.h +++ b/src/board/espressif/ESP32_S3_LCD_EV_BOARD_2.h @@ -93,21 +93,23 @@ * * There are two formats for the sequence code: * 1. Raw data: {command, (uint8_t []){ data0, data1, ... }, data_size, delay_ms} - * 2. Formater: ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(delay_ms, command, { data0, data1, ... }) and + * 2. Formatter: ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(delay_ms, command, { data0, data1, ... }) and * ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(delay_ms, command) */ -// #define ESP_PANEL_LCD_VENDOR_INIT_CMD \ -// { \ -// {0xFF, (uint8_t []){0x77, 0x01, 0x00, 0x00, 0x10}, 5, 0}, \ -// {0xC0, (uint8_t []){0x3B, 0x00}, 2, 0}, \ -// {0xC1, (uint8_t []){0x0D, 0x02}, 2, 0}, \ -// {0x29, (uint8_t []){0x00}, 0, 120}, \ -// or \ -// ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xFF, {0x77, 0x01, 0x00, 0x00, 0x10}), \ -// ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC0, {0x3B, 0x00}), \ -// ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC1, {0x0D, 0x02}), \ -// ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(120, 0x29), \ -// } +/* +#define ESP_PANEL_LCD_VENDOR_INIT_CMD() \ + { \ + {0xFF, (uint8_t []){0x77, 0x01, 0x00, 0x00, 0x10}, 5, 0}, \ + {0xC0, (uint8_t []){0x3B, 0x00}, 2, 0}, \ + {0xC1, (uint8_t []){0x0D, 0x02}, 2, 0}, \ + {0x29, (uint8_t []){0x00}, 0, 120}, \ + or \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xFF, {0x77, 0x01, 0x00, 0x00, 0x10}), \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC0, {0x3B, 0x00}), \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC1, {0x0D, 0x02}), \ + ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(120, 0x29), \ + } +*/ /* LCD Color Settings */ /* LCD color depth in bits */ diff --git a/src/board/espressif/ESP32_S3_LCD_EV_BOARD_2_V1_5.h b/src/board/espressif/ESP32_S3_LCD_EV_BOARD_2_V1_5.h index 83a43a2f..cefbcb55 100644 --- a/src/board/espressif/ESP32_S3_LCD_EV_BOARD_2_V1_5.h +++ b/src/board/espressif/ESP32_S3_LCD_EV_BOARD_2_V1_5.h @@ -93,21 +93,23 @@ * * There are two formats for the sequence code: * 1. Raw data: {command, (uint8_t []){ data0, data1, ... }, data_size, delay_ms} - * 2. Formater: ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(delay_ms, command, { data0, data1, ... }) and + * 2. Formatter: ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(delay_ms, command, { data0, data1, ... }) and * ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(delay_ms, command) */ -// #define ESP_PANEL_LCD_VENDOR_INIT_CMD \ -// { \ -// {0xFF, (uint8_t []){0x77, 0x01, 0x00, 0x00, 0x10}, 5, 0}, \ -// {0xC0, (uint8_t []){0x3B, 0x00}, 2, 0}, \ -// {0xC1, (uint8_t []){0x0D, 0x02}, 2, 0}, \ -// {0x29, (uint8_t []){0x00}, 0, 120}, \ -// or \ -// ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xFF, {0x77, 0x01, 0x00, 0x00, 0x10}), \ -// ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC0, {0x3B, 0x00}), \ -// ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC1, {0x0D, 0x02}), \ -// ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(120, 0x29), \ -// } +/* +#define ESP_PANEL_LCD_VENDOR_INIT_CMD() \ + { \ + {0xFF, (uint8_t []){0x77, 0x01, 0x00, 0x00, 0x10}, 5, 0}, \ + {0xC0, (uint8_t []){0x3B, 0x00}, 2, 0}, \ + {0xC1, (uint8_t []){0x0D, 0x02}, 2, 0}, \ + {0x29, (uint8_t []){0x00}, 0, 120}, \ + or \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xFF, {0x77, 0x01, 0x00, 0x00, 0x10}), \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC0, {0x3B, 0x00}), \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC1, {0x0D, 0x02}), \ + ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(120, 0x29), \ + } +*/ /* LCD Color Settings */ /* LCD color depth in bits */ diff --git a/src/board/espressif/ESP32_S3_LCD_EV_BOARD_V1_5.h b/src/board/espressif/ESP32_S3_LCD_EV_BOARD_V1_5.h index fa0a2999..a4626e5d 100644 --- a/src/board/espressif/ESP32_S3_LCD_EV_BOARD_V1_5.h +++ b/src/board/espressif/ESP32_S3_LCD_EV_BOARD_V1_5.h @@ -109,21 +109,23 @@ * * There are two formats for the sequence code: * 1. Raw data: {command, (uint8_t []){ data0, data1, ... }, data_size, delay_ms} - * 2. Formater: ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(delay_ms, command, { data0, data1, ... }) and + * 2. Formatter: ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(delay_ms, command, { data0, data1, ... }) and * ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(delay_ms, command) */ -// #define ESP_PANEL_LCD_VENDOR_INIT_CMD \ -// { \ -// {0xFF, (uint8_t []){0x77, 0x01, 0x00, 0x00, 0x10}, 5, 0}, \ -// {0xC0, (uint8_t []){0x3B, 0x00}, 2, 0}, \ -// {0xC1, (uint8_t []){0x0D, 0x02}, 2, 0}, \ -// {0x29, (uint8_t []){0x00}, 0, 120}, \ -// or \ -// ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xFF, {0x77, 0x01, 0x00, 0x00, 0x10}), \ -// ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC0, {0x3B, 0x00}), \ -// ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC1, {0x0D, 0x02}), \ -// ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(120, 0x29), \ -// } +/* +#define ESP_PANEL_LCD_VENDOR_INIT_CMD() \ + { \ + {0xFF, (uint8_t []){0x77, 0x01, 0x00, 0x00, 0x10}, 5, 0}, \ + {0xC0, (uint8_t []){0x3B, 0x00}, 2, 0}, \ + {0xC1, (uint8_t []){0x0D, 0x02}, 2, 0}, \ + {0x29, (uint8_t []){0x00}, 0, 120}, \ + or \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xFF, {0x77, 0x01, 0x00, 0x00, 0x10}), \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC0, {0x3B, 0x00}), \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC1, {0x0D, 0x02}), \ + ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(120, 0x29), \ + } +*/ /* LCD Color Settings */ /* LCD color depth in bits */ diff --git a/src/board/espressif/ESP32_S3_USB_OTG.h b/src/board/espressif/ESP32_S3_USB_OTG.h index 17398827..0fd9eded 100644 --- a/src/board/espressif/ESP32_S3_USB_OTG.h +++ b/src/board/espressif/ESP32_S3_USB_OTG.h @@ -69,21 +69,23 @@ * * There are two formats for the sequence code: * 1. Raw data: {command, (uint8_t []){ data0, data1, ... }, data_size, delay_ms} - * 2. Formater: ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(delay_ms, command, { data0, data1, ... }) and + * 2. Formatter: ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(delay_ms, command, { data0, data1, ... }) and * ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(delay_ms, command) */ -// #define ESP_PANEL_LCD_VENDOR_INIT_CMD \ -// { \ -// {0xFF, (uint8_t []){0x77, 0x01, 0x00, 0x00, 0x10}, 5, 0}, \ -// {0xC0, (uint8_t []){0x3B, 0x00}, 2, 0}, \ -// {0xC1, (uint8_t []){0x0D, 0x02}, 2, 0}, \ -// {0x29, (uint8_t []){0x00}, 0, 120}, \ -// or \ -// ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xFF, {0x77, 0x01, 0x00, 0x00, 0x10}), \ -// ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC0, {0x3B, 0x00}), \ -// ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC1, {0x0D, 0x02}), \ -// ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(120, 0x29), \ -// } +/* +#define ESP_PANEL_LCD_VENDOR_INIT_CMD() \ + { \ + {0xFF, (uint8_t []){0x77, 0x01, 0x00, 0x00, 0x10}, 5, 0}, \ + {0xC0, (uint8_t []){0x3B, 0x00}, 2, 0}, \ + {0xC1, (uint8_t []){0x0D, 0x02}, 2, 0}, \ + {0x29, (uint8_t []){0x00}, 0, 120}, \ + or \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xFF, {0x77, 0x01, 0x00, 0x00, 0x10}), \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC0, {0x3B, 0x00}), \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC1, {0x0D, 0x02}), \ + ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(120, 0x29), \ + } +*/ /* LCD Color Settings */ /* LCD color depth in bits */ diff --git a/src/board/espressif/Kconfig.espressif b/src/board/espressif/Kconfig.espressif new file mode 100644 index 00000000..57d934ef --- /dev/null +++ b/src/board/espressif/Kconfig.espressif @@ -0,0 +1,59 @@ +config BOARD_ESP32_C3_LCDKIT + bool "ESP32-C3-LCDkit" + help + https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32c3/esp32-c3-lcdkit/index.html + +config BOARD_ESP32_S3_BOX + bool "ESP32-S3-Box" + help + https://github.com/espressif/esp-box/tree/master + +config BOARD_ESP32_S3_BOX_3 + bool "ESP32-S3-Box-3 & ESP32-S3-Box-3B" + help + https://github.com/espressif/esp-box/tree/master + +config BOARD_ESP32_S3_BOX_3_BETA + bool "ESP32-S3-Box-3(beta)" + help + https://github.com/espressif/esp-box/tree/c4c954888e11250423f083df0067d99e22d59fbe + +config BOARD_ESP32_S3_BOX_LITE + bool "ESP32-S3-Box-Lite" + help + https://github.com/espressif/esp-box/tree/master + +config BOARD_ESP32_S3_EYE + bool "ESP32-S3-EYE" + help + https://github.com/espressif/esp-who/blob/master/docs/en/get-started/ESP32-S3-EYE_Getting_Started_Guide.md + +config BOARD_ESP32_S3_KORVO_2 + bool "ESP32-S3-Korvo-2" + help + https://docs.espressif.com/projects/esp-adf/en/latest/design-guide/dev-boards/user-guide-esp32-s3-korvo-2.html + +config BOARD_ESP32_S3_LCD_EV_BOARD + bool "ESP32-S3-LCD-EV-Board(v1.1-v1.4)" + help + https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32s3/esp32-s3-lcd-ev-board/user_guide_v1.4.html + +config BOARD_ESP32_S3_LCD_EV_BOARD_V1_5 + bool "ESP32-S3-LCD-EV-Board(v1.5)" + help + https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32s3/esp32-s3-lcd-ev-board/user_guide.html + +config BOARD_ESP32_S3_LCD_EV_BOARD_2 + bool "ESP32-S3-LCD-EV-Board-2(v1.1-v1.4)" + help + https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32s3/esp32-s3-lcd-ev-board/user_guide_v1.4.html + +config BOARD_ESP32_S3_LCD_EV_BOARD_2_V1_5 + bool "ESP32-S3-LCD-EV-Board-2(v1.5)" + help + https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32s3/esp32-s3-lcd-ev-board/user_guide.html + +config BOARD_ESP32_S3_USB_OTG + bool "ESP32-S3-USB-OTG" + help + https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32s3/esp32-s3-usb-otg/index.html diff --git a/src/board/jingcai/ESP32_4848S040C_I_Y_3.h b/src/board/jingcai/ESP32_4848S040C_I_Y_3.h index f5e94acb..3c23176c 100644 --- a/src/board/jingcai/ESP32_4848S040C_I_Y_3.h +++ b/src/board/jingcai/ESP32_4848S040C_I_Y_3.h @@ -107,7 +107,7 @@ * * There are two formats for the sequence code: * 1. Raw data: {command, (uint8_t []){ data0, data1, ... }, data_size, delay_ms} - * 2. Formater: ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(delay_ms, command, { data0, data1, ... }) and + * 2. Formatter: ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(delay_ms, command, { data0, data1, ... }) and * ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(delay_ms, command) */ #define ESP_PANEL_LCD_VENDOR_INIT_CMD() \ diff --git a/src/board/jingcai/Kconfig.jingcai b/src/board/jingcai/Kconfig.jingcai new file mode 100644 index 00000000..2779f1a7 --- /dev/null +++ b/src/board/jingcai/Kconfig.jingcai @@ -0,0 +1,4 @@ +config BOARD_ESP32_4848S040C_I_Y_3 + bool "ESP32-4848S040C_I_Y_3" + help + https://www.displaysmodule.com/sale-41828962-experience-the-power-of-the-esp32-display-module-sku-esp32-4848s040c-i-y-3.html diff --git a/src/board/m5stack/Kconfig.m5stack b/src/board/m5stack/Kconfig.m5stack new file mode 100644 index 00000000..e56b468d --- /dev/null +++ b/src/board/m5stack/Kconfig.m5stack @@ -0,0 +1,14 @@ +config BOARD_M5STACK_M5CORE2 + bool "M5STACK_M5CORE2" + help + https://docs.m5stack.com/en/core/core2 + +config BOARD_M5STACK_M5CORES3 + bool "M5STACK_M5CORES3" + help + https://docs.m5stack.com/en/core/CoreS3 + +config BOARD_M5STACK_M5DIAL + bool "M5STACK_M5DIAL" + help + https://docs.m5stack.com/en/core/M5Dial diff --git a/src/board/m5stack/M5CORE2.h b/src/board/m5stack/M5CORE2.h index b43b9b58..10c696d3 100644 --- a/src/board/m5stack/M5CORE2.h +++ b/src/board/m5stack/M5CORE2.h @@ -70,21 +70,23 @@ * * There are two formats for the sequence code: * 1. Raw data: {command, (uint8_t []){ data0, data1, ... }, data_size, delay_ms} - * 2. Formater: ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(delay_ms, command, { data0, data1, ... }) and + * 2. Formatter: ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(delay_ms, command, { data0, data1, ... }) and * ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(delay_ms, command) */ -// #define ESP_PANEL_LCD_VENDOR_INIT_CMD \ -// { \ -// {0xFF, (uint8_t []){0x77, 0x01, 0x00, 0x00, 0x10}, 5, 0}, \ -// {0xC0, (uint8_t []){0x3B, 0x00}, 2, 0}, \ -// {0xC1, (uint8_t []){0x0D, 0x02}, 2, 0}, \ -// {0x29, (uint8_t []){0x00}, 0, 120}, \ -// or \ -// ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xFF, {0x77, 0x01, 0x00, 0x00, 0x10}), \ -// ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC0, {0x3B, 0x00}), \ -// ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC1, {0x0D, 0x02}), \ -// ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(120, 0x29), \ -// } +/* +#define ESP_PANEL_LCD_VENDOR_INIT_CMD() \ + { \ + {0xFF, (uint8_t []){0x77, 0x01, 0x00, 0x00, 0x10}, 5, 0}, \ + {0xC0, (uint8_t []){0x3B, 0x00}, 2, 0}, \ + {0xC1, (uint8_t []){0x0D, 0x02}, 2, 0}, \ + {0x29, (uint8_t []){0x00}, 0, 120}, \ + or \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xFF, {0x77, 0x01, 0x00, 0x00, 0x10}), \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC0, {0x3B, 0x00}), \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC1, {0x0D, 0x02}), \ + ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(120, 0x29), \ + } +*/ /* LCD Color Settings */ /* LCD color depth in bits */ @@ -192,7 +194,7 @@ #define ESP_PANEL_BEGIN_END_FUNCTION( panel ) \ { \ static const uint8_t AXP_ADDR = 0x34; \ - static const uint8_t I2C_MASTER_TIMEOUT_MS = 1000; \ + static const uint32_t I2C_MASTER_TIMEOUT_MS = 1000; \ static i2c_port_t i2c_master_port = I2C_NUM_0; \ \ uint8_t device_id = 0; \ diff --git a/src/board/m5stack/M5CORES3.h b/src/board/m5stack/M5CORES3.h index a7981eac..c3d15c13 100644 --- a/src/board/m5stack/M5CORES3.h +++ b/src/board/m5stack/M5CORES3.h @@ -5,7 +5,6 @@ */ #pragma once -#include #include // *INDENT-OFF* @@ -73,21 +72,23 @@ * * There are two formats for the sequence code: * 1. Raw data: {command, (uint8_t []){ data0, data1, ... }, data_size, delay_ms} - * 2. Formater: ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(delay_ms, command, { data0, data1, ... }) and + * 2. Formatter: ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(delay_ms, command, { data0, data1, ... }) and * ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(delay_ms, command) */ -// #define ESP_PANEL_LCD_VENDOR_INIT_CMD() \ -// { \ -// {0xFF, (uint8_t []){0x77, 0x01, 0x00, 0x00, 0x10}, 5, 0}, \ -// {0xC0, (uint8_t []){0x3B, 0x00}, 2, 0}, \ -// {0xC1, (uint8_t []){0x0D, 0x02}, 2, 0}, \ -// {0x29, (uint8_t []){0x00}, 0, 120}, \ -// or \ -// ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xFF, {0x77, 0x01, 0x00, 0x00, 0x10}), \ -// ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC0, {0x3B, 0x00}), \ -// ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC1, {0x0D, 0x02}), \ -// ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(120, 0x29), \ -// } +/* +#define ESP_PANEL_LCD_VENDOR_INIT_CMD() \ + { \ + {0xFF, (uint8_t []){0x77, 0x01, 0x00, 0x00, 0x10}, 5, 0}, \ + {0xC0, (uint8_t []){0x3B, 0x00}, 2, 0}, \ + {0xC1, (uint8_t []){0x0D, 0x02}, 2, 0}, \ + {0x29, (uint8_t []){0x00}, 0, 120}, \ + or \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xFF, {0x77, 0x01, 0x00, 0x00, 0x10}), \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC0, {0x3B, 0x00}), \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC1, {0x0D, 0x02}), \ + ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(120, 0x29), \ + } +*/ /* LCD Color Settings */ /* LCD color depth in bits */ @@ -186,7 +187,7 @@ #define ESP_PANEL_BEGIN_START_FUNCTION( panel ) \ { \ const uint8_t AXP_ADDR = 0x34; \ - const uint8_t I2C_MASTER_TIMEOUT_MS = 1000; \ + const uint32_t I2C_MASTER_TIMEOUT_MS = 1000; \ const i2c_port_t i2c_master_port = I2C_NUM_0; \ \ uint8_t read_value = 0; \ diff --git a/src/board/m5stack/M5DIAL.h b/src/board/m5stack/M5DIAL.h index 0c672c17..58afaa2e 100644 --- a/src/board/m5stack/M5DIAL.h +++ b/src/board/m5stack/M5DIAL.h @@ -159,21 +159,23 @@ * * There are two formats for the sequence code: * 1. Raw data: {command, (uint8_t []){ data0, data1, ... }, data_size, delay_ms} - * 2. Formater: ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(delay_ms, command, { data0, data1, ... }) and + * 2. Formatter: ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(delay_ms, command, { data0, data1, ... }) and * ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(delay_ms, command) */ -// #define ESP_PANEL_LCD_VENDOR_INIT_CMD \ -// { \ -// {0xFF, (uint8_t []){0x77, 0x01, 0x00, 0x00, 0x10}, 5, 0}, \ -// {0xC0, (uint8_t []){0x3B, 0x00}, 2, 0}, \ -// {0xC1, (uint8_t []){0x0D, 0x02}, 2, 0}, \ -// {0x29, (uint8_t []){0x00}, 0, 120}, \ -// or \ -// ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xFF, {0x77, 0x01, 0x00, 0x00, 0x10}), \ -// ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC0, {0x3B, 0x00}), \ -// ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC1, {0x0D, 0x02}), \ -// ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(120, 0x29), \ -// } +/* +#define ESP_PANEL_LCD_VENDOR_INIT_CMD() \ + { \ + {0xFF, (uint8_t []){0x77, 0x01, 0x00, 0x00, 0x10}, 5, 0}, \ + {0xC0, (uint8_t []){0x3B, 0x00}, 2, 0}, \ + {0xC1, (uint8_t []){0x0D, 0x02}, 2, 0}, \ + {0x29, (uint8_t []){0x00}, 0, 120}, \ + or \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xFF, {0x77, 0x01, 0x00, 0x00, 0x10}), \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC0, {0x3B, 0x00}), \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC1, {0x0D, 0x02}), \ + ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(120, 0x29), \ + } +*/ /* LCD Color Settings */ /* LCD color depth in bits */ diff --git a/src/board/waveshare/ESP32_S3_Touch_LCD_1_85.h b/src/board/waveshare/ESP32_S3_Touch_LCD_1_85.h index 19f00310..f83cbe54 100644 --- a/src/board/waveshare/ESP32_S3_Touch_LCD_1_85.h +++ b/src/board/waveshare/ESP32_S3_Touch_LCD_1_85.h @@ -70,21 +70,23 @@ * * There are two formats for the sequence code: * 1. Raw data: {command, (uint8_t []){ data0, data1, ... }, data_size, delay_ms} - * 2. Formater: ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(delay_ms, command, { data0, data1, ... }) and + * 2. Formatter: ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(delay_ms, command, { data0, data1, ... }) and * ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(delay_ms, command) */ -// #define ESP_PANEL_LCD_VENDOR_INIT_CMD() \ -// { \ -// {0xFF, (uint8_t []){0x77, 0x01, 0x00, 0x00, 0x10}, 5, 0}, \ -// {0xC0, (uint8_t []){0x3B, 0x00}, 2, 0}, \ -// {0xC1, (uint8_t []){0x0D, 0x02}, 2, 0}, \ -// {0x29, (uint8_t []){0x00}, 0, 120}, \ -// or \ -// ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xFF, {0x77, 0x01, 0x00, 0x00, 0x10}), \ -// ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC0, {0x3B, 0x00}), \ -// ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC1, {0x0D, 0x02}), \ -// ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(120, 0x29), \ -// } +/* +#define ESP_PANEL_LCD_VENDOR_INIT_CMD() \ + { \ + {0xFF, (uint8_t []){0x77, 0x01, 0x00, 0x00, 0x10}, 5, 0}, \ + {0xC0, (uint8_t []){0x3B, 0x00}, 2, 0}, \ + {0xC1, (uint8_t []){0x0D, 0x02}, 2, 0}, \ + {0x29, (uint8_t []){0x00}, 0, 120}, \ + or \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xFF, {0x77, 0x01, 0x00, 0x00, 0x10}), \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC0, {0x3B, 0x00}), \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC1, {0x0D, 0x02}), \ + ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(120, 0x29), \ + } +*/ /* LCD Color Settings */ /* LCD color depth in bits */ diff --git a/src/board/waveshare/ESP32_S3_Touch_LCD_2_1.h b/src/board/waveshare/ESP32_S3_Touch_LCD_2_1.h index c4cfd571..432aa9e8 100644 --- a/src/board/waveshare/ESP32_S3_Touch_LCD_2_1.h +++ b/src/board/waveshare/ESP32_S3_Touch_LCD_2_1.h @@ -119,7 +119,7 @@ * * There are two formats for the sequence code: * 1. Raw data: {command, (uint8_t []){ data0, data1, ... }, data_size, delay_ms} - * 2. Formater: ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(delay_ms, command, { data0, data1, ... }) and + * 2. Formatter: ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(delay_ms, command, { data0, data1, ... }) and * ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(delay_ms, command) */ #define ESP_PANEL_LCD_VENDOR_INIT_CMD() \ diff --git a/src/board/waveshare/ESP32_S3_Touch_LCD_4_3.h b/src/board/waveshare/ESP32_S3_Touch_LCD_4_3.h index 3b2f72c2..1155896d 100644 --- a/src/board/waveshare/ESP32_S3_Touch_LCD_4_3.h +++ b/src/board/waveshare/ESP32_S3_Touch_LCD_4_3.h @@ -113,21 +113,23 @@ * * There are two formats for the sequence code: * 1. Raw data: {command, (uint8_t []){ data0, data1, ... }, data_size, delay_ms} - * 2. Formater: ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(delay_ms, command, { data0, data1, ... }) and + * 2. Formatter: ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(delay_ms, command, { data0, data1, ... }) and * ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(delay_ms, command) */ -// #define ESP_PANEL_LCD_VENDOR_INIT_CMD \ -// { \ -// {0xFF, (uint8_t []){0x77, 0x01, 0x00, 0x00, 0x10}, 5, 0}, \ -// {0xC0, (uint8_t []){0x3B, 0x00}, 2, 0}, \ -// {0xC1, (uint8_t []){0x0D, 0x02}, 2, 0}, \ -// {0x29, (uint8_t []){0x00}, 0, 120}, \ -// or \ -// ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xFF, {0x77, 0x01, 0x00, 0x00, 0x10}), \ -// ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC0, {0x3B, 0x00}), \ -// ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC1, {0x0D, 0x02}), \ -// ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(120, 0x29), \ -// } +/* +#define ESP_PANEL_LCD_VENDOR_INIT_CMD() \ + { \ + {0xFF, (uint8_t []){0x77, 0x01, 0x00, 0x00, 0x10}, 5, 0}, \ + {0xC0, (uint8_t []){0x3B, 0x00}, 2, 0}, \ + {0xC1, (uint8_t []){0x0D, 0x02}, 2, 0}, \ + {0x29, (uint8_t []){0x00}, 0, 120}, \ + or \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xFF, {0x77, 0x01, 0x00, 0x00, 0x10}), \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC0, {0x3B, 0x00}), \ + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC1, {0x0D, 0x02}), \ + ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(120, 0x29), \ + } +*/ /* LCD Color Settings */ /* LCD color depth in bits */ diff --git a/src/board/waveshare/Kconfig.waveshare b/src/board/waveshare/Kconfig.waveshare new file mode 100644 index 00000000..bc6f3a84 --- /dev/null +++ b/src/board/waveshare/Kconfig.waveshare @@ -0,0 +1,14 @@ +config BOARD_WAVESHARE_ESP32_S3_Touch_LCD_4_3 + bool "ESP32_S3_Touch_LCD_4_3" + help + https://www.waveshare.com/esp32-s3-touch-lcd-4.3.htm + +config BOARD_WAVESHARE_ESP32_S3_Touch_LCD_1_85 + bool "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_2_1 + bool "ESP32_S3_Touch_LCD_2_1" + help + https://www.waveshare.com/esp32-s3-touch-lcd-2.1.htm diff --git a/src/bus/ESP_PanelBus.cpp b/src/bus/ESP_PanelBus.cpp index 51962971..3f818f7d 100644 --- a/src/bus/ESP_PanelBus.cpp +++ b/src/bus/ESP_PanelBus.cpp @@ -22,7 +22,7 @@ ESP_PanelBus::ESP_PanelBus(int host_id, uint8_t bus_type, bool host_need_init): bool ESP_PanelBus::readRegisterData(uint32_t address, void *data, uint32_t data_size) { ESP_PANEL_CHECK_ERR_RET(esp_lcd_panel_io_rx_param(handle, address, data, data_size), false, - "Read register(0x%x) failed", address); + "Read register(0x%" PRIx32 ") failed", address); return true; } @@ -30,7 +30,7 @@ bool ESP_PanelBus::readRegisterData(uint32_t address, void *data, uint32_t data_ bool ESP_PanelBus::writeRegisterData(uint32_t address, const void *data, uint32_t data_size) { ESP_PANEL_CHECK_ERR_RET(esp_lcd_panel_io_tx_param(handle, address, data, data_size), false, - "Read register(0x%x) failed", address); + "Read register(0x%" PRIx32 ") failed", address); return true; } @@ -38,7 +38,7 @@ bool ESP_PanelBus::writeRegisterData(uint32_t address, const void *data, uint32_ bool ESP_PanelBus::writeColorData(uint32_t address, const void *color, uint32_t color_size) { ESP_PANEL_CHECK_ERR_RET(esp_lcd_panel_io_tx_param(handle, address, color, color_size), false, - "Read register(0x%x) failed", address); + "Read register(0x%" PRIx32 ") failed", address); return true; } diff --git a/src/bus/ESP_PanelBus.h b/src/bus/ESP_PanelBus.h index 37ccd273..169ec47d 100644 --- a/src/bus/ESP_PanelBus.h +++ b/src/bus/ESP_PanelBus.h @@ -55,7 +55,7 @@ class ESP_PanelBus { * * @return true if success, otherwise false */ - bool del(void); + virtual bool del(void); /** * @brief Read the register data @@ -94,7 +94,7 @@ class ESP_PanelBus { * @brief Get the type of bus * * @return - * - ESP_PANEL_BUS_TYPE_UNKNOWN: Unkown bus + * - ESP_PANEL_BUS_TYPE_UNKNOWN: Unknown bus * - ESP_PANEL_BUS_TYPE_SPI: SPI bus * - ESP_PANEL_BUS_TYPE_RGB: RGB (DPI)bus * - ESP_PANEL_BUS_TYPE_QSPI: QSPI bus diff --git a/src/bus/I2C.cpp b/src/bus/I2C.cpp index c13f2c84..1f38fd0a 100644 --- a/src/bus/I2C.cpp +++ b/src/bus/I2C.cpp @@ -113,8 +113,13 @@ bool ESP_PanelBus_I2C::begin(void) ESP_LOGD(TAG, "Init host[%d]", (int)host_id); } +#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 1, 0) ESP_PANEL_CHECK_ERR_RET(esp_lcd_new_panel_io_i2c((esp_lcd_i2c_bus_handle_t)host_id, &io_config, &handle), false, "Create panel io failed"); +#else + ESP_PANEL_CHECK_ERR_RET(esp_lcd_new_panel_io_i2c_v1((esp_lcd_i2c_bus_handle_t)host_id, &io_config, &handle), false, + "Create panel io failed"); +#endif ESP_LOGD(TAG, "Panel IO @%p created", handle); return true; diff --git a/src/bus/SPI.cpp b/src/bus/SPI.cpp index a81a6646..22ee6963 100644 --- a/src/bus/SPI.cpp +++ b/src/bus/SPI.cpp @@ -57,6 +57,15 @@ ESP_PanelBus_SPI::~ESP_PanelBus_SPI() ESP_LOGE(TAG, "Delete panel io failed"); } +end: + ESP_LOGD(TAG, "Destroyed"); +} + +bool ESP_PanelBus_SPI::del(void) +{ + ESP_PANEL_ENABLE_TAG_DEBUG_LOG(); + + ESP_PANEL_CHECK_FALSE_RET(ESP_PanelBus::del(), false, "Delete base panel failed"); if (host_need_init) { if (spi_bus_free((spi_host_device_t)host_id) != ESP_OK) { ESP_LOGE(TAG, "Delete host[%d] driver failed", host_id); @@ -65,8 +74,7 @@ ESP_PanelBus_SPI::~ESP_PanelBus_SPI() } } -end: - ESP_LOGD(TAG, "Destroyed"); + return true; } void ESP_PanelBus_SPI::configSpiMode(uint8_t mode) diff --git a/src/bus/SPI.h b/src/bus/SPI.h index 07eee1e6..ab388a84 100644 --- a/src/bus/SPI.h +++ b/src/bus/SPI.h @@ -111,6 +111,13 @@ class ESP_PanelBus_SPI: public ESP_PanelBus { */ ~ESP_PanelBus_SPI() override; + /** + * @brief Delete the bus object, release the resources + * + * @return true if success, otherwise false + */ + bool del(void) override; + /** * @brief Here are some functions to configure the SPI bus object. These functions should be called before `begin()` * diff --git a/src/bus/base/esp_lcd_panel_io_additions.h b/src/bus/base/esp_lcd_panel_io_additions.h index dd820c7f..8d6d0980 100644 --- a/src/bus/base/esp_lcd_panel_io_additions.h +++ b/src/bus/base/esp_lcd_panel_io_additions.h @@ -54,7 +54,7 @@ typedef struct { typedef struct { spi_line_config_t line_config; /*!< SPI line configuration */ uint32_t expect_clk_speed; /*!< Expected SPI clock speed, in Hz (1 ~ 500000 - * If this value is 0, it will be set to `PANEL_IO_3WIRE_SPI_CLK_MAX` by defaul + * If this value is 0, it will be set to `PANEL_IO_3WIRE_SPI_CLK_MAX` by default * The actual frequency may be very different due to the limitation of the software delay */ uint32_t spi_mode: 2; /*!< Traditional SPI mode (0 ~ 3) */ uint32_t lcd_cmd_bytes: 3; /*!< Bytes of LCD command (1 ~ 4) */ diff --git a/src/host/ESP_PanelHost.cpp b/src/host/ESP_PanelHost.cpp index 24b59ed6..d34799af 100644 --- a/src/host/ESP_PanelHost.cpp +++ b/src/host/ESP_PanelHost.cpp @@ -20,6 +20,9 @@ ESP_PanelHost::~ESP_PanelHost() { ESP_PANEL_ENABLE_TAG_DEBUG_LOG(); + if (!del()) { + ESP_LOGE(TAG, "Delete panel host failed"); + } ESP_LOGD(TAG, "Destroyed"); } @@ -36,7 +39,7 @@ bool ESP_PanelHost::addHostI2C(const i2c_config_t &host_config, i2c_port_t host_ } ESP_LOGD(TAG, "Host I2C[%d] is already exist", (int)host_id); ESP_PANEL_CHECK_FALSE_RET(!memcmp(&ret->second, &host_config, sizeof(i2c_config_t)), false, - "Attempt to add with a different configuartion"); + "Attempt to add with a different configuration"); return true; } @@ -56,7 +59,7 @@ bool ESP_PanelHost::addHostI2C(int scl_io, int sda_io, i2c_port_t host_id) } ESP_LOGD(TAG, "Host I2C[%d] is already exist", (int)host_id); ESP_PANEL_CHECK_FALSE_RET(!memcmp(&ret->second, &host_config, sizeof(i2c_config_t)), false, - "Attempt to add with a different configuartion"); + "Attempt to add with a different configuration"); return true; } @@ -75,7 +78,7 @@ bool ESP_PanelHost::addHostSPI(const spi_bus_config_t &host_config, spi_host_dev ESP_LOGD(TAG, "Host SPI[%d] is already exist", (int)host_id); ESP_PANEL_CHECK_FALSE_RET(compare_spi_host_config(ret->second, host_config), false, - "Attempt to add with a different configuartion"); + "Attempt to add with a different configuration"); return true; } @@ -96,7 +99,7 @@ bool ESP_PanelHost::addHostSPI(int sck_io, int sda_io, int sdo_io, spi_host_devi ESP_LOGD(TAG, "Host SPI[%d] is already exist", (int)host_id); ESP_PANEL_CHECK_FALSE_RET(compare_spi_host_config(ret->second, host_config), false, - "Attempt to add with a different configuartion"); + "Attempt to add with a different configuration"); return true; } @@ -114,7 +117,7 @@ bool ESP_PanelHost::addHostQSPI(const spi_bus_config_t &host_config, spi_host_de } ESP_LOGD(TAG, "Host SPI[%d] is already exist", (int)host_id); ESP_PANEL_CHECK_FALSE_RET(!memcmp(&ret->second, &host_config, sizeof(spi_bus_config_t)), false, - "Attempt to add with a different configuartion"); + "Attempt to add with a different configuration"); return true; } @@ -134,7 +137,7 @@ bool ESP_PanelHost::addHostQSPI(int sck_io, int d0_io, int d1_io, int d2_io, int } ESP_LOGD(TAG, "Host SPI[%d] is already exist", (int)host_id); ESP_PANEL_CHECK_FALSE_RET(!memcmp(&ret->second, &host_config, sizeof(spi_bus_config_t)), false, - "Attempt to add with a different configuartion"); + "Attempt to add with a different configuration"); return true; } @@ -165,6 +168,31 @@ bool ESP_PanelHost::begin(void) return true; } +bool ESP_PanelHost::del(void) +{ + ESP_PANEL_ENABLE_TAG_DEBUG_LOG(); + + // Uninstall all I2C hosts + if (_i2c_host_config_map.size() > 0) { + for (auto &it : _i2c_host_config_map) { + ESP_PANEL_CHECK_ERR_RET(i2c_driver_delete(it.first), false, "I2C[%d] delete driver failed", it.first); + ESP_LOGD(TAG, "Delete host I2C[%d]", (int)it.first); + } + _i2c_host_config_map.clear(); + } + + // Uninstall all SPI hosts + if (_spi_host_config_map.size() > 0) { + for (auto &it : _spi_host_config_map) { + ESP_PANEL_CHECK_ERR_RET(spi_bus_free(it.first), false, "SPI[%d] free failed", it.first); + ESP_LOGD(TAG, "Delete host SPI[%d]", (int)it.first); + } + _spi_host_config_map.clear(); + } + + return true; +} + bool ESP_PanelHost::compare_spi_host_config(spi_bus_config_t &old_config, const spi_bus_config_t &new_config) { spi_bus_config_t temp_config = { }; diff --git a/src/host/ESP_PanelHost.h b/src/host/ESP_PanelHost.h index fbf9b769..d0ef8d31 100644 --- a/src/host/ESP_PanelHost.h +++ b/src/host/ESP_PanelHost.h @@ -39,7 +39,10 @@ #define ESP_PANEL_HOST_SPI_MAX_TRANSFER_SIZE ((1 << 24) >> 3) #elif CONFIG_IDF_TARGET_ESP32S2 #define ESP_PANEL_HOST_SPI_MAX_TRANSFER_SIZE ((1 << 23) >> 3) -#elif CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 +#else +// ESP32-C3, ESP32-C3, ESP32-C5, ESP32-C6, ESP32-C61 +// ESP32-S3 +// ESP32-P4 #define ESP_PANEL_HOST_SPI_MAX_TRANSFER_SIZE ((1 << 18) >> 3) #endif #define ESP_PANEL_HOST_SPI_CONFIG_DEFAULT(sck_io, sda_io, sdo_io) \ @@ -88,6 +91,7 @@ class ESP_PanelHost { bool addHostQSPI(int sck_io, int d0_io, int d1_io, int d2_io, int d3_io, spi_host_device_t host_id); bool begin(void); + bool del(void); private: bool compare_spi_host_config(spi_bus_config_t &old_config, const spi_bus_config_t &new_config); diff --git a/src/lcd/ESP_PanelLcd.cpp b/src/lcd/ESP_PanelLcd.cpp index 04e6aaf1..28e96038 100644 --- a/src/lcd/ESP_PanelLcd.cpp +++ b/src/lcd/ESP_PanelLcd.cpp @@ -4,12 +4,16 @@ * SPDX-License-Identifier: Apache-2.0 */ +#include #include "cstring" #include "ESP_PanelLog.h" +#include "soc/soc_caps.h" #include "esp_heap_caps.h" #include "esp_lcd_panel_ops.h" #include "esp_lcd_panel_io.h" +#if SOC_LCD_RGB_SUPPORTED #include "esp_lcd_panel_rgb.h" +#endif #include "esp_memory_utils.h" #include "freertos/FreeRTOS.h" #include "freertos/semphr.h" @@ -38,6 +42,8 @@ static const char *TAG = "ESP_PanelLcd"; +using namespace std; + ESP_PanelLcd::ESP_PanelLcd(ESP_PanelBus *bus, uint8_t color_bits, int rst_io): x_coord_align(0), y_coord_align(0), @@ -186,6 +192,10 @@ bool ESP_PanelLcd::reset(void) bool ESP_PanelLcd::del(void) { ESP_PANEL_CHECK_ERR_RET(esp_lcd_panel_del(handle), false, "Delete panel failed"); + if (_refresh_finish_sem) { + vSemaphoreDelete(_refresh_finish_sem); + _refresh_finish_sem = NULL; + } ESP_LOGD(TAG, "LCD panel @%p deleted", handle); handle = NULL; @@ -295,9 +305,11 @@ bool ESP_PanelLcd::attachRefreshFinishCallback(std::function call #if SOC_LCD_RGB_SUPPORTED && CONFIG_LCD_RGB_ISR_IRAM_SAFE && \ !(CONFIG_SPIRAM_RODATA && CONFIG_SPIRAM_FETCH_INSTRUCTIONS) if (bus->getType() == ESP_PANEL_BUS_TYPE_RGB) { - ESP_PANEL_CHECK_FALSE_RET((esp_ptr_in_iram(callback), false, "Callback function should be placed in IRAM, add - `IRAM_ATTR` before the function")); - ESP_PANEL_CHECK_FALSE_RET((esp_ptr_internal(user_data), false, "User data should be placed in SRAM")); + ESP_PANEL_CHECK_FALSE_RET( + esp_ptr_in_iram(callback), false, + "Callback function should be placed in IRAM, add `IRAM_ATTR` before the function" + ); + ESP_PANEL_CHECK_FALSE_RET((esp_ptr_internal(user_data), false, "User data should be placed in SRAM")); } #endif @@ -319,17 +331,11 @@ bool ESP_PanelLcd::colorBarTest(uint16_t width, uint16_t height) int bytes_per_piexl = bits_per_piexl / 8; int line_per_bar = height / bits_per_piexl; int line_count = 0; - uint8_t *single_bar_buf = NULL; int res_line_count = 0; /* Malloc memory for a single color bar */ - try { - single_bar_buf = new uint8_t[line_per_bar * width * bytes_per_piexl]; - } catch (std::bad_alloc &e) { - ESP_PANEL_CHECK_FALSE_RET(false, false, "Malloc color buffer failed"); - } - - bool ret = true; + shared_ptr single_bar_buf(new uint8_t[line_per_bar * width * bytes_per_piexl]); + ESP_PANEL_CHECK_FALSE_RET(single_bar_buf != nullptr, false, "Malloc color buffer failed"); /* Draw color bar from top left to bottom right, the order is B - G - R */ for (int j = 0; j < bits_per_piexl; j++) { @@ -337,18 +343,17 @@ bool ESP_PanelLcd::colorBarTest(uint16_t width, uint16_t height) for (int k = 0; k < bytes_per_piexl; k++) { if ((bus->getType() == ESP_PANEL_BUS_TYPE_SPI) || (bus->getType() == ESP_PANEL_BUS_TYPE_QSPI)) { // For SPI interface, the data bytes should be swapped since the data is sent by LSB first - single_bar_buf[i * bytes_per_piexl + k] = SPI_SWAP_DATA_TX(BIT(j), bits_per_piexl) >> (k * 8); + single_bar_buf.get()[i * bytes_per_piexl + k] = SPI_SWAP_DATA_TX(BIT(j), bits_per_piexl) >> (k * 8); } else { - single_bar_buf[i * bytes_per_piexl + k] = BIT(j) >> (k * 8); + single_bar_buf.get()[i * bytes_per_piexl + k] = BIT(j) >> (k * 8); } } } line_count += line_per_bar; - ret = drawBitmapWaitUntilFinish(0, j * line_per_bar, width, line_per_bar, single_bar_buf); - if (ret != true) { - ESP_LOGE(TAG, "Draw bitmap failed"); - goto end; - } + ESP_PANEL_CHECK_FALSE_RET( + drawBitmapWaitUntilFinish(0, j * line_per_bar, width, line_per_bar, single_bar_buf.get()), false, + "Draw bitmap failed" + ); } /* Fill the rest of the screen with white color */ @@ -356,18 +361,14 @@ bool ESP_PanelLcd::colorBarTest(uint16_t width, uint16_t height) if (res_line_count > 0) { ESP_LOGD(TAG, "Fill the rest lines (%d) with white color", res_line_count); - memset(single_bar_buf, 0xff, res_line_count * width * bytes_per_piexl); - ret = drawBitmapWaitUntilFinish(0, line_count, width, res_line_count, single_bar_buf); - if (ret != true) { - ESP_LOGE(TAG, "Draw bitmap failed"); - goto end; - } + memset(single_bar_buf.get(), 0xff, res_line_count * width * bytes_per_piexl); + ESP_PANEL_CHECK_FALSE_RET( + drawBitmapWaitUntilFinish(0, line_count, width, res_line_count, single_bar_buf.get()), false, + "Draw bitmap failed" + ); } -end: - delete[] single_bar_buf; - - return ret; + return true; } int ESP_PanelLcd::getColorBits(void) diff --git a/src/lcd/ESP_PanelLcd.h b/src/lcd/ESP_PanelLcd.h index 86d80254..c8fb4293 100644 --- a/src/lcd/ESP_PanelLcd.h +++ b/src/lcd/ESP_PanelLcd.h @@ -8,9 +8,12 @@ #include #include +#include "soc/soc_caps.h" #include "esp_lcd_panel_ops.h" #include "esp_lcd_panel_vendor.h" +#if SOC_LCD_RGB_SUPPORTED #include "esp_lcd_panel_rgb.h" +#endif #include "freertos/FreeRTOS.h" #include "freertos/semphr.h" #include "soc/soc_caps.h" @@ -75,7 +78,7 @@ class ESP_PanelLcd { * for initialization sequence code. * @note There are two formats for the sequence code: * 1. Raw data: {command, (uint8_t []){ data0, data1, ... }, data_size, delay_ms} - * 2. Formater: ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(delay_ms, command, { data0, data1, ... }) and + * 2. Formatter: ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(delay_ms, command, { data0, data1, ... }) and * ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(delay_ms, command) * * @return true if success, otherwise false @@ -99,7 +102,7 @@ class ESP_PanelLcd { * `mirror()`function will be implemented by software * @note This function is conflict with `configAutoReleaseBus()`, please don't use them at the same time * - * @param en ture: enable, false: disable + * @param en true: enable, false: disable * */ void configMirrorByCommand(bool en); @@ -114,7 +117,7 @@ class ESP_PanelLcd { * cannot be used to transmit commands any more. * @note This function is conflict with `configMirrorByCommand()`, please don't use them at the same time * - * @param en ture: enable, false: disable + * @param en true: enable, false: disable * */ void configAutoReleaseBus(bool en); @@ -227,7 +230,7 @@ class ESP_PanelLcd { * @brief Swap the X and Y axis * * @note This function should be called after `begin()` - * @note This function typically calls `esp_lcd_panel_swap_xy()` to mirror the axises + * @note This function typically calls `esp_lcd_panel_swap_xy()` to mirror the axes * * @param en true: enable, false: disable * @@ -260,7 +263,7 @@ class ESP_PanelLcd { bool setGapY(uint16_t gap); /** - * @brief Invert every bit of pixel color data, like frome `0x55` to `0xAA` + * @brief Invert every bit of pixel color data, like from `0x55` to `0xAA` * * @note This function should be called after `begin()` * @note This function typically calls `esp_lcd_panel_invert_color()` to invert the color diff --git a/src/lcd/base/esp_lcd_custom_types.h b/src/lcd/base/esp_lcd_custom_types.h index b8ede8be..19342b70 100644 --- a/src/lcd/base/esp_lcd_custom_types.h +++ b/src/lcd/base/esp_lcd_custom_types.h @@ -6,7 +6,10 @@ #pragma once +#include "soc/soc_caps.h" +#if SOC_LCD_RGB_SUPPORTED #include "esp_lcd_panel_rgb.h" +#endif #include "soc/soc_caps.h" #include "sdkconfig.h" diff --git a/src/lcd/base/esp_lcd_gc9503.c b/src/lcd/base/esp_lcd_gc9503.c index 851222bf..ad2c23ae 100644 --- a/src/lcd/base/esp_lcd_gc9503.c +++ b/src/lcd/base/esp_lcd_gc9503.c @@ -319,8 +319,8 @@ static esp_err_t panel_gc9503_del(esp_lcd_panel_t *panel) } // Delete RGB panel gc9503->del(panel); - free(gc9503); ESP_LOGD(TAG, "del gc9503 panel @%p", gc9503); + free(gc9503); return ESP_OK; } diff --git a/src/lcd/base/esp_lcd_ili9341.c b/src/lcd/base/esp_lcd_ili9341.c index bf2f4141..05e63c39 100644 --- a/src/lcd/base/esp_lcd_ili9341.c +++ b/src/lcd/base/esp_lcd_ili9341.c @@ -177,7 +177,7 @@ static esp_err_t panel_ili9341_reset(esp_lcd_panel_t *panel) static const esp_lcd_panel_vendor_init_cmd_t vendor_specific_init_default[] = { // {cmd, { data }, data_size, delay_ms} - /* Power contorl B, power control = 0, DC_ENA = 1 */ + /* Power control B, power control = 0, DC_ENA = 1 */ {0xCF, (uint8_t []){0x00, 0xAA, 0XE0}, 3, 0}, /* Power on sequence control, * cp1 keeps 1 frame, 1st frame enable diff --git a/src/lcd/base/esp_lcd_st7701.c b/src/lcd/base/esp_lcd_st7701.c index a97f62a8..8f2c678a 100644 --- a/src/lcd/base/esp_lcd_st7701.c +++ b/src/lcd/base/esp_lcd_st7701.c @@ -311,8 +311,8 @@ static esp_err_t panel_st7701_del(esp_lcd_panel_t *panel) } // Delete RGB panel st7701->del(panel); - free(st7701); ESP_LOGD(TAG, "del st7701 panel @%p", st7701); + free(st7701); return ESP_OK; } diff --git a/src/touch/ESP_PanelTouch.h b/src/touch/ESP_PanelTouch.h index 3ea8662b..1a8e4d7f 100644 --- a/src/touch/ESP_PanelTouch.h +++ b/src/touch/ESP_PanelTouch.h @@ -126,7 +126,7 @@ class ESP_PanelTouch { * @brief Swap the X and Y axis * * @note This function should be called after `begin()` - * @note This function typically calls `esp_lcd_touch_set_swap_xy()` to mirror the axises + * @note This function typically calls `esp_lcd_touch_set_swap_xy()` to mirror the axes * * @param en true: enable, false: disable * diff --git a/src/touch/Kconfig.touch b/src/touch/Kconfig.touch new file mode 100644 index 00000000..558579ec --- /dev/null +++ b/src/touch/Kconfig.touch @@ -0,0 +1,45 @@ +menu "LCD touch driver" + config ESP_PANEL_TOUCH_MAX_POINTS + int "Max point number" + default 5 + help + Maximum number of touch points that can be handled by the touch driver. + This value should be set to the maximum number of touch points supported by the touch controller. + + config ESP_PANEL_TOUCH_MAX_BUTTONS + int "Max button number" + default 1 + help + Maximum number of buttons that can be handled by the touch driver. + This value should be set to the maximum number of buttons supported by the touch controller. + + menu "XPT2046" + config ESP_PANEL_TOUCH_XPT2046_Z_THRESHOLD + int "Minimum Z pressure threshold" + default 400 + + config ESP_PANEL_TOUCH_XPT2046_INTERRUPT_MODE + bool "Enable Interrupt (PENIRQ) output" + default n + help + Also called Full Power Mode. Enable this to configure the XPT2046 to output low on the PENIRQ output if a touch is detected. This mode uses more power when enabled. Note that this signal goes low normally when a read is active. + + config ESP_PANEL_TOUCH_XPT2046_VREF_ON_MODE + bool "Keep internal Vref enabled" + default n + help + Enable this to keep the internal Vref enabled between conversions. This uses slightly more power, but requires fewer transactions when reading the battery voltage, aux voltage and temperature. + + config ESP_PANEL_TOUCH_XPT2046_CONVERT_ADC_TO_COORDS + bool "Convert touch coordinates to screen coordinates" + default y + help + When this option is enabled the raw ADC values will be converted from 0-4096 to 0-{screen width} or 0-{screen height}. When this option is disabled the process_coordinates method will need to be used to convert the raw ADC values into a screen coordinate. + + config ESP_PANEL_TOUCH_XPT2046_ENABLE_LOCKING + bool "Enable data structure locking" + default n + help + By enabling this option the XPT2046 driver will lock the touch position data structures when reading values from the XPT2046 and when reading position data via API. WARNING: enabling this option may result in unintended crashes. + endmenu +endmenu diff --git a/src/touch/base/esp_lcd_touch.h b/src/touch/base/esp_lcd_touch.h index 96b354a7..d3801832 100644 --- a/src/touch/base/esp_lcd_touch.h +++ b/src/touch/base/esp_lcd_touch.h @@ -150,7 +150,7 @@ struct esp_lcd_touch_s { * @param max_point_num: Maximum count of touched points to return (equals with max size of x and y array) * * @return - * - Returns true, when touched and coordinates readed. Otherwise returns false. + * - Returns true, when touched and coordinates read. Otherwise returns false. */ 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); @@ -164,7 +164,7 @@ struct esp_lcd_touch_s { * @param state: Button state * * @return - * - Returns true, when touched and coordinates readed. Otherwise returns false. + * - Returns true, when touched and coordinates read. Otherwise returns false. */ esp_err_t (*get_button_state)(esp_lcd_touch_handle_t tp, uint8_t n, uint8_t *state); #endif @@ -291,7 +291,7 @@ esp_err_t esp_lcd_touch_read_data(esp_lcd_touch_handle_t tp); * @param max_point_num: Maximum count of touched points to return (equals with max size of x and y array) * * @return - * - Returns true, when touched and coordinates readed. Otherwise returns false. + * - Returns true, when touched and coordinates read. Otherwise returns false. */ bool esp_lcd_touch_get_coordinates(esp_lcd_touch_handle_t tp, uint16_t *x, uint16_t *y, uint16_t *strength, uint8_t *point_num, uint8_t max_point_num); diff --git a/src/touch/base/esp_lcd_touch_gt1151.c b/src/touch/base/esp_lcd_touch_gt1151.c index 7a397952..d2b8a75c 100644 --- a/src/touch/base/esp_lcd_touch_gt1151.c +++ b/src/touch/base/esp_lcd_touch_gt1151.c @@ -138,7 +138,7 @@ static esp_err_t read_data(esp_lcd_touch_handle_t tp) ESP_RETURN_ON_ERROR( i2c_read_bytes(tp, READ_XY_REG, buf, DATA_BUFF_LEN(touch_cnt)), TAG, "I2C read failed"); /* Clear all */ i2c_write_byte(tp, READ_XY_REG, 0); - /* Caculate checksum */ + /* Calculate checksum */ uint8_t checksum = 0; for (int i = 0; i < DATA_BUFF_LEN(touch_cnt); i++) { checksum += buf[i]; diff --git a/src/touch/base/esp_lcd_touch_xpt2046.c b/src/touch/base/esp_lcd_touch_xpt2046.c index dcf6a592..50afbcd0 100644 --- a/src/touch/base/esp_lcd_touch_xpt2046.c +++ b/src/touch/base/esp_lcd_touch_xpt2046.c @@ -41,7 +41,7 @@ static const char *TAG = "xpt2046"; #define XPT2046_PD_BITS (XPT2046_PD1_BIT | XPT2046_PD0_BIT) enum xpt2046_registers { - // START ADDR MODE SER/ VREF ADC (PENIRQ) + // START ADDR MODE SET/ VREF ADC (PENIRQ) // 12/8b DFR INT/EXT ENA Z_VALUE_1 = 0xB0 | XPT2046_PD_BITS, // 1 011 0 0 X X Z_VALUE_2 = 0xC0 | XPT2046_PD_BITS, // 1 100 0 0 X X diff --git a/src/touch/base/esp_lcd_touch_xpt2046.h b/src/touch/base/esp_lcd_touch_xpt2046.h index c67f4d67..9539ce0a 100644 --- a/src/touch/base/esp_lcd_touch_xpt2046.h +++ b/src/touch/base/esp_lcd_touch_xpt2046.h @@ -213,7 +213,7 @@ esp_err_t esp_lcd_touch_xpt2046_read_aux_level(const esp_lcd_touch_handle_t hand * calibration offset for accurate results. * * @param handle: XPT2046 instance handle. - * @param out_level: Approximate tempreature of the TSC2046 in degrees C + * @param out_level: Approximate temperature of the TSC2046 in degrees C * @return * - ESP_OK on success, otherwise returns ESP_ERR_xxx */ @@ -224,7 +224,7 @@ esp_err_t esp_lcd_touch_xpt2046_read_temp0_level(const esp_lcd_touch_handle_t ha * Low precision (1.6 degrees C) but high accuracy requires no calibration. * * @param handle: XPT2046 instance handle. - * @param out_level: Approximate tempreature of the TSC2046 in degrees C + * @param out_level: Approximate temperature of the TSC2046 in degrees C * @return * - ESP_OK on success, otherwise returns ESP_ERR_xxx */ diff --git a/test_apps/lcd/3wire_spi_rgb/CMakeLists.txt b/test_apps/lcd/3wire_spi_rgb/CMakeLists.txt new file mode 100644 index 00000000..3b65f42d --- /dev/null +++ b/test_apps/lcd/3wire_spi_rgb/CMakeLists.txt @@ -0,0 +1,5 @@ +# The following lines of boilerplate have to be in your project's CMakeLists +# in this exact order for cmake to work correctly +cmake_minimum_required(VERSION 3.5) +include($ENV{IDF_PATH}/tools/cmake/project.cmake) +project(3wire_spi_rgb_lcd_test) diff --git a/test_apps/lcd/3wire_spi_rgb/main/CMakeLists.txt b/test_apps/lcd/3wire_spi_rgb/main/CMakeLists.txt new file mode 100644 index 00000000..1eb34163 --- /dev/null +++ b/test_apps/lcd/3wire_spi_rgb/main/CMakeLists.txt @@ -0,0 +1,5 @@ +idf_component_register( + SRCS "test_app_main.c" "test_3wire_spi_rgb_lcd.cpp" + PRIV_REQUIRES esp_lcd driver esp_timer + WHOLE_ARCHIVE +) diff --git a/test_apps/lcd/3wire_spi_rgb/main/idf_component.yml b/test_apps/lcd/3wire_spi_rgb/main/idf_component.yml new file mode 100644 index 00000000..bbace3aa --- /dev/null +++ b/test_apps/lcd/3wire_spi_rgb/main/idf_component.yml @@ -0,0 +1,9 @@ +## IDF Component Manager Manifest File +dependencies: + test_utils: + path: ${IDF_PATH}/tools/unit-test-app/components/test_utils + test_driver_utils: + path: ${IDF_PATH}/components/driver/test_apps/components/test_driver_utils + ESP32_Display_Panel: + version: "*" + override_path: "../../../../../ESP32_Display_Panel" diff --git a/test_apps/lcd/3wire_spi_rgb/main/test_3wire_spi_rgb_lcd.cpp b/test_apps/lcd/3wire_spi_rgb/main/test_3wire_spi_rgb_lcd.cpp new file mode 100644 index 00000000..550d5ffa --- /dev/null +++ b/test_apps/lcd/3wire_spi_rgb/main/test_3wire_spi_rgb_lcd.cpp @@ -0,0 +1,237 @@ +/* + * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: CC0-1.0 + */ +#include +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" +#include "esp_heap_caps.h" +#include "esp_log.h" +#include "esp_timer.h" +#include "unity.h" +#include "unity_test_runner.h" +#include "ESP_Panel_Library.h" + +using namespace std; + +// *INDENT-OFF* + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////// Please update the following configuration according to your LCD spec ////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +#define TEST_LCD_WIDTH (800) +#define TEST_LCD_HEIGHT (480) + // | 8-bit RGB888 | 16-bit RGB565 | +#define TEST_LCD_COLOR_BITS (18) // | 24 | 16/18/24 | +#define TEST_LCD_RGB_DATA_WIDTH (16) // | 8 | 16 | +#define TEST_LCD_RGB_TIMING_FREQ_HZ (16 * 1000 * 1000) +#define TEST_LCD_RGB_TIMING_HPW (10) +#define TEST_LCD_RGB_TIMING_HBP (10) +#define TEST_LCD_RGB_TIMING_HFP (20) +#define TEST_LCD_RGB_TIMING_VPW (10) +#define TEST_LCD_RGB_TIMING_VBP (10) +#define TEST_LCD_RGB_TIMING_VFP (10) +#define TEST_LCD_RGB_BOUNCE_BUFFER_SIZE (TEST_LCD_WIDTH * 10) +#define TEST_LCD_USE_EXTERNAL_CMD (1) +#if TEST_LCD_USE_EXTERNAL_CMD +/** + * LCD 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, then use `configVendorCommands()` to pass them in the + * same format if needed. Otherwise, the LCD driver will use the default initialization sequence code. + * + * There are two formats for the sequence code: + * 1. Raw data: {command, (uint8_t []){ data0, data1, ... }, data_size, delay_ms} + * 2. Formatter: ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(delay_ms, command, { data0, data1, ... }) and + * ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(delay_ms, command) + */ +const esp_lcd_panel_vendor_init_cmd_t lcd_init_cmd[] = { + // {0xFF, (uint8_t []){0x77, 0x01, 0x00, 0x00, 0x10}, 5, 0}, + // {0xC0, (uint8_t []){0x3B, 0x00}, 2, 0}, + // {0xC1, (uint8_t []){0x0D, 0x02}, 2, 0}, + // {0x29, (uint8_t []){0x00}, 0, 120}, + // // or + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xFF, {0x77, 0x01, 0x00, 0x00, 0x10}), + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC0, {0x3B, 0x00}), + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC1, {0x0D, 0x02}), + ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(120, 0x29), +}; +#endif + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////// Please update the following configuration according to your board spec //////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +#define TEST_LCD_PIN_NUM_RGB_DISP (-1) +#define TEST_LCD_PIN_NUM_RGB_VSYNC (3) +#define TEST_LCD_PIN_NUM_RGB_HSYNC (46) +#define TEST_LCD_PIN_NUM_RGB_DE (17) +#define TEST_LCD_PIN_NUM_RGB_PCLK (9) + // | RGB565 | RGB666 | RGB888 | + // |--------|--------|--------| +#define TEST_LCD_PIN_NUM_RGB_DATA0 (10) // | B0 | B0-1 | B0-3 | +#define TEST_LCD_PIN_NUM_RGB_DATA1 (11) // | B1 | B2 | B4 | +#define TEST_LCD_PIN_NUM_RGB_DATA2 (12) // | B2 | B3 | B5 | +#define TEST_LCD_PIN_NUM_RGB_DATA3 (13) // | B3 | B4 | B6 | +#define TEST_LCD_PIN_NUM_RGB_DATA4 (14) // | B4 | B5 | B7 | +#define TEST_LCD_PIN_NUM_RGB_DATA5 (21) // | G0 | G0 | G0-2 | +#define TEST_LCD_PIN_NUM_RGB_DATA6 (47) // | G1 | G1 | G3 | +#define TEST_LCD_PIN_NUM_RGB_DATA7 (48) // | G2 | G2 | G4 | +#if TEST_LCD_RGB_DATA_WIDTH > 8 +#define TEST_LCD_PIN_NUM_RGB_DATA8 (45) // | G3 | G3 | G5 | +#define TEST_LCD_PIN_NUM_RGB_DATA9 (38) // | G4 | G4 | G6 | +#define TEST_LCD_PIN_NUM_RGB_DATA10 (39) // | G5 | G5 | G7 | +#define TEST_LCD_PIN_NUM_RGB_DATA11 (40) // | R0 | R0-1 | R0-3 | +#define TEST_LCD_PIN_NUM_RGB_DATA12 (41) // | R1 | R2 | R4 | +#define TEST_LCD_PIN_NUM_RGB_DATA13 (42) // | R2 | R3 | R5 | +#define TEST_LCD_PIN_NUM_RGB_DATA14 (2) // | R3 | R4 | R6 | +#define TEST_LCD_PIN_NUM_RGB_DATA15 (1) // | R4 | R5 | R7 | +#endif +#define TEST_LCD_PIN_NUM_SPI_CS (39) +#define TEST_LCD_PIN_NUM_SPI_SCK (48) +#define TEST_LCD_PIN_NUM_SPI_SDA (47) +#define TEST_LCD_PIN_NUM_RST (-1) // Set to -1 if not used +#define TEST_LCD_PIN_NUM_BK_LIGHT (-1) // Set to -1 if not used +#define TEST_LCD_BK_LIGHT_ON_LEVEL (1) +#define TEST_LCD_BK_LIGHT_OFF_LEVEL !TEST_LCD_BK_LIGHT_ON_LEVEL + +// *INDENT-OFF* + +/* Enable or disable printing RGB refresh rate */ +#define TEST_ENABLE_PRINT_LCD_FPS (1) +/* Enable or disable the attachment of a callback function that is called after each bitmap drawing is completed */ +#define TEST_ENABLE_ATTACH_CALLBACK (1) +#define TEST_COLOR_BAR_SHOW_TIME_MS (3000) + +static const char *TAG = "test_3wire_spi_rgb_lcd"; + +static shared_ptr init_backlight(void) +{ +#if TEST_LCD_PIN_NUM_BK_LIGHT >= 0 + ESP_LOGI(TAG, "Initialize backlight control pin and turn it on"); + shared_ptr backlight = make_shared( + TEST_LCD_PIN_NUM_BK_LIGHT, TEST_LCD_BK_LIGHT_ON_LEVEL, true + ); + TEST_ASSERT_NOT_NULL_MESSAGE(backlight, "Create backlight object failed"); + + TEST_ASSERT_TRUE_MESSAGE(backlight->begin(), "Backlight begin failed"); + TEST_ASSERT_TRUE_MESSAGE(backlight->on(), "Backlight on failed"); + + return backlight; +#else + return nullptr; +#endif +} + +static shared_ptr init_panel_bus(void) +{ + ESP_LOGI(TAG, "Create LCD bus"); + shared_ptr panel_bus = make_shared( +#if TEST_LCD_RGB_DATA_WIDTH == 8 + TEST_LCD_WIDTH, TEST_LCD_HEIGHT, + TEST_LCD_PIN_NUM_SPI_CS, TEST_LCD_PIN_NUM_SPI_SCK, TEST_LCD_PIN_NUM_SPI_SDA, + TEST_LCD_PIN_NUM_RGB_DATA0, TEST_LCD_PIN_NUM_RGB_DATA1, TEST_LCD_PIN_NUM_RGB_DATA2, TEST_LCD_PIN_NUM_RGB_DATA3, + TEST_LCD_PIN_NUM_RGB_DATA4, TEST_LCD_PIN_NUM_RGB_DATA5, TEST_LCD_PIN_NUM_RGB_DATA6, TEST_LCD_PIN_NUM_RGB_DATA7, + TEST_LCD_PIN_NUM_RGB_HSYNC, TEST_LCD_PIN_NUM_RGB_VSYNC, TEST_LCD_PIN_NUM_RGB_PCLK, TEST_LCD_PIN_NUM_RGB_DE, + TEST_LCD_PIN_NUM_RGB_DISP +#elif TEST_LCD_RGB_DATA_WIDTH == 16 + TEST_LCD_WIDTH, TEST_LCD_HEIGHT, + TEST_LCD_PIN_NUM_SPI_CS, TEST_LCD_PIN_NUM_SPI_SCK, TEST_LCD_PIN_NUM_SPI_SDA, + TEST_LCD_PIN_NUM_RGB_DATA0, TEST_LCD_PIN_NUM_RGB_DATA1, TEST_LCD_PIN_NUM_RGB_DATA2, TEST_LCD_PIN_NUM_RGB_DATA3, + TEST_LCD_PIN_NUM_RGB_DATA4, TEST_LCD_PIN_NUM_RGB_DATA5, TEST_LCD_PIN_NUM_RGB_DATA6, TEST_LCD_PIN_NUM_RGB_DATA7, + TEST_LCD_PIN_NUM_RGB_DATA8, TEST_LCD_PIN_NUM_RGB_DATA9, TEST_LCD_PIN_NUM_RGB_DATA10, TEST_LCD_PIN_NUM_RGB_DATA11, + TEST_LCD_PIN_NUM_RGB_DATA12, TEST_LCD_PIN_NUM_RGB_DATA13, TEST_LCD_PIN_NUM_RGB_DATA14, TEST_LCD_PIN_NUM_RGB_DATA15, + TEST_LCD_PIN_NUM_RGB_HSYNC, TEST_LCD_PIN_NUM_RGB_VSYNC, TEST_LCD_PIN_NUM_RGB_PCLK, TEST_LCD_PIN_NUM_RGB_DE, + TEST_LCD_PIN_NUM_RGB_DISP +#endif + ); + TEST_ASSERT_NOT_NULL_MESSAGE(panel_bus, "Create panel bus object failed"); + + panel_bus->configRgbTimingFreqHz(TEST_LCD_RGB_TIMING_FREQ_HZ); + panel_bus->configRgbTimingPorch( + TEST_LCD_RGB_TIMING_HPW, TEST_LCD_RGB_TIMING_HBP, TEST_LCD_RGB_TIMING_HFP, + TEST_LCD_RGB_TIMING_VPW, TEST_LCD_RGB_TIMING_VBP, TEST_LCD_RGB_TIMING_VFP + ); + panel_bus->configRgbBounceBufferSize(TEST_LCD_RGB_BOUNCE_BUFFER_SIZE); // Set bounce buffer to avoid screen drift + TEST_ASSERT_TRUE_MESSAGE(panel_bus->begin(), "Panel bus begin failed"); + + return panel_bus; +} + +#if TEST_ENABLE_PRINT_LCD_FPS +#define TEST_LCD_FPS_COUNT_MAX (100) +#ifndef millis +#define millis() (esp_timer_get_time() / 1000) +#endif + +DRAM_ATTR int frame_count = 0; +DRAM_ATTR int fps = 0; +DRAM_ATTR long start_time = 0; + +IRAM_ATTR bool onVsyncEndCallback(void *user_data) +{ + long frame_start_time = *(long *)user_data; + if (frame_start_time == 0) { + (*(long *)user_data) = millis(); + + return false; + } + + frame_count++; + if (frame_count >= TEST_LCD_FPS_COUNT_MAX) { + fps = TEST_LCD_FPS_COUNT_MAX * 1000 / (millis() - frame_start_time); + frame_count = 0; + (*(long *)user_data) = millis(); + } + + return false; +} +#endif + +static void run_test(shared_ptr lcd) +{ +#if TEST_LCD_USE_EXTERNAL_CMD + // Configure external initialization commands, should called before `init()` + lcd->configVendorCommands(lcd_init_cmd, sizeof(lcd_init_cmd) / sizeof(lcd_init_cmd[0])); +#endif + TEST_ASSERT_TRUE_MESSAGE(lcd->init(), "LCD init failed"); + TEST_ASSERT_TRUE_MESSAGE(lcd->reset(), "LCD reset failed"); + TEST_ASSERT_TRUE_MESSAGE(lcd->begin(), "LCD begin failed"); +#if TEST_LCD_PIN_NUM_RGB_DISP >= 0 + TEST_ASSERT_TRUE_MESSAGE(lcd->displayOn(), "LCD display on failed"); +#endif +#if TEST_ENABLE_PRINT_LCD_FPS + TEST_ASSERT_TRUE_MESSAGE( + lcd->attachRefreshFinishCallback(onVsyncEndCallback, (void *)&start_time), "Attach refresh callback failed" + ); +#endif + + ESP_LOGI(TAG, "Draw color bar from top left to bottom right, the order is B - G - R"); + TEST_ASSERT_TRUE_MESSAGE(lcd->colorBarTest(TEST_LCD_WIDTH, TEST_LCD_HEIGHT), "LCD color bar test failed"); +} + +#define CREATE_LCD(name, panel_bus) \ + ({ \ + ESP_LOGI(TAG, "Create LCD device: " #name); \ + shared_ptr lcd = make_shared(panel_bus, TEST_LCD_COLOR_BITS, TEST_LCD_PIN_NUM_RST); \ + TEST_ASSERT_NOT_NULL_MESSAGE(lcd, "Create LCD object failed"); \ + lcd; \ + }) +#define CREATE_TEST_CASE(name) \ + TEST_CASE("Test LCD (" #name ") to draw color bar", "[3wire_spi_rgb_lcd][" #name "]") \ + { \ + shared_ptr backlight = init_backlight(); \ + shared_ptr panel_bus = init_panel_bus(); \ + shared_ptr lcd = CREATE_LCD(name, panel_bus.get()); \ + run_test(lcd); \ + } + +/** + * Here to create test cases for different LCDs + * + */ +CREATE_TEST_CASE(GC9503) +CREATE_TEST_CASE(ST7701) diff --git a/test_apps/lcd/3wire_spi_rgb/main/test_app_main.c b/test_apps/lcd/3wire_spi_rgb/main/test_app_main.c new file mode 100644 index 00000000..ad471114 --- /dev/null +++ b/test_apps/lcd/3wire_spi_rgb/main/test_app_main.c @@ -0,0 +1,63 @@ +/* + * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: CC0-1.0 + */ +#include +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" +#include "esp_heap_caps.h" +#include "unity.h" +#include "unity_test_runner.h" + +// Some resources are lazy allocated in the LCD driver, the threadhold is left for that case +#define TEST_MEMORY_LEAK_THRESHOLD (-300) + +static size_t before_free_8bit; +static size_t before_free_32bit; + +static void check_leak(size_t before_free, size_t after_free, const char *type) +{ + ssize_t delta = after_free - before_free; + printf("MALLOC_CAP_%s: Before %u bytes free, After %u bytes free (delta %d)\n", type, before_free, after_free, delta); + TEST_ASSERT_MESSAGE(delta >= TEST_MEMORY_LEAK_THRESHOLD, "memory leak"); +} + +void setUp(void) +{ + before_free_8bit = heap_caps_get_free_size(MALLOC_CAP_8BIT); + before_free_32bit = heap_caps_get_free_size(MALLOC_CAP_32BIT); +} + +void tearDown(void) +{ + size_t after_free_8bit = heap_caps_get_free_size(MALLOC_CAP_8BIT); + size_t after_free_32bit = heap_caps_get_free_size(MALLOC_CAP_32BIT); + check_leak(before_free_8bit, after_free_8bit, "8BIT"); + check_leak(before_free_32bit, after_free_32bit, "32BIT"); +} + +void app_main(void) +{ + /** + * ______ __ __ ______ _______ ________ ______ _______ ______ _______ ______ _______ __ ______ _______ + * / \ | \ _ | \| \| \ | \ / \ | \| \ | \ / \ | \ | \ / \ | \ + * | $$$$$$\| $$ / \ | $$ \$$$$$$| $$$$$$$\| $$$$$$$$ | $$$$$$\| $$$$$$$\\$$$$$$ | $$$$$$$\| $$$$$$\| $$$$$$$\ | $$ | $$$$$$\| $$$$$$$\ + * \$$__| $$| $$/ $\| $$ | $$ | $$__| $$| $$__ ______| $$___\$$| $$__/ $$ | $$ | $$__| $$| $$ __\$$| $$__/ $$ | $$ | $$ \$$| $$ | $$ + * | $$| $$ $$$\ $$ | $$ | $$ $$| $$ \| \\$$ \ | $$ $$ | $$ | $$ $$| $$| \| $$ $$ | $$ | $$ | $$ | $$ + * __\$$$$$\| $$ $$\$$\$$ | $$ | $$$$$$$\| $$$$$ \$$$$$$_\$$$$$$\| $$$$$$$ | $$ | $$$$$$$\| $$ \$$$$| $$$$$$$\ | $$ | $$ __ | $$ | $$ + * | \__| $$| $$$$ \$$$$ _| $$_ | $$ | $$| $$_____ | \__| $$| $$ _| $$_ | $$ | $$| $$__| $$| $$__/ $$ | $$_____| $$__/ \| $$__/ $$ + * \$$ $$| $$$ \$$$| $$ \| $$ | $$| $$ \ \$$ $$| $$ | $$ \ | $$ | $$ \$$ $$| $$ $$ | $$ \\$$ $$| $$ $$ + * \$$$$$$ \$$ \$$ \$$$$$$ \$$ \$$ \$$$$$$$$ \$$$$$$ \$$ \$$$$$$ \$$ \$$ \$$$$$$ \$$$$$$$ \$$$$$$$$ \$$$$$$ \$$$$$$$ + */ + printf(" ______ __ __ ______ _______ ________ ______ _______ ______ _______ ______ _______ __ ______ _______\r\n"); + printf(" / \\ | \\ _ | \\| \\| \\ | \\ / \\ | \\| \\ | \\ / \\ | \\ | \\ / \\ | \\\r\n"); + printf("| $$$$$$\\| $$ / \\ | $$ \\$$$$$$| $$$$$$$\\| $$$$$$$$ | $$$$$$\\| $$$$$$$\\\\$$$$$$ | $$$$$$$\\| $$$$$$\\| $$$$$$$\\ | $$ | $$$$$$\\| $$$$$$$\\\r\n"); + printf(" \\$$__| $$| $$/ $\\| $$ | $$ | $$__| $$| $$__ ______| $$___\\$$| $$__/ $$ | $$ | $$__| $$| $$ __\\$$| $$__/ $$ | $$ | $$ \\$$| $$ | $$\r\n"); + printf(" | $$| $$ $$$\\ $$ | $$ | $$ $$| $$ \\| \\\\$$ \\ | $$ $$ | $$ | $$ $$| $$| \\| $$ $$ | $$ | $$ | $$ | $$\r\n"); + printf(" __\\$$$$$\\| $$ $$\\$$\\$$ | $$ | $$$$$$$\\| $$$$$ \\$$$$$$_\\$$$$$$\\| $$$$$$$ | $$ | $$$$$$$\\| $$ \\$$$$| $$$$$$$\\ | $$ | $$ __ | $$ | $$\r\n"); + printf("| \\__| $$| $$$$ \\$$$$ _| $$_ | $$ | $$| $$_____ | \\__| $$| $$ _| $$_ | $$ | $$| $$__| $$| $$__/ $$ | $$_____| $$__/ \\| $$__/ $$\r\n"); + printf(" \\$$ $$| $$$ \\$$$| $$ \\| $$ | $$| $$ \\ \\$$ $$| $$ | $$ \\ | $$ | $$ \\$$ $$| $$ $$ | $$ \\\\$$ $$| $$ $$\r\n"); + printf(" \\$$$$$$ \\$$ \\$$ \\$$$$$$ \\$$ \\$$ \\$$$$$$$$ \\$$$$$$ \\$$ \\$$$$$$ \\$$ \\$$ \\$$$$$$ \\$$$$$$$ \\$$$$$$$$ \\$$$$$$ \\$$$$$$$\r\n"); + unity_run_menu(); +} diff --git a/test_apps/lcd/3wire_spi_rgb/sdkconfig.defaults b/test_apps/lcd/3wire_spi_rgb/sdkconfig.defaults new file mode 100644 index 00000000..f627e6eb --- /dev/null +++ b/test_apps/lcd/3wire_spi_rgb/sdkconfig.defaults @@ -0,0 +1,7 @@ +CONFIG_SPIRAM=y +CONFIG_SPIRAM_MODE_OCT=y +CONFIG_SPIRAM_FETCH_INSTRUCTIONS=y +CONFIG_SPIRAM_RODATA=y +CONFIG_SPIRAM_SPEED_80M=y +CONFIG_ESP_TASK_WDT_INIT=n +CONFIG_FREERTOS_HZ=1000 diff --git a/test_apps/lcd/qspi/CMakeLists.txt b/test_apps/lcd/qspi/CMakeLists.txt new file mode 100644 index 00000000..0a401187 --- /dev/null +++ b/test_apps/lcd/qspi/CMakeLists.txt @@ -0,0 +1,5 @@ +# The following lines of boilerplate have to be in your project's CMakeLists +# in this exact order for cmake to work correctly +cmake_minimum_required(VERSION 3.5) +include($ENV{IDF_PATH}/tools/cmake/project.cmake) +project(qspi_lcd_test) diff --git a/test_apps/lcd/qspi/main/CMakeLists.txt b/test_apps/lcd/qspi/main/CMakeLists.txt new file mode 100644 index 00000000..9fc1653a --- /dev/null +++ b/test_apps/lcd/qspi/main/CMakeLists.txt @@ -0,0 +1,5 @@ +idf_component_register( + SRCS "test_app_main.c" "test_qspi_lcd.cpp" + PRIV_REQUIRES esp_lcd driver + WHOLE_ARCHIVE +) diff --git a/test_apps/lcd/qspi/main/idf_component.yml b/test_apps/lcd/qspi/main/idf_component.yml new file mode 100644 index 00000000..bbace3aa --- /dev/null +++ b/test_apps/lcd/qspi/main/idf_component.yml @@ -0,0 +1,9 @@ +## IDF Component Manager Manifest File +dependencies: + test_utils: + path: ${IDF_PATH}/tools/unit-test-app/components/test_utils + test_driver_utils: + path: ${IDF_PATH}/components/driver/test_apps/components/test_driver_utils + ESP32_Display_Panel: + version: "*" + override_path: "../../../../../ESP32_Display_Panel" diff --git a/test_apps/lcd/qspi/main/test_app_main.c b/test_apps/lcd/qspi/main/test_app_main.c new file mode 100644 index 00000000..6dadfea8 --- /dev/null +++ b/test_apps/lcd/qspi/main/test_app_main.c @@ -0,0 +1,65 @@ +/* + * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: CC0-1.0 + */ +#include +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" +#include "esp_heap_caps.h" +#include "unity.h" +#include "unity_test_runner.h" + +// Some resources are lazy allocated in the LCD driver, the threadhold is left for that case +#define TEST_MEMORY_LEAK_THRESHOLD (-300) + +static size_t before_free_8bit; +static size_t before_free_32bit; + +static void check_leak(size_t before_free, size_t after_free, const char *type) +{ + ssize_t delta = after_free - before_free; + printf("MALLOC_CAP_%s: Before %u bytes free, After %u bytes free (delta %d)\n", type, before_free, after_free, delta); + TEST_ASSERT_MESSAGE(delta >= TEST_MEMORY_LEAK_THRESHOLD, "memory leak"); +} + +void setUp(void) +{ + before_free_8bit = heap_caps_get_free_size(MALLOC_CAP_8BIT); + before_free_32bit = heap_caps_get_free_size(MALLOC_CAP_32BIT); +} + +void tearDown(void) +{ + size_t after_free_8bit = heap_caps_get_free_size(MALLOC_CAP_8BIT); + size_t after_free_32bit = heap_caps_get_free_size(MALLOC_CAP_32BIT); + check_leak(before_free_8bit, after_free_8bit, "8BIT"); + check_leak(before_free_32bit, after_free_32bit, "32BIT"); +} + +void app_main(void) +{ + /** + * ______ ______ _______ ______ __ ______ _______ + * / \ / \ | \| \ | \ / \ | \ + * | $$$$$$\| $$$$$$\| $$$$$$$\\$$$$$$ | $$ | $$$$$$\| $$$$$$$\ + * | $$ | $$| $$___\$$| $$__/ $$ | $$ | $$ | $$ \$$| $$ | $$ + * | $$ | $$ \$$ \ | $$ $$ | $$ | $$ | $$ | $$ | $$ + * | $$ _| $$ _\$$$$$$\| $$$$$$$ | $$ | $$ | $$ __ | $$ | $$ + * | $$/ \ $$| \__| $$| $$ _| $$_ | $$_____| $$__/ \| $$__/ $$ + * \$$ $$ $$ \$$ $$| $$ | $$ \ | $$ \\$$ $$| $$ $$ + * \$$$$$$\ \$$$$$$ \$$ \$$$$$$ \$$$$$$$$ \$$$$$$ \$$$$$$$ + * \$$$ + */ + printf(" ______ ______ _______ ______ __ ______ _______\r\n"); + printf(" / \\ / \\ | \\| \\ | \\ / \\ | \\\r\n"); + printf("| $$$$$$\\| $$$$$$\\| $$$$$$$\\\\$$$$$$ | $$ | $$$$$$\\| $$$$$$$\\\r\n"); + printf("| $$ | $$| $$___\\$$| $$__/ $$ | $$ | $$ | $$ \\$$| $$ | $$\r\n"); + printf("| $$ | $$ \\$$ \\ | $$ $$ | $$ | $$ | $$ | $$ | $$\r\n"); + printf("| $$ _| $$ _\\$$$$$$\\| $$$$$$$ | $$ | $$ | $$ __ | $$ | $$\r\n"); + printf("| $$/ \\ $$| \\__| $$| $$ _| $$_ | $$_____| $$__/ \\| $$__/ $$\r\n"); + printf(" \\$$ $$ $$ \\$$ $$| $$ | $$ \\ | $$ \\\\$$ $$| $$ $$\r\n"); + printf(" \\$$$$$$\\ \\$$$$$$ \\$$ \\$$$$$$ \\$$$$$$$$ \\$$$$$$ \\$$$$$$$\r\n"); + printf(" \\$$$\r\n"); + unity_run_menu(); +} diff --git a/test_apps/lcd/qspi/main/test_qspi_lcd.cpp b/test_apps/lcd/qspi/main/test_qspi_lcd.cpp new file mode 100644 index 00000000..e69d530a --- /dev/null +++ b/test_apps/lcd/qspi/main/test_qspi_lcd.cpp @@ -0,0 +1,160 @@ +/* + * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: CC0-1.0 + */ +#include +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" +#include "esp_heap_caps.h" +#include "esp_log.h" +#include "unity.h" +#include "unity_test_runner.h" +#include "ESP_Panel_Library.h" + +using namespace std; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////// Please update the following configuration according to your LCD spec ////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +#define TEST_LCD_WIDTH (532) +#define TEST_LCD_HEIGHT (300) +#define TEST_LCD_COLOR_BITS (16) +#define TEST_LCD_SPI_FREQ_HZ (40 * 1000 * 1000) +#define TEST_LCD_USE_EXTERNAL_CMD (1) +#if TEST_LCD_USE_EXTERNAL_CMD +/** + * LCD 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, then use `configVendorCommands()` to pass them in the + * same format if needed. Otherwise, the LCD driver will use the default initialization sequence code. + * + * There are two formats for the sequence code: + * 1. Raw data: {command, (uint8_t []){ data0, data1, ... }, data_size, delay_ms} + * 2. Formatter: ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(delay_ms, command, { data0, data1, ... }) and + * ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(delay_ms, command) + */ +const esp_lcd_panel_vendor_init_cmd_t lcd_init_cmd[] = { + // {0xFF, (uint8_t []){0x77, 0x01, 0x00, 0x00, 0x10}, 5, 0}, + // {0xC0, (uint8_t []){0x3B, 0x00}, 2, 0}, + // {0xC1, (uint8_t []){0x0D, 0x02}, 2, 0}, + // {0x29, (uint8_t []){0x00}, 0, 120}, + // // or + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xFF, {0x77, 0x01, 0x00, 0x00, 0x10}), + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC0, {0x3B, 0x00}), + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC1, {0x0D, 0x02}), + ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(120, 0x29), +}; +#endif + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////// Please update the following configuration according to your board spec //////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +#define TEST_LCD_PIN_NUM_SPI_CS (9) +#define TEST_LCD_PIN_NUM_SPI_SCK (10) +#define TEST_LCD_PIN_NUM_SPI_DATA0 (11) +#define TEST_LCD_PIN_NUM_SPI_DATA1 (12) +#define TEST_LCD_PIN_NUM_SPI_DATA2 (13) +#define TEST_LCD_PIN_NUM_SPI_DATA3 (14) +#define TEST_LCD_PIN_NUM_RST (3) // Set to -1 if not used +#define TEST_LCD_PIN_NUM_BK_LIGHT (-1) // Set to -1 if not used +#define TEST_LCD_BK_LIGHT_ON_LEVEL (1) +#define TEST_LCD_BK_LIGHT_OFF_LEVEL !TEST_LCD_BK_LIGHT_ON_LEVEL + +/* Enable or disable the attachment of a callback function that is called after each bitmap drawing is completed */ +#define TEST_ENABLE_ATTACH_CALLBACK (1) +#define TEST_COLOR_BAR_SHOW_TIME_MS (3000) + +static const char *TAG = "test_qspi_lcd"; + +static shared_ptr init_backlight(void) +{ +#if TEST_LCD_PIN_NUM_BK_LIGHT >= 0 + ESP_LOGI(TAG, "Initialize backlight control pin and turn it on"); + shared_ptr backlight = make_shared( + TEST_LCD_PIN_NUM_BK_LIGHT, TEST_LCD_BK_LIGHT_ON_LEVEL, true + ); + TEST_ASSERT_NOT_NULL_MESSAGE(backlight, "Create backlight object failed"); + + TEST_ASSERT_TRUE_MESSAGE(backlight->begin(), "Backlight begin failed"); + TEST_ASSERT_TRUE_MESSAGE(backlight->on(), "Backlight on failed"); + + return backlight; +#else + return nullptr; +#endif +} + +static shared_ptr init_panel_bus(void) +{ + ESP_LOGI(TAG, "Create LCD bus"); + shared_ptr panel_bus = make_shared( + TEST_LCD_PIN_NUM_SPI_CS, TEST_LCD_PIN_NUM_SPI_SCK, + TEST_LCD_PIN_NUM_SPI_DATA0, TEST_LCD_PIN_NUM_SPI_DATA1, + TEST_LCD_PIN_NUM_SPI_DATA2, TEST_LCD_PIN_NUM_SPI_DATA3 + ); + TEST_ASSERT_NOT_NULL_MESSAGE(panel_bus, "Create panel bus object failed"); + + panel_bus->configQspiFreqHz(TEST_LCD_SPI_FREQ_HZ); + TEST_ASSERT_TRUE_MESSAGE(panel_bus->begin(), "Panel bus begin failed"); + + return panel_bus; +} + +#if TEST_ENABLE_ATTACH_CALLBACK +IRAM_ATTR static bool onDrawBitmapFinishCallback(void *user_data) +{ + esp_rom_printf("Draw bitmap finish callback\n"); + + return false; +} +#endif + +static void run_test(shared_ptr lcd) +{ +#if TEST_LCD_USE_EXTERNAL_CMD + // Configure external initialization commands, should called before `init()` + lcd->configVendorCommands(lcd_init_cmd, sizeof(lcd_init_cmd) / sizeof(lcd_init_cmd[0])); +#endif + TEST_ASSERT_TRUE_MESSAGE(lcd->init(), "LCD init failed"); + TEST_ASSERT_TRUE_MESSAGE(lcd->reset(), "LCD reset failed"); + TEST_ASSERT_TRUE_MESSAGE(lcd->begin(), "LCD begin failed"); + TEST_ASSERT_TRUE_MESSAGE(lcd->displayOn(), "LCD display on failed"); +#if TEST_ENABLE_ATTACH_CALLBACK + TEST_ASSERT_TRUE_MESSAGE( + lcd->attachRefreshFinishCallback(onDrawBitmapFinishCallback, nullptr), "Attach callback failed" + ); +#endif + + ESP_LOGI(TAG, "Draw color bar from top left to bottom right, the order is B - G - R"); + TEST_ASSERT_TRUE_MESSAGE(lcd->colorBarTest(TEST_LCD_WIDTH, TEST_LCD_HEIGHT), "LCD color bar test failed"); +} + +#define CREATE_LCD(name, panel_bus) \ + ({ \ + ESP_LOGI(TAG, "Create LCD device: " #name); \ + shared_ptr lcd = make_shared(panel_bus, TEST_LCD_COLOR_BITS, TEST_LCD_PIN_NUM_RST); \ + TEST_ASSERT_NOT_NULL_MESSAGE(lcd, "Create LCD object failed"); \ + lcd; \ + }) +#define CREATE_TEST_CASE(name) \ + TEST_CASE("Test LCD (" #name ") to draw color bar", "[qspi_lcd][" #name "]") \ + { \ + shared_ptr backlight = init_backlight(); \ + shared_ptr panel_bus = init_panel_bus(); \ + shared_ptr lcd = CREATE_LCD(name, panel_bus.get()); \ + run_test(lcd); \ + } + +/** + * Here to create test cases for different LCDs + * + */ +CREATE_TEST_CASE(GC9B71) +CREATE_TEST_CASE(SH8601) +CREATE_TEST_CASE(SPD2010) +CREATE_TEST_CASE(ST77916) +CREATE_TEST_CASE(ST77922) diff --git a/test_apps/lcd/qspi/sdkconfig.defaults b/test_apps/lcd/qspi/sdkconfig.defaults new file mode 100644 index 00000000..e0e5bb6d --- /dev/null +++ b/test_apps/lcd/qspi/sdkconfig.defaults @@ -0,0 +1,2 @@ +CONFIG_ESP_TASK_WDT= +CONFIG_FREERTOS_HZ=1000 diff --git a/test_apps/lcd/rgb/CMakeLists.txt b/test_apps/lcd/rgb/CMakeLists.txt new file mode 100644 index 00000000..32d71f90 --- /dev/null +++ b/test_apps/lcd/rgb/CMakeLists.txt @@ -0,0 +1,5 @@ +# The following lines of boilerplate have to be in your project's CMakeLists +# in this exact order for cmake to work correctly +cmake_minimum_required(VERSION 3.5) +include($ENV{IDF_PATH}/tools/cmake/project.cmake) +project(rgb_lcd_test) diff --git a/test_apps/lcd/rgb/main/CMakeLists.txt b/test_apps/lcd/rgb/main/CMakeLists.txt new file mode 100644 index 00000000..a5561bd4 --- /dev/null +++ b/test_apps/lcd/rgb/main/CMakeLists.txt @@ -0,0 +1,5 @@ +idf_component_register( + SRCS "test_app_main.c" "test_rgb_lcd.cpp" + PRIV_REQUIRES esp_lcd driver esp_timer + WHOLE_ARCHIVE +) diff --git a/test_apps/lcd/rgb/main/idf_component.yml b/test_apps/lcd/rgb/main/idf_component.yml new file mode 100644 index 00000000..bbace3aa --- /dev/null +++ b/test_apps/lcd/rgb/main/idf_component.yml @@ -0,0 +1,9 @@ +## IDF Component Manager Manifest File +dependencies: + test_utils: + path: ${IDF_PATH}/tools/unit-test-app/components/test_utils + test_driver_utils: + path: ${IDF_PATH}/components/driver/test_apps/components/test_driver_utils + ESP32_Display_Panel: + version: "*" + override_path: "../../../../../ESP32_Display_Panel" diff --git a/test_apps/lcd/rgb/main/test_app_main.c b/test_apps/lcd/rgb/main/test_app_main.c new file mode 100644 index 00000000..e802e57e --- /dev/null +++ b/test_apps/lcd/rgb/main/test_app_main.c @@ -0,0 +1,63 @@ +/* + * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: CC0-1.0 + */ +#include +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" +#include "esp_heap_caps.h" +#include "unity.h" +#include "unity_test_runner.h" + +// Some resources are lazy allocated in the LCD driver, the threadhold is left for that case +#define TEST_MEMORY_LEAK_THRESHOLD (-300) + +static size_t before_free_8bit; +static size_t before_free_32bit; + +static void check_leak(size_t before_free, size_t after_free, const char *type) +{ + ssize_t delta = after_free - before_free; + printf("MALLOC_CAP_%s: Before %u bytes free, After %u bytes free (delta %d)\n", type, before_free, after_free, delta); + TEST_ASSERT_MESSAGE(delta >= TEST_MEMORY_LEAK_THRESHOLD, "memory leak"); +} + +void setUp(void) +{ + before_free_8bit = heap_caps_get_free_size(MALLOC_CAP_8BIT); + before_free_32bit = heap_caps_get_free_size(MALLOC_CAP_32BIT); +} + +void tearDown(void) +{ + size_t after_free_8bit = heap_caps_get_free_size(MALLOC_CAP_8BIT); + size_t after_free_32bit = heap_caps_get_free_size(MALLOC_CAP_32BIT); + check_leak(before_free_8bit, after_free_8bit, "8BIT"); + check_leak(before_free_32bit, after_free_32bit, "32BIT"); +} + +void app_main(void) +{ + /** + * _______ ______ _______ __ ______ _______ + * | \ / \ | \ | \ / \ | \ + * | $$$$$$$\| $$$$$$\| $$$$$$$\ | $$ | $$$$$$\| $$$$$$$\ + * | $$__| $$| $$ __\$$| $$__/ $$ | $$ | $$ \$$| $$ | $$ + * | $$ $$| $$| \| $$ $$ | $$ | $$ | $$ | $$ + * | $$$$$$$\| $$ \$$$$| $$$$$$$\ | $$ | $$ __ | $$ | $$ + * | $$ | $$| $$__| $$| $$__/ $$ | $$_____| $$__/ \| $$__/ $$ + * | $$ | $$ \$$ $$| $$ $$ | $$ \\$$ $$| $$ $$ + * \$$ \$$ \$$$$$$ \$$$$$$$ \$$$$$$$$ \$$$$$$ \$$$$$$$ + */ + printf(" _______ ______ _______ __ ______ _______\r\n"); + printf("| \\ / \\ | \\ | \\ / \\ | \\\r\n"); + printf("| $$$$$$$\\| $$$$$$\\| $$$$$$$\\ | $$ | $$$$$$\\| $$$$$$$\\\r\n"); + printf("| $$__| $$| $$ __\\$$| $$__/ $$ | $$ | $$ \\$$| $$ | $$\r\n"); + printf("| $$ $$| $$| \\| $$ $$ | $$ | $$ | $$ | $$\r\n"); + printf("| $$$$$$$\\| $$ \\$$$$| $$$$$$$\\ | $$ | $$ __ | $$ | $$\r\n"); + printf("| $$ | $$| $$__| $$| $$__/ $$ | $$_____| $$__/ \\| $$__/ $$\r\n"); + printf("| $$ | $$ \\$$ $$| $$ $$ | $$ \\\\$$ $$| $$ $$\r\n"); + printf(" \\$$ \\$$ \\$$$$$$ \\$$$$$$$ \\$$$$$$$$ \\$$$$$$ \\$$$$$$$\r\n"); + unity_run_menu(); +} diff --git a/test_apps/lcd/rgb/main/test_rgb_lcd.cpp b/test_apps/lcd/rgb/main/test_rgb_lcd.cpp new file mode 100644 index 00000000..5c837770 --- /dev/null +++ b/test_apps/lcd/rgb/main/test_rgb_lcd.cpp @@ -0,0 +1,204 @@ +/* + * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: CC0-1.0 + */ +#include +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" +#include "esp_heap_caps.h" +#include "esp_log.h" +#include "esp_timer.h" +#include "unity.h" +#include "unity_test_runner.h" +#include "ESP_Panel_Library.h" + +using namespace std; + +// *INDENT-OFF* + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////// Please update the following configuration according to your LCD spec ////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +#define TEST_LCD_WIDTH (800) +#define TEST_LCD_HEIGHT (480) + // | 8-bit RGB888 | 16-bit RGB565 | +#define TEST_LCD_COLOR_BITS (18) // | 24 | 16/18/24 | +#define TEST_LCD_RGB_DATA_WIDTH (16) // | 8 | 16 | +#define TEST_LCD_RGB_TIMING_FREQ_HZ (16 * 1000 * 1000) +#define TEST_LCD_RGB_TIMING_HPW (10) +#define TEST_LCD_RGB_TIMING_HBP (10) +#define TEST_LCD_RGB_TIMING_HFP (20) +#define TEST_LCD_RGB_TIMING_VPW (10) +#define TEST_LCD_RGB_TIMING_VBP (10) +#define TEST_LCD_RGB_TIMING_VFP (10) +#define TEST_LCD_RGB_BOUNCE_BUFFER_SIZE (TEST_LCD_WIDTH * 10) + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////// Please update the following configuration according to your board spec //////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +#define TEST_LCD_PIN_NUM_RGB_DISP (-1) +#define TEST_LCD_PIN_NUM_RGB_VSYNC (3) +#define TEST_LCD_PIN_NUM_RGB_HSYNC (46) +#define TEST_LCD_PIN_NUM_RGB_DE (17) +#define TEST_LCD_PIN_NUM_RGB_PCLK (9) + // | RGB565 | RGB666 | RGB888 | + // |--------|--------|--------| +#define TEST_LCD_PIN_NUM_RGB_DATA0 (10) // | B0 | B0-1 | B0-3 | +#define TEST_LCD_PIN_NUM_RGB_DATA1 (11) // | B1 | B2 | B4 | +#define TEST_LCD_PIN_NUM_RGB_DATA2 (12) // | B2 | B3 | B5 | +#define TEST_LCD_PIN_NUM_RGB_DATA3 (13) // | B3 | B4 | B6 | +#define TEST_LCD_PIN_NUM_RGB_DATA4 (14) // | B4 | B5 | B7 | +#define TEST_LCD_PIN_NUM_RGB_DATA5 (21) // | G0 | G0 | G0-2 | +#define TEST_LCD_PIN_NUM_RGB_DATA6 (47) // | G1 | G1 | G3 | +#define TEST_LCD_PIN_NUM_RGB_DATA7 (48) // | G2 | G2 | G4 | +#if TEST_LCD_RGB_DATA_WIDTH > 8 +#define TEST_LCD_PIN_NUM_RGB_DATA8 (45) // | G3 | G3 | G5 | +#define TEST_LCD_PIN_NUM_RGB_DATA9 (38) // | G4 | G4 | G6 | +#define TEST_LCD_PIN_NUM_RGB_DATA10 (39) // | G5 | G5 | G7 | +#define TEST_LCD_PIN_NUM_RGB_DATA11 (40) // | R0 | R0-1 | R0-3 | +#define TEST_LCD_PIN_NUM_RGB_DATA12 (41) // | R1 | R2 | R4 | +#define TEST_LCD_PIN_NUM_RGB_DATA13 (42) // | R2 | R3 | R5 | +#define TEST_LCD_PIN_NUM_RGB_DATA14 (2) // | R3 | R4 | R6 | +#define TEST_LCD_PIN_NUM_RGB_DATA15 (1) // | R4 | R5 | R7 | +#endif +#define TEST_LCD_PIN_NUM_RST (-1) // Set to -1 if not used +#define TEST_LCD_PIN_NUM_BK_LIGHT (-1) // Set to -1 if not used +#define TEST_LCD_BK_LIGHT_ON_LEVEL (1) +#define TEST_LCD_BK_LIGHT_OFF_LEVEL !TEST_LCD_BK_LIGHT_ON_LEVEL + +// *INDENT-OFF* + +/* Enable or disable printing RGB refresh rate */ +#define TEST_ENABLE_PRINT_LCD_FPS (1) +/* Enable or disable the attachment of a callback function that is called after each bitmap drawing is completed */ +#define TEST_ENABLE_ATTACH_CALLBACK (1) +#define TEST_COLOR_BAR_SHOW_TIME_MS (3000) + +static const char *TAG = "test_rgb_lcd"; + +static shared_ptr init_backlight(void) +{ +#if TEST_LCD_PIN_NUM_BK_LIGHT >= 0 + ESP_LOGI(TAG, "Initialize backlight control pin and turn it on"); + shared_ptr backlight = make_shared( + TEST_LCD_PIN_NUM_BK_LIGHT, TEST_LCD_BK_LIGHT_ON_LEVEL, true + ); + TEST_ASSERT_NOT_NULL_MESSAGE(backlight, "Create backlight object failed"); + + TEST_ASSERT_TRUE_MESSAGE(backlight->begin(), "Backlight begin failed"); + TEST_ASSERT_TRUE_MESSAGE(backlight->on(), "Backlight on failed"); + + return backlight; +#else + return nullptr; +#endif +} + +static shared_ptr init_panel_bus(void) +{ + ESP_LOGI(TAG, "Create LCD bus"); + shared_ptr panel_bus = make_shared( +#if TEST_LCD_RGB_DATA_WIDTH == 8 + TEST_LCD_WIDTH, TEST_LCD_HEIGHT, + TEST_LCD_PIN_NUM_RGB_DATA0, TEST_LCD_PIN_NUM_RGB_DATA1, TEST_LCD_PIN_NUM_RGB_DATA2, TEST_LCD_PIN_NUM_RGB_DATA3, + TEST_LCD_PIN_NUM_RGB_DATA4, TEST_LCD_PIN_NUM_RGB_DATA5, TEST_LCD_PIN_NUM_RGB_DATA6, TEST_LCD_PIN_NUM_RGB_DATA7, + TEST_LCD_PIN_NUM_RGB_HSYNC, TEST_LCD_PIN_NUM_RGB_VSYNC, TEST_LCD_PIN_NUM_RGB_PCLK, TEST_LCD_PIN_NUM_RGB_DE, + TEST_LCD_PIN_NUM_RGB_DISP +#elif TEST_LCD_RGB_DATA_WIDTH == 16 + TEST_LCD_WIDTH, TEST_LCD_HEIGHT, + TEST_LCD_PIN_NUM_RGB_DATA0, TEST_LCD_PIN_NUM_RGB_DATA1, TEST_LCD_PIN_NUM_RGB_DATA2, TEST_LCD_PIN_NUM_RGB_DATA3, + TEST_LCD_PIN_NUM_RGB_DATA4, TEST_LCD_PIN_NUM_RGB_DATA5, TEST_LCD_PIN_NUM_RGB_DATA6, TEST_LCD_PIN_NUM_RGB_DATA7, + TEST_LCD_PIN_NUM_RGB_DATA8, TEST_LCD_PIN_NUM_RGB_DATA9, TEST_LCD_PIN_NUM_RGB_DATA10, TEST_LCD_PIN_NUM_RGB_DATA11, + TEST_LCD_PIN_NUM_RGB_DATA12, TEST_LCD_PIN_NUM_RGB_DATA13, TEST_LCD_PIN_NUM_RGB_DATA14, TEST_LCD_PIN_NUM_RGB_DATA15, + TEST_LCD_PIN_NUM_RGB_HSYNC, TEST_LCD_PIN_NUM_RGB_VSYNC, TEST_LCD_PIN_NUM_RGB_PCLK, TEST_LCD_PIN_NUM_RGB_DE, + TEST_LCD_PIN_NUM_RGB_DISP +#endif + ); + TEST_ASSERT_NOT_NULL_MESSAGE(panel_bus, "Create panel bus object failed"); + + panel_bus->configRgbTimingFreqHz(TEST_LCD_RGB_TIMING_FREQ_HZ); + panel_bus->configRgbTimingPorch( + TEST_LCD_RGB_TIMING_HPW, TEST_LCD_RGB_TIMING_HBP, TEST_LCD_RGB_TIMING_HFP, + TEST_LCD_RGB_TIMING_VPW, TEST_LCD_RGB_TIMING_VBP, TEST_LCD_RGB_TIMING_VFP + ); + panel_bus->configRgbBounceBufferSize(TEST_LCD_RGB_BOUNCE_BUFFER_SIZE); // Set bounce buffer to avoid screen drift + TEST_ASSERT_TRUE_MESSAGE(panel_bus->begin(), "Panel bus begin failed"); + + return panel_bus; +} + +#if TEST_ENABLE_PRINT_LCD_FPS +#define TEST_LCD_FPS_COUNT_MAX (100) +#ifndef millis +#define millis() (esp_timer_get_time() / 1000) +#endif + +DRAM_ATTR int frame_count = 0; +DRAM_ATTR int fps = 0; +DRAM_ATTR long start_time = 0; + +IRAM_ATTR bool onVsyncEndCallback(void *user_data) +{ + long frame_start_time = *(long *)user_data; + if (frame_start_time == 0) { + (*(long *)user_data) = millis(); + + return false; + } + + frame_count++; + if (frame_count >= TEST_LCD_FPS_COUNT_MAX) { + fps = TEST_LCD_FPS_COUNT_MAX * 1000 / (millis() - frame_start_time); + frame_count = 0; + (*(long *)user_data) = millis(); + } + + return false; +} +#endif + +static void run_test(shared_ptr lcd) +{ +#if TEST_LCD_USE_EXTERNAL_CMD + // Configure external initialization commands, should called before `init()` + lcd->configVendorCommands(lcd_init_cmd, sizeof(lcd_init_cmd) / sizeof(lcd_init_cmd[0])); +#endif + TEST_ASSERT_TRUE_MESSAGE(lcd->init(), "LCD init failed"); + TEST_ASSERT_TRUE_MESSAGE(lcd->reset(), "LCD reset failed"); + TEST_ASSERT_TRUE_MESSAGE(lcd->begin(), "LCD begin failed"); +#if TEST_LCD_PIN_NUM_RGB_DISP >= 0 + TEST_ASSERT_TRUE_MESSAGE(lcd->displayOn(), "LCD display on failed"); +#endif +#if TEST_ENABLE_PRINT_LCD_FPS + TEST_ASSERT_TRUE_MESSAGE( + lcd->attachRefreshFinishCallback(onVsyncEndCallback, (void *)&start_time), "Attach refresh callback failed" + ); +#endif + + ESP_LOGI(TAG, "Draw color bar from top left to bottom right, the order is B - G - R"); + TEST_ASSERT_TRUE_MESSAGE(lcd->colorBarTest(TEST_LCD_WIDTH, TEST_LCD_HEIGHT), "LCD color bar test failed"); +} + +#define CREATE_LCD(name, panel_bus) \ + ({ \ + ESP_LOGI(TAG, "Create LCD device: " #name); \ + shared_ptr lcd = make_shared(panel_bus, TEST_LCD_COLOR_BITS, TEST_LCD_PIN_NUM_RST); \ + TEST_ASSERT_NOT_NULL_MESSAGE(lcd, "Create LCD object failed"); \ + lcd; \ + }) +#define CREATE_TEST_CASE(name) \ + TEST_CASE("Test LCD (" #name ") to draw color bar", "[rgb_lcd][" #name "]") \ + { \ + shared_ptr backlight = init_backlight(); \ + shared_ptr panel_bus = init_panel_bus(); \ + shared_ptr lcd = CREATE_LCD(name, panel_bus.get()); \ + run_test(lcd); \ + } + +/** + * Here to create test cases for different LCDs + * + */ +CREATE_TEST_CASE(ST7262) +CREATE_TEST_CASE(EK9716B) diff --git a/test_apps/lcd/rgb/sdkconfig.defaults b/test_apps/lcd/rgb/sdkconfig.defaults new file mode 100644 index 00000000..f627e6eb --- /dev/null +++ b/test_apps/lcd/rgb/sdkconfig.defaults @@ -0,0 +1,7 @@ +CONFIG_SPIRAM=y +CONFIG_SPIRAM_MODE_OCT=y +CONFIG_SPIRAM_FETCH_INSTRUCTIONS=y +CONFIG_SPIRAM_RODATA=y +CONFIG_SPIRAM_SPEED_80M=y +CONFIG_ESP_TASK_WDT_INIT=n +CONFIG_FREERTOS_HZ=1000 diff --git a/test_apps/lcd/spi/CMakeLists.txt b/test_apps/lcd/spi/CMakeLists.txt new file mode 100644 index 00000000..c22cd3f8 --- /dev/null +++ b/test_apps/lcd/spi/CMakeLists.txt @@ -0,0 +1,5 @@ +# The following lines of boilerplate have to be in your project's CMakeLists +# in this exact order for cmake to work correctly +cmake_minimum_required(VERSION 3.5) +include($ENV{IDF_PATH}/tools/cmake/project.cmake) +project(spi_lcd_test) diff --git a/test_apps/lcd/spi/main/CMakeLists.txt b/test_apps/lcd/spi/main/CMakeLists.txt new file mode 100644 index 00000000..26848d00 --- /dev/null +++ b/test_apps/lcd/spi/main/CMakeLists.txt @@ -0,0 +1,5 @@ +idf_component_register( + SRCS "test_app_main.c" "test_spi_lcd.cpp" + PRIV_REQUIRES esp_lcd driver + WHOLE_ARCHIVE +) diff --git a/test_apps/lcd/spi/main/idf_component.yml b/test_apps/lcd/spi/main/idf_component.yml new file mode 100644 index 00000000..bbace3aa --- /dev/null +++ b/test_apps/lcd/spi/main/idf_component.yml @@ -0,0 +1,9 @@ +## IDF Component Manager Manifest File +dependencies: + test_utils: + path: ${IDF_PATH}/tools/unit-test-app/components/test_utils + test_driver_utils: + path: ${IDF_PATH}/components/driver/test_apps/components/test_driver_utils + ESP32_Display_Panel: + version: "*" + override_path: "../../../../../ESP32_Display_Panel" diff --git a/test_apps/lcd/spi/main/test_app_main.c b/test_apps/lcd/spi/main/test_app_main.c new file mode 100644 index 00000000..103f7bcb --- /dev/null +++ b/test_apps/lcd/spi/main/test_app_main.c @@ -0,0 +1,63 @@ +/* + * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: CC0-1.0 + */ +#include +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" +#include "esp_heap_caps.h" +#include "unity.h" +#include "unity_test_runner.h" + +// Some resources are lazy allocated in the LCD driver, the threadhold is left for that case +#define TEST_MEMORY_LEAK_THRESHOLD (-300) + +static size_t before_free_8bit; +static size_t before_free_32bit; + +static void check_leak(size_t before_free, size_t after_free, const char *type) +{ + ssize_t delta = after_free - before_free; + printf("MALLOC_CAP_%s: Before %u bytes free, After %u bytes free (delta %d)\n", type, before_free, after_free, delta); + TEST_ASSERT_MESSAGE(delta >= TEST_MEMORY_LEAK_THRESHOLD, "memory leak"); +} + +void setUp(void) +{ + before_free_8bit = heap_caps_get_free_size(MALLOC_CAP_8BIT); + before_free_32bit = heap_caps_get_free_size(MALLOC_CAP_32BIT); +} + +void tearDown(void) +{ + size_t after_free_8bit = heap_caps_get_free_size(MALLOC_CAP_8BIT); + size_t after_free_32bit = heap_caps_get_free_size(MALLOC_CAP_32BIT); + check_leak(before_free_8bit, after_free_8bit, "8BIT"); + check_leak(before_free_32bit, after_free_32bit, "32BIT"); +} + +void app_main(void) +{ + /** + * ______ _______ ______ __ ______ _______ + * / \ | \| \ | \ / \ | \ + * | $$$$$$\| $$$$$$$\\$$$$$$ | $$ | $$$$$$\| $$$$$$$\ + * | $$___\$$| $$__/ $$ | $$ | $$ | $$ \$$| $$ | $$ + * \$$ \ | $$ $$ | $$ | $$ | $$ | $$ | $$ + * _\$$$$$$\| $$$$$$$ | $$ | $$ | $$ __ | $$ | $$ + * | \__| $$| $$ _| $$_ | $$_____| $$__/ \| $$__/ $$ + * \$$ $$| $$ | $$ \ | $$ \\$$ $$| $$ $$ + * \$$$$$$ \$$ \$$$$$$ \$$$$$$$$ \$$$$$$ \$$$$$$$ + */ + printf(" ______ _______ ______ __ ______ _______\r\n"); + printf(" / \\ | \\| \\ | \\ / \\ | \\\r\n"); + printf("| $$$$$$\\| $$$$$$$\\\\$$$$$$ | $$ | $$$$$$\\| $$$$$$$\\\r\n"); + printf("| $$___\\$$| $$__/ $$ | $$ | $$ | $$ \\$$| $$ | $$\r\n"); + printf(" \\$$ \\ | $$ $$ | $$ | $$ | $$ | $$ | $$\r\n"); + printf(" _\\$$$$$$\\| $$$$$$$ | $$ | $$ | $$ __ | $$ | $$\r\n"); + printf("| \\__| $$| $$ _| $$_ | $$_____| $$__/ \\| $$__/ $$\r\n"); + printf(" \\$$ $$| $$ | $$ \\ | $$ \\\\$$ $$| $$ $$\r\n"); + printf(" \\$$$$$$ \\$$ \\$$$$$$ \\$$$$$$$$ \\$$$$$$ \\$$$$$$$\r\n"); + unity_run_menu(); +} diff --git a/test_apps/lcd/spi/main/test_spi_lcd.cpp b/test_apps/lcd/spi/main/test_spi_lcd.cpp new file mode 100644 index 00000000..61cb6454 --- /dev/null +++ b/test_apps/lcd/spi/main/test_spi_lcd.cpp @@ -0,0 +1,161 @@ +/* + * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: CC0-1.0 + */ +#include +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" +#include "esp_heap_caps.h" +#include "esp_log.h" +#include "unity.h" +#include "unity_test_runner.h" +#include "ESP_Panel_Library.h" + +using namespace std; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////// Please update the following configuration according to your LCD spec ////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +#define TEST_LCD_WIDTH (320) +#define TEST_LCD_HEIGHT (240) +#define TEST_LCD_COLOR_BITS (16) +#define TEST_LCD_SPI_FREQ_HZ (40 * 1000 * 1000) +#define TEST_LCD_USE_EXTERNAL_CMD (1) +#if TEST_LCD_USE_EXTERNAL_CMD +/** + * LCD 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, then use `configVendorCommands()` to pass them in the + * same format if needed. Otherwise, the LCD driver will use the default initialization sequence code. + * + * There are two formats for the sequence code: + * 1. Raw data: {command, (uint8_t []){ data0, data1, ... }, data_size, delay_ms} + * 2. Formatter: ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(delay_ms, command, { data0, data1, ... }) and + * ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(delay_ms, command) + */ +const esp_lcd_panel_vendor_init_cmd_t lcd_init_cmd[] = { + // {0xFF, (uint8_t []){0x77, 0x01, 0x00, 0x00, 0x10}, 5, 0}, + // {0xC0, (uint8_t []){0x3B, 0x00}, 2, 0}, + // {0xC1, (uint8_t []){0x0D, 0x02}, 2, 0}, + // {0x29, (uint8_t []){0x00}, 0, 120}, + // // or + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xFF, {0x77, 0x01, 0x00, 0x00, 0x10}), + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC0, {0x3B, 0x00}), + ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC1, {0x0D, 0x02}), + ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(120, 0x29), +}; +#endif + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////// Please update the following configuration according to your board spec //////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +#define TEST_LCD_PIN_NUM_SPI_CS (5) +#define TEST_LCD_PIN_NUM_SPI_DC (4) +#define TEST_LCD_PIN_NUM_SPI_SCK (7) +#define TEST_LCD_PIN_NUM_SPI_SDA (6) +#define TEST_LCD_PIN_NUM_SPI_SDO (-1) +#define TEST_LCD_PIN_NUM_RST (-1) // Set to -1 if not used +#define TEST_LCD_PIN_NUM_BK_LIGHT (45) // Set to -1 if not used +#define TEST_LCD_BK_LIGHT_ON_LEVEL (1) +#define TEST_LCD_BK_LIGHT_OFF_LEVEL !TEST_LCD_BK_LIGHT_ON_LEVEL + +/* Enable or disable the attachment of a callback function that is called after each bitmap drawing is completed */ +#define TEST_ENABLE_ATTACH_CALLBACK (1) +#define TEST_COLOR_BAR_SHOW_TIME_MS (3000) + +static const char *TAG = "test_spi_lcd"; + +static shared_ptr init_backlight(void) +{ +#if TEST_LCD_PIN_NUM_BK_LIGHT >= 0 + ESP_LOGI(TAG, "Initialize backlight control pin and turn it on"); + shared_ptr backlight = make_shared( + TEST_LCD_PIN_NUM_BK_LIGHT, TEST_LCD_BK_LIGHT_ON_LEVEL, true + ); + TEST_ASSERT_NOT_NULL_MESSAGE(backlight, "Create backlight object failed"); + + TEST_ASSERT_TRUE_MESSAGE(backlight->begin(), "Backlight begin failed"); + TEST_ASSERT_TRUE_MESSAGE(backlight->on(), "Backlight on failed"); + + return backlight; +#else + return nullptr; +#endif +} + +static shared_ptr init_panel_bus(void) +{ + ESP_LOGI(TAG, "Create LCD bus"); + shared_ptr panel_bus = make_shared( + TEST_LCD_PIN_NUM_SPI_CS, TEST_LCD_PIN_NUM_SPI_DC, TEST_LCD_PIN_NUM_SPI_SCK, + TEST_LCD_PIN_NUM_SPI_SDA, TEST_LCD_PIN_NUM_SPI_SDO + ); + TEST_ASSERT_NOT_NULL_MESSAGE(panel_bus, "Create panel bus object failed"); + + panel_bus->configSpiFreqHz(TEST_LCD_SPI_FREQ_HZ); + TEST_ASSERT_TRUE_MESSAGE(panel_bus->begin(), "Panel bus begin failed"); + + return panel_bus; +} + +#if TEST_ENABLE_ATTACH_CALLBACK +IRAM_ATTR static bool onDrawBitmapFinishCallback(void *user_data) +{ + esp_rom_printf("Draw bitmap finish callback\n"); + + return false; +} +#endif + +static void run_test(shared_ptr lcd) +{ +#if TEST_LCD_USE_EXTERNAL_CMD + // Configure external initialization commands, should called before `init()` + lcd->configVendorCommands(lcd_init_cmd, sizeof(lcd_init_cmd) / sizeof(lcd_init_cmd[0])); +#endif + TEST_ASSERT_TRUE_MESSAGE(lcd->init(), "LCD init failed"); + TEST_ASSERT_TRUE_MESSAGE(lcd->reset(), "LCD reset failed"); + TEST_ASSERT_TRUE_MESSAGE(lcd->begin(), "LCD begin failed"); + TEST_ASSERT_TRUE_MESSAGE(lcd->displayOn(), "LCD display on failed"); +#if TEST_ENABLE_ATTACH_CALLBACK + TEST_ASSERT_TRUE_MESSAGE( + lcd->attachRefreshFinishCallback(onDrawBitmapFinishCallback, nullptr), "Attach callback failed" + ); +#endif + + ESP_LOGI(TAG, "Draw color bar from top left to bottom right, the order is B - G - R"); + TEST_ASSERT_TRUE_MESSAGE(lcd->colorBarTest(TEST_LCD_WIDTH, TEST_LCD_HEIGHT), "LCD color bar test failed"); +} + +#define CREATE_LCD(name, panel_bus) \ + ({ \ + ESP_LOGI(TAG, "Create LCD device: " #name); \ + shared_ptr lcd = make_shared(panel_bus, TEST_LCD_COLOR_BITS, TEST_LCD_PIN_NUM_RST); \ + TEST_ASSERT_NOT_NULL_MESSAGE(lcd, "Create LCD object failed"); \ + lcd; \ + }) +#define CREATE_TEST_CASE(name) \ + TEST_CASE("Test LCD (" #name ") to draw color bar", "[spi_lcd][" #name "]") \ + { \ + shared_ptr backlight = init_backlight(); \ + shared_ptr panel_bus = init_panel_bus(); \ + shared_ptr lcd = CREATE_LCD(name, panel_bus.get()); \ + run_test(lcd); \ + } + +/** + * Here to create test cases for different LCDs + * + */ +CREATE_TEST_CASE(GC9A01) +CREATE_TEST_CASE(GC9B71) +CREATE_TEST_CASE(NV3022B) +CREATE_TEST_CASE(SH8601) +CREATE_TEST_CASE(SPD2010) +CREATE_TEST_CASE(ST7789) +CREATE_TEST_CASE(ST77916) +CREATE_TEST_CASE(ST77922) diff --git a/test_apps/lcd/spi/sdkconfig.defaults b/test_apps/lcd/spi/sdkconfig.defaults new file mode 100644 index 00000000..e0e5bb6d --- /dev/null +++ b/test_apps/lcd/spi/sdkconfig.defaults @@ -0,0 +1,2 @@ +CONFIG_ESP_TASK_WDT= +CONFIG_FREERTOS_HZ=1000 diff --git a/test_apps/panel/CMakeLists.txt b/test_apps/panel/CMakeLists.txt new file mode 100644 index 00000000..028915bb --- /dev/null +++ b/test_apps/panel/CMakeLists.txt @@ -0,0 +1,5 @@ +# The following lines of boilerplate have to be in your project's CMakeLists +# in this exact order for cmake to work correctly +cmake_minimum_required(VERSION 3.5) +include($ENV{IDF_PATH}/tools/cmake/project.cmake) +project(panal_test) diff --git a/test_apps/panel/main/CMakeLists.txt b/test_apps/panel/main/CMakeLists.txt new file mode 100644 index 00000000..6489599d --- /dev/null +++ b/test_apps/panel/main/CMakeLists.txt @@ -0,0 +1,4 @@ +idf_component_register( + SRCS "test_app_main.c" "test_panel.cpp" + WHOLE_ARCHIVE +) diff --git a/test_apps/panel/main/idf_component.yml b/test_apps/panel/main/idf_component.yml new file mode 100644 index 00000000..e69eb944 --- /dev/null +++ b/test_apps/panel/main/idf_component.yml @@ -0,0 +1,9 @@ +## IDF Component Manager Manifest File +dependencies: + test_utils: + path: ${IDF_PATH}/tools/unit-test-app/components/test_utils + test_driver_utils: + path: ${IDF_PATH}/components/driver/test_apps/components/test_driver_utils + ESP32_Display_Panel: + version: "*" + override_path: "../../../../ESP32_Display_Panel" diff --git a/test_apps/panel/main/test_app_main.c b/test_apps/panel/main/test_app_main.c new file mode 100644 index 00000000..bf8ef112 --- /dev/null +++ b/test_apps/panel/main/test_app_main.c @@ -0,0 +1,63 @@ +/* + * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: CC0-1.0 + */ +#include +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" +#include "esp_heap_caps.h" +#include "unity.h" +#include "unity_test_runner.h" + +// Some resources are lazy allocated in the LCD driver, the threadhold is left for that case +#define TEST_MEMORY_LEAK_THRESHOLD (-300) + +static size_t before_free_8bit; +static size_t before_free_32bit; + +static void check_leak(size_t before_free, size_t after_free, const char *type) +{ + ssize_t delta = after_free - before_free; + printf("MALLOC_CAP_%s: Before %u bytes free, After %u bytes free (delta %d)\n", type, before_free, after_free, delta); + TEST_ASSERT_MESSAGE(delta >= TEST_MEMORY_LEAK_THRESHOLD, "memory leak"); +} + +void setUp(void) +{ + before_free_8bit = heap_caps_get_free_size(MALLOC_CAP_8BIT); + before_free_32bit = heap_caps_get_free_size(MALLOC_CAP_32BIT); +} + +void tearDown(void) +{ + size_t after_free_8bit = heap_caps_get_free_size(MALLOC_CAP_8BIT); + size_t after_free_32bit = heap_caps_get_free_size(MALLOC_CAP_32BIT); + check_leak(before_free_8bit, after_free_8bit, "8BIT"); + check_leak(before_free_32bit, after_free_32bit, "32BIT"); +} + +void app_main(void) +{ + /** + * _______ ______ __ __ ________ __ + * | \ / \ | \ | \| \| \ + * | $$$$$$$\| $$$$$$\| $$\ | $$| $$$$$$$$| $$ + * | $$__/ $$| $$__| $$| $$$\| $$| $$__ | $$ + * | $$ $$| $$ $$| $$$$\ $$| $$ \ | $$ + * | $$$$$$$ | $$$$$$$$| $$\$$ $$| $$$$$ | $$ + * | $$ | $$ | $$| $$ \$$$$| $$_____ | $$_____ + * | $$ | $$ | $$| $$ \$$$| $$ \| $$ \ + * \$$ \$$ \$$ \$$ \$$ \$$$$$$$$ \$$$$$$$$ + */ + printf(" _______ ______ __ __ ________ __\r\n"); + printf("| \\ / \\ | \\ | \\| \\| \\\r\n"); + printf("| $$$$$$$\\| $$$$$$\\| $$\\ | $$| $$$$$$$$| $$\r\n"); + printf("| $$__/ $$| $$__| $$| $$$\\| $$| $$__ | $$\r\n"); + printf("| $$ $$| $$ $$| $$$$\\ $$| $$ \\ | $$\r\n"); + printf("| $$$$$$$ | $$$$$$$$| $$\\$$ $$| $$$$$ | $$\r\n"); + printf("| $$ | $$ | $$| $$ \\$$$$| $$_____ | $$_____\r\n"); + printf("| $$ | $$ | $$| $$ \\$$$| $$ \\| $$ \\\r\n"); + printf(" \\$$ \\$$ \\$$ \\$$ \\$$ \\$$$$$$$$ \\$$$$$$$$\r\n"); + unity_run_menu(); +} diff --git a/test_apps/panel/main/test_panel.cpp b/test_apps/panel/main/test_panel.cpp new file mode 100644 index 00000000..f545cf13 --- /dev/null +++ b/test_apps/panel/main/test_panel.cpp @@ -0,0 +1,114 @@ +/* + * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: CC0-1.0 + */ +#include +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" +#include "esp_heap_caps.h" +#include "esp_log.h" +#include "unity.h" +#include "unity_test_runner.h" +#include "ESP_Panel_Library.h" + +#define TEST_LCD_ENABLE_ATTACH_CALLBACK (0) +#define TEST_LCD_SHOW_TIME_MS (3000) + +#define TEST_TOUCH_ENABLE_ATTACH_CALLBACK (0) +#define TEST_TOUCH_READ_POINTS_NUM (5) +#define TEST_TOUCH_READ_TIME_MS (3000) +#define TEST_TOUCH_READ_DELAY_MS (30) + +#define delay(x) vTaskDelay(pdMS_TO_TICKS(x)) + +using namespace std; + +static const char *TAG = "test_panel"; + +#if TEST_LCD_ENABLE_ATTACH_CALLBACK +IRAM_ATTR static bool onLcdRefreshFinishCallback(void *user_data) +{ + esp_rom_printf("Refresh finish callback\n"); + + return false; +} +#endif + +#if TEST_TOUCH_ENABLE_ATTACH_CALLBACK && (ESP_PANEL_TOUCH_IO_INT >= 0) +IRAM_ATTR static bool onTouchInterruptCallback(void *user_data) +{ + esp_rom_printf("Touch interrupt callback\n"); + + return false; +} +#endif + +TEST_CASE("Test panel to draw color bar and read touch", "[panel]") +{ + shared_ptr panel = make_shared(); + TEST_ASSERT_NOT_NULL_MESSAGE(panel, "Create panel object failed"); + + ESP_LOGI(TAG, "Initialize display panel"); + TEST_ASSERT_TRUE_MESSAGE(panel->init(), "Panel init failed"); + TEST_ASSERT_TRUE_MESSAGE(panel->begin(), "Panel begin failed"); + + ESP_PanelLcd *lcd = panel->getLcd(); + ESP_PanelTouch *touch = panel->getTouch(); + ESP_PanelBacklight *backlight = panel->getBacklight(); + + if (backlight != nullptr) { + ESP_LOGI(TAG, "Turn off the backlight"); + backlight->off(); + } else { + ESP_LOGI(TAG, "Backlight is not available"); + } + + if (lcd != nullptr) { +#if TEST_LCD_ENABLE_ATTACH_CALLBACK + TEST_ASSERT_TRUE_MESSAGE( + lcd->attachRefreshFinishCallback(onLcdRefreshFinishCallback, NULL), "Attach refresh callback failed" + ); +#endif + ESP_LOGI(TAG, "Draw color bar from top to bottom, the order is B - G - R"); + TEST_ASSERT_TRUE_MESSAGE( + lcd->colorBarTest(panel->getLcdWidth(), panel->getLcdHeight()), "LCD color bar test failed" + ); + delay(TEST_LCD_SHOW_TIME_MS); + } else { + ESP_LOGI(TAG, "LCD is not available"); + } + + if (backlight != nullptr) { + ESP_LOGI(TAG, "Turn on the backlight"); + TEST_ASSERT_TRUE_MESSAGE(backlight->on(), "Backlight on failed"); + } + + if (touch != nullptr) { +#if TEST_LCD_ENABLE_ATTACH_CALLBACK && (ESP_PANEL_TOUCH_IO_INT >= 0) + TEST_ASSERT_TRUE_MESSAGE( + touch->attachInterruptCallback(onTouchInterruptCallback, NULL), "Attach touch interrupt callback failed" + ); +#endif + uint32_t t = 0; + ESP_PanelTouchPoint point[TEST_TOUCH_READ_POINTS_NUM]; + int read_touch_result = 0; + + ESP_LOGI(TAG, "Reading touch_device point..."); + while (t++ < TEST_TOUCH_READ_TIME_MS / TEST_TOUCH_READ_DELAY_MS) { + read_touch_result = touch->readPoints(point, TEST_TOUCH_READ_POINTS_NUM, TEST_TOUCH_READ_DELAY_MS); + if (read_touch_result > 0) { + for (int i = 0; i < read_touch_result; i++) { + ESP_LOGI(TAG, "Touch point(%d): x %d, y %d, strength %d\n", i, point[i].x, point[i].y, point[i].strength); + } + } else if (read_touch_result < 0) { + ESP_LOGE(TAG, "Read touch_device point failed"); + } + if (!touch->isInterruptEnabled()) { + delay(TEST_TOUCH_READ_DELAY_MS); + } + } + } else { + ESP_LOGI(TAG, "Touch is not available"); + } +} diff --git a/test_apps/panel/sdkconfig.ci.elecrow_crowpanel_7_0 b/test_apps/panel/sdkconfig.ci.elecrow_crowpanel_7_0 new file mode 100644 index 00000000..7d488c6c --- /dev/null +++ b/test_apps/panel/sdkconfig.ci.elecrow_crowpanel_7_0 @@ -0,0 +1,9 @@ +CONFIG_IDF_TARGET="esp32s3" +CONFIG_BOARD_MANUFACTURER_ALL=y +CONFIG_BOARD_ELECROW_CROWPANEL_7_0=y + +CONFIG_SPIRAM=y +CONFIG_SPIRAM_MODE_OCT=y +CONFIG_SPIRAM_FETCH_INSTRUCTIONS=y +CONFIG_SPIRAM_RODATA=y +CONFIG_SPIRAM_SPEED_80M=y diff --git a/test_apps/panel/sdkconfig.ci.espressif_esp32_c3_lcdkit b/test_apps/panel/sdkconfig.ci.espressif_esp32_c3_lcdkit new file mode 100644 index 00000000..e81429f1 --- /dev/null +++ b/test_apps/panel/sdkconfig.ci.espressif_esp32_c3_lcdkit @@ -0,0 +1,3 @@ +CONFIG_IDF_TARGET="esp32c3" +CONFIG_BOARD_MANUFACTURER_ALL=y +CONFIG_BOARD_ESP32_C3_LCDKIT=y diff --git a/test_apps/panel/sdkconfig.ci.espressif_esp32_s3_box b/test_apps/panel/sdkconfig.ci.espressif_esp32_s3_box new file mode 100644 index 00000000..6e15d03d --- /dev/null +++ b/test_apps/panel/sdkconfig.ci.espressif_esp32_s3_box @@ -0,0 +1,9 @@ +CONFIG_IDF_TARGET="esp32s3" +CONFIG_BOARD_MANUFACTURER_ALL=y +CONFIG_BOARD_ESP32_S3_BOX=y + +CONFIG_SPIRAM=y +CONFIG_SPIRAM_MODE_OCT=y +CONFIG_SPIRAM_FETCH_INSTRUCTIONS=y +CONFIG_SPIRAM_RODATA=y +CONFIG_SPIRAM_SPEED_80M=y diff --git a/test_apps/panel/sdkconfig.ci.espressif_esp32_s3_box_3 b/test_apps/panel/sdkconfig.ci.espressif_esp32_s3_box_3 new file mode 100644 index 00000000..efa09e4b --- /dev/null +++ b/test_apps/panel/sdkconfig.ci.espressif_esp32_s3_box_3 @@ -0,0 +1,9 @@ +CONFIG_IDF_TARGET="esp32s3" +CONFIG_BOARD_MANUFACTURER_ALL=y +CONFIG_BOARD_ESP32_S3_BOX_3=y + +CONFIG_SPIRAM=y +CONFIG_SPIRAM_MODE_OCT=y +CONFIG_SPIRAM_FETCH_INSTRUCTIONS=y +CONFIG_SPIRAM_RODATA=y +CONFIG_SPIRAM_SPEED_80M=y diff --git a/test_apps/panel/sdkconfig.ci.espressif_esp32_s3_box_3_beta b/test_apps/panel/sdkconfig.ci.espressif_esp32_s3_box_3_beta new file mode 100644 index 00000000..e859d720 --- /dev/null +++ b/test_apps/panel/sdkconfig.ci.espressif_esp32_s3_box_3_beta @@ -0,0 +1,9 @@ +CONFIG_IDF_TARGET="esp32s3" +CONFIG_BOARD_MANUFACTURER_ALL=y +CONFIG_BOARD_ESP32_S3_BOX_3_BETA=y + +CONFIG_SPIRAM=y +CONFIG_SPIRAM_MODE_OCT=y +CONFIG_SPIRAM_FETCH_INSTRUCTIONS=y +CONFIG_SPIRAM_RODATA=y +CONFIG_SPIRAM_SPEED_80M=y diff --git a/test_apps/panel/sdkconfig.ci.espressif_esp32_s3_box_lite b/test_apps/panel/sdkconfig.ci.espressif_esp32_s3_box_lite new file mode 100644 index 00000000..5c3fe36e --- /dev/null +++ b/test_apps/panel/sdkconfig.ci.espressif_esp32_s3_box_lite @@ -0,0 +1,9 @@ +CONFIG_IDF_TARGET="esp32s3" +CONFIG_BOARD_MANUFACTURER_ALL=y +CONFIG_BOARD_ESP32_S3_BOX_LITE=y + +CONFIG_SPIRAM=y +CONFIG_SPIRAM_MODE_OCT=y +CONFIG_SPIRAM_FETCH_INSTRUCTIONS=y +CONFIG_SPIRAM_RODATA=y +CONFIG_SPIRAM_SPEED_80M=y diff --git a/test_apps/panel/sdkconfig.ci.espressif_esp32_s3_eye b/test_apps/panel/sdkconfig.ci.espressif_esp32_s3_eye new file mode 100644 index 00000000..236bdd7c --- /dev/null +++ b/test_apps/panel/sdkconfig.ci.espressif_esp32_s3_eye @@ -0,0 +1,9 @@ +CONFIG_IDF_TARGET="esp32s3" +CONFIG_BOARD_MANUFACTURER_ALL=y +CONFIG_BOARD_ESP32_S3_EYE=y + +CONFIG_SPIRAM=y +CONFIG_SPIRAM_MODE_OCT=y +CONFIG_SPIRAM_FETCH_INSTRUCTIONS=y +CONFIG_SPIRAM_RODATA=y +CONFIG_SPIRAM_SPEED_80M=y diff --git a/test_apps/panel/sdkconfig.ci.espressif_esp32_s3_korvo_2 b/test_apps/panel/sdkconfig.ci.espressif_esp32_s3_korvo_2 new file mode 100644 index 00000000..ce44a69c --- /dev/null +++ b/test_apps/panel/sdkconfig.ci.espressif_esp32_s3_korvo_2 @@ -0,0 +1,9 @@ +CONFIG_IDF_TARGET="esp32s3" +CONFIG_BOARD_MANUFACTURER_ALL=y +CONFIG_BOARD_ESP32_S3_KORVO_2=y + +CONFIG_SPIRAM=y +CONFIG_SPIRAM_MODE_OCT=y +CONFIG_SPIRAM_FETCH_INSTRUCTIONS=y +CONFIG_SPIRAM_RODATA=y +CONFIG_SPIRAM_SPEED_80M=y diff --git a/test_apps/panel/sdkconfig.ci.espressif_esp32_s3_lcd_ev_board b/test_apps/panel/sdkconfig.ci.espressif_esp32_s3_lcd_ev_board new file mode 100644 index 00000000..0246bddb --- /dev/null +++ b/test_apps/panel/sdkconfig.ci.espressif_esp32_s3_lcd_ev_board @@ -0,0 +1,9 @@ +CONFIG_IDF_TARGET="esp32s3" +CONFIG_BOARD_MANUFACTURER_ALL=y +CONFIG_BOARD_ESP32_S3_LCD_EV_BOARD=y + +CONFIG_SPIRAM=y +CONFIG_SPIRAM_MODE_OCT=y +CONFIG_SPIRAM_FETCH_INSTRUCTIONS=y +CONFIG_SPIRAM_RODATA=y +CONFIG_SPIRAM_SPEED_80M=y diff --git a/test_apps/panel/sdkconfig.ci.espressif_esp32_s3_lcd_ev_board_2 b/test_apps/panel/sdkconfig.ci.espressif_esp32_s3_lcd_ev_board_2 new file mode 100644 index 00000000..71375001 --- /dev/null +++ b/test_apps/panel/sdkconfig.ci.espressif_esp32_s3_lcd_ev_board_2 @@ -0,0 +1,9 @@ +CONFIG_IDF_TARGET="esp32s3" +CONFIG_BOARD_MANUFACTURER_ALL=y +CONFIG_BOARD_ESP32_S3_LCD_EV_BOARD_2=y + +CONFIG_SPIRAM=y +CONFIG_SPIRAM_MODE_OCT=y +CONFIG_SPIRAM_FETCH_INSTRUCTIONS=y +CONFIG_SPIRAM_RODATA=y +CONFIG_SPIRAM_SPEED_80M=y diff --git a/test_apps/panel/sdkconfig.ci.espressif_esp32_s3_lcd_ev_board_2_v1_5 b/test_apps/panel/sdkconfig.ci.espressif_esp32_s3_lcd_ev_board_2_v1_5 new file mode 100644 index 00000000..605f2d29 --- /dev/null +++ b/test_apps/panel/sdkconfig.ci.espressif_esp32_s3_lcd_ev_board_2_v1_5 @@ -0,0 +1,9 @@ +CONFIG_IDF_TARGET="esp32s3" +CONFIG_BOARD_MANUFACTURER_ALL=y +CONFIG_BOARD_ESP32_S3_LCD_EV_BOARD_2_V1_5=y + +CONFIG_SPIRAM=y +CONFIG_SPIRAM_MODE_OCT=y +CONFIG_SPIRAM_FETCH_INSTRUCTIONS=y +CONFIG_SPIRAM_RODATA=y +CONFIG_SPIRAM_SPEED_80M=y diff --git a/test_apps/panel/sdkconfig.ci.espressif_esp32_s3_lcd_ev_board_v1_5 b/test_apps/panel/sdkconfig.ci.espressif_esp32_s3_lcd_ev_board_v1_5 new file mode 100644 index 00000000..3186a9a8 --- /dev/null +++ b/test_apps/panel/sdkconfig.ci.espressif_esp32_s3_lcd_ev_board_v1_5 @@ -0,0 +1,9 @@ +CONFIG_IDF_TARGET="esp32s3" +CONFIG_BOARD_MANUFACTURER_ALL=y +CONFIG_BOARD_ESP32_S3_LCD_EV_BOARD_V1_5=y + +CONFIG_SPIRAM=y +CONFIG_SPIRAM_MODE_OCT=y +CONFIG_SPIRAM_FETCH_INSTRUCTIONS=y +CONFIG_SPIRAM_RODATA=y +CONFIG_SPIRAM_SPEED_80M=y diff --git a/test_apps/panel/sdkconfig.ci.espressif_esp32_s3_usb_otg b/test_apps/panel/sdkconfig.ci.espressif_esp32_s3_usb_otg new file mode 100644 index 00000000..266fd377 --- /dev/null +++ b/test_apps/panel/sdkconfig.ci.espressif_esp32_s3_usb_otg @@ -0,0 +1,3 @@ +CONFIG_IDF_TARGET="esp32s3" +CONFIG_BOARD_MANUFACTURER_ALL=y +CONFIG_BOARD_ESP32_S3_USB_OTG=y diff --git a/test_apps/panel/sdkconfig.ci.jingcai_esp32_4848S040C_I_Y_3 b/test_apps/panel/sdkconfig.ci.jingcai_esp32_4848S040C_I_Y_3 new file mode 100644 index 00000000..7904e91b --- /dev/null +++ b/test_apps/panel/sdkconfig.ci.jingcai_esp32_4848S040C_I_Y_3 @@ -0,0 +1,9 @@ +CONFIG_IDF_TARGET="esp32s3" +CONFIG_BOARD_MANUFACTURER_ALL=y +CONFIG_BOARD_ESP32_4848S040C_I_Y_3=y + +CONFIG_SPIRAM=y +CONFIG_SPIRAM_MODE_OCT=y +CONFIG_SPIRAM_FETCH_INSTRUCTIONS=y +CONFIG_SPIRAM_RODATA=y +CONFIG_SPIRAM_SPEED_80M=y diff --git a/test_apps/panel/sdkconfig.ci.m5stack_m5core2 b/test_apps/panel/sdkconfig.ci.m5stack_m5core2 new file mode 100644 index 00000000..ef2f58da --- /dev/null +++ b/test_apps/panel/sdkconfig.ci.m5stack_m5core2 @@ -0,0 +1,3 @@ +CONFIG_IDF_TARGET="esp32s3" +CONFIG_BOARD_MANUFACTURER_ALL=y +CONFIG_BOARD_M5STACK_M5CORE2=y diff --git a/test_apps/panel/sdkconfig.ci.m5stack_m5core3 b/test_apps/panel/sdkconfig.ci.m5stack_m5core3 new file mode 100644 index 00000000..e8126d4b --- /dev/null +++ b/test_apps/panel/sdkconfig.ci.m5stack_m5core3 @@ -0,0 +1,9 @@ +CONFIG_IDF_TARGET="esp32s3" +CONFIG_BOARD_MANUFACTURER_ALL=y +CONFIG_BOARD_M5STACK_M5CORES3=y + +CONFIG_SPIRAM=y +CONFIG_SPIRAM_MODE_OCT=y +CONFIG_SPIRAM_FETCH_INSTRUCTIONS=y +CONFIG_SPIRAM_RODATA=y +CONFIG_SPIRAM_SPEED_80M=y diff --git a/test_apps/panel/sdkconfig.ci.m5stack_m5dial b/test_apps/panel/sdkconfig.ci.m5stack_m5dial new file mode 100644 index 00000000..89f97068 --- /dev/null +++ b/test_apps/panel/sdkconfig.ci.m5stack_m5dial @@ -0,0 +1,9 @@ +CONFIG_IDF_TARGET="esp32s3" +CONFIG_BOARD_MANUFACTURER_ALL=y +CONFIG_BOARD_M5STACK_M5DIAL=y + +CONFIG_SPIRAM=y +CONFIG_SPIRAM_MODE_OCT=y +CONFIG_SPIRAM_FETCH_INSTRUCTIONS=y +CONFIG_SPIRAM_RODATA=y +CONFIG_SPIRAM_SPEED_80M=y diff --git a/test_apps/panel/sdkconfig.ci.waveshare_esp32_s3_touch_lcd_1_85 b/test_apps/panel/sdkconfig.ci.waveshare_esp32_s3_touch_lcd_1_85 new file mode 100644 index 00000000..7848f3e2 --- /dev/null +++ b/test_apps/panel/sdkconfig.ci.waveshare_esp32_s3_touch_lcd_1_85 @@ -0,0 +1,9 @@ +CONFIG_IDF_TARGET="esp32s3" +CONFIG_BOARD_MANUFACTURER_ALL=y +CONFIG_BOARD_WAVESHARE_ESP32_S3_Touch_LCD_1_85=y + +CONFIG_SPIRAM=y +CONFIG_SPIRAM_MODE_OCT=y +CONFIG_SPIRAM_FETCH_INSTRUCTIONS=y +CONFIG_SPIRAM_RODATA=y +CONFIG_SPIRAM_SPEED_80M=y diff --git a/test_apps/panel/sdkconfig.ci.waveshare_esp32_s3_touch_lcd_2_1 b/test_apps/panel/sdkconfig.ci.waveshare_esp32_s3_touch_lcd_2_1 new file mode 100644 index 00000000..55839aba --- /dev/null +++ b/test_apps/panel/sdkconfig.ci.waveshare_esp32_s3_touch_lcd_2_1 @@ -0,0 +1,9 @@ +CONFIG_IDF_TARGET="esp32s3" +CONFIG_BOARD_MANUFACTURER_ALL=y +CONFIG_BOARD_WAVESHARE_ESP32_S3_Touch_LCD_2_1=y + +CONFIG_SPIRAM=y +CONFIG_SPIRAM_MODE_OCT=y +CONFIG_SPIRAM_FETCH_INSTRUCTIONS=y +CONFIG_SPIRAM_RODATA=y +CONFIG_SPIRAM_SPEED_80M=y diff --git a/test_apps/panel/sdkconfig.ci.waveshare_esp32_s3_touch_lcd_4_3 b/test_apps/panel/sdkconfig.ci.waveshare_esp32_s3_touch_lcd_4_3 new file mode 100644 index 00000000..9cdf5a34 --- /dev/null +++ b/test_apps/panel/sdkconfig.ci.waveshare_esp32_s3_touch_lcd_4_3 @@ -0,0 +1,9 @@ +CONFIG_IDF_TARGET="esp32s3" +CONFIG_BOARD_MANUFACTURER_ALL=y +CONFIG_BOARD_WAVESHARE_ESP32_S3_Touch_LCD_4_3=y + +CONFIG_SPIRAM=y +CONFIG_SPIRAM_MODE_OCT=y +CONFIG_SPIRAM_FETCH_INSTRUCTIONS=y +CONFIG_SPIRAM_RODATA=y +CONFIG_SPIRAM_SPEED_80M=y diff --git a/test_apps/panel/sdkconfig.defaults b/test_apps/panel/sdkconfig.defaults new file mode 100644 index 00000000..4f5a4441 --- /dev/null +++ b/test_apps/panel/sdkconfig.defaults @@ -0,0 +1,2 @@ +CONFIG_ESP_TASK_WDT_EN=n +CONFIG_FREERTOS_HZ=1000 diff --git a/test_apps/touch/i2c/CMakeLists.txt b/test_apps/touch/i2c/CMakeLists.txt new file mode 100644 index 00000000..e97e2c30 --- /dev/null +++ b/test_apps/touch/i2c/CMakeLists.txt @@ -0,0 +1,5 @@ +# The following lines of boilerplate have to be in your project's CMakeLists +# in this exact order for cmake to work correctly +cmake_minimum_required(VERSION 3.5) +include($ENV{IDF_PATH}/tools/cmake/project.cmake) +project(i2c_touch_test) diff --git a/test_apps/touch/i2c/main/CMakeLists.txt b/test_apps/touch/i2c/main/CMakeLists.txt new file mode 100644 index 00000000..92afe161 --- /dev/null +++ b/test_apps/touch/i2c/main/CMakeLists.txt @@ -0,0 +1,7 @@ +idf_component_register( + SRCS "test_app_main.c" "test_i2c_touch.cpp" + PRIV_REQUIRES esp_lcd driver + WHOLE_ARCHIVE +) + +target_compile_options(${COMPONENT_LIB} PRIVATE -Wno-missing-field-initializers) diff --git a/test_apps/touch/i2c/main/idf_component.yml b/test_apps/touch/i2c/main/idf_component.yml new file mode 100644 index 00000000..bbace3aa --- /dev/null +++ b/test_apps/touch/i2c/main/idf_component.yml @@ -0,0 +1,9 @@ +## IDF Component Manager Manifest File +dependencies: + test_utils: + path: ${IDF_PATH}/tools/unit-test-app/components/test_utils + test_driver_utils: + path: ${IDF_PATH}/components/driver/test_apps/components/test_driver_utils + ESP32_Display_Panel: + version: "*" + override_path: "../../../../../ESP32_Display_Panel" diff --git a/test_apps/touch/i2c/main/test_app_main.c b/test_apps/touch/i2c/main/test_app_main.c new file mode 100644 index 00000000..28b5cd63 --- /dev/null +++ b/test_apps/touch/i2c/main/test_app_main.c @@ -0,0 +1,63 @@ +/* + * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: CC0-1.0 + */ +#include +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" +#include "esp_heap_caps.h" +#include "unity.h" +#include "unity_test_runner.h" + +// Some resources are lazy allocated in the LCD driver, the threadhold is left for that case +#define TEST_MEMORY_LEAK_THRESHOLD (-300) + +static size_t before_free_8bit; +static size_t before_free_32bit; + +static void check_leak(size_t before_free, size_t after_free, const char *type) +{ + ssize_t delta = after_free - before_free; + printf("MALLOC_CAP_%s: Before %u bytes free, After %u bytes free (delta %d)\n", type, before_free, after_free, delta); + TEST_ASSERT_MESSAGE(delta >= TEST_MEMORY_LEAK_THRESHOLD, "memory leak"); +} + +void setUp(void) +{ + before_free_8bit = heap_caps_get_free_size(MALLOC_CAP_8BIT); + before_free_32bit = heap_caps_get_free_size(MALLOC_CAP_32BIT); +} + +void tearDown(void) +{ + size_t after_free_8bit = heap_caps_get_free_size(MALLOC_CAP_8BIT); + size_t after_free_32bit = heap_caps_get_free_size(MALLOC_CAP_32BIT); + check_leak(before_free_8bit, after_free_8bit, "8BIT"); + check_leak(before_free_32bit, after_free_32bit, "32BIT"); +} + +void app_main(void) +{ + /** + * ______ ______ ______ ________ __ + * | \ / \ / \ | \ | \ + * \$$$$$$| $$$$$$\| $$$$$$\ \$$$$$$$$______ __ __ _______ | $$____ + * | $$ \$$__| $$| $$ \$$ | $$ / \ | \ | \ / \| $$ \ + * | $$ / $$| $$ | $$ | $$$$$$\| $$ | $$| $$$$$$$| $$$$$$$\ + * | $$ | $$$$$$ | $$ __ | $$ | $$ | $$| $$ | $$| $$ | $$ | $$ + * _| $$_ | $$_____ | $$__/ \ | $$ | $$__/ $$| $$__/ $$| $$_____ | $$ | $$ + * | $$ \| $$ \ \$$ $$ | $$ \$$ $$ \$$ $$ \$$ \| $$ | $$ + * \$$$$$$ \$$$$$$$$ \$$$$$$ \$$ \$$$$$$ \$$$$$$ \$$$$$$$ \$$ \$$ + */ + printf(" ______ ______ ______ ________ __\r\n"); + printf("| \\ / \\ / \\ | \\ | \\\r\n"); + printf(" \\$$$$$$| $$$$$$\\| $$$$$$\\ \\$$$$$$$$______ __ __ _______ | $$____\r\n"); + printf(" | $$ \\$$__| $$| $$ \\$$ | $$ / \\ | \\ | \\ / \\| $$ \\\r\n"); + printf(" | $$ / $$| $$ | $$ | $$$$$$\\| $$ | $$| $$$$$$$| $$$$$$$\\\r\n"); + printf(" | $$ | $$$$$$ | $$ __ | $$ | $$ | $$| $$ | $$| $$ | $$ | $$\r\n"); + printf(" _| $$_ | $$_____ | $$__/ \\ | $$ | $$__/ $$| $$__/ $$| $$_____ | $$ | $$\r\n"); + printf("| $$ \\| $$ \\ \\$$ $$ | $$ \\$$ $$ \\$$ $$ \\$$ \\| $$ | $$\r\n"); + printf(" \\$$$$$$ \\$$$$$$$$ \\$$$$$$ \\$$ \\$$$$$$ \\$$$$$$ \\$$$$$$$ \\$$ \\$$\r\n"); + unity_run_menu(); +} diff --git a/test_apps/touch/i2c/main/test_i2c_touch.cpp b/test_apps/touch/i2c/main/test_i2c_touch.cpp new file mode 100644 index 00000000..741d7272 --- /dev/null +++ b/test_apps/touch/i2c/main/test_i2c_touch.cpp @@ -0,0 +1,119 @@ +/* + * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: CC0-1.0 + */ +#include +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" +#include "esp_heap_caps.h" +#include "esp_log.h" +#include "unity.h" +#include "unity_test_runner.h" +#include "ESP_Panel_Library.h" + +using namespace std; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////// Please update the following configuration according to your touch_device spec //////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +#define TEST_TOUCH_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 +#define TEST_TOUCH_WIDTH (480) +#define TEST_TOUCH_HEIGHT (480) +#define TEST_TOUCH_I2C_FREQ_HZ (400 * 1000) +#define TEST_TOUCH_READ_POINTS_NUM (5) + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////// Please update the following configuration according to your board spec //////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +#define TEST_TOUCH_PIN_NUM_I2C_SCL (10) +#define TEST_TOUCH_PIN_NUM_I2C_SDA (9) +#define TEST_TOUCH_PIN_NUM_RST (13) // Set to `-1` if not used +// For GT911, the RST pin is also used to configure the I2C address +#define TEST_TOUCH_PIN_NUM_INT (14) // Set to `-1` if not used +// For GT911, the INT pin is also used to configure the I2C address + +#define TEST_READ_TOUCH_DELAY_MS (30) +#define TEST_READ_TOUCH_TIME_MS (3000) + +static const char *TAG = "test_i2c_touch"; + +#define delay(x) vTaskDelay(pdMS_TO_TICKS(x)) + +#if TEST_TOUCH_PIN_NUM_INT >= 0 +IRAM_ATTR static bool onTouchInterruptCallback(void *user_data) +{ + esp_rom_printf("Touch interrupt callback\n"); + + return false; +} +#endif + +static void run_test(shared_ptr touch_device) +{ + touch_device->init(); + touch_device->begin(); +#if TEST_TOUCH_PIN_NUM_INT >= 0 + touch_device->attachInterruptCallback(onTouchInterruptCallback, NULL); +#endif + + uint32_t t = 0; + while (t++ < TEST_READ_TOUCH_TIME_MS / TEST_READ_TOUCH_DELAY_MS) { + ESP_PanelTouchPoint point[TEST_TOUCH_READ_POINTS_NUM]; + int read_touch_result = touch_device->readPoints(point, TEST_TOUCH_READ_POINTS_NUM, TEST_READ_TOUCH_DELAY_MS); + + if (read_touch_result > 0) { + for (int i = 0; i < read_touch_result; i++) { + ESP_LOGI(TAG, "Touch point(%d): x %d, y %d, strength %d\n", i, point[i].x, point[i].y, point[i].strength); + } + } else if (read_touch_result < 0) { + ESP_LOGE(TAG, "Read touch_device point failed"); + } +#if TEST_TOUCH_PIN_NUM_INT < 0 + delay(TEST_READ_TOUCH_DELAY_MS); +#endif + } +} + +#define CREATE_TOUCH_BUS(name) \ + ({ \ + ESP_LOGI(TAG, "Create touch bus"); \ + shared_ptr touch_bus = make_shared( \ + TEST_TOUCH_PIN_NUM_I2C_SCL, TEST_TOUCH_PIN_NUM_I2C_SDA, \ + (esp_lcd_panel_io_i2c_config_t)ESP_PANEL_TOUCH_I2C_PANEL_IO_CONFIG(name) \ + ); \ + TEST_ASSERT_NOT_NULL_MESSAGE(touch_bus, "Create panel bus object failed"); \ + touch_bus->configI2cFreqHz(TEST_TOUCH_I2C_FREQ_HZ); \ + TEST_ASSERT_TRUE_MESSAGE(touch_bus->begin(), "Panel bus begin failed"); \ + touch_bus; \ + }) +#define CREATE_TOUCH(name, touch_bus) \ + ({ \ + ESP_LOGI(TAG, "Create touch device: " #name); \ + shared_ptr touch_device = make_shared( \ + touch_bus, TEST_TOUCH_WIDTH, TEST_TOUCH_HEIGHT, TEST_TOUCH_PIN_NUM_RST, TEST_TOUCH_PIN_NUM_INT \ + ); \ + TEST_ASSERT_NOT_NULL_MESSAGE(touch_device, "Create TOUCH object failed"); \ + touch_device; \ + }) +#define CREATE_TEST_CASE(name) \ + TEST_CASE("Test touch (" #name ") to draw color bar", "[i2c_touch][" #name "]") \ + { \ + shared_ptr touch_bus = CREATE_TOUCH_BUS(name); \ + shared_ptr touch_device = CREATE_TOUCH(name, touch_bus.get()); \ + run_test(touch_device); \ + } + +/** + * Here to create test cases for different touchs + * + */ +CREATE_TEST_CASE(CST816S) +CREATE_TEST_CASE(FT5x06) +CREATE_TEST_CASE(GT1151) +CREATE_TEST_CASE(TT21100) +CREATE_TEST_CASE(ST1633) +CREATE_TEST_CASE(ST7123) diff --git a/test_apps/touch/i2c/sdkconfig.defaults b/test_apps/touch/i2c/sdkconfig.defaults new file mode 100644 index 00000000..e0e5bb6d --- /dev/null +++ b/test_apps/touch/i2c/sdkconfig.defaults @@ -0,0 +1,2 @@ +CONFIG_ESP_TASK_WDT= +CONFIG_FREERTOS_HZ=1000 diff --git a/test_apps/touch/spi/CMakeLists.txt b/test_apps/touch/spi/CMakeLists.txt new file mode 100644 index 00000000..03ad00c5 --- /dev/null +++ b/test_apps/touch/spi/CMakeLists.txt @@ -0,0 +1,5 @@ +# The following lines of boilerplate have to be in your project's CMakeLists +# in this exact order for cmake to work correctly +cmake_minimum_required(VERSION 3.5) +include($ENV{IDF_PATH}/tools/cmake/project.cmake) +project(spi_touch_test) diff --git a/test_apps/touch/spi/main/CMakeLists.txt b/test_apps/touch/spi/main/CMakeLists.txt new file mode 100644 index 00000000..aecd05fa --- /dev/null +++ b/test_apps/touch/spi/main/CMakeLists.txt @@ -0,0 +1,5 @@ +idf_component_register( + SRCS "test_app_main.c" "test_spi_touch.cpp" + PRIV_REQUIRES esp_lcd driver + WHOLE_ARCHIVE +) diff --git a/test_apps/touch/spi/main/idf_component.yml b/test_apps/touch/spi/main/idf_component.yml new file mode 100644 index 00000000..bbace3aa --- /dev/null +++ b/test_apps/touch/spi/main/idf_component.yml @@ -0,0 +1,9 @@ +## IDF Component Manager Manifest File +dependencies: + test_utils: + path: ${IDF_PATH}/tools/unit-test-app/components/test_utils + test_driver_utils: + path: ${IDF_PATH}/components/driver/test_apps/components/test_driver_utils + ESP32_Display_Panel: + version: "*" + override_path: "../../../../../ESP32_Display_Panel" diff --git a/test_apps/touch/spi/main/test_app_main.c b/test_apps/touch/spi/main/test_app_main.c new file mode 100644 index 00000000..bb5d99cc --- /dev/null +++ b/test_apps/touch/spi/main/test_app_main.c @@ -0,0 +1,63 @@ +/* + * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: CC0-1.0 + */ +#include +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" +#include "esp_heap_caps.h" +#include "unity.h" +#include "unity_test_runner.h" + +// Some resources are lazy allocated in the LCD driver, the threadhold is left for that case +#define TEST_MEMORY_LEAK_THRESHOLD (-300) + +static size_t before_free_8bit; +static size_t before_free_32bit; + +static void check_leak(size_t before_free, size_t after_free, const char *type) +{ + ssize_t delta = after_free - before_free; + printf("MALLOC_CAP_%s: Before %u bytes free, After %u bytes free (delta %d)\n", type, before_free, after_free, delta); + TEST_ASSERT_MESSAGE(delta >= TEST_MEMORY_LEAK_THRESHOLD, "memory leak"); +} + +void setUp(void) +{ + before_free_8bit = heap_caps_get_free_size(MALLOC_CAP_8BIT); + before_free_32bit = heap_caps_get_free_size(MALLOC_CAP_32BIT); +} + +void tearDown(void) +{ + size_t after_free_8bit = heap_caps_get_free_size(MALLOC_CAP_8BIT); + size_t after_free_32bit = heap_caps_get_free_size(MALLOC_CAP_32BIT); + check_leak(before_free_8bit, after_free_8bit, "8BIT"); + check_leak(before_free_32bit, after_free_32bit, "32BIT"); +} + +void app_main(void) +{ + /** + * ______ _______ ______ ________ __ + * / \ | \| \ | \ | \ + * | $$$$$$\| $$$$$$$\\$$$$$$ \$$$$$$$$______ __ __ _______ | $$____ + * | $$___\$$| $$__/ $$ | $$ | $$ / \ | \ | \ / \| $$ \ + * \$$ \ | $$ $$ | $$ | $$ | $$$$$$\| $$ | $$| $$$$$$$| $$$$$$$\ + * _\$$$$$$\| $$$$$$$ | $$ | $$ | $$ | $$| $$ | $$| $$ | $$ | $$ + * | \__| $$| $$ _| $$_ | $$ | $$__/ $$| $$__/ $$| $$_____ | $$ | $$ + * \$$ $$| $$ | $$ \ | $$ \$$ $$ \$$ $$ \$$ \| $$ | $$ + * \$$$$$$ \$$ \$$$$$$ \$$ \$$$$$$ \$$$$$$ \$$$$$$$ \$$ \$$ + */ + printf(" ______ _______ ______ ________ __\r\n"); + printf(" / \\ | \\| \\ | \\ | \\\r\n"); + printf("| $$$$$$\\| $$$$$$$\\\\$$$$$$ \\$$$$$$$$______ __ __ _______ | $$____\r\n"); + printf("| $$___\\$$| $$__/ $$ | $$ | $$ / \\ | \\ | \\ / \\| $$ \\\r\n"); + printf(" \\$$ \\ | $$ $$ | $$ | $$ | $$$$$$\\| $$ | $$| $$$$$$$| $$$$$$$\\\r\n"); + printf(" _\\$$$$$$\\| $$$$$$$ | $$ | $$ | $$ | $$| $$ | $$| $$ | $$ | $$\r\n"); + printf("| \\__| $$| $$ _| $$_ | $$ | $$__/ $$| $$__/ $$| $$_____ | $$ | $$\r\n"); + printf(" \\$$ $$| $$ | $$ \\ | $$ \\$$ $$ \\$$ $$ \\$$ \\| $$ | $$\r\n"); + printf(" \\$$$$$$ \\$$ \\$$$$$$ \\$$ \\$$$$$$ \\$$$$$$ \\$$$$$$$ \\$$ \\$$\r\n"); + unity_run_menu(); +} diff --git a/test_apps/touch/spi/main/test_spi_touch.cpp b/test_apps/touch/spi/main/test_spi_touch.cpp new file mode 100644 index 00000000..319b81da --- /dev/null +++ b/test_apps/touch/spi/main/test_spi_touch.cpp @@ -0,0 +1,110 @@ +/* + * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: CC0-1.0 + */ +#include +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" +#include "esp_heap_caps.h" +#include "esp_log.h" +#include "unity.h" +#include "unity_test_runner.h" +#include "ESP_Panel_Library.h" + +using namespace std; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////// Please update the following configuration according to your touch_device spec //////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +#define TEST_TOUCH_WIDTH (240) +#define TEST_TOUCH_HEIGHT (320) +#define TEST_TOUCH_SPI_FREQ_HZ (1 * 1000 * 1000) +#define TEST_TOUCH_READ_POINTS_NUM (1) + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////// Please update the following configuration according to your board spec //////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +#define TEST_TOUCH_PIN_NUM_SPI_CS (46) +#define TEST_TOUCH_PIN_NUM_SPI_SCK (10) +#define TEST_TOUCH_PIN_NUM_SPI_MOSI (14) +#define TEST_TOUCH_PIN_NUM_SPI_MISO (8) +#define TEST_TOUCH_PIN_NUM_RST (-1) +#define TEST_TOUCH_PIN_NUM_INT (-1) + +#define TEST_READ_TOUCH_DELAY_MS (30) +#define TEST_READ_TOUCH_TIME_MS (3000) + +static const char *TAG = "test_spi_touch"; + +#define delay(x) vTaskDelay(pdMS_TO_TICKS(x)) + +#if TEST_TOUCH_PIN_NUM_INT >= 0 +IRAM_ATTR static bool onTouchInterruptCallback(void *user_data) +{ + esp_rom_printf("Touch interrupt callback\n"); + + return false; +} +#endif + +static void run_test(shared_ptr touch_device) +{ + touch_device->init(); + touch_device->begin(); +#if TEST_TOUCH_PIN_NUM_INT >= 0 + touch_device->attachInterruptCallback(onTouchInterruptCallback, NULL); +#endif + + uint32_t t = 0; + while (t++ < TEST_READ_TOUCH_TIME_MS / TEST_READ_TOUCH_DELAY_MS) { + ESP_PanelTouchPoint point[TEST_TOUCH_READ_POINTS_NUM]; + int read_touch_result = touch_device->readPoints(point, TEST_TOUCH_READ_POINTS_NUM, TEST_READ_TOUCH_DELAY_MS); + + if (read_touch_result > 0) { + for (int i = 0; i < read_touch_result; i++) { + ESP_LOGI(TAG, "Touch point(%d): x %d, y %d, strength %d\n", i, point[i].x, point[i].y, point[i].strength); + } + } else if (read_touch_result < 0) { + ESP_LOGE(TAG, "Read touch_device point failed"); + } +#if TEST_TOUCH_PIN_NUM_INT < 0 + delay(TEST_READ_TOUCH_DELAY_MS); +#endif + } +} + +#define CREATE_TOUCH_BUS(name) \ + ({ \ + ESP_LOGI(TAG, "Create touch bus"); \ + shared_ptr touch_bus = make_shared( \ + TEST_TOUCH_PIN_NUM_SPI_SCK, TEST_TOUCH_PIN_NUM_SPI_MOSI, TEST_TOUCH_PIN_NUM_SPI_MISO, \ + (esp_lcd_panel_io_spi_config_t)ESP_PANEL_TOUCH_SPI_PANEL_IO_CONFIG(name, TEST_TOUCH_PIN_NUM_SPI_CS) \ + ); \ + TEST_ASSERT_NOT_NULL_MESSAGE(touch_bus, "Create panel bus object failed"); \ + touch_bus->configSpiFreqHz(TEST_TOUCH_SPI_FREQ_HZ); \ + TEST_ASSERT_TRUE_MESSAGE(touch_bus->begin(), "Panel bus begin failed"); \ + touch_bus; \ + }) +#define CREATE_TOUCH(name, touch_bus) \ + ({ \ + ESP_LOGI(TAG, "Create touch device: " #name); \ + shared_ptr touch_device = make_shared( \ + touch_bus, TEST_TOUCH_WIDTH, TEST_TOUCH_HEIGHT, TEST_TOUCH_PIN_NUM_RST, TEST_TOUCH_PIN_NUM_INT \ + ); \ + TEST_ASSERT_NOT_NULL_MESSAGE(touch_device, "Create TOUCH object failed"); \ + touch_device; \ + }) +#define CREATE_TEST_CASE(name) \ + TEST_CASE("Test touch (" #name ") to draw color bar", "[spi_touch][" #name "]") \ + { \ + shared_ptr touch_bus = CREATE_TOUCH_BUS(name); \ + shared_ptr touch_device = CREATE_TOUCH(name, touch_bus.get()); \ + run_test(touch_device); \ + } + +/** + * Here to create test cases for different touchs + * + */ +CREATE_TEST_CASE(XPT2046) diff --git a/test_apps/touch/spi/sdkconfig.defaults b/test_apps/touch/spi/sdkconfig.defaults new file mode 100644 index 00000000..e0e5bb6d --- /dev/null +++ b/test_apps/touch/spi/sdkconfig.defaults @@ -0,0 +1,2 @@ +CONFIG_ESP_TASK_WDT= +CONFIG_FREERTOS_HZ=1000 diff --git a/tools/check_file_version.py b/tools/check_file_version.py index 9f0cb223..ddcc031f 100644 --- a/tools/check_file_version.py +++ b/tools/check_file_version.py @@ -5,92 +5,92 @@ import sys import re -internal_version_file = "src/ESP_PanelVersions.h" +internal_version_file = 'src/ESP_PanelVersions.h' internal_version_macross = [ { - "file": "library.properties", - "macro": { - "major": "ESP_PANEL_VERSION_MAJOR", - "minor": "ESP_PANEL_VERSION_MINOR", - "patch": "ESP_PANEL_VERSION_PATCH" + 'file': 'library.properties', + 'macro': { + 'major': 'ESP_PANEL_VERSION_MAJOR', + 'minor': 'ESP_PANEL_VERSION_MINOR', + 'patch': 'ESP_PANEL_VERSION_PATCH' }, }, { - "file": "ESP_Panel_Conf.h", - "macro": { - "major": "ESP_PANEL_CONF_VERSION_MAJOR", - "minor": "ESP_PANEL_CONF_VERSION_MINOR", - "patch": "ESP_PANEL_CONF_VERSION_PATCH" + 'file': 'ESP_Panel_Conf.h', + 'macro': { + 'major': 'ESP_PANEL_CONF_VERSION_MAJOR', + 'minor': 'ESP_PANEL_CONF_VERSION_MINOR', + 'patch': 'ESP_PANEL_CONF_VERSION_PATCH' }, }, { - "file": "ESP_Panel_Board_Custom.h", - "macro": { - "major": "ESP_PANEL_BOARD_CUSTOM_VERSION_MAJOR", - "minor": "ESP_PANEL_BOARD_CUSTOM_VERSION_MINOR", - "patch": "ESP_PANEL_BOARD_CUSTOM_VERSION_PATCH" + 'file': 'ESP_Panel_Board_Custom.h', + 'macro': { + 'major': 'ESP_PANEL_BOARD_CUSTOM_VERSION_MAJOR', + 'minor': 'ESP_PANEL_BOARD_CUSTOM_VERSION_MINOR', + 'patch': 'ESP_PANEL_BOARD_CUSTOM_VERSION_PATCH' }, }, { - "file": "ESP_Panel_Board_Supported.h", - "macro": { - "major": "ESP_PANEL_BOARD_SUPPORTED_VERSION_MAJOR", - "minor": "ESP_PANEL_BOARD_SUPPORTED_VERSION_MINOR", - "patch": "ESP_PANEL_BOARD_SUPPORTED_VERSION_PATCH" + 'file': 'ESP_Panel_Board_Supported.h', + 'macro': { + 'major': 'ESP_PANEL_BOARD_SUPPORTED_VERSION_MAJOR', + 'minor': 'ESP_PANEL_BOARD_SUPPORTED_VERSION_MINOR', + 'patch': 'ESP_PANEL_BOARD_SUPPORTED_VERSION_PATCH' }, }, ] file_version_macros = [ { - "file": "ESP_Panel_Conf.h", - "macro": { - "major": "ESP_PANEL_CONF_FILE_VERSION_MAJOR", - "minor": "ESP_PANEL_CONF_FILE_VERSION_MINOR", - "patch": "ESP_PANEL_CONF_FILE_VERSION_PATCH" + 'file': 'ESP_Panel_Conf.h', + 'macro': { + 'major': 'ESP_PANEL_CONF_FILE_VERSION_MAJOR', + 'minor': 'ESP_PANEL_CONF_FILE_VERSION_MINOR', + 'patch': 'ESP_PANEL_CONF_FILE_VERSION_PATCH' }, }, { - "file": "ESP_Panel_Board_Custom.h", - "macro": { - "major": "ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MAJOR", - "minor": "ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MINOR", - "patch": "ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_PATCH" + 'file': 'ESP_Panel_Board_Custom.h', + 'macro': { + 'major': 'ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MAJOR', + 'minor': 'ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MINOR', + 'patch': 'ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_PATCH' }, }, { - "file": "ESP_Panel_Board_Supported.h", - "macro": { - "major": "ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MAJOR", - "minor": "ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MINOR", - "patch": "ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_PATCH" + 'file': 'ESP_Panel_Board_Supported.h', + 'macro': { + 'major': 'ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MAJOR', + 'minor': 'ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MINOR', + 'patch': 'ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_PATCH' }, }, ] -arduino_version_file = "library.properties" +arduino_version_file = 'library.properties' def extract_file_version(file_path, version_dict): file_contents = [] - content_str = "" + content_str = '' with open(file_path, 'r') as file: file_contents.append(file.readlines()) for content in file_contents: content_str = ''.join(content) version_macro = version_dict['macro'] - major_version = re.search(r'#define ' + version_macro["major"] + r' (\d+)', content_str) - minor_version = re.search(r'#define ' + version_macro["minor"] + r' (\d+)', content_str) - patch_version = re.search(r'#define ' + version_macro["patch"] + r' (\d+)', content_str) + major_version = re.search(r'#define ' + version_macro['major'] + r' (\d+)', content_str) + minor_version = re.search(r'#define ' + version_macro['minor'] + r' (\d+)', content_str) + patch_version = re.search(r'#define ' + version_macro['patch'] + r' (\d+)', content_str) if major_version and minor_version and patch_version: - return {"file": version_dict['file'], "version": major_version.group(1) + '.' + minor_version.group(1) + '.' + patch_version.group(1)} + return {'file': version_dict['file'], 'version': major_version.group(1) + '.' + minor_version.group(1) + '.' + patch_version.group(1)} return None def extract_arduino_version(file_path): file_contents = [] - content_str = "" + content_str = '' with open(file_path, 'r') as file: file_contents.append(file.readlines()) for content in file_contents: @@ -99,12 +99,12 @@ def extract_arduino_version(file_path): version = re.search(r'version=(\d+\.\d+\.\d+)', content_str) if version: - return {"file": os.path.basename(file_path), "version": version.group(1)} + return {'file': os.path.basename(file_path), 'version': version.group(1)} return None -if __name__ == "__main__": +if __name__ == '__main__': if len(sys.argv) >= 3: search_directory = sys.argv[1] @@ -138,20 +138,20 @@ def extract_arduino_version(file_path): if (internal_version['file'] == versions['file']) and (internal_version['version'] != versions['version']): print(f"Version mismatch: '{internal_version['file']}'") sys.exit(1) - print(f"Version matched") + print(f'Version matched') # Extract arduino version arduino_version_path = os.path.join(search_directory, arduino_version_file) arduino_version = extract_arduino_version(arduino_version_path) print(f"Arduino version extracted from '{arduino_version_path}") if arduino_version: - print(f"Arduino version: {arduino_version}") + print(f'Arduino version: {arduino_version}') else: - print(f"Arduino version not found") + print(f'Arduino version not found') # Check arduino version for internal_version in internal_versions: if (internal_version['file'] == arduino_version_file) and (internal_version['version'] != arduino_version['version']): print(f"Arduino version mismatch: '{internal_version['file']}'") sys.exit(1) - print(f"Arduino Version matched") + print(f'Arduino Version matched') diff --git a/tools/sync_conf_files.py b/tools/sync_conf_files.py index 503c1da9..70df4005 100644 --- a/tools/sync_conf_files.py +++ b/tools/sync_conf_files.py @@ -5,7 +5,7 @@ import sys import shutil -exclude_dirs = ["./build"] +exclude_dirs = ['./build'] def is_in_directory(file_path, directory): @@ -24,7 +24,7 @@ def is_same_file(file1, file2): def replace_files(search_directory, file_path): - if os.path.dirname(file_path) == "": + if os.path.dirname(file_path) == '': file_path = os.path.join(search_directory, file_path) filename = os.path.basename(file_path) @@ -53,7 +53,7 @@ def replace_files(search_directory, file_path): shutil.copy(src_file, file_path) -if __name__ == "__main__": +if __name__ == '__main__': if len(sys.argv) >= 3: search_directory = sys.argv[1] @@ -61,4 +61,4 @@ def replace_files(search_directory, file_path): file_path = sys.argv[i] replace_files(search_directory, file_path) - print("Replacement completed.") + print('Replacement completed.')