diff --git a/.codespellrc b/.codespellrc index 756f7e9503b..d3b9b45cb1e 100644 --- a/.codespellrc +++ b/.codespellrc @@ -1,7 +1,7 @@ [codespell] # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/spell-check/.codespellrc # In the event of a false positive, add the problematic word, in all lowercase, to a comma-separated list here: -ignore-words-list = ba,licence,ot,dout,als,exten +ignore-words-list = ba,licence,ot,dout,als,exten,emac skip = ./.git,./.licenses,__pycache__,.clang-format,.codespellrc,.editorconfig,.flake8,.prettierignore,.yamllint.yml,.gitignore,boards.txt,platform.txt,programmers.txt builtin = clear,informal,en-GB_to_en-US check-filenames = diff --git a/.github/ISSUE_TEMPLATE/Feature-request.yml b/.github/ISSUE_TEMPLATE/Feature-request.yml index 0788288036c..8849a407a39 100644 --- a/.github/ISSUE_TEMPLATE/Feature-request.yml +++ b/.github/ISSUE_TEMPLATE/Feature-request.yml @@ -5,6 +5,7 @@ body: - type: markdown attributes: value: | + * Please note that we can only process feature requests reported in English to ensure effective communication and support. Feature requests written in other languages will be closed, with a request to rewrite them in English. * We welcome any ideas or feature requests! It is helpful if you can explain exactly why the feature would be useful. * There are usually some outstanding feature requests in the [existing issues list](https://github.com/espressif/arduino-esp32/issues?q=is%3Aopen+is%3Aissue+label%3A%22Type%3A+Feature+request%22), feel free to add comments to them. * If you would like to contribute, please read the [contributions guide](https://docs.espressif.com/projects/arduino-esp32/en/latest/contributing.html). diff --git a/.github/ISSUE_TEMPLATE/Issue-report.yml b/.github/ISSUE_TEMPLATE/Issue-report.yml index a902184f06b..9dba5e0ca8f 100644 --- a/.github/ISSUE_TEMPLATE/Issue-report.yml +++ b/.github/ISSUE_TEMPLATE/Issue-report.yml @@ -5,6 +5,7 @@ body: - type: markdown attributes: value: | + * Please note that we can only process issues reported in English to ensure effective communication and support. Issues written in other languages will be closed, with a request to rewrite them in English. * Before reporting a new issue please check and search in [List of existing issues](https://github.com/espressif/arduino-esp32/issues?q=is%3Aissue) * Please check [Online Documentation](https://docs.espressif.com/projects/arduino-esp32/en/latest/index.html) * Take a look on [Troubleshooting guide](https://docs.espressif.com/projects/arduino-esp32/en/latest/troubleshooting.html) @@ -39,8 +40,11 @@ body: label: Version description: What version of Arduino ESP32 are you running? If possible, consider updating to the latest version. options: - - latest master (checkout manually) + - latest stable Release (if not listed below) - latest development Release Candidate (RC-X) + - latest master (checkout manually) + - v3.2.0 + - v3.1.3 - v3.1.2 - v3.1.1 - v3.1.0 diff --git a/.github/scripts/on-push-idf.sh b/.github/scripts/on-push-idf.sh new file mode 100644 index 00000000000..72e7c7f574e --- /dev/null +++ b/.github/scripts/on-push-idf.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +set -e + +CHECK_REQUIREMENTS="./components/arduino-esp32/.github/scripts/sketch_utils.sh check_requirements" + +# Export IDF environment +. ${IDF_PATH}/export.sh + +# Find all examples in ./components/arduino-esp32/idf_component_examples +idf_component_examples=$(find ./components/arduino-esp32/idf_component_examples -mindepth 1 -maxdepth 1 -type d) + +for example in $idf_component_examples; do + if [ -f "$example"/ci.json ]; then + # If the target is listed as false, skip the sketch. Otherwise, include it. + is_target=$(jq -r --arg target "$IDF_TARGET" '.targets[$target]' "$example"/ci.json) + if [[ "$is_target" == "false" ]]; then + printf "\n\033[93mSkipping %s for target %s\033[0m\n\n" "$example" "$IDF_TARGET" + continue + fi + fi + + idf.py -C "$example" set-target "$IDF_TARGET" + + has_requirements=$(${CHECK_REQUIREMENTS} "$example" "$example/sdkconfig") + if [ "$has_requirements" -eq 0 ]; then + printf "\n\033[93m%s does not meet the requirements for %s. Skipping...\033[0m\n\n" "$example" "$IDF_TARGET" + continue + fi + + printf "\n\033[95mBuilding %s\033[0m\n\n" "$example" + idf.py -C "$example" -DEXTRA_COMPONENT_DIRS="$PWD/components" build +done diff --git a/.github/scripts/on-push.sh b/.github/scripts/on-push.sh index 6095f88e727..3eb020c09a3 100755 --- a/.github/scripts/on-push.sh +++ b/.github/scripts/on-push.sh @@ -90,6 +90,7 @@ if [ "$BUILD_LOG" -eq 1 ]; then fi #build sketches for different targets +build "esp32c5" "$CHUNK_INDEX" "$CHUNKS_CNT" "$BUILD_LOG" "$LOG_LEVEL" "$SKETCHES_FILE" "${SKETCHES_ESP32[@]}" build "esp32p4" "$CHUNK_INDEX" "$CHUNKS_CNT" "$BUILD_LOG" "$LOG_LEVEL" "$SKETCHES_FILE" "${SKETCHES_ESP32[@]}" build "esp32s3" "$CHUNK_INDEX" "$CHUNKS_CNT" "$BUILD_LOG" "$LOG_LEVEL" "$SKETCHES_FILE" "${SKETCHES_ESP32[@]}" build "esp32s2" "$CHUNK_INDEX" "$CHUNKS_CNT" "$BUILD_LOG" "$LOG_LEVEL" "$SKETCHES_FILE" "${SKETCHES_ESP32[@]}" diff --git a/.github/scripts/on-release.sh b/.github/scripts/on-release.sh index 242cee93d0b..dafbf3d6a1c 100755 --- a/.github/scripts/on-release.sh +++ b/.github/scripts/on-release.sh @@ -35,6 +35,8 @@ PACKAGE_JSON_MERGE="$GITHUB_WORKSPACE/.github/scripts/merge_packages.py" PACKAGE_JSON_TEMPLATE="$GITHUB_WORKSPACE/package/package_esp32_index.template.json" PACKAGE_JSON_DEV="package_esp32_dev_index.json" PACKAGE_JSON_REL="package_esp32_index.json" +PACKAGE_JSON_DEV_CN="package_esp32_dev_index_cn.json" +PACKAGE_JSON_REL_CN="package_esp32_index_cn.json" echo "Event: $GITHUB_EVENT_NAME, Repo: $GITHUB_REPOSITORY, Path: $GITHUB_WORKSPACE, Ref: $GITHUB_REF" echo "Action: $action, Branch: $RELEASE_BRANCH, ID: $RELEASE_ID" @@ -339,9 +341,13 @@ jq_arg=".packages[0].platforms[0].version = \"$RELEASE_TAG\" | \ # Generate package JSONs echo "Generating $PACKAGE_JSON_DEV ..." cat "$PACKAGE_JSON_TEMPLATE" | jq "$jq_arg" > "$OUTPUT_DIR/$PACKAGE_JSON_DEV" +# On MacOS the sed command won't skip the first match. Use gsed instead. +sed '0,/github\.com\/espressif\//!s|github\.com/espressif/|dl.espressif.cn/github_assets/espressif/|g' "$OUTPUT_DIR/$PACKAGE_JSON_DEV" > "$OUTPUT_DIR/$PACKAGE_JSON_DEV_CN" if [ "$RELEASE_PRE" == "false" ]; then echo "Generating $PACKAGE_JSON_REL ..." cat "$PACKAGE_JSON_TEMPLATE" | jq "$jq_arg" > "$OUTPUT_DIR/$PACKAGE_JSON_REL" + # On MacOS the sed command won't skip the first match. Use gsed instead. + sed '0,/github\.com\/espressif\//!s|github\.com/espressif/|dl.espressif.cn/github_assets/espressif/|g' "$OUTPUT_DIR/$PACKAGE_JSON_REL" > "$OUTPUT_DIR/$PACKAGE_JSON_REL_CN" fi # Figure out the last release or pre-release @@ -373,12 +379,14 @@ echo if [ -n "$prev_any_release" ] && [ "$prev_any_release" != "null" ]; then echo "Merging with JSON from $prev_any_release ..." merge_package_json "$prev_any_release/$PACKAGE_JSON_DEV" "$OUTPUT_DIR/$PACKAGE_JSON_DEV" + merge_package_json "$prev_any_release/$PACKAGE_JSON_DEV_CN" "$OUTPUT_DIR/$PACKAGE_JSON_DEV_CN" fi if [ "$RELEASE_PRE" == "false" ]; then if [ -n "$prev_release" ] && [ "$prev_release" != "null" ]; then echo "Merging with JSON from $prev_release ..." merge_package_json "$prev_release/$PACKAGE_JSON_REL" "$OUTPUT_DIR/$PACKAGE_JSON_REL" + merge_package_json "$prev_release/$PACKAGE_JSON_REL_CN" "$OUTPUT_DIR/$PACKAGE_JSON_REL_CN" fi fi @@ -388,6 +396,8 @@ echo "Installing arduino-cli ..." export PATH="/home/runner/bin:$PATH" source "${SCRIPTS_DIR}/install-arduino-cli.sh" +# For the Chinese mirror, we can't test the package JSONs as the Chinese mirror might not be updated yet. + echo "Testing $PACKAGE_JSON_DEV install ..." echo "Installing esp32 ..." @@ -445,11 +455,15 @@ fi echo "Uploading $PACKAGE_JSON_DEV ..." echo "Download URL: $(git_safe_upload_asset "$OUTPUT_DIR/$PACKAGE_JSON_DEV")" echo "Pages URL: $(git_safe_upload_to_pages "$PACKAGE_JSON_DEV" "$OUTPUT_DIR/$PACKAGE_JSON_DEV")" +echo "Download CN URL: $(git_safe_upload_asset "$OUTPUT_DIR/$PACKAGE_JSON_DEV_CN")" +echo "Pages CN URL: $(git_safe_upload_to_pages "$PACKAGE_JSON_DEV" "$OUTPUT_DIR/$PACKAGE_JSON_DEV_CN")" echo if [ "$RELEASE_PRE" == "false" ]; then echo "Uploading $PACKAGE_JSON_REL ..." echo "Download URL: $(git_safe_upload_asset "$OUTPUT_DIR/$PACKAGE_JSON_REL")" echo "Pages URL: $(git_safe_upload_to_pages "$PACKAGE_JSON_REL" "$OUTPUT_DIR/$PACKAGE_JSON_REL")" + echo "Download CN URL: $(git_safe_upload_asset "$OUTPUT_DIR/$PACKAGE_JSON_REL_CN")" + echo "Pages CN URL: $(git_safe_upload_to_pages "$PACKAGE_JSON_REL" "$OUTPUT_DIR/$PACKAGE_JSON_REL_CN")" echo fi diff --git a/.github/scripts/sketch_utils.sh b/.github/scripts/sketch_utils.sh index e536da50111..01ceafe9af1 100755 --- a/.github/scripts/sketch_utils.sh +++ b/.github/scripts/sketch_utils.sh @@ -16,7 +16,7 @@ function check_requirements { # check_requirements local requirements_or if [ ! -f "$sdkconfig_path" ] || [ ! -f "$sketchdir/ci.json" ]; then - echo "ERROR: sdkconfig or ci.json not found" 1>&2 + echo "WARNING: sdkconfig or ci.json not found. Assuming requirements are met." 1>&2 # Return 1 on error to force the sketch to be built and fail. This way the # CI will fail and the user will know that the sketch has a problem. else @@ -156,6 +156,7 @@ function build_sketch { # build_sketch [ext esp32c6_opts=$(echo "$debug_level,$fqbn_append" | sed 's/^,*//;s/,*$//;s/,\{2,\}/,/g') esp32h2_opts=$(echo "$debug_level,$fqbn_append" | sed 's/^,*//;s/,*$//;s/,\{2,\}/,/g') esp32p4_opts=$(echo "PSRAM=enabled,USBMode=default,$debug_level,$fqbn_append" | sed 's/^,*//;s/,*$//;s/,\{2,\}/,/g') + esp32c5_opts=$(echo "$debug_level,$fqbn_append" | sed 's/^,*//;s/,*$//;s/,\{2,\}/,/g') # Select the common part of the FQBN based on the target. The rest will be # appended depending on the passed options. @@ -191,6 +192,10 @@ function build_sketch { # build_sketch [ext [ -n "${options:-$esp32p4_opts}" ] && opt=":${options:-$esp32p4_opts}" fqbn="espressif:esp32:esp32p4$opt" ;; + "esp32c5") + [ -n "${options:-$esp32c5_opts}" ] && opt=":${options:-$esp32c5_opts}" + fqbn="espressif:esp32:esp32c5$opt" + ;; *) echo "ERROR: Invalid chip: $target" exit 1 diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index d98da24fc07..026e0b8fc0d 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -31,6 +31,7 @@ on: - "!libraries/**.properties" - "!libraries/**.py" - "package/**" + - "idf_component_examples/**" - "tools/**.py" - "platform.txt" - "programmers.txt" @@ -45,8 +46,8 @@ on: - "!.github/scripts/tests_*" - "!.github/scripts/upload_*" - "variants/esp32/**/*" - - "variants/esp32c2/**/*" - "variants/esp32c3/**/*" + - "variants/esp32c5/**/*" - "variants/esp32c6/**/*" - "variants/esp32h2/**/*" - "variants/esp32p4/**/*" @@ -124,7 +125,7 @@ jobs: - 'idf_component.yml' - 'Kconfig.projbuild' - 'CMakeLists.txt' - - "variants/esp32c2/**/*" + - "idf_component_examples/**" - name: Set chunks id: set-chunks @@ -267,15 +268,23 @@ jobs: submodules: recursive path: components/arduino-esp32 + - name: Setup jq + uses: dcarbone/install-jq-action@e397bd87438d72198f81efd21f876461183d383a # v3.0.1 + - name: Build env: IDF_TARGET: ${{ matrix.idf_target }} shell: bash run: | - . ${IDF_PATH}/export.sh - idf.py create-project test - echo CONFIG_FREERTOS_HZ=1000 > test/sdkconfig.defaults - idf.py -C test -DEXTRA_COMPONENT_DIRS=$PWD/components build + chmod a+x ./components/arduino-esp32/.github/scripts/* + ./components/arduino-esp32/.github/scripts/on-push-idf.sh + + - name: Upload generated sdkconfig files for debugging + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 + if: always() + with: + name: sdkconfig-${{ matrix.idf_target }} + path: ./components/arduino-esp32/idf_component_examples/**/sdkconfig # Save artifacts to gh-pages save-master-artifacts: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f80261422b0..0d425c46eae 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -12,7 +12,7 @@ default_language_version: repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: "v5.0.0" + rev: "cef0300fd0fc4d2a87a85fa2093c6b283ea36f4b" # v5.0.0 hooks: # Generic checks - id: check-case-conflict @@ -39,15 +39,8 @@ repos: ^package\/.*$ ) - - repo: https://github.com/codespell-project/codespell - rev: "v2.3.0" - hooks: - # Spell checking - - id: codespell - exclude: ^.*\.(svd|SVD)$ - - repo: https://github.com/pre-commit/mirrors-clang-format - rev: "v18.1.3" + rev: "f6446549e5e97ec9665b9b03e75b87b445857f9a" # v18.1.3 hooks: # C/C++ formatting - id: clang-format @@ -55,7 +48,7 @@ repos: exclude: ^.*\/build_opt\.h$ - repo: https://github.com/psf/black-pre-commit-mirror - rev: "24.10.0" + rev: "a4920527036bb9a3f3e6055d595849d67d0da066" # 25.1.0 hooks: # Python formatting - id: black @@ -63,7 +56,7 @@ repos: args: [--line-length=120] #From the arduino code style. Add as argument rather than creating a new config file. - repo: https://github.com/PyCQA/flake8 - rev: "7.1.1" + rev: "16f5f28a384f0781bebb37a08aa45e65b9526c50" # 7.2.0 hooks: # Python linting - id: flake8 @@ -74,21 +67,28 @@ repos: - flake8-simplify - repo: https://github.com/pre-commit/mirrors-prettier - rev: "v3.1.0" + rev: "ffb6a759a979008c0e6dff86e39f4745a2d9eac4" # v3.1.0 hooks: # YAML formatting - id: prettier types_or: [yaml] + - repo: https://github.com/codespell-project/codespell + rev: "63c8f8312b7559622c0d82815639671ae42132ac" # v2.4.1 + hooks: + # Spell checking + - id: codespell + exclude: ^.*\.(svd|SVD)$ + - repo: https://github.com/shellcheck-py/shellcheck-py - rev: "v0.10.0.1" + rev: "a23f6b85d0fdd5bb9d564e2579e678033debbdff" # v0.10.0.1 hooks: # Bash linting - id: shellcheck types: [shell] - repo: https://github.com/openstack/bashate - rev: "2.1.1" + rev: "fbd7c2534c2701351c603ff700ddf08202430a31" # 2.1.1 hooks: # Bash formatting - id: bashate @@ -96,15 +96,15 @@ repos: args: ["-i", "E006"] # Ignore E006: Line too long - repo: https://github.com/errata-ai/vale - rev: "v3.9.1" + rev: "dc4c47923788a413fb5677de6e3370d514aecb78" # v3.11.2 hooks: # Sync vale styles and lint markdown and reStructuredText - id: vale name: vale-sync - language_version: "1.21.6" + language_version: "1.23.2" pass_filenames: false args: [sync] types_or: [markdown, rst] - id: vale - language_version: "1.21.6" + language_version: "1.23.2" types_or: [markdown, rst] diff --git a/CMakeLists.txt b/CMakeLists.txt index 7539601d9e5..5ba9c999d81 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,7 +6,7 @@ # idf.py build set(min_supported_idf_version "5.3.0") -set(max_supported_idf_version "5.4.99") +set(max_supported_idf_version "5.5.99") set(idf_version "${IDF_VERSION_MAJOR}.${IDF_VERSION_MINOR}.${IDF_VERSION_PATCH}") if ("${idf_version}" AND NOT "$ENV{ARDUINO_SKIP_IDF_VERSION_CHECK}") @@ -300,6 +300,7 @@ set(ARDUINO_LIBRARY_Zigbee_SRCS libraries/Zigbee/src/ep/ZigbeeGateway.cpp libraries/Zigbee/src/ep/ZigbeeWindSpeedSensor.cpp libraries/Zigbee/src/ep/ZigbeeIlluminanceSensor.cpp + libraries/Zigbee/src/ep/ZigbeePM25Sensor.cpp ) set(ARDUINO_LIBRARY_BLE_SRCS diff --git a/boards.txt b/boards.txt index f0df27762c2..889f36852e2 100644 --- a/boards.txt +++ b/boards.txt @@ -161,6 +161,217 @@ esp32c2.menu.EraseFlash.all.upload.erase_cmd=-e ############################################################## +esp32c5.name=ESP32C5 Dev Module + +esp32c5.bootloader.tool=esptool_py +esp32c5.bootloader.tool.default=esptool_py + +esp32c5.upload.tool=esptool_py +esp32c5.upload.tool.default=esptool_py +esp32c5.upload.tool.network=esp_ota + +esp32c5.upload.maximum_size=1310720 +esp32c5.upload.maximum_data_size=327680 +esp32c5.upload.flags= +esp32c5.upload.extra_flags= +esp32c5.upload.use_1200bps_touch=false +esp32c5.upload.wait_for_upload_port=false + +esp32c5.serial.disableDTR=false +esp32c5.serial.disableRTS=false + +esp32c5.build.tarch=riscv32 +esp32c5.build.target=esp +esp32c5.build.mcu=esp32c5 +esp32c5.build.core=esp32 +esp32c5.build.variant=esp32c5 +esp32c5.build.board=ESP32C5_DEV +esp32c5.build.bootloader_addr=0x2000 + +esp32c5.build.cdc_on_boot=0 +esp32c5.build.f_cpu=240000000L +esp32c5.build.flash_size=4MB +esp32c5.build.flash_freq=80m +esp32c5.build.flash_mode=qio +esp32c5.build.boot=qio +esp32c5.build.partitions=default +esp32c5.build.defines= + +## IDE 2.0 Seems to not update the value +esp32c5.menu.JTAGAdapter.default=Disabled +esp32c5.menu.JTAGAdapter.default.build.copy_jtag_files=0 +esp32c5.menu.JTAGAdapter.builtin=Integrated USB JTAG +esp32c5.menu.JTAGAdapter.builtin.build.openocdscript=esp32c5-builtin.cfg +esp32c5.menu.JTAGAdapter.builtin.build.copy_jtag_files=1 +esp32c5.menu.JTAGAdapter.external=FTDI Adapter +esp32c5.menu.JTAGAdapter.external.build.openocdscript=esp32c5-ftdi.cfg +esp32c5.menu.JTAGAdapter.external.build.copy_jtag_files=1 +esp32c5.menu.JTAGAdapter.bridge=ESP USB Bridge +esp32c5.menu.JTAGAdapter.bridge.build.openocdscript=esp32c5-bridge.cfg +esp32c5.menu.JTAGAdapter.bridge.build.copy_jtag_files=1 + +esp32c5.menu.PSRAM.disabled=Disabled +esp32c5.menu.PSRAM.disabled.build.defines= +esp32c5.menu.PSRAM.enabled=Enabled +esp32c5.menu.PSRAM.enabled.build.defines=-DBOARD_HAS_PSRAM + +esp32c5.menu.CDCOnBoot.default=Disabled +esp32c5.menu.CDCOnBoot.default.build.cdc_on_boot=0 +esp32c5.menu.CDCOnBoot.cdc=Enabled +esp32c5.menu.CDCOnBoot.cdc.build.cdc_on_boot=1 + +esp32c5.menu.PartitionScheme.default=Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS) +esp32c5.menu.PartitionScheme.default.build.partitions=default +esp32c5.menu.PartitionScheme.defaultffat=Default 4MB with ffat (1.2MB APP/1.5MB FATFS) +esp32c5.menu.PartitionScheme.defaultffat.build.partitions=default_ffat +esp32c5.menu.PartitionScheme.default_8MB=8M with spiffs (3MB APP/1.5MB SPIFFS) +esp32c5.menu.PartitionScheme.default_8MB.build.partitions=default_8MB +esp32c5.menu.PartitionScheme.default_8MB.upload.maximum_size=3342336 +esp32c5.menu.PartitionScheme.minimal=Minimal (1.3MB APP/700KB SPIFFS) +esp32c5.menu.PartitionScheme.minimal.build.partitions=minimal +esp32c5.menu.PartitionScheme.no_fs=No FS 4MB (2MB APP x2) +esp32c5.menu.PartitionScheme.no_fs.build.partitions=no_fs +esp32c5.menu.PartitionScheme.no_fs.upload.maximum_size=2031616 +esp32c5.menu.PartitionScheme.no_ota=No OTA (2MB APP/2MB SPIFFS) +esp32c5.menu.PartitionScheme.no_ota.build.partitions=no_ota +esp32c5.menu.PartitionScheme.no_ota.upload.maximum_size=2097152 +esp32c5.menu.PartitionScheme.noota_3g=No OTA (1MB APP/3MB SPIFFS) +esp32c5.menu.PartitionScheme.noota_3g.build.partitions=noota_3g +esp32c5.menu.PartitionScheme.noota_3g.upload.maximum_size=1048576 +esp32c5.menu.PartitionScheme.noota_ffat=No OTA (2MB APP/2MB FATFS) +esp32c5.menu.PartitionScheme.noota_ffat.build.partitions=noota_ffat +esp32c5.menu.PartitionScheme.noota_ffat.upload.maximum_size=2097152 +esp32c5.menu.PartitionScheme.noota_3gffat=No OTA (1MB APP/3MB FATFS) +esp32c5.menu.PartitionScheme.noota_3gffat.build.partitions=noota_3gffat +esp32c5.menu.PartitionScheme.noota_3gffat.upload.maximum_size=1048576 +esp32c5.menu.PartitionScheme.huge_app=Huge APP (3MB No OTA/1MB SPIFFS) +esp32c5.menu.PartitionScheme.huge_app.build.partitions=huge_app +esp32c5.menu.PartitionScheme.huge_app.upload.maximum_size=3145728 +esp32c5.menu.PartitionScheme.min_spiffs=Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS) +esp32c5.menu.PartitionScheme.min_spiffs.build.partitions=min_spiffs +esp32c5.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080 +esp32c5.menu.PartitionScheme.fatflash=16M Flash (2MB APP/12.5MB FATFS) +esp32c5.menu.PartitionScheme.fatflash.build.partitions=ffat +esp32c5.menu.PartitionScheme.fatflash.upload.maximum_size=2097152 +esp32c5.menu.PartitionScheme.app3M_fat9M_16MB=16M Flash (3MB APP/9.9MB FATFS) +esp32c5.menu.PartitionScheme.app3M_fat9M_16MB.build.partitions=app3M_fat9M_16MB +esp32c5.menu.PartitionScheme.app3M_fat9M_16MB.upload.maximum_size=3145728 +esp32c5.menu.PartitionScheme.rainmaker=RainMaker 4MB +esp32c5.menu.PartitionScheme.rainmaker.build.partitions=rainmaker +esp32c5.menu.PartitionScheme.rainmaker.upload.maximum_size=1966080 +esp32c5.menu.PartitionScheme.rainmaker_4MB=RainMaker 4MB No OTA +esp32c5.menu.PartitionScheme.rainmaker_4MB.build.partitions=rainmaker_4MB_no_ota +esp32c5.menu.PartitionScheme.rainmaker_4MB.upload.maximum_size=4038656 +esp32c5.menu.PartitionScheme.rainmaker_8MB=RainMaker 8MB +esp32c5.menu.PartitionScheme.rainmaker_8MB.build.partitions=rainmaker_8MB +esp32c5.menu.PartitionScheme.rainmaker_8MB.upload.maximum_size=4116480 +esp32c5.menu.PartitionScheme.zigbee_2MB=Zigbee 2MB with spiffs +esp32c5.menu.PartitionScheme.zigbee_2MB.build.partitions=zigbee_2MB +esp32c5.menu.PartitionScheme.zigbee_2MB.upload.maximum_size=1310720 +esp32c5.menu.PartitionScheme.zigbee=Zigbee 4MB with spiffs +esp32c5.menu.PartitionScheme.zigbee.build.partitions=zigbee +esp32c5.menu.PartitionScheme.zigbee.upload.maximum_size=1310720 +esp32c5.menu.PartitionScheme.zigbee_8MB=Zigbee 8MB with spiffs +esp32c5.menu.PartitionScheme.zigbee_8MB.build.partitions=zigbee_8MB +esp32c5.menu.PartitionScheme.zigbee_8MB.upload.maximum_size=3407872 +esp32c5.menu.PartitionScheme.zigbee_zczr_2MB=Zigbee ZCZR 2MB with spiffs +esp32c5.menu.PartitionScheme.zigbee_zczr_2MB.build.partitions=zigbee_zczr_2MB +esp32c5.menu.PartitionScheme.zigbee_zczr_2MB.upload.maximum_size=1310720 +esp32c5.menu.PartitionScheme.zigbee_zczr=Zigbee ZCZR 4MB with spiffs +esp32c5.menu.PartitionScheme.zigbee_zczr.build.partitions=zigbee_zczr +esp32c5.menu.PartitionScheme.zigbee_zczr.upload.maximum_size=1310720 +esp32c5.menu.PartitionScheme.zigbee_zczr_8MB=Zigbee ZCZR 8MB with spiffs +esp32c5.menu.PartitionScheme.zigbee_zczr_8MB.build.partitions=zigbee_zczr_8MB +esp32c5.menu.PartitionScheme.zigbee_zczr_8MB.upload.maximum_size=3407872 +esp32c5.menu.PartitionScheme.custom=Custom +esp32c5.menu.PartitionScheme.custom.build.partitions= +esp32c5.menu.PartitionScheme.custom.upload.maximum_size=16777216 + +esp32c5.menu.CPUFreq.240=240MHz (WiFi) +esp32c5.menu.CPUFreq.240.build.f_cpu=240000000L +esp32c5.menu.CPUFreq.120=120MHz (WiFi) +esp32c5.menu.CPUFreq.120.build.f_cpu=120000000L +esp32c5.menu.CPUFreq.80=80MHz (WiFi) +esp32c5.menu.CPUFreq.80.build.f_cpu=80000000L +esp32c5.menu.CPUFreq.40=40MHz +esp32c5.menu.CPUFreq.40.build.f_cpu=40000000L +esp32c5.menu.CPUFreq.20=20MHz +esp32c5.menu.CPUFreq.20.build.f_cpu=20000000L +esp32c5.menu.CPUFreq.10=10MHz +esp32c5.menu.CPUFreq.10.build.f_cpu=10000000L + +esp32c5.menu.FlashMode.qio=QIO +esp32c5.menu.FlashMode.qio.build.flash_mode=dio +esp32c5.menu.FlashMode.qio.build.boot=qio +esp32c5.menu.FlashMode.dio=DIO +esp32c5.menu.FlashMode.dio.build.flash_mode=dio +esp32c5.menu.FlashMode.dio.build.boot=dio + +esp32c5.menu.FlashFreq.80=80MHz +esp32c5.menu.FlashFreq.80.build.flash_freq=80m +esp32c5.menu.FlashFreq.40=40MHz +esp32c5.menu.FlashFreq.40.build.flash_freq=40m + +esp32c5.menu.FlashSize.4M=4MB (32Mb) +esp32c5.menu.FlashSize.4M.build.flash_size=4MB +esp32c5.menu.FlashSize.8M=8MB (64Mb) +esp32c5.menu.FlashSize.8M.build.flash_size=8MB +esp32c5.menu.FlashSize.2M=2MB (16Mb) +esp32c5.menu.FlashSize.2M.build.flash_size=2MB +esp32c5.menu.FlashSize.16M=16MB (128Mb) +esp32c5.menu.FlashSize.16M.build.flash_size=16MB + +esp32c5.menu.UploadSpeed.921600=921600 +esp32c5.menu.UploadSpeed.921600.upload.speed=921600 +esp32c5.menu.UploadSpeed.115200=115200 +esp32c5.menu.UploadSpeed.115200.upload.speed=115200 +esp32c5.menu.UploadSpeed.256000.windows=256000 +esp32c5.menu.UploadSpeed.256000.upload.speed=256000 +esp32c5.menu.UploadSpeed.230400.windows.upload.speed=256000 +esp32c5.menu.UploadSpeed.230400=230400 +esp32c5.menu.UploadSpeed.230400.upload.speed=230400 +esp32c5.menu.UploadSpeed.460800.linux=460800 +esp32c5.menu.UploadSpeed.460800.macosx=460800 +esp32c5.menu.UploadSpeed.460800.upload.speed=460800 +esp32c5.menu.UploadSpeed.512000.windows=512000 +esp32c5.menu.UploadSpeed.512000.upload.speed=512000 + +esp32c5.menu.DebugLevel.none=None +esp32c5.menu.DebugLevel.none.build.code_debug=0 +esp32c5.menu.DebugLevel.error=Error +esp32c5.menu.DebugLevel.error.build.code_debug=1 +esp32c5.menu.DebugLevel.warn=Warn +esp32c5.menu.DebugLevel.warn.build.code_debug=2 +esp32c5.menu.DebugLevel.info=Info +esp32c5.menu.DebugLevel.info.build.code_debug=3 +esp32c5.menu.DebugLevel.debug=Debug +esp32c5.menu.DebugLevel.debug.build.code_debug=4 +esp32c5.menu.DebugLevel.verbose=Verbose +esp32c5.menu.DebugLevel.verbose.build.code_debug=5 + +esp32c5.menu.EraseFlash.none=Disabled +esp32c5.menu.EraseFlash.none.upload.erase_cmd= +esp32c5.menu.EraseFlash.all=Enabled +esp32c5.menu.EraseFlash.all.upload.erase_cmd=-e + +esp32c5.menu.ZigbeeMode.default=Disabled +esp32c5.menu.ZigbeeMode.default.build.zigbee_mode= +esp32c5.menu.ZigbeeMode.default.build.zigbee_libs= +esp32c5.menu.ZigbeeMode.ed=Zigbee ED (end device) +esp32c5.menu.ZigbeeMode.ed.build.zigbee_mode=-DZIGBEE_MODE_ED +esp32c5.menu.ZigbeeMode.ed.build.zigbee_libs=-lesp_zb_api.ed -lzboss_stack.ed -lzboss_port.native +esp32c5.menu.ZigbeeMode.zczr=Zigbee ZCZR (coordinator/router) +esp32c5.menu.ZigbeeMode.zczr.build.zigbee_mode=-DZIGBEE_MODE_ZCZR +esp32c5.menu.ZigbeeMode.zczr.build.zigbee_libs=-lesp_zb_api.zczr -lzboss_stack.zczr -lzboss_port.native +esp32c5.menu.ZigbeeMode.ed_debug=Zigbee ED (end device) - Debug +esp32c5.menu.ZigbeeMode.ed_debug.build.zigbee_mode=-DZIGBEE_MODE_ED +esp32c5.menu.ZigbeeMode.ed_debug.build.zigbee_libs=-lesp_zb_api.ed.debug -lzboss_stack.ed.debug -lzboss_port.native.debug +esp32c5.menu.ZigbeeMode.zczr_debug=Zigbee ZCZR (coordinator/router) - Debug +esp32c5.menu.ZigbeeMode.zczr_debug.build.zigbee_mode=-DZIGBEE_MODE_ZCZR +esp32c5.menu.ZigbeeMode.zczr_debug.build.zigbee_libs=-lesp_zb_api.zczr.debug -lzboss_stack.zczr.debug -lzboss_port.native.debug + +############################################################## + esp32p4.name=ESP32P4 Dev Module esp32p4.bootloader.tool=esptool_py @@ -6007,12 +6218,12 @@ twatchs3.menu.UploadMode.cdc=USB-OTG CDC (TinyUSB) twatchs3.menu.UploadMode.cdc.upload.use_1200bps_touch=true twatchs3.menu.UploadMode.cdc.upload.wait_for_upload_port=true -twatchs3.menu.PartitionScheme.fatflash=16M Flash (2MB APP/12.5MB FATFS) -twatchs3.menu.PartitionScheme.fatflash.build.partitions=ffat -twatchs3.menu.PartitionScheme.fatflash.upload.maximum_size=2097152 twatchs3.menu.PartitionScheme.app3M_fat9M_16MB=16M Flash (3MB APP/9.9MB FATFS) twatchs3.menu.PartitionScheme.app3M_fat9M_16MB.build.partitions=app3M_fat9M_16MB twatchs3.menu.PartitionScheme.app3M_fat9M_16MB.upload.maximum_size=3145728 +twatchs3.menu.PartitionScheme.fatflash=16M Flash (2MB APP/12.5MB FATFS) +twatchs3.menu.PartitionScheme.fatflash.build.partitions=ffat +twatchs3.menu.PartitionScheme.fatflash.upload.maximum_size=2097152 twatchs3.menu.PartitionScheme.rainmaker=RainMaker twatchs3.menu.PartitionScheme.rainmaker.build.partitions=rainmaker twatchs3.menu.PartitionScheme.rainmaker.upload.maximum_size=1966080 @@ -6076,6 +6287,10 @@ twatchs3.menu.Revision.Radio_SX1280=Radio-SX1280 twatchs3.menu.Revision.Radio_SX1280.build.board=LILYGO_LORA_SX1280 twatchs3.menu.Revision.Radio_CC1101=Radio-CC1101 twatchs3.menu.Revision.Radio_CC1101.build.board=LILYGO_LORA_CC1101 +twatchs3.menu.Revision.Radio_LR1121=Radio-LR1121 +twatchs3.menu.Revision.Radio_LR1121.build.board=LILYGO_LORA_LR1121 +twatchs3.menu.Revision.Radio_SI4432=Radio-SI4432 +twatchs3.menu.Revision.Radio_SI4432.build.board=LILYGO_LORA_SI4432 ############################################################## @@ -6231,13 +6446,16 @@ twatch_ultra.menu.EraseFlash.none.upload.erase_cmd= twatch_ultra.menu.EraseFlash.all=Enabled twatch_ultra.menu.EraseFlash.all.upload.erase_cmd=-e -twatch_ultra.menu.Revision.Radio_SX1280=Radio-SX1280 -twatch_ultra.menu.Revision.Radio_SX1280.build.board=LILYGO_LORA_SX1280 twatch_ultra.menu.Revision.Radio_SX1262=Radio-SX1262 twatch_ultra.menu.Revision.Radio_SX1262.build.board=LILYGO_LORA_SX1262 +twatch_ultra.menu.Revision.Radio_SX1280=Radio-SX1280 +twatch_ultra.menu.Revision.Radio_SX1280.build.board=LILYGO_LORA_SX1280 twatch_ultra.menu.Revision.Radio_CC1101=Radio-CC1101 twatch_ultra.menu.Revision.Radio_CC1101.build.board=LILYGO_LORA_CC1101 - +twatch_ultra.menu.Revision.Radio_LR1121=Radio-LR1121 +twatch_ultra.menu.Revision.Radio_LR1121.build.board=LILYGO_LORA_LR1121 +twatch_ultra.menu.Revision.Radio_SI4432=Radio-SI4432 +twatch_ultra.menu.Revision.Radio_SI4432.build.board=LILYGO_LORA_SI4432 ############################################################## @@ -6393,12 +6611,16 @@ tlora_pager.menu.EraseFlash.all=Enabled tlora_pager.menu.EraseFlash.all.upload.erase_cmd=-e -tlora_pager.menu.Revision.Radio_SX1280=Radio-SX1280 -tlora_pager.menu.Revision.Radio_SX1280.build.board=LILYGO_LORA_SX1280 tlora_pager.menu.Revision.Radio_SX1262=Radio-SX1262 tlora_pager.menu.Revision.Radio_SX1262.build.board=LILYGO_LORA_SX1262 +tlora_pager.menu.Revision.Radio_SX1280=Radio-SX1280 +tlora_pager.menu.Revision.Radio_SX1280.build.board=LILYGO_LORA_SX1280 tlora_pager.menu.Revision.Radio_CC1101=Radio-CC1101 tlora_pager.menu.Revision.Radio_CC1101.build.board=LILYGO_LORA_CC1101 +tlora_pager.menu.Revision.Radio_LR1121=Radio-LR1121 +tlora_pager.menu.Revision.Radio_LR1121.build.board=LILYGO_LORA_LR1121 +tlora_pager.menu.Revision.Radio_SI4432=Radio-SI4432 +tlora_pager.menu.Revision.Radio_SI4432.build.board=LILYGO_LORA_SI4432 ############################################################## @@ -43266,20 +43488,22 @@ alfredo-nou3.menu.EraseFlash.all=Enabled alfredo-nou3.menu.EraseFlash.all.upload.erase_cmd=-e ############################################################## -codecell.name=CodeCell -codecell.vid.0=0x303a -codecell.pid.0=0x1002 -codecell.upload_port.0.vid=0x303a -codecell.upload_port.0.pid=0x1002 +codecell.name=CodeCell C3 codecell.bootloader.tool=esptool_py +codecell.bootloader.tool.default=esptool_py + codecell.upload.tool=esptool_py -codecell.upload.maximum_size=4194304 +codecell.upload.tool.default=esptool_py +codecell.upload.tool.network=esp_ota + +codecell.upload.maximum_size=1310720 codecell.upload.maximum_data_size=327680 +codecell.upload.flags= +codecell.upload.extra_flags= codecell.upload.use_1200bps_touch=false codecell.upload.wait_for_upload_port=false -codecell.upload.speed=921600 codecell.serial.disableDTR=false codecell.serial.disableRTS=false @@ -43288,8 +43512,9 @@ codecell.build.target=esp codecell.build.mcu=esp32c3 codecell.build.core=esp32 codecell.build.variant=codecell -codecell.build.board=ESP32C3_DEV +codecell.build.board=CODECELLC3 codecell.build.bootloader_addr=0x0 + codecell.build.cdc_on_boot=1 codecell.build.f_cpu=160000000L codecell.build.flash_size=4MB @@ -43297,13 +43522,118 @@ codecell.build.flash_freq=80m codecell.build.flash_mode=qio codecell.build.boot=qio codecell.build.partitions=default +codecell.build.defines= + + +codecell.menu.JTAGAdapter.default=Disabled +codecell.menu.JTAGAdapter.default.build.copy_jtag_files=0 +codecell.menu.JTAGAdapter.builtin=Integrated USB JTAG +codecell.menu.JTAGAdapter.builtin.build.openocdscript=esp32c3-builtin.cfg +codecell.menu.JTAGAdapter.builtin.build.copy_jtag_files=1 +codecell.menu.JTAGAdapter.external=FTDI Adapter +codecell.menu.JTAGAdapter.external.build.openocdscript=esp32c3-ftdi.cfg +codecell.menu.JTAGAdapter.external.build.copy_jtag_files=1 +codecell.menu.JTAGAdapter.bridge=ESP USB Bridge +codecell.menu.JTAGAdapter.bridge.build.openocdscript=esp32c3-bridge.cfg +codecell.menu.JTAGAdapter.bridge.build.copy_jtag_files=1 + +codecell.menu.CDCOnBoot.default=Enabled +codecell.menu.CDCOnBoot.default.build.cdc_on_boot=0 +codecell.menu.CDCOnBoot.cdc=Enabled +codecell.menu.CDCOnBoot.cdc.build.cdc_on_boot=1 codecell.menu.PartitionScheme.default=Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS) -codecell.menu.CPUFreq.160=160MHz +codecell.menu.PartitionScheme.default.build.partitions=default +codecell.menu.PartitionScheme.defaultffat=Default 4MB with ffat (1.2MB APP/1.5MB FATFS) +codecell.menu.PartitionScheme.defaultffat.build.partitions=default_ffat +codecell.menu.PartitionScheme.minimal=Minimal (1.3MB APP/700KB SPIFFS) +codecell.menu.PartitionScheme.minimal.build.partitions=minimal +codecell.menu.PartitionScheme.no_fs=No FS 4MB (2MB APP x2) +codecell.menu.PartitionScheme.no_fs.build.partitions=no_fs +codecell.menu.PartitionScheme.no_fs.upload.maximum_size=2031616 +codecell.menu.PartitionScheme.no_ota=No OTA (2MB APP/2MB SPIFFS) +codecell.menu.PartitionScheme.no_ota.build.partitions=no_ota +codecell.menu.PartitionScheme.no_ota.upload.maximum_size=2097152 +codecell.menu.PartitionScheme.noota_3g=No OTA (1MB APP/3MB SPIFFS) +codecell.menu.PartitionScheme.noota_3g.build.partitions=noota_3g +codecell.menu.PartitionScheme.noota_3g.upload.maximum_size=1048576 +codecell.menu.PartitionScheme.noota_ffat=No OTA (2MB APP/2MB FATFS) +codecell.menu.PartitionScheme.noota_ffat.build.partitions=noota_ffat +codecell.menu.PartitionScheme.noota_ffat.upload.maximum_size=2097152 +codecell.menu.PartitionScheme.noota_3gffat=No OTA (1MB APP/3MB FATFS) +codecell.menu.PartitionScheme.noota_3gffat.build.partitions=noota_3gffat +codecell.menu.PartitionScheme.noota_3gffat.upload.maximum_size=1048576 +codecell.menu.PartitionScheme.huge_app=Huge APP (3MB No OTA/1MB SPIFFS) +codecell.menu.PartitionScheme.huge_app.build.partitions=huge_app +codecell.menu.PartitionScheme.huge_app.upload.maximum_size=3145728 +codecell.menu.PartitionScheme.min_spiffs=Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS) +codecell.menu.PartitionScheme.min_spiffs.build.partitions=min_spiffs +codecell.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080 +codecell.menu.PartitionScheme.fatflash=16M Flash (2MB APP/12.5MB FATFS) +codecell.menu.PartitionScheme.fatflash.build.partitions=ffat +codecell.menu.PartitionScheme.fatflash.upload.maximum_size=2097152 +codecell.menu.PartitionScheme.app3M_fat9M_16MB=16M Flash (3MB APP/9.9MB FATFS) +codecell.menu.PartitionScheme.app3M_fat9M_16MB.build.partitions=app3M_fat9M_16MB +codecell.menu.PartitionScheme.app3M_fat9M_16MB.upload.maximum_size=3145728 +codecell.menu.PartitionScheme.rainmaker=RainMaker 4MB +codecell.menu.PartitionScheme.rainmaker.build.partitions=rainmaker +codecell.menu.PartitionScheme.rainmaker.upload.maximum_size=1966080 +codecell.menu.PartitionScheme.rainmaker_4MB=RainMaker 4MB No OTA +codecell.menu.PartitionScheme.rainmaker_4MB.build.partitions=rainmaker_4MB_no_ota +codecell.menu.PartitionScheme.rainmaker_4MB.upload.maximum_size=4038656 +codecell.menu.PartitionScheme.rainmaker_8MB=RainMaker 8MB +codecell.menu.PartitionScheme.rainmaker_8MB.build.partitions=rainmaker_8MB +codecell.menu.PartitionScheme.rainmaker_8MB.upload.maximum_size=4116480 +codecell.menu.PartitionScheme.zigbee_zczr=Zigbee ZCZR 4MB with spiffs +codecell.menu.PartitionScheme.zigbee_zczr.build.partitions=zigbee_zczr +codecell.menu.PartitionScheme.zigbee_zczr.upload.maximum_size=1310720 +codecell.menu.PartitionScheme.zigbee_zczr_8MB=Zigbee ZCZR 8MB with spiffs +codecell.menu.PartitionScheme.zigbee_zczr_8MB.build.partitions=zigbee_zczr_8MB +codecell.menu.PartitionScheme.zigbee_zczr_8MB.upload.maximum_size=3407872 +codecell.menu.PartitionScheme.custom=Custom +codecell.menu.PartitionScheme.custom.build.partitions= +codecell.menu.PartitionScheme.custom.upload.maximum_size=16777216 + +codecell.menu.CPUFreq.160=160MHz (WiFi) +codecell.menu.CPUFreq.160.build.f_cpu=160000000L +codecell.menu.CPUFreq.80=80MHz (WiFi) +codecell.menu.CPUFreq.80.build.f_cpu=80000000L +codecell.menu.CPUFreq.40=40MHz +codecell.menu.CPUFreq.40.build.f_cpu=40000000L +codecell.menu.CPUFreq.20=20MHz +codecell.menu.CPUFreq.20.build.f_cpu=20000000L +codecell.menu.CPUFreq.10=10MHz +codecell.menu.CPUFreq.10.build.f_cpu=10000000L + codecell.menu.FlashMode.qio=QIO +codecell.menu.FlashMode.qio.build.flash_mode=dio +codecell.menu.FlashMode.qio.build.boot=qio +codecell.menu.FlashMode.dio=DIO +codecell.menu.FlashMode.dio.build.flash_mode=dio +codecell.menu.FlashMode.dio.build.boot=dio + codecell.menu.FlashFreq.80=80MHz +codecell.menu.FlashFreq.80.build.flash_freq=80m +codecell.menu.FlashFreq.40=40MHz +codecell.menu.FlashFreq.40.build.flash_freq=40m + codecell.menu.FlashSize.4M=4MB (32Mb) +codecell.menu.FlashSize.4M.build.flash_size=4MB + codecell.menu.UploadSpeed.921600=921600 +codecell.menu.UploadSpeed.921600.upload.speed=921600 +codecell.menu.UploadSpeed.115200=115200 +codecell.menu.UploadSpeed.115200.upload.speed=115200 +codecell.menu.UploadSpeed.256000.windows=256000 +codecell.menu.UploadSpeed.256000.upload.speed=256000 +codecell.menu.UploadSpeed.230400.windows.upload.speed=256000 +codecell.menu.UploadSpeed.230400=230400 +codecell.menu.UploadSpeed.230400.upload.speed=230400 +codecell.menu.UploadSpeed.460800.linux=460800 +codecell.menu.UploadSpeed.460800.macosx=460800 +codecell.menu.UploadSpeed.460800.upload.speed=460800 +codecell.menu.UploadSpeed.512000.windows=512000 +codecell.menu.UploadSpeed.512000.upload.speed=512000 codecell.menu.DebugLevel.none=None codecell.menu.DebugLevel.none.build.code_debug=0 @@ -43323,6 +43653,12 @@ codecell.menu.EraseFlash.none.upload.erase_cmd= codecell.menu.EraseFlash.all=Enabled codecell.menu.EraseFlash.all.upload.erase_cmd=-e +codecell.menu.ZigbeeMode.default=Disabled +codecell.menu.ZigbeeMode.default.build.zigbee_mode= +codecell.menu.ZigbeeMode.default.build.zigbee_libs= +codecell.menu.ZigbeeMode.zczr=Zigbee ZCZR (coordinator/router) +codecell.menu.ZigbeeMode.zczr.build.zigbee_mode=-DZIGBEE_MODE_ZCZR +codecell.menu.ZigbeeMode.zczr.build.zigbee_libs=-lesp_zb_api.zczr -lzboss_stack.zczr -lzboss_port.remote ############################################################## jczn_2432s028r.name=ESP32-2432S028R CYD diff --git a/cores/esp32/Arduino.h b/cores/esp32/Arduino.h index d21089cc3fe..9048249a873 100644 --- a/cores/esp32/Arduino.h +++ b/cores/esp32/Arduino.h @@ -41,7 +41,6 @@ #include "extra_attr.h" #include "pins_arduino.h" -#include "io_pin_remap.h" #include "esp32-hal.h" #define PI 3.1415926535897932384626433832795 @@ -251,4 +250,8 @@ void tone(uint8_t _pin, unsigned int frequency, unsigned long duration = 0); void noTone(uint8_t _pin); #endif /* __cplusplus */ + +// must be applied last as it overrides some of the above +#include "io_pin_remap.h" + #endif /* _ESP32_CORE_ARDUINO_H_ */ diff --git a/cores/esp32/Esp.cpp b/cores/esp32/Esp.cpp index 9f90a828b25..f911b2d5f20 100644 --- a/cores/esp32/Esp.cpp +++ b/cores/esp32/Esp.cpp @@ -21,6 +21,7 @@ #include "Esp.h" #include "esp_sleep.h" #include "spi_flash_mmap.h" +#include "esp_idf_version.h" #include #include #include @@ -63,6 +64,9 @@ extern "C" { #elif CONFIG_IDF_TARGET_ESP32P4 #include "esp32p4/rom/spi_flash.h" #define ESP_FLASH_IMAGE_BASE 0x2000 // Esp32p4 is located at 0x2000 +#elif CONFIG_IDF_TARGET_ESP32C5 +#include "esp32c5/rom/spi_flash.h" +#define ESP_FLASH_IMAGE_BASE 0x2000 // Esp32c5 is located at 0x2000 #else #error Target CONFIG_IDF_TARGET is not supported #endif @@ -301,7 +305,12 @@ const char *EspClass::getChipModel(void) { case CHIP_ESP32C6: return "ESP32-C6"; case CHIP_ESP32H2: return "ESP32-H2"; case CHIP_ESP32P4: return "ESP32-P4"; - default: return "UNKNOWN"; +#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 5, 0) + case CHIP_ESP32C5: return "ESP32-C5"; + case CHIP_ESP32C61: return "ESP32-C61"; + case CHIP_ESP32H21: return "ESP32-H21"; +#endif + default: return "UNKNOWN"; } #endif } diff --git a/cores/esp32/HWCDC.cpp b/cores/esp32/HWCDC.cpp index 170e323a035..062317d9f53 100644 --- a/cores/esp32/HWCDC.cpp +++ b/cores/esp32/HWCDC.cpp @@ -603,6 +603,7 @@ void HWCDC::setDebugOutput(bool en) { } else { ets_install_putc2(NULL); } + ets_install_putc1(NULL); // closes UART log output } #if ARDUINO_USB_MODE && ARDUINO_USB_CDC_ON_BOOT // Hardware JTAG CDC selected diff --git a/cores/esp32/HardwareSerial.cpp b/cores/esp32/HardwareSerial.cpp index 76135691411..6d762da21fb 100644 --- a/cores/esp32/HardwareSerial.cpp +++ b/cores/esp32/HardwareSerial.cpp @@ -607,6 +607,24 @@ bool HardwareSerial::setMode(SerialMode mode) { return uartSetMode(_uart, mode); } +// Sets the UART Clock Source based on the compatible SoC options +// This method must be called before starting UART using begin(), otherwise it won't have any effect. +// Clock Source Options are: +// UART_CLK_SRC_DEFAULT :: any SoC - it will set whatever IDF defines as the default UART Clock Source +// UART_CLK_SRC_APB :: ESP32, ESP32-S2, ESP32-C3 and ESP32-S3 +// UART_CLK_SRC_PLL :: ESP32-C2, ESP32-C5, ESP32-C6, ESP32-C61, ESP32-H2 and ESP32-P4 +// UART_CLK_SRC_XTAL :: ESP32-C2, ESP32-C3, ESP32-C5, ESP32-C6, ESP32-C61, ESP32-H2, ESP32-S3 and ESP32-P4 +// UART_CLK_SRC_RTC :: ESP32-C2, ESP32-C3, ESP32-C5, ESP32-C6, ESP32-C61, ESP32-H2, ESP32-S3 and ESP32-P4 +// UART_CLK_SRC_REF_TICK :: ESP32 and ESP32-S2 +// Note: CLK_SRC_PLL Freq depends on the SoC - ESP32-C2 has 40MHz, ESP32-H2 has 48MHz and ESP32-C5, C6, C61 and P4 has 80MHz +// Note: ESP32-C6, C61, ESP32-P4 and ESP32-C5 have LP UART that will use only RTC_FAST or XTAL/2 as Clock Source +bool HardwareSerial::setClockSource(SerialClkSrc clkSrc) { + if (_uart) { + log_e("No Clock Source change was done. This function must be called before beginning UART%d.", _uart_nr); + return false; + } + return uartSetClockSource(_uart_nr, (uart_sclk_t)clkSrc); +} // minimum total RX Buffer size is the UART FIFO space (128 bytes for most SoC) + 1. IDF imposition. // LP UART has FIFO of 16 bytes size_t HardwareSerial::setRxBufferSize(size_t new_size) { diff --git a/cores/esp32/HardwareSerial.h b/cores/esp32/HardwareSerial.h index b1f6df17724..bd24e0eec0e 100644 --- a/cores/esp32/HardwareSerial.h +++ b/cores/esp32/HardwareSerial.h @@ -96,6 +96,29 @@ typedef enum { UART_PARITY_ERROR } hardwareSerial_error_t; +typedef enum { + UART_CLK_SRC_DEFAULT = UART_SCLK_DEFAULT, +#if SOC_UART_SUPPORT_APB_CLK + UART_CLK_SRC_APB = UART_SCLK_APB, +#endif +#if SOC_UART_SUPPORT_PLL_F40M_CLK + UART_CLK_SRC_PLL = UART_SCLK_PLL_F40M, +#elif SOC_UART_SUPPORT_PLL_F80M_CLK + UART_CLK_SRC_PLL = UART_SCLK_PLL_F80M, +#elif CONFIG_IDF_TARGET_ESP32H2 + UART_CLK_SRC_PLL = UART_SCLK_PLL_F48M, +#endif +#if SOC_UART_SUPPORT_XTAL_CLK + UART_CLK_SRC_XTAL = UART_SCLK_XTAL, +#endif +#if SOC_UART_SUPPORT_RTC_CLK + UART_CLK_SRC_RTC = UART_SCLK_RTC, +#endif +#if SOC_UART_SUPPORT_REF_TICK + UART_CLK_SRC_REF_TICK = UART_SCLK_REF_TICK, +#endif +} SerialClkSrc; + #ifndef ARDUINO_SERIAL_EVENT_TASK_STACK_SIZE #ifndef CONFIG_ARDUINO_SERIAL_EVENT_TASK_STACK_SIZE #define ARDUINO_SERIAL_EVENT_TASK_STACK_SIZE 2048 @@ -139,6 +162,8 @@ typedef enum { #define SOC_RX0 (gpio_num_t)23 #elif CONFIG_IDF_TARGET_ESP32P4 #define SOC_RX0 (gpio_num_t)38 +#elif CONFIG_IDF_TARGET_ESP32C5 +#define SOC_RX0 (gpio_num_t)12 #endif #endif @@ -157,6 +182,8 @@ typedef enum { #define SOC_TX0 (gpio_num_t)24 #elif CONFIG_IDF_TARGET_ESP32P4 #define SOC_TX0 (gpio_num_t)37 +#elif CONFIG_IDF_TARGET_ESP32C5 +#define SOC_TX0 (gpio_num_t)11 #endif #endif @@ -180,6 +207,8 @@ typedef enum { #define RX1 (gpio_num_t)0 #elif CONFIG_IDF_TARGET_ESP32P4 #define RX1 (gpio_num_t)11 +#elif CONFIG_IDF_TARGET_ESP32C5 +#define RX1 (gpio_num_t)4 #endif #endif @@ -200,6 +229,8 @@ typedef enum { #define TX1 (gpio_num_t)1 #elif CONFIG_IDF_TARGET_ESP32P4 #define TX1 (gpio_num_t)10 +#elif CONFIG_IDF_TARGET_ESP32C5 +#define TX1 (gpio_num_t)5 #endif #endif #endif /* SOC_UART_HP_NUM > 1 */ @@ -344,6 +375,17 @@ class HardwareSerial : public Stream { // UART_MODE_RS485_COLLISION_DETECT = 0x03 mode: RS485 collision detection UART mode (used for test purposes) // UART_MODE_RS485_APP_CTRL = 0x04 mode: application control RS485 UART mode (used for test purposes) bool setMode(SerialMode mode); + // Used to set the UART clock source mode. It must be set before calling begin(), otherwise it won't have any effect. + // Not all clock source are available to every SoC. The compatible option are listed here: + // UART_CLK_SRC_DEFAULT :: any SoC - it will set whatever IDF defines as the default UART Clock Source + // UART_CLK_SRC_APB :: ESP32, ESP32-S2, ESP32-C3 and ESP32-S3 + // UART_CLK_SRC_PLL :: ESP32-C2, ESP32-C5, ESP32-C6, ESP32-C61, ESP32-H2 and ESP32-P4 + // UART_CLK_SRC_XTAL :: ESP32-C2, ESP32-C3, ESP32-C5, ESP32-C6, ESP32-C61, ESP32-H2, ESP32-S3 and ESP32-P4 + // UART_CLK_SRC_RTC :: ESP32-C2, ESP32-C3, ESP32-C5, ESP32-C6, ESP32-C61, ESP32-H2, ESP32-S3 and ESP32-P4 + // UART_CLK_SRC_REF_TICK :: ESP32 and ESP32-S2 + // Note: CLK_SRC_PLL Freq depends on the SoC - ESP32-C2 has 40MHz, ESP32-H2 has 48MHz and ESP32-C5, C6, C61 and P4 has 80MHz + // Note: ESP32-C6, C61, ESP32-P4 and ESP32-C5 have LP UART that will use only RTC_FAST or XTAL/2 as Clock Source + bool setClockSource(SerialClkSrc clkSrc); size_t setRxBufferSize(size_t new_size); size_t setTxBufferSize(size_t new_size); diff --git a/cores/esp32/USB.cpp b/cores/esp32/USB.cpp index 8fdd7a3ab71..269e9a76cb3 100644 --- a/cores/esp32/USB.cpp +++ b/cores/esp32/USB.cpp @@ -100,6 +100,7 @@ static bool tinyusb_device_suspended = false; void tud_mount_cb(void) { tinyusb_device_mounted = true; arduino_usb_event_data_t p; + p.suspend.remote_wakeup_en = 0; arduino_usb_event_post(ARDUINO_USB_EVENTS, ARDUINO_USB_STARTED_EVENT, &p, sizeof(arduino_usb_event_data_t), portMAX_DELAY); } @@ -107,6 +108,7 @@ void tud_mount_cb(void) { void tud_umount_cb(void) { tinyusb_device_mounted = false; arduino_usb_event_data_t p; + p.suspend.remote_wakeup_en = 0; arduino_usb_event_post(ARDUINO_USB_EVENTS, ARDUINO_USB_STOPPED_EVENT, &p, sizeof(arduino_usb_event_data_t), portMAX_DELAY); } @@ -123,6 +125,7 @@ void tud_suspend_cb(bool remote_wakeup_en) { void tud_resume_cb(void) { tinyusb_device_suspended = false; arduino_usb_event_data_t p; + p.suspend.remote_wakeup_en = 0; arduino_usb_event_post(ARDUINO_USB_EVENTS, ARDUINO_USB_RESUME_EVENT, &p, sizeof(arduino_usb_event_data_t), portMAX_DELAY); } diff --git a/cores/esp32/USBCDC.cpp b/cores/esp32/USBCDC.cpp index 945021a79e2..c7bb4582d4f 100644 --- a/cores/esp32/USBCDC.cpp +++ b/cores/esp32/USBCDC.cpp @@ -455,6 +455,7 @@ void USBCDC::setDebugOutput(bool en) { } else { ets_install_putc2(NULL); } + ets_install_putc1(NULL); // closes UART log output } USBCDC::operator bool() const { diff --git a/cores/esp32/chip-debug-report.cpp b/cores/esp32/chip-debug-report.cpp index daafef3cab9..281c7bdb62d 100644 --- a/cores/esp32/chip-debug-report.cpp +++ b/cores/esp32/chip-debug-report.cpp @@ -67,6 +67,9 @@ static void printPkgVersion(void) { #elif CONFIG_IDF_TARGET_ESP32P4 uint32_t pkg_ver = REG_GET_FIELD(EFUSE_RD_MAC_SYS_2_REG, EFUSE_PKG_VERSION); chip_report_printf("%lu", pkg_ver); +#elif CONFIG_IDF_TARGET_ESP32C5 + uint32_t pkg_ver = REG_GET_FIELD(EFUSE_RD_MAC_SYS2_REG, EFUSE_PKG_VERSION); + chip_report_printf("%lu", pkg_ver); #else chip_report_printf("Unknown"); #endif @@ -88,6 +91,11 @@ static void printChipInfo(void) { case CHIP_ESP32C6: chip_report_printf("ESP32-C6\n"); break; case CHIP_ESP32H2: chip_report_printf("ESP32-H2\n"); break; case CHIP_ESP32P4: chip_report_printf("ESP32-P4\n"); break; +#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 5, 0) + case CHIP_ESP32C5: chip_report_printf("ESP32-C5\n"); break; + case CHIP_ESP32C61: chip_report_printf("ESP32-C61\n"); break; + case CHIP_ESP32H21: chip_report_printf("ESP32-H21\n"); break; +#endif default: chip_report_printf("Unknown %d\n", info.model); break; } printPkgVersion(); diff --git a/cores/esp32/esp32-hal-bt.c b/cores/esp32/esp32-hal-bt.c index 5f1148bd492..1e5f73e324c 100644 --- a/cores/esp32/esp32-hal-bt.c +++ b/cores/esp32/esp32-hal-bt.c @@ -15,7 +15,7 @@ #include "esp32-hal-bt.h" #if SOC_BT_SUPPORTED -#ifdef CONFIG_BT_ENABLED +#ifdef CONFIG_BT_BLUEDROID_ENABLED #if CONFIG_IDF_TARGET_ESP32 bool btInUse() { diff --git a/cores/esp32/esp32-hal-cpu.c b/cores/esp32/esp32-hal-cpu.c index 1ffde860792..30c7e3a2b0a 100644 --- a/cores/esp32/esp32-hal-cpu.c +++ b/cores/esp32/esp32-hal-cpu.c @@ -19,7 +19,7 @@ #include "esp_attr.h" #include "esp_log.h" #include "soc/rtc.h" -#if !defined(CONFIG_IDF_TARGET_ESP32C2) && !defined(CONFIG_IDF_TARGET_ESP32C6) && !defined(CONFIG_IDF_TARGET_ESP32H2) && !defined(CONFIG_IDF_TARGET_ESP32P4) +#if !defined(CONFIG_IDF_TARGET_ESP32C2) && !defined(CONFIG_IDF_TARGET_ESP32C6) && !defined(CONFIG_IDF_TARGET_ESP32H2) && !defined(CONFIG_IDF_TARGET_ESP32P4) && !defined(CONFIG_IDF_TARGET_ESP32C5) #include "soc/rtc_cntl_reg.h" #include "soc/syscon_reg.h" #endif @@ -48,6 +48,8 @@ #include "esp32h2/rom/rtc.h" #elif CONFIG_IDF_TARGET_ESP32P4 #include "esp32p4/rom/rtc.h" +#elif CONFIG_IDF_TARGET_ESP32C5 +#include "esp32c5/rom/rtc.h" #else #error Target CONFIG_IDF_TARGET is not supported #endif @@ -179,7 +181,7 @@ bool setCpuFrequencyMhz(uint32_t cpu_freq_mhz) { rtc_cpu_freq_config_t conf, cconf; uint32_t capb, apb; //Get XTAL Frequency and calculate min CPU MHz -#if (!defined(CONFIG_IDF_TARGET_ESP32H2) && !defined(CONFIG_IDF_TARGET_ESP32P4)) +#if (!defined(CONFIG_IDF_TARGET_ESP32H2) && !defined(CONFIG_IDF_TARGET_ESP32P4) && !defined(CONFIG_IDF_TARGET_ESP32C5)) rtc_xtal_freq_t xtal = rtc_clk_xtal_freq_get(); #endif #if CONFIG_IDF_TARGET_ESP32 @@ -195,7 +197,7 @@ bool setCpuFrequencyMhz(uint32_t cpu_freq_mhz) { } } #endif -#if (!defined(CONFIG_IDF_TARGET_ESP32H2) && !defined(CONFIG_IDF_TARGET_ESP32P4)) +#if (!defined(CONFIG_IDF_TARGET_ESP32H2) && !defined(CONFIG_IDF_TARGET_ESP32P4) && !defined(CONFIG_IDF_TARGET_ESP32C5)) if (cpu_freq_mhz > xtal && cpu_freq_mhz != 240 && cpu_freq_mhz != 160 && cpu_freq_mhz != 120 && cpu_freq_mhz != 80) { if (xtal >= RTC_XTAL_FREQ_40M) { log_e("Bad frequency: %u MHz! Options are: 240, 160, 120, 80, %u, %u and %u MHz", cpu_freq_mhz, xtal, xtal / 2, xtal / 4); @@ -265,6 +267,12 @@ bool setCpuFrequencyMhz(uint32_t cpu_freq_mhz) { (conf.source == SOC_CPU_CLK_SRC_PLL) ? "PLL" : ((conf.source == SOC_CPU_CLK_SRC_APLL) ? "APLL" : ((conf.source == SOC_CPU_CLK_SRC_XTAL) ? "XTAL" : "8M")), conf.source_freq_mhz, conf.div, conf.freq_mhz, apb ); +#elif defined(CONFIG_IDF_TARGET_ESP32C5) + log_d( + "%s: %u / %u = %u Mhz, APB: %u Hz", + (conf.source == SOC_CPU_CLK_SRC_PLL_F240M || conf.source == SOC_CPU_CLK_SRC_PLL_F160M) ? "PLL" : ((conf.source == SOC_CPU_CLK_SRC_XTAL) ? "XTAL" : "8M"), + conf.source_freq_mhz, conf.div, conf.freq_mhz, apb + ); #else log_d( "%s: %u / %u = %u Mhz, APB: %u Hz", (conf.source == SOC_CPU_CLK_SRC_PLL) ? "PLL" : ((conf.source == SOC_CPU_CLK_SRC_XTAL) ? "XTAL" : "17.5M"), diff --git a/cores/esp32/esp32-hal-gpio.c b/cores/esp32/esp32-hal-gpio.c index c681be077b3..90ad1e7f36d 100644 --- a/cores/esp32/esp32-hal-gpio.c +++ b/cores/esp32/esp32-hal-gpio.c @@ -185,7 +185,7 @@ extern int ARDUINO_ISR_ATTR __digitalRead(uint8_t pin) { #endif // RGB_BUILTIN // This work when the pin is set as GPIO and in INPUT mode. For all other pin functions, it may return inconsistent response if (perimanGetPinBus(pin, ESP32_BUS_TYPE_GPIO) == NULL) { - log_w("IO %i is not set as GPIO. digitalRead() may return an inconsistent value."); + log_w("IO %i is not set as GPIO. digitalRead() may return an inconsistent value.", pin); } return gpio_get_level((gpio_num_t)pin); } diff --git a/cores/esp32/esp32-hal-i2c-slave.c b/cores/esp32/esp32-hal-i2c-slave.c index 46c3a4d58c2..0e01259da61 100644 --- a/cores/esp32/esp32-hal-i2c-slave.c +++ b/cores/esp32/esp32-hal-i2c-slave.c @@ -43,7 +43,9 @@ #include "soc/i2c_struct.h" #include "soc/periph_defs.h" #include "hal/i2c_ll.h" +#ifndef CONFIG_IDF_TARGET_ESP32C5 #include "hal/clk_gate_ll.h" +#endif #include "esp32-hal-log.h" #include "esp32-hal-i2c-slave.h" #include "esp32-hal-periman.h" @@ -325,7 +327,7 @@ esp_err_t i2cSlaveInit(uint8_t num, int sda, int scl, uint16_t slaveID, uint32_t frequency = 100000L; } frequency = (frequency * 5) / 4; -#if !defined(CONFIG_IDF_TARGET_ESP32P4) +#if !defined(CONFIG_IDF_TARGET_ESP32P4) && !defined(CONFIG_IDF_TARGET_ESP32C5) if (i2c->num == 0) { periph_ll_enable_clk_clear_rst(PERIPH_I2C0_MODULE); #if SOC_HP_I2C_NUM > 1 @@ -556,6 +558,9 @@ static bool i2c_slave_set_frequency(i2c_slave_struct_t *i2c, uint32_t clk_speed) i2c_ll_set_source_clk(i2c->dev, SOC_MOD_CLK_APB); /*!< I2C source clock from APB, 80M*/ } #elif SOC_I2C_SUPPORT_XTAL +#ifndef XTAL_CLK_FREQ +#define XTAL_CLK_FREQ APB_CLK_FREQ +#endif i2c_ll_master_cal_bus_clk(XTAL_CLK_FREQ, clk_speed, &clk_cal); I2C_CLOCK_SRC_ATOMIC() { i2c_ll_set_source_clk(i2c->dev, SOC_MOD_CLK_XTAL); /*!< I2C source clock from XTAL, 40M */ diff --git a/cores/esp32/esp32-hal-ledc.c b/cores/esp32/esp32-hal-ledc.c index 0a3ec5a60c7..039fa1312f1 100644 --- a/cores/esp32/esp32-hal-ledc.c +++ b/cores/esp32/esp32-hal-ledc.c @@ -126,7 +126,14 @@ bool ledcAttachChannel(uint8_t pin, uint32_t freq, uint8_t resolution, uint8_t c return false; } } else { - ledc_timer_config_t ledc_timer = {.speed_mode = group, .timer_num = timer, .duty_resolution = resolution, .freq_hz = freq, .clk_cfg = clock_source}; + ledc_timer_config_t ledc_timer; + memset((void *)&ledc_timer, 0, sizeof(ledc_timer_config_t)); + ledc_timer.speed_mode = group; + ledc_timer.timer_num = timer; + ledc_timer.duty_resolution = resolution; + ledc_timer.freq_hz = freq; + ledc_timer.clk_cfg = clock_source; + if (ledc_timer_config(&ledc_timer) != ESP_OK) { log_e("ledc setup failed!"); return false; @@ -134,9 +141,16 @@ bool ledcAttachChannel(uint8_t pin, uint32_t freq, uint8_t resolution, uint8_t c uint32_t duty = ledc_get_duty(group, (channel % 8)); - ledc_channel_config_t ledc_channel = { - .speed_mode = group, .channel = (channel % 8), .timer_sel = timer, .intr_type = LEDC_INTR_DISABLE, .gpio_num = pin, .duty = duty, .hpoint = 0 - }; + ledc_channel_config_t ledc_channel; + memset((void *)&ledc_channel, 0, sizeof(ledc_channel_config_t)); + ledc_channel.speed_mode = group; + ledc_channel.channel = (channel % 8); + ledc_channel.timer_sel = timer; + ledc_channel.intr_type = LEDC_INTR_DISABLE; + ledc_channel.gpio_num = pin; + ledc_channel.duty = duty; + ledc_channel.hpoint = 0; + ledc_channel_config(&ledc_channel); } @@ -256,7 +270,13 @@ uint32_t ledcWriteTone(uint8_t pin, uint32_t freq) { uint8_t group = (bus->channel / 8), timer = ((bus->channel / 2) % 4); - ledc_timer_config_t ledc_timer = {.speed_mode = group, .timer_num = timer, .duty_resolution = 10, .freq_hz = freq, .clk_cfg = clock_source}; + ledc_timer_config_t ledc_timer; + memset((void *)&ledc_timer, 0, sizeof(ledc_timer_config_t)); + ledc_timer.speed_mode = group; + ledc_timer.timer_num = timer; + ledc_timer.duty_resolution = 10; + ledc_timer.freq_hz = freq; + ledc_timer.clk_cfg = clock_source; if (ledc_timer_config(&ledc_timer) != ESP_OK) { log_e("ledcWriteTone configuration failed!"); @@ -307,7 +327,13 @@ uint32_t ledcChangeFrequency(uint8_t pin, uint32_t freq, uint8_t resolution) { } uint8_t group = (bus->channel / 8), timer = ((bus->channel / 2) % 4); - ledc_timer_config_t ledc_timer = {.speed_mode = group, .timer_num = timer, .duty_resolution = resolution, .freq_hz = freq, .clk_cfg = clock_source}; + ledc_timer_config_t ledc_timer; + memset((void *)&ledc_timer, 0, sizeof(ledc_timer_config_t)); + ledc_timer.speed_mode = group; + ledc_timer.timer_num = timer; + ledc_timer.duty_resolution = resolution; + ledc_timer.freq_hz = freq; + ledc_timer.clk_cfg = clock_source; if (ledc_timer_config(&ledc_timer) != ESP_OK) { log_e("ledcChangeFrequency failed!"); diff --git a/cores/esp32/esp32-hal-matrix.c b/cores/esp32/esp32-hal-matrix.c index 7cddb4e04db..0d81e979f2b 100644 --- a/cores/esp32/esp32-hal-matrix.c +++ b/cores/esp32/esp32-hal-matrix.c @@ -34,6 +34,8 @@ #include "esp32h2/rom/gpio.h" #elif CONFIG_IDF_TARGET_ESP32P4 #include "esp32p4/rom/gpio.h" +#elif CONFIG_IDF_TARGET_ESP32C5 +#include "esp32c5/rom/gpio.h" #else #error Target CONFIG_IDF_TARGET is not supported #endif diff --git a/cores/esp32/esp32-hal-misc.c b/cores/esp32/esp32-hal-misc.c index 50e2973d27a..6b46f688305 100644 --- a/cores/esp32/esp32-hal-misc.c +++ b/cores/esp32/esp32-hal-misc.c @@ -25,12 +25,12 @@ #include "esp_ota_ops.h" #endif //CONFIG_APP_ROLLBACK_ENABLE #include "esp_private/startup_internal.h" -#if defined(CONFIG_BT_ENABLED) && SOC_BT_SUPPORTED +#if defined(CONFIG_BT_BLUEDROID_ENABLED) && SOC_BT_SUPPORTED #include "esp_bt.h" -#endif //CONFIG_BT_ENABLED +#endif //CONFIG_BT_BLUEDROID_ENABLED #include #include "soc/rtc.h" -#if !defined(CONFIG_IDF_TARGET_ESP32C2) && !defined(CONFIG_IDF_TARGET_ESP32C6) && !defined(CONFIG_IDF_TARGET_ESP32H2) && !defined(CONFIG_IDF_TARGET_ESP32P4) +#if !defined(CONFIG_IDF_TARGET_ESP32C2) && !defined(CONFIG_IDF_TARGET_ESP32C6) && !defined(CONFIG_IDF_TARGET_ESP32H2) && !defined(CONFIG_IDF_TARGET_ESP32P4) && !defined(CONFIG_IDF_TARGET_ESP32C5) #include "soc/rtc_cntl_reg.h" #include "soc/syscon_reg.h" #endif @@ -56,6 +56,8 @@ #include "esp32h2/rom/rtc.h" #elif CONFIG_IDF_TARGET_ESP32P4 #include "esp32p4/rom/rtc.h" +#elif CONFIG_IDF_TARGET_ESP32C5 +#include "esp32c5/rom/rtc.h" #else #error Target CONFIG_IDF_TARGET is not supported @@ -243,7 +245,7 @@ bool verifyRollbackLater() { } #endif -#ifdef CONFIG_BT_ENABLED +#ifdef CONFIG_BT_BLUEDROID_ENABLED #if CONFIG_IDF_TARGET_ESP32 //overwritten in esp32-hal-bt.c bool btInUse() __attribute__((weak)); @@ -305,7 +307,7 @@ void initArduino() { if (err) { log_e("Failed to initialize NVS! Error: %u", err); } -#if defined(CONFIG_BT_ENABLED) && SOC_BT_SUPPORTED +#if defined(CONFIG_BT_BLUEDROID_ENABLED) && SOC_BT_SUPPORTED if (!btInUse()) { esp_bt_controller_mem_release(ESP_BT_MODE_BTDM); } diff --git a/cores/esp32/esp32-hal-psram.c b/cores/esp32/esp32-hal-psram.c index 3c7a51c3343..0d57a67ede4 100644 --- a/cores/esp32/esp32-hal-psram.c +++ b/cores/esp32/esp32-hal-psram.c @@ -29,6 +29,8 @@ #include "esp32s3/rom/cache.h" #elif CONFIG_IDF_TARGET_ESP32P4 #include "esp32p4/rom/cache.h" +#elif CONFIG_IDF_TARGET_ESP32C5 +#include "esp32c5/rom/cache.h" #else #error Target CONFIG_IDF_TARGET is not supported #endif diff --git a/cores/esp32/esp32-hal-rmt.c b/cores/esp32/esp32-hal-rmt.c index e3877b5ff48..7bca1a1b529 100644 --- a/cores/esp32/esp32-hal-rmt.c +++ b/cores/esp32/esp32-hal-rmt.c @@ -206,7 +206,8 @@ bool rmtSetCarrier(int pin, bool carrier_en, bool carrier_level, uint32_t freque log_w("GPIO %d - RMT Carrier must be a float percentage from 0 to 1. Setting to 50%.", pin); duty_percent = 0.5; } - rmt_carrier_config_t carrier_cfg = {0}; + rmt_carrier_config_t carrier_cfg; + memset((void *)&carrier_cfg, 0, sizeof(rmt_carrier_config_t)); carrier_cfg.duty_cycle = duty_percent; // duty cycle carrier_cfg.frequency_hz = carrier_en ? frequency_Hz : 0; // carrier frequency in Hz carrier_cfg.flags.polarity_active_low = carrier_level; // carrier modulation polarity level @@ -313,7 +314,8 @@ static bool _rmtWrite(int pin, rmt_data_t *data, size_t num_rmt_symbols, bool bl return false; } - rmt_transmit_config_t transmit_cfg = {0}; // loop mode disabled + rmt_transmit_config_t transmit_cfg; // loop mode disabled + memset((void *)&transmit_cfg, 0, sizeof(rmt_transmit_config_t)); bool retCode = true; RMT_MUTEX_LOCK(bus); @@ -380,6 +382,7 @@ static bool _rmtRead(int pin, rmt_data_t *data, size_t *num_rmt_symbols, bool wa // request reading RMT Channel Data rmt_receive_config_t receive_config; + memset((void *)&receive_config, 0, sizeof(rmt_receive_config_t)); receive_config.signal_range_min_ns = bus->signal_range_min_ns; receive_config.signal_range_max_ns = bus->signal_range_max_ns; @@ -530,6 +533,7 @@ bool rmtInit(int pin, rmt_ch_dir_t channel_direction, rmt_reserve_memsize_t mem_ if (channel_direction == RMT_TX_MODE) { // TX Channel rmt_tx_channel_config_t tx_cfg; + memset((void *)&tx_cfg, 0, sizeof(rmt_tx_channel_config_t)); tx_cfg.gpio_num = pin; // CLK_APB for ESP32|S2|S3|C3 -- CLK_PLL_F80M for C6 -- CLK_XTAL for H2 tx_cfg.clk_src = RMT_CLK_SRC_DEFAULT; @@ -559,6 +563,7 @@ bool rmtInit(int pin, rmt_ch_dir_t channel_direction, rmt_reserve_memsize_t mem_ } else { // RX Channel rmt_rx_channel_config_t rx_cfg; + memset((void *)&rx_cfg, 0, sizeof(rmt_rx_channel_config_t)); rx_cfg.gpio_num = pin; // CLK_APB for ESP32|S2|S3|C3 -- CLK_PLL_F80M for C6 -- CLK_XTAL for H2 rx_cfg.clk_src = RMT_CLK_SRC_DEFAULT; @@ -585,7 +590,8 @@ bool rmtInit(int pin, rmt_ch_dir_t channel_direction, rmt_reserve_memsize_t mem_ } // allocate memory for the RMT Copy encoder - rmt_copy_encoder_config_t copy_encoder_config = {}; + rmt_copy_encoder_config_t copy_encoder_config; + memset((void *)©_encoder_config, 0, sizeof(rmt_copy_encoder_config_t)); if (rmt_new_copy_encoder(©_encoder_config, &bus->rmt_copy_encoder_h) != ESP_OK) { log_e("GPIO %d - RMT Encoder Memory Allocation error.", pin); goto Err; diff --git a/cores/esp32/esp32-hal-spi.c b/cores/esp32/esp32-hal-spi.c index 80928309670..4af09019c17 100644 --- a/cores/esp32/esp32-hal-spi.c +++ b/cores/esp32/esp32-hal-spi.c @@ -26,7 +26,9 @@ #include "soc/io_mux_reg.h" #include "soc/gpio_sig_map.h" #include "soc/rtc.h" +#ifndef CONFIG_IDF_TARGET_ESP32C5 #include "hal/clk_gate_ll.h" +#endif #include "esp32-hal-periman.h" #include "esp_private/periph_ctrl.h" @@ -60,6 +62,9 @@ #elif CONFIG_IDF_TARGET_ESP32P4 #include "esp32p4/rom/ets_sys.h" #include "esp32p4/rom/gpio.h" +#elif CONFIG_IDF_TARGET_ESP32C5 +#include "esp32c5/rom/ets_sys.h" +#include "esp32c5/rom/gpio.h" #else #error Target CONFIG_IDF_TARGET is not supported #endif @@ -74,6 +79,7 @@ struct spi_struct_t { int8_t miso; int8_t mosi; int8_t ss; + bool ss_invert; }; #if CONFIG_IDF_TARGET_ESP32S2 @@ -119,7 +125,7 @@ struct spi_struct_t { #define SPI_SS_IDX(p, n) ((p == 0) ? SPI_FSPI_SS_IDX(n) : ((p == 1) ? SPI_HSPI_SS_IDX(n) : 0)) -#elif CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 +#elif CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32C5 // ESP32C3 #define SPI_COUNT (1) @@ -151,23 +157,23 @@ struct spi_struct_t { // clang-format off static spi_t _spi_bus_array[] = { #if CONFIG_IDF_TARGET_ESP32S2 - {(volatile spi_dev_t *)(DR_REG_SPI1_BASE), 0, -1, -1, -1, -1}, - {(volatile spi_dev_t *)(DR_REG_SPI2_BASE), 1, -1, -1, -1, -1}, - {(volatile spi_dev_t *)(DR_REG_SPI3_BASE), 2, -1, -1, -1, -1} + {(volatile spi_dev_t *)(DR_REG_SPI1_BASE), 0, -1, -1, -1, -1, false}, + {(volatile spi_dev_t *)(DR_REG_SPI2_BASE), 1, -1, -1, -1, -1, false}, + {(volatile spi_dev_t *)(DR_REG_SPI3_BASE), 2, -1, -1, -1, -1, false} #elif CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32P4 - {(volatile spi_dev_t *)(DR_REG_SPI2_BASE), 0, -1, -1, -1, -1}, - {(volatile spi_dev_t *)(DR_REG_SPI3_BASE), 1, -1, -1, -1, -1} + {(volatile spi_dev_t *)(DR_REG_SPI2_BASE), 0, -1, -1, -1, -1, false}, + {(volatile spi_dev_t *)(DR_REG_SPI3_BASE), 1, -1, -1, -1, -1, false} #elif CONFIG_IDF_TARGET_ESP32C2 - {(volatile spi_dev_t *)(DR_REG_SPI2_BASE), 0, -1, -1, -1, -1} + {(volatile spi_dev_t *)(DR_REG_SPI2_BASE), 0, -1, -1, -1, -1, false} #elif CONFIG_IDF_TARGET_ESP32C3 - {(volatile spi_dev_t *)(DR_REG_SPI2_BASE), 0, -1, -1, -1, -1} -#elif CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 - {(spi_dev_t *)(DR_REG_SPI2_BASE), 0, -1, -1, -1, -1} + {(volatile spi_dev_t *)(DR_REG_SPI2_BASE), 0, -1, -1, -1, -1, false} +#elif CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32C5 + {(spi_dev_t *)(DR_REG_SPI2_BASE), 0, -1, -1, -1, -1, false} #else - {(volatile spi_dev_t *)(DR_REG_SPI0_BASE), 0, -1, -1, -1, -1}, - {(volatile spi_dev_t *)(DR_REG_SPI1_BASE), 1, -1, -1, -1, -1}, - {(volatile spi_dev_t *)(DR_REG_SPI2_BASE), 2, -1, -1, -1, -1}, - {(volatile spi_dev_t *)(DR_REG_SPI3_BASE), 3, -1, -1, -1, -1} + {(volatile spi_dev_t *)(DR_REG_SPI0_BASE), 0, -1, -1, -1, -1, false}, + {(volatile spi_dev_t *)(DR_REG_SPI1_BASE), 1, -1, -1, -1, -1, false}, + {(volatile spi_dev_t *)(DR_REG_SPI2_BASE), 2, -1, -1, -1, -1, false}, + {(volatile spi_dev_t *)(DR_REG_SPI3_BASE), 3, -1, -1, -1, -1, false} #endif }; // clang-format on @@ -179,22 +185,22 @@ static spi_t _spi_bus_array[] = { static spi_t _spi_bus_array[] = { #if CONFIG_IDF_TARGET_ESP32S2 - {(volatile spi_dev_t *)(DR_REG_SPI1_BASE), NULL, 0, -1, -1, -1, -1}, - {(volatile spi_dev_t *)(DR_REG_SPI2_BASE), NULL, 1, -1, -1, -1, -1}, - {(volatile spi_dev_t *)(DR_REG_SPI3_BASE), NULL, 2, -1, -1, -1, -1} + {(volatile spi_dev_t *)(DR_REG_SPI1_BASE), NULL, 0, -1, -1, -1, -1, false}, + {(volatile spi_dev_t *)(DR_REG_SPI2_BASE), NULL, 1, -1, -1, -1, -1, false}, + {(volatile spi_dev_t *)(DR_REG_SPI3_BASE), NULL, 2, -1, -1, -1, -1, false} #elif CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32P4 - {(volatile spi_dev_t *)(DR_REG_SPI2_BASE), NULL, 0, -1, -1, -1, -1}, {(volatile spi_dev_t *)(DR_REG_SPI3_BASE), NULL, 1, -1, -1, -1, -1} + {(volatile spi_dev_t *)(DR_REG_SPI2_BASE), NULL, 0, -1, -1, -1, -1, false}, {(volatile spi_dev_t *)(DR_REG_SPI3_BASE), NULL, 1, -1, -1, -1, -1, false} #elif CONFIG_IDF_TARGET_ESP32C2 - {(volatile spi_dev_t *)(DR_REG_SPI2_BASE), NULL, 0, -1, -1, -1, -1} + {(volatile spi_dev_t *)(DR_REG_SPI2_BASE), NULL, 0, -1, -1, -1, -1, false} #elif CONFIG_IDF_TARGET_ESP32C3 - {(volatile spi_dev_t *)(DR_REG_SPI2_BASE), NULL, 0, -1, -1, -1, -1} -#elif CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 - {(spi_dev_t *)(DR_REG_SPI2_BASE), NULL, 0, -1, -1, -1, -1} + {(volatile spi_dev_t *)(DR_REG_SPI2_BASE), NULL, 0, -1, -1, -1, -1, false} +#elif CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32C5 + {(spi_dev_t *)(DR_REG_SPI2_BASE), NULL, 0, -1, -1, -1, -1, false} #else - {(volatile spi_dev_t *)(DR_REG_SPI0_BASE), NULL, 0, -1, -1, -1, -1}, - {(volatile spi_dev_t *)(DR_REG_SPI1_BASE), NULL, 1, -1, -1, -1, -1}, - {(volatile spi_dev_t *)(DR_REG_SPI2_BASE), NULL, 2, -1, -1, -1, -1}, - {(volatile spi_dev_t *)(DR_REG_SPI3_BASE), NULL, 3, -1, -1, -1, -1} + {(volatile spi_dev_t *)(DR_REG_SPI0_BASE), NULL, 0, -1, -1, -1, -1, false}, + {(volatile spi_dev_t *)(DR_REG_SPI1_BASE), NULL, 1, -1, -1, -1, -1, false}, + {(volatile spi_dev_t *)(DR_REG_SPI2_BASE), NULL, 2, -1, -1, -1, -1, false}, + {(volatile spi_dev_t *)(DR_REG_SPI3_BASE), NULL, 3, -1, -1, -1, -1, false} #endif }; #endif @@ -365,7 +371,7 @@ bool spiAttachSS(spi_t *spi, uint8_t ss_num, int8_t ss) { return false; } pinMode(ss, OUTPUT); - pinMatrixOutAttach(ss, SPI_SS_IDX(spi->num, ss_num), false, false); + pinMatrixOutAttach(ss, SPI_SS_IDX(spi->num, ss_num), spi->ss_invert, false); spiEnableSSPins(spi, (1 << ss_num)); spi->ss = ss; if (!perimanSetPinBus(ss, ESP32_BUS_TYPE_SPI_MASTER_SS, (void *)(spi->num + 1), spi->num, -1)) { @@ -435,6 +441,12 @@ void spiSSDisable(spi_t *spi) { SPI_MUTEX_UNLOCK(); } +void spiSSInvert(spi_t *spi, bool invert) { + if (spi) { + spi->ss_invert = invert; + } +} + void spiSSSet(spi_t *spi) { if (!spi) { return; @@ -685,7 +697,7 @@ spi_t *spiStartBus(uint8_t spi_num, uint32_t clockDiv, uint8_t dataMode, uint8_t spi->dev->user.doutdin = 1; int i; for (i = 0; i < 16; i++) { -#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32C5 spi->dev->data_buf[i].val = 0x00000000; #else spi->dev->data_buf[i] = 0x00000000; @@ -733,7 +745,7 @@ void spiWrite(spi_t *spi, const uint32_t *data, uint8_t len) { spi->dev->miso_dlen.usr_miso_dbitlen = 0; #endif for (i = 0; i < len; i++) { -#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32C5 spi->dev->data_buf[i].val = data[i]; #else spi->dev->data_buf[i] = data[i]; @@ -760,7 +772,7 @@ void spiTransfer(spi_t *spi, uint32_t *data, uint8_t len) { spi->dev->mosi_dlen.usr_mosi_dbitlen = (len * 32) - 1; spi->dev->miso_dlen.usr_miso_dbitlen = (len * 32) - 1; for (i = 0; i < len; i++) { -#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32C5 spi->dev->data_buf[i].val = data[i]; #else spi->dev->data_buf[i] = data[i]; @@ -773,7 +785,7 @@ void spiTransfer(spi_t *spi, uint32_t *data, uint8_t len) { spi->dev->cmd.usr = 1; while (spi->dev->cmd.usr); for (i = 0; i < len; i++) { -#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32C5 data[i] = spi->dev->data_buf[i].val; #else data[i] = spi->dev->data_buf[i]; @@ -791,7 +803,7 @@ void spiWriteByte(spi_t *spi, uint8_t data) { #if CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32 spi->dev->miso_dlen.usr_miso_dbitlen = 0; #endif -#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32C5 spi->dev->data_buf[0].val = data; #else spi->dev->data_buf[0] = data; @@ -813,7 +825,7 @@ uint8_t spiTransferByte(spi_t *spi, uint8_t data) { SPI_MUTEX_LOCK(); spi->dev->mosi_dlen.usr_mosi_dbitlen = 7; spi->dev->miso_dlen.usr_miso_dbitlen = 7; -#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32C5 spi->dev->data_buf[0].val = data; #else spi->dev->data_buf[0] = data; @@ -824,7 +836,7 @@ uint8_t spiTransferByte(spi_t *spi, uint8_t data) { #endif spi->dev->cmd.usr = 1; while (spi->dev->cmd.usr); -#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32C5 data = spi->dev->data_buf[0].val & 0xFF; #else data = spi->dev->data_buf[0] & 0xFF; @@ -854,7 +866,7 @@ void spiWriteWord(spi_t *spi, uint16_t data) { #if CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32 spi->dev->miso_dlen.usr_miso_dbitlen = 0; #endif -#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32C5 spi->dev->data_buf[0].val = data; #else spi->dev->data_buf[0] = data; @@ -878,7 +890,7 @@ uint16_t spiTransferWord(spi_t *spi, uint16_t data) { SPI_MUTEX_LOCK(); spi->dev->mosi_dlen.usr_mosi_dbitlen = 15; spi->dev->miso_dlen.usr_miso_dbitlen = 15; -#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32C5 spi->dev->data_buf[0].val = data; #else spi->dev->data_buf[0] = data; @@ -889,7 +901,7 @@ uint16_t spiTransferWord(spi_t *spi, uint16_t data) { #endif spi->dev->cmd.usr = 1; while (spi->dev->cmd.usr); -#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32C5 data = spi->dev->data_buf[0].val; #else data = spi->dev->data_buf[0]; @@ -913,7 +925,7 @@ void spiWriteLong(spi_t *spi, uint32_t data) { #if CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32 spi->dev->miso_dlen.usr_miso_dbitlen = 0; #endif -#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32C5 spi->dev->data_buf[0].val = data; #else spi->dev->data_buf[0] = data; @@ -937,7 +949,7 @@ uint32_t spiTransferLong(spi_t *spi, uint32_t data) { SPI_MUTEX_LOCK(); spi->dev->mosi_dlen.usr_mosi_dbitlen = 31; spi->dev->miso_dlen.usr_miso_dbitlen = 31; -#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32C5 spi->dev->data_buf[0].val = data; #else spi->dev->data_buf[0] = data; @@ -948,7 +960,7 @@ uint32_t spiTransferLong(spi_t *spi, uint32_t data) { #endif spi->dev->cmd.usr = 1; while (spi->dev->cmd.usr); -#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32C5 data = spi->dev->data_buf[0].val; #else data = spi->dev->data_buf[0]; @@ -987,7 +999,7 @@ static void __spiTransferBytes(spi_t *spi, const uint8_t *data, uint8_t *out, ui spi->dev->miso_dlen.usr_miso_dbitlen = ((bytes * 8) - 1); for (i = 0; i < words; i++) { -#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32C5 spi->dev->data_buf[i].val = wordsBuf[i]; //copy buffer to spi fifo #else spi->dev->data_buf[i] = wordsBuf[i]; //copy buffer to spi fifo @@ -1004,7 +1016,7 @@ static void __spiTransferBytes(spi_t *spi, const uint8_t *data, uint8_t *out, ui if (out) { for (i = 0; i < words; i++) { -#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32C5 wordsBuf[i] = spi->dev->data_buf[i].val; //copy spi fifo to buffer #else wordsBuf[i] = spi->dev->data_buf[i]; //copy spi fifo to buffer @@ -1145,7 +1157,7 @@ void ARDUINO_ISR_ATTR spiWriteByteNL(spi_t *spi, uint8_t data) { #if CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32 spi->dev->miso_dlen.usr_miso_dbitlen = 0; #endif -#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32C5 spi->dev->data_buf[0].val = data; #else spi->dev->data_buf[0] = data; @@ -1164,7 +1176,7 @@ uint8_t spiTransferByteNL(spi_t *spi, uint8_t data) { } spi->dev->mosi_dlen.usr_mosi_dbitlen = 7; spi->dev->miso_dlen.usr_miso_dbitlen = 7; -#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32C5 spi->dev->data_buf[0].val = data; #else spi->dev->data_buf[0] = data; @@ -1175,7 +1187,7 @@ uint8_t spiTransferByteNL(spi_t *spi, uint8_t data) { #endif spi->dev->cmd.usr = 1; while (spi->dev->cmd.usr); -#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32C5 data = spi->dev->data_buf[0].val & 0xFF; #else data = spi->dev->data_buf[0] & 0xFF; @@ -1194,7 +1206,7 @@ void ARDUINO_ISR_ATTR spiWriteShortNL(spi_t *spi, uint16_t data) { #if CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32 spi->dev->miso_dlen.usr_miso_dbitlen = 0; #endif -#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32C5 spi->dev->data_buf[0].val = data; #else spi->dev->data_buf[0] = data; @@ -1216,7 +1228,7 @@ uint16_t spiTransferShortNL(spi_t *spi, uint16_t data) { } spi->dev->mosi_dlen.usr_mosi_dbitlen = 15; spi->dev->miso_dlen.usr_miso_dbitlen = 15; -#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32C5 spi->dev->data_buf[0].val = data; #else spi->dev->data_buf[0] = data; @@ -1227,7 +1239,7 @@ uint16_t spiTransferShortNL(spi_t *spi, uint16_t data) { #endif spi->dev->cmd.usr = 1; while (spi->dev->cmd.usr); -#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32C5 data = spi->dev->data_buf[0].val & 0xFFFF; #else data = spi->dev->data_buf[0] & 0xFFFF; @@ -1249,7 +1261,7 @@ void ARDUINO_ISR_ATTR spiWriteLongNL(spi_t *spi, uint32_t data) { #if CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32 spi->dev->miso_dlen.usr_miso_dbitlen = 0; #endif -#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32C5 spi->dev->data_buf[0].val = data; #else spi->dev->data_buf[0] = data; @@ -1271,7 +1283,7 @@ uint32_t spiTransferLongNL(spi_t *spi, uint32_t data) { } spi->dev->mosi_dlen.usr_mosi_dbitlen = 31; spi->dev->miso_dlen.usr_miso_dbitlen = 31; -#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32C5 spi->dev->data_buf[0].val = data; #else spi->dev->data_buf[0] = data; @@ -1282,7 +1294,7 @@ uint32_t spiTransferLongNL(spi_t *spi, uint32_t data) { #endif spi->dev->cmd.usr = 1; while (spi->dev->cmd.usr); -#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32C5 data = spi->dev->data_buf[0].val; #else data = spi->dev->data_buf[0]; @@ -1313,7 +1325,7 @@ void spiWriteNL(spi_t *spi, const void *data_in, uint32_t len) { spi->dev->miso_dlen.usr_miso_dbitlen = 0; #endif for (size_t i = 0; i < c_longs; i++) { -#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32C5 spi->dev->data_buf[i].val = data[i]; #else spi->dev->data_buf[i] = data[i]; @@ -1352,7 +1364,7 @@ void spiTransferBytesNL(spi_t *spi, const void *data_in, uint8_t *data_out, uint spi->dev->miso_dlen.usr_miso_dbitlen = (c_len * 8) - 1; if (data) { for (size_t i = 0; i < c_longs; i++) { -#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32C5 spi->dev->data_buf[i].val = data[i]; #else spi->dev->data_buf[i] = data[i]; @@ -1360,7 +1372,7 @@ void spiTransferBytesNL(spi_t *spi, const void *data_in, uint8_t *data_out, uint } } else { for (size_t i = 0; i < c_longs; i++) { -#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32C5 spi->dev->data_buf[i].val = 0xFFFFFFFF; #else spi->dev->data_buf[i] = 0xFFFFFFFF; @@ -1376,13 +1388,13 @@ void spiTransferBytesNL(spi_t *spi, const void *data_in, uint8_t *data_out, uint if (result) { if (c_len & 3) { for (size_t i = 0; i < (c_longs - 1); i++) { -#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32C5 result[i] = spi->dev->data_buf[i].val; #else result[i] = spi->dev->data_buf[i]; #endif } -#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32C5 uint32_t last_data = spi->dev->data_buf[c_longs - 1].val; #else uint32_t last_data = spi->dev->data_buf[c_longs - 1]; @@ -1394,7 +1406,7 @@ void spiTransferBytesNL(spi_t *spi, const void *data_in, uint8_t *data_out, uint } } else { for (size_t i = 0; i < c_longs; i++) { -#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32C5 result[i] = spi->dev->data_buf[i].val; #else result[i] = spi->dev->data_buf[i]; @@ -1436,7 +1448,7 @@ void spiTransferBitsNL(spi_t *spi, uint32_t data, uint32_t *out, uint8_t bits) { spi->dev->mosi_dlen.usr_mosi_dbitlen = (bits - 1); spi->dev->miso_dlen.usr_miso_dbitlen = (bits - 1); -#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32C5 spi->dev->data_buf[0].val = data; #else spi->dev->data_buf[0] = data; @@ -1447,7 +1459,7 @@ void spiTransferBitsNL(spi_t *spi, uint32_t data, uint32_t *out, uint8_t bits) { #endif spi->dev->cmd.usr = 1; while (spi->dev->cmd.usr); -#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32C5 data = spi->dev->data_buf[0].val; #else data = spi->dev->data_buf[0]; @@ -1488,27 +1500,27 @@ void ARDUINO_ISR_ATTR spiWritePixelsNL(spi_t *spi, const void *data_in, uint32_t if (msb) { if (l_bytes && i == (c_longs - 1)) { if (l_bytes == 2) { -#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32C5 MSB_16_SET(spi->dev->data_buf[i].val, data[i]); #else MSB_16_SET(spi->dev->data_buf[i], data[i]); #endif } else { -#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32C5 spi->dev->data_buf[i].val = data[i] & 0xFF; #else spi->dev->data_buf[i] = data[i] & 0xFF; #endif } } else { -#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32C5 MSB_PIX_SET(spi->dev->data_buf[i].val, data[i]); #else MSB_PIX_SET(spi->dev->data_buf[i], data[i]); #endif } } else { -#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32C5 spi->dev->data_buf[i].val = data[i]; #else spi->dev->data_buf[i] = data[i]; diff --git a/cores/esp32/esp32-hal-spi.h b/cores/esp32/esp32-hal-spi.h index b77abff7854..7d56f0820d3 100644 --- a/cores/esp32/esp32-hal-spi.h +++ b/cores/esp32/esp32-hal-spi.h @@ -97,6 +97,8 @@ void spiSSSet(spi_t *spi); void spiSSClear(spi_t *spi); void spiWaitReady(spi_t *spi); +//invert hardware SS +void spiSSInvert(spi_t *spi, bool invert); uint32_t spiGetClockDiv(spi_t *spi); uint8_t spiGetDataMode(spi_t *spi); diff --git a/cores/esp32/esp32-hal-uart.c b/cores/esp32/esp32-hal-uart.c index 75e2da013ea..21540b3e95a 100644 --- a/cores/esp32/esp32-hal-uart.c +++ b/cores/esp32/esp32-hal-uart.c @@ -58,6 +58,7 @@ struct uart_struct_t { uint16_t _rx_buffer_size, _tx_buffer_size; // UART RX and TX buffer sizes bool _inverted; // UART inverted signal uint8_t _rxfifo_full_thrhd; // UART RX FIFO full threshold + int8_t _uart_clock_source; // UART Clock Source used when it is started using uartBegin() }; #if CONFIG_DISABLE_HAL_LOCKS @@ -66,21 +67,21 @@ struct uart_struct_t { #define UART_MUTEX_UNLOCK() static uart_t _uart_bus_array[] = { - {0, false, 0, NULL, -1, -1, -1, -1, 0, 0, 0, 0, false, 0}, + {0, false, 0, NULL, -1, -1, -1, -1, 0, 0, 0, 0, false, 0, -1}, #if SOC_UART_NUM > 1 - {1, false, 0, NULL, -1, -1, -1, -1, 0, 0, 0, 0, false, 0}, + {1, false, 0, NULL, -1, -1, -1, -1, 0, 0, 0, 0, false, 0, -1}, #endif #if SOC_UART_NUM > 2 - {2, false, 0, NULL, -1, -1, -1, -1, 0, 0, 0, 0, false, 0}, + {2, false, 0, NULL, -1, -1, -1, -1, 0, 0, 0, 0, false, 0, -1}, #endif #if SOC_UART_NUM > 3 - {3, false, 0, NULL, -1, -1, -1, -1, 0, 0, 0, 0, false, 0}, + {3, false, 0, NULL, -1, -1, -1, -1, 0, 0, 0, 0, false, 0, -1}, #endif #if SOC_UART_NUM > 4 - {4, false, 0, NULL, -1, -1, -1, -1, 0, 0, 0, 0, false, 0}, + {4, false, 0, NULL, -1, -1, -1, -1, 0, 0, 0, 0, false, 0, -1}, #endif #if SOC_UART_NUM > 5 - {5, false, 0, NULL, -1, -1, -1, -1, 0, 0, 0, 0, false, 0}, + {5, false, 0, NULL, -1, -1, -1, -1, 0, 0, 0, 0, false, 0, -1}, #endif }; @@ -95,21 +96,21 @@ static uart_t _uart_bus_array[] = { xSemaphoreGive(uart->lock) static uart_t _uart_bus_array[] = { - {NULL, 0, false, 0, NULL, -1, -1, -1, -1, 0, 0, 0, 0, false, 0}, + {NULL, 0, false, 0, NULL, -1, -1, -1, -1, 0, 0, 0, 0, false, 0, -1}, #if SOC_UART_NUM > 1 - {NULL, 1, false, 0, NULL, -1, -1, -1, -1, 0, 0, 0, 0, false, 0}, + {NULL, 1, false, 0, NULL, -1, -1, -1, -1, 0, 0, 0, 0, false, 0, -1}, #endif #if SOC_UART_NUM > 2 - {NULL, 2, false, 0, NULL, -1, -1, -1, -1, 0, 0, 0, 0, false, 0}, + {NULL, 2, false, 0, NULL, -1, -1, -1, -1, 0, 0, 0, 0, false, 0, -1}, #endif #if SOC_UART_NUM > 3 - {NULL, 3, false, 0, NULL, -1, -1, -1, -1, 0, 0, 0, 0, false, 0}, + {NULL, 3, false, 0, NULL, -1, -1, -1, -1, 0, 0, 0, 0, false, 0, -1}, #endif #if SOC_UART_NUM > 4 - {NULL, 4, false, 0, NULL, -1, -1, -1, -1, 0, 0, 0, 0, false, 0}, + {NULL, 4, false, 0, NULL, -1, -1, -1, -1, 0, 0, 0, 0, false, 0, -1}, #endif #if SOC_UART_NUM > 5 - {NULL, 5, false, 0, NULL, -1, -1, -1, -1, 0, 0, 0, 0, false, 0}, + {NULL, 5, false, 0, NULL, -1, -1, -1, -1, 0, 0, 0, 0, false, 0, -1}, #endif }; @@ -206,6 +207,14 @@ static bool lpuartCheckPins(int8_t rxPin, int8_t txPin, int8_t ctsPin, int8_t rt } #endif // SOC_UART_LP_NUM >= 1 +#ifndef GPIO_FUNC_IN_LOW +#define GPIO_FUNC_IN_LOW GPIO_MATRIX_CONST_ZERO_INPUT +#endif + +#ifndef GPIO_FUNC_IN_HIGH +#define GPIO_FUNC_IN_HIGH GPIO_MATRIX_CONST_ONE_INPUT +#endif + // Negative Pin Number will keep it unmodified, thus this function can detach individual pins // This function will also unset the pins in the Peripheral Manager and set the pin to -1 after detaching static bool _uartDetachPins(uint8_t uart_num, int8_t rxPin, int8_t txPin, int8_t ctsPin, int8_t rtsPin) { @@ -221,7 +230,8 @@ static bool _uartDetachPins(uint8_t uart_num, int8_t rxPin, int8_t txPin, int8_t // detaches HP and LP pins and sets Peripheral Manager and UART information if (rxPin >= 0 && uart->_rxPin == rxPin && perimanGetPinBusType(rxPin) == ESP32_BUS_TYPE_UART_RX) { - gpio_hal_iomux_func_sel(GPIO_PIN_MUX_REG[rxPin], PIN_FUNC_GPIO); + //gpio_hal_iomux_func_sel(GPIO_PIN_MUX_REG[rxPin], PIN_FUNC_GPIO); + esp_rom_gpio_pad_select_gpio(rxPin); // avoids causing BREAK in the UART line if (uart->_inverted) { esp_rom_gpio_connect_in_signal(GPIO_FUNC_IN_LOW, UART_PERIPH_SIGNAL(uart_num, SOC_UART_RX_PIN_IDX), false); @@ -235,7 +245,8 @@ static bool _uartDetachPins(uint8_t uart_num, int8_t rxPin, int8_t txPin, int8_t } } if (txPin >= 0 && uart->_txPin == txPin && perimanGetPinBusType(txPin) == ESP32_BUS_TYPE_UART_TX) { - gpio_hal_iomux_func_sel(GPIO_PIN_MUX_REG[txPin], PIN_FUNC_GPIO); + //gpio_hal_iomux_func_sel(GPIO_PIN_MUX_REG[txPin], PIN_FUNC_GPIO); + esp_rom_gpio_pad_select_gpio(txPin); esp_rom_gpio_connect_out_signal(txPin, SIG_GPIO_OUT_IDX, false, false); uart->_txPin = -1; // -1 means unassigned/detached if (!perimanClearPinBus(txPin)) { @@ -244,7 +255,8 @@ static bool _uartDetachPins(uint8_t uart_num, int8_t rxPin, int8_t txPin, int8_t } } if (ctsPin >= 0 && uart->_ctsPin == ctsPin && perimanGetPinBusType(ctsPin) == ESP32_BUS_TYPE_UART_CTS) { - gpio_hal_iomux_func_sel(GPIO_PIN_MUX_REG[ctsPin], PIN_FUNC_GPIO); + //gpio_hal_iomux_func_sel(GPIO_PIN_MUX_REG[ctsPin], PIN_FUNC_GPIO); + esp_rom_gpio_pad_select_gpio(ctsPin); esp_rom_gpio_connect_in_signal(GPIO_FUNC_IN_LOW, UART_PERIPH_SIGNAL(uart_num, SOC_UART_CTS_PIN_IDX), false); uart->_ctsPin = -1; // -1 means unassigned/detached if (!perimanClearPinBus(ctsPin)) { @@ -253,7 +265,8 @@ static bool _uartDetachPins(uint8_t uart_num, int8_t rxPin, int8_t txPin, int8_t } } if (rtsPin >= 0 && uart->_rtsPin == rtsPin && perimanGetPinBusType(rtsPin) == ESP32_BUS_TYPE_UART_RTS) { - gpio_hal_iomux_func_sel(GPIO_PIN_MUX_REG[rtsPin], PIN_FUNC_GPIO); + //gpio_hal_iomux_func_sel(GPIO_PIN_MUX_REG[rtsPin], PIN_FUNC_GPIO); + esp_rom_gpio_pad_select_gpio(rtsPin); esp_rom_gpio_connect_out_signal(rtsPin, SIG_GPIO_OUT_IDX, false, false); uart->_rtsPin = -1; // -1 means unassigned/detached if (!perimanClearPinBus(rtsPin)) { @@ -664,30 +677,40 @@ uart_t *uartBegin( rxfifo_full_thrhd = uart_config.rx_flow_ctrl_thresh; // makes sure that it will be set correctly in the struct uart_config.baud_rate = baudrate; #if SOC_UART_LP_NUM >= 1 - if (uart_nr >= SOC_UART_HP_NUM) { // it is a LP UART NUM - uart_config.lp_source_clk = LP_UART_SCLK_DEFAULT; // use default LP clock - log_v("Setting UART%d to use LP clock", uart_nr); + if (uart_nr >= SOC_UART_HP_NUM) { // it is a LP UART NUM + if (uart->_uart_clock_source > 0) { + uart_config.lp_source_clk = (soc_periph_lp_uart_clk_src_t)uart->_uart_clock_source; // use user defined LP UART clock + log_v("Setting UART%d to user defined LP clock source (%d) ", uart_nr, uart->_uart_clock_source); + } else { + uart_config.lp_source_clk = LP_UART_SCLK_DEFAULT; // use default LP clock + log_v("Setting UART%d to Default LP clock source", uart_nr); + } } else -#endif +#endif // SOC_UART_LP_NUM >= 1 { - // there is an issue when returning from light sleep with the C6 and H2: the uart baud rate is not restored - // therefore, uart clock source will set to XTAL for all SoC that support it. This fix solves the C6|H2 issue. + if (uart->_uart_clock_source >= 0) { + uart_config.source_clk = (soc_module_clk_t)uart->_uart_clock_source; // use user defined HP UART clock + log_v("Setting UART%d to user defined HP clock source (%d) ", uart_nr, uart->_uart_clock_source); + } else { + // there is an issue when returning from light sleep with the C6 and H2: the uart baud rate is not restored + // therefore, uart clock source will set to XTAL for all SoC that support it. This fix solves the C6|H2 issue. #if SOC_UART_SUPPORT_XTAL_CLK - uart_config.source_clk = UART_SCLK_XTAL; // valid for C2, S3, C3, C6, H2 and P4 - log_v("Setting UART%d to use XTAL clock", uart_nr); + uart_config.source_clk = UART_SCLK_XTAL; // valid for C2, S3, C3, C6, H2 and P4 + log_v("Setting UART%d to use XTAL clock", uart_nr); #elif SOC_UART_SUPPORT_REF_TICK - if (baudrate <= REF_TICK_BAUDRATE_LIMIT) { - uart_config.source_clk = UART_SCLK_REF_TICK; // valid for ESP32, S2 - MAX supported baud rate is 250 Kbps - log_v("Setting UART%d to use REF_TICK clock", uart_nr); - } else { - uart_config.source_clk = UART_SCLK_APB; // baudrate may change with the APB Frequency! - log_v("Setting UART%d to use APB clock", uart_nr); - } + if (baudrate <= REF_TICK_BAUDRATE_LIMIT) { + uart_config.source_clk = UART_SCLK_REF_TICK; // valid for ESP32, S2 - MAX supported baud rate is 250 Kbps + log_v("Setting UART%d to use REF_TICK clock", uart_nr); + } else { + uart_config.source_clk = UART_SCLK_APB; // baudrate may change with the APB Frequency! + log_v("Setting UART%d to use APB clock", uart_nr); + } #else - // Default CLK Source: CLK_APB for ESP32|S2|S3|C3 -- CLK_PLL_F40M for C2 -- CLK_PLL_F48M for H2 -- CLK_PLL_F80M for C6 - uart_config.source_clk = UART_SCLK_DEFAULT; // baudrate may change with the APB Frequency! - log_v("Setting UART%d to use DEFAULT clock", uart_nr); -#endif + // Default CLK Source: CLK_APB for ESP32|S2|S3|C3 -- CLK_PLL_F40M for C2 -- CLK_PLL_F48M for H2 -- CLK_PLL_F80M for C6|P4 + uart_config.source_clk = UART_SCLK_DEFAULT; // baudrate may change with the APB Frequency! + log_v("Setting UART%d to use DEFAULT clock", uart_nr); +#endif // SOC_UART_SUPPORT_XTAL_CLK + } } UART_MUTEX_LOCK(); @@ -716,6 +739,14 @@ uart_t *uartBegin( uart->_tx_buffer_size = tx_buffer_size; uart->has_peek = false; uart->peek_byte = 0; +#if SOC_UART_LP_NUM >= 1 + if (uart_nr >= SOC_UART_HP_NUM) { + uart->_uart_clock_source = uart_config.lp_source_clk; + } else +#endif + { + uart->_uart_clock_source = uart_config.source_clk; + } } UART_MUTEX_UNLOCK(); @@ -808,7 +839,7 @@ void uartSetRxInvert(uart_t *uart, bool invert) { if (uart == NULL) { return; } -#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32C5 // POTENTIAL ISSUE :: original code only set/reset rxd_inv bit // IDF or LL set/reset the whole inv_mask! // if (invert) @@ -975,22 +1006,52 @@ bool uartSetBaudRate(uart_t *uart, uint32_t baud_rate) { return false; } bool retCode = true; - UART_MUTEX_LOCK(); -#if SOC_UART_SUPPORT_XTAL_CLK // ESP32-S3, ESP32-C3, ESP32-C5, ESP32-C6, ESP32-H2 and ESP32-P4 - soc_module_clk_t newClkSrc = UART_SCLK_XTAL; + soc_module_clk_t newClkSrc = UART_SCLK_DEFAULT; + int8_t previousClkSrc = uart->_uart_clock_source; #if SOC_UART_LP_NUM >= 1 if (uart->num >= SOC_UART_HP_NUM) { // it is a LP UART NUM - newClkSrc = LP_UART_SCLK_DEFAULT; // use default LP clock + if (uart->_uart_clock_source > 0) { + newClkSrc = (soc_periph_lp_uart_clk_src_t)uart->_uart_clock_source; // use user defined LP UART clock + log_v("Setting UART%d to user defined LP clock source (%d) ", uart->num, newClkSrc); + } else { + newClkSrc = LP_UART_SCLK_DEFAULT; // use default LP clock + log_v("Setting UART%d to Default LP clock source", uart->num); + } + } else +#endif // SOC_UART_LP_NUM >= 1 + { + if (uart->_uart_clock_source >= 0) { + newClkSrc = (soc_module_clk_t)uart->_uart_clock_source; // use user defined HP UART clock + log_v("Setting UART%d to use HP clock source (%d) ", uart->num, newClkSrc); + } else { + // there is an issue when returning from light sleep with the C6 and H2: the uart baud rate is not restored + // therefore, uart clock source will set to XTAL for all SoC that support it. This fix solves the C6|H2 issue. +#if SOC_UART_SUPPORT_XTAL_CLK + newClkSrc = UART_SCLK_XTAL; // valid for C2, S3, C3, C6, H2 and P4 + log_v("Setting UART%d to use XTAL clock", uart->num); +#elif SOC_UART_SUPPORT_REF_TICK + if (baud_rate <= REF_TICK_BAUDRATE_LIMIT) { + newClkSrc = UART_SCLK_REF_TICK; // valid for ESP32, S2 - MAX supported baud rate is 250 Kbps + log_v("Setting UART%d to use REF_TICK clock", uart->num); + } else { + newClkSrc = UART_SCLK_APB; // baudrate may change with the APB Frequency! + log_v("Setting UART%d to use APB clock", uart->num); + } +#else + // Default CLK Source: CLK_APB for ESP32|S2|S3|C3 -- CLK_PLL_F40M for C2 -- CLK_PLL_F48M for H2 -- CLK_PLL_F80M for C6|P4 + // using newClkSrc = UART_SCLK_DEFAULT as defined in the variable declaration + log_v("Setting UART%d to use DEFAULT clock", uart->num); +#endif // SOC_UART_SUPPORT_XTAL_CLK + } } -#endif - // ESP32-P4 demands an atomic operation for setting the clock source - HP_UART_SRC_CLK_ATOMIC() { - uart_ll_set_sclk(UART_LL_GET_HW(uart->num), newClkSrc); + UART_MUTEX_LOCK(); + // if necessary, set the correct UART Clock Source before changing the baudrate + if (previousClkSrc < 0 || previousClkSrc != newClkSrc) { + HP_UART_SRC_CLK_ATOMIC() { + uart_ll_set_sclk(UART_LL_GET_HW(uart->num), newClkSrc); + } + uart->_uart_clock_source = newClkSrc; } -#else // ESP32, ESP32-S2 - soc_module_clk_t newClkSrc = baud_rate <= REF_TICK_BAUDRATE_LIMIT ? SOC_MOD_CLK_REF_TICK : SOC_MOD_CLK_APB; - uart_ll_set_sclk(UART_LL_GET_HW(uart->num), newClkSrc); -#endif if (uart_set_baudrate(uart->num, baud_rate) == ESP_OK) { log_v("Setting UART%d baud rate to %ld.", uart->num, baud_rate); uart->_baudrate = baud_rate; @@ -1084,6 +1145,35 @@ bool uartSetMode(uart_t *uart, uart_mode_t mode) { return retCode; } +// this function will set the uart clock source +// it must be called before uartBegin(), otherwise it won't change any thing. +bool uartSetClockSource(uint8_t uartNum, uart_sclk_t clkSrc) { + if (uartNum >= SOC_UART_NUM) { + log_e("UART%d is invalid. This device has %d UARTs, from 0 to %d.", uartNum, SOC_UART_NUM, SOC_UART_NUM - 1); + return false; + } + uart_t *uart = &_uart_bus_array[uartNum]; +#if SOC_UART_LP_NUM >= 1 + if (uart->num >= SOC_UART_HP_NUM) { + switch (clkSrc) { + case UART_SCLK_XTAL: uart->_uart_clock_source = LP_UART_SCLK_XTAL_D2; break; +#if CONFIG_IDF_TARGET_ESP32C5 + case UART_SCLK_RTC: uart->_uart_clock_source = LP_UART_SCLK_RC_FAST; break; +#else + case UART_SCLK_RTC: uart->_uart_clock_source = LP_UART_SCLK_LP_FAST; break; +#endif + case UART_SCLK_DEFAULT: + default: uart->_uart_clock_source = LP_UART_SCLK_DEFAULT; + } + } else +#endif + { + uart->_uart_clock_source = clkSrc; + } + //log_i("UART%d set clock source to %d", uart->num, uart->_uart_clock_source); + return true; +} + void uartSetDebug(uart_t *uart) { // LP UART is not supported for debug if (uart == NULL || uart->num >= SOC_UART_HP_NUM) { @@ -1112,7 +1202,7 @@ int log_printfv(const char *format, va_list arg) { return 0; } } -/* + /* // This causes dead locks with logging in specific cases and also with C++ constructors that may send logs #if !CONFIG_DISABLE_HAL_LOCKS if(s_uart_debug_nr != -1 && _uart_bus_array[s_uart_debug_nr].lock){ @@ -1120,16 +1210,8 @@ int log_printfv(const char *format, va_list arg) { } #endif */ -#if (ARDUINO_USB_CDC_ON_BOOT == 1 && ARDUINO_USB_MODE == 0) || CONFIG_IDF_TARGET_ESP32C3 \ - || ((CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32P4) && ARDUINO_USB_CDC_ON_BOOT == 1) vsnprintf(temp, len + 1, format, arg); ets_printf("%s", temp); -#else - int wlen = vsnprintf(temp, len + 1, format, arg); - for (int i = 0; i < wlen; i++) { - ets_write_char_uart(temp[i]); - } -#endif /* // This causes dead locks with logging and also with constructors that may send logs #if !CONFIG_DISABLE_HAL_LOCKS diff --git a/cores/esp32/esp32-hal-uart.h b/cores/esp32/esp32-hal-uart.h index 4d686fdd23d..41b005aa151 100644 --- a/cores/esp32/esp32-hal-uart.h +++ b/cores/esp32/esp32-hal-uart.h @@ -97,6 +97,19 @@ bool uartSetHwFlowCtrlMode(uart_t *uart, uart_hw_flowcontrol_t mode, uint8_t thr // UART_MODE_RS485_APP_CTRL = 0x04 mode: application control RS485 UART mode (used for test purposes) bool uartSetMode(uart_t *uart, uart_mode_t mode); +// Used to set the UART clock source mode. It must be set before calling uartBegin(), otherwise it won't have any effect. +// Not all clock source are available to every SoC. The compatible option are listed here: +// UART_SCLK_DEFAULT :: any SoC - it will set whatever IDF defines as the default UART Clock Source +// UART_SCLK_APB :: ESP32, ESP32-S2, ESP32-C3 and ESP32-S3 +// UART_SCLK_PLL_F80M :: ESP32-C5, ESP32-C6, ESP32-C61 and ESP32-P4 +// UART_SCLK_PLL_F40M :: ESP32-C2 +// UART_SCLK_PLL_F48M :: ESP32-H2 +// UART_SCLK_XTAL :: ESP32-C2, ESP32-C3, ESP32-C5, ESP32-C6, ESP32-C61, ESP32-H2, ESP32-S3 and ESP32-P4 +// UART_SCLK_RTC :: ESP32-C2, ESP32-C3, ESP32-C5, ESP32-C6, ESP32-C61, ESP32-H2, ESP32-S3 and ESP32-P4 +// UART_SCLK_REF_TICK :: ESP32 and ESP32-S2 +// Note: ESP32-C6, C61, ESP32-P4 and ESP32-C5 have LP UART that will use only LP_UART_SCLK_LP_FAST (RTC_FAST) or LP_UART_SCLK_XTAL_D2 (XTAL/2) as Clock Source +bool uartSetClockSource(uint8_t uartNum, uart_sclk_t clkSrc); + void uartStartDetectBaudrate(uart_t *uart); unsigned long uartDetectBaudrate(uart_t *uart); diff --git a/cores/esp32/esp_arduino_version.h b/cores/esp32/esp_arduino_version.h index b1355e908ae..120377c61f7 100644 --- a/cores/esp32/esp_arduino_version.h +++ b/cores/esp32/esp_arduino_version.h @@ -21,7 +21,7 @@ extern "C" { /** Major version number (X.x.x) */ #define ESP_ARDUINO_VERSION_MAJOR 3 /** Minor version number (x.X.x) */ -#define ESP_ARDUINO_VERSION_MINOR 2 +#define ESP_ARDUINO_VERSION_MINOR 3 /** Patch version number (x.x.X) */ #define ESP_ARDUINO_VERSION_PATCH 0 diff --git a/docs/en/contributing.rst b/docs/en/contributing.rst index 4093c60ec64..4ebe01cbf5b 100644 --- a/docs/en/contributing.rst +++ b/docs/en/contributing.rst @@ -15,6 +15,9 @@ Before Contributing Before sending us a Pull Request, please consider this: +* All contributions must be written in English to ensure effective communication and support. + Pull Requests written in other languages will be closed, with a request to rewrite them in English. + * Is the contribution entirely your own work, or is it already licensed under an LGPL 2.1 compatible Open Source License? If not, cannot accept it. diff --git a/docs/en/installing.rst b/docs/en/installing.rst index d5392d4b5ec..35342020864 100644 --- a/docs/en/installing.rst +++ b/docs/en/installing.rst @@ -10,6 +10,11 @@ Before Installing We recommend you install the support using your favorite IDE, but other options are available depending on your operating system. To install Arduino-ESP32 support, you can use one of the following options. +.. note:: + Users in China might have troubles with connection and download speeds using GitHub. Please use our Jihulab mirror as the repository source: + + ``https://jihulab.com/esp-mirror/espressif/arduino-esp32.git`` + Installing using Arduino IDE ---------------------------- @@ -32,6 +37,16 @@ This is the way to install Arduino-ESP32 directly from the Arduino IDE. https://espressif.github.io/arduino-esp32/package_esp32_dev_index.json +Users in China might have troubles with connection and download speeds using the links above. Please use our Jihulab mirror: + +- Stable release link:: + + https://jihulab.com/esp-mirror/espressif/arduino-esp32/-/raw/gh-pages/package_esp32_index_cn.json + +- Development release link:: + + https://jihulab.com/esp-mirror/espressif/arduino-esp32/-/raw/gh-pages/package_esp32_dev_index_cn.json + .. note:: Starting with the Arduino IDE version 1.6.4, Arduino allows installation of third-party platform packages using Boards Manager. We have packages available for Windows, macOS, and Linux. diff --git a/docs/en/troubleshooting.rst b/docs/en/troubleshooting.rst index f6a241729f5..ea9a6db94d6 100644 --- a/docs/en/troubleshooting.rst +++ b/docs/en/troubleshooting.rst @@ -14,6 +14,23 @@ Installing Here are the common issues during the installation. +Slow or unstable downloads +************************** + +Users in China might have troubles with connection and download speeds using GitHub. Please use our Jihulab mirror as the repository source: + +`https://jihulab.com/esp-mirror/espressif/arduino-esp32.git `_ + +JSON files for the boards manager are available here: + +- Stable release:: + + https://jihulab.com/esp-mirror/espressif/arduino-esp32/-/raw/gh-pages/package_esp32_index_cn.json + +- Development release:: + + https://jihulab.com/esp-mirror/espressif/arduino-esp32/-/raw/gh-pages/package_esp32_dev_index_cn.json + Building -------- diff --git a/idf_component.yml b/idf_component.yml index 967c4ecf0f6..c1fc614cae5 100644 --- a/idf_component.yml +++ b/idf_component.yml @@ -10,6 +10,7 @@ targets: - esp32c6 - esp32h2 - esp32p4 + - esp32c5 tags: - arduino files: @@ -22,6 +23,7 @@ files: - "variants/esp32c6/**/*" - "variants/esp32h2/**/*" - "variants/esp32p4/**/*" + - "variants/esp32c5/**/*" exclude: - "docs/" - "docs/**/*" @@ -44,7 +46,7 @@ files: - "platform.txt" - "programmers.txt" dependencies: - idf: ">=5.3,<5.5" + idf: ">=5.3,<5.6" # mdns 1.2.1 is necessary to build H2 with no WiFi espressif/mdns: version: "^1.2.3" @@ -107,7 +109,7 @@ dependencies: rules: - if: "target == esp32p4" espressif/esp_wifi_remote: - version: "^0.4.1" + version: "^0.5.4" rules: - if: "target == esp32p4" espressif/libsodium: diff --git a/idf_component_examples/.gitignore b/idf_component_examples/.gitignore new file mode 100644 index 00000000000..6052fd4e70b --- /dev/null +++ b/idf_component_examples/.gitignore @@ -0,0 +1,4 @@ +build/ +managed_components/ +dependencies.lock +sdkconfig diff --git a/idf_component_examples/esp_matter_light/CMakeLists.txt b/idf_component_examples/esp_matter_light/CMakeLists.txt index 16a7533f2a5..1430df8ff78 100644 --- a/idf_component_examples/esp_matter_light/CMakeLists.txt +++ b/idf_component_examples/esp_matter_light/CMakeLists.txt @@ -8,6 +8,7 @@ set(PROJECT_VER_NUMBER 1) # This should be done before using the IDF_TARGET variable. include($ENV{IDF_PATH}/tools/cmake/project.cmake) +idf_build_set_property(MINIMAL_BUILD ON) project(arduino_managed_component_light) # WARNING: This is just an example for using key for decrypting the encrypted OTA image @@ -20,7 +21,7 @@ if(CONFIG_IDF_TARGET_ESP32C2) include(relinker) endif() -idf_build_set_property(CXX_COMPILE_OPTIONS "-std=gnu++17;-Os;-DCHIP_HAVE_CONFIG_H" APPEND) +idf_build_set_property(CXX_COMPILE_OPTIONS "-std=gnu++2a;-Os;-DCHIP_HAVE_CONFIG_H" APPEND) idf_build_set_property(C_COMPILE_OPTIONS "-Os" APPEND) # For RISCV chips, project_include.cmake sets -Wno-format, but does not clear various # flags that depend on -Wformat diff --git a/idf_component_examples/esp_matter_light/README.md b/idf_component_examples/esp_matter_light/README.md index 06a22cdceac..b0173f6a437 100644 --- a/idf_component_examples/esp_matter_light/README.md +++ b/idf_component_examples/esp_matter_light/README.md @@ -59,15 +59,22 @@ Use ESP-IDF 5.1.4 from https://github.com/espressif/esp-idf/tree/release/v5.1 This example has been tested with Arduino Core 3.0.4 The project will download all necessary components, including the Arduino Core. -Run `idf.py -D SDKCONFIG_DEFAULTS="sdkconfig.defaults..idf" -p flash monitor` +Execute this sequence: + ` using linux rm command or Windows rmdir command` + `idf.py set-target ` + `idf.py -D SDKCONFIG_DEFAULTS="sdkconfig_file1;sdkconfig_file2;sdkconfig_fileX" -p flash monitor` Example for ESP32-S3/Linux | macOS: ``` -idf.py -D SDKCONFIG_DEFAULTS="sdkconfig.defaults.esp32s3" -p /dev/ttyACM0 flash monitor +rm -rf build +idf.py set-target esp32s3 +idf.py -D SDKCONFIG_DEFAULTS="sdkconfig.defaults" -p /dev/ttyACM0 flash monitor ``` Example for ESP32-C3/Windows: ``` -idf.py -D SDKCONFIG_DEFAULTS="sdkconfig.defaults.esp32c3" -p com3 flash monitor +rmdir /s/q build +idf.py set-target esp32c3 +idf.py -D SDKCONFIG_DEFAULTS="sdkconfig.defaults" -p com3 flash monitor ``` It may be necessary to delete some folders and files before running `idf.py` @@ -95,11 +102,15 @@ In order to build the application that will use Thread Networking instead of Wi- Example for ESP32-C6/Linux | macOS: ``` -idf.py -D SDKCONFIG_DEFAULTS="sdkconfig.defaults.c6_thread" -p /dev/ttyACM0 flash monitor +rm -rf build +idf.py set-target esp32c6 +idf.py -D SDKCONFIG_DEFAULTS="sdkconfig.defaults;sdkconfig.defaults.c6_thread" -p /dev/ttyACM0 flash monitor ``` Example for ESP32-C6/Windows: ``` -idf.py -D SDKCONFIG_DEFAULTS="sdkconfig.defaults.c6_thread" -p com3 flash monitor +rmdir /s/q build +idf.py set-targt esp32c6 +idf.py -D SDKCONFIG_DEFAULTS="sdkconfig.defaults;sdkconfig.defaults.c6_thread" -p com3 flash monitor ``` It may be necessary to delete some folders and files before running `idf.py` diff --git a/idf_component_examples/esp_matter_light/ci.json b/idf_component_examples/esp_matter_light/ci.json new file mode 100644 index 00000000000..f23a085285d --- /dev/null +++ b/idf_component_examples/esp_matter_light/ci.json @@ -0,0 +1,11 @@ +{ + "targets": { + "esp32c2": false, + "esp32s2": false + }, + "requires": [ + "CONFIG_SOC_WIFI_SUPPORTED=y", + "CONFIG_ESP_MATTER_ENABLE_DATA_MODEL=y", + "CONFIG_MBEDTLS_HKDF_C=y" + ] +} diff --git a/idf_component_examples/esp_matter_light/main/Kconfig.projbuild b/idf_component_examples/esp_matter_light/main/Kconfig.projbuild index 6e6abcb7fcf..3e0a35c5e15 100644 --- a/idf_component_examples/esp_matter_light/main/Kconfig.projbuild +++ b/idf_component_examples/esp_matter_light/main/Kconfig.projbuild @@ -3,100 +3,40 @@ menu "Light Matter Accessory" config BUTTON_PIN int prompt "Button 1 GPIO" - default ENV_GPIO_BOOT_BUTTON + default 9 if IDF_TARGET_ESP32C3 || IDF_TARGET_ESP32C6 + default 0 range -1 ENV_GPIO_IN_RANGE_MAX help The GPIO pin for button that will be used to turn on/off the Matter Light. It shall be connected to a push button. It can use the BOOT button of the development board. endmenu - menu "LEDs" config WS2812_PIN int prompt "WS2812 RGB LED GPIO" - default ENV_GPIO_RGB_LED + default 8 if IDF_TARGET_ESP32C3 || IDF_TARGET_ESP32C6 + default 48 range -1 ENV_GPIO_OUT_RANGE_MAX help The GPIO pin for the Matter Light that will be driven by RMT. It shall be connected to one single WS2812 RGB LED. endmenu - # TARGET CONFIGURATION - if IDF_TARGET_ESP32C3 - config ENV_GPIO_RANGE_MIN - int - default 0 - - config ENV_GPIO_RANGE_MAX - int - default 19 - # GPIOs 20/21 are always used by UART in examples - - config ENV_GPIO_IN_RANGE_MAX - int - default ENV_GPIO_RANGE_MAX - - config ENV_GPIO_OUT_RANGE_MAX - int - default ENV_GPIO_RANGE_MAX - - config ENV_GPIO_BOOT_BUTTON - int - default 9 - - config ENV_GPIO_RGB_LED - int - default 8 - endif - if IDF_TARGET_ESP32C6 - config ENV_GPIO_RANGE_MIN - int - default 0 + config ENV_GPIO_RANGE_MIN + int + default 0 - config ENV_GPIO_RANGE_MAX - int - default 30 - # GPIOs 16/17 are always used by UART in examples + config ENV_GPIO_RANGE_MAX + int + default 19 if IDF_TARGET_ESP32C3 + default 30 if IDF_TARGET_ESP32C6 + default 48 - config ENV_GPIO_IN_RANGE_MAX - int - default ENV_GPIO_RANGE_MAX + config ENV_GPIO_IN_RANGE_MAX + int + default ENV_GPIO_RANGE_MAX - config ENV_GPIO_OUT_RANGE_MAX - int - default ENV_GPIO_RANGE_MAX - - config ENV_GPIO_BOOT_BUTTON - int - default 9 - - config ENV_GPIO_RGB_LED - int - default 8 - endif - if IDF_TARGET_ESP32S3 - config ENV_GPIO_RANGE_MIN - int - default 0 - - config ENV_GPIO_RANGE_MAX - int - default 48 - - config ENV_GPIO_IN_RANGE_MAX - int - default ENV_GPIO_RANGE_MAX - - config ENV_GPIO_OUT_RANGE_MAX - int - default ENV_GPIO_RANGE_MAX - - config ENV_GPIO_BOOT_BUTTON - int - default 0 - - config ENV_GPIO_RGB_LED - int - default 48 - endif + config ENV_GPIO_OUT_RANGE_MAX + int + default ENV_GPIO_RANGE_MAX endmenu diff --git a/idf_component_examples/esp_matter_light/main/idf_component.yml b/idf_component_examples/esp_matter_light/main/idf_component.yml index 2b4ae4b34a4..e0286324591 100644 --- a/idf_component_examples/esp_matter_light/main/idf_component.yml +++ b/idf_component_examples/esp_matter_light/main/idf_component.yml @@ -1,9 +1,9 @@ dependencies: espressif/esp_matter: - version: "^1.3.0" + version: ">=1.3.0" # Adds Arduino Core from GitHub repository using main branch espressif/arduino-esp32: - version: "^3.0.5" + version: ">=3.0.5" override_path: "../../../" pre_release: true diff --git a/idf_component_examples/esp_matter_light/sdkconfig.defaults.esp32c3 b/idf_component_examples/esp_matter_light/sdkconfig.defaults similarity index 98% rename from idf_component_examples/esp_matter_light/sdkconfig.defaults.esp32c3 rename to idf_component_examples/esp_matter_light/sdkconfig.defaults index df6d6b0d585..43871661856 100644 --- a/idf_component_examples/esp_matter_light/sdkconfig.defaults.esp32c3 +++ b/idf_component_examples/esp_matter_light/sdkconfig.defaults @@ -1,5 +1,3 @@ -CONFIG_IDF_TARGET="esp32c3" - # Arduino Settings CONFIG_FREERTOS_HZ=1000 CONFIG_AUTOSTART_ARDUINO=y diff --git a/idf_component_examples/esp_matter_light/sdkconfig.defaults.esp32c6 b/idf_component_examples/esp_matter_light/sdkconfig.defaults.esp32c6 index f228f3158c8..9fe589613ef 100644 --- a/idf_component_examples/esp_matter_light/sdkconfig.defaults.esp32c6 +++ b/idf_component_examples/esp_matter_light/sdkconfig.defaults.esp32c6 @@ -1,68 +1,5 @@ CONFIG_IDF_TARGET="esp32c6" -# Arduino Settings -CONFIG_FREERTOS_HZ=1000 -CONFIG_AUTOSTART_ARDUINO=y - -# Log Levels -# Boot Messages - Log level -CONFIG_BOOTLOADER_LOG_LEVEL_ERROR=y -# Arduino Log Level -CONFIG_ARDUHAL_LOG_DEFAULT_LEVEL_INFO=y -# IDF Log Level -CONFIG_LOG_DEFAULT_LEVEL_ERROR=y - -# Default to 921600 baud when flashing and monitoring device -CONFIG_ESPTOOLPY_BAUD_921600B=y -CONFIG_ESPTOOLPY_BAUD=921600 -CONFIG_ESPTOOLPY_COMPRESSED=y -CONFIG_ESPTOOLPY_MONITOR_BAUD_115200B=y -CONFIG_ESPTOOLPY_MONITOR_BAUD=115200 -CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y - -#enable BT -CONFIG_BT_ENABLED=y -CONFIG_BT_NIMBLE_ENABLED=y - -#disable BT connection reattempt -CONFIG_BT_NIMBLE_ENABLE_CONN_REATTEMPT=n - -#enable lwip ipv6 autoconfig -CONFIG_LWIP_IPV6_AUTOCONFIG=y - -# Use a custom partition table -CONFIG_PARTITION_TABLE_CUSTOM=y -CONFIG_PARTITION_TABLE_FILENAME="partitions.csv" -CONFIG_PARTITION_TABLE_OFFSET=0xC000 - -# Disable chip shell -CONFIG_ENABLE_CHIP_SHELL=n - -# Enable OTA Requester -CONFIG_ENABLE_OTA_REQUESTOR=n - -#enable lwIP route hooks -CONFIG_LWIP_HOOK_IP6_ROUTE_DEFAULT=y -CONFIG_LWIP_HOOK_ND6_GET_GW_DEFAULT=y - -# disable softap by default -CONFIG_ESP_WIFI_SOFTAP_SUPPORT=n -CONFIG_ENABLE_WIFI_STATION=y -CONFIG_ENABLE_WIFI_AP=n - -# Disable DS Peripheral -CONFIG_ESP_SECURE_CERT_DS_PERIPHERAL=n - -# Use compact attribute storage mode -CONFIG_ESP_MATTER_NVS_USE_COMPACT_ATTR_STORAGE=y - -# Enable HKDF in mbedtls -CONFIG_MBEDTLS_HKDF_C=y - -# Increase LwIP IPv6 address number to 6 (MAX_FABRIC + 1) -# unique local addresses for fabrics(MAX_FABRIC), a link local address(1) -CONFIG_LWIP_IPV6_NUM_ADDRESSES=6 - # libsodium CONFIG_LIBSODIUM_USE_MBEDTLS_SHA=y diff --git a/idf_component_examples/esp_matter_light/sdkconfig.defaults.esp32s3 b/idf_component_examples/esp_matter_light/sdkconfig.defaults.esp32s3 deleted file mode 100644 index 9c1aa36b6c9..00000000000 --- a/idf_component_examples/esp_matter_light/sdkconfig.defaults.esp32s3 +++ /dev/null @@ -1,64 +0,0 @@ -CONFIG_IDF_TARGET="esp32s3" - -# Arduino Settings -CONFIG_FREERTOS_HZ=1000 -CONFIG_AUTOSTART_ARDUINO=y - -# Log Levels -# Boot Messages - Log level -CONFIG_BOOTLOADER_LOG_LEVEL_ERROR=y -# Arduino Log Level -CONFIG_ARDUHAL_LOG_DEFAULT_LEVEL_INFO=y -# IDF Log Level -CONFIG_LOG_DEFAULT_LEVEL_ERROR=y - -# Default to 921600 baud when flashing and monitoring device -CONFIG_ESPTOOLPY_BAUD_921600B=y -CONFIG_ESPTOOLPY_BAUD=921600 -CONFIG_ESPTOOLPY_COMPRESSED=y -CONFIG_ESPTOOLPY_MONITOR_BAUD_115200B=y -CONFIG_ESPTOOLPY_MONITOR_BAUD=115200 -CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y - -#enable BT -CONFIG_BT_ENABLED=y -CONFIG_BT_NIMBLE_ENABLED=y - -#disable BT connection reattempt -CONFIG_BT_NIMBLE_ENABLE_CONN_REATTEMPT=n - -#enable lwip ipv6 autoconfig -CONFIG_LWIP_IPV6_AUTOCONFIG=y - -# Use a custom partition table -CONFIG_PARTITION_TABLE_CUSTOM=y -CONFIG_PARTITION_TABLE_FILENAME="partitions.csv" -CONFIG_PARTITION_TABLE_OFFSET=0xC000 - -# Disable chip shell -CONFIG_ENABLE_CHIP_SHELL=n - -# Enable OTA Requester -CONFIG_ENABLE_OTA_REQUESTOR=n - -#enable lwIP route hooks -CONFIG_LWIP_HOOK_IP6_ROUTE_DEFAULT=y -CONFIG_LWIP_HOOK_ND6_GET_GW_DEFAULT=y - -# disable softap by default -CONFIG_ESP_WIFI_SOFTAP_SUPPORT=n -CONFIG_ENABLE_WIFI_STATION=y -CONFIG_ENABLE_WIFI_AP=n - -# Disable DS Peripheral -CONFIG_ESP_SECURE_CERT_DS_PERIPHERAL=n - -# Use compact attribute storage mode -CONFIG_ESP_MATTER_NVS_USE_COMPACT_ATTR_STORAGE=y - -# Enable HKDF in mbedtls -CONFIG_MBEDTLS_HKDF_C=y - -# Increase LwIP IPv6 address number to 6 (MAX_FABRIC + 1) -# unique local addresses for fabrics(MAX_FABRIC), a link local address(1) -CONFIG_LWIP_IPV6_NUM_ADDRESSES=6 diff --git a/idf_component_examples/hello_world/CMakeLists.txt b/idf_component_examples/hello_world/CMakeLists.txt index 664d45871d0..af087cf42b6 100644 --- a/idf_component_examples/hello_world/CMakeLists.txt +++ b/idf_component_examples/hello_world/CMakeLists.txt @@ -5,4 +5,6 @@ cmake_minimum_required(VERSION 3.16) include($ENV{IDF_PATH}/tools/cmake/project.cmake) + +idf_build_set_property(MINIMAL_BUILD ON) project(main) diff --git a/idf_component_examples/hw_cdc_hello_world/CMakeLists.txt b/idf_component_examples/hw_cdc_hello_world/CMakeLists.txt index 16bb1063af3..1c3971f4dbf 100644 --- a/idf_component_examples/hw_cdc_hello_world/CMakeLists.txt +++ b/idf_component_examples/hw_cdc_hello_world/CMakeLists.txt @@ -9,4 +9,5 @@ include($ENV{IDF_PATH}/tools/cmake/project.cmake) list(APPEND compile_definitions "ARDUINO_USB_CDC_ON_BOOT=1") list(APPEND compile_definitions "ARDUINO_USB_MODE=1") +idf_build_set_property(MINIMAL_BUILD ON) project(hw_cdc_hello_world) diff --git a/idf_component_examples/hw_cdc_hello_world/ci.json b/idf_component_examples/hw_cdc_hello_world/ci.json new file mode 100644 index 00000000000..80669afc2cc --- /dev/null +++ b/idf_component_examples/hw_cdc_hello_world/ci.json @@ -0,0 +1,5 @@ +{ + "requires": [ + "CONFIG_SOC_USB_SERIAL_JTAG_SUPPORTED=y" + ] +} diff --git a/libraries/ArduinoOTA/library.properties b/libraries/ArduinoOTA/library.properties index 0796eddf318..3a3f7e111e0 100644 --- a/libraries/ArduinoOTA/library.properties +++ b/libraries/ArduinoOTA/library.properties @@ -1,5 +1,5 @@ name=ArduinoOTA -version=3.2.0 +version=3.3.0 author=Ivan Grokhotkov and Hristo Gochkov maintainer=Hristo Gochkov sentence=Enables Over The Air upgrades, via wifi and espota.py UDP request/TCP download. diff --git a/libraries/AsyncUDP/library.properties b/libraries/AsyncUDP/library.properties index 116dcbacaa8..ddf9f79b6d9 100644 --- a/libraries/AsyncUDP/library.properties +++ b/libraries/AsyncUDP/library.properties @@ -1,5 +1,5 @@ name=ESP32 Async UDP -version=3.2.0 +version=3.3.0 author=Me-No-Dev maintainer=Me-No-Dev sentence=Async UDP Library for ESP32 diff --git a/libraries/BLE/library.properties b/libraries/BLE/library.properties index 7ef636223ec..816f67b67cb 100644 --- a/libraries/BLE/library.properties +++ b/libraries/BLE/library.properties @@ -1,5 +1,5 @@ name=BLE -version=3.2.0 +version=3.3.0 author=Neil Kolban maintainer=Dariusz Krempa sentence=BLE functions for ESP32 diff --git a/libraries/BluetoothSerial/library.properties b/libraries/BluetoothSerial/library.properties index 0a382410bba..49211bf3b63 100644 --- a/libraries/BluetoothSerial/library.properties +++ b/libraries/BluetoothSerial/library.properties @@ -1,5 +1,5 @@ name=BluetoothSerial -version=3.2.0 +version=3.3.0 author=Evandro Copercini maintainer=Evandro Copercini sentence=Simple UART to Classical Bluetooth bridge for ESP32 diff --git a/libraries/DNSServer/library.properties b/libraries/DNSServer/library.properties index 5e70a6ec03a..c193b919d02 100644 --- a/libraries/DNSServer/library.properties +++ b/libraries/DNSServer/library.properties @@ -1,5 +1,5 @@ name=DNSServer -version=3.2.0 +version=3.3.0 author=Kristijan Novoselić maintainer=Kristijan Novoselić, sentence=A simple DNS server for ESP32. diff --git a/libraries/EEPROM/library.properties b/libraries/EEPROM/library.properties index c7e48501c04..6d69f52a085 100644 --- a/libraries/EEPROM/library.properties +++ b/libraries/EEPROM/library.properties @@ -1,5 +1,5 @@ name=EEPROM -version=3.2.0 +version=3.3.0 author=Ivan Grokhotkov maintainer=Paolo Becchi sentence=Enables reading and writing data a sequential, addressable FLASH storage diff --git a/libraries/ESP32/examples/DeepSleep/ExternalWakeUp/ci.json b/libraries/ESP32/examples/DeepSleep/ExternalWakeUp/ci.json index cd679adefad..dfd49d94fe9 100644 --- a/libraries/ESP32/examples/DeepSleep/ExternalWakeUp/ci.json +++ b/libraries/ESP32/examples/DeepSleep/ExternalWakeUp/ci.json @@ -3,6 +3,7 @@ "esp32c3": false, "esp32c6": false, "esp32h2": false, - "esp32p4": false + "esp32p4": false, + "esp32c5": false } } diff --git a/libraries/ESP32/examples/DeepSleep/SmoothBlink_ULP_Code/ci.json b/libraries/ESP32/examples/DeepSleep/SmoothBlink_ULP_Code/ci.json index 6afa60f44c4..5fa2bd14e5d 100644 --- a/libraries/ESP32/examples/DeepSleep/SmoothBlink_ULP_Code/ci.json +++ b/libraries/ESP32/examples/DeepSleep/SmoothBlink_ULP_Code/ci.json @@ -5,6 +5,7 @@ "esp32h2": false, "esp32p4": false, "esp32s2": false, - "esp32s3": false + "esp32s3": false, + "esp32c5": false } } diff --git a/libraries/ESP32/examples/DeepSleep/TouchWakeUp/TouchWakeUp.ino b/libraries/ESP32/examples/DeepSleep/TouchWakeUp/TouchWakeUp.ino index 9d2b248ba44..5b1e0e9e115 100644 --- a/libraries/ESP32/examples/DeepSleep/TouchWakeUp/TouchWakeUp.ino +++ b/libraries/ESP32/examples/DeepSleep/TouchWakeUp/TouchWakeUp.ino @@ -48,7 +48,7 @@ Method to print the touchpad by which ESP32 has been awaken from sleep */ void print_wakeup_touchpad() { - touchPin = esp_sleep_get_touchpad_wakeup_status(); + touchPin = (touch_pad_t)esp_sleep_get_touchpad_wakeup_status(); #if CONFIG_IDF_TARGET_ESP32 switch (touchPin) { diff --git a/libraries/ESP32/examples/DeepSleep/TouchWakeUp/ci.json b/libraries/ESP32/examples/DeepSleep/TouchWakeUp/ci.json index 25c42144223..ae65fa0df74 100644 --- a/libraries/ESP32/examples/DeepSleep/TouchWakeUp/ci.json +++ b/libraries/ESP32/examples/DeepSleep/TouchWakeUp/ci.json @@ -2,6 +2,7 @@ "targets": { "esp32c3": false, "esp32c6": false, - "esp32h2": false + "esp32h2": false, + "esp32c5": false } } diff --git a/libraries/ESP32/examples/RMT/RMTLoopback/RMTLoopback.ino b/libraries/ESP32/examples/RMT/RMTLoopback/RMTLoopback.ino index 17e7af290bf..088f5044f65 100644 --- a/libraries/ESP32/examples/RMT/RMTLoopback/RMTLoopback.ino +++ b/libraries/ESP32/examples/RMT/RMTLoopback/RMTLoopback.ino @@ -1,4 +1,4 @@ -// Copyright 2023 Espressif Systems (Shanghai) PTE LTD +// Copyright 2025 Espressif Systems (Shanghai) PTE LTD // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -21,7 +21,7 @@ * */ -#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32C5 // ESP32 C3 has only 2 channels for RX and 2 for TX, thus MAX RMT_MEM is 128 #define RMT_TX_PIN 4 #define RMT_RX_PIN 5 @@ -35,14 +35,11 @@ rmt_data_t my_data[256]; rmt_data_t data[256]; -static EventGroupHandle_t events; - #define RMT_FREQ 10000000 // tick time is 100ns -#define RMT_NUM_EXCHANGED_DATA 30 +#define RMT_NUM_EXCHANGED_DATA 32 void setup() { Serial.begin(115200); - events = xEventGroupCreate(); if (!rmtInit(RMT_TX_PIN, RMT_TX_MODE, RMT_MEM_NUM_BLOCKS_1, RMT_FREQ)) { Serial.println("init sender failed\n"); @@ -50,25 +47,41 @@ void setup() { if (!rmtInit(RMT_RX_PIN, RMT_RX_MODE, RMT_MEM_RX, RMT_FREQ)) { Serial.println("init receiver failed\n"); } + Serial.println(); + Serial.println("RMT tick set to: 100ns"); // End of transmission shall be detected when line is idle for 2us = 20*100ns rmtSetRxMaxThreshold(RMT_RX_PIN, 20); // Disable Glitch filter rmtSetRxMinThreshold(RMT_RX_PIN, 0); - Serial.println("real tick set to: 100ns"); - Serial.printf("\nPlease connect GPIO %d to GPIO %d, now.\n", RMT_TX_PIN, RMT_RX_PIN); -} - -void loop() { - // Init data - int i; - for (i = 0; i < 255; i++) { - data[i].val = 0x80010001 + ((i % 13) << 16) + 13 - (i % 13); + // create multiple pulses with different width to be sent + for (int i = 0; i < 255; i++) { + data[i].level0 = 1; // HIGH + data[i].duration0 = 1 + 13 - (i % 13); // number of Tick on High + data[i].level1 = 0; // LOW + data[i].duration1 = 1 + (i % 13); // number of Ticks on Low my_data[i].val = 0; } data[255].val = 0; + Serial.println(); + Serial.println("===================================================================================================="); + Serial.println("Preloaded Data that will sent (time in 0.1us):"); + // Printout the received data plus the original values + for (int i = 0; i < RMT_NUM_EXCHANGED_DATA; i++) { + Serial.printf("%08lx=[%c 0x%02x|%c 0x%02x] ", data[i].val, data[i].level0 ? 'H' : 'L', data[i].duration0, data[i].level1 ? 'H' : 'L', data[i].duration1); + if (!((i + 1) % 4)) { + Serial.println(); + } + } + Serial.println("===================================================================================================="); + Serial.printf("Please connect GPIO %d to GPIO %d, now.", RMT_TX_PIN, RMT_RX_PIN); + Serial.println(); + Serial.println(); +} + +void loop() { // Start an async data read size_t rx_num_symbols = RMT_NUM_EXCHANGED_DATA; rmtReadAsync(RMT_RX_PIN, my_data, &rx_num_symbols); @@ -84,13 +97,13 @@ void loop() { Serial.printf("Got %d RMT symbols\n", rx_num_symbols); // Printout the received data plus the original values - for (i = 0; i < 60; i++) { + for (int i = 0; i < RMT_NUM_EXCHANGED_DATA; i++) { Serial.printf("%08lx=%08lx ", my_data[i].val, data[i].val); if (!((i + 1) % 4)) { - Serial.println(""); + Serial.println(); } } - Serial.println("\n"); + Serial.println(); - delay(500); + delay(2000); } diff --git a/libraries/ESP32/examples/RMT/RMT_LED_Blink/RMT_LED_Blink.ino b/libraries/ESP32/examples/RMT/RMT_LED_Blink/RMT_LED_Blink.ino index 8c2b8db3cd1..1cdd2224ea5 100644 --- a/libraries/ESP32/examples/RMT/RMT_LED_Blink/RMT_LED_Blink.ino +++ b/libraries/ESP32/examples/RMT/RMT_LED_Blink/RMT_LED_Blink.ino @@ -1,4 +1,4 @@ -// Copyright 2023 Espressif Systems (Shanghai) PTE LTD +// Copyright 2025 Espressif Systems (Shanghai) PTE LTD // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -13,16 +13,16 @@ // limitations under the License. /** - * @brief This example demonstrate how to use RMT to just blink a regular LED (GPIO) - * It uses all the different RMT Writing APIs to blink the LED by hardware, not being - * necessary the regular Blink code in Arduino. - * - * The output is the Blinking LED in the GPIO and a serial output describing what is - * going on, along the execution. - * - * The circuit is just a LED and a resistor of 270 ohms connected to the GPIO - * GPIO ---> resistor 270 ohms ---> + LED - ---> GND - */ + @brief This example demonstrate how to use RMT to just blink a regular LED (GPIO) + It uses all the different RMT Writing APIs to blink the LED by hardware, not being + necessary the regular Blink code in Arduino. + + The output is the Blinking LED in the GPIO and a serial output describing what is + going on, along the execution. + + The circuit is just a LED and a resistor of 270 ohms connected to the GPIO + GPIO ---> resistor 270 ohms ---> + LED - ---> GND +*/ #define BLINK_GPIO 2 @@ -232,7 +232,7 @@ void RMT_Mixed_Write_Blink() { Serial.println("===> rmtWrite() (Blocking Mode) to Blink the LED."); Serial.println("Blinking at 500ms on + 500ms off :: 4 blinks"); for (uint8_t i = 0; i < 4; i++) { - if (!rmtWrite(BLINK_GPIO, blink_500ms_rmt_data, RMT_SYMBOLS_OF(blink_500ms_rmt_data) - 2, RMT_WAIT_FOR_EVER)) { + if (!rmtWrite(BLINK_GPIO, blink_500ms_rmt_data, RMT_SYMBOLS_OF(blink_500ms_rmt_data) - 1, RMT_WAIT_FOR_EVER)) { Serial.println("===> rmtWrite Blink 0.5s Error!"); } } @@ -240,7 +240,7 @@ void RMT_Mixed_Write_Blink() { Serial.println("===> rmtWriteAsync() (Non-Blocking Mode) to Blink the LED."); Serial.println("Blinking at 250ms on + 250ms off :: 5 blinks"); for (uint8_t i = 0; i < 5; i++) { - if (!rmtWriteAsync(BLINK_GPIO, blink_250ms_rmt_data, RMT_SYMBOLS_OF(blink_250ms_rmt_data) - 2)) { + if (!rmtWriteAsync(BLINK_GPIO, blink_250ms_rmt_data, RMT_SYMBOLS_OF(blink_250ms_rmt_data) - 1)) { Serial.println("===> rmtWrite Blink 0.25s Error!"); } // wait (blocks) until all the data is sent out @@ -267,9 +267,11 @@ void RMT_Loop_Write_Blink() { Serial.println("===> rmtWriteLooping Blink 0.25s Error!"); } delay(5000); + Serial.println("Blinking OFF for 2 seconds"); - if (!rmtWriteLooping(BLINK_GPIO, NULL, 0)) { - Serial.println("===> rmtWriteLooping Blink OFF Error!"); + rmt_data_t blink_STOP_rmt_data[] = {{0, 0, 0, 0}}; + if (!rmtWrite(BLINK_GPIO, blink_STOP_rmt_data, RMT_SYMBOLS_OF(blink_STOP_rmt_data), RMT_WAIT_FOR_EVER)) { + Serial.println("===> rmtWrite Blink STOP Error!"); } delay(2000); } @@ -278,19 +280,19 @@ void RMT_Single_Write_Blocking_Blink() { Serial.println("Using RMT Writing and its Completion to blink an LED."); Serial.println("Blinking at 1s on + 1s off :: 2 blinks"); for (uint8_t i = 0; i < 2; i++) { - if (!rmtWrite(BLINK_GPIO, blink_1s_rmt_data, RMT_SYMBOLS_OF(blink_1s_rmt_data) - 2, RMT_WAIT_FOR_EVER)) { + if (!rmtWrite(BLINK_GPIO, blink_1s_rmt_data, RMT_SYMBOLS_OF(blink_1s_rmt_data) - 1, RMT_WAIT_FOR_EVER)) { Serial.println("===> rmtWrite Blink 1s Error!"); } } Serial.println("Blinking at 500ms on + 500ms off :: 4 blinks"); for (uint8_t i = 0; i < 4; i++) { - if (!rmtWrite(BLINK_GPIO, blink_500ms_rmt_data, RMT_SYMBOLS_OF(blink_500ms_rmt_data) - 2, RMT_WAIT_FOR_EVER)) { + if (!rmtWrite(BLINK_GPIO, blink_500ms_rmt_data, RMT_SYMBOLS_OF(blink_500ms_rmt_data) - 1, RMT_WAIT_FOR_EVER)) { Serial.println("===> rmtWrite Blink 0.5s Error!"); } } Serial.println("Blinking at 250ms on + 250ms off :: 8 blinks"); for (uint8_t i = 0; i < 8; i++) { - if (!rmtWrite(BLINK_GPIO, blink_250ms_rmt_data, RMT_SYMBOLS_OF(blink_250ms_rmt_data) - 2, RMT_WAIT_FOR_EVER)) { + if (!rmtWrite(BLINK_GPIO, blink_250ms_rmt_data, RMT_SYMBOLS_OF(blink_250ms_rmt_data) - 1, RMT_WAIT_FOR_EVER)) { Serial.println("===> rmtWrite Blink 0.25s Error!"); } } @@ -302,7 +304,7 @@ void RMT_Write_Aync_Non_Blocking_Blink() { Serial.println("Using RMT Async Writing and its Completion to blink an LED."); Serial.println("Blinking at 1s on + 1s off :: 5 blinks"); for (uint8_t i = 0; i < 5; i++) { - if (!rmtWriteAsync(BLINK_GPIO, blink_1s_rmt_data, RMT_SYMBOLS_OF(blink_1s_rmt_data) - 2)) { + if (!rmtWriteAsync(BLINK_GPIO, blink_1s_rmt_data, RMT_SYMBOLS_OF(blink_1s_rmt_data) - 1)) { Serial.println("===> rmtWrite Blink 1s Error!"); } // wait (blocks) until all the data is sent out @@ -310,7 +312,7 @@ void RMT_Write_Aync_Non_Blocking_Blink() { } Serial.println("Blinking at 500ms on + 500ms off :: 5 blinks"); for (uint8_t i = 0; i < 5; i++) { - if (!rmtWriteAsync(BLINK_GPIO, blink_500ms_rmt_data, RMT_SYMBOLS_OF(blink_500ms_rmt_data) - 2)) { + if (!rmtWriteAsync(BLINK_GPIO, blink_500ms_rmt_data, RMT_SYMBOLS_OF(blink_500ms_rmt_data) - 1)) { Serial.println("===> rmtWrite Blink 0.5s Error!"); } // wait (blocks) until all the data is sent out @@ -318,7 +320,7 @@ void RMT_Write_Aync_Non_Blocking_Blink() { } Serial.println("Blinking at 250ms on + 250ms off :: 5 blinks"); for (uint8_t i = 0; i < 5; i++) { - if (!rmtWriteAsync(BLINK_GPIO, blink_250ms_rmt_data, RMT_SYMBOLS_OF(blink_250ms_rmt_data) - 2)) { + if (!rmtWriteAsync(BLINK_GPIO, blink_250ms_rmt_data, RMT_SYMBOLS_OF(blink_250ms_rmt_data) - 1)) { Serial.println("===> rmtWrite Blink 0.25s Error!"); } // wait (blocks) until all the data is sent out @@ -345,7 +347,6 @@ void setup() { RMT_Mixed_Write_Blink(); Serial.println("End of Mixed Calls testing"); - delay(1000); Serial.println("\n==============================="); Serial.println("Starting a Blinking sequence..."); diff --git a/libraries/ESP32/examples/ResetReason/ResetReason/ResetReason.ino b/libraries/ESP32/examples/ResetReason/ResetReason/ResetReason.ino index 0104c6422f2..ca7e15bf479 100644 --- a/libraries/ESP32/examples/ResetReason/ResetReason/ResetReason.ino +++ b/libraries/ESP32/examples/ResetReason/ResetReason/ResetReason.ino @@ -28,6 +28,8 @@ #include "esp32h2/rom/rtc.h" #elif CONFIG_IDF_TARGET_ESP32P4 #include "esp32p4/rom/rtc.h" +#elif CONFIG_IDF_TARGET_ESP32C5 +#include "esp32c5/rom/rtc.h" #else #error Target CONFIG_IDF_TARGET is not supported #endif diff --git a/libraries/ESP32/examples/Serial/RxTimeout_Demo/RxTimeout_Demo.ino b/libraries/ESP32/examples/Serial/RxTimeout_Demo/RxTimeout_Demo.ino index 64d15d3d916..35d2da5c199 100644 --- a/libraries/ESP32/examples/Serial/RxTimeout_Demo/RxTimeout_Demo.ino +++ b/libraries/ESP32/examples/Serial/RxTimeout_Demo/RxTimeout_Demo.ino @@ -21,6 +21,15 @@ If UART receives less than 120 bytes, it will wait RX Timeout to understand that the bus is IDLE and then copy the data from the FIFO to the Arduino internal buffer, making it available to the Arduino API. + There is an important detail about how HardwareSerial works using ESP32 and ESP32-S2: + If the baud rate is lower than 250,000, it will select REF_TICK as clock source in order to avoid that + the baud rate may change when the CPU Frequency is changed. Default UART clock source is APB, which changes + when CPU clock source is also changed. But when it selects REF_TICK as UART clock source, RX Timeout is limited to 1. + Therefore, in order to change the ESP32/ESP32-S2 RX Timeout it is necessary to fix the UART Clock Source to APB. + + In the case of the other SoC, such as ESP32-S3, C3, C6, H2 and P4, there is no such RX Timeout limitation. + Those will set the UART Source Clock as XTAL, which allows the baud rate to be high and it is steady, not + changing with the CPU Frequency. */ #include @@ -45,6 +54,12 @@ void setup() { // UART1 will have its RX<->TX cross connected // GPIO4 <--> GPIO5 using external wire +#if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32S2 + // UART_CLK_SRC_APB will allow higher values of RX Timeout + // default for ESP32 and ESP32-S2 is REF_TICK which limits the RX Timeout to 1 + // setClockSource() must be called before begin() + Serial1.setClockSource(UART_CLK_SRC_APB); +#endif Serial1.begin(BAUD, SERIAL_8N1, RXPIN, TXPIN); // Rx = 4, Tx = 5 will work for ESP32, S2, S3 and C3 #if USE_INTERNAL_PIN_LOOPBACK uart_internal_loopback(TEST_UART, RXPIN); diff --git a/libraries/ESP32/examples/Serial/onReceiveExample/onReceiveExample.ino b/libraries/ESP32/examples/Serial/onReceiveExample/onReceiveExample.ino index fe66b07b875..17d800b3b39 100644 --- a/libraries/ESP32/examples/Serial/onReceiveExample/onReceiveExample.ino +++ b/libraries/ESP32/examples/Serial/onReceiveExample/onReceiveExample.ino @@ -5,20 +5,20 @@ void HardwareSerial::onReceive(OnReceiveCb function, bool onlyOnTimeout = false) It is possible to register an UART callback function that will be called - every time that UART receives data and an associated interrupt is generated. + every time that UART receives data and an associated UART interrupt is generated. - In summary, HardwareSerial::onReceive() works like an RX Interrupt callback, that can be adjusted - using HardwareSerial::setRxFIFOFull() and HardwareSerial::setRxTimeout(). + In summary, HardwareSerial::onReceive() works like an RX Interrupt callback, that + can be adjusted using HardwareSerial::setRxFIFOFull() and HardwareSerial::setRxTimeout(). - OnReceive will be called, while receiving a stream of data, when every 120 bytes are received (default FIFO Full), - which may not help in case that the application needs to get all data at once before processing it. - Therefore, a way to make it work is by detecting the end of a stream transmission. This can be based on a protocol - or based on timeout with the UART line in idle (no data received - this is the case of this example). + In case that is not changed or it is set to , the callback function is + executed whenever any event happens first (FIFO Full or RX Timeout). + OnReceive will be called when every 120 bytes are received(default FIFO Full), + or when RX Timeout occurs after 1 UART symbol by default. - In some cases, it is necessary to wait for receiving all the data before processing it and parsing the - UART input. This example demonstrates a way to create a String with all data received from UART0 and - signaling it using a Mutex for another task to process it. This example uses a timeout of 500ms as a way to - know when the reception of data has finished. + This example demonstrates a way to create a String with all data received from UART0 only + after RX Timeout. This example uses an RX timeout of about 3.5 Symbols as a way to know + when the reception of data has finished. + In order to achieve it, the sketch sets to . The onReceive() callback is called whenever the RX ISR is triggered. It can occur because of two possible events: @@ -34,90 +34,73 @@ 2- UART RX Timeout: it happens, based on a timeout equivalent to a number of symbols at the current baud rate. If the UART line is idle for this timeout, it will raise an interrupt. - This time can be changed by HardwareSerial::setRxTimeout(uint8_t rxTimeout) + This time can be changed by HardwareSerial::setRxTimeout(uint8_t rxTimeout). + is bound to the clock source. + In order to use it properly, ESP32 and ESP32-S2 shall set the UART Clock Source to APB. When any of those two interrupts occur, IDF UART driver will copy FIFO data to its internal RingBuffer and then Arduino can read such data. At the same time, Arduino Layer will execute the callback function defined with HardwareSerial::onReceive(). - parameter (default false) can be used by the application to tell Arduino to - only execute the callback when the second event above happens (Rx Timeout). At this time all - received data will be available to be read by the Arduino application. But if the number of - received bytes is higher than the FIFO space, it will generate an error of FIFO overflow. - In order to avoid such problem, the application shall set an appropriate RX buffer size using + parameter can be used by the application to tell Arduino to only execute + the callback when Rx Timeout happens, by setting it to . + At this time all received data will be available to be read by the Arduino application. + The application shall set an appropriate RX buffer size using HardwareSerial::setRxBufferSize(size_t new_size) before executing begin() for the Serial port. -*/ -// this will make UART0 work in any case (using or not USB) -#if ARDUINO_USB_CDC_ON_BOOT -#define UART0 Serial0 -#else -#define UART0 Serial -#endif + MODBUS timeout of 3.5 symbol is based on these documents: + https://www.automation.com/en-us/articles/2012-1/introduction-to-modbus + https://minimalmodbus.readthedocs.io/en/stable/serialcommunication.html +*/ // global variable to keep the results from onReceive() String uart_buffer = ""; -// a pause of a half second in the UART transmission is considered the end of transmission. -const uint32_t communicationTimeout_ms = 500; - -// Create a mutex for the access to uart_buffer -// only one task can read/write it at a certain time -SemaphoreHandle_t uart_buffer_Mutex = NULL; - -// UART_RX_IRQ will be executed as soon as data is received by the UART -// This is a callback function executed from a high priority -// task created when onReceive() is used +// The Modbus RTU standard prescribes a silent period corresponding to 3.5 characters between each +// message, to be able to figure out where one message ends and the next one starts. +const uint32_t modbusRxTimeoutLimit = 4; +const uint32_t baudrate = 19200; + +// UART_RX_IRQ will be executed as soon as data is received by the UART and an RX Timeout occurs +// This is a callback function executed from a high priority monitor task +// All data will be buffered into RX Buffer, which may have its size set to whatever necessary void UART0_RX_CB() { - // take the mutex, waits forever until loop() finishes its processing - if (xSemaphoreTake(uart_buffer_Mutex, portMAX_DELAY)) { - uint32_t now = millis(); // tracks timeout - while ((millis() - now) < communicationTimeout_ms) { - if (UART0.available()) { - uart_buffer += (char)UART0.read(); - now = millis(); // reset the timer - } - } - // releases the mutex for data processing - xSemaphoreGive(uart_buffer_Mutex); + while (Serial0.available()) { + uart_buffer += (char)Serial0.read(); } } // setup() and loop() are functions executed by a low priority task // Therefore, there are 2 tasks running when using onReceive() void setup() { - UART0.begin(115200); - - // creates a mutex object to control access to uart_buffer - uart_buffer_Mutex = xSemaphoreCreateMutex(); - if (uart_buffer_Mutex == NULL) { - log_e("Error creating Mutex. Sketch will fail."); - while (true) { - UART0.println("Mutex error (NULL). Program halted."); - delay(2000); - } - } - - UART0.onReceive(UART0_RX_CB); // sets the callback function - UART0.println("Send data to UART0 in order to activate the RX callback"); + // Using Serial0 will work in any case (using or not USB CDC on Boot) +#if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32S2 + // UART_CLK_SRC_APB will allow higher values of RX Timeout + // default for ESP32 and ESP32-S2 is REF_TICK which limits the RX Timeout to 1 + // setClockSource() must be called before begin() + Serial0.setClockSource(UART_CLK_SRC_APB); +#endif + // the amount of data received or waiting to be proessed shall not exceed this limit of 1024 bytes + Serial0.setRxBufferSize(1024); // default is 256 bytes + Serial0.begin(baudrate); // default pins and default mode 8N1 (8 bits data, no parity bit, 1 stopbit) + // set RX Timeout based on UART symbols ~ 3.5 symbols of 11 bits (MODBUS standard) ~= 2 ms at 19200 + Serial0.setRxTimeout(modbusRxTimeoutLimit); // 4 symbols at 19200 8N1 is about 2.08 ms (40 bits) + // sets the callback function that will be executed only after RX Timeout + Serial0.onReceive(UART0_RX_CB, true); + Serial0.println("Send data using Serial Monitor in order to activate the RX callback"); } uint32_t counter = 0; void loop() { + // String is filled by the UART Callback whenever data is received and RX Timeout occurs if (uart_buffer.length() > 0) { - // signals that the onReceive function shall not change uart_buffer while processing - if (xSemaphoreTake(uart_buffer_Mutex, portMAX_DELAY)) { - // process the received data from UART0 - example, just print it beside a counter - UART0.print("["); - UART0.print(counter++); - UART0.print("] ["); - UART0.print(uart_buffer.length()); - UART0.print(" bytes] "); - UART0.println(uart_buffer); - uart_buffer = ""; // reset uart_buffer for the next UART reading - // releases the mutex for more data to be received - xSemaphoreGive(uart_buffer_Mutex); - } + // process the received data from Serial - example, just print it beside a counter + Serial0.print("["); + Serial0.print(counter++); + Serial0.print("] ["); + Serial0.print(uart_buffer.length()); + Serial0.print(" bytes] "); + Serial0.println(uart_buffer); + uart_buffer = ""; // reset uart_buffer for the next UART reading } - UART0.println("Sleeping for 1 second..."); - delay(1000); + delay(1); } diff --git a/libraries/ESP32/examples/TWAI/TWAIreceive/ci.json b/libraries/ESP32/examples/TWAI/TWAIreceive/ci.json new file mode 100644 index 00000000000..7379dba8bb9 --- /dev/null +++ b/libraries/ESP32/examples/TWAI/TWAIreceive/ci.json @@ -0,0 +1,5 @@ +{ + "targets": { + "esp32c5": false + } +} diff --git a/libraries/ESP32/examples/TWAI/TWAItransmit/ci.json b/libraries/ESP32/examples/TWAI/TWAItransmit/ci.json new file mode 100644 index 00000000000..7379dba8bb9 --- /dev/null +++ b/libraries/ESP32/examples/TWAI/TWAItransmit/ci.json @@ -0,0 +1,5 @@ +{ + "targets": { + "esp32c5": false + } +} diff --git a/libraries/ESP32/library.properties b/libraries/ESP32/library.properties index 7ebc69be71f..e664022388d 100644 --- a/libraries/ESP32/library.properties +++ b/libraries/ESP32/library.properties @@ -1,5 +1,5 @@ name=ESP32 -version=3.2.0 +version=3.3.0 author=Hristo Gochkov, Ivan Grokhtkov maintainer=Hristo Gochkov sentence=ESP32 sketches examples diff --git a/libraries/ESP_I2S/library.properties b/libraries/ESP_I2S/library.properties index 263e9823275..b2763f4e7e8 100644 --- a/libraries/ESP_I2S/library.properties +++ b/libraries/ESP_I2S/library.properties @@ -1,5 +1,5 @@ name=ESP_I2S -version=3.2.0 +version=3.3.0 author=me-no-dev maintainer=me-no-dev sentence=Library for ESP I2S communication diff --git a/libraries/ESP_NOW/library.properties b/libraries/ESP_NOW/library.properties index f3e5c109a9b..f8e627dbc03 100644 --- a/libraries/ESP_NOW/library.properties +++ b/libraries/ESP_NOW/library.properties @@ -1,5 +1,5 @@ name=ESP_NOW -version=3.2.0 +version=3.3.0 author=me-no-dev maintainer=P-R-O-C-H-Y sentence=Library for ESP_NOW diff --git a/libraries/ESP_NOW/src/ESP32_NOW.cpp b/libraries/ESP_NOW/src/ESP32_NOW.cpp index 6fd3ff0a0b1..83fec4c4529 100644 --- a/libraries/ESP_NOW/src/ESP32_NOW.cpp +++ b/libraries/ESP_NOW/src/ESP32_NOW.cpp @@ -129,7 +129,12 @@ static void _esp_now_rx_cb(const esp_now_recv_info_t *info, const uint8_t *data, } } +#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 5, 0) +static void _esp_now_tx_cb(const esp_now_send_info_t *tx_info, esp_now_send_status_t status) { + const uint8_t *mac_addr = tx_info->des_addr; +#else static void _esp_now_tx_cb(const uint8_t *mac_addr, esp_now_send_status_t status) { +#endif log_v(MACSTR " : %s", MAC2STR(mac_addr), (status == ESP_NOW_SEND_SUCCESS) ? "SUCCESS" : "FAILED"); //find the peer and call it's callback for (uint8_t i = 0; i < ESP_NOW_MAX_TOTAL_PEER_NUM; i++) { diff --git a/libraries/ESP_SR/examples/Basic/ci.json b/libraries/ESP_SR/examples/Basic/ci.json index c395378f45e..ec0e969a7d0 100644 --- a/libraries/ESP_SR/examples/Basic/ci.json +++ b/libraries/ESP_SR/examples/Basic/ci.json @@ -13,6 +13,7 @@ "esp32c6": false, "esp32h2": false, "esp32p4": false, - "esp32s2": false + "esp32s2": false, + "esp32c5": false } } diff --git a/libraries/ESP_SR/library.properties b/libraries/ESP_SR/library.properties index 295761bd9fb..9d9787b7931 100644 --- a/libraries/ESP_SR/library.properties +++ b/libraries/ESP_SR/library.properties @@ -1,5 +1,5 @@ name=ESP_SR -version=3.2.0 +version=3.3.0 author=me-no-dev maintainer=me-no-dev sentence=Library for ESP Sound Recognition diff --git a/libraries/ESPmDNS/library.properties b/libraries/ESPmDNS/library.properties index 6d36d61b783..062d3b90b51 100644 --- a/libraries/ESPmDNS/library.properties +++ b/libraries/ESPmDNS/library.properties @@ -1,5 +1,5 @@ name=ESPmDNS -version=3.2.0 +version=3.3.0 author=Hristo Gochkov, Ivan Grokhtkov maintainer=Hristo Gochkov sentence=ESP32 mDNS Library diff --git a/libraries/Ethernet/library.properties b/libraries/Ethernet/library.properties index d34ae036417..28f2a8697d9 100644 --- a/libraries/Ethernet/library.properties +++ b/libraries/Ethernet/library.properties @@ -1,5 +1,5 @@ name=Ethernet -version=3.2.0 +version=3.3.0 author=Hristo Gochkov maintainer=Hristo Gochkov sentence=Enables network connection (local and Internet) using the ESP32 Ethernet. diff --git a/libraries/FFat/library.properties b/libraries/FFat/library.properties index 35940fd5472..25b8c4e8acd 100644 --- a/libraries/FFat/library.properties +++ b/libraries/FFat/library.properties @@ -1,5 +1,5 @@ name=FFat -version=3.2.0 +version=3.3.0 author=Hristo Gochkov, Ivan Grokhtkov, Larry Bernstone maintainer=Hristo Gochkov sentence=ESP32 FAT on Flash File System diff --git a/libraries/FS/library.properties b/libraries/FS/library.properties index 07bd296bb83..0f05f1134d5 100644 --- a/libraries/FS/library.properties +++ b/libraries/FS/library.properties @@ -1,5 +1,5 @@ name=FS -version=3.2.0 +version=3.3.0 author=Hristo Gochkov, Ivan Grokhtkov maintainer=Hristo Gochkov sentence=ESP32 File System diff --git a/libraries/HTTPClient/library.properties b/libraries/HTTPClient/library.properties index f2dafc36d1b..bb5b0936255 100644 --- a/libraries/HTTPClient/library.properties +++ b/libraries/HTTPClient/library.properties @@ -1,5 +1,5 @@ name=HTTPClient -version=3.2.0 +version=3.3.0 author=Markus Sattler maintainer=Markus Sattler sentence=HTTP Client for ESP32 diff --git a/libraries/HTTPUpdate/library.properties b/libraries/HTTPUpdate/library.properties index 419f3b97b3f..88466a3a72e 100644 --- a/libraries/HTTPUpdate/library.properties +++ b/libraries/HTTPUpdate/library.properties @@ -1,5 +1,5 @@ name=HTTPUpdate -version=3.2.0 +version=3.3.0 author=Markus Sattler maintainer=Markus Sattler sentence=Http Update for ESP32 diff --git a/libraries/HTTPUpdateServer/library.properties b/libraries/HTTPUpdateServer/library.properties index 9c793a26ac8..c182eeb8d7f 100644 --- a/libraries/HTTPUpdateServer/library.properties +++ b/libraries/HTTPUpdateServer/library.properties @@ -1,5 +1,5 @@ name=HTTPUpdateServer -version=3.2.0 +version=3.3.0 author=Hristo Kapanakov maintainer= sentence=Simple HTTP Update server based on the WebServer diff --git a/libraries/Insights/library.properties b/libraries/Insights/library.properties index fefe5aab177..3ef98d25be6 100644 --- a/libraries/Insights/library.properties +++ b/libraries/Insights/library.properties @@ -1,5 +1,5 @@ name=ESP Insights -version=3.2.0 +version=3.3.0 author=Sanket Wadekar maintainer=Sanket Wadekar sentence=ESP Insights diff --git a/libraries/LittleFS/library.properties b/libraries/LittleFS/library.properties index a9dae69b7f8..202d8ad4a6d 100644 --- a/libraries/LittleFS/library.properties +++ b/libraries/LittleFS/library.properties @@ -1,5 +1,5 @@ name=LittleFS -version=3.2.0 +version=3.3.0 author= maintainer= sentence=LittleFS for esp32 diff --git a/libraries/Matter/library.properties b/libraries/Matter/library.properties index ac9e0964ab5..0b140bfa169 100644 --- a/libraries/Matter/library.properties +++ b/libraries/Matter/library.properties @@ -1,5 +1,5 @@ name=Matter -version=3.2.0 +version=3.3.0 author=Rodrigo Garcia | GitHub @SuGlider maintainer=Rodrigo Garcia sentence=Library for supporting Matter environment on ESP32. diff --git a/libraries/NetBIOS/library.properties b/libraries/NetBIOS/library.properties index 5f134bfdc55..71d22d6f363 100644 --- a/libraries/NetBIOS/library.properties +++ b/libraries/NetBIOS/library.properties @@ -1,5 +1,5 @@ name=NetBIOS -version=3.2.0 +version=3.3.0 author=Pablo@xpablo.cz maintainer=Hristo Gochkov sentence=Enables NBNS (NetBIOS) name resolution. diff --git a/libraries/Network/library.properties b/libraries/Network/library.properties index 0b821e08d77..f7e04f4de3b 100644 --- a/libraries/Network/library.properties +++ b/libraries/Network/library.properties @@ -1,5 +1,5 @@ name=Networking -version=3.2.0 +version=3.3.0 author=Hristo Gochkov maintainer=Hristo Gochkov sentence=General network management library. diff --git a/libraries/NetworkClientSecure/library.properties b/libraries/NetworkClientSecure/library.properties index 455dea6a2bf..6ebf4c0ec70 100644 --- a/libraries/NetworkClientSecure/library.properties +++ b/libraries/NetworkClientSecure/library.properties @@ -1,5 +1,5 @@ name=NetworkClientSecure -version=3.2.0 +version=3.3.0 author=Evandro Luis Copercini maintainer=Github Community sentence=Enables secure network connection (local and Internet) using the ESP32 built-in WiFi. diff --git a/libraries/OpenThread/library.properties b/libraries/OpenThread/library.properties index 0e547d188aa..550d4eb1627 100644 --- a/libraries/OpenThread/library.properties +++ b/libraries/OpenThread/library.properties @@ -1,5 +1,5 @@ name=OpenThread -version=3.2.0 +version=3.3.0 author=Rodrigo Garcia | GitHub @SuGlider maintainer=Rodrigo Garcia sentence=Library for OpenThread Network on ESP32. diff --git a/libraries/PPP/library.properties b/libraries/PPP/library.properties index 7158a027b0a..537708b1261 100644 --- a/libraries/PPP/library.properties +++ b/libraries/PPP/library.properties @@ -1,5 +1,5 @@ name=PPP -version=3.2.0 +version=3.3.0 author=Hristo Gochkov maintainer=Hristo Gochkov sentence=Enables network connection using GSM Modem. diff --git a/libraries/Preferences/library.properties b/libraries/Preferences/library.properties index eb0158e4932..0a7e678aa6c 100644 --- a/libraries/Preferences/library.properties +++ b/libraries/Preferences/library.properties @@ -1,5 +1,5 @@ name=Preferences -version=3.2.0 +version=3.3.0 author=Hristo Gochkov maintainer=Hristo Gochkov sentence=Provides friendly access to ESP32's Non-Volatile Storage diff --git a/libraries/RainMaker/library.properties b/libraries/RainMaker/library.properties index 95ce14d6708..1d72a8faff5 100644 --- a/libraries/RainMaker/library.properties +++ b/libraries/RainMaker/library.properties @@ -1,5 +1,5 @@ name=ESP RainMaker -version=3.2.0 +version=3.3.0 author=Sweety Mhaiske maintainer=Hristo Gochkov sentence=ESP RainMaker Support diff --git a/libraries/SD/library.properties b/libraries/SD/library.properties index 66c4f5cfafd..9d868dce799 100644 --- a/libraries/SD/library.properties +++ b/libraries/SD/library.properties @@ -1,5 +1,5 @@ name=SD -version=3.2.0 +version=3.3.0 author=Arduino, SparkFun maintainer=Arduino sentence=Enables reading and writing on SD cards. For all Arduino boards. diff --git a/libraries/SD_MMC/library.properties b/libraries/SD_MMC/library.properties index 855390e5057..f96ee4377c2 100644 --- a/libraries/SD_MMC/library.properties +++ b/libraries/SD_MMC/library.properties @@ -1,5 +1,5 @@ name=SD_MMC -version=3.2.0 +version=3.3.0 author=Hristo Gochkov, Ivan Grokhtkov maintainer=Hristo Gochkov sentence=ESP32 SDMMC File System diff --git a/libraries/SPI/library.properties b/libraries/SPI/library.properties index 64db93aceeb..3403d1c5d4f 100644 --- a/libraries/SPI/library.properties +++ b/libraries/SPI/library.properties @@ -1,5 +1,5 @@ name=SPI -version=3.2.0 +version=3.3.0 author=Hristo Gochkov maintainer=Hristo Gochkov sentence=Enables the communication with devices that use the Serial Peripheral Interface (SPI) Bus. For all Arduino boards, BUT Arduino DUE. diff --git a/libraries/SPI/src/SPI.cpp b/libraries/SPI/src/SPI.cpp index 35e52f43e4d..77abb1eccaf 100644 --- a/libraries/SPI/src/SPI.cpp +++ b/libraries/SPI/src/SPI.cpp @@ -83,7 +83,7 @@ void SPIClass::begin(int8_t sck, int8_t miso, int8_t mosi, int8_t ss) { _miso = (_spi_num == FSPI) ? MISO : -1; _mosi = (_spi_num == FSPI) ? MOSI : -1; _ss = (_spi_num == FSPI) ? SS : -1; -#elif CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 +#elif CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32C5 _sck = SCK; _miso = MISO; _mosi = MOSI; @@ -144,6 +144,12 @@ void SPIClass::setHwCs(bool use) { _use_hw_ss = use; } +void SPIClass::setSSInvert(bool invert) { + if (_spi) { + spiSSInvert(_spi, invert); + } +} + void SPIClass::setFrequency(uint32_t freq) { SPI_PARAM_LOCK(); //check if last freq changed diff --git a/libraries/SPI/src/SPI.h b/libraries/SPI/src/SPI.h index adb3d1bc11f..628c2190f50 100644 --- a/libraries/SPI/src/SPI.h +++ b/libraries/SPI/src/SPI.h @@ -65,6 +65,7 @@ class SPIClass { void end(); void setHwCs(bool use); + void setSSInvert(bool invert); //use before setHwCS for change to be used by setHwCs void setBitOrder(uint8_t bitOrder); void setDataMode(uint8_t dataMode); void setFrequency(uint32_t freq); diff --git a/libraries/SPIFFS/library.properties b/libraries/SPIFFS/library.properties index 78f77fe9794..486ec1b4ce6 100644 --- a/libraries/SPIFFS/library.properties +++ b/libraries/SPIFFS/library.properties @@ -1,5 +1,5 @@ name=SPIFFS -version=3.2.0 +version=3.3.0 author=Hristo Gochkov, Ivan Grokhtkov maintainer=Hristo Gochkov sentence=ESP32 SPIFFS File System diff --git a/libraries/SimpleBLE/library.properties b/libraries/SimpleBLE/library.properties index ad5e10d3acb..a7f12207afe 100644 --- a/libraries/SimpleBLE/library.properties +++ b/libraries/SimpleBLE/library.properties @@ -1,5 +1,5 @@ name=SimpleBLE -version=3.2.0 +version=3.3.0 author=Hristo Gochkov maintainer=Hristo Gochkov sentence=Provides really simple BLE advertizer with just on and off diff --git a/libraries/TFLiteMicro/library.properties b/libraries/TFLiteMicro/library.properties index 1e8db045610..d2dc127f5ab 100644 --- a/libraries/TFLiteMicro/library.properties +++ b/libraries/TFLiteMicro/library.properties @@ -1,5 +1,5 @@ name=TFLite Micro -version=3.2.0 +version=3.3.0 author=Sanket Wadekar maintainer=Sanket Wadekar sentence=TensorFlow Lite for Microcontrollers diff --git a/libraries/Ticker/library.properties b/libraries/Ticker/library.properties index 975db96d1ad..8795deb22ce 100644 --- a/libraries/Ticker/library.properties +++ b/libraries/Ticker/library.properties @@ -1,5 +1,5 @@ name=Ticker -version=3.2.0 +version=3.3.0 author=Bert Melis maintainer=Hristo Gochkov sentence=Allows to call functions with a given interval. diff --git a/libraries/USB/library.properties b/libraries/USB/library.properties index 9d47dfc6719..4c2c032545e 100644 --- a/libraries/USB/library.properties +++ b/libraries/USB/library.properties @@ -1,5 +1,5 @@ name=USB -version=3.2.0 +version=3.3.0 author=Hristo Gochkov maintainer=Hristo Gochkov sentence=ESP32S2 USB Library diff --git a/libraries/USB/src/USBHIDConsumerControl.h b/libraries/USB/src/USBHIDConsumerControl.h index e65e529a77b..7a59c70b6b1 100644 --- a/libraries/USB/src/USBHIDConsumerControl.h +++ b/libraries/USB/src/USBHIDConsumerControl.h @@ -37,10 +37,14 @@ #define CONSUMER_CONTROL_WIRELESS_RADIO_SLIDER_SWITCH 0x00C8 // Media Control -#define CONSUMER_CONTROL_PLAY_PAUSE 0x00CD +#define CONSUMER_CONTROL_RECORD 0x00B2 +#define CONSUMER_CONTROL_FAST_FORWARD 0x00B3 +#define CONSUMER_CONTROL_REWIND 0x00B4 #define CONSUMER_CONTROL_SCAN_NEXT 0x00B5 #define CONSUMER_CONTROL_SCAN_PREVIOUS 0x00B6 #define CONSUMER_CONTROL_STOP 0x00B7 +#define CONSUMER_CONTROL_EJECT 0x00B8 +#define CONSUMER_CONTROL_PLAY_PAUSE 0x00CD #define CONSUMER_CONTROL_VOLUME 0x00E0 #define CONSUMER_CONTROL_MUTE 0x00E2 #define CONSUMER_CONTROL_BASS 0x00E3 diff --git a/libraries/USB/src/keyboardLayout/KeyboardLayout.h b/libraries/USB/src/keyboardLayout/KeyboardLayout.h index 0ef69dc7ab9..ee6b6b4e11e 100644 --- a/libraries/USB/src/keyboardLayout/KeyboardLayout.h +++ b/libraries/USB/src/keyboardLayout/KeyboardLayout.h @@ -5,7 +5,7 @@ only in Keyboard.cpp and the keyboard layout files. Layout files map ASCII character codes to keyboard scan codes (technically, to USB HID Usage codes), possibly altered by the SHIFT or ALT_GR modifiers. - Non-ACSII characters (anything outside the 7-bit range NUL..DEL) are + Non-ASCII characters (anything outside the 7-bit range NUL..DEL) are not supported. == Creating your own layout == diff --git a/libraries/Update/library.properties b/libraries/Update/library.properties index c3ee8f7e506..5fd633ec358 100644 --- a/libraries/Update/library.properties +++ b/libraries/Update/library.properties @@ -1,5 +1,5 @@ name=Update -version=3.2.0 +version=3.3.0 author=Hristo Gochkov maintainer=Hristo Gochkov sentence=ESP32 Sketch Update Library diff --git a/libraries/WebServer/library.properties b/libraries/WebServer/library.properties index 2a9ff530d57..913dd00e036 100644 --- a/libraries/WebServer/library.properties +++ b/libraries/WebServer/library.properties @@ -1,5 +1,5 @@ name=WebServer -version=3.2.0 +version=3.3.0 author=Ivan Grokhotkov maintainer=Ivan Grokhtkov sentence=Simple web server library diff --git a/libraries/WiFi/examples/WiFiScan/WiFiScan.ino b/libraries/WiFi/examples/WiFiScan/WiFiScan.ino index 15ce367c897..98733adb0bb 100644 --- a/libraries/WiFi/examples/WiFiScan/WiFiScan.ino +++ b/libraries/WiFi/examples/WiFiScan/WiFiScan.ino @@ -1,5 +1,5 @@ /* - * This sketch demonstrates how to scan WiFi networks. + * This sketch demonstrates how to scan WiFi networks. For chips that support 5GHz band, separate scans are done for all bands. * The API is based on the Arduino WiFi Shield library, but has significant changes as newer WiFi functions are supported. * E.g. the return value of `encryptionType()` different because more modern encryption is supported. */ @@ -7,18 +7,13 @@ void setup() { Serial.begin(115200); - - // Set WiFi to station mode and disconnect from an AP if it was previously connected. - WiFi.mode(WIFI_STA); - WiFi.disconnect(); - delay(100); - + // Enable Station Interface + WiFi.STA.begin(); Serial.println("Setup done"); } -void loop() { +void ScanWiFi() { Serial.println("Scan start"); - // WiFi.scanNetworks will return the number of networks found. int n = WiFi.scanNetworks(); Serial.println("Scan done"); @@ -54,11 +49,33 @@ void loop() { delay(10); } } - Serial.println(""); // Delete the scan result to free memory for code below. WiFi.scanDelete(); - + Serial.println("-------------------------------------"); +} +void loop() { + Serial.println("-------------------------------------"); + Serial.println("Default wifi band mode scan:"); + Serial.println("-------------------------------------"); + WiFi.setBandMode(WIFI_BAND_MODE_AUTO); + ScanWiFi(); +#if CONFIG_SOC_WIFI_SUPPORT_5G + // Wait a bit before scanning again. + delay(1000); + Serial.println("-------------------------------------"); + Serial.println("2.4 Ghz wifi band mode scan:"); + Serial.println("-------------------------------------"); + WiFi.setBandMode(WIFI_BAND_MODE_2G_ONLY); + ScanWiFi(); + // Wait a bit before scanning again. + delay(1000); + Serial.println("-------------------------------------"); + Serial.println("5 Ghz wifi band mode scan:"); + Serial.println("-------------------------------------"); + WiFi.setBandMode(WIFI_BAND_MODE_5G_ONLY); + ScanWiFi(); +#endif // Wait a bit before scanning again. - delay(5000); + delay(10000); } diff --git a/libraries/WiFi/library.properties b/libraries/WiFi/library.properties index 03112c2fcc6..82ccb32b702 100644 --- a/libraries/WiFi/library.properties +++ b/libraries/WiFi/library.properties @@ -1,5 +1,5 @@ name=WiFi -version=3.2.0 +version=3.3.0 author=Hristo Gochkov maintainer=Hristo Gochkov sentence=Enables network connection (local and Internet) using the ESP32 built-in WiFi. diff --git a/libraries/WiFi/src/WiFiGeneric.cpp b/libraries/WiFi/src/WiFiGeneric.cpp index aa994963514..e669ba81c12 100644 --- a/libraries/WiFi/src/WiFiGeneric.cpp +++ b/libraries/WiFi/src/WiFiGeneric.cpp @@ -378,6 +378,10 @@ static bool espWiFiStart() { log_e("esp_wifi_start 0x%x: %s", err, esp_err_to_name(err)); return _esp_wifi_started; } +#if SOC_WIFI_SUPPORT_5G + log_v("Setting Band Mode to AUTO"); + esp_wifi_set_band_mode(WIFI_BAND_MODE_AUTO); +#endif return _esp_wifi_started; } @@ -602,9 +606,9 @@ bool WiFiGenericClass::mode(wifi_mode_t m) { #else #define WIFI_PROTOCOL_DEFAULT (WIFI_PROTOCOL_11B | WIFI_PROTOCOL_11G | WIFI_PROTOCOL_11N) #endif - uint8_t current_protocol = 0; + uint32_t current_protocol = 0; if (m & WIFI_MODE_STA) { - err = esp_wifi_get_protocol(WIFI_IF_STA, ¤t_protocol); + err = esp_wifi_get_protocol(WIFI_IF_STA, (uint8_t *)¤t_protocol); if (err == ESP_OK && current_protocol == WIFI_PROTOCOL_LR) { log_v("Disabling long range on STA"); err = esp_wifi_set_protocol(WIFI_IF_STA, WIFI_PROTOCOL_DEFAULT); @@ -614,7 +618,7 @@ bool WiFiGenericClass::mode(wifi_mode_t m) { } } if (m & WIFI_MODE_AP) { - err = esp_wifi_get_protocol(WIFI_IF_AP, ¤t_protocol); + err = esp_wifi_get_protocol(WIFI_IF_AP, (uint8_t *)¤t_protocol); if (err == ESP_OK && current_protocol == WIFI_PROTOCOL_LR) { log_v("Disabling long range on AP"); err = esp_wifi_set_protocol(WIFI_IF_AP, WIFI_PROTOCOL_DEFAULT); @@ -729,6 +733,90 @@ wifi_ps_type_t WiFiGenericClass::getSleep() { return _sleepEnabled; } +/** + * control wifi band mode + * @param band_mode enum possible band modes + * @return ok + */ +bool WiFiGenericClass::setBandMode(wifi_band_mode_t band_mode) { +#if SOC_WIFI_SUPPORT_5G + if (!WiFi.STA.started() && !WiFi.AP.started()) { + log_e("You need to start WiFi first"); + return false; + } + wifi_band_mode_t bm = WIFI_BAND_MODE_AUTO; + esp_err_t err = esp_wifi_get_band_mode(&bm); + if (err != ESP_OK) { + log_e("Failed to get Current Band Mode: 0x%x: %s", err, esp_err_to_name(err)); + return false; + } else if (bm == band_mode) { + log_d("No change in Band Mode"); + return true; + } else { + log_d("Switching Band Mode from %d to %d", bm, band_mode); + } +#if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_ERROR + if (WiFi.STA.connected() || WiFi.AP.connected()) { + log_e("Your network will get disconnected!"); + } +#endif + err = esp_wifi_set_band_mode(band_mode); + if (err != ESP_OK) { + log_e("Failed to set Band Mode: 0x%x: %s", err, esp_err_to_name(err)); + return false; + } + delay(100); + return true; +#else + if (band_mode == WIFI_BAND_MODE_5G_ONLY) { + log_e("This chip supports only 2.4GHz WiFi"); + } + return band_mode != WIFI_BAND_MODE_5G_ONLY; +#endif +} + +/** + * get the current enabled wifi band mode + * @return enum band mode + */ +wifi_band_mode_t WiFiGenericClass::getBandMode() { +#if SOC_WIFI_SUPPORT_5G + wifi_band_mode_t band_mode = WIFI_BAND_MODE_AUTO; + if (!WiFi.STA.started() && !WiFi.AP.started()) { + log_e("You need to start WiFi first"); + return band_mode; + } + esp_err_t err = esp_wifi_get_band_mode(&band_mode); + if (err != ESP_OK) { + log_e("Failed to get Band Mode: 0x%x: %s", err, esp_err_to_name(err)); + } + return band_mode; +#else + return WIFI_BAND_MODE_2G_ONLY; +#endif +} + +/** + * get the current active wifi band + * @return enum band + */ +wifi_band_t WiFiGenericClass::getBand() { +#if SOC_WIFI_SUPPORT_5G + wifi_band_t band = WIFI_BAND_2G; + if (!WiFi.STA.started() && !WiFi.AP.started()) { + log_e("You need to start WiFi first"); + return band; + } + esp_err_t err = esp_wifi_get_band(&band); + if (err != ESP_OK) { + log_e("Failed to get Band: 0x%x: %s", err, esp_err_to_name(err)); + } + return band; +#else + return WIFI_BAND_2G; +#endif +} + /** * control wifi tx power * @param power enum maximum wifi tx power diff --git a/libraries/WiFi/src/WiFiGeneric.h b/libraries/WiFi/src/WiFiGeneric.h index ed216229ed4..8497b4b4f3d 100644 --- a/libraries/WiFi/src/WiFiGeneric.h +++ b/libraries/WiFi/src/WiFiGeneric.h @@ -111,6 +111,10 @@ class WiFiGenericClass { bool setTxPower(wifi_power_t power); wifi_power_t getTxPower(); + bool setBandMode(wifi_band_mode_t band_mode); + wifi_band_mode_t getBandMode(); + wifi_band_t getBand(); + bool initiateFTM(uint8_t frm_count = 16, uint16_t burst_period = 2, uint8_t channel = 1, const uint8_t *mac = NULL); static bool setDualAntennaConfig(uint8_t gpio_ant1, uint8_t gpio_ant2, wifi_rx_ant_t rx_mode, wifi_tx_ant_t tx_mode); diff --git a/libraries/WiFiProv/library.properties b/libraries/WiFiProv/library.properties index 13a63c50bb1..1b19186c40b 100644 --- a/libraries/WiFiProv/library.properties +++ b/libraries/WiFiProv/library.properties @@ -1,5 +1,5 @@ name=WiFiProv -version=3.2.0 +version=3.3.0 author=Switi Mhaiske maintainer=Hristo Gochkov sentence=Enables provisioning. diff --git a/libraries/Wire/library.properties b/libraries/Wire/library.properties index 655f4bd3194..182e98790bc 100644 --- a/libraries/Wire/library.properties +++ b/libraries/Wire/library.properties @@ -1,5 +1,5 @@ name=Wire -version=3.2.0 +version=3.3.0 author=Hristo Gochkov maintainer=Hristo Gochkov sentence=Allows the communication between devices or sensors connected via Two Wire Interface Bus. For esp8266 boards. diff --git a/libraries/Zigbee/examples/Zigbee_PM25_Sensor/README.md b/libraries/Zigbee/examples/Zigbee_PM25_Sensor/README.md new file mode 100644 index 00000000000..51bf11459b7 --- /dev/null +++ b/libraries/Zigbee/examples/Zigbee_PM25_Sensor/README.md @@ -0,0 +1,72 @@ +# Arduino-ESP32 PM2.5 Sensor + +This example shows how to configure the Zigbee end device and use it as a Home Automation (HA) simple sensor device type with particulate matter (PM2.5) measuring + +# Supported Targets + +Currently, this example supports the following targets. + +| Supported Targets | ESP32-C6 | ESP32-H2 | +| ----------------- | -------- | -------- | + +## Pressure + Flow Sensor Functions + + * After this board first starts up, it would be configured locally to report the PM2.5 on every 30 seconds. + * By clicking the button (BOOT) on this board, this board will immediately send a report of the current PM2.5 to the network. + +## Hardware Required + +* A USB cable for power supply and programming + +### Configure the Project + +In this example, the internal temperature sensor is used to demonstrate reading of the PM2.5 sensors. +Set the Button GPIO by changing the `button` variable. By default, it's the pin `BOOT_PIN` (BOOT button on ESP32-C6 and ESP32-H2). + +#### Using Arduino IDE + +To get more information about the Espressif boards see [Espressif Development Kits](https://www.espressif.com/en/products/devkits). + +* Before Compile/Verify, select the correct board: `Tools -> Board`. +* Select the End device Zigbee mode: `Tools -> Zigbee mode: Zigbee ED (end device)` +* Select Partition Scheme for Zigbee: `Tools -> Partition Scheme: Zigbee 4MB with spiffs` +* Select the COM port: `Tools -> Port: xxx` where the `xxx` is the detected COM port. +* Optional: Set debug level to verbose to see all logs from Zigbee stack: `Tools -> Core Debug Level: Verbose`. + +## Troubleshooting + +If the End device flashed with this example is not connecting to the coordinator, erase the flash of the End device before flashing the example to the board. It is recommended to do this if you re-flash the coordinator. +You can do the following: + +* In the Arduino IDE go to the Tools menu and set `Erase All Flash Before Sketch Upload` to `Enabled`. +* Add to the sketch `Zigbee.factoryReset();` to reset the device and Zigbee stack. + +By default, the coordinator network is closed after rebooting or flashing new firmware. +To open the network you have 2 options: + +* Open network after reboot by setting `Zigbee.setRebootOpenNetwork(time);` before calling `Zigbee.begin();`. +* In application you can anytime call `Zigbee.openNetwork(time);` to open the network for devices to join. + +***Important: Make sure you are using a good quality USB cable and that you have a reliable power source*** + +* **LED not blinking:** Check the wiring connection and the IO selection. +* **Programming Fail:** If the programming/flash procedure fails, try reducing the serial connection speed. +* **COM port not detected:** Check the USB cable and the USB to Serial driver installation. + +If the error persists, you can ask for help at the official [ESP32 forum](https://esp32.com) or see [Contribute](#contribute). + +## Contribute + +To know how to contribute to this project, see [How to contribute.](https://github.com/espressif/arduino-esp32/blob/master/CONTRIBUTING.rst) + +If you have any **feedback** or **issue** to report on this example/library, please open an issue or fix it by creating a new PR. Contributions are more than welcome! + +Before creating a new issue, be sure to try Troubleshooting and check if the same issue was already created by someone else. + +## Resources + +* Official ESP32 Forum: [Link](https://esp32.com) +* Arduino-ESP32 Official Repository: [espressif/arduino-esp32](https://github.com/espressif/arduino-esp32) +* ESP32-C6 Datasheet: [Link to datasheet](https://www.espressif.com/sites/default/files/documentation/esp32-c6_datasheet_en.pdf) +* ESP32-H2 Datasheet: [Link to datasheet](https://www.espressif.com/sites/default/files/documentation/esp32-h2_datasheet_en.pdf) +* Official ESP-IDF documentation: [ESP-IDF](https://idf.espressif.com) diff --git a/libraries/Zigbee/examples/Zigbee_PM25_Sensor/Zigbee_PM25_Sensor.ino b/libraries/Zigbee/examples/Zigbee_PM25_Sensor/Zigbee_PM25_Sensor.ino new file mode 100644 index 00000000000..a98d697f700 --- /dev/null +++ b/libraries/Zigbee/examples/Zigbee_PM25_Sensor/Zigbee_PM25_Sensor.ino @@ -0,0 +1,109 @@ +// Copyright 2024 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** + * @brief This example demonstrates Zigbee PM2.5 sensor. + * + * The example demonstrates how to use Zigbee library to create a end device PM2.5 sensor. + * + * Proper Zigbee mode must be selected in Tools->Zigbee mode + * and also the correct partition scheme must be selected in Tools->Partition Scheme. + * + * Please check the README.md for instructions and more detailed description. + * + * Created by Jan Procházka (https://github.com/P-R-O-C-H-Y/) + */ + +#ifndef ZIGBEE_MODE_ED +#error "Zigbee end device mode is not selected in Tools->Zigbee mode" +#endif + +#include "Zigbee.h" + +/* Zigbee PM2.5 sensor configuration */ +#define PM2_5_SENSOR_ENDPOINT_NUMBER 1 +uint8_t button = BOOT_PIN; + +ZigbeePM25Sensor zbPM25Sensor = ZigbeePM25Sensor(PM2_5_SENSOR_ENDPOINT_NUMBER); + +void setup() { + Serial.begin(115200); + + // Init button switch + pinMode(button, INPUT_PULLUP); + + // Optional: set Zigbee device name and model + zbPM25Sensor.setManufacturerAndModel("Espressif", "ZigbeePM25Sensor"); + + // Set minimum and maximum PM2.5 measurement value in µg/m³ + zbPM25Sensor.setMinMaxValue(0, 350); + + // Set tolerance for PM2.5 measurement in µg/m³ + zbPM25Sensor.setTolerance(0.1); + + // Add endpoints to Zigbee Core + Zigbee.addEndpoint(&zbPM25Sensor); + + Serial.println("Starting Zigbee..."); + // When all EPs are registered, start Zigbee in End Device mode + if (!Zigbee.begin()) { + Serial.println("Zigbee failed to start!"); + Serial.println("Rebooting..."); + ESP.restart(); + } else { + Serial.println("Zigbee started successfully!"); + } + Serial.println("Connecting to network"); + while (!Zigbee.connected()) { + Serial.print("."); + delay(100); + } + Serial.println(); + + // Set reporting interval for PM2.5 measurement to be done every 30 seconds, must be called after Zigbee.begin() + // min_interval and max_interval in seconds, delta (PM2.5 change in µg/m³) + // if min = 1 and max = 0, reporting is sent only when PM2.5 changes by delta + // if min = 0 and max = 10, reporting is sent every 10 seconds or when PM2.5 changes by delta + // if min = 0, max = 10 and delta = 0, reporting is sent every 10 seconds regardless of delta change + zbPM25Sensor.setReporting(0, 30, 0); +} + +void loop() { + static uint32_t timeCounter = 0; + // Read PM2.5 sensor every 2s + if (!(timeCounter++ % 20)) { // delaying for 100ms x 20 = 2s + // Read sensor value - here is chip temperature used + 50 as a dummy value for demonstration + float pm25_value = 50.5 + temperatureRead(); + Serial.printf("Updating PM2.5 sensor value to %0.1f µg/m³\r\n", pm25_value); + zbPM25Sensor.setPM25(pm25_value); + } + + // Checking button for factory reset and reporting + if (digitalRead(button) == LOW) { // Push button pressed + // Key debounce handling + delay(100); + int startTime = millis(); + while (digitalRead(button) == LOW) { + delay(50); + if ((millis() - startTime) > 3000) { + // If key pressed for more than 3secs, factory reset Zigbee and reboot + Serial.println("Resetting Zigbee to factory and rebooting in 1s."); + delay(1000); + Zigbee.factoryReset(); + } + } + zbPM25Sensor.report(); + } + delay(100); +} diff --git a/libraries/Zigbee/examples/Zigbee_PM25_Sensor/ci.json b/libraries/Zigbee/examples/Zigbee_PM25_Sensor/ci.json new file mode 100644 index 00000000000..ceacc367801 --- /dev/null +++ b/libraries/Zigbee/examples/Zigbee_PM25_Sensor/ci.json @@ -0,0 +1,7 @@ +{ + "fqbn_append": "PartitionScheme=zigbee,ZigbeeMode=ed", + "requires": [ + "CONFIG_SOC_IEEE802154_SUPPORTED=y", + "CONFIG_ZB_ENABLED=y" + ] +} diff --git a/libraries/Zigbee/examples/Zigbee_Temp_Hum_Sensor_Sleepy/Zigbee_Temp_Hum_Sensor_Sleepy.ino b/libraries/Zigbee/examples/Zigbee_Temp_Hum_Sensor_Sleepy/Zigbee_Temp_Hum_Sensor_Sleepy.ino index 3eefd973dd2..e9d08d32175 100644 --- a/libraries/Zigbee/examples/Zigbee_Temp_Hum_Sensor_Sleepy/Zigbee_Temp_Hum_Sensor_Sleepy.ino +++ b/libraries/Zigbee/examples/Zigbee_Temp_Hum_Sensor_Sleepy/Zigbee_Temp_Hum_Sensor_Sleepy.ino @@ -85,9 +85,9 @@ void setup() { // Set tolerance for temperature measurement in °C (lowest possible value is 0.01°C) zbTempSensor.setTolerance(1); - // Set power source to battery and set battery percentage to measured value (now 100% for demonstration) - // The value can be also updated by calling zbTempSensor.setBatteryPercentage(percentage) anytime - zbTempSensor.setPowerSource(ZB_POWER_SOURCE_BATTERY, 100); + // Set power source to battery, battery percentage and battery voltage (now 100% and 3.5V for demonstration) + // The value can be also updated by calling zbTempSensor.setBatteryPercentage(percentage) or zbTempSensor.setBatteryVoltage(voltage) anytime after Zigbee.begin() + zbTempSensor.setPowerSource(ZB_POWER_SOURCE_BATTERY, 100, 35); // Add humidity cluster to the temperature sensor device with min, max and tolerance values zbTempSensor.addHumiditySensor(0, 100, 1); diff --git a/libraries/Zigbee/library.properties b/libraries/Zigbee/library.properties index 9a558d70216..dab96b82a61 100644 --- a/libraries/Zigbee/library.properties +++ b/libraries/Zigbee/library.properties @@ -1,5 +1,5 @@ name=Zigbee -version=3.2.0 +version=3.3.0 author=P-R-O-C-H-Y maintainer=Jan Procházka sentence=Enables zigbee connection with the ESP32 diff --git a/libraries/Zigbee/src/Zigbee.h b/libraries/Zigbee/src/Zigbee.h index ea42e9dd41a..7f44d7813af 100644 --- a/libraries/Zigbee/src/Zigbee.h +++ b/libraries/Zigbee/src/Zigbee.h @@ -7,23 +7,29 @@ #include "ZigbeeEP.h" // Endpoints -#include "ep/ZigbeeLight.h" +//// Switches +#include "ep/ZigbeeColorDimmerSwitch.h" #include "ep/ZigbeeSwitch.h" -#include "ep/ZigbeeDimmableLight.h" +//// Lights #include "ep/ZigbeeColorDimmableLight.h" -#include "ep/ZigbeeColorDimmerSwitch.h" -#include "ep/ZigbeeTempSensor.h" +#include "ep/ZigbeeDimmableLight.h" +#include "ep/ZigbeeLight.h" +//// Controllers #include "ep/ZigbeeThermostat.h" -#include "ep/ZigbeePressureSensor.h" +//// Sensors #include "ep/ZigbeeAnalog.h" -#include "ep/ZigbeeFlowSensor.h" -#include "ep/ZigbeeOccupancySensor.h" -#include "ep/ZigbeeIlluminanceSensor.h" #include "ep/ZigbeeCarbonDioxideSensor.h" #include "ep/ZigbeeContactSwitch.h" #include "ep/ZigbeeDoorWindowHandle.h" -#include "ep/ZigbeeWindowCovering.h" +#include "ep/ZigbeeFlowSensor.h" +#include "ep/ZigbeeIlluminanceSensor.h" +#include "ep/ZigbeeOccupancySensor.h" +#include "ep/ZigbeePM25Sensor.h" +#include "ep/ZigbeePressureSensor.h" +#include "ep/ZigbeeTempSensor.h" #include "ep/ZigbeeVibrationSensor.h" -#include "ep/ZigbeeRangeExtender.h" -#include "ep/ZigbeeGateway.h" #include "ep/ZigbeeWindSpeedSensor.h" +#include "ep/ZigbeeWindowCovering.h" +//// Other +#include "ep/ZigbeeGateway.h" +#include "ep/ZigbeeRangeExtender.h" diff --git a/libraries/Zigbee/src/ZigbeeEP.cpp b/libraries/Zigbee/src/ZigbeeEP.cpp index e7d507dc441..cf52a902983 100644 --- a/libraries/Zigbee/src/ZigbeeEP.cpp +++ b/libraries/Zigbee/src/ZigbeeEP.cpp @@ -19,6 +19,8 @@ ZigbeeEP::ZigbeeEP(uint8_t endpoint) { _ep_config.endpoint = 0; _cluster_list = nullptr; _on_identify = nullptr; + _read_model = NULL; + _read_manufacturer = NULL; _time_status = 0; if (!lock) { lock = xSemaphoreCreateBinary(); @@ -33,16 +35,23 @@ void ZigbeeEP::setVersion(uint8_t version) { } bool ZigbeeEP::setManufacturerAndModel(const char *name, const char *model) { + // Allocate a new array of size length + 2 (1 for the length, 1 for null terminator) + char zb_name[ZB_MAX_NAME_LENGTH + 2]; + char zb_model[ZB_MAX_NAME_LENGTH + 2]; + // Convert manufacturer to ZCL string size_t name_length = strlen(name); size_t model_length = strlen(model); - if (name_length > 32 || model_length > 32) { + if (name_length > ZB_MAX_NAME_LENGTH || model_length > ZB_MAX_NAME_LENGTH) { log_e("Manufacturer or model name is too long"); return false; } - // Allocate a new array of size length + 2 (1 for the length, 1 for null terminator) - char *zb_name = new char[name_length + 2]; - char *zb_model = new char[model_length + 2]; + // Get and check the basic cluster + esp_zb_attribute_list_t *basic_cluster = esp_zb_cluster_list_get_cluster(_cluster_list, ESP_ZB_ZCL_CLUSTER_ID_BASIC, ESP_ZB_ZCL_CLUSTER_SERVER_ROLE); + if (basic_cluster == nullptr) { + log_e("Failed to get basic cluster"); + return false; + } // Store the length as the first element zb_name[0] = static_cast(name_length); // Cast size_t to char zb_model[0] = static_cast(model_length); @@ -52,9 +61,7 @@ bool ZigbeeEP::setManufacturerAndModel(const char *name, const char *model) { // Null-terminate the array zb_name[name_length + 1] = '\0'; zb_model[model_length + 1] = '\0'; - - // Get the basic cluster and update the manufacturer and model attributes - esp_zb_attribute_list_t *basic_cluster = esp_zb_cluster_list_get_cluster(_cluster_list, ESP_ZB_ZCL_CLUSTER_ID_BASIC, ESP_ZB_ZCL_CLUSTER_SERVER_ROLE); + // Update the manufacturer and model attributes esp_err_t ret_name = esp_zb_basic_cluster_add_attr(basic_cluster, ESP_ZB_ZCL_ATTR_BASIC_MANUFACTURER_NAME_ID, (void *)zb_name); if (ret_name != ESP_OK) { log_e("Failed to set manufacturer: 0x%x: %s", ret_name, esp_err_to_name(ret_name)); @@ -63,12 +70,10 @@ bool ZigbeeEP::setManufacturerAndModel(const char *name, const char *model) { if (ret_model != ESP_OK) { log_e("Failed to set model: 0x%x: %s", ret_model, esp_err_to_name(ret_model)); } - delete[] zb_name; - delete[] zb_model; return ret_name == ESP_OK && ret_model == ESP_OK; } -bool ZigbeeEP::setPowerSource(zb_power_source_t power_source, uint8_t battery_percentage) { +bool ZigbeeEP::setPowerSource(zb_power_source_t power_source, uint8_t battery_percentage, uint8_t battery_voltage) { esp_zb_attribute_list_t *basic_cluster = esp_zb_cluster_list_get_cluster(_cluster_list, ESP_ZB_ZCL_CLUSTER_ID_BASIC, ESP_ZB_ZCL_CLUSTER_SERVER_ROLE); esp_err_t ret = esp_zb_cluster_update_attr(basic_cluster, ESP_ZB_ZCL_ATTR_BASIC_POWER_SOURCE_ID, (void *)&power_source); if (ret != ESP_OK) { @@ -88,6 +93,11 @@ bool ZigbeeEP::setPowerSource(zb_power_source_t power_source, uint8_t battery_pe log_e("Failed to add battery percentage attribute: 0x%x: %s", ret, esp_err_to_name(ret)); return false; } + ret = esp_zb_power_config_cluster_add_attr(power_config_cluster, ESP_ZB_ZCL_ATTR_POWER_CONFIG_BATTERY_VOLTAGE_ID, (void *)&battery_voltage); + if (ret != ESP_OK) { + log_e("Failed to add battery voltage attribute: 0x%x: %s", ret, esp_err_to_name(ret)); + return false; + } ret = esp_zb_cluster_list_add_power_config_cluster(_cluster_list, power_config_cluster, ESP_ZB_ZCL_CLUSTER_SERVER_ROLE); if (ret != ESP_OK) { log_e("Failed to add power config cluster: 0x%x: %s", ret, esp_err_to_name(ret)); @@ -120,6 +130,21 @@ bool ZigbeeEP::setBatteryPercentage(uint8_t percentage) { return true; } +bool ZigbeeEP::setBatteryVoltage(uint8_t voltage) { + esp_zb_zcl_status_t ret = ESP_ZB_ZCL_STATUS_SUCCESS; + esp_zb_lock_acquire(portMAX_DELAY); + ret = esp_zb_zcl_set_attribute_val( + _endpoint, ESP_ZB_ZCL_CLUSTER_ID_POWER_CONFIG, ESP_ZB_ZCL_CLUSTER_SERVER_ROLE, ESP_ZB_ZCL_ATTR_POWER_CONFIG_BATTERY_VOLTAGE_ID, &voltage, false + ); + esp_zb_lock_release(); + if (ret != ESP_ZB_ZCL_STATUS_SUCCESS) { + log_e("Failed to set battery voltage: 0x%x: %s", ret, esp_zb_zcl_status_to_name(ret)); + return false; + } + log_v("Battery voltage updated"); + return true; +} + bool ZigbeeEP::reportBatteryPercentage() { /* Send report attributes command */ esp_zb_zcl_report_attr_cmd_t report_attr_cmd; @@ -163,10 +188,10 @@ char *ZigbeeEP::readManufacturer(uint8_t endpoint, uint16_t short_addr, esp_zb_i read_req.attr_number = ZB_ARRAY_LENTH(attributes); read_req.attr_field = attributes; - if (_read_manufacturer != nullptr) { + if (_read_manufacturer != NULL) { free(_read_manufacturer); } - _read_manufacturer = nullptr; + _read_manufacturer = NULL; esp_zb_lock_acquire(portMAX_DELAY); esp_zb_zcl_read_attr_cmd_req(&read_req); @@ -201,10 +226,10 @@ char *ZigbeeEP::readModel(uint8_t endpoint, uint16_t short_addr, esp_zb_ieee_add read_req.attr_number = ZB_ARRAY_LENTH(attributes); read_req.attr_field = attributes; - if (_read_model != nullptr) { + if (_read_model != NULL) { free(_read_model); } - _read_model = nullptr; + _read_model = NULL; esp_zb_lock_acquire(portMAX_DELAY); esp_zb_zcl_read_attr_cmd_req(&read_req); @@ -245,20 +270,28 @@ void ZigbeeEP::zbReadBasicCluster(const esp_zb_zcl_attribute_t *attribute) { /* Basic cluster attributes */ if (attribute->id == ESP_ZB_ZCL_ATTR_BASIC_MANUFACTURER_NAME_ID && attribute->data.type == ESP_ZB_ZCL_ATTR_TYPE_CHAR_STRING && attribute->data.value) { zbstring_t *zbstr = (zbstring_t *)attribute->data.value; - char *string = (char *)malloc(zbstr->len + 1); - memcpy(string, zbstr->data, zbstr->len); - string[zbstr->len] = '\0'; - log_i("Peer Manufacturer is \"%s\"", string); - _read_manufacturer = string; + _read_manufacturer = (char *)malloc(zbstr->len + 1); + if (_read_manufacturer == NULL) { + log_e("Failed to allocate memory for manufacturer data"); + xSemaphoreGive(lock); + return; + } + memcpy(_read_manufacturer, zbstr->data, zbstr->len); + _read_manufacturer[zbstr->len] = '\0'; + log_i("Peer Manufacturer is \"%s\"", _read_manufacturer); xSemaphoreGive(lock); } if (attribute->id == ESP_ZB_ZCL_ATTR_BASIC_MODEL_IDENTIFIER_ID && attribute->data.type == ESP_ZB_ZCL_ATTR_TYPE_CHAR_STRING && attribute->data.value) { zbstring_t *zbstr = (zbstring_t *)attribute->data.value; - char *string = (char *)malloc(zbstr->len + 1); - memcpy(string, zbstr->data, zbstr->len); - string[zbstr->len] = '\0'; - log_i("Peer Model is \"%s\"", string); - _read_model = string; + _read_model = (char *)malloc(zbstr->len + 1); + if (_read_model == NULL) { + log_e("Failed to allocate memory for model data"); + xSemaphoreGive(lock); + return; + } + memcpy(_read_model, zbstr->data, zbstr->len); + _read_model[zbstr->len] = '\0'; + log_i("Peer Model is \"%s\"", _read_model); xSemaphoreGive(lock); } } diff --git a/libraries/Zigbee/src/ZigbeeEP.h b/libraries/Zigbee/src/ZigbeeEP.h index bd142344929..e13b3b59de9 100644 --- a/libraries/Zigbee/src/ZigbeeEP.h +++ b/libraries/Zigbee/src/ZigbeeEP.h @@ -41,6 +41,10 @@ typedef enum { /* Zigbee End Device Class */ class ZigbeeEP { public: + // constants and limits + static constexpr size_t ZB_MAX_NAME_LENGTH = 32; + + // constructors and destructor ZigbeeEP(uint8_t endpoint = 10); ~ZigbeeEP() {} @@ -77,9 +81,10 @@ class ZigbeeEP { char *readModel(uint8_t endpoint, uint16_t short_addr, esp_zb_ieee_addr_t ieee_addr); // Set Power source and battery percentage for battery powered devices - bool setPowerSource(zb_power_source_t power_source, uint8_t percentage = 255); - bool setBatteryPercentage(uint8_t percentage); - bool reportBatteryPercentage(); + bool setPowerSource(zb_power_source_t power_source, uint8_t percentage = 0xff, uint8_t voltage = 0xff); // voltage in 100mV + bool setBatteryPercentage(uint8_t percentage); // 0-100 % + bool setBatteryVoltage(uint8_t voltage); // voltage in 100mV (example value 35 for 3.5V) + bool reportBatteryPercentage(); // battery voltage is not reportable attribute // Set time bool addTimeCluster(tm time = {}, int32_t gmt_offset = 0); // gmt offset in seconds diff --git a/libraries/Zigbee/src/ep/ZigbeePM25Sensor.cpp b/libraries/Zigbee/src/ep/ZigbeePM25Sensor.cpp new file mode 100644 index 00000000000..d25d15e5de3 --- /dev/null +++ b/libraries/Zigbee/src/ep/ZigbeePM25Sensor.cpp @@ -0,0 +1,118 @@ +#include "ZigbeePM25Sensor.h" +#if CONFIG_ZB_ENABLED + +esp_zb_cluster_list_t *zigbee_pm2_5_sensor_clusters_create(zigbee_pm2_5_sensor_cfg_t *pm2_5_sensor) { + esp_zb_basic_cluster_cfg_t *basic_cfg = pm2_5_sensor ? &(pm2_5_sensor->basic_cfg) : NULL; + esp_zb_identify_cluster_cfg_t *identify_cfg = pm2_5_sensor ? &(pm2_5_sensor->identify_cfg) : NULL; + esp_zb_pm2_5_measurement_cluster_cfg_t *pm2_5_meas_cfg = pm2_5_sensor ? &(pm2_5_sensor->pm2_5_meas_cfg) : NULL; + esp_zb_cluster_list_t *cluster_list = esp_zb_zcl_cluster_list_create(); + esp_zb_cluster_list_add_basic_cluster(cluster_list, esp_zb_basic_cluster_create(basic_cfg), ESP_ZB_ZCL_CLUSTER_SERVER_ROLE); + esp_zb_cluster_list_add_identify_cluster(cluster_list, esp_zb_identify_cluster_create(identify_cfg), ESP_ZB_ZCL_CLUSTER_SERVER_ROLE); + esp_zb_cluster_list_add_pm2_5_measurement_cluster(cluster_list, esp_zb_pm2_5_measurement_cluster_create(pm2_5_meas_cfg), ESP_ZB_ZCL_CLUSTER_SERVER_ROLE); + return cluster_list; +} + +ZigbeePM25Sensor::ZigbeePM25Sensor(uint8_t endpoint) : ZigbeeEP(endpoint) { + _device_id = ESP_ZB_HA_SIMPLE_SENSOR_DEVICE_ID; + + //Create custom PM2.5 sensor configuration + zigbee_pm2_5_sensor_cfg_t pm2_5_sensor_cfg = ZIGBEE_DEFAULT_PM2_5_SENSOR_CONFIG(); + _cluster_list = zigbee_pm2_5_sensor_clusters_create(&pm2_5_sensor_cfg); + + _ep_config = {.endpoint = _endpoint, .app_profile_id = ESP_ZB_AF_HA_PROFILE_ID, .app_device_id = ESP_ZB_HA_SIMPLE_SENSOR_DEVICE_ID, .app_device_version = 0}; +} + +bool ZigbeePM25Sensor::setMinMaxValue(float min, float max) { + esp_zb_attribute_list_t *pm2_5_measure_cluster = + esp_zb_cluster_list_get_cluster(_cluster_list, ESP_ZB_ZCL_CLUSTER_ID_PM2_5_MEASUREMENT, ESP_ZB_ZCL_CLUSTER_SERVER_ROLE); + esp_err_t ret = esp_zb_cluster_update_attr(pm2_5_measure_cluster, ESP_ZB_ZCL_ATTR_PM2_5_MEASUREMENT_MIN_MEASURED_VALUE_ID, (void *)&min); + if (ret != ESP_OK) { + log_e("Failed to set min value: 0x%x: %s", ret, esp_err_to_name(ret)); + return false; + } + ret = esp_zb_cluster_update_attr(pm2_5_measure_cluster, ESP_ZB_ZCL_ATTR_PM2_5_MEASUREMENT_MAX_MEASURED_VALUE_ID, (void *)&max); + if (ret != ESP_OK) { + log_e("Failed to set max value: 0x%x: %s", ret, esp_err_to_name(ret)); + return false; + } + return true; +} + +bool ZigbeePM25Sensor::setTolerance(float tolerance) { + esp_zb_attribute_list_t *pm2_5_measure_cluster = + esp_zb_cluster_list_get_cluster(_cluster_list, ESP_ZB_ZCL_CLUSTER_ID_PM2_5_MEASUREMENT, ESP_ZB_ZCL_CLUSTER_SERVER_ROLE); + esp_err_t ret = esp_zb_pm2_5_measurement_cluster_add_attr(pm2_5_measure_cluster, ESP_ZB_ZCL_ATTR_PM2_5_MEASUREMENT_TOLERANCE_ID, (void *)&tolerance); + if (ret != ESP_OK) { + log_e("Failed to set tolerance: 0x%x: %s", ret, esp_err_to_name(ret)); + return false; + } + return true; +} + +bool ZigbeePM25Sensor::setReporting(uint16_t min_interval, uint16_t max_interval, float delta) { + esp_zb_zcl_reporting_info_t reporting_info; + memset(&reporting_info, 0, sizeof(esp_zb_zcl_reporting_info_t)); + reporting_info.direction = ESP_ZB_ZCL_CMD_DIRECTION_TO_SRV; + reporting_info.ep = _endpoint; + reporting_info.cluster_id = ESP_ZB_ZCL_CLUSTER_ID_PM2_5_MEASUREMENT; + reporting_info.cluster_role = ESP_ZB_ZCL_CLUSTER_SERVER_ROLE; + reporting_info.attr_id = ESP_ZB_ZCL_ATTR_PM2_5_MEASUREMENT_MEASURED_VALUE_ID; + reporting_info.u.send_info.min_interval = min_interval; + reporting_info.u.send_info.max_interval = max_interval; + reporting_info.u.send_info.def_min_interval = min_interval; + reporting_info.u.send_info.def_max_interval = max_interval; + // reporting_info.u.send_info.delta.u16 = (uint16_t)(delta * 100); // Convert delta to ZCL uint16_t + reporting_info.dst.profile_id = ESP_ZB_AF_HA_PROFILE_ID; + reporting_info.manuf_code = ESP_ZB_ZCL_ATTR_NON_MANUFACTURER_SPECIFIC; + float delta_f = delta; + memcpy(&reporting_info.u.send_info.delta.s32, &delta_f, sizeof(float)); + + esp_zb_lock_acquire(portMAX_DELAY); + esp_err_t ret = esp_zb_zcl_update_reporting_info(&reporting_info); + esp_zb_lock_release(); + if (ret != ESP_OK) { + log_e("Failed to set reporting: 0x%x: %s", ret, esp_err_to_name(ret)); + return false; + } + return true; +} + +bool ZigbeePM25Sensor::setPM25(float pm25) { + esp_zb_zcl_status_t ret = ESP_ZB_ZCL_STATUS_SUCCESS; + log_v("Updating PM2.5 sensor value..."); + /* Update PM2.5 sensor measured value */ + log_d("Setting PM2.5 to %0.1f", pm25); + esp_zb_lock_acquire(portMAX_DELAY); + ret = esp_zb_zcl_set_attribute_val( + _endpoint, ESP_ZB_ZCL_CLUSTER_ID_PM2_5_MEASUREMENT, ESP_ZB_ZCL_CLUSTER_SERVER_ROLE, ESP_ZB_ZCL_ATTR_PM2_5_MEASUREMENT_MEASURED_VALUE_ID, &pm25, false + ); + esp_zb_lock_release(); + if (ret != ESP_ZB_ZCL_STATUS_SUCCESS) { + log_e("Failed to set PM2.5: 0x%x: %s", ret, esp_zb_zcl_status_to_name(ret)); + return false; + } + return true; +} + +bool ZigbeePM25Sensor::report() { + /* Send report attributes command */ + esp_zb_zcl_report_attr_cmd_t report_attr_cmd; + report_attr_cmd.address_mode = ESP_ZB_APS_ADDR_MODE_DST_ADDR_ENDP_NOT_PRESENT; + report_attr_cmd.attributeID = ESP_ZB_ZCL_ATTR_PM2_5_MEASUREMENT_MEASURED_VALUE_ID; + report_attr_cmd.direction = ESP_ZB_ZCL_CMD_DIRECTION_TO_CLI; + report_attr_cmd.clusterID = ESP_ZB_ZCL_CLUSTER_ID_PM2_5_MEASUREMENT; + report_attr_cmd.zcl_basic_cmd.src_endpoint = _endpoint; + report_attr_cmd.manuf_code = ESP_ZB_ZCL_ATTR_NON_MANUFACTURER_SPECIFIC; + + esp_zb_lock_acquire(portMAX_DELAY); + esp_err_t ret = esp_zb_zcl_report_attr_cmd_req(&report_attr_cmd); + esp_zb_lock_release(); + if (ret != ESP_OK) { + log_e("Failed to send PM2.5 report: 0x%x: %s", ret, esp_err_to_name(ret)); + return false; + } + log_v("PM2.5 report sent"); + return true; +} + +#endif // CONFIG_ZB_ENABLED diff --git a/libraries/Zigbee/src/ep/ZigbeePM25Sensor.h b/libraries/Zigbee/src/ep/ZigbeePM25Sensor.h new file mode 100644 index 00000000000..344f3e1f479 --- /dev/null +++ b/libraries/Zigbee/src/ep/ZigbeePM25Sensor.h @@ -0,0 +1,60 @@ +/* Class of Zigbee PM2.5 sensor endpoint inherited from common EP class */ + +#pragma once + +#include "soc/soc_caps.h" +#include "sdkconfig.h" +#if CONFIG_ZB_ENABLED + +#include "ZigbeeEP.h" +#include "ha/esp_zigbee_ha_standard.h" + +// clang-format off +#define ZIGBEE_DEFAULT_PM2_5_SENSOR_CONFIG() \ + { \ + .basic_cfg = \ + { \ + .zcl_version = ESP_ZB_ZCL_BASIC_ZCL_VERSION_DEFAULT_VALUE, \ + .power_source = ESP_ZB_ZCL_BASIC_POWER_SOURCE_DEFAULT_VALUE, \ + }, \ + .identify_cfg = \ + { \ + .identify_time = ESP_ZB_ZCL_IDENTIFY_IDENTIFY_TIME_DEFAULT_VALUE, \ + }, \ + .pm2_5_meas_cfg = \ + { \ + .measured_value = 0.0, \ + .min_measured_value = 0.0, \ + .max_measured_value = 500.0, \ + }, \ + } +// clang-format on + +typedef struct zigbee_pm2_5_sensor_cfg_s { + esp_zb_basic_cluster_cfg_t basic_cfg; + esp_zb_identify_cluster_cfg_t identify_cfg; + esp_zb_pm2_5_measurement_cluster_cfg_t pm2_5_meas_cfg; +} zigbee_pm2_5_sensor_cfg_t; + +class ZigbeePM25Sensor : public ZigbeeEP { +public: + ZigbeePM25Sensor(uint8_t endpoint); + ~ZigbeePM25Sensor() {} + + // Set the PM2.5 value in 0.1 µg/m³ + bool setPM25(float pm25); + + // Set the min and max value for the PM2.5 sensor in 0.1 µg/m³ + bool setMinMaxValue(float min, float max); + + // Set the tolerance value for the PM2.5 sensor in 0.1 µg/m³ + bool setTolerance(float tolerance); + + // Set the reporting interval for PM2.5 measurement in seconds and delta (PM2.5 change in 0.1 µg/m³) + bool setReporting(uint16_t min_interval, uint16_t max_interval, float delta); + + // Report the PM2.5 value + bool report(); +}; + +#endif // CONFIG_ZB_ENABLED diff --git a/package.json b/package.json index 9c918733209..4c3e4725a9d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "framework-arduinoespressif32", - "version": "3.2.0", + "version": "3.3.0", "description": "Arduino Wiring-based Framework for the Espressif ESP32, ESP32-P4, ESP32-S and ESP32-C series of SoCs", "keywords": [ "framework", diff --git a/package/package_esp32_index.template.json b/package/package_esp32_index.template.json index 19254d11682..a0d78ebc47e 100644 --- a/package/package_esp32_index.template.json +++ b/package/package_esp32_index.template.json @@ -51,7 +51,7 @@ { "packager": "esp32", "name": "esp32-arduino-libs", - "version": "idf-release_v5.4-2f7dcd86-v1" + "version": "idf-master-d930a386-v1" }, { "packager": "esp32", @@ -61,7 +61,7 @@ { "packager": "esp32", "name": "xtensa-esp-elf-gdb", - "version": "14.2_20240403" + "version": "16.2_20250324" }, { "packager": "esp32", @@ -71,12 +71,12 @@ { "packager": "esp32", "name": "riscv32-esp-elf-gdb", - "version": "14.2_20240403" + "version": "16.2_20250324" }, { "packager": "esp32", "name": "openocd-esp32", - "version": "v0.12.0-esp32-20241016" + "version": "v0.12.0-esp32-20250226" }, { "packager": "esp32", @@ -104,63 +104,63 @@ "tools": [ { "name": "esp32-arduino-libs", - "version": "idf-release_v5.4-2f7dcd86-v1", + "version": "idf-master-d930a386-v1", "systems": [ { "host": "i686-mingw32", - "url": "https://github.com/espressif/esp32-arduino-lib-builder/releases/download/idf-release_v5.4/esp32-arduino-libs-idf-release_v5.4-2f7dcd86-v1.zip", - "archiveFileName": "esp32-arduino-libs-idf-release_v5.4-2f7dcd86-v1.zip", - "checksum": "SHA-256:11f1271fe5e2857155d90384690069e4d33f0f97a4c04e7474b29a7cbc7ededd", - "size": "352347498" + "url": "https://github.com/espressif/esp32-arduino-lib-builder/releases/download/idf-master/esp32-arduino-libs-idf-master-d930a386-v1.zip", + "archiveFileName": "esp32-arduino-libs-idf-master-d930a386-v1.zip", + "checksum": "SHA-256:0310daa4f08f807f2bf3babd2587c2694df64c70e367863eadf5020636b717ae", + "size": "422376381" }, { "host": "x86_64-mingw32", - "url": "https://github.com/espressif/esp32-arduino-lib-builder/releases/download/idf-release_v5.4/esp32-arduino-libs-idf-release_v5.4-2f7dcd86-v1.zip", - "archiveFileName": "esp32-arduino-libs-idf-release_v5.4-2f7dcd86-v1.zip", - "checksum": "SHA-256:11f1271fe5e2857155d90384690069e4d33f0f97a4c04e7474b29a7cbc7ededd", - "size": "352347498" + "url": "https://github.com/espressif/esp32-arduino-lib-builder/releases/download/idf-master/esp32-arduino-libs-idf-master-d930a386-v1.zip", + "archiveFileName": "esp32-arduino-libs-idf-master-d930a386-v1.zip", + "checksum": "SHA-256:0310daa4f08f807f2bf3babd2587c2694df64c70e367863eadf5020636b717ae", + "size": "422376381" }, { "host": "arm64-apple-darwin", - "url": "https://github.com/espressif/esp32-arduino-lib-builder/releases/download/idf-release_v5.4/esp32-arduino-libs-idf-release_v5.4-2f7dcd86-v1.zip", - "archiveFileName": "esp32-arduino-libs-idf-release_v5.4-2f7dcd86-v1.zip", - "checksum": "SHA-256:11f1271fe5e2857155d90384690069e4d33f0f97a4c04e7474b29a7cbc7ededd", - "size": "352347498" + "url": "https://github.com/espressif/esp32-arduino-lib-builder/releases/download/idf-master/esp32-arduino-libs-idf-master-d930a386-v1.zip", + "archiveFileName": "esp32-arduino-libs-idf-master-d930a386-v1.zip", + "checksum": "SHA-256:0310daa4f08f807f2bf3babd2587c2694df64c70e367863eadf5020636b717ae", + "size": "422376381" }, { "host": "x86_64-apple-darwin", - "url": "https://github.com/espressif/esp32-arduino-lib-builder/releases/download/idf-release_v5.4/esp32-arduino-libs-idf-release_v5.4-2f7dcd86-v1.zip", - "archiveFileName": "esp32-arduino-libs-idf-release_v5.4-2f7dcd86-v1.zip", - "checksum": "SHA-256:11f1271fe5e2857155d90384690069e4d33f0f97a4c04e7474b29a7cbc7ededd", - "size": "352347498" + "url": "https://github.com/espressif/esp32-arduino-lib-builder/releases/download/idf-master/esp32-arduino-libs-idf-master-d930a386-v1.zip", + "archiveFileName": "esp32-arduino-libs-idf-master-d930a386-v1.zip", + "checksum": "SHA-256:0310daa4f08f807f2bf3babd2587c2694df64c70e367863eadf5020636b717ae", + "size": "422376381" }, { "host": "x86_64-pc-linux-gnu", - "url": "https://github.com/espressif/esp32-arduino-lib-builder/releases/download/idf-release_v5.4/esp32-arduino-libs-idf-release_v5.4-2f7dcd86-v1.zip", - "archiveFileName": "esp32-arduino-libs-idf-release_v5.4-2f7dcd86-v1.zip", - "checksum": "SHA-256:11f1271fe5e2857155d90384690069e4d33f0f97a4c04e7474b29a7cbc7ededd", - "size": "352347498" + "url": "https://github.com/espressif/esp32-arduino-lib-builder/releases/download/idf-master/esp32-arduino-libs-idf-master-d930a386-v1.zip", + "archiveFileName": "esp32-arduino-libs-idf-master-d930a386-v1.zip", + "checksum": "SHA-256:0310daa4f08f807f2bf3babd2587c2694df64c70e367863eadf5020636b717ae", + "size": "422376381" }, { "host": "i686-pc-linux-gnu", - "url": "https://github.com/espressif/esp32-arduino-lib-builder/releases/download/idf-release_v5.4/esp32-arduino-libs-idf-release_v5.4-2f7dcd86-v1.zip", - "archiveFileName": "esp32-arduino-libs-idf-release_v5.4-2f7dcd86-v1.zip", - "checksum": "SHA-256:11f1271fe5e2857155d90384690069e4d33f0f97a4c04e7474b29a7cbc7ededd", - "size": "352347498" + "url": "https://github.com/espressif/esp32-arduino-lib-builder/releases/download/idf-master/esp32-arduino-libs-idf-master-d930a386-v1.zip", + "archiveFileName": "esp32-arduino-libs-idf-master-d930a386-v1.zip", + "checksum": "SHA-256:0310daa4f08f807f2bf3babd2587c2694df64c70e367863eadf5020636b717ae", + "size": "422376381" }, { "host": "aarch64-linux-gnu", - "url": "https://github.com/espressif/esp32-arduino-lib-builder/releases/download/idf-release_v5.4/esp32-arduino-libs-idf-release_v5.4-2f7dcd86-v1.zip", - "archiveFileName": "esp32-arduino-libs-idf-release_v5.4-2f7dcd86-v1.zip", - "checksum": "SHA-256:11f1271fe5e2857155d90384690069e4d33f0f97a4c04e7474b29a7cbc7ededd", - "size": "352347498" + "url": "https://github.com/espressif/esp32-arduino-lib-builder/releases/download/idf-master/esp32-arduino-libs-idf-master-d930a386-v1.zip", + "archiveFileName": "esp32-arduino-libs-idf-master-d930a386-v1.zip", + "checksum": "SHA-256:0310daa4f08f807f2bf3babd2587c2694df64c70e367863eadf5020636b717ae", + "size": "422376381" }, { "host": "arm-linux-gnueabihf", - "url": "https://github.com/espressif/esp32-arduino-lib-builder/releases/download/idf-release_v5.4/esp32-arduino-libs-idf-release_v5.4-2f7dcd86-v1.zip", - "archiveFileName": "esp32-arduino-libs-idf-release_v5.4-2f7dcd86-v1.zip", - "checksum": "SHA-256:11f1271fe5e2857155d90384690069e4d33f0f97a4c04e7474b29a7cbc7ededd", - "size": "352347498" + "url": "https://github.com/espressif/esp32-arduino-lib-builder/releases/download/idf-master/esp32-arduino-libs-idf-master-d930a386-v1.zip", + "archiveFileName": "esp32-arduino-libs-idf-master-d930a386-v1.zip", + "checksum": "SHA-256:0310daa4f08f807f2bf3babd2587c2694df64c70e367863eadf5020636b717ae", + "size": "422376381" } ] }, @@ -228,63 +228,63 @@ }, { "name": "xtensa-esp-elf-gdb", - "version": "14.2_20240403", + "version": "16.2_20250324", "systems": [ { "host": "x86_64-pc-linux-gnu", - "url": "https://github.com/espressif/binutils-gdb/releases/download/esp-gdb-v14.2_20240403/xtensa-esp-elf-gdb-14.2_20240403-x86_64-linux-gnu.tar.gz", - "archiveFileName": "xtensa-esp-elf-gdb-14.2_20240403-x86_64-linux-gnu.tar.gz", - "checksum": "SHA-256:9d68472d4cba5cf8c2b79d94f86f92c828e76a632bd1e6be5e7706e5b304d36e", - "size": "31010320" + "url": "https://github.com/espressif/binutils-gdb/releases/download/esp-gdb-v16.2_20250324/xtensa-esp-elf-gdb-16.2_20250324-x86_64-linux-gnu.tar.gz", + "archiveFileName": "xtensa-esp-elf-gdb-16.2_20250324-x86_64-linux-gnu.tar.gz", + "checksum": "SHA-256:27b58ab12248e04277c4fdc74038cf0a001d5142df091ab94939ad35053738fd", + "size": "36361058" }, { "host": "aarch64-linux-gnu", - "url": "https://github.com/espressif/binutils-gdb/releases/download/esp-gdb-v14.2_20240403/xtensa-esp-elf-gdb-14.2_20240403-aarch64-linux-gnu.tar.gz", - "archiveFileName": "xtensa-esp-elf-gdb-14.2_20240403-aarch64-linux-gnu.tar.gz", - "checksum": "SHA-256:bdabc3217994815fc311c4e16e588b78f6596b5ad4ffa46c80b40e982cfb1e66", - "size": "30954580" + "url": "https://github.com/espressif/binutils-gdb/releases/download/esp-gdb-v16.2_20250324/xtensa-esp-elf-gdb-16.2_20250324-aarch64-linux-gnu.tar.gz", + "archiveFileName": "xtensa-esp-elf-gdb-16.2_20250324-aarch64-linux-gnu.tar.gz", + "checksum": "SHA-256:24f85aa778e1605098a13ff7bd29d5760767faf012705c8915cb08b32cad0206", + "size": "35442104" }, { "host": "arm-linux-gnueabihf", - "url": "https://github.com/espressif/binutils-gdb/releases/download/esp-gdb-v14.2_20240403/xtensa-esp-elf-gdb-14.2_20240403-arm-linux-gnueabi.tar.gz", - "archiveFileName": "xtensa-esp-elf-gdb-14.2_20240403-arm-linux-gnueabi.tar.gz", - "checksum": "SHA-256:d54b8d703ba897b28c627da3d27106a3906dd01ba298778a67064710bc33c76d", - "size": "28697281" + "url": "https://github.com/espressif/binutils-gdb/releases/download/esp-gdb-v16.2_20250324/xtensa-esp-elf-gdb-16.2_20250324-arm-linux-gnueabi.tar.gz", + "archiveFileName": "xtensa-esp-elf-gdb-16.2_20250324-arm-linux-gnueabi.tar.gz", + "checksum": "SHA-256:c73e43038b6d50374cd0ee714370ce748189e0b00404d581babd2bb0115c4785", + "size": "31260410" }, { "host": "i686-pc-linux-gnu", - "url": "https://github.com/espressif/binutils-gdb/releases/download/esp-gdb-v14.2_20240403/xtensa-esp-elf-gdb-14.2_20240403-i586-linux-gnu.tar.gz", - "archiveFileName": "xtensa-esp-elf-gdb-14.2_20240403-i586-linux-gnu.tar.gz", - "checksum": "SHA-256:64d3bc992ed8fdec383d49e8b803ac494605a38117c8293db8da055037de96b0", - "size": "29890994" + "url": "https://github.com/espressif/binutils-gdb/releases/download/esp-gdb-v16.2_20250324/xtensa-esp-elf-gdb-16.2_20250324-i586-linux-gnu.tar.gz", + "archiveFileName": "xtensa-esp-elf-gdb-16.2_20250324-i586-linux-gnu.tar.gz", + "checksum": "SHA-256:dc7b8aad0fb1c6a1abfdb8dff4f08221ea08a0f28fb837f181969ac1174d4dc6", + "size": "35067894" }, { "host": "x86_64-apple-darwin", - "url": "https://github.com/espressif/binutils-gdb/releases/download/esp-gdb-v14.2_20240403/xtensa-esp-elf-gdb-14.2_20240403-x86_64-apple-darwin14.tar.gz", - "archiveFileName": "xtensa-esp-elf-gdb-14.2_20240403-x86_64-apple-darwin14.tar.gz", - "checksum": "SHA-256:023e74b3fda793da4bc0509b02de776ee0dad6efaaac17bef5916fb7dc9c26b9", - "size": "44446611" + "url": "https://github.com/espressif/binutils-gdb/releases/download/esp-gdb-v16.2_20250324/xtensa-esp-elf-gdb-16.2_20250324-x86_64-apple-darwin21.1.tar.gz", + "archiveFileName": "xtensa-esp-elf-gdb-16.2_20250324-x86_64-apple-darwin21.1.tar.gz", + "checksum": "SHA-256:398c429cfe696bad01d636c5488cadc87b20471c1b5ed02c60eee5ef2a775c93", + "size": "54992785" }, { "host": "arm64-apple-darwin", - "url": "https://github.com/espressif/binutils-gdb/releases/download/esp-gdb-v14.2_20240403/xtensa-esp-elf-gdb-14.2_20240403-aarch64-apple-darwin21.1.tar.gz", - "archiveFileName": "xtensa-esp-elf-gdb-14.2_20240403-aarch64-apple-darwin21.1.tar.gz", - "checksum": "SHA-256:ea757c6bf8c25238f6d2fdcc6bbab25a1b00608a0f9e19b7ddd2f37ddbdc3fb1", - "size": "37021423" + "url": "https://github.com/espressif/binutils-gdb/releases/download/esp-gdb-v16.2_20250324/xtensa-esp-elf-gdb-16.2_20250324-aarch64-apple-darwin21.1.tar.gz", + "archiveFileName": "xtensa-esp-elf-gdb-16.2_20250324-aarch64-apple-darwin21.1.tar.gz", + "checksum": "SHA-256:b6d85c0d76d653bb55f9d06b0cd509eab7e99db541c88b8c849c64827e9d74a9", + "size": "43538967" }, { "host": "i686-mingw32", - "url": "https://github.com/espressif/binutils-gdb/releases/download/esp-gdb-v14.2_20240403/xtensa-esp-elf-gdb-14.2_20240403-i686-w64-mingw32.zip", - "archiveFileName": "xtensa-esp-elf-gdb-14.2_20240403-i686-w64-mingw32.zip", - "checksum": "SHA-256:322e8d9b700dc32d8158e3dc55fb85ec55de48d0bb7789375ee39a28d5d655e2", - "size": "26302466" + "url": "https://github.com/espressif/binutils-gdb/releases/download/esp-gdb-v16.2_20250324/xtensa-esp-elf-gdb-16.2_20250324-i686-w64-mingw32.zip", + "archiveFileName": "xtensa-esp-elf-gdb-16.2_20250324-i686-w64-mingw32.zip", + "checksum": "SHA-256:f748d6b65fdf66733b82e12d0d85a05e3134122416280379df129cfebe2aa4b2", + "size": "32189419" }, { "host": "x86_64-mingw32", - "url": "https://github.com/espressif/binutils-gdb/releases/download/esp-gdb-v14.2_20240403/xtensa-esp-elf-gdb-14.2_20240403-x86_64-w64-mingw32.zip", - "archiveFileName": "xtensa-esp-elf-gdb-14.2_20240403-x86_64-w64-mingw32.zip", - "checksum": "SHA-256:a27a2fe20f192f8e0a51b8936428b4e1cf8935cfe008ee445cc49f6fc7f6db2e", - "size": "28366035" + "url": "https://github.com/espressif/binutils-gdb/releases/download/esp-gdb-v16.2_20250324/xtensa-esp-elf-gdb-16.2_20250324-x86_64-w64-mingw32.zip", + "archiveFileName": "xtensa-esp-elf-gdb-16.2_20250324-x86_64-w64-mingw32.zip", + "checksum": "SHA-256:e970fc3ec8a1d0acee2432e91e0a01b348613a0425aacfa981b2fc505fe920cc", + "size": "32290997" } ] }, @@ -352,118 +352,118 @@ }, { "name": "riscv32-esp-elf-gdb", - "version": "14.2_20240403", + "version": "16.2_20250324", "systems": [ { "host": "x86_64-pc-linux-gnu", - "url": "https://github.com/espressif/binutils-gdb/releases/download/esp-gdb-v14.2_20240403/riscv32-esp-elf-gdb-14.2_20240403-x86_64-linux-gnu.tar.gz", - "archiveFileName": "riscv32-esp-elf-gdb-14.2_20240403-x86_64-linux-gnu.tar.gz", - "checksum": "SHA-256:ce004bc0bbd71b246800d2d13b239218b272a38bd528e316f21f1af2db8a4b13", - "size": "30707431" + "url": "https://github.com/espressif/binutils-gdb/releases/download/esp-gdb-v16.2_20250324/riscv32-esp-elf-gdb-16.2_20250324-x86_64-linux-gnu.tar.gz", + "archiveFileName": "riscv32-esp-elf-gdb-16.2_20250324-x86_64-linux-gnu.tar.gz", + "checksum": "SHA-256:f9b172d8d72d0a1e2b0b80127df29263a0cb0d0c4e998e09c27031bfac09f3ec", + "size": "36528201" }, { "host": "aarch64-linux-gnu", - "url": "https://github.com/espressif/binutils-gdb/releases/download/esp-gdb-v14.2_20240403/riscv32-esp-elf-gdb-14.2_20240403-aarch64-linux-gnu.tar.gz", - "archiveFileName": "riscv32-esp-elf-gdb-14.2_20240403-aarch64-linux-gnu.tar.gz", - "checksum": "SHA-256:ba10f2866c61410b88c65957274280b1a62e3bed05131654ed9b6758efe18e55", - "size": "30824065" + "url": "https://github.com/espressif/binutils-gdb/releases/download/esp-gdb-v16.2_20250324/riscv32-esp-elf-gdb-16.2_20250324-aarch64-linux-gnu.tar.gz", + "archiveFileName": "riscv32-esp-elf-gdb-16.2_20250324-aarch64-linux-gnu.tar.gz", + "checksum": "SHA-256:68bb6a85fb58b8a738f799e8fb4fa1f56cfeffc4de803ceb03c8a33cb2cd919d", + "size": "35643464" }, { "host": "arm-linux-gnueabihf", - "url": "https://github.com/espressif/binutils-gdb/releases/download/esp-gdb-v14.2_20240403/riscv32-esp-elf-gdb-14.2_20240403-arm-linux-gnueabi.tar.gz", - "archiveFileName": "riscv32-esp-elf-gdb-14.2_20240403-arm-linux-gnueabi.tar.gz", - "checksum": "SHA-256:88539db5d987f28827efac7e26080a2803b9b539342ccd2963ccfdd56d7f08f7", - "size": "29000575" + "url": "https://github.com/espressif/binutils-gdb/releases/download/esp-gdb-v16.2_20250324/riscv32-esp-elf-gdb-16.2_20250324-arm-linux-gnueabi.tar.gz", + "archiveFileName": "riscv32-esp-elf-gdb-16.2_20250324-arm-linux-gnueabi.tar.gz", + "checksum": "SHA-256:673038ab9fb2b7391ff9252824194e3b9e40668efe9ce54d1e582a9d6c51f04a", + "size": "32154574" }, { "host": "i686-pc-linux-gnu", - "url": "https://github.com/espressif/binutils-gdb/releases/download/esp-gdb-v14.2_20240403/riscv32-esp-elf-gdb-14.2_20240403-i586-linux-gnu.tar.gz", - "archiveFileName": "riscv32-esp-elf-gdb-14.2_20240403-i586-linux-gnu.tar.gz", - "checksum": "SHA-256:0e628ee37438ab6ba05eb889a76d09e50cb98e0020a16b8e2b935c5cf19b4ed2", - "size": "29947521" + "url": "https://github.com/espressif/binutils-gdb/releases/download/esp-gdb-v16.2_20250324/riscv32-esp-elf-gdb-16.2_20250324-i586-linux-gnu.tar.gz", + "archiveFileName": "riscv32-esp-elf-gdb-16.2_20250324-i586-linux-gnu.tar.gz", + "checksum": "SHA-256:62f05d5fe08145b25e423dd0b3f1ae260be99abf5462b8cfd918bf2231e26e30", + "size": "35410891" }, { "host": "x86_64-apple-darwin", - "url": "https://github.com/espressif/binutils-gdb/releases/download/esp-gdb-v14.2_20240403/riscv32-esp-elf-gdb-14.2_20240403-x86_64-apple-darwin14.tar.gz", - "archiveFileName": "riscv32-esp-elf-gdb-14.2_20240403-x86_64-apple-darwin14.tar.gz", - "checksum": "SHA-256:8f6bda832d70dad5860a639d55aba4237bd10cbac9f4822db1eece97357b34a9", - "size": "44196117" + "url": "https://github.com/espressif/binutils-gdb/releases/download/esp-gdb-v16.2_20250324/riscv32-esp-elf-gdb-16.2_20250324-x86_64-apple-darwin21.1.tar.gz", + "archiveFileName": "riscv32-esp-elf-gdb-16.2_20250324-x86_64-apple-darwin21.1.tar.gz", + "checksum": "SHA-256:63ae12cfbab648e2d2ca7a700a0c615c4f36a6fbe6876c11ba108115ee0d60f2", + "size": "55359246" }, { "host": "arm64-apple-darwin", - "url": "https://github.com/espressif/binutils-gdb/releases/download/esp-gdb-v14.2_20240403/riscv32-esp-elf-gdb-14.2_20240403-aarch64-apple-darwin21.1.tar.gz", - "archiveFileName": "riscv32-esp-elf-gdb-14.2_20240403-aarch64-apple-darwin21.1.tar.gz", - "checksum": "SHA-256:d88b6116e86456c8480ce9bc95aed375a35c0d091f1da0a53b86be0e6ef3d320", - "size": "36794404" + "url": "https://github.com/espressif/binutils-gdb/releases/download/esp-gdb-v16.2_20250324/riscv32-esp-elf-gdb-16.2_20250324-aarch64-apple-darwin21.1.tar.gz", + "archiveFileName": "riscv32-esp-elf-gdb-16.2_20250324-aarch64-apple-darwin21.1.tar.gz", + "checksum": "SHA-256:bfbe49774f839020cef988537da0a06896dfe4a382674c62285361ed9bd4aee3", + "size": "43926592" }, { "host": "i686-mingw32", - "url": "https://github.com/espressif/binutils-gdb/releases/download/esp-gdb-v14.2_20240403/riscv32-esp-elf-gdb-14.2_20240403-i686-w64-mingw32.zip", - "archiveFileName": "riscv32-esp-elf-gdb-14.2_20240403-i686-w64-mingw32.zip", - "checksum": "SHA-256:d6e7ce05805b0d8d4dd138ad239b98a1adf8da98941867d60760eb1ae5361730", - "size": "26486295" + "url": "https://github.com/espressif/binutils-gdb/releases/download/esp-gdb-v16.2_20250324/riscv32-esp-elf-gdb-16.2_20250324-i686-w64-mingw32.zip", + "archiveFileName": "riscv32-esp-elf-gdb-16.2_20250324-i686-w64-mingw32.zip", + "checksum": "SHA-256:e8b84eec990ff514729b3770edf2b543f36670f43663ce0c3b624fb4884812ca", + "size": "32914955" }, { "host": "x86_64-mingw32", - "url": "https://github.com/espressif/binutils-gdb/releases/download/esp-gdb-v14.2_20240403/riscv32-esp-elf-gdb-14.2_20240403-x86_64-w64-mingw32.zip", - "archiveFileName": "riscv32-esp-elf-gdb-14.2_20240403-x86_64-w64-mingw32.zip", - "checksum": "SHA-256:5c9f211dc46daf6b96fad09d709284a0f0186fef8947d9f6edd6bca5b5ad4317", - "size": "27942579" + "url": "https://github.com/espressif/binutils-gdb/releases/download/esp-gdb-v16.2_20250324/riscv32-esp-elf-gdb-16.2_20250324-x86_64-w64-mingw32.zip", + "archiveFileName": "riscv32-esp-elf-gdb-16.2_20250324-x86_64-w64-mingw32.zip", + "checksum": "SHA-256:37c79178900c19ca7487c26af4b5ad6b0d3f34683bd0e9c2ddd39038c999e429", + "size": "32667353" } ] }, { "name": "openocd-esp32", - "version": "v0.12.0-esp32-20241016", + "version": "v0.12.0-esp32-20250226", "systems": [ { "host": "x86_64-pc-linux-gnu", - "url": "https://github.com/espressif/openocd-esp32/releases/download/v0.12.0-esp32-20241016/openocd-esp32-linux-amd64-0.12.0-esp32-20241016.tar.gz", - "archiveFileName": "openocd-esp32-linux-amd64-0.12.0-esp32-20241016.tar.gz", - "checksum": "SHA-256:e82b0f036dc99244bead5f09a86e91bb2365cbcd1122ac68261e5647942485df", - "size": "2398717" + "url": "https://github.com/espressif/openocd-esp32/releases/download/v0.12.0-esp32-20250226/openocd-esp32-linux-amd64-0.12.0-esp32-20250226.tar.gz", + "archiveFileName": "openocd-esp32-linux-amd64-0.12.0-esp32-20250226.tar.gz", + "checksum": "SHA-256:914c726342ba5828e53f41aa454f01f317c42d8e6772d3d874593a6960fc4729", + "size": "2414924" }, { "host": "aarch64-linux-gnu", - "url": "https://github.com/espressif/openocd-esp32/releases/download/v0.12.0-esp32-20241016/openocd-esp32-linux-arm64-0.12.0-esp32-20241016.tar.gz", - "archiveFileName": "openocd-esp32-linux-arm64-0.12.0-esp32-20241016.tar.gz", - "checksum": "SHA-256:8f8daf5bd22ec5d2fa9257b0862ec33da18ee677e023fb9a9eb17f74ce208c76", - "size": "2271584" + "url": "https://github.com/espressif/openocd-esp32/releases/download/v0.12.0-esp32-20250226/openocd-esp32-linux-arm64-0.12.0-esp32-20250226.tar.gz", + "archiveFileName": "openocd-esp32-linux-arm64-0.12.0-esp32-20250226.tar.gz", + "checksum": "SHA-256:c44ee99a9209c0234dbbcec86339fd685f5c61a763b29c33eba590bf62db2296", + "size": "2293923" }, { "host": "arm-linux-gnueabihf", - "url": "https://github.com/espressif/openocd-esp32/releases/download/v0.12.0-esp32-20241016/openocd-esp32-linux-armel-0.12.0-esp32-20241016.tar.gz", - "archiveFileName": "openocd-esp32-linux-armel-0.12.0-esp32-20241016.tar.gz", - "checksum": "SHA-256:bc9c020ecf20e2000f76cffa44305fd5bc44d2e688ea78cce423399d33f19767", - "size": "2414206" + "url": "https://github.com/espressif/openocd-esp32/releases/download/v0.12.0-esp32-20250226/openocd-esp32-linux-armel-0.12.0-esp32-20250226.tar.gz", + "archiveFileName": "openocd-esp32-linux-armel-0.12.0-esp32-20250226.tar.gz", + "checksum": "SHA-256:21ab6af3cf05f9290f4d59f1f381d5094dd2755fc528d3d2feb9334348fc0d8d", + "size": "2436071" }, { "host": "x86_64-apple-darwin", - "url": "https://github.com/espressif/openocd-esp32/releases/download/v0.12.0-esp32-20241016/openocd-esp32-macos-0.12.0-esp32-20241016.tar.gz", - "archiveFileName": "openocd-esp32-macos-0.12.0-esp32-20241016.tar.gz", - "checksum": "SHA-256:02a2dffe801a2d005fa9e614d80ff8173395b2cb0b5d3118d0229d094a9946a7", - "size": "2508089" + "url": "https://github.com/espressif/openocd-esp32/releases/download/v0.12.0-esp32-20250226/openocd-esp32-macos-0.12.0-esp32-20250226.tar.gz", + "archiveFileName": "openocd-esp32-macos-0.12.0-esp32-20250226.tar.gz", + "checksum": "SHA-256:0b5751699e93b6d101381611c96216ddff8c7dfd16425c610993fa27993f9a0a", + "size": "2525387" }, { "host": "arm64-apple-darwin", - "url": "https://github.com/espressif/openocd-esp32/releases/download/v0.12.0-esp32-20241016/openocd-esp32-macos-arm64-0.12.0-esp32-20241016.tar.gz", - "archiveFileName": "openocd-esp32-macos-arm64-0.12.0-esp32-20241016.tar.gz", - "checksum": "SHA-256:c382f9e884d6565cb6089bff5f200f4810994667d885f062c3d3c5625a0fa9d6", - "size": "2552569" + "url": "https://github.com/espressif/openocd-esp32/releases/download/v0.12.0-esp32-20250226/openocd-esp32-macos-arm64-0.12.0-esp32-20250226.tar.gz", + "archiveFileName": "openocd-esp32-macos-arm64-0.12.0-esp32-20250226.tar.gz", + "checksum": "SHA-256:8bffbbb594b27a4971a3922792135f8c836fff26991f7f450094386920263531", + "size": "2568843" }, { "host": "i686-mingw32", - "url": "https://github.com/espressif/openocd-esp32/releases/download/v0.12.0-esp32-20241016/openocd-esp32-win32-0.12.0-esp32-20241016.zip", - "archiveFileName": "openocd-esp32-win32-0.12.0-esp32-20241016.zip", - "checksum": "SHA-256:3b5d615e0a72cc771a45dd469031312d5881c01d7b6bc9edb29b8b6bda8c2e90", - "size": "2946244" + "url": "https://github.com/espressif/openocd-esp32/releases/download/v0.12.0-esp32-20250226/openocd-esp32-win32-0.12.0-esp32-20250226.zip", + "archiveFileName": "openocd-esp32-win32-0.12.0-esp32-20250226.zip", + "checksum": "SHA-256:aaf3c955bb4eb47805a1ba108dfd07a8a56ce720cb40194a354362b5f0961230", + "size": "2960226" }, { "host": "x86_64-mingw32", - "url": "https://github.com/espressif/openocd-esp32/releases/download/v0.12.0-esp32-20241016/openocd-esp32-win64-0.12.0-esp32-20241016.zip", - "archiveFileName": "openocd-esp32-win64-0.12.0-esp32-20241016.zip", - "checksum": "SHA-256:5e7b2fd1947d3a8625f6a11db7a2340cf2f41ff4c61284c022c7d7c32b18780a", - "size": "2946244" + "url": "https://github.com/espressif/openocd-esp32/releases/download/v0.12.0-esp32-20250226/openocd-esp32-win64-0.12.0-esp32-20250226.zip", + "archiveFileName": "openocd-esp32-win64-0.12.0-esp32-20250226.zip", + "checksum": "SHA-256:79baf35325117a53093b62f6b9bee677dd12275d7066e3f8a274d2a80e986b6e", + "size": "2960225" } ] }, diff --git a/platform.txt b/platform.txt index 65be05b3bf4..cca1a8a9d9e 100644 --- a/platform.txt +++ b/platform.txt @@ -1,5 +1,5 @@ name=ESP32 Arduino -version=3.2.0 +version=3.3.0 tools.esp32-arduino-libs.path={runtime.platform.path}/tools/esp32-arduino-libs tools.esp32-arduino-libs.path.windows={runtime.platform.path}\tools\esp32-arduino-libs @@ -84,6 +84,7 @@ build.extra_flags.esp32c3=-DARDUINO_USB_MODE=1 -DARDUINO_USB_CDC_ON_BOOT={build. build.extra_flags.esp32c6=-DARDUINO_USB_MODE=1 -DARDUINO_USB_CDC_ON_BOOT={build.cdc_on_boot} build.extra_flags.esp32h2=-DARDUINO_USB_MODE=1 -DARDUINO_USB_CDC_ON_BOOT={build.cdc_on_boot} build.extra_flags.esp32p4=-DARDUINO_USB_MODE={build.usb_mode} -DARDUINO_USB_CDC_ON_BOOT={build.cdc_on_boot} -DARDUINO_USB_MSC_ON_BOOT={build.msc_on_boot} -DARDUINO_USB_DFU_ON_BOOT={build.dfu_on_boot} +build.extra_flags.esp32c5=-DARDUINO_USB_MODE=1 -DARDUINO_USB_CDC_ON_BOOT={build.cdc_on_boot} # This can be overriden in boards.txt build.zigbee_mode= @@ -260,6 +261,14 @@ debug_config.esp32c6= debug_script.esp32h2=esp32h2-builtin.cfg debug_config.esp32h2= +# ESP32-P4 debug configuration (TBD) +debug_script.esp32p4=esp32p4-builtin.cfg +debug_config.esp32p4= + +# ESP32-C5 debug configuration (TBD) +debug_script.esp32c5=esp32c5-builtin.cfg +debug_config.esp32c5= + # Debug API variable definitions debug.executable={build.path}/{build.project_name}.elf debug.toolchain=gcc diff --git a/tools/pioarduino-build.py b/tools/pioarduino-build.py index 3335a716888..47940b0d043 100644 --- a/tools/pioarduino-build.py +++ b/tools/pioarduino-build.py @@ -213,7 +213,11 @@ def add_tinyuf2_extra_image(): LIBSOURCE_DIRS=[join(FRAMEWORK_DIR, "libraries")], FLASH_EXTRA_IMAGES=[ ( - "0x1000" if build_mcu in ["esp32", "esp32s2"] else ("0x2000" if build_mcu in ["esp32p4"] else "0x0000"), + ( + "0x1000" + if build_mcu in ["esp32", "esp32s2"] + else ("0x2000" if build_mcu in ["esp32p4", "esp32c5"] else "0x0000") + ), get_bootloader_image(variants_dir), ), ("0x8000", join(env.subst("$BUILD_DIR"), "partitions.bin")), diff --git a/variants/alfredo-nou3/pins_arduino.h b/variants/alfredo-nou3/pins_arduino.h index 88bdbea0bb1..8b5a7d51b9f 100644 --- a/variants/alfredo-nou3/pins_arduino.h +++ b/variants/alfredo-nou3/pins_arduino.h @@ -1,6 +1,7 @@ #ifndef Pins_Arduino_h #define Pins_Arduino_h +#include #define USB_VID 0xAFD0 #define USB_PID 0x0003 #define USB_MANUFACTURER "Alfredo" diff --git a/variants/esp32c5/pins_arduino.h b/variants/esp32c5/pins_arduino.h new file mode 100644 index 00000000000..e3a7e57ef44 --- /dev/null +++ b/variants/esp32c5/pins_arduino.h @@ -0,0 +1,48 @@ +#ifndef Pins_Arduino_h +#define Pins_Arduino_h + +#include +#include "soc/soc_caps.h" + +#define PIN_RGB_LED 27 +// BUILTIN_LED can be used in new Arduino API digitalWrite() like in Blink.ino +static const uint8_t LED_BUILTIN = SOC_GPIO_PIN_COUNT + PIN_RGB_LED; +#define BUILTIN_LED LED_BUILTIN // backward compatibility +#define LED_BUILTIN LED_BUILTIN // allow testing #ifdef LED_BUILTIN +// RGB_BUILTIN and RGB_BRIGHTNESS can be used in new Arduino API rgbLedWrite() +#define RGB_BUILTIN LED_BUILTIN +#define RGB_BRIGHTNESS 64 + +static const uint8_t TX = 11; +static const uint8_t RX = 12; + +// static const uint8_t USB_DM = 13; +// static const uint8_t USB_DP = 14; + +static const uint8_t SDA = 0; +static const uint8_t SCL = 1; + +static const uint8_t SS = 6; +static const uint8_t MOSI = 8; +static const uint8_t MISO = 9; +static const uint8_t SCK = 10; + +static const uint8_t A0 = 1; +static const uint8_t A1 = 2; +static const uint8_t A2 = 3; +static const uint8_t A3 = 4; +static const uint8_t A4 = 5; +static const uint8_t A5 = 6; + +// LP I2C Pins are fixed on ESP32-C5 +static const uint8_t LP_SDA = 2; +static const uint8_t LP_SCL = 3; +#define WIRE1_PIN_DEFINED +#define SDA1 LP_SDA +#define SCL1 LP_SCL + +// LP UART Pins are fixed on ESP32-C5 +static const uint8_t LP_RX = 4; +static const uint8_t LP_TX = 5; + +#endif /* Pins_Arduino_h */ diff --git a/variants/lilygo_tlora_pager/pins_arduino.h b/variants/lilygo_tlora_pager/pins_arduino.h index 1a1d8e5da3f..fb57b5d493f 100644 --- a/variants/lilygo_tlora_pager/pins_arduino.h +++ b/variants/lilygo_tlora_pager/pins_arduino.h @@ -8,7 +8,7 @@ #endif #define USB_VID 0x303a -#define USB_PID 0x82D1 +#define USB_PID 0x82D4 #define USB_MANUFACTURER "LILYGO" #define USB_PRODUCT "T-LoRa-Pager" @@ -20,9 +20,9 @@ static const uint8_t TX = 43; static const uint8_t RX = 44; -//BHI260,PCF85063,BQ25896,DRV2605L,ES8311 share I2C Bus -static const uint8_t SDA = 2; -static const uint8_t SCL = 3; +// BHI260,PCF85063,BQ25896,DRV2605L,ES8311 share I2C Bus +static const uint8_t SDA = 3; +static const uint8_t SCL = 2; // Default sd cs pin static const uint8_t SS = SD_CS; @@ -75,16 +75,18 @@ static const uint8_t SCK = 35; #define DISP_BL (42) // External expansion chip IO definition -#define EXPANDS_DRV_EN (0) -#define EXPANDS_AMP_EN (1) -#define EXPANDS_KB_RST (2) -#define EXPANDS_LORA_EN (3) -#define EXPANDS_GPS_EN (4) -#define EXPANDS_NFC_EN (5) -#define EXPANDS_DISP_RST (6) -#define EXPANDS_GPS_RST (7) -#define EXPANDS_KB_EN (8) -#define EXPANDS_GPIO_EN (9) +#define EXPANDS_DRV_EN (0) +#define EXPANDS_AMP_EN (1) +#define EXPANDS_KB_RST (2) +#define EXPANDS_LORA_EN (3) +#define EXPANDS_GPS_EN (4) +#define EXPANDS_NFC_EN (5) +#define EXPANDS_GPS_RST (7) +#define EXPANDS_KB_EN (8) +#define EXPANDS_GPIO_EN (9) +#define EXPANDS_SD_DET (10) +#define EXPANDS_SD_PULLEN (11) +#define EXPANDS_SD_EN (12) // Peripheral definition exists #define USING_AUDIO_CODEC diff --git a/variants/lilygo_twatch_s3/pins_arduino.h b/variants/lilygo_twatch_s3/pins_arduino.h index b184dc9ba17..05543de27c5 100644 --- a/variants/lilygo_twatch_s3/pins_arduino.h +++ b/variants/lilygo_twatch_s3/pins_arduino.h @@ -44,7 +44,7 @@ static const uint8_t TX = 42; static const uint8_t RX = 41; -//BHI260,PCF85063,AXP2101,DRV2605L,PN532 share I2C Bus +// BMA423,PCF8563,AXP2101,DRV2605L share I2C Bus static const uint8_t SDA = 10; static const uint8_t SCL = 11; diff --git a/variants/lilygo_twatch_ultra/pins_arduino.h b/variants/lilygo_twatch_ultra/pins_arduino.h index c90c1ba584e..91797e687fa 100644 --- a/variants/lilygo_twatch_ultra/pins_arduino.h +++ b/variants/lilygo_twatch_ultra/pins_arduino.h @@ -22,6 +22,7 @@ #define DISP_D3 (45) #define DISP_SCK (40) #define DISP_CS (41) +#define DISP_RST (37) #define DISP_TE (6) // Interrupt IO port @@ -47,9 +48,9 @@ static const uint8_t TX = 43; static const uint8_t RX = 44; -//BHI260,PCF85063,AXP2101,DRV2605L,PN532 share I2C Bus -static const uint8_t SDA = 2; -static const uint8_t SCL = 3; +// BHI260,PCF85063,AXP2101,DRV2605L share I2C Bus +static const uint8_t SDA = 3; +static const uint8_t SCL = 2; // Default sd cs pin static const uint8_t SS = SD_CS; @@ -76,8 +77,8 @@ static const uint8_t SCK = 35; // External expansion chip IO definition #define EXPANDS_DRV_EN (6) #define EXPANDS_DISP_EN (7) -#define EXPANDS_TOUCH_RST (10) -#define EXPANDS_DISP_RST (11) +#define EXPANDS_TOUCH_RST (8) +#define EXPANDS_SD_DET (10) // Peripheral definition exists #define USING_XL9555_EXPANDS