diff --git a/.github/workflows/bloat_check.yaml b/.github/workflows/bloat_check.yaml index 148426d99ccd6b..a5a059ec7b9cbb 100644 --- a/.github/workflows/bloat_check.yaml +++ b/.github/workflows/bloat_check.yaml @@ -34,7 +34,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build:41 + image: ghcr.io/project-chip/chip-build:47 steps: - name: Checkout diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 1da7dd09665706..0616a9bb7f7acd 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -16,6 +16,8 @@ name: Builds on: push: + branches-ignore: + - 'dependabot/**' pull_request: merge_group: workflow_dispatch: @@ -40,7 +42,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:41 + image: ghcr.io/project-chip/chip-build:47 volumes: - "/:/runner-root-volume" - "/tmp/log_output:/tmp/test_logs" @@ -136,7 +138,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:41 + image: ghcr.io/project-chip/chip-build:47 volumes: - "/:/runner-root-volume" - "/tmp/log_output:/tmp/test_logs" @@ -279,7 +281,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:41 + image: ghcr.io/project-chip/chip-build:47 volumes: - "/:/runner-root-volume" - "/tmp/log_output:/tmp/test_logs" @@ -340,7 +342,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:41 + image: ghcr.io/project-chip/chip-build:47 volumes: - "/:/runner-root-volume" - "/tmp/log_output:/tmp/test_logs" @@ -449,7 +451,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:41 + image: ghcr.io/project-chip/chip-build:47 volumes: - "/:/runner-root-volume" - "/tmp/log_output:/tmp/test_logs" diff --git a/.github/workflows/chef.yaml b/.github/workflows/chef.yaml index c2c4a777bde7d3..f69ed74e523421 100644 --- a/.github/workflows/chef.yaml +++ b/.github/workflows/chef.yaml @@ -16,6 +16,8 @@ name: Build Chef CI examples on all platforms on: push: + branches-ignore: + - 'dependabot/**' pull_request: merge_group: @@ -33,7 +35,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:41 + image: ghcr.io/project-chip/chip-build:47 options: --user root steps: @@ -54,7 +56,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-esp32:41 + image: ghcr.io/project-chip/chip-build-esp32:47 options: --user root steps: @@ -75,7 +77,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-nrf-platform:41 + image: ghcr.io/project-chip/chip-build-nrf-platform:47 options: --user root steps: @@ -96,7 +98,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-telink:41 + image: ghcr.io/project-chip/chip-build-telink:47 options: --user root steps: @@ -108,7 +110,7 @@ jobs: platform: telink # - name: Update Zephyr to specific revision (for developers purpose) # shell: bash - # run: scripts/run_in_build_env.sh "python3 scripts/tools/telink/update_zephyr.py b5c8028ec94f3efa69decff3a09f0d6f8a21fd6d" + # run: scripts/run_in_build_env.sh "python3 scripts/tools/telink/update_zephyr.py 65dc1812431bf946dfc110682298acf83d63e27a" - name: CI Examples Telink shell: bash run: | diff --git a/.github/workflows/cirque.yaml b/.github/workflows/cirque.yaml index 919085ac77ee0f..e61bdd8778d209 100644 --- a/.github/workflows/cirque.yaml +++ b/.github/workflows/cirque.yaml @@ -16,6 +16,8 @@ name: Cirque on: push: + branches-ignore: + - 'dependabot/**' pull_request: merge_group: workflow_dispatch: @@ -40,7 +42,7 @@ jobs: # need to run with privilege, which isn't supported by job.XXX.contaner # https://github.com/actions/container-action/issues/2 # container: - # image: ghcr.io/project-chip/chip-build-cirque:41 + # image: ghcr.io/project-chip/chip-build-cirque:47 # volumes: # - "/tmp:/tmp" # - "/dev/pts:/dev/pts" diff --git a/.github/workflows/darwin-tests.yaml b/.github/workflows/darwin-tests.yaml index 78e06521d973f2..a916250572bb6e 100644 --- a/.github/workflows/darwin-tests.yaml +++ b/.github/workflows/darwin-tests.yaml @@ -16,6 +16,8 @@ name: Darwin Tests on: push: + branches-ignore: + - 'dependabot/**' pull_request: merge_group: workflow_dispatch: diff --git a/.github/workflows/darwin.yaml b/.github/workflows/darwin.yaml index af8740f74eddb7..3076f046e3f38f 100644 --- a/.github/workflows/darwin.yaml +++ b/.github/workflows/darwin.yaml @@ -16,6 +16,8 @@ name: Darwin on: push: + branches-ignore: + - 'dependabot/**' pull_request: merge_group: workflow_dispatch: @@ -73,9 +75,6 @@ jobs: options: # We don't need a full matrix - flavor: asan arguments: -enableAddressSanitizer YES -enableUndefinedBehaviorSanitizer YES - - flavor: asan-global-storage - arguments: -enableAddressSanitizer YES -enableUndefinedBehaviorSanitizer YES - defines: MTR_PER_CONTROLLER_STORAGE_ENABLED=0 - flavor: tsan arguments: -enableThreadSanitizer YES steps: diff --git a/.github/workflows/doxygen.yaml b/.github/workflows/doxygen.yaml index cc93947c2c0937..90a1ee02c6ffd7 100644 --- a/.github/workflows/doxygen.yaml +++ b/.github/workflows/doxygen.yaml @@ -81,7 +81,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build-doxygen:41 + image: ghcr.io/project-chip/chip-build-doxygen:47 if: github.actor != 'restyled-io[bot]' diff --git a/.github/workflows/examples-ameba.yaml b/.github/workflows/examples-ameba.yaml index 1d4d478d0c00b6..ff405b963c1827 100644 --- a/.github/workflows/examples-ameba.yaml +++ b/.github/workflows/examples-ameba.yaml @@ -16,6 +16,8 @@ name: Build example - Ameba on: push: + branches-ignore: + - 'dependabot/**' pull_request: merge_group: @@ -36,7 +38,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-ameba:42 + image: ghcr.io/project-chip/chip-build-ameba:47 options: --user root steps: diff --git a/.github/workflows/examples-asr.yaml b/.github/workflows/examples-asr.yaml index 52c63eda8fbbd0..55f14bc003a278 100644 --- a/.github/workflows/examples-asr.yaml +++ b/.github/workflows/examples-asr.yaml @@ -16,6 +16,8 @@ name: Build example - ASR on: push: + branches-ignore: + - 'dependabot/**' pull_request: merge_group: @@ -34,7 +36,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-asr:41 + image: ghcr.io/project-chip/chip-build-asr:47 options: --user root steps: @@ -60,4 +62,4 @@ jobs: --target asr-asr582x-dishwasher \ --target asr-asr582x-refrigerator \ build \ - " \ No newline at end of file + " diff --git a/.github/workflows/examples-bouffalolab.yaml b/.github/workflows/examples-bouffalolab.yaml index 8d12696dcd8f89..7599fb1738c884 100644 --- a/.github/workflows/examples-bouffalolab.yaml +++ b/.github/workflows/examples-bouffalolab.yaml @@ -16,6 +16,8 @@ name: Build example - BouffaloLab on: push: + branches-ignore: + - 'dependabot/**' pull_request: merge_group: workflow_dispatch: @@ -35,7 +37,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-bouffalolab:41 + image: ghcr.io/project-chip/chip-build-bouffalolab:47 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-cc13x2x7_26x2x7.yaml b/.github/workflows/examples-cc13xx_26xx.yaml similarity index 92% rename from .github/workflows/examples-cc13x2x7_26x2x7.yaml rename to .github/workflows/examples-cc13xx_26xx.yaml index d36fb18c7c0509..ce8c5a94910c1c 100644 --- a/.github/workflows/examples-cc13x2x7_26x2x7.yaml +++ b/.github/workflows/examples-cc13xx_26xx.yaml @@ -12,10 +12,12 @@ # See the License for the specific language governing permissions and # limitations under the License. -name: Build example - TI CC26X2X7 +name: Build example - TI CC13XX_26XX on: push: + branches-ignore: + - 'dependabot/**' pull_request: merge_group: @@ -26,17 +28,17 @@ env: CHIP_NO_LOG_TIMESTAMPS: true jobs: - cc26x2x7: - name: cc26x2x7 + cc13xx_26xx: + name: cc13xx_26xx env: - BUILD_TYPE: gn_cc26x2x7 + BUILD_TYPE: gn_cc13xx_26xx runs-on: ubuntu-latest if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-ti:46 + image: ghcr.io/project-chip/chip-build-ti:47 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: @@ -97,11 +99,6 @@ jobs: cc13x4_26x4 LP_EM_CC1354P10_6 lighting-app \ out/artifacts/ti-cc13x4_26x4-lighting-mtd/chip-LP_EM_CC1354P10_6-lighting-example.out \ /tmp/bloat_reports/ - - name: Uploading Size Reports - uses: ./.github/actions/upload-size-reports - if: ${{ !env.ACT }} - with: - platform-name: cc13x2x7_26x2x7 - name: Uploading Size Reports uses: ./.github/actions/upload-size-reports if: ${{ !env.ACT }} diff --git a/.github/workflows/examples-cc32xx.yaml b/.github/workflows/examples-cc32xx.yaml index a56e5cff8d70c4..112f79c429e526 100644 --- a/.github/workflows/examples-cc32xx.yaml +++ b/.github/workflows/examples-cc32xx.yaml @@ -16,6 +16,8 @@ name: Build example - TI CC32XX on: push: + branches-ignore: + - 'dependabot/**' pull_request: merge_group: @@ -37,7 +39,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-ti:46 + image: ghcr.io/project-chip/chip-build-ti:47 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-efr32.yaml b/.github/workflows/examples-efr32.yaml index c4af320b990074..019807f32164c0 100644 --- a/.github/workflows/examples-efr32.yaml +++ b/.github/workflows/examples-efr32.yaml @@ -16,6 +16,8 @@ name: Build example - EFR32 on: push: + branches-ignore: + - 'dependabot/**' pull_request: merge_group: @@ -38,7 +40,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-efr32:41 + image: ghcr.io/project-chip/chip-build-efr32:47 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-esp32.yaml b/.github/workflows/examples-esp32.yaml index d262bd789c687b..be0cecc263f740 100644 --- a/.github/workflows/examples-esp32.yaml +++ b/.github/workflows/examples-esp32.yaml @@ -16,6 +16,8 @@ name: Build example - ESP32 on: push: + branches-ignore: + - 'dependabot/**' pull_request: merge_group: @@ -34,7 +36,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-esp32:41 + image: ghcr.io/project-chip/chip-build-esp32:47 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" @@ -124,7 +126,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-esp32:41 + image: ghcr.io/project-chip/chip-build-esp32:47 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" diff --git a/.github/workflows/examples-infineon.yaml b/.github/workflows/examples-infineon.yaml index 0f94ce1a2da631..c06f6181b4aac1 100644 --- a/.github/workflows/examples-infineon.yaml +++ b/.github/workflows/examples-infineon.yaml @@ -16,6 +16,8 @@ name: Build example - Infineon on: push: + branches-ignore: + - 'dependabot/**' pull_request: merge_group: workflow_dispatch: @@ -35,7 +37,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-infineon:41 + image: ghcr.io/project-chip/chip-build-infineon:47 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: @@ -144,4 +146,4 @@ jobs: uses: ./.github/actions/upload-size-reports if: ${{ !env.ACT }} with: - platform-name: Infineon \ No newline at end of file + platform-name: Infineon diff --git a/.github/workflows/examples-linux-arm.yaml b/.github/workflows/examples-linux-arm.yaml index 562279a0d35375..bc9d3025a8369f 100644 --- a/.github/workflows/examples-linux-arm.yaml +++ b/.github/workflows/examples-linux-arm.yaml @@ -16,6 +16,8 @@ name: Build example - Linux ARM on: push: + branches-ignore: + - 'dependabot/**' pull_request: merge_group: @@ -34,7 +36,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-crosscompile:41 + image: ghcr.io/project-chip/chip-build-crosscompile:47 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" diff --git a/.github/workflows/examples-linux-imx.yaml b/.github/workflows/examples-linux-imx.yaml index 843e76b9b14c41..cd52f099b39bc5 100644 --- a/.github/workflows/examples-linux-imx.yaml +++ b/.github/workflows/examples-linux-imx.yaml @@ -16,6 +16,8 @@ name: Build example - i.MX Linux on: push: + branches-ignore: + - 'dependabot/**' pull_request: merge_group: @@ -34,7 +36,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-imx:41 + image: ghcr.io/project-chip/chip-build-imx:47 steps: - name: Checkout diff --git a/.github/workflows/examples-linux-standalone.yaml b/.github/workflows/examples-linux-standalone.yaml index ea60e6adbcb022..28f0ad19dbbe45 100644 --- a/.github/workflows/examples-linux-standalone.yaml +++ b/.github/workflows/examples-linux-standalone.yaml @@ -16,6 +16,8 @@ name: Build example - Linux Standalone on: push: + branches-ignore: + - 'dependabot/**' pull_request: merge_group: @@ -34,7 +36,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:41 + image: ghcr.io/project-chip/chip-build:47 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" diff --git a/.github/workflows/examples-linux-tv-casting-app.yaml b/.github/workflows/examples-linux-tv-casting-app.yaml index daba40795f8d87..e7ecb5bdddecc7 100644 --- a/.github/workflows/examples-linux-tv-casting-app.yaml +++ b/.github/workflows/examples-linux-tv-casting-app.yaml @@ -16,6 +16,8 @@ name: Test TV Casting Example on: push: + branches-ignore: + - 'dependabot/**' pull_request: merge_group: diff --git a/.github/workflows/examples-mbed.yaml b/.github/workflows/examples-mbed.yaml index 4b5748b4d0abe7..6c20b6374ec183 100644 --- a/.github/workflows/examples-mbed.yaml +++ b/.github/workflows/examples-mbed.yaml @@ -16,6 +16,8 @@ name: Build example - Mbed OS on: push: + branches-ignore: + - 'dependabot/**' pull_request: merge_group: workflow_dispatch: @@ -40,7 +42,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-mbed-os:41 + image: ghcr.io/project-chip/chip-build-mbed-os:47 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" diff --git a/.github/workflows/examples-mw320.yaml b/.github/workflows/examples-mw320.yaml index a16ea66c148aca..9135074a39da79 100644 --- a/.github/workflows/examples-mw320.yaml +++ b/.github/workflows/examples-mw320.yaml @@ -16,6 +16,8 @@ name: Build example - MW320 on: push: + branches-ignore: + - 'dependabot/**' pull_request: merge_group: @@ -37,7 +39,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:41 + image: ghcr.io/project-chip/chip-build:47 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-nrfconnect.yaml b/.github/workflows/examples-nrfconnect.yaml index eb62c69299fc85..ad0993852ac613 100644 --- a/.github/workflows/examples-nrfconnect.yaml +++ b/.github/workflows/examples-nrfconnect.yaml @@ -16,6 +16,8 @@ name: Build example - nRF Connect SDK on: push: + branches-ignore: + - 'dependabot/**' pull_request: merge_group: @@ -37,7 +39,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-nrf-platform:41 + image: ghcr.io/project-chip/chip-build-nrf-platform:47 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" diff --git a/.github/workflows/examples-nxp.yaml b/.github/workflows/examples-nxp.yaml index 9a8a7b8968bdc1..f6ca62c7011f4c 100644 --- a/.github/workflows/examples-nxp.yaml +++ b/.github/workflows/examples-nxp.yaml @@ -16,6 +16,8 @@ name: Build example - NXP on: push: + branches-ignore: + - 'dependabot/**' pull_request: merge_group: @@ -37,7 +39,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-k32w:38 + image: ghcr.io/project-chip/chip-build-k32w:47 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-openiotsdk.yaml b/.github/workflows/examples-openiotsdk.yaml index b6f69791d2270a..9ddaea33b6291b 100644 --- a/.github/workflows/examples-openiotsdk.yaml +++ b/.github/workflows/examples-openiotsdk.yaml @@ -16,6 +16,8 @@ name: Build example - Open IoT SDK on: push: + branches-ignore: + - 'dependabot/**' pull_request: merge_group: workflow_dispatch: @@ -38,7 +40,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-openiotsdk:41 + image: ghcr.io/project-chip/chip-build-openiotsdk:47 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" options: --privileged diff --git a/.github/workflows/examples-qpg.yaml b/.github/workflows/examples-qpg.yaml index b0af5ab2141ef0..5d61bccda1fdac 100644 --- a/.github/workflows/examples-qpg.yaml +++ b/.github/workflows/examples-qpg.yaml @@ -16,6 +16,8 @@ name: Build example - QPG on: push: + branches-ignore: + - 'dependabot/**' pull_request: merge_group: @@ -37,7 +39,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:41 + image: ghcr.io/project-chip/chip-build:47 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: @@ -86,4 +88,4 @@ jobs: uses: ./.github/actions/upload-size-reports if: ${{ !env.ACT }} with: - platform-name: QPG \ No newline at end of file + platform-name: QPG diff --git a/.github/workflows/examples-rw61x.yaml b/.github/workflows/examples-rw61x.yaml index 42df03382b9249..250968a5e1f6c2 100644 --- a/.github/workflows/examples-rw61x.yaml +++ b/.github/workflows/examples-rw61x.yaml @@ -16,6 +16,8 @@ name: Build example - RW61X on: push: + branches-ignore: + - 'dependabot/**' pull_request: merge_group: @@ -37,7 +39,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-rw61x:37 + image: ghcr.io/project-chip/chip-build-rw61x:47 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-stm32.yaml b/.github/workflows/examples-stm32.yaml index 9a30af500112ce..58ccf9760fbe75 100644 --- a/.github/workflows/examples-stm32.yaml +++ b/.github/workflows/examples-stm32.yaml @@ -16,6 +16,8 @@ name: Build example - stm32 on: push: + branches-ignore: + - 'dependabot/**' pull_request: merge_group: @@ -38,7 +40,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:41 + image: ghcr.io/project-chip/chip-build:47 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-telink.yaml b/.github/workflows/examples-telink.yaml index 285ba96aceda07..c2dc5a1b43a1c4 100644 --- a/.github/workflows/examples-telink.yaml +++ b/.github/workflows/examples-telink.yaml @@ -16,6 +16,8 @@ name: Build example - Telink on: push: + branches-ignore: + - 'dependabot/**' pull_request: merge_group: @@ -36,7 +38,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-telink:41 + image: ghcr.io/project-chip/chip-build-telink:47 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" @@ -55,7 +57,7 @@ jobs: gh-context: ${{ toJson(github) }} # - name: Update Zephyr to specific revision (for developers purpose) - # run: scripts/run_in_build_env.sh "python3 scripts/tools/telink/update_zephyr.py b5c8028ec94f3efa69decff3a09f0d6f8a21fd6d" + # run: scripts/run_in_build_env.sh "python3 scripts/tools/telink/update_zephyr.py 65dc1812431bf946dfc110682298acf83d63e27a" - name: Build example Telink (B92 retention) Air Quality Sensor App run: | @@ -175,13 +177,13 @@ jobs: - name: clean out build output run: rm -rf ./out - - name: Build example Telink (B95 retention) Pump App + - name: Build example Telink (B95) Pump App run: | ./scripts/run_in_build_env.sh \ - "./scripts/build/build_examples.py --target 'telink-tlsr9258a_retention-pump' build" + "./scripts/build/build_examples.py --target 'telink-tlsr9258a-pump' build" .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ - telink tlsr9258a_retention pump-app \ - out/telink-tlsr9258a_retention-pump/zephyr/zephyr.elf \ + telink tlsr9258a pump-app \ + out/telink-tlsr9258a-pump/zephyr/zephyr.elf \ /tmp/bloat_reports/ - name: clean out build output diff --git a/.github/workflows/examples-tizen.yaml b/.github/workflows/examples-tizen.yaml index 65c15e5ea4114d..2b8cf469fdaa87 100644 --- a/.github/workflows/examples-tizen.yaml +++ b/.github/workflows/examples-tizen.yaml @@ -16,6 +16,8 @@ name: Build example - Tizen on: push: + branches-ignore: + - 'dependabot/**' pull_request: merge_group: @@ -34,7 +36,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-tizen:41 + image: ghcr.io/project-chip/chip-build-tizen:47 options: --user root volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" diff --git a/.github/workflows/full-android.yaml b/.github/workflows/full-android.yaml index 81a277d906d786..e5c72de20a0b13 100644 --- a/.github/workflows/full-android.yaml +++ b/.github/workflows/full-android.yaml @@ -16,6 +16,8 @@ name: Full builds - Android on: push: + branches-ignore: + - 'dependabot/**' workflow_dispatch: concurrency: @@ -36,7 +38,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-android:41 + image: ghcr.io/project-chip/chip-build-android:47 volumes: - "/tmp/log_output:/tmp/test_logs" diff --git a/.github/workflows/fuzzing-build.yaml b/.github/workflows/fuzzing-build.yaml index f354ce369c27fd..18a2f182e7f3a6 100644 --- a/.github/workflows/fuzzing-build.yaml +++ b/.github/workflows/fuzzing-build.yaml @@ -33,7 +33,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:41 + image: ghcr.io/project-chip/chip-build:47 volumes: - "/tmp/log_output:/tmp/test_logs" diff --git a/.github/workflows/gradle-wrapper-validation.yml b/.github/workflows/gradle-wrapper-validation.yml index 97617480d8f292..ab3f49942329ce 100644 --- a/.github/workflows/gradle-wrapper-validation.yml +++ b/.github/workflows/gradle-wrapper-validation.yml @@ -1,5 +1,9 @@ name: "Validate Gradle Wrapper" -on: [push, pull_request] +on: + push: + branches-ignore: + - 'dependabot/**' + pull_request: jobs: validation: diff --git a/.github/workflows/java-tests.yaml b/.github/workflows/java-tests.yaml index 4356924024c9fe..32d5de468a296d 100644 --- a/.github/workflows/java-tests.yaml +++ b/.github/workflows/java-tests.yaml @@ -16,6 +16,8 @@ name: Java Tests on: push: + branches-ignore: + - 'dependabot/**' pull_request: merge_group: workflow_dispatch: @@ -40,7 +42,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build-java:41 + image: ghcr.io/project-chip/chip-build-java:47 options: --privileged --sysctl "net.ipv6.conf.all.disable_ipv6=0 net.ipv4.conf.all.forwarding=0 net.ipv6.conf.all.forwarding=0" diff --git a/.github/workflows/kotlin-style.yaml b/.github/workflows/kotlin-style.yaml index 2f8df6f486123b..a8d328268951bf 100644 --- a/.github/workflows/kotlin-style.yaml +++ b/.github/workflows/kotlin-style.yaml @@ -22,11 +22,17 @@ jobs: uses: actions/checkout@v4 - name: "detekt" - uses: natiginfo/action-detekt-all@1.23.5 + uses: natiginfo/action-detekt-all@1.23.6 # Detekt seems not to like circular symlinks, so we set up # explicit paths below + # + # In particular, if symlinks exist and recurse, detekt tries to + # follow, so for example `examples/android/CHIPTest` as a path + # will never end (and eventually run out of HEAP) because + # `examples/android/CHIPTest/third_party/connectedhomeip` is + # circular with: - args: --parallel --build-upon-default-config --config kotlin-detect-config.yaml --input examples/android/CHIPTest,examples/android/CHIPTool,examples/java-matter-controller/java,src/controller/java + args: --parallel --build-upon-default-config --config kotlin-detect-config.yaml --input examples/android/CHIPTest/app,examples/android/CHIPTool,examples/java-matter-controller/java,src/controller/java ktlint: name: "Format check" diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 30907201df17d0..4fbaab2a46a675 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -13,14 +13,20 @@ # limitations under the License. name: Lint Code Base + on: push: + branches-ignore: + - 'dependabot/**' pull_request: merge_group: workflow_dispatch: concurrency: - group: ${{ github.ref }}-${{ github.workflow }}-${{ (github.event_name == 'pull_request' && github.event.number) || (github.event_name == 'workflow_dispatch' && github.run_number) || github.sha }} + group: + ${{ github.ref }}-${{ github.workflow }}-${{ (github.event_name == + 'pull_request' && github.event.number) || (github.event_name == + 'workflow_dispatch' && github.run_number) || github.sha }} cancel-in-progress: true jobs: @@ -29,7 +35,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:41 + image: ghcr.io/project-chip/chip-build:47 steps: - name: Checkout @@ -40,7 +46,7 @@ jobs: - name: Checkout submodules & Bootstrap uses: ./.github/actions/checkout-submodules-and-bootstrap with: - platform: linux + platform: linux - name: Check for orphaned gn files if: always() @@ -90,7 +96,6 @@ jobs: --known-failure app/app-platform/ContentAppPlatform.h \ --known-failure controller/ExamplePersistentStorage.cpp \ --known-failure controller/ExamplePersistentStorage.h \ - --known-failure app/AttributeAccessInterface.h \ --known-failure app/AttributeAccessToken.h \ --known-failure app/CommandHandler.h \ --known-failure app/CommandHandlerInterface.h \ @@ -100,11 +105,11 @@ jobs: --known-failure app/reporting/reporting.cpp \ --known-failure app/reporting/tests/MockReportScheduler.cpp \ --known-failure app/reporting/tests/MockReportScheduler.h \ - --known-failure app/TestEventTriggerDelegate.h \ - --known-failure app/util/af.h \ --known-failure app/util/attribute-storage.cpp \ + --known-failure app/util/attribute-storage-detail.h \ --known-failure app/util/attribute-storage.h \ --known-failure app/util/attribute-table.cpp \ + --known-failure app/util/attribute-table-detail.h \ --known-failure app/util/attribute-table.h \ --known-failure app/util/binding-table.cpp \ --known-failure app/util/binding-table.h \ @@ -117,6 +122,7 @@ jobs: --known-failure app/util/generic-callbacks.h \ --known-failure app/util/generic-callback-stubs.cpp \ --known-failure app/util/im-client-callbacks.h \ + --known-failure app/util/IMClusterCommandHandler.h \ --known-failure app/util/util.cpp \ --known-failure app/util/util.h \ --known-failure app/WriteHandler.h \ @@ -170,7 +176,8 @@ jobs: # git grep exits with 0 if it finds a match, but we want # to fail (exit nonzero) on match. And we want to exclude this file, # to avoid our grep regexp matching itself. - - name: Check for use of PRI*8, which are not supported on some libcs. + - name: + Check for use of PRI*8, which are not supported on some libcs. if: always() run: | git grep -I -n "PRI.8" -- './*' ':(exclude).github/workflows/lint.yml' ':(exclude)third_party/lwip/repo/lwip/src/include/lwip/arch.h' && exit 1 || exit 0 @@ -178,7 +185,9 @@ jobs: # git grep exits with 0 if it finds a match, but we want # to fail (exit nonzero) on match. And we want to exclude this file, # to avoid our grep regexp matching itself. - - name: Check for use of PRI*16, which are not supported on some libcs. + - name: + Check for use of PRI*16, which are not supported on some + libcs. if: always() run: | git grep -I -n "PRI.16" -- './*' ':(exclude).github/workflows/lint.yml' ':(exclude)third_party/lwip/repo/lwip/src/include/lwip/arch.h' && exit 1 || exit 0 @@ -186,7 +195,9 @@ jobs: # git grep exits with 0 if it finds a match, but we want # to fail (exit nonzero) on match. And we want to exclude this file, # to avoid our grep regexp matching itself. - - name: Check for use of PRI*64, which are not supported on some libcs. + - name: + Check for use of PRI*64, which are not supported on some + libcs. if: always() run: | # TODO: MessageDefHelper should ideally not be excluded here. @@ -226,7 +237,9 @@ jobs: # git grep exits with 0 if it finds a match, but we want # to fail (exit nonzero) on match. And we want to exclude this file, # to avoid our grep regexp matching itself. - - name: Check for use of 0x%u and the like, which lead to misleading output. + - name: + Check for use of 0x%u and the like, which lead to misleading + output. if: always() run: | git grep -I -n '0x%[0-9l.-]*[^0-9lxX".-]' -- './*' ':(exclude).github/workflows/lint.yml' && exit 1 || exit 0 @@ -234,14 +247,18 @@ jobs: # git grep exits with 0 if it finds a match, but we want # to fail (exit nonzero) on match. And we want to exclude this file, # to avoid our grep regexp matching itself. - - name: Check for use of '"0x" PRIu*' and the like, which lead to misleading output. + - name: + Check for use of '"0x" PRIu*' and the like, which lead to + misleading output. if: always() run: | git grep -I -n '0x%[0-9-]*" *PRI[^xX]' -- './*' ':(exclude).github/workflows/lint.yml' && exit 1 || exit 0 # git grep exits with 0 if it finds a match, but we want # to fail (exit nonzero) on match. - - name: Check for use of NSLog instead of Matter logging in Matter framework + - name: + Check for use of NSLog instead of Matter logging in Matter + framework if: always() run: | git grep -n 'NSLog(' -- src/darwin/Framework/CHIP && exit 1 || exit 0 @@ -250,20 +267,24 @@ jobs: # to fail (exit nonzero) on match. And we want to exclude this file, # to avoid our grep regexp matching itself, as well as excluding the files # that implement the type-safe accessors - - name: Check for use of 'emberAfReadAttribute' instead of the type-safe getters + - name: + Check for use of 'emberAfReadAttribute' instead of the + type-safe getters if: always() run: | - git grep -I -n 'emberAfReadAttribute' -- './*' ':(exclude).github/workflows/lint.yml' ':(exclude)src/app/util/af.h' ':(exclude)zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp' ':(exclude)src/app/zap-templates/templates/app/attributes/Accessors-src.zapt' ':(exclude)src/app/util/attribute-table.cpp' && exit 1 || exit 0 + git grep -I -n 'emberAfReadAttribute' -- './*' ':(exclude).github/workflows/lint.yml' ':(exclude)src/app/util/attribute-table.h' ':(exclude)zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp' ':(exclude)src/app/zap-templates/templates/app/attributes/Accessors-src.zapt' ':(exclude)src/app/util/attribute-table.cpp' && exit 1 || exit 0 # git grep exits with 0 if it finds a match, but we want # to fail (exit nonzero) on match. And we want to exclude this file, # to avoid our grep regexp matching itself, as well as excluding the files # that implement the type-safe accessors, attribute writing from the wire, and some # Pigweed RPC code that seems hard to update. - - name: Check for use of 'emberAfWriteAttribute' instead of the type-safe setters + - name: + Check for use of 'emberAfWriteAttribute' instead of the + type-safe setters if: always() run: | - git grep -I -n 'emberAfWriteAttribute' -- './*' ':(exclude).github/workflows/lint.yml' ':(exclude)src/app/util/af.h' ':(exclude)zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp' ':(exclude)src/app/zap-templates/templates/app/attributes/Accessors-src.zapt' ':(exclude)src/app/util/attribute-table.cpp' ':(exclude)examples/common/pigweed/rpc_services/Attributes.h' ':(exclude)src/app/util/attribute-table.h' ':(exclude)src/app/util/ember-compatibility-functions.cpp' && exit 1 || exit 0 + git grep -I -n 'emberAfWriteAttribute' -- './*' ':(exclude).github/workflows/lint.yml' ':(exclude)zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp' ':(exclude)src/app/zap-templates/templates/app/attributes/Accessors-src.zapt' ':(exclude)src/app/util/attribute-table.cpp' ':(exclude)examples/common/pigweed/rpc_services/Attributes.h' ':(exclude)src/app/util/attribute-table.h' ':(exclude)src/app/util/ember-compatibility-functions.cpp' && exit 1 || exit 0 # Run ruff python linter - name: Check for errors using ruff Python linter @@ -274,7 +295,9 @@ jobs: # git grep exits with 0 if it finds a match, but we want # to fail (exit nonzero) on match. And we want to exclude this file, # to avoid our grep regexp matching itself. - - name: Check for use of "SuccessOrExit(CHIP_ERROR_*)", which should probably be "SuccessOrExit(err = CHIP_ERROR_*)" + - name: + Check for use of "SuccessOrExit(CHIP_ERROR_*)", which should + probably be "SuccessOrExit(err = CHIP_ERROR_*)" if: always() run: | git grep -I -n 'SuccessOrExit(CHIP_ERROR' -- './*' ':(exclude).github/workflows/lint.yml' && exit 1 || exit 0 @@ -282,14 +305,19 @@ jobs: # git grep exits with 0 if it finds a match, but we want # to fail (exit nonzero) on match. And we want to exclude this file, # to avoid our grep regexp matching itself. - - name: Check for use of "SuccessOrExit(something-without-assignment(", which should probably be "SuccessOrExit(err = something(" + - name: + Check for use of + "SuccessOrExit(something-without-assignment(", which should + probably be "SuccessOrExit(err = something(" if: always() run: | git grep -I -n 'SuccessOrExit([^=)]*(' -- './*' ':(exclude).github/workflows/lint.yml' && exit 1 || exit 0 # git grep exits with 0 if it finds a match, but we want # to fail (exit nonzero) on match. - - name: Check for use of "using namespace" outside of a class/function in headers. + - name: + Check for use of "using namespace" outside of a class/function + in headers. if: always() run: | # Various platforms have `using namespace chip::Ble` in their BLEManager* headers; just exclude those for now. diff --git a/.github/workflows/minimal-build.yaml b/.github/workflows/minimal-build.yaml index 029f3d759771fc..d5f705f35427de 100644 --- a/.github/workflows/minimal-build.yaml +++ b/.github/workflows/minimal-build.yaml @@ -16,6 +16,8 @@ name: Minimal Build (Linux / configure) on: push: + branches-ignore: + - 'dependabot/**' pull_request: merge_group: @@ -31,7 +33,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build-minimal:41 + image: ghcr.io/project-chip/chip-build-minimal:47 steps: - name: Checkout diff --git a/.github/workflows/qemu.yaml b/.github/workflows/qemu.yaml index dc356586b4dd96..534c46f3c206a1 100644 --- a/.github/workflows/qemu.yaml +++ b/.github/workflows/qemu.yaml @@ -16,6 +16,8 @@ name: QEMU on: push: + branches-ignore: + - 'dependabot/**' pull_request: merge_group: @@ -38,7 +40,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-esp32-qemu:41 + image: ghcr.io/project-chip/chip-build-esp32-qemu:47 volumes: - "/tmp/log_output:/tmp/test_logs" @@ -78,7 +80,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-tizen-qemu:41 + image: ghcr.io/project-chip/chip-build-tizen-qemu:47 volumes: - "/tmp/log_output:/tmp/test_logs" diff --git a/.github/workflows/release_artifacts.yaml b/.github/workflows/release_artifacts.yaml index 57a1ce7b325dc3..1622808396cee8 100644 --- a/.github/workflows/release_artifacts.yaml +++ b/.github/workflows/release_artifacts.yaml @@ -32,7 +32,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build-esp32:41 + image: ghcr.io/project-chip/chip-build-esp32:47 steps: - name: Checkout @@ -64,7 +64,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build-efr32:41 + image: ghcr.io/project-chip/chip-build-efr32:47 steps: - name: Checkout uses: actions/checkout@v4 diff --git a/.github/workflows/smoketest-android.yaml b/.github/workflows/smoketest-android.yaml index d1dd509fd5aa63..37a84e5f49535a 100644 --- a/.github/workflows/smoketest-android.yaml +++ b/.github/workflows/smoketest-android.yaml @@ -37,7 +37,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-android:41 + image: ghcr.io/project-chip/chip-build-android:47 volumes: - "/:/runner-root-volume" - "/tmp/log_output:/tmp/test_logs" diff --git a/.github/workflows/spell.yml b/.github/workflows/spell.yml index 84877bf6f8c8bb..f37a0e28711c6f 100644 --- a/.github/workflows/spell.yml +++ b/.github/workflows/spell.yml @@ -16,6 +16,8 @@ name: Run misspell on: push: + branches-ignore: + - 'dependabot/**' paths: - "**.md" - ".github/.wordlist.txt" diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 2907a4a89711ea..281ac5c76a2ab1 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -16,6 +16,8 @@ name: Tests on: push: + branches-ignore: + - 'dependabot/**' pull_request: merge_group: workflow_dispatch: @@ -47,7 +49,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build:41 + image: ghcr.io/project-chip/chip-build:47 options: --privileged --sysctl "net.ipv6.conf.all.disable_ipv6=0 net.ipv4.conf.all.forwarding=1 net.ipv6.conf.all.forwarding=1" @@ -247,7 +249,7 @@ jobs: --chip-tool ./out/linux-x64-chip-tool${CHIP_TOOL_VARIANT}-${BUILD_VARIANT}/chip-tool \ run \ --iterations 1 \ - --expected-failures 1 \ + --expected-failures 3 \ --keep-going \ --test-timeout-seconds 120 \ --all-clusters-app ./out/linux-x64-all-clusters-${BUILD_VARIANT}/chip-all-clusters-app \ @@ -398,7 +400,7 @@ jobs: --chip-tool ./out/darwin-x64-chip-tool${CHIP_TOOL_VARIANT}-${BUILD_VARIANT}/chip-tool \ run \ --iterations 1 \ - --expected-failures 1 \ + --expected-failures 3 \ --keep-going \ --test-timeout-seconds 120 \ --all-clusters-app ./out/darwin-x64-all-clusters-${BUILD_VARIANT}/chip-all-clusters-app \ @@ -437,7 +439,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build:41 + image: ghcr.io/project-chip/chip-build:47 options: --privileged --sysctl "net.ipv6.conf.all.disable_ipv6=0 net.ipv4.conf.all.forwarding=0 net.ipv6.conf.all.forwarding=0" @@ -506,6 +508,7 @@ jobs: scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_FAN_3_4.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_FAN_3_5.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-lit-icd-ipv6only-no-ble-no-wifi-tsan-clang-test/lit-icd-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_ICDM_2_1.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-lit-icd-ipv6only-no-ble-no-wifi-tsan-clang-test/lit-icd-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json --enable-key 000102030405060708090a0b0c0d0e0f" --script "src/python_testing/TC_ICDManagementCluster.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_IDM_1_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json --enable-key 000102030405060708090a0b0c0d0e0f" --script "src/python_testing/TC_IDM_1_4.py" --script-args "--hex-arg PIXIT.DGGEN.TEST_EVENT_TRIGGER_KEY:000102030405060708090a0b0c0d0e0f --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_PWRTL_2_1.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' diff --git a/.github/workflows/unit_integration_test.yaml b/.github/workflows/unit_integration_test.yaml index 478d347be25ab9..b4778381fab1b4 100644 --- a/.github/workflows/unit_integration_test.yaml +++ b/.github/workflows/unit_integration_test.yaml @@ -16,6 +16,8 @@ name: Unit / Integration Tests on: push: + branches-ignore: + - 'dependabot/**' pull_request: merge_group: @@ -37,7 +39,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build:41 + image: ghcr.io/project-chip/chip-build:47 volumes: - "/:/runner-root-volume" - "/tmp/log_output:/tmp/test_logs" diff --git a/.github/workflows/zap_regeneration.yaml b/.github/workflows/zap_regeneration.yaml index 4488e23258cd65..670d711cade843 100644 --- a/.github/workflows/zap_regeneration.yaml +++ b/.github/workflows/zap_regeneration.yaml @@ -30,7 +30,7 @@ jobs: runs-on: ubuntu-20.04 container: - image: ghcr.io/project-chip/chip-build:41 + image: ghcr.io/project-chip/chip-build:47 defaults: run: shell: sh diff --git a/.github/workflows/zap_templates.yaml b/.github/workflows/zap_templates.yaml index f14b914ae7f88a..ce7b5946985144 100644 --- a/.github/workflows/zap_templates.yaml +++ b/.github/workflows/zap_templates.yaml @@ -16,6 +16,8 @@ name: ZAP on: push: + branches-ignore: + - 'dependabot/**' pull_request: merge_group: @@ -32,7 +34,7 @@ jobs: runs-on: ubuntu-20.04 container: - image: ghcr.io/project-chip/chip-build:41 + image: ghcr.io/project-chip/chip-build:47 defaults: run: shell: sh diff --git a/.gitmodules b/.gitmodules index 03554f83b5aac6..be8c70fb160cba 100644 --- a/.gitmodules +++ b/.gitmodules @@ -73,6 +73,11 @@ url = https://github.com/SiliconLabs/ot-efr32.git branch = matter_sve platforms = silabs,silabs_docker +[submodule "ot-stm32"] + path = third_party/openthread/ot-stm32 + url = https://github.com/openthread/openthread + branch = eb6377f + platforms = stm32 [submodule "third_party/openthread/ot-ifx"] path = third_party/openthread/ot-ifx url = https://github.com/Infineon/ot-ifx-release.git diff --git a/README.md b/README.md index 1dad5ef6fe4d4f..d2967701288875 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ [![ASR](https://github.com/project-chip/connectedhomeip/workflows/Build%20example%20-%20ASR/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-asr.yaml) [![BouffaloLab](https://github.com/project-chip/connectedhomeip/workflows/Build%20example%20-%20BouffaloLab/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-bouffalolab.yaml) [![Darwin](https://github.com/project-chip/connectedhomeip/workflows/Darwin/badge.svg)](https://github.com/project-chip/connectedhomeip/blob/master/.github/workflows/darwin.yaml) -[![TI CC26X2X7](https://github.com/project-chip/connectedhomeip/workflows/Build%20example%20-%20TI%20CC26X2X7/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-cc13x2x7_26x2x7.yaml) +[![TI CC26X2X7](https://github.com/project-chip/connectedhomeip/workflows/Build%20example%20-%20TI%20CC13XX_26XX/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-cc13xx_26xx.yaml) [![TI CC32XX](https://github.com/project-chip/connectedhomeip/workflows/Build%20example%20-%20TI%20CC32XX/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-cc32xx.yaml) [![EFR32](https://github.com/project-chip/connectedhomeip/workflows/Build%20example%20-%20EFR32/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-efr32.yaml) [![ESP32](https://github.com/project-chip/connectedhomeip/workflows/Build%20example%20-%20ESP32/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-esp32.yaml) diff --git a/config/nrfconnect/chip-module/generate_factory_data.cmake b/config/nrfconnect/chip-module/generate_factory_data.cmake index 3c286fc21dddee..21f7360cd03f10 100644 --- a/config/nrfconnect/chip-module/generate_factory_data.cmake +++ b/config/nrfconnect/chip-module/generate_factory_data.cmake @@ -15,25 +15,29 @@ # -# Create a JSON file based on factory data given via kConfigs. +# Create a .hex file in CBOR format based on factory data given via kConfigs. # # This function creates a list of arguments for external script and then run it to write a JSON file. # Created JSON file can be checked using JSON SCHEMA file if it is provided. +# Next, the resulting .hex file is generated based on previously created JSON file. # # This script can be manipulated using following kConfigs: # - To merge generated factory data with final zephyr.hex file set kConfig CONFIG_CHIP_FACTORY_DATA_MERGE_WITH_FIRMWARE=y # - To use default certification paths set CONFIG_CHIP_FACTORY_DATA_USE_DEFAULTS_CERTS_PATH=y # -# During generation process a some file will be created in zephyr's build directory: +# During generation process the following files will be created in zephyr's build directory: # - .json a file containing all factory data written in JSON format. +# - .hex a file containing all factory data in CBOR format. +# - .bin a binary file containing all raw factory data in CBOR format. +# - .cbor a file containing all factory data in CBOR format. # # [Args]: # factory_data_target - a name for target to generate factory_data. # script_path - a path to script that makes a JSON factory data file from given arguments. # schema_path - a path to JSON schema file which can be used to verify generated factory data JSON file. # This argument is optional, if you don't want to verify the JSON file put it empty "". -# output_path - a path to output directory, where created JSON file will be stored. -function(nrfconnect_create_factory_data_json factory_data_target script_path schema_path output_path) +# output_path - a path to output directory, where created hex and JSON files will be stored. +function(nrfconnect_create_factory_data factory_data_target script_path schema_path output_path) # set script args for future purpose set(script_args) @@ -120,62 +124,25 @@ if(CONFIG_CHIP_DEVICE_ENABLE_KEY) string(APPEND script_args "--enable_key \"${CONFIG_CHIP_DEVICE_ENABLE_KEY}\"\n") endif() -# Set output JSON file and path to SCHEMA file to validate generated factory data -set(factory_data_json ${output_path}/${factory_data_target}.json) -string(APPEND script_args "-o \"${factory_data_json}\"\n") +# Set output path and path to SCHEMA file to validate generated factory data +set(factory_data_output_path ${output_path}/${factory_data_target}) +string(APPEND script_args "-o \"${factory_data_output_path}\"\n") string(APPEND script_args "-s \"${schema_path}\"\n") +# Add optional offset and size arguments to generate both .hex and .json files. +string(APPEND script_args "--offset $\n") +string(APPEND script_args "--size $\n") + # execute first script to create a JSON file separate_arguments(separated_script_args NATIVE_COMMAND ${script_args}) add_custom_command( - OUTPUT ${factory_data_json} + OUTPUT ${factory_data_output_path}.hex DEPENDS ${FACTORY_DATA_SCRIPT_PATH} COMMAND ${Python3_EXECUTABLE} ${FACTORY_DATA_SCRIPT_PATH} ${separated_script_args} COMMENT "Generating new Factory Data..." ) add_custom_target(${factory_data_target} ALL - DEPENDS ${factory_data_json} - ) - -endfunction() - - -# Create a .hex file with factory data in CBOR format. -# -# This function creates a .hex and .cbor files from given JSON factory data file. -# -# -# During generation process some files will be created in zephyr's build directory: -# - .hex a file containing all factory data in CBOR format. -# - .bin a binary file containing all raw factory data in CBOR format. -# - .cbor a file containing all factory data in CBOR format. -# -# [Args]: -# factory_data_hex_target - a name for target to generate factory data HEX file. -# factory_data_target - a name for target to generate factory data JSON file. -# script_path - a path to script that makes a factory data .hex file from given arguments. -# output_path - a path to output directory, where created JSON file will be stored. -function(nrfconnect_create_factory_data_hex_file factory_data_hex_target factory_data_target script_path output_path) - -# Pass the argument list via file -set(cbor_script_args "-i ${output_path}/${factory_data_target}.json\n") -string(APPEND cbor_script_args "-o ${output_path}/${factory_data_target}\n") -# get partition address and offset from partition manager during compilation -string(APPEND cbor_script_args "--offset $\n") -string(APPEND cbor_script_args "--size $\n") -string(APPEND cbor_script_args "-r\n") - -# execute second script to create a hex file containing factory data in cbor format -separate_arguments(separated_cbor_script_args NATIVE_COMMAND ${cbor_script_args}) -set(factory_data_hex ${output_path}/${factory_data_target}.hex) - -add_custom_command(OUTPUT ${factory_data_hex} - COMMAND ${Python3_EXECUTABLE} ${script_path} ${separated_cbor_script_args} - COMMENT "Generating factory data HEX file..." - DEPENDS ${factory_data_target} ${script_path} - ) -add_custom_target(${factory_data_hex_target} - DEPENDS ${factory_data_hex} + DEPENDS ${factory_data_output_path}.hex ) endfunction() @@ -202,22 +169,16 @@ set(GENERATE_CBOR_SCRIPT_PATH ${CHIP_ROOT}/scripts/tools/nrfconnect/nrfconnect_g set(FACTORY_DATA_SCHEMA_PATH ${CHIP_ROOT}/scripts/tools/nrfconnect/nrfconnect_factory_data.schema) set(OUTPUT_FILE_PATH ${APPLICATION_BINARY_DIR}/zephyr) -# create a JSON file with all factory data -nrfconnect_create_factory_data_json(factory_data - ${FACTORY_DATA_SCRIPT_PATH} - ${FACTORY_DATA_SCHEMA_PATH} - ${OUTPUT_FILE_PATH}) - # create a .hex file with factory data in CBOR format based on the JSON file created previously -nrfconnect_create_factory_data_hex_file(factory_data_hex - factory_data - ${GENERATE_CBOR_SCRIPT_PATH} - ${OUTPUT_FILE_PATH}) +nrfconnect_create_factory_data(factory_data + ${FACTORY_DATA_SCRIPT_PATH} + ${FACTORY_DATA_SCHEMA_PATH} + ${OUTPUT_FILE_PATH}) if(CONFIG_CHIP_FACTORY_DATA_MERGE_WITH_FIRMWARE) # set custom target for merging factory_data hex file set_property(GLOBAL PROPERTY factory_data_PM_HEX_FILE ${OUTPUT_FILE_PATH}/factory_data.hex) - set_property(GLOBAL PROPERTY factory_data_PM_TARGET factory_data_hex) + set_property(GLOBAL PROPERTY factory_data_PM_TARGET factory_data) endif() diff --git a/config/telink/chip-module/CMakeLists.txt b/config/telink/chip-module/CMakeLists.txt index 7862d5f8b95d8e..27f429b390d528 100644 --- a/config/telink/chip-module/CMakeLists.txt +++ b/config/telink/chip-module/CMakeLists.txt @@ -1,5 +1,5 @@ # -# Copyright (c) 2022-2023 Project CHIP Authors +# Copyright (c) 2022-2024 Project CHIP Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -149,47 +149,7 @@ set_property(GLOBAL APPEND PROPERTY ZEPHYR_INTERFACE_LIBS chip) # Define 'chip-ota-image' target for building CHIP OTA image # ============================================================================== -string(REPLACE "_retention" "" BASE_BOARD ${BOARD}) - -if(${TLNK_USB_DONGLE} MATCHES y) - if(EXISTS "${CHIP_ROOT}/src/platform/telink/${BASE_BOARD}_usb_boot.overlay") - set(USB_BOOT_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/${BASE_BOARD}_usb_boot.overlay") - else() - unset(USB_BOOT_DTC_OVERLAY_FILE) - endif() -else() - unset(USB_BOOT_DTC_OVERLAY_FILE) -endif() - -if(${TLNK_MARS_BOARD} MATCHES y) - if(EXISTS "${CHIP_ROOT}/src/platform/telink/${BASE_BOARD}_mars_boot.overlay") - set(MARS_BOOT_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/${BASE_BOARD}_mars_boot.overlay") - else() - unset(MARS_BOOT_DTC_OVERLAY_FILE) - endif() -else() - unset(MARS_CONF_OVERLAY_FILE) -endif() - -if(EXISTS "${CHIP_ROOT}/src/platform/telink/${BASE_BOARD}.overlay") - set(GLOBAL_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/${BASE_BOARD}.overlay") -else() - unset(GLOBAL_DTC_OVERLAY_FILE) -endif() - -if(EXISTS "${CHIP_ROOT}/src/platform/telink/${FLASH_SIZE}_flash.overlay") - set(FLASH_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/${FLASH_SIZE}_flash.overlay") - message(STATUS "Flash memory size is set to: " ${FLASH_SIZE} "b") -else() - set(FLASH_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/2m_flash.overlay") - message(STATUS "Flash memory size is set to: 2mb") -endif() - -if(EXISTS "${CHIP_ROOT}/config/telink/app/bootloader.conf") - set(GLOBAL_BOOTLOADER_CONF_OVERLAY_FILE "${CHIP_ROOT}/config/telink/app/bootloader.conf") -else() - unset(GLOBAL_BOOTLOADER_CONF_OVERLAY_FILE) -endif() +include(${TELINK_COMMON}/common.cmake) set(BLOCK_SIZE "1024") @@ -202,7 +162,7 @@ if (CONFIG_BOOTLOADER_MCUBOOT) add_custom_target(build_mcuboot ALL COMMAND west build -b ${BASE_BOARD} -d build_mcuboot ${ZEPHYR_BASE}/../bootloader/mcuboot/boot/zephyr - -- -DOVERLAY_CONFIG=${GLOBAL_BOOTLOADER_CONF_OVERLAY_FILE} -DDTC_OVERLAY_FILE="${GLOBAL_DTC_OVERLAY_FILE};${FLASH_DTC_OVERLAY_FILE};${USB_BOOT_DTC_OVERLAY_FILE};${MARS_BOOT_DTC_OVERLAY_FILE}" + -- -DOVERLAY_CONFIG=${GLOBAL_BOOT_CONF_OVERLAY_FILE} -DDTC_OVERLAY_FILE="${GLOBAL_BOOT_DTC_OVERLAY_FILE};${FLASH_DTC_OVERLAY_FILE};${USB_BOOT_DTC_OVERLAY_FILE};${MARS_BOOT_DTC_OVERLAY_FILE}" COMMAND cp ${PROJECT_BINARY_DIR}/../modules/chip-module/build_mcuboot/zephyr/zephyr.bin ${PROJECT_BINARY_DIR}/zephyr.mcuboot.bin ) diff --git a/config/telink/chip-module/Kconfig.defaults b/config/telink/chip-module/Kconfig.defaults index 964b08547bb0b5..f0584d8495149e 100644 --- a/config/telink/chip-module/Kconfig.defaults +++ b/config/telink/chip-module/Kconfig.defaults @@ -1,5 +1,5 @@ # -# Copyright (c) 2023 Project CHIP Authors +# Copyright (c) 2023-2024 Project CHIP Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -20,6 +20,10 @@ if CHIP +config CHIP_PROJECT_CONFIG + string "Project configuration file for Matter" + default "include/CHIPProjectConfig.h" + config LOG default y @@ -106,6 +110,8 @@ config GPIO config BT default y +if BT + config BT_PERIPHERAL default y @@ -157,9 +163,11 @@ choice B9X_BLE_CTRL_MAC_TYPE default B9X_BLE_CTRL_MAC_TYPE_RANDOM_STATIC endchoice +endif + # Board retention config -if BOARD_TLSR9528A_RETENTION || BOARD_TLSR9258A_RETENTION || BOARD_TLSR9518ADK80D_RETENTION -config BOARD_TLSR9X_NON_RETENTION_RAM_CODE +if BOARD_TLSR9528A_RETENTION || BOARD_TLSR9258A_RETENTION || BOARD_TLSR9518ADK80D_RETENTION +config SOC_SERIES_RISCV_TELINK_B9X_NON_RETENTION_RAM_CODE default y if PM config TELINK_B9x_MATTER_RETENTION_LAYOUT @@ -218,6 +226,12 @@ config SETTINGS_NVS_SECTOR_COUNT config NET_L2_OPENTHREAD default y +if NET_L2_OPENTHREAD + +config CHIP_OPENTHREAD_CONFIG + string "Custom OpenThread configuration file" + default "../../platform/telink/project_include/OpenThreadConfig.h" + choice CHIP_THREAD_DEVICE_ROLE prompt "Thread network device role" default CHIP_THREAD_DEVICE_ROLE_ROUTER @@ -256,6 +270,8 @@ config OPENTHREAD_DEFAULT_TX_POWER default 3 if PM default 9 +endif # NET_L2_OPENTHREAD + config NET_TX_STACK_SIZE default 554 if PM diff --git a/docs/examples/index.md b/docs/examples/index.md index fc82f2a0bc9016..2c0225cbbf3b9f 100644 --- a/docs/examples/index.md +++ b/docs/examples/index.md @@ -213,7 +213,6 @@ pigweed-app/**/README :maxdepth: 1 pump-app/**/README -pump-app/cc13x2x7_26x2x7/doc/programming* ``` ## Pump controller example @@ -223,7 +222,6 @@ pump-app/cc13x2x7_26x2x7/doc/programming* :maxdepth: 1 pump-controller-app/**/README -pump-controller-app/cc13x2x7_26x2x7/doc/programming* ``` ## Refrigerator example diff --git a/docs/guides/BUILDING.md b/docs/guides/BUILDING.md index f521c78ec3caf9..12ae984ce7d586 100644 --- a/docs/guides/BUILDING.md +++ b/docs/guides/BUILDING.md @@ -470,7 +470,7 @@ gn desc out/unified '//src/controller(//build/toolchain/host:linux_x64_clang)' > **Note:** Some platforms that can be built as part of the unified build > require downloading additional tools. To add these to the build, the location > must be provided as a build argument. For example, to add the Simplelink -> cc13x2_26x2 examples to the unified build, install +> cc13xx_26xx examples to the unified build, install > [SysConfig](https://www.ti.com/tool/SYSCONFIG) and add the following build > arguments: > diff --git a/docs/guides/nrfconnect_factory_data_configuration.md b/docs/guides/nrfconnect_factory_data_configuration.md index e4c3be4899df4e..212963d5266b66 100644 --- a/docs/guides/nrfconnect_factory_data_configuration.md +++ b/docs/guides/nrfconnect_factory_data_configuration.md @@ -37,7 +37,7 @@ data secure by applying hardware write protection. - [Appearance field description](#appearance-field-description) - [Enabling factory data support](#enabling-factory-data-support) - [Generating factory data](#generating-factory-data) - - [Creating the factory data JSON file with the first script](#creating-the-factory-data-json-file-with-the-first-script) + - [Creating the factory data JSON and HEX files with the first script](#creating-the-factory-data-json-and-hex-files-with-the-first-script) - [How to set user data](#how-to-set-user-data) - [How to handle user data](#how-to-handle-user-data) - [Verifying using the JSON Schema tool](#verifying-using-the-json-schema-tool) @@ -218,14 +218,19 @@ file written in another way. To make sure that the JSON file is correct and the device is able to read out parameters, [verify the file using the JSON schema tool](#verifying-using-the-json-schema-tool). -### Creating the factory data JSON file with the first script +You can also use only the first script to generate both JSON and HEX files, by +providing optional `offset` and `size` arguments, which results in invoking the +script internally. Such option is the recommended one, but invoking two scripts +one by one is also supported to provide backward compatibility. + +### Creating the factory data JSON and HEX files with the first script A Matter device needs a proper factory data partition stored in the flash memory to read out all required parameters during startup. To simplify the factory data generation, you can use the [generate_nrfconnect_chip_factory_data.py](../../scripts/tools/nrfconnect/generate_nrfconnect_chip_factory_data.py) Python script to provide all required parameters and generate a human-readable -JSON file. +JSON file and save it to a HEX file. To use this script, complete the following steps: @@ -245,10 +250,10 @@ To use this script, complete the following steps: --sn --vendor_id, --product_id, --vendor_name, --product_name, --date, --hw_ver, --hw_ver_str, --spake2_it, --spake2_salt, --discriminator ``` - b. Add output file path: + b. Add output path to store .json file, e.g. my_dir/output: ``` - -o + -o ``` c. Generate SPAKE2 verifier using one of the following methods: @@ -341,6 +346,34 @@ To use this script, complete the following steps: > `chip-cert` executable. See the note at the end of this section to learn > how to get it. + k. (optional) Partition offset that is an address in device's NVM memory, + where factory data will be stored. + + ``` + --offset + ``` + + > **Note:** To generate a HEX file with factory data, you need to provide + > both `offset` and `size` optional arguments. As a result, + > `factory_data.hex` and `factory_data.bin` files are created in the + > `output` directory. The first file contains the required memory offset. + > For this reason, it can be programmed directly to the device using a + > programmer (for example, `nrfjprog`). + + l. (optional) The maximum partition size in device's NVM memory, where + factory data will be stored. + + ``` + --size + ``` + + > **Note:** To generate a HEX file with factory data, you need to provide + > both `offset` and `size` optional arguments. As a result, + > `factory_data.hex` and `factory_data.bin` files are created in the + > `output` directory. The first file contains the required memory offset. + > For this reason, it can be programmed directly to the device using a + > programmer (for example, `nrfjprog`). + 4. Run the script using the prepared list of arguments: ``` @@ -370,8 +403,10 @@ $ python scripts/tools/nrfconnect/generate_nrfconnect_chip_factory_data.py \ --passcode 20202021 \ --product_finish "matte" \ --product_color "black" \ ---out "build.json" \ ---schema "scripts/tools/nrfconnect/nrfconnect_factory_data.schema" +--out "build" \ +--schema "scripts/tools/nrfconnect/nrfconnect_factory_data.schema" \ +--offset 0xf7000 \ +--size 0x1000 ``` As the result of the above example, a unique ID for the rotating device ID is @@ -570,7 +605,7 @@ To generate a manual pairing code and a QR code, complete the following steps: ``` 2. Complete steps 1, 2, and 3 from the - [Creating the factory data JSON file with the first script](#creating-the-factory-data-json-file-with-the-first-script) + [Creating the factory data JSON and HEX files with the first script](#creating-the-factory-data-json-and-hex-files-with-the-first-script) section to prepare the final invocation of the Python script. 3. Add the `--generate_onboarding` argument to the Python script final @@ -686,10 +721,15 @@ The output will look similar to the following one: ### Creating a factory data partition with the second script To store the factory data set in the device's persistent storage, convert the -data from the JSON file to its binary representation in the CBOR format. To do -this, use the +data from the JSON file to its binary representation in the CBOR format. This is +done by the +[generate_nrfconnect_chip_factory_data.py](../../scripts/tools/nrfconnect/generate_nrfconnect_chip_factory_data.py), +if you provide optional `offset` and `size` arguments. If you provided these +arguments, skip the following steps of this section. + +You can skip these optional arguments and do this, using the [nrfconnect_generate_partition.py](../../scripts/tools/nrfconnect/nrfconnect_generate_partition.py) -to generate the factory data partition: +script, but this is obsolete solution kept only for backward compatibility: 1. Navigate to the _connectedhomeip_ root directory 2. Run the following command pattern: @@ -924,14 +964,13 @@ $ west flash ## Using own factory data implementation The [factory data generation process](#generating-factory-data) described above -is only an example valid for the nRF Connect platform. You can also create a HEX -file containing all components from the -[factory data component table](#factory-data-component-table) in any format and -then implement a parser to read out all parameters and pass them to a provider. -Each manufacturer can implement a factory data set on its own by implementing a -parser and a factory data accessor inside the Matter stack. Use the -[nRF Connect Provider](../../src/platform/nrfconnect/FactoryDataProvider.h) and -[FactoryDataParser](../../src/platform/nrfconnect/FactoryDataParser.h) as +is only an example valid for the nRF Connect platform. You can well create a HEX +file containing all [factory data components](#factory-data-component-table) in +any format and then implement a parser to read out all parameters and pass them +to a provider. Each manufacturer can implement a factory data set on its own by +implementing a parser and a factory data accessor inside the Matter stack. Use +the [nRF Connect Provider](../../src/platform/nrfconnect/FactoryDataProvider.h) +and [FactoryDataParser](../../src/platform/nrfconnect/FactoryDataParser.h) as examples. You can read the factory data set from the device's flash memory in different diff --git a/docs/guides/ti/images/cc13x2_memmap.png b/docs/guides/ti/images/cc13x2_memmap.png deleted file mode 100644 index a89aee7837e3aa..00000000000000 Binary files a/docs/guides/ti/images/cc13x2_memmap.png and /dev/null differ diff --git a/docs/guides/ti/ti_factory_data_user_guide.md b/docs/guides/ti/ti_factory_data_user_guide.md index c8168779d17119..50dfc41b15231d 100644 --- a/docs/guides/ti/ti_factory_data_user_guide.md +++ b/docs/guides/ti/ti_factory_data_user_guide.md @@ -33,29 +33,26 @@ Each element is described in more detail below: Developers can configure this per device. Elements in this file are from the specification. 2. Matter Application with dummy factory data: Any TI Matter example application -3. `BIM`/MCUBoot: Boot Image Manager/MCUBoot image used for OTA. This is built - with the Matter application and does not require additional build steps from - developers. +3. MCUBoot: MCUBoot image used for OTA. This is built with the Matter + application and does not require additional build steps from developers. 4. create_factory_data.py: Processes a factory data JSON file and generates a hex file with the unique factory data values configured in the JSON file. 5. factory_data_trim.py: When using the custom factory data option, this script removes the dummy factory data which is required to be able to successfully compile the application. 6. `oad`\_and_factory_data_merge_tool.py: Merges the factory data hex, Matter - application without factory data and `BIM`/MCUBoot image to generate a - functional hex that can be programmed onto the device. + application without factory data and MCUBoot image to generate a functional + hex that can be programmed onto the device. ## Flash memory layout -![Memory Layout 1](images/cc13x2_memmap.png) - ![Memory Layout 2](images/cc13x4_memmap.png) ## How to use Out of box factory data location is configured to be on second last page of -flash. For CC13x2, the starting address is `0xAC000`. For CC13x4, the starting -address is `0xFE800`. This can be configured in the linker file. +flash. For CC13x4, the starting address is `0xFE800`. This can be configured in +the linker file. To configure: @@ -63,13 +60,13 @@ To configure: used by the application ``` -FLASH_FACTORY_DATA (R) : ORIGIN = 0x000ac000, LENGTH = 0x00000900 +FLASH_FACTORY_DATA (R) : ORIGIN = 0x000fe800, LENGTH = 0x00000900 ``` ``` /* Define base address for the DAC arrays and struct */ PROVIDE (_factory_data_base_address = - DEFINED(_factory_data_base_address) ? _factory_data_base_address : 0xAC000); + DEFINED(_factory_data_base_address) ? _factory_data_base_address : 0xFE800); ``` 2. create_factory_data.py: Set the address of the start of the factory data @@ -78,7 +75,7 @@ FLASH_FACTORY_DATA (R) : ORIGIN = 0x000ac000, LENGTH = 0x00000900 ``` # there are 17 elements, each element will need 8 bytes in the struct # 4 for length of the element, and 4 for the pointer to the element - # factory data starts at 0xAC000 or 0xFE800, so the elements will + # factory data starts at 0xFE800, so the elements will # start 136 bytes after the start address factory_data_dict = json.load(args.factory_data_json_file[0]) factory_data_schema = json.load(args.factory_data_schema[0]) @@ -88,23 +85,16 @@ FLASH_FACTORY_DATA (R) : ORIGIN = 0x000ac000, LENGTH = 0x00000900 struct_idx = 0 values_idx = 0 - if device_family == 'cc13x2_26x2': - value_address = 0xAC088 - else: - value_address = 0xFE888 + value_address = 0xFE888 ``` ``` - if device_family == 'cc13x2_26x2': - subprocess.call(['objcopy', 'temp.bin','--input-target','binary','--output-target', 'ihex', args.factory_data_hex_file, '--change-addresses=0xac000']) - else: - subprocess.call(['objcopy', 'temp.bin','--input-target','binary','--output-target', 'ihex', args.factory_data_hex_file, '--change-addresses=0xfe800']) + subprocess.call(['objcopy', 'temp.bin','--input-target','binary','--output-target', 'ihex', args.factory_data_hex_file, '--change-addresses=0xfe800']) ``` 3. In the example's args.gni file, set 'custom_factory_data' to true -It is recommended to keep a dedicated page (2 pages for CC13x4) for factory -data. +It is recommended to keep 2 dedicated pages for CC13x4 for factory data. ### Formatting certs and keys for JSON file @@ -121,7 +111,6 @@ being copied into the JSON file. The example application can be built using the instructions in the example's README. The factory data from the JSON file will be formatted into a hex file that will then be merged into the final executable. The final executable will be -named _{example-application}-`bim`.hex_ for CC13x2 and -_{example-application}-mcuboot.hex_ for CC13x4, and the factory data that was -inputted into the JSON file will be named +named _{example-application}-mcuboot.hex_ for CC13x4, and the factory data that +was inputted into the JSON file will be named _{example-application}-factory-data.hex_. diff --git a/docs/guides/ti/ti_platform_overview.md b/docs/guides/ti/ti_platform_overview.md index 47e140cfa06ba0..a26ade4d224b0a 100644 --- a/docs/guides/ti/ti_platform_overview.md +++ b/docs/guides/ti/ti_platform_overview.md @@ -48,8 +48,8 @@ In the TI example applications the Bluetooth Low Energy protocol is used to provision the Thread protocol to enable Matter communication. Then Thread is used for IP communication with other Matter devices. -The TI applications leverage the Bluetooth Low Energy stack on the CC13X2 and -CC26X2 families. This BLE software is distributed in binary form within the TI +The TI applications leverage the Bluetooth Low Energy stack on the CC13XX and +CC26XX families. This BLE software is distributed in binary form within the TI SimpleLink SDK. The BLE stack leverages code that is present in the device ROM for certain common BLE operations. @@ -103,9 +103,9 @@ handled by the platform implementation files. Sample Matter applications are provided for the TI platform. These can be used as reference for your own application. -- [lock-app](../../../examples/lock-app/cc13x2x7_26x2x7/README.md) -- [pump-app](../../../examples/pump-app/cc13x2x7_26x2x7/README.md) -- [pump-controller-app](../../../examples/pump-controller-app/cc13x2x7_26x2x7/README.md) +- [lock-app](../../../examples/lock-app/cc13x4_26x4/README.md) +- [pump-app](../../../examples/pump-app/cc13x4_26x4/README.md) +- [pump-controller-app](../../../examples/pump-controller-app/cc13x4_26x4/README.md)
diff --git a/examples/air-purifier-app/ameba/main/DeviceCallbacks.cpp b/examples/air-purifier-app/ameba/main/DeviceCallbacks.cpp index 42551f7cb40579..deb3731f1b25d4 100644 --- a/examples/air-purifier-app/ameba/main/DeviceCallbacks.cpp +++ b/examples/air-purifier-app/ameba/main/DeviceCallbacks.cpp @@ -29,7 +29,6 @@ #include #include #include -#include #include #include #include diff --git a/examples/air-purifier-app/ameba/main/chipinterface.cpp b/examples/air-purifier-app/ameba/main/chipinterface.cpp index 264ad532b513aa..fd1c568afbf44f 100644 --- a/examples/air-purifier-app/ameba/main/chipinterface.cpp +++ b/examples/air-purifier-app/ameba/main/chipinterface.cpp @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/examples/air-purifier-app/linux/main.cpp b/examples/air-purifier-app/linux/main.cpp index 98d8d405cfadfb..0335ebcaac3bba 100644 --- a/examples/air-purifier-app/linux/main.cpp +++ b/examples/air-purifier-app/linux/main.cpp @@ -20,7 +20,6 @@ #include #include #include -#include #include #define AIR_PURIFIER_ENDPOINT 1 diff --git a/examples/air-quality-sensor-app/linux/AirQualitySensorAppAttrUpdateDelegate.cpp b/examples/air-quality-sensor-app/linux/AirQualitySensorAppAttrUpdateDelegate.cpp index 41a53d4fd94c7d..7aaa873a906706 100644 --- a/examples/air-quality-sensor-app/linux/AirQualitySensorAppAttrUpdateDelegate.cpp +++ b/examples/air-quality-sensor-app/linux/AirQualitySensorAppAttrUpdateDelegate.cpp @@ -30,6 +30,7 @@ #include #include +#include using namespace chip; using namespace chip::app; diff --git a/examples/air-quality-sensor-app/linux/AirQualitySensorAppAttrUpdateDelegate.h b/examples/air-quality-sensor-app/linux/AirQualitySensorAppAttrUpdateDelegate.h index e608b7a671457d..88b60d13174300 100644 --- a/examples/air-quality-sensor-app/linux/AirQualitySensorAppAttrUpdateDelegate.h +++ b/examples/air-quality-sensor-app/linux/AirQualitySensorAppAttrUpdateDelegate.h @@ -23,6 +23,8 @@ #include #include +#include + class AirQualitySensorAttrUpdateHandler { public: diff --git a/examples/air-quality-sensor-app/linux/main.cpp b/examples/air-quality-sensor-app/linux/main.cpp index 9dee0c20982f0a..39a13ba1c8e20c 100644 --- a/examples/air-quality-sensor-app/linux/main.cpp +++ b/examples/air-quality-sensor-app/linux/main.cpp @@ -20,9 +20,10 @@ #include #include -#include #include +#include + #if defined(CHIP_IMGUI_ENABLED) && CHIP_IMGUI_ENABLED #include #include diff --git a/examples/air-quality-sensor-app/telink/CMakeLists.txt b/examples/air-quality-sensor-app/telink/CMakeLists.txt index 5ed8c314f1b334..4d34c74fcdba68 100644 --- a/examples/air-quality-sensor-app/telink/CMakeLists.txt +++ b/examples/air-quality-sensor-app/telink/CMakeLists.txt @@ -1,5 +1,5 @@ # -# Copyright (c) 2023 Project CHIP Authors +# Copyright (c) 2023-2024 Project CHIP Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,70 +13,18 @@ # See the License for the specific language governing permissions and # limitations under the License. # + cmake_minimum_required(VERSION 3.13.1) get_filename_component(CHIP_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/third_party/connectedhomeip REALPATH) get_filename_component(TELINK_COMMON ${CHIP_ROOT}/examples/platform/telink REALPATH) get_filename_component(GEN_DIR ${CHIP_ROOT}/zzz_generated/ REALPATH) -set(ignoreMe "${TLNK_MARS_BOARD}") - -if(${TLNK_MARS_BOARD} MATCHES y) - if(EXISTS "${CHIP_ROOT}/src/platform/telink/${BOARD}_mars.overlay") - set(MARS_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/${BOARD}_mars.overlay") - else() - unset(MARS_DTC_OVERLAY_FILE) - endif() - if(EXISTS "${CHIP_ROOT}/src/platform/telink/${BOARD}_mars.conf") - set(MARS_CONF_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/${BOARD}_mars.conf") - else() - unset(MARS_CONF_OVERLAY_FILE) - endif() -else() - unset(MARS_CONF_OVERLAY_FILE) -endif() - -if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/boards/${BOARD}.overlay") - set(LOCAL_DTC_OVERLAY_FILE "${CMAKE_CURRENT_SOURCE_DIR}/boards/${BOARD}.overlay") -else() - unset(LOCAL_DTC_OVERLAY_FILE) -endif() - -if(EXISTS "${CHIP_ROOT}/src/platform/telink/${BOARD}.overlay") - set(GLOBAL_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/${BOARD}.overlay") -else() - unset(GLOBAL_DTC_OVERLAY_FILE) -endif() - -if(EXISTS "${CHIP_ROOT}/src/platform/telink/${FLASH_SIZE}_flash.overlay") - set(FLASH_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/${FLASH_SIZE}_flash.overlay") - message(STATUS "Flash memory size is set to: " ${FLASH_SIZE} "b") -else() - set(FLASH_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/2m_flash.overlay") - message(STATUS "Flash memory size is set to: 2mb") -endif() - -if(DTC_OVERLAY_FILE) - set(DTC_OVERLAY_FILE - "${DTC_OVERLAY_FILE} ${GLOBAL_DTC_OVERLAY_FILE} ${MARS_DTC_OVERLAY_FILE} ${FLASH_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}" - CACHE STRING "" FORCE - ) -else() - set(DTC_OVERLAY_FILE ${GLOBAL_DTC_OVERLAY_FILE} ${MARS_DTC_OVERLAY_FILE} ${FLASH_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}) -endif() - -set(CONF_FILE ${MARS_CONF_OVERLAY_FILE} prj.conf) - -# Load NCS/Zephyr build system -list(APPEND ZEPHYR_EXTRA_MODULES ${CHIP_ROOT}/config/telink/chip-module) -find_package(Zephyr HINTS $ENV{ZEPHYR_BASE}) - -project(chip-telink-air-quality-sensor-example) - +include(${TELINK_COMMON}/common.cmake) include(${CHIP_ROOT}/config/telink/app/enable-gnu-std.cmake) include(${CHIP_ROOT}/src/app/chip_data_model.cmake) -target_compile_options(app PRIVATE -fpermissive) +project(chip-telink-air-quality-sensor-example) target_include_directories(app PRIVATE include @@ -84,7 +32,8 @@ target_include_directories(app PRIVATE ${GEN_DIR}/air-quality-sensor-app ${TELINK_COMMON}/common/include ${TELINK_COMMON}/util/include - ${CHIP_ROOT}/examples/air-quality-sensor-app/air-quality-sensor-common/include) + ${CHIP_ROOT}/examples/air-quality-sensor-app/air-quality-sensor-common/include + ${TELINK_COMMON}/zephyr_ext) target_sources(app PRIVATE src/AppTask.cpp @@ -92,12 +41,16 @@ target_sources(app PRIVATE ${TELINK_COMMON}/common/src/mainCommon.cpp ${TELINK_COMMON}/common/src/AppTaskCommon.cpp ${TELINK_COMMON}/common/src/SensorManagerCommon.cpp - ${TELINK_COMMON}/util/src/LEDWidget.cpp + ${TELINK_COMMON}/util/src/LEDManager.cpp ${TELINK_COMMON}/util/src/ButtonManager.cpp ${TELINK_COMMON}/util/src/ThreadUtil.cpp - ${TELINK_COMMON}/util/src/PWMDevice.cpp - ${TELINK_COMMON}/util/src/WS2812Device.cpp - ${CHIP_ROOT}/examples/air-quality-sensor-app/air-quality-sensor-common/src/air-quality-sensor-manager.cpp) + ${TELINK_COMMON}/util/src/PWMManager.cpp + ${CHIP_ROOT}/examples/air-quality-sensor-app/air-quality-sensor-common/src/air-quality-sensor-manager.cpp + ${TELINK_COMMON}/zephyr_ext/zephyr_key_matrix.c + ${TELINK_COMMON}/zephyr_ext/zephyr_key_pool.c + ${TELINK_COMMON}/zephyr_ext/zephyr_led_pool.c + ${TELINK_COMMON}/zephyr_ext/zephyr_pwm_pool.c + ${TELINK_COMMON}/zephyr_ext/zephyr_ws2812.c) chip_configure_data_model(app INCLUDE_SERVER diff --git a/examples/air-quality-sensor-app/telink/include/AppConfig.h b/examples/air-quality-sensor-app/telink/include/AppConfig.h index 7513ed3771b961..0888260c26a7f1 100644 --- a/examples/air-quality-sensor-app/telink/include/AppConfig.h +++ b/examples/air-quality-sensor-app/telink/include/AppConfig.h @@ -20,11 +20,5 @@ // ---- Air Quality Example App Config ---- -#define APP_USE_EXAMPLE_START_BUTTON 1 -#define APP_USE_BLE_START_BUTTON 0 -#define APP_USE_THREAD_START_BUTTON 0 #define APP_SET_DEVICE_INFO_PROVIDER 1 #define APP_SET_NETWORK_COMM_ENDPOINT_SEC 0 -#if defined(CONFIG_BOARD_TLSR9518ADK80D) || defined(CONFIG_BOARD_TLSR9528A) -#define APP_USE_IDENTIFY_PWM 1 -#endif diff --git a/examples/air-quality-sensor-app/telink/prj.conf b/examples/air-quality-sensor-app/telink/prj.conf index b43fbe9636d9aa..12ee5d07bb1eb4 100644 --- a/examples/air-quality-sensor-app/telink/prj.conf +++ b/examples/air-quality-sensor-app/telink/prj.conf @@ -1,5 +1,5 @@ # -# Copyright (c) 2023 Project CHIP Authors +# Copyright (c) 2023-2024 Project CHIP Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ # limitations under the License. # -# This sample uses sample-defaults.conf to set options common for all +# This sample uses Kconfig.defaults to set options common for all # samples. This file should contain only options specific for this sample # or overrides of default values. @@ -22,10 +22,6 @@ CONFIG_CHIP=y CONFIG_STD_CPP17=y -# CHIP configuration -CONFIG_CHIP_PROJECT_CONFIG="include/CHIPProjectConfig.h" -CONFIG_CHIP_OPENTHREAD_CONFIG="../../platform/telink/project_include/OpenThreadConfig.h" - # 32774 == 0x8006 (example air-quality-sensor-app) CONFIG_CHIP_DEVICE_PRODUCT_ID=32774 diff --git a/examples/air-quality-sensor-app/telink/src/AppTask.cpp b/examples/air-quality-sensor-app/telink/src/AppTask.cpp index ac2f61b3c06f52..da0f80ec9c15f7 100644 --- a/examples/air-quality-sensor-app/telink/src/AppTask.cpp +++ b/examples/air-quality-sensor-app/telink/src/AppTask.cpp @@ -37,9 +37,7 @@ CHIP_ERROR AppTask::Init(void) { CHIP_ERROR err; -#if APP_USE_EXAMPLE_START_BUTTON SetExampleButtonCallbacks(AirQualitySensorUpdateTimerEventHandler); -#endif InitCommonParts(); err = SensorMgr().Init(); diff --git a/examples/all-clusters-app/all-clusters-common/include/dishwasher-mode.h b/examples/all-clusters-app/all-clusters-common/include/dishwasher-mode.h index 604496f886b3c2..2ff1696e9378cc 100644 --- a/examples/all-clusters-app/all-clusters-common/include/dishwasher-mode.h +++ b/examples/all-clusters-app/all-clusters-common/include/dishwasher-mode.h @@ -19,7 +19,6 @@ #pragma once #include -#include #include #include #include diff --git a/examples/all-clusters-app/all-clusters-common/include/laundry-dryer-controls-delegate-impl.h b/examples/all-clusters-app/all-clusters-common/include/laundry-dryer-controls-delegate-impl.h index 898cf8806f4111..920d7030c2aa78 100644 --- a/examples/all-clusters-app/all-clusters-common/include/laundry-dryer-controls-delegate-impl.h +++ b/examples/all-clusters-app/all-clusters-common/include/laundry-dryer-controls-delegate-impl.h @@ -20,7 +20,6 @@ #include #include -#include #include #include diff --git a/examples/all-clusters-app/all-clusters-common/include/laundry-washer-controls-delegate-impl.h b/examples/all-clusters-app/all-clusters-common/include/laundry-washer-controls-delegate-impl.h index 15a72482726ba0..f9d3d1bf8c7bdf 100644 --- a/examples/all-clusters-app/all-clusters-common/include/laundry-washer-controls-delegate-impl.h +++ b/examples/all-clusters-app/all-clusters-common/include/laundry-washer-controls-delegate-impl.h @@ -20,7 +20,6 @@ #include #include -#include #include #include diff --git a/examples/all-clusters-app/all-clusters-common/include/laundry-washer-mode.h b/examples/all-clusters-app/all-clusters-common/include/laundry-washer-mode.h index 2f59b0dfd04bab..5d35c03d4e50cd 100644 --- a/examples/all-clusters-app/all-clusters-common/include/laundry-washer-mode.h +++ b/examples/all-clusters-app/all-clusters-common/include/laundry-washer-mode.h @@ -19,7 +19,6 @@ #pragma once #include -#include #include #include #include diff --git a/examples/all-clusters-app/all-clusters-common/include/microwave-oven-mode.h b/examples/all-clusters-app/all-clusters-common/include/microwave-oven-mode.h index dd5d5b4bcaf2eb..df06d23a7dc5d7 100644 --- a/examples/all-clusters-app/all-clusters-common/include/microwave-oven-mode.h +++ b/examples/all-clusters-app/all-clusters-common/include/microwave-oven-mode.h @@ -19,7 +19,6 @@ #pragma once #include -#include #include #include #include diff --git a/examples/all-clusters-app/all-clusters-common/include/oven-modes.h b/examples/all-clusters-app/all-clusters-common/include/oven-modes.h index 7e264a4c47e272..2c58229ef6e541 100644 --- a/examples/all-clusters-app/all-clusters-common/include/oven-modes.h +++ b/examples/all-clusters-app/all-clusters-common/include/oven-modes.h @@ -19,7 +19,6 @@ #pragma once #include -#include #include #include #include diff --git a/examples/all-clusters-app/all-clusters-common/include/rvc-modes.h b/examples/all-clusters-app/all-clusters-common/include/rvc-modes.h index 8af4aa5f6f9155..8449878260f053 100644 --- a/examples/all-clusters-app/all-clusters-common/include/rvc-modes.h +++ b/examples/all-clusters-app/all-clusters-common/include/rvc-modes.h @@ -19,7 +19,6 @@ #pragma once #include -#include #include #include #include diff --git a/examples/all-clusters-app/all-clusters-common/include/static-supported-modes-manager.h b/examples/all-clusters-app/all-clusters-common/include/static-supported-modes-manager.h index ef90de38697f4c..b4ce50b8cd49a3 100644 --- a/examples/all-clusters-app/all-clusters-common/include/static-supported-modes-manager.h +++ b/examples/all-clusters-app/all-clusters-common/include/static-supported-modes-manager.h @@ -19,7 +19,6 @@ #pragma once #include -#include #include #include diff --git a/examples/all-clusters-app/all-clusters-common/include/static-supported-temperature-levels.h b/examples/all-clusters-app/all-clusters-common/include/static-supported-temperature-levels.h index 3fdce87e109317..9698df8c094cc8 100644 --- a/examples/all-clusters-app/all-clusters-common/include/static-supported-temperature-levels.h +++ b/examples/all-clusters-app/all-clusters-common/include/static-supported-temperature-levels.h @@ -19,7 +19,6 @@ #pragma once #include -#include #include namespace chip { diff --git a/examples/all-clusters-app/all-clusters-common/include/tcc-mode.h b/examples/all-clusters-app/all-clusters-common/include/tcc-mode.h index dcd9024e8d0385..8d8cdb02962d68 100644 --- a/examples/all-clusters-app/all-clusters-common/include/tcc-mode.h +++ b/examples/all-clusters-app/all-clusters-common/include/tcc-mode.h @@ -19,7 +19,6 @@ #pragma once #include -#include #include #include #include diff --git a/examples/all-clusters-app/all-clusters-common/src/bridged-actions-stub.cpp b/examples/all-clusters-app/all-clusters-common/src/bridged-actions-stub.cpp index 13c0205a4e3ca1..41171d760d0048 100644 --- a/examples/all-clusters-app/all-clusters-common/src/bridged-actions-stub.cpp +++ b/examples/all-clusters-app/all-clusters-common/src/bridged-actions-stub.cpp @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include diff --git a/examples/all-clusters-app/all-clusters-common/src/fan-stub.cpp b/examples/all-clusters-app/all-clusters-common/src/fan-stub.cpp index 9a9fcccd73f4f2..9309b597db434f 100644 --- a/examples/all-clusters-app/all-clusters-common/src/fan-stub.cpp +++ b/examples/all-clusters-app/all-clusters-common/src/fan-stub.cpp @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include diff --git a/examples/all-clusters-app/ameba/README.md b/examples/all-clusters-app/ameba/README.md index 3450d27befe551..48f327611f0891 100644 --- a/examples/all-clusters-app/ameba/README.md +++ b/examples/all-clusters-app/ameba/README.md @@ -27,11 +27,11 @@ The CHIP demo application is supported on - Pull docker image: - $ docker pull ghcr.io/project-chip/chip-build-ameba:42 + $ docker pull ghcr.io/project-chip/chip-build-ameba:47 - Run docker container: - $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:42 + $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:47 - Setup build environment: diff --git a/examples/all-clusters-app/ameba/main/DeviceCallbacks.cpp b/examples/all-clusters-app/ameba/main/DeviceCallbacks.cpp index 338a469bb32947..ef4a733dde4339 100644 --- a/examples/all-clusters-app/ameba/main/DeviceCallbacks.cpp +++ b/examples/all-clusters-app/ameba/main/DeviceCallbacks.cpp @@ -29,7 +29,6 @@ #include #include #include -#include #include #include #include diff --git a/examples/all-clusters-app/ameba/main/chipinterface.cpp b/examples/all-clusters-app/ameba/main/chipinterface.cpp index c9547136035f81..aa7cc4afe75047 100644 --- a/examples/all-clusters-app/ameba/main/chipinterface.cpp +++ b/examples/all-clusters-app/ameba/main/chipinterface.cpp @@ -34,7 +34,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/examples/all-clusters-app/asr/src/AppTask.cpp b/examples/all-clusters-app/asr/src/AppTask.cpp index 92b6aaef3dba49..1a829ca3de1798 100644 --- a/examples/all-clusters-app/asr/src/AppTask.cpp +++ b/examples/all-clusters-app/asr/src/AppTask.cpp @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include diff --git a/examples/all-clusters-app/asr/src/DeviceCallbacks.cpp b/examples/all-clusters-app/asr/src/DeviceCallbacks.cpp index cc48488fd7e3ca..459b3e9921799f 100644 --- a/examples/all-clusters-app/asr/src/DeviceCallbacks.cpp +++ b/examples/all-clusters-app/asr/src/DeviceCallbacks.cpp @@ -30,7 +30,6 @@ #include #include #include -#include #include #include #include diff --git a/examples/all-clusters-app/cc13x2x7_26x2x7/.gn b/examples/all-clusters-app/cc13x2x7_26x2x7/.gn deleted file mode 100644 index cf974b2eb1df22..00000000000000 --- a/examples/all-clusters-app/cc13x2x7_26x2x7/.gn +++ /dev/null @@ -1,30 +0,0 @@ -# Copyright (c) 2020 Project CHIP Authors -# -# 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. - -import("//build_overrides/build.gni") - -# The location of the build configuration file. -buildconfig = "${build_root}/config/BUILDCONFIG.gn" - -# CHIP uses angle bracket includes. -check_system_includes = true - -default_args = { - target_cpu = "arm" - target_os = "freertos" - - import("//args.gni") - pw_build_PIP_REQUIREMENTS += - [ "${chip_root}/scripts/setup/requirements.ti.txt" ] -} diff --git a/examples/all-clusters-app/cc13x2x7_26x2x7/BUILD.gn b/examples/all-clusters-app/cc13x2x7_26x2x7/BUILD.gn deleted file mode 100644 index 6cf5941e79d2c4..00000000000000 --- a/examples/all-clusters-app/cc13x2x7_26x2x7/BUILD.gn +++ /dev/null @@ -1,143 +0,0 @@ -# Copyright (c) 2020 Project CHIP Authors -# -# 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. - -import("//build_overrides/build.gni") -import("//build_overrides/chip.gni") -import("//build_overrides/openthread.gni") -import("//build_overrides/ti_simplelink_sdk.gni") - -import("${build_root}/config/defaults.gni") - -import("${chip_root}/src/platform/device.gni") - -import("${ti_simplelink_sdk_build_root}/ti_simplelink_executable.gni") -import("${ti_simplelink_sdk_build_root}/ti_simplelink_sdk.gni") - -assert(current_os == "freertos") - -project_dir = "${chip_root}/examples/all-clusters-app/cc13x2x7_26x2x7" - -ti_simplelink_sdk("sdk") { - include_dirs = [ "${project_dir}/main/include" ] - public_configs = [ ":all-clusters-app_config" ] -} - -ti_sysconfig("sysconfig") { - sources = [ "${project_dir}/chip.syscfg" ] - - outputs = [ - "ti_devices_config.c", - "ti_radio_config.c", - "ti_radio_config.h", - "ti_drivers_config.c", - "ti_drivers_config.h", - "ti_ble_config.c", - "ti_ble_config.h", - "ti_dmm_application_policy.c", - "ti_dmm_application_policy.h", - - # disabled until upstream generation is aligned - #"tiop_config.h", - #"tiop_config.c", - - # not traditional source files - #"ti_utils_build_linker.cmd.genlibs", - #"syscfg_c.rov.xs", - #"ti_utils_runtime_model.gv", - #"ti_utils_runtime_Makefile", - #"ti_ble_app_config.opt", - #"ti_build_config.opt", - ] - - public_configs = [ ":sdk_cc13x2x7_26x2x7_dmm_config" ] - - cflags = [ - "-Wno-comment", - "@" + rebase_path("${target_gen_dir}/sysconfig/ti_ble_app_config.opt", - root_build_dir), - "@" + rebase_path("${target_gen_dir}/sysconfig/ti_build_config.opt", - root_build_dir), - ] -} - -ti_simplelink_executable("all-clusters-app") { - output_name = "chip-${ti_simplelink_board}-all-clusters-example.out" - - sources = [ - "${chip_root}/examples/all-clusters-app/all-clusters-common/src/air-quality-instance.cpp", - "${chip_root}/examples/all-clusters-app/all-clusters-common/src/binding-handler.cpp", - "${chip_root}/examples/all-clusters-app/all-clusters-common/src/bridged-actions-stub.cpp", - "${chip_root}/examples/all-clusters-app/all-clusters-common/src/concentration-measurement-instances.cpp", - "${chip_root}/examples/all-clusters-app/all-clusters-common/src/device-energy-management-stub.cpp", - "${chip_root}/examples/all-clusters-app/all-clusters-common/src/energy-evse-stub.cpp", - "${chip_root}/examples/all-clusters-app/all-clusters-common/src/fan-stub.cpp", - "${chip_root}/examples/all-clusters-app/all-clusters-common/src/oven-modes.cpp", - "${chip_root}/examples/all-clusters-app/all-clusters-common/src/resource-monitoring-delegates.cpp", - "${chip_root}/examples/all-clusters-app/all-clusters-common/src/smco-stub.cpp", - "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp", - "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-temperature-levels.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementDelegateImpl.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementManager.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/ElectricalPowerMeasurementDelegate.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp", - "${chip_root}/examples/providers/DeviceInfoProviderImpl.cpp", - "${project_dir}/main/AppTask.cpp", - "${project_dir}/main/ClusterManager.cpp", - "${project_dir}/main/Globals.cpp", - "${project_dir}/main/ZclCallbacks.cpp", - "${project_dir}/main/main.cpp", - ] - - deps = [ - ":sdk", - ":sysconfig", - "${chip_root}/examples/all-clusters-app/all-clusters-common", - "${chip_root}/src/lib", - ] - - if (chip_openthread_ftd) { - deps += [ "${chip_root}/third_party/openthread/repo:libopenthread-ftd" ] - } else { - deps += [ "${chip_root}/third_party/openthread/repo:libopenthread-mtd" ] - } - - if (custom_factory_data) { - defines = [ "CC13XX_26XX_FACTORY_DATA" ] - } - - include_dirs = [ - "${project_dir}", - "${project_dir}/main", - "${chip_root}/examples/all-clusters-app/all-clusters-common/include", - "${chip_root}/examples/energy-management-app/energy-management-common/include", - "${chip_root}/examples/providers/", - ] - - cflags = [ - "-Wno-implicit-fallthrough", - "-Wno-sign-compare", - "-Wconversion", - ] - - output_dir = root_out_dir -} - -group("cc13x2x7_26x2x7") { - deps = [ ":all-clusters-app" ] -} - -group("default") { - deps = [ ":cc13x2x7_26x2x7" ] -} diff --git a/examples/all-clusters-app/cc13x2x7_26x2x7/README.md b/examples/all-clusters-app/cc13x2x7_26x2x7/README.md deleted file mode 100644 index 68d6f927224585..00000000000000 --- a/examples/all-clusters-app/cc13x2x7_26x2x7/README.md +++ /dev/null @@ -1,241 +0,0 @@ -# Matter CC1352 CC2652 All-clusters Example Application - -An example application showing the use of [Matter][matter] on the Texas -Instruments CC13XX_26XX family of Wireless MCUs. - ---- - -- [Matter CC1352 CC2652 All Clusters Example Application](#matter-cc1352-cc2652-all-clusters-example-application) - - [Introduction](#introduction) - - [Device UI](#device-ui) - - [Building](#building) - - [Preparation](#preparation) - - [Compilation](#compilation) - - [Programming](#programming) - - [Code Composer Studio](#code-composer-studio) - - [UniFlash](#uniflash) - - [Viewing Logging Output](#viewing-logging-output) - - [Running the Example](#running-the-example) - - [Provisioning](#provisioning) - - [Bluetooth LE Advertising](#bluetooth-le-advertising) - - [Bluetooth LE Rendezvous](#bluetooth-le-rendezvous) - - [TI Support](#ti-support) - ---- - -## Introduction - -![CC1352R1_LAUNCHXL](../../pump-app/cc13x2x7_26x2x7/doc/images/cc1352r1_launchxl.jpg) - -The CC13XX_26XX all clusters example application provides the basis to query and -run commands for all currently implemented Matter clusters. This uses the -open-source Matter implementation and the Texas Instruments SimpleLinkâ„¢ CC13XX -and CC26XX software development kit. - -This example is enabled to build for CC2652R7 devices. - -The all-clusters example is intended to serve both as a means to explore the -workings of Matter, as well as a template for creating real products based on -the Texas Instruments devices. - -## Device UI - -This example application has a simple User Interface to depict the state of the -various Matter clusters and the attribute changes associated with them. The user -LEDs on the LaunchPad are used for the onoff, levelcontrol and identify clusters -to provide a working demonstration of the cluster attribute changes. The Green -LED is used to represent attribute changes to endpoint 1 while the Red LED is -used to represent changes to endpoint 2. - -Short presses (less than 1000ms) of the user buttons are used currently unused -in the all-clusters application, but stubs are provided. - -Long presses (greater than 1000ms) of the user buttons are used for controlling -BLE advertisements and resets. The left button (`BTN-1`) is used to perform a -factory reset of the device. The Right button (`BTN-2`) is used to disable BLE -advertisements (if enabled) or enable advertisements (if disabled). - -## Building - -### Preparation - -Some initial setup is necessary for preparing the build environment. This -section will need to be done when migrating to new versions of the SDK. This -guide assumes that the environment is linux based, and recommends Ubuntu 20.04. - -- Download and install [SysConfig][sysconfig]. This can be done simply with - the following commands. - - ``` - $ cd ~ - $ wget https://dr-download.ti.com/software-development/ide-configuration-compiler-or-debugger/MD-nsUM6f7Vvb/1.16.2.3028/sysconfig-1.16.2_3028-setup.run - $ chmod +x sysconfig-1.16.2_3028-setup.run - $ ./sysconfig-1.16.2_3028-setup.run - ``` - -- Run the bootstrap script to setup the build environment. - - ``` - $ cd ~/connectedhomeip - $ source ./scripts/bootstrap.sh - - ``` - -### Compilation - -It is necessary to activate the environment in every new shell. Then run GN and -Ninja to build the executable. - -- Activate the build environment with the repository activate script. - - ``` - $ cd ~/connectedhomeip - $ source ./scripts/activate.sh - - ``` - -- Run the build to produce a default executable. By default on Linux both the - TI SimpleLink SDK and Sysconfig are located in a `ti` folder in the user's - home directory, and you must provide the absolute path to them. For example - `/home/username/ti/sysconfig_1.16.2`. On Windows the default directory is - `C:\ti`. Take note of this install path, as it will be used in the next - step. - - ``` - $ cd ~/connectedhomeip/examples/all-clusters-app/cc13x2x7_26x2x7 - $ gn gen out/debug --args="ti_sysconfig_root=\"$HOME/ti/sysconfig_1.16.2\"" - $ ninja -C out/debug - - ``` - -## Programming - -Loading the built image onto a LaunchPad is supported through two methods; -Uniflash and Code Composer Studio (CCS). UniFlash can be used to load the image. -Code Composer Studio can be used to load the image and debug the source code. - -### Code Composer Studio - -Programming with CCS will allow for a full debug environment within the IDE. -This is accomplished by creating a target connection to the XDS110 debugger and -starting a project-less debug session. The CCS IDE will attempt to find the -source files on the local machine based on the debug information embedded within -the ELF. CCS may prompt you to find the source code if the image was built on -another machine or the source code is located in a different location than is -recorded within the ELF. - -Download and install [Code Composer Studio][ccs]. - -First open CCS and create a new workspace. - -Create a target connection (sometimes called the CCXML) for your target SoC and -debugger as described in the [Manual Method][ccs_manual_method] section of the -CCS User's Guide. - -Next initiate a project-less debug session as described in the [Manual -Launch][ccs_manual_launch] section of the CCS User's Guide. - -CCS should switch to the debug view described in the [After -Launch][ccs_after_launch] section of the User's Guide. The SoC core will likely -be disconnected and symbols will not be loaded. Connect to the core as described -in the [Debug View][ccs_debug_view] section of the User's Guide. Once the core -is connected, use the `Load` button on the toolbar to load the ELF image. - -Note that the default configuration of the CCXML uses 2-wire cJTAG instead of -the full 4-wire JTAG connection to match the default jumper configuration of the -LaunchPad. - -### UniFlash - -Uniflash is Texas Instrument's uniform programming tool for embedded processors. -This will allow you to erase, flash, and inspect the SoC without setting up a -debugging environment. - -Download and install [UniFlash][uniflash]. - -First open UniFlash. Debug probes connected to the computer will usually be -displayed under the Detected Devices due to the automatic device detection -feature. If your device does not show up in this view it my be disconnected, or -you may have to create a New Configuration. If you already have a CCXML for your -SoC and debug connection you can use that in the section at the bottom. Once -your device is selected, click the `Start` button within the section to launch -the session. - -Select the ELF image to load on the device with the `Browse` button. This file -is placed in the `out/debug` folder by this guide and ends with the `*.out` file -extension. - -Finally click the `Load Image` button to load the executable image onto the -device. You should be able to see the log output over the XDS110 User UART. - -Note that programming the device through JTAG sets the Halt-in-Boot flag and may -cause issues when performing a software reset. This flag can be reset by -power-cycling the LaunchPad. - -## Viewing Logging Output - -By default the log output will be sent to the Application/User UART. Open a -terminal emulator to that port to see the output with the following options: - -| Parameter | Value | -| ------------ | -------- | -| Speed (baud) | `115200` | -| Data bits | `8` | -| Stop bits | `1` | -| Parity | `None` | -| Flow control | `None` | - -## Running the Example - -Once a device has been flashed with this example, it can now join and operate in -an existing Thread network. The following sections assume that a Thread network -is already active, and has at least one [OpenThread Border -Router][ot_border_router_setup]. - -For insight into what other components are needed to run this example, please -refer to our [Matter Getting Started Guide][matter-e2e-faq]. - -### Provisioning - -Interacting with the application begins by enabling BLE advertisements and then -pairing the device into a Thread network. - -#### Bluetooth LE Advertising - -To provision this example onto a Thread network, the device must be discoverable -over Bluetooth LE. BLE advertising is started by long pressing the right button -(greater than 1000ms), labeled `BTN-2` on the silkscreen. Once the device is -fully provisioned, BLE advertising will stop. - -#### Bluetooth LE Rendezvous - -Pairing this application with `ble-thread` can be done with any of the enabled -[CHIP Controller](../../../src/controller/README.md) applications. Use the -information printed on the console to aide in pairing the device. The controller -application can also be used to control the example app with the cluster -commands. - -## TI Support - -For technical support, please consider creating a post on TI's [E2E forum][e2e]. -Additionally, we welcome any feedback. - -[matter]: https://github.com/project-chip/connectedhomeip -[ccs]: https://www.ti.com/tool/CCSTUDIO -[ccs_after_launch]: - https://software-dl.ti.com/ccs/esd/documents/users_guide/ccs_debug-main.html?configuration#after-launch -[ccs_debug_view]: - https://software-dl.ti.com/ccs/esd/documents/users_guide/ccs_debug-main.html?configuration#debug-view -[ccs_manual_launch]: - https://software-dl.ti.com/ccs/esd/documents/users_guide/ccs_debug-main.html?configuration#manual-launch -[ccs_manual_method]: - https://software-dl.ti.com/ccs/esd/documents/users_guide/ccs_debug-main.html?configuration#manual-method -[cc1352r1_launchxl]: https://www.ti.com/tool/LAUNCHXL-CC1352R1 -[e2e]: https://e2e.ti.com/support/wireless-connectivity/zigbee-and-thread -[matter-e2e-faq]: - https://e2e.ti.com/support/wireless-connectivity/zigbee-thread-group/zigbee-and-thread/f/zigbee-thread-forum/1082428/faq-cc2652r7-matter----getting-started-guide -[sysconfig]: https://www.ti.com/tool/SYSCONFIG -[ti_thread_dnd]: - https://www.ti.com/wireless-connectivity/thread/design-development.html -[ot_border_router_setup]: https://openthread.io/guides/border-router/build -[uniflash]: https://www.ti.com/tool/download/UNIFLASH diff --git a/examples/all-clusters-app/cc13x2x7_26x2x7/args.gni b/examples/all-clusters-app/cc13x2x7_26x2x7/args.gni deleted file mode 100644 index 23c3aee1afb0bb..00000000000000 --- a/examples/all-clusters-app/cc13x2x7_26x2x7/args.gni +++ /dev/null @@ -1,54 +0,0 @@ -# Copyright (c) 2020 Project CHIP Authors -# -# 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. - -import("//build_overrides/chip.gni") -import("${chip_root}/config/standalone/args.gni") -import("${chip_root}/examples/platform/cc13x2_26x2/args.gni") - -ti_simplelink_sdk_target = get_label_info(":sdk", "label_no_toolchain") -ti_simplelink_sysconfig_target = - get_label_info(":sysconfig", "label_no_toolchain") - -ti_simplelink_board = "LP_CC2652R7" - -# Size Optimizations -# use -Os instead of -Og, LWIP release build -optimize_debug_level = "s" -lwip_debug = false - -chip_enable_ota_requestor = false - -# Disable FTD Build for all-clusters app to save Flash -chip_openthread_ftd = false - -# Disable CHIP Logging -chip_progress_logging = false - -# Dsiable verbose logs for all-clusters app to save Flash -chip_detail_logging = false -chip_automation_logging = false - -# BLE options -chip_config_network_layer_ble = true - -# Disable lock tracking, since our FreeRTOS configuration does not set -# INCLUDE_xSemaphoreGetMutexHolder -chip_stack_lock_tracking = "none" - -matter_device_vid = "0xFFF1" -matter_device_pid = "0x8006" -matter_software_ver = "0x0001" -matter_software_ver_str = "1.0d1" - -custom_factory_data = true diff --git a/examples/all-clusters-app/cc13x2x7_26x2x7/build_overrides b/examples/all-clusters-app/cc13x2x7_26x2x7/build_overrides deleted file mode 120000 index e578e73312ebd1..00000000000000 --- a/examples/all-clusters-app/cc13x2x7_26x2x7/build_overrides +++ /dev/null @@ -1 +0,0 @@ -../../build_overrides \ No newline at end of file diff --git a/examples/all-clusters-app/cc13x2x7_26x2x7/chip.syscfg b/examples/all-clusters-app/cc13x2x7_26x2x7/chip.syscfg deleted file mode 100644 index 4f02a9fd40da9a..00000000000000 --- a/examples/all-clusters-app/cc13x2x7_26x2x7/chip.syscfg +++ /dev/null @@ -1,192 +0,0 @@ -/* - * - * Copyright (c) 2020 Project CHIP Authors - * Copyright (c) 2020 Texas Instruments Incorporated - * All rights reserved. - * - * 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. - */ - - -/* Modules */ -var AESCCM = scripting.addModule("/ti/drivers/AESCCM"); -var AESECB = scripting.addModule("/ti/drivers/AESECB"); -var Button = scripting.addModule("/ti/drivers/apps/Button"); -var LED = scripting.addModule("/ti/drivers/apps/LED"); -var NVS = scripting.addModule("/ti/drivers/NVS"); -var RF = scripting.addModule("/ti/drivers/RF"); -var RFDesign = scripting.addModule("ti/devices/radioconfig/rfdesign"); -var RTOS = scripting.addModule("/ti/drivers/RTOS"); -var TRNG = scripting.addModule("/ti/drivers/TRNG"); -var Thread = scripting.addModule("/ti/thread/thread"); -var SHA2 = scripting.addModule("/ti/drivers/SHA2"); -var UART = scripting.addModule("/ti/drivers/UART"); -var ble = scripting.addModule("/ti/ble5stack/ble"); -var dmm = scripting.addModule("/ti/dmm/dmm"); -var AESCTRDRBG = scripting.addModule("/ti/drivers/AESCTRDRBG"); -var ECDH = scripting.addModule("/ti/drivers/ECDH"); - -/* Instances */ -var AESCCM1 = AESCCM.addInstance(); -var AESECB1 = AESECB.addInstance(); -var AESECB2 = AESECB.addInstance(); -var Button1 = Button.addInstance(); -var Button2 = Button.addInstance(); -var NVS1 = NVS.addInstance(); -var NVS2 = NVS.addInstance(); -var SHA21 = SHA2.addInstance(); -var LED1 = LED.addInstance(); -var LED2 = LED.addInstance(); -var TRNG1 = TRNG.addInstance(); -var TRNG2 = TRNG.addInstance(); -var TRNG3 = TRNG.addInstance(); -var UART1 = UART.addInstance(); -var AESCTRDRBG1 = AESCTRDRBG.addInstance(); -var ECDH1 = ECDH.addInstance(); - -AESCTRDRBG1.$name = "CONFIG_AESCTRDRBG_0"; -AESCTRDRBG1.aesctrObject.$name = "CONFIG_AESCTR_0"; - -AESCCM1.$name = "CONFIG_AESCCM0"; - -AESECB1.$name = "CONFIG_AESECB0"; -AESECB2.$name = "CONFIG_AESECB_1"; - -ECDH1.$name = "CONFIG_ECDH0"; - -/* RTOS */ -RTOS.name = "FreeRTOS"; - -/* Left Button */ -Button1.$name = "CONFIG_BTN_LEFT"; -Button1.$hardware = system.deviceData.board.components["BTN-1"]; -Button1.gpioPin.$name = "CONFIG_GPIO_BTN1"; -Button1.gpioPin.pull = "Pull Up"; -Button1.gpioPin.interruptTrigger = "Falling Edge"; - -/* Left Button */ -Button2.$name = "CONFIG_BTN_RIGHT"; -Button2.$hardware = system.deviceData.board.components["BTN-2"]; -Button2.gpioPin.$name = "CONFIG_GPIO_BTN2"; -Button2.gpioPin.pull = "Pull Up"; -Button2.gpioPin.interruptTrigger = "Falling Edge"; - -/* ======== CCFG ======== */ -var CCFG = scripting.addModule("/ti/devices/CCFG"); -const ccfgSettings = system.getScript("/ti/common/lprf_ccfg_settings.js").ccfgSettings; -for(var setting in ccfgSettings) -{ - CCFG[setting] = ccfgSettings[setting]; -} - -CCFG.enableCodeGeneration = true; - -/* NVS */ -NVS1.$name = "CONFIG_NVSINTERNAL"; - -NVS1.internalFlash.regionBase = 0xAA000; -NVS1.internalFlash.regionSize = 0x4000; - -NVS2.$name = "CONFIG_NVSEXTERNAL"; -NVS2.nvsType = "External"; // NVS Region Type -NVS2.$hardware = system.deviceData.board.components.MX25R8035F; - -/* RF */ -/* if an antenna component exists, assign it to the rf instance */ -if (system.deviceData.board && system.deviceData.board.components.RF) { - RF.$hardware = system.deviceData.board.components.RF; -} - -const rfDesignSettings = system.getScript("/ti/common/lprf_rf_design_settings.js").rfDesignSettings; -for(var setting in rfDesignSettings) -{ - RFDesign[setting] = rfDesignSettings[setting]; -} - -/* Red LED */ -LED1.$name = "CONFIG_LED_RED"; -LED1.$hardware = system.deviceData.board.components.LED_RED; -LED1.gpioPin.$name = "CONFIG_GPIO_RLED"; -LED1.gpioPin.mode = "Output"; -LED1.gpioPin.callbackFunction = ""; - -/* Green LED */ -LED2.$name = "CONFIG_LED_GREEN"; -LED2.$hardware = system.deviceData.board.components.LED_GREEN; -LED2.gpioPin.$name = "CONFIG_GPIO_GLED"; -LED2.gpioPin.mode = "Output"; -LED2.gpioPin.callbackFunction = ""; - -/* Debug UART */ -UART1.$hardware = system.deviceData.board.components.XDS110UART; -UART1.$name = "CONFIG_UART_DEBUG"; - -/* TRNG */ -TRNG1.$name = "CONFIG_TRNG_0"; -TRNG2.$name = "CONFIG_TRNG_1"; -TRNG3.$name = "CONFIG_TRNG_APP"; - -RTOS.name = "FreeRTOS"; - -/* BLE */ -ble.addressMode = "ADDRMODE_RP_WITH_PUBLIC_ID"; -ble.maxConnNum = 1; -ble.numOfAdvSets = 1; -ble.lockProject = true; -ble.oneLibSizeOpt = true; -ble.maxPDUSize = 255; -ble.radioConfig.codeExportConfig.$name = "ti_devices_radioconfig_code_export_param1"; -ble.connUpdateParamsPeripheral.$name = "ti_ble5stack_general_ble_conn_update_params0"; -ble.connUpdateParamsPeripheral.reqMinConnInt = 30; -ble.connUpdateParamsPeripheral.reqMaxConnInt = 50; - -ble.advSet1.$name = "ti_ble5stack_broadcaster_advertisement_set0"; -ble.advSet1.advParam1.$name = "ti_ble5stack_broadcaster_advertisement_params0"; - -/* DMM */ -dmm.project = "ti_thread_thermostat_remote_display"; -dmm.stackRoles = ["blePeripheral","threadFTD"]; -dmm.lockStackRoles = true; -dmm.numApplicationStates = 10; -dmm.applicationState0 = "ANY"; -dmm.applicationState1 = "DMMPOLICY_BLE_IDLE"; -dmm.applicationState2 = "DMMPOLICY_BLE_ADV"; -dmm.applicationState3 = "DMMPOLICY_BLE_CONNECTING"; -dmm.applicationState4 = "DMMPOLICY_BLE_HIGH_BANDWIDTH"; -dmm.applicationState5 = "DMMPOLICY_BLE_CONNECTED"; -dmm.applicationState6 = "DMMPOLICY_BLE_OAD"; -dmm.applicationState7 = "DMMPOLICY_THREAD_IDLE"; -dmm.applicationState8 = "DMMPOLICY_THREAD_LINK_EST"; -dmm.applicationState9 = "DMMPOLICY_THREAD_DATA"; -dmm.policyArray.create(4); -dmm.policyArray[0].$name = "ti_dmm_policy_dmm_policy0"; -dmm.policyArray[0].blePeripheral.$name = "ti_dmm_policy_stack_dmm_stack_ble0"; -dmm.policyArray[0].blePeripheral.applicationStates = ["applicationState6"]; -dmm.policyArray[0].threadFTD.$name = "ti_dmm_policy_stack_dmm_stack_thread0"; -dmm.policyArray[0].threadFTD.pause = "DMMPOLICY_PAUSED"; -dmm.policyArray[1].$name = "ti_dmm_policy_dmm_policy1"; -dmm.policyArray[1].blePeripheral.$name = "ti_dmm_policy_stack_dmm_stack_ble1"; -dmm.policyArray[1].blePeripheral.applicationStates = ["applicationState3","applicationState4"]; -dmm.policyArray[1].blePeripheral.weight = 25; -dmm.policyArray[1].blePeripheral.appliedActivity = ["DMMPOLICY_APPLIED_ACTIVITY_BLE_CONNECTION"]; -dmm.policyArray[1].threadFTD.$name = "ti_dmm_policy_stack_dmm_stack_thread1"; -dmm.policyArray[2].$name = "ti_dmm_policy_dmm_policy2"; -dmm.policyArray[2].blePeripheral.$name = "ti_dmm_policy_stack_dmm_stack_ble2"; -dmm.policyArray[2].threadFTD.$name = "ti_dmm_policy_stack_dmm_stack_thread2"; -dmm.policyArray[2].threadFTD.weight = 30; -dmm.policyArray[2].threadFTD.applicationStates = ["applicationState8"]; -dmm.policyArray[2].threadFTD.appliedActivity = ["DMMPOLICY_APPLIED_ACTIVITY_ALL"]; -dmm.policyArray[3].$name = "ti_dmm_policy_dmm_policy3"; -dmm.policyArray[3].blePeripheral.$name = "ti_dmm_policy_stack_dmm_stack_ble3"; -dmm.policyArray[3].threadFTD.$name = "ti_dmm_policy_stack_dmm_stack_thread3"; -dmm.policyArray[3].threadFTD.weight = 1; diff --git a/examples/all-clusters-app/cc13x2x7_26x2x7/main/AppTask.cpp b/examples/all-clusters-app/cc13x2x7_26x2x7/main/AppTask.cpp deleted file mode 100644 index b6b9bf1e8bd8f4..00000000000000 --- a/examples/all-clusters-app/cc13x2x7_26x2x7/main/AppTask.cpp +++ /dev/null @@ -1,408 +0,0 @@ -/* - * - * Copyright (c) 2020 Project CHIP Authors - * Copyright (c) 2020 Texas Instruments Incorporated - * All rights reserved. - * - * 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. - */ - -#include "AppTask.h" -#include "AppConfig.h" -#include "AppEvent.h" -#include -#include - -#include "FreeRTOS.h" -#include "Globals.h" -#include -#include - -#include -#include -#include - -#if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR -#include -#include -#include -#include -#include -#endif -#include -#include - -#ifdef AUTO_PRINT_METRICS -#include -#endif -#include - -#include -#include - -/* syscfg */ -#include - -#define APP_TASK_STACK_SIZE (5000) -#define APP_TASK_PRIORITY 4 -#define APP_EVENT_QUEUE_SIZE 10 - -using namespace ::chip; -using namespace ::chip::Credentials; -using namespace ::chip::DeviceLayer; - -static TaskHandle_t sAppTaskHandle; -static QueueHandle_t sAppEventQueue; - -static Button_Handle sAppLeftHandle; -static Button_Handle sAppRightHandle; -static DeviceInfoProviderImpl sExampleDeviceInfoProvider; - -AppTask AppTask::sAppTask; - -constexpr EndpointId kNetworkCommissioningEndpointSecondary = 0xFFFE; - -namespace { -app::Clusters::TemperatureControl::AppSupportedTemperatureLevelsDelegate sAppSupportedTemperatureLevelsDelegate; -} - -#if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR -static DefaultOTARequestor sRequestorCore; -static DefaultOTARequestorStorage sRequestorStorage; -static DefaultOTARequestorDriver sRequestorUser; -static BDXDownloader sDownloader; -static OTAImageProcessorImpl sImageProcessor; - -void InitializeOTARequestor(void) -{ - // Initialize and interconnect the Requestor and Image Processor objects - SetRequestorInstance(&sRequestorCore); - - sRequestorStorage.Init(Server::GetInstance().GetPersistentStorage()); - sRequestorCore.Init(Server::GetInstance(), sRequestorStorage, sRequestorUser, sDownloader); - sImageProcessor.SetOTADownloader(&sDownloader); - sDownloader.SetImageProcessorDelegate(&sImageProcessor); - sRequestorUser.Init(&sRequestorCore, &sImageProcessor); -} -#endif - -#ifdef AUTO_PRINT_METRICS -static void printMetrics(void) -{ - chip::DeviceLayer::ThreadMetrics *threadMetricsOut, *currThread; - uint64_t heapFree, heapUsed; - - DiagnosticDataProviderImpl::GetDefaultInstance().GetCurrentHeapUsed(heapUsed); - DiagnosticDataProviderImpl::GetDefaultInstance().GetCurrentHeapFree(heapFree); - DiagnosticDataProviderImpl::GetDefaultInstance().GetThreadMetrics(&threadMetricsOut); - - PLAT_LOG("Heap Metrics\n Heap Free: %d Heap Used: %d", (uint32_t) heapFree, (uint32_t) heapUsed); - - PLAT_LOG("Thread Metrics\n"); - - currThread = threadMetricsOut; - while (currThread) - { - PLAT_LOG("Task Name: %s ID: %d Stack Free Min: %d", currThread->name, (uint32_t) currThread->id, - (uint32_t) currThread->stackFreeMinimum); - - currThread = currThread->Next; - } - - DiagnosticDataProviderImpl::GetDefaultInstance().ReleaseThreadMetrics(threadMetricsOut); -} -#endif - -void DeviceEventCallback(const ChipDeviceEvent * event, intptr_t arg) -{ - switch (event->Type) - { - case DeviceEventType::kCHIPoBLEConnectionEstablished: - PLAT_LOG("CHIPoBLE connection established"); - break; - - case DeviceEventType::kCHIPoBLEConnectionClosed: - PLAT_LOG("CHIPoBLE disconnected"); - break; - - case DeviceEventType::kCommissioningComplete: - PLAT_LOG("Commissioning complete"); - break; - } - -#ifdef AUTO_PRINT_METRICS - printMetrics(); -#endif -} - -int AppTask::StartAppTask() -{ - int ret = 0; - - sAppEventQueue = xQueueCreate(APP_EVENT_QUEUE_SIZE, sizeof(AppEvent)); - if (sAppEventQueue == NULL) - { - PLAT_LOG("Failed to allocate app event queue"); - while (true) - ; - } - - // Start App task. - if (xTaskCreate(AppTaskMain, "APP", APP_TASK_STACK_SIZE / sizeof(StackType_t), NULL, APP_TASK_PRIORITY, &sAppTaskHandle) != - pdPASS) - { - PLAT_LOG("Failed to create app task"); - while (true) - ; - } - return ret; -} - -int AppTask::Init() -{ - LED_Params ledParams; - Button_Params buttonParams; - - cc13x2_26x2LogInit(); - - // Initialize LEDs - PLAT_LOG("Initialize LEDs"); - LED_init(); - - LED_Params_init(&ledParams); // default PWM LED - sAppRedHandle = LED_open(CONFIG_LED_RED, &ledParams); - LED_setOff(sAppRedHandle); - - LED_Params_init(&ledParams); // default PWM LED - sAppGreenHandle = LED_open(CONFIG_LED_GREEN, &ledParams); - LED_setOff(sAppGreenHandle); - - // Initialize buttons - PLAT_LOG("Initialize buttons"); - Button_init(); - - Button_Params_init(&buttonParams); - buttonParams.buttonEventMask = Button_EV_CLICKED | Button_EV_LONGCLICKED; - buttonParams.longPressDuration = 1000U; // ms - sAppLeftHandle = Button_open(CONFIG_BTN_LEFT, &buttonParams); - Button_setCallback(sAppLeftHandle, ButtonLeftEventHandler); - - Button_Params_init(&buttonParams); - buttonParams.buttonEventMask = Button_EV_CLICKED | Button_EV_LONGCLICKED; - buttonParams.longPressDuration = 1000U; // ms - sAppRightHandle = Button_open(CONFIG_BTN_RIGHT, &buttonParams); - Button_setCallback(sAppRightHandle, ButtonRightEventHandler); - - // Init Chip memory management before the stack - Platform::MemoryInit(); - - CHIP_ERROR ret = PlatformMgr().InitChipStack(); - if (ret != CHIP_NO_ERROR) - { - PLAT_LOG("PlatformMgr().InitChipStack() failed"); - while (true) - ; - } - - ret = ThreadStackMgr().InitThreadStack(); - if (ret != CHIP_NO_ERROR) - { - PLAT_LOG("ThreadStackMgr().InitThreadStack() failed"); - while (true) - ; - } - - ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_MinimalEndDevice); - if (ret != CHIP_NO_ERROR) - { - PLAT_LOG("ConnectivityMgr().SetThreadDeviceType() failed"); - while (true) - ; - } - - // Initialize device attestation config -#ifdef CC13X2_26X2_ATTESTATION_CREDENTIALS -#ifdef CC13XX_26XX_FACTORY_DATA - SetDeviceInstanceInfoProvider(&mFactoryDataProvider); - SetDeviceAttestationCredentialsProvider(&mFactoryDataProvider); - SetCommissionableDataProvider(&mFactoryDataProvider); -#else - SetDeviceAttestationCredentialsProvider(CC13X2_26X2::GetCC13X2_26X2DacProvider()); -#endif -#else - SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider()); -#endif - - ret = PlatformMgr().StartEventLoopTask(); - if (ret != CHIP_NO_ERROR) - { - PLAT_LOG("PlatformMgr().StartEventLoopTask() failed"); - while (true) - ; - } - - ret = ThreadStackMgrImpl().StartThreadTask(); - if (ret != CHIP_NO_ERROR) - { - PLAT_LOG("ThreadStackMgr().StartThreadTask() failed"); - while (true) - ; - } - - // Init ZCL Data Model and start server - PLAT_LOG("Initialize Server"); - static chip::CommonCaseDeviceServerInitParams initParams; - (void) initParams.InitializeStaticResourcesBeforeServerInit(); - - // Initialize info provider - sExampleDeviceInfoProvider.SetStorageDelegate(initParams.persistentStorageDelegate); - SetDeviceInfoProvider(&sExampleDeviceInfoProvider); - - chip::Server::GetInstance().Init(initParams); - - ConfigurationMgr().LogDeviceConfig(); - - // We only have network commissioning on endpoint 0. - emberAfEndpointEnableDisable(kNetworkCommissioningEndpointSecondary, false); - - // Register a function to receive events from the CHIP device layer. Note that calls to - // this function will happen on the CHIP event loop thread, not the app_main thread. - PlatformMgr().AddEventHandler(DeviceEventCallback, reinterpret_cast(nullptr)); - -#if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR - InitializeOTARequestor(); -#endif - // QR code will be used with CHIP Tool - PrintOnboardingCodes(RendezvousInformationFlags(RendezvousInformationFlag::kBLE)); - - app::Clusters::TemperatureControl::SetInstance(&sAppSupportedTemperatureLevelsDelegate); - return 0; -} - -void AppTask::AppTaskMain(void * pvParameter) -{ - AppEvent event; - - sAppTask.Init(); - - while (true) - { - /* Task pend until we have stuff to do */ - if (xQueueReceive(sAppEventQueue, &event, portMAX_DELAY) == pdTRUE) - { - sAppTask.DispatchEvent(&event); - } - } -} - -void AppTask::PostEvent(const AppEvent * aEvent) -{ - if (xQueueSend(sAppEventQueue, aEvent, 0) != pdPASS) - { - /* Failed to post the message */ - } -} - -void AppTask::ButtonLeftEventHandler(Button_Handle handle, Button_EventMask events) -{ - AppEvent event; - event.Type = AppEvent::kEventType_ButtonLeft; - - if (events & Button_EV_CLICKED) - { - event.ButtonEvent.Type = AppEvent::kAppEventButtonType_Clicked; - } - else if (events & Button_EV_LONGCLICKED) - { - event.ButtonEvent.Type = AppEvent::kAppEventButtonType_LongClicked; - } - // button callbacks are in ISR context - if (xQueueSendFromISR(sAppEventQueue, &event, NULL) != pdPASS) - { - /* Failed to post the message */ - } -} - -void AppTask::ButtonRightEventHandler(Button_Handle handle, Button_EventMask events) -{ - AppEvent event; - event.Type = AppEvent::kEventType_ButtonRight; - - if (events & Button_EV_CLICKED) - { - event.ButtonEvent.Type = AppEvent::kAppEventButtonType_Clicked; - } - else if (events & Button_EV_LONGCLICKED) - { - event.ButtonEvent.Type = AppEvent::kAppEventButtonType_LongClicked; - } - // button callbacks are in ISR context - if (xQueueSendFromISR(sAppEventQueue, &event, NULL) != pdPASS) - { - /* Failed to post the message */ - } -} - -void AppTask::DispatchEvent(AppEvent * aEvent) -{ - switch (aEvent->Type) - { - case AppEvent::kEventType_ButtonLeft: - if (AppEvent::kAppEventButtonType_Clicked == aEvent->ButtonEvent.Type) - { - } - else if (AppEvent::kAppEventButtonType_LongClicked == aEvent->ButtonEvent.Type) - { - chip::Server::GetInstance().ScheduleFactoryReset(); - } - break; - - case AppEvent::kEventType_ButtonRight: - if (AppEvent::kAppEventButtonType_Clicked == aEvent->ButtonEvent.Type) - { - } - else if (AppEvent::kAppEventButtonType_LongClicked == aEvent->ButtonEvent.Type) - { - // Enable BLE advertisements - if (!ConnectivityMgr().IsBLEAdvertisingEnabled()) - { - if (Server::GetInstance().GetCommissioningWindowManager().OpenBasicCommissioningWindow() == CHIP_NO_ERROR) - { - PLAT_LOG("Enabled BLE Advertisements"); - } - else - { - PLAT_LOG("OpenBasicCommissioningWindow() failed"); - } - } - else - { - // Disable BLE advertisements - ConnectivityMgr().SetBLEAdvertisingEnabled(false); - PLAT_LOG("Disabled BLE Advertisements"); - } - } - break; - - case AppEvent::kEventType_AppEvent: - if (NULL != aEvent->Handler) - { - aEvent->Handler(aEvent); - } - break; - - case AppEvent::kEventType_None: - default: - break; - } -} diff --git a/examples/all-clusters-app/cc13x2x7_26x2x7/main/ClusterManager.cpp b/examples/all-clusters-app/cc13x2x7_26x2x7/main/ClusterManager.cpp deleted file mode 100644 index df12e131ca069a..00000000000000 --- a/examples/all-clusters-app/cc13x2x7_26x2x7/main/ClusterManager.cpp +++ /dev/null @@ -1,180 +0,0 @@ - -/* - * - * Copyright (c) 2022 Project CHIP Authors - * All rights reserved. - * - * 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. - */ -#include "ClusterManager.h" -#include "Globals.h" -#include -#include -#include -#include -#include - -#ifdef AUTO_PRINT_METRICS -#include -#endif - -using namespace ::chip; -using namespace ::chip::app; -using namespace ::chip::Inet; -using namespace ::chip::System; -using namespace ::chip::DeviceLayer; - -constexpr uint32_t kIdentifyTimerDelayMS = 250; -constexpr uint32_t kIdentifyTimerDelayPerSec = 4; -ClusterManager ClusterManager::sCluster; - -#define ENDPOINT_ID_0 (0) -#define ENDPOINT_ID_1 (1) -#define ENDPOINT_ID_2 (2) - -void OnIdentifyTriggerEffect(Identify * identify) -{ - switch (identify->mCurrentEffectIdentifier) - { - case Clusters::Identify::EffectIdentifierEnum::kBlink: - PLAT_LOG("Clusters::Identify::EffectIdentifierEnum::kBlink"); - break; - case Clusters::Identify::EffectIdentifierEnum::kBreathe: - PLAT_LOG("Clusters::Identify::EffectIdentifierEnum::kBreathe"); - break; - case Clusters::Identify::EffectIdentifierEnum::kOkay: - PLAT_LOG("Clusters::Identify::EffectIdentifierEnum::kOkay"); - break; - case Clusters::Identify::EffectIdentifierEnum::kChannelChange: - PLAT_LOG("Clusters::Identify::EffectIdentifierEnum::kChannelChange"); - break; - default: - PLAT_LOG("No identifier effect"); - break; - } - return; -} - -Identify gIdentify0 = { - chip::EndpointId{ 0 }, - [](Identify *) { PLAT_LOG("onIdentifyStart"); }, - [](Identify *) { PLAT_LOG("onIdentifyStop"); }, - Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator, - OnIdentifyTriggerEffect, -}; - -Identify gIdentify1 = { - chip::EndpointId{ 1 }, - [](Identify *) { PLAT_LOG("onIdentifyStart"); }, - [](Identify *) { PLAT_LOG("onIdentifyStop"); }, - Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator, - OnIdentifyTriggerEffect, -}; - -void ClusterManager::OnOnOffPostAttributeChangeCallback(EndpointId endpointId, AttributeId attributeId, uint8_t * value) -{ - using namespace app::Clusters::OnOff::Attributes; - - VerifyOrExit(attributeId == OnOff::Id, PLAT_LOG("Unhandled Attribute ID: '0x%04x", attributeId)); - VerifyOrExit(endpointId == ENDPOINT_ID_1 || endpointId == ENDPOINT_ID_2, - PLAT_LOG("Unexpected EndPoint ID: `0x%02x'", endpointId)); - - // At this point we can assume that value points to a bool value. - mEndpointOnOffState[endpointId - 1] = *value; - endpointId == ENDPOINT_ID_1 ? LED_write(sAppGreenHandle, *value) : LED_write(sAppRedHandle, *value); - -exit: - return; -} - -void ClusterManager::OnLevelControlAttributeChangeCallback(EndpointId endpointId, AttributeId attributeId, uint8_t * value) -{ - using namespace app::Clusters::LevelControl::Attributes; - - bool onOffState = mEndpointOnOffState[endpointId - 1]; - uint8_t brightness = onOffState ? *value : 0; - - VerifyOrExit(brightness > 0, PLAT_LOG("Brightness set to 0, ignoring")); - VerifyOrExit(attributeId == CurrentLevel::Id, PLAT_LOG("Unhandled Attribute ID: '0x%04x", attributeId)); - VerifyOrExit(endpointId == ENDPOINT_ID_1 || endpointId == ENDPOINT_ID_2, - PLAT_LOG("Unexpected EndPoint ID: `0x%02x'", endpointId)); - - if (brightness > LED_BRIGHTNESS_MAX) - { - brightness = LED_BRIGHTNESS_MAX; - } - - endpointId == ENDPOINT_ID_1 ? LED_setOn(sAppGreenHandle, brightness) : LED_setOn(sAppRedHandle, brightness); - -exit: - return; -} - -void ClusterManager::OnColorControlAttributeChangeCallback(EndpointId endpointId, AttributeId attributeId, uint8_t * value) -{ - using namespace app::Clusters::ColorControl::Attributes; - - VerifyOrExit(attributeId == CurrentHue::Id || attributeId == CurrentSaturation::Id, - PLAT_LOG("Unhandled AttributeId ID: '0x%04x", attributeId)); - VerifyOrExit(endpointId == ENDPOINT_ID_1 || endpointId == ENDPOINT_ID_2, - PLAT_LOG("Unexpected EndPoint ID: `0x%02x'", endpointId)); - - if (endpointId == ENDPOINT_ID_1) - { - uint8_t hue, saturation; - if (attributeId == CurrentHue::Id) - { - hue = *value; - /* Read Current Saturation value when Attribute change callback for HUE Attribute */ - CurrentSaturation::Get(endpointId, &saturation); - } - else - { - saturation = *value; - /* Read Current Hue value when Attribute change callback for SATURATION Attribute */ - CurrentHue::Get(endpointId, &hue); - } - PLAT_LOG("Color Control triggered: Hue: %d Saturation: %d", hue, saturation); - } -exit: - return; -} - -void ClusterManager::OnIdentifyPostAttributeChangeCallback(EndpointId endpointId, AttributeId attributeId, uint16_t size, - uint8_t * value) -{ - if (attributeId == app::Clusters::Identify::Attributes::IdentifyTime::Id && size == 2) - { - uint16_t identifyTime; - memcpy(&identifyTime, value, size); - if (identifyTime) - { - // Currently we have no separate indicator LEDs on each endpoints. - // We are using LED1 for endpoint 0,1 and LED2 for endpoint 2 - if (endpointId == ENDPOINT_ID_2) - { - LED_startBlinking(sAppGreenHandle, kIdentifyTimerDelayMS, identifyTime * kIdentifyTimerDelayPerSec); - } - else - { - LED_startBlinking(sAppRedHandle, kIdentifyTimerDelayMS, identifyTime * kIdentifyTimerDelayPerSec); - } - } - else - { - bool onOffState; - endpointId == ENDPOINT_ID_0 ? onOffState = mEndpointOnOffState[0] : onOffState = mEndpointOnOffState[endpointId - 1]; - endpointId == ENDPOINT_ID_2 ? LED_write(sAppRedHandle, onOffState) : LED_write(sAppGreenHandle, onOffState); - } - } -} diff --git a/examples/all-clusters-app/cc13x2x7_26x2x7/main/Globals.cpp b/examples/all-clusters-app/cc13x2x7_26x2x7/main/Globals.cpp deleted file mode 100644 index 01a945e1a33d12..00000000000000 --- a/examples/all-clusters-app/cc13x2x7_26x2x7/main/Globals.cpp +++ /dev/null @@ -1,22 +0,0 @@ -/* - * - * Copyright (c) 2022 Project CHIP Authors - * All rights reserved. - * - * 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. - */ - -#include "Globals.h" - -LED_Handle sAppRedHandle; -LED_Handle sAppGreenHandle; diff --git a/examples/all-clusters-app/cc13x2x7_26x2x7/main/ZclCallbacks.cpp b/examples/all-clusters-app/cc13x2x7_26x2x7/main/ZclCallbacks.cpp deleted file mode 100644 index ba3f7bd1c205f8..00000000000000 --- a/examples/all-clusters-app/cc13x2x7_26x2x7/main/ZclCallbacks.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * - * Copyright (c) 2021 Project CHIP Authors - * Copyright 2021, Cypress Semiconductor Corporation (an Infineon company) - * - * 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. - */ - -/** - * @file - * This file implements the handler for data model messages. - */ - -#include "AppConfig.h" -#include "Globals.h" -#include - -#include "ClusterManager.h" - -#include -#include -#include -#include -#include -#include - -using namespace ::chip; -using namespace ::chip::app::Clusters; - -void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & attributePath, uint8_t type, uint16_t size, - uint8_t * value) -{ - EndpointId endpoint = attributePath.mEndpointId; - ClusterId clusterId = attributePath.mClusterId; - AttributeId attributeId = attributePath.mAttributeId; - PLAT_LOG("MatterPostAttributeChangeCallback - Cluster ID: " ChipLogFormatMEI - ", EndPoint ID: '0x%02x', Attribute ID: " ChipLogFormatMEI, - ChipLogValueMEI(clusterId), endpoint, ChipLogValueMEI(attributeId)); - - switch (clusterId) - { - case OnOff::Id: - ClusterMgr().OnOnOffPostAttributeChangeCallback(endpoint, attributeId, value); - break; - - case Identify::Id: - ClusterMgr().OnIdentifyPostAttributeChangeCallback(endpoint, attributeId, size, value); - break; - - case LevelControl::Id: - ClusterMgr().OnLevelControlAttributeChangeCallback(endpoint, attributeId, value); - break; - - case ColorControl::Id: - ClusterMgr().OnColorControlAttributeChangeCallback(endpoint, attributeId, value); - break; - default: - PLAT_LOG("Unhandled cluster ID: " ChipLogFormatMEI, ChipLogValueMEI(clusterId)); - break; - } -} -/** @brief OnOff Cluster Init - * - * This function is called when a specific cluster is initialized. It gives the - * application an opportunity to take care of cluster initialization procedures. - * It is called exactly once for each endpoint where cluster is present. - * - * @param endpoint Ver.: always - */ -void emberAfOnOffClusterInitCallback(EndpointId endpoint) -{ - // TODO: implement any additional Cluster Server init actions -} diff --git a/examples/all-clusters-app/cc13x2x7_26x2x7/main/include/AppConfig.h b/examples/all-clusters-app/cc13x2x7_26x2x7/main/include/AppConfig.h deleted file mode 100644 index f7302b6efd10cd..00000000000000 --- a/examples/all-clusters-app/cc13x2x7_26x2x7/main/include/AppConfig.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (c) 2020 Project CHIP Authors - * Copyright (c) 2019 Google LLC. - * All rights reserved. - * - * 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. - */ - -#ifndef APP_CONFIG_H -#define APP_CONFIG_H - -#endif // APP_CONFIG_H diff --git a/examples/all-clusters-app/cc13x2x7_26x2x7/main/include/AppEvent.h b/examples/all-clusters-app/cc13x2x7_26x2x7/main/include/AppEvent.h deleted file mode 100644 index ad9e93ee3ad1a5..00000000000000 --- a/examples/all-clusters-app/cc13x2x7_26x2x7/main/include/AppEvent.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * - * Copyright (c) 2018 Nest Labs, Inc. - * All rights reserved. - * - * 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. - */ - -#ifndef APP_EVENT_H -#define APP_EVENT_H - -struct AppEvent; -typedef void (*EventHandler)(AppEvent *); - -struct AppEvent -{ - enum AppEventType - { - kEventType_None = 0, - kEventType_ButtonLeft, - kEventType_ButtonRight, - kEventType_AppEvent, - }; - - enum AppEventButtonType - { - kAppEventButtonType_None = 0, - kAppEventButtonType_Clicked, - kAppEventButtonType_LongClicked, - }; - - enum AppEventType Type; - - union - { - struct - { - enum AppEventButtonType Type; - } ButtonEvent; - - struct - { - void * Context; - } BoltLockEvent; - }; - - EventHandler Handler; -}; - -#endif // APP_EVENT_H diff --git a/examples/all-clusters-app/cc13x2x7_26x2x7/main/include/AppTask.h b/examples/all-clusters-app/cc13x2x7_26x2x7/main/include/AppTask.h deleted file mode 100644 index 6ab8ca425ddbdf..00000000000000 --- a/examples/all-clusters-app/cc13x2x7_26x2x7/main/include/AppTask.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2020 Project CHIP Authors - * Copyright (c) 2019 Google LLC. - * All rights reserved. - * - * 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. - */ - -#ifndef APP_TASK_H -#define APP_TASK_H - -#include -#include - -#include "FreeRTOS.h" -#include "semphr.h" -#include "task.h" - -#include "AppEvent.h" - -#include - -#ifdef CC13XX_26XX_FACTORY_DATA -#include -#endif - -class AppTask -{ -public: - int StartAppTask(); - static void AppTaskMain(void * pvParameter); - - void PostEvent(const AppEvent * event); - -private: - friend AppTask & GetAppTask(void); - - int Init(); - - void DispatchEvent(AppEvent * event); - - static void ButtonLeftEventHandler(Button_Handle handle, Button_EventMask events); - static void ButtonRightEventHandler(Button_Handle handle, Button_EventMask events); - static void TimerEventHandler(void * p_context); - - enum Function_t - { - kFunction_NoneSelected = 0, - kFunction_SoftwareUpdate = 0, - kFunction_FactoryReset, - - kFunction_Invalid - } Function; - - Function_t mFunction; - bool mFunctionTimerActive; - - static AppTask sAppTask; - -#ifdef CC13XX_26XX_FACTORY_DATA - chip::DeviceLayer::FactoryDataProvider mFactoryDataProvider; -#endif -}; - -inline AppTask & GetAppTask(void) -{ - return AppTask::sAppTask; -} - -#endif // APP_TASK_H diff --git a/examples/all-clusters-app/cc13x2x7_26x2x7/main/include/CHIPProjectConfig.h b/examples/all-clusters-app/cc13x2x7_26x2x7/main/include/CHIPProjectConfig.h deleted file mode 100644 index 97357823332342..00000000000000 --- a/examples/all-clusters-app/cc13x2x7_26x2x7/main/include/CHIPProjectConfig.h +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright (c) 2020 Project CHIP Authors - * Copyright (c) 2019 Google LLC. - * All rights reserved. - * - * 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. - */ - -/** - * @file - * Example project configuration file for CHIP. - * - * This is a place to put application or project-specific overrides - * to the default configuration values for general CHIP features. - * - */ - -#ifndef CHIP_PROJECT_CONFIG_H -#define CHIP_PROJECT_CONFIG_H - -#if BUILD_RELEASE // release build -// Note: Default Pairing/PIN/Serial Numbers being used. These should not be enabled for production builds -#endif // BUILD_RELEASE - -// Use a default pairing code if one hasn't been provisioned in flash. -#define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE 20202021 -#define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR 0xF00 - -/** - * CHIP_DEVICE_CONFIG_TEST_SERIAL_NUMBER - * - * Enables the use of a hard-coded default serial number if none - * is found in CHIP NV storage. - */ -#define CHIP_DEVICE_CONFIG_TEST_SERIAL_NUMBER "TEST_SN" - -/** - * CHIP_DEVICE_CONFIG_DEVICE_HARDWARE_VERSION - * - * The hardware version number assigned to device or product by the device vendor. This - * number is scoped to the device product id, and typically corresponds to a revision of the - * physical device, a change to its packaging, and/or a change to its marketing presentation. - * This value is generally *not* incremented for device software versions. - */ -#define CHIP_DEVICE_CONFIG_DEVICE_HARDWARE_VERSION 1 - -/** - * Values set by args.gni: - * CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID - * CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID - * CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING - * CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION - */ - -/** - * CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE - * - * Enable support for CHIP-over-BLE (CHIPOBLE). - */ -#define CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE 1 - -/** - * CHIP_DEVICE_CONFIG_EVENT_LOGGING_DEBUG_BUFFER_SIZE - * - * A size, in bytes, of the individual debug event logging buffer. - */ -#define CHIP_DEVICE_CONFIG_EVENT_LOGGING_DEBUG_BUFFER_SIZE (512) - -#define MATTER_CC13X2_26X2_PLATFORM_LOG_ENABLED 1 - -/** - * CHIP_DEVICE_CONFIG_ENABLE_THREAD_SRP_CLIENT - * - * Enable the OpenThread SRP client to allow for CHIP device discovery. - */ -#define CHIP_DEVICE_CONFIG_ENABLE_THREAD_SRP_CLIENT 1 - -/** - * CHIP_CONFIG_EVENT_LOGGING_DEFAULT_IMPORTANCE - * - * For a development build, set the default importance of events to be logged as Debug. - * Since debug is the lowest importance level, this means all standard, critical, info and - * debug importance level vi events get logged. - */ -#if BUILD_RELEASE -#define CHIP_CONFIG_EVENT_LOGGING_DEFAULT_IMPORTANCE chip::Profiles::DataManagement::Production -#else -#define CHIP_CONFIG_EVENT_LOGGING_DEFAULT_IMPORTANCE chip::Profiles::DataManagement::Debug -#endif // BUILD_RELEASE - -#define CHIP_DEVICE_CONFIG_ENABLE_EXTENDED_DISCOVERY 1 - -/** - * @def CHIP_IM_MAX_NUM_COMMAND_HANDLER - * - * @brief Defines the maximum number of CommandHandler, limits the number of active commands transactions on server. - */ -#define CHIP_IM_MAX_NUM_COMMAND_HANDLER 1 - -/** - * @def CHIP_IM_MAX_NUM_WRITE_HANDLER - * - * @brief Defines the maximum number of WriteHandler, limits the number of active write transactions on server. - */ -#define CHIP_IM_MAX_NUM_WRITE_HANDLER 1 - -// All clusters app has 3 group endpoints. This needs to defined here so that -// CHIP_CONFIG_MAX_GROUPS_PER_FABRIC is properly configured. -#define CHIP_CONFIG_MAX_GROUP_ENDPOINTS_PER_FABRIC 3 - -#endif // CHIP_PROJECT_CONFIG_H diff --git a/examples/all-clusters-app/cc13x2x7_26x2x7/main/include/ClusterManager.h b/examples/all-clusters-app/cc13x2x7_26x2x7/main/include/ClusterManager.h deleted file mode 100644 index 1599ef1ef19264..00000000000000 --- a/examples/all-clusters-app/cc13x2x7_26x2x7/main/include/ClusterManager.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * - * Copyright (c) 2021 Project CHIP Authors - * Copyright 2021, Cypress Semiconductor Corporation (an Infineon company) - * All rights reserved. - * - * 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. - */ - -/** - * @file ClusterManager.h - * - * Declarations for the ClusterManager callbacks for this application - * - **/ - -#pragma once - -#include -#include -#include - -class ClusterManager -{ -public: - void OnOnOffPostAttributeChangeCallback(chip::EndpointId endpointId, chip::AttributeId attributeId, uint8_t * value); - void OnLevelControlAttributeChangeCallback(chip::EndpointId endpointId, chip::AttributeId attributeId, uint8_t * value); - void OnColorControlAttributeChangeCallback(chip::EndpointId endpointId, chip::AttributeId attributeId, uint8_t * value); - void OnIdentifyPostAttributeChangeCallback(chip::EndpointId endpointId, chip::AttributeId attributeId, uint16_t size, - uint8_t * value); - -private: - friend ClusterManager & ClusterMgr(void); - bool mEndpointOnOffState[2]; - static ClusterManager sCluster; -}; - -inline ClusterManager & ClusterMgr(void) -{ - return ClusterManager::sCluster; -} diff --git a/examples/all-clusters-app/cc13x2x7_26x2x7/main/include/Globals.h b/examples/all-clusters-app/cc13x2x7_26x2x7/main/include/Globals.h deleted file mode 100644 index 43f9362e0341b9..00000000000000 --- a/examples/all-clusters-app/cc13x2x7_26x2x7/main/include/Globals.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * - * Copyright (c) 2020 Project CHIP Authors - * All rights reserved. - * - * 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. - */ - -#pragma once - -#include -// Logging -#ifdef __cplusplus -extern "C" { -#endif - -int cc13x2_26x2LogInit(void); -void cc13x2_26x2Log(const char * aFormat, ...); -#define PLAT_LOG(...) cc13x2_26x2Log(__VA_ARGS__); - -#ifdef __cplusplus -} -#endif -extern LED_Handle sAppRedHandle; -extern LED_Handle sAppGreenHandle; diff --git a/examples/all-clusters-app/cc13x2x7_26x2x7/main/include/OpenThreadConfig.h b/examples/all-clusters-app/cc13x2x7_26x2x7/main/include/OpenThreadConfig.h deleted file mode 100644 index 30f5633cc3bc7f..00000000000000 --- a/examples/all-clusters-app/cc13x2x7_26x2x7/main/include/OpenThreadConfig.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * - * Copyright (c) 2020 Project CHIP Authors - * Copyright (c) 2019 Google LLC. - * All rights reserved. - * - * 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. - */ - -/** - * @file - * Overrides to default OpenThread configuration. - * - */ - -#pragma once - -// Use the TI-supplied default platform configuration for remainder -#include "openthread-core-cc13x2_26x2-config.h" diff --git a/examples/all-clusters-app/cc13x2x7_26x2x7/main/main.cpp b/examples/all-clusters-app/cc13x2x7_26x2x7/main/main.cpp deleted file mode 100644 index 8311c8990aa5c6..00000000000000 --- a/examples/all-clusters-app/cc13x2x7_26x2x7/main/main.cpp +++ /dev/null @@ -1,97 +0,0 @@ -/* - * - * Copyright (c) 2020 Project CHIP Authors - * Copyright (c) 2020 Texas Instruments Incorporated - * - * 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. - */ - -#include -#include - -#include - -#include -#include - -#include - -/* Driver Header files */ -#include -#include -#include -#include - -#include -#include -#include -#include - -#include -#define TOTAL_ICALL_HEAP_SIZE (0xc800) - -using namespace ::chip; -using namespace ::chip::Inet; -using namespace ::chip::DeviceLayer; - -__attribute__((section(".heap"))) uint8_t GlobalHeapZoneBuffer[TOTAL_ICALL_HEAP_SIZE]; -uint32_t heapSize = TOTAL_ICALL_HEAP_SIZE; - -// ================================================================================ -// FreeRTOS Callbacks -// ================================================================================ -extern "C" void vApplicationStackOverflowHook(void) -{ - while (true) - { - ; - } -} - -// ================================================================================ -// Main Code -// ================================================================================ -int main(void) -{ - Board_init(); - bpool((void *) GlobalHeapZoneBuffer, TOTAL_ICALL_HEAP_SIZE); - - GPIO_init(); - - NVS_init(); - - UART_init(); - - ECDH_init(); - - ECDSA_init(); - - AESECB_init(); - - SHA2_init(); - - int ret = GetAppTask().StartAppTask(); - if (ret != 0) - { - // can't log until the kernel is started - // PLAT_LOG("GetAppTask().StartAppTask() failed"); - while (true) - ; - } - - vTaskStartScheduler(); - - // Should never get here. - while (true) - ; -} diff --git a/examples/all-clusters-app/cc13x2x7_26x2x7/third_party/connectedhomeip b/examples/all-clusters-app/cc13x2x7_26x2x7/third_party/connectedhomeip deleted file mode 120000 index c866b86874994d..00000000000000 --- a/examples/all-clusters-app/cc13x2x7_26x2x7/third_party/connectedhomeip +++ /dev/null @@ -1 +0,0 @@ -../../../.. \ No newline at end of file diff --git a/examples/all-clusters-app/cc13x4_26x4/README.md b/examples/all-clusters-app/cc13x4_26x4/README.md index 513bf01de715d4..4cb76380ce2df4 100644 --- a/examples/all-clusters-app/cc13x4_26x4/README.md +++ b/examples/all-clusters-app/cc13x4_26x4/README.md @@ -93,8 +93,6 @@ Ninja to build the executable. step. ``` - $ cd ~/connectedhomeip/examples/all-clusters-app/cc13x2x7_26x2x7 - OR $ cd ~/connectedhomeip/examples/all-clusters-minimal-app/cc13x4_26x4 $ gn gen out/debug --args="ti_sysconfig_root=\"$HOME/ti/sysconfig_1.18.1\"" $ ninja -C out/debug diff --git a/examples/all-clusters-app/cc13x4_26x4/main/AppTask.cpp b/examples/all-clusters-app/cc13x4_26x4/main/AppTask.cpp index 6df3ff32d1862b..3e338474833eab 100644 --- a/examples/all-clusters-app/cc13x4_26x4/main/AppTask.cpp +++ b/examples/all-clusters-app/cc13x4_26x4/main/AppTask.cpp @@ -20,10 +20,10 @@ #include "AppConfig.h" #include "AppEvent.h" #include -#include #include "FreeRTOS.h" #include "Globals.h" +#include #include #include @@ -40,8 +40,8 @@ #include #include -#ifdef AUTO_PRINT_METRICS -#include +#if AUTO_PRINT_METRICS +// #include #endif #include diff --git a/examples/all-clusters-app/cc13x4_26x4/main/ZclCallbacks.cpp b/examples/all-clusters-app/cc13x4_26x4/main/ZclCallbacks.cpp index 09505504315cad..b21e2ad4c1b9f0 100644 --- a/examples/all-clusters-app/cc13x4_26x4/main/ZclCallbacks.cpp +++ b/examples/all-clusters-app/cc13x4_26x4/main/ZclCallbacks.cpp @@ -30,7 +30,6 @@ #include #include #include -#include #include using namespace ::chip; diff --git a/examples/all-clusters-app/esp32/main/DeviceWithDisplay.cpp b/examples/all-clusters-app/esp32/main/DeviceWithDisplay.cpp index 0668411a9bfbd3..6f35995a445110 100644 --- a/examples/all-clusters-app/esp32/main/DeviceWithDisplay.cpp +++ b/examples/all-clusters-app/esp32/main/DeviceWithDisplay.cpp @@ -22,6 +22,10 @@ #include #include +#include +#include +#include + #if CONFIG_HAVE_DISPLAY using namespace ::chip; using namespace ::chip::Credentials; diff --git a/examples/all-clusters-app/esp32/main/Kconfig.projbuild b/examples/all-clusters-app/esp32/main/Kconfig.projbuild index e1d8805e689326..2cec0c32093734 100644 --- a/examples/all-clusters-app/esp32/main/Kconfig.projbuild +++ b/examples/all-clusters-app/esp32/main/Kconfig.projbuild @@ -59,10 +59,6 @@ menu "Demo" depends on IDF_TARGET_ESP32H2 endchoice - config CHIP_PROJECT_CONFIG - string "CHIP Project Configuration file" - default "main/include/CHIPProjectConfig.h" - choice prompt "Rendezvous Mode" default RENDEZVOUS_MODE_BLE if BT_ENABLED diff --git a/examples/all-clusters-app/esp32/main/QRCodeScreen.cpp b/examples/all-clusters-app/esp32/main/QRCodeScreen.cpp index 578f44003f435e..ac39b9498e9f21 100644 --- a/examples/all-clusters-app/esp32/main/QRCodeScreen.cpp +++ b/examples/all-clusters-app/esp32/main/QRCodeScreen.cpp @@ -42,6 +42,8 @@ #include #include +#include + // TODO need sensible library tag when put in library extern const char TAG[]; diff --git a/examples/all-clusters-app/esp32/main/StatusScreen.cpp b/examples/all-clusters-app/esp32/main/StatusScreen.cpp index 55f42a32723823..0013bda66c5c70 100644 --- a/examples/all-clusters-app/esp32/main/StatusScreen.cpp +++ b/examples/all-clusters-app/esp32/main/StatusScreen.cpp @@ -45,6 +45,8 @@ #include #include +#include + #define MAX_LENGTH_SMALL_FONT 30 using namespace chip; diff --git a/examples/all-clusters-app/esp32/main/include/CHIPProjectConfig.h b/examples/all-clusters-app/esp32/main/include/CHIPProjectConfig.h deleted file mode 100644 index 9fff1bd10e67b4..00000000000000 --- a/examples/all-clusters-app/esp32/main/include/CHIPProjectConfig.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * - * Copyright (c) 2023 Project CHIP Authors - * All rights reserved. - * - * 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. - */ - -/** - * @file - * Example project configuration file for CHIP. - * - * This is a place to put application or project-specific overrides - * to the default configuration values for general CHIP features. - * - */ - -#pragma once - -/** - * @def CONFIG_BUILD_FOR_HOST_UNIT_TEST - * - * @brief Defines whether we're currently building for unit testing, which enables a set of features - * that are only utilized in those tests. This flag should not be enabled on devices. If you have a test - * that uses this flag, either appropriately conditionalize the entire test on this flag, or to exclude - * the compliation of that test source file entirely. - */ -#define CONFIG_BUILD_FOR_HOST_UNIT_TEST 1 diff --git a/examples/all-clusters-app/esp32/main/include/QRCodeScreen.h b/examples/all-clusters-app/esp32/main/include/QRCodeScreen.h index ced5be2ac3a670..9599280b7fd3b0 100644 --- a/examples/all-clusters-app/esp32/main/include/QRCodeScreen.h +++ b/examples/all-clusters-app/esp32/main/include/QRCodeScreen.h @@ -31,6 +31,7 @@ #include "ScreenManager.h" #include +#include #include class QRCodeScreen : public Screen diff --git a/examples/all-clusters-app/esp32/main/main.cpp b/examples/all-clusters-app/esp32/main/main.cpp index a3af54f3a22e06..af94d2b2d36afe 100644 --- a/examples/all-clusters-app/esp32/main/main.cpp +++ b/examples/all-clusters-app/esp32/main/main.cpp @@ -34,7 +34,7 @@ #include "platform/PlatformManager.h" #include "shell_extension/launch.h" #include -#include +#include #include #include #include diff --git a/examples/all-clusters-app/infineon/psoc6/src/AppTask.cpp b/examples/all-clusters-app/infineon/psoc6/src/AppTask.cpp index b75b5abfc74294..0d0ba0f5b25663 100644 --- a/examples/all-clusters-app/infineon/psoc6/src/AppTask.cpp +++ b/examples/all-clusters-app/infineon/psoc6/src/AppTask.cpp @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include diff --git a/examples/all-clusters-app/linux/AllClustersCommandDelegate.cpp b/examples/all-clusters-app/linux/AllClustersCommandDelegate.cpp index d1bab3649f0b67..8effe6426cc49d 100644 --- a/examples/all-clusters-app/linux/AllClustersCommandDelegate.cpp +++ b/examples/all-clusters-app/linux/AllClustersCommandDelegate.cpp @@ -25,6 +25,7 @@ #include #include #include +#include #include #include @@ -35,6 +36,8 @@ #include #include +#include + using namespace chip; using namespace chip::app; using namespace chip::app::Clusters; diff --git a/examples/all-clusters-app/linux/AllClustersCommandDelegate.h b/examples/all-clusters-app/linux/AllClustersCommandDelegate.h index 4022b06e9f8565..f097c539b54fb6 100644 --- a/examples/all-clusters-app/linux/AllClustersCommandDelegate.h +++ b/examples/all-clusters-app/linux/AllClustersCommandDelegate.h @@ -23,6 +23,8 @@ #include #include +#include + class AllClustersAppCommandHandler { public: diff --git a/examples/all-clusters-app/linux/AppOptions.cpp b/examples/all-clusters-app/linux/AppOptions.cpp index 50be6561c6bb4a..bd5147102715eb 100644 --- a/examples/all-clusters-app/linux/AppOptions.cpp +++ b/examples/all-clusters-app/linux/AppOptions.cpp @@ -21,6 +21,8 @@ #include #include +#include + using namespace chip::ArgParser; using chip::ArgParser::OptionDef; diff --git a/examples/all-clusters-app/linux/AppOptions.h b/examples/all-clusters-app/linux/AppOptions.h index dfdd2c0e66fe70..69c1af83b72909 100644 --- a/examples/all-clusters-app/linux/AppOptions.h +++ b/examples/all-clusters-app/linux/AppOptions.h @@ -22,6 +22,8 @@ #include +#include + class AppOptions { public: diff --git a/examples/all-clusters-app/linux/diagnostic-logs-provider-delegate-impl.cpp b/examples/all-clusters-app/linux/diagnostic-logs-provider-delegate-impl.cpp index 4dc94da1338c28..afb75a7ef666c4 100644 --- a/examples/all-clusters-app/linux/diagnostic-logs-provider-delegate-impl.cpp +++ b/examples/all-clusters-app/linux/diagnostic-logs-provider-delegate-impl.cpp @@ -20,6 +20,8 @@ #include +#include + using namespace chip; using namespace chip::app::Clusters::DiagnosticLogs; diff --git a/examples/all-clusters-app/linux/include/diagnostic-logs-provider-delegate-impl.h b/examples/all-clusters-app/linux/include/diagnostic-logs-provider-delegate-impl.h index c0e69f1c5bde0b..f90c8d600f4526 100644 --- a/examples/all-clusters-app/linux/include/diagnostic-logs-provider-delegate-impl.h +++ b/examples/all-clusters-app/linux/include/diagnostic-logs-provider-delegate-impl.h @@ -22,6 +22,7 @@ #include #include +#include namespace chip { namespace app { diff --git a/examples/all-clusters-app/linux/main-common.cpp b/examples/all-clusters-app/linux/main-common.cpp index 8760bcb92d456c..73af031ecbdb5d 100644 --- a/examples/all-clusters-app/linux/main-common.cpp +++ b/examples/all-clusters-app/linux/main-common.cpp @@ -48,7 +48,6 @@ #include #include #include -#include #include #include #include @@ -61,6 +60,8 @@ #include #include +#include + using namespace chip; using namespace chip::app; using namespace chip::DeviceLayer; diff --git a/examples/all-clusters-app/nrfconnect/main/AppTask.cpp b/examples/all-clusters-app/nrfconnect/main/AppTask.cpp index efdee7153b493c..3551087a969411 100644 --- a/examples/all-clusters-app/nrfconnect/main/AppTask.cpp +++ b/examples/all-clusters-app/nrfconnect/main/AppTask.cpp @@ -31,6 +31,7 @@ #include #include #include +#include #include #include diff --git a/examples/all-clusters-app/nxp/common/main/AppTask.cpp b/examples/all-clusters-app/nxp/common/main/AppTask.cpp index 7f4c1f257d0405..0b945d49561e43 100644 --- a/examples/all-clusters-app/nxp/common/main/AppTask.cpp +++ b/examples/all-clusters-app/nxp/common/main/AppTask.cpp @@ -23,6 +23,7 @@ #include "ICDUtil.h" #include #include +#include using namespace chip; using namespace chip::app::Clusters; diff --git a/examples/all-clusters-app/nxp/common/main/ZclCallbacks.cpp b/examples/all-clusters-app/nxp/common/main/ZclCallbacks.cpp index 86ea10f4687558..d4be6f1eb89a8c 100644 --- a/examples/all-clusters-app/nxp/common/main/ZclCallbacks.cpp +++ b/examples/all-clusters-app/nxp/common/main/ZclCallbacks.cpp @@ -25,7 +25,6 @@ #include #include #include -#include using namespace ::chip; diff --git a/examples/all-clusters-app/telink/CMakeLists.txt b/examples/all-clusters-app/telink/CMakeLists.txt index 2c59e658a7e6dc..d5f2132c9d2747 100644 --- a/examples/all-clusters-app/telink/CMakeLists.txt +++ b/examples/all-clusters-app/telink/CMakeLists.txt @@ -1,5 +1,5 @@ # -# Copyright (c) 2022 Project CHIP Authors +# Copyright (c) 2022-2024 Project CHIP Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # + cmake_minimum_required(VERSION 3.13.1) get_filename_component(CHIP_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/third_party/connectedhomeip REALPATH) @@ -21,47 +22,11 @@ get_filename_component(GEN_DIR ${CHIP_ROOT}/zzz_generated/ REALPATH) get_filename_component(ALL_CLUSTERS_COMMON_DIR ${CHIP_ROOT}/examples/all-clusters-app/all-clusters-common REALPATH) get_filename_component(ENERGY_MANAGEMENT_COMMON_DIR ${CHIP_ROOT}/examples/energy-management-app/energy-management-common/ REALPATH) -if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/boards/${BOARD}.overlay") - set(LOCAL_DTC_OVERLAY_FILE "${CMAKE_CURRENT_SOURCE_DIR}/boards/${BOARD}.overlay") -else() - unset(LOCAL_DTC_OVERLAY_FILE) -endif() - -if(EXISTS "${CHIP_ROOT}/src/platform/telink/${BOARD}.overlay") - set(GLOBAL_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/${BOARD}.overlay") -else() - unset(GLOBAL_DTC_OVERLAY_FILE) -endif() - -if(EXISTS "${CHIP_ROOT}/src/platform/telink/${FLASH_SIZE}_flash.overlay") - set(FLASH_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/${FLASH_SIZE}_flash.overlay") - message(STATUS "Flash memory size is set to: " ${FLASH_SIZE} "b") -else() - set(FLASH_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/2m_flash.overlay") - message(STATUS "Flash memory size is set to: 2mb") -endif() - -if(DTC_OVERLAY_FILE) - set(DTC_OVERLAY_FILE - "${DTC_OVERLAY_FILE} ${GLOBAL_DTC_OVERLAY_FILE} ${FLASH_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}" - CACHE STRING "" FORCE - ) -else() - set(DTC_OVERLAY_FILE ${GLOBAL_DTC_OVERLAY_FILE} ${FLASH_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}) -endif() - -set(CONF_FILE prj.conf) - -# Load NCS/Zephyr build system -list(APPEND ZEPHYR_EXTRA_MODULES ${CHIP_ROOT}/config/telink/chip-module) -find_package(Zephyr HINTS $ENV{ZEPHYR_BASE}) - -project(chip-telink-all-clusters-app-example) - +include(${TELINK_COMMON}/common.cmake) include(${CHIP_ROOT}/config/telink/app/enable-gnu-std.cmake) include(${CHIP_ROOT}/src/app/chip_data_model.cmake) -target_compile_options(app PRIVATE -fpermissive) +project(chip-telink-all-clusters-app-example) target_include_directories(app PRIVATE include @@ -70,7 +35,8 @@ target_include_directories(app PRIVATE ${GEN_DIR}/app-common ${GEN_DIR}/all-clusters-app ${TELINK_COMMON}/common/include - ${TELINK_COMMON}/util/include) + ${TELINK_COMMON}/util/include + ${TELINK_COMMON}/zephyr_ext) target_sources(app PRIVATE src/AppTask.cpp @@ -92,10 +58,15 @@ target_sources(app PRIVATE ${ENERGY_MANAGEMENT_COMMON_DIR}/src/DeviceEnergyManagementManager.cpp ${TELINK_COMMON}/common/src/mainCommon.cpp ${TELINK_COMMON}/common/src/AppTaskCommon.cpp - ${TELINK_COMMON}/util/src/LEDWidget.cpp + ${TELINK_COMMON}/util/src/LEDManager.cpp ${TELINK_COMMON}/util/src/ButtonManager.cpp ${TELINK_COMMON}/util/src/ThreadUtil.cpp - ${TELINK_COMMON}/util/src/PWMDevice.cpp) + ${TELINK_COMMON}/util/src/PWMManager.cpp + ${TELINK_COMMON}/zephyr_ext/zephyr_key_matrix.c + ${TELINK_COMMON}/zephyr_ext/zephyr_key_pool.c + ${TELINK_COMMON}/zephyr_ext/zephyr_led_pool.c + ${TELINK_COMMON}/zephyr_ext/zephyr_pwm_pool.c + ${TELINK_COMMON}/zephyr_ext/zephyr_ws2812.c) chip_configure_data_model(app INCLUDE_SERVER diff --git a/examples/all-clusters-app/telink/include/AppConfig.h b/examples/all-clusters-app/telink/include/AppConfig.h index 68263bbda460db..602aa6065313a5 100644 --- a/examples/all-clusters-app/telink/include/AppConfig.h +++ b/examples/all-clusters-app/telink/include/AppConfig.h @@ -19,11 +19,5 @@ #pragma once // ---- All Clusters Application example config ---- -#define APP_USE_EXAMPLE_START_BUTTON 0 -#define APP_USE_BLE_START_BUTTON 0 -#define APP_USE_THREAD_START_BUTTON 1 #define APP_SET_DEVICE_INFO_PROVIDER 1 #define APP_SET_NETWORK_COMM_ENDPOINT_SEC 1 -#if defined(CONFIG_BOARD_TLSR9518ADK80D) || defined(CONFIG_BOARD_TLSR9528A) -#define APP_USE_IDENTIFY_PWM 1 -#endif diff --git a/examples/all-clusters-app/telink/prj.conf b/examples/all-clusters-app/telink/prj.conf index 18b7edcc11f395..a2b81f952a17f3 100644 --- a/examples/all-clusters-app/telink/prj.conf +++ b/examples/all-clusters-app/telink/prj.conf @@ -1,5 +1,5 @@ # -# Copyright (c) 2022-2023 Project CHIP Authors +# Copyright (c) 2022-2024 Project CHIP Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ # limitations under the License. # -# This sample uses sample-defaults.conf to set options common for all +# This sample uses Kconfig.defaults to set options common for all # samples. This file should contain only options specific for this sample # or overrides of default values. @@ -22,10 +22,6 @@ CONFIG_CHIP=y CONFIG_STD_CPP17=y -# CHIP configuration -CONFIG_CHIP_PROJECT_CONFIG="include/CHIPProjectConfig.h" -CONFIG_CHIP_OPENTHREAD_CONFIG="../../platform/telink/project_include/OpenThreadConfig.h" - # CHIP PID: 32769 == 0x8001 (all-clusters-app) CONFIG_CHIP_DEVICE_PRODUCT_ID=32769 diff --git a/examples/all-clusters-app/tizen/src/main.cpp b/examples/all-clusters-app/tizen/src/main.cpp index e3e8aa736846fc..49c9f06ad9b8f6 100644 --- a/examples/all-clusters-app/tizen/src/main.cpp +++ b/examples/all-clusters-app/tizen/src/main.cpp @@ -20,7 +20,7 @@ #include #include #include -#include +#include #include #include diff --git a/examples/all-clusters-minimal-app/ameba/README.md b/examples/all-clusters-minimal-app/ameba/README.md index 693b06cbaa80e4..f6f6c9206ae4b4 100644 --- a/examples/all-clusters-minimal-app/ameba/README.md +++ b/examples/all-clusters-minimal-app/ameba/README.md @@ -27,13 +27,13 @@ The CHIP demo application is supported on - Pull docker image: ``` - $ docker pull ghcr.io/project-chip/chip-build-ameba:35 + $ docker pull ghcr.io/project-chip/chip-build-ameba:47 ``` - Run docker container: ``` - $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:35 + $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:47 ``` - Setup build environment: diff --git a/examples/all-clusters-minimal-app/ameba/main/DeviceCallbacks.cpp b/examples/all-clusters-minimal-app/ameba/main/DeviceCallbacks.cpp index 67b13d9abb9506..a02dd619100928 100644 --- a/examples/all-clusters-minimal-app/ameba/main/DeviceCallbacks.cpp +++ b/examples/all-clusters-minimal-app/ameba/main/DeviceCallbacks.cpp @@ -29,7 +29,6 @@ #include #include #include -#include #include #include #include diff --git a/examples/all-clusters-minimal-app/ameba/main/chipinterface.cpp b/examples/all-clusters-minimal-app/ameba/main/chipinterface.cpp index bc297dfa3d426b..abb0791ac9a132 100644 --- a/examples/all-clusters-minimal-app/ameba/main/chipinterface.cpp +++ b/examples/all-clusters-minimal-app/ameba/main/chipinterface.cpp @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/examples/all-clusters-minimal-app/asr/src/AppTask.cpp b/examples/all-clusters-minimal-app/asr/src/AppTask.cpp index d6f77d2f28a836..f9d05c2157382d 100644 --- a/examples/all-clusters-minimal-app/asr/src/AppTask.cpp +++ b/examples/all-clusters-minimal-app/asr/src/AppTask.cpp @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include diff --git a/examples/all-clusters-minimal-app/asr/src/DeviceCallbacks.cpp b/examples/all-clusters-minimal-app/asr/src/DeviceCallbacks.cpp index 89266592872d3e..c40de8c006e1fc 100644 --- a/examples/all-clusters-minimal-app/asr/src/DeviceCallbacks.cpp +++ b/examples/all-clusters-minimal-app/asr/src/DeviceCallbacks.cpp @@ -29,7 +29,6 @@ #include #include #include -#include #include #include #include diff --git a/examples/all-clusters-minimal-app/esp32/main/DeviceWithDisplay.cpp b/examples/all-clusters-minimal-app/esp32/main/DeviceWithDisplay.cpp index c588c84bcff2d0..f56a3e69a023e7 100644 --- a/examples/all-clusters-minimal-app/esp32/main/DeviceWithDisplay.cpp +++ b/examples/all-clusters-minimal-app/esp32/main/DeviceWithDisplay.cpp @@ -21,6 +21,9 @@ #include #include +#include +#include + #if CONFIG_HAVE_DISPLAY using namespace ::chip; using namespace ::chip::Credentials; diff --git a/examples/all-clusters-minimal-app/esp32/main/Kconfig.projbuild b/examples/all-clusters-minimal-app/esp32/main/Kconfig.projbuild index 9fe8f460e6b0a4..171af4f0ba2c24 100644 --- a/examples/all-clusters-minimal-app/esp32/main/Kconfig.projbuild +++ b/examples/all-clusters-minimal-app/esp32/main/Kconfig.projbuild @@ -48,10 +48,6 @@ menu "Demo" depends on IDF_TARGET_ESP32C2 endchoice - config CHIP_PROJECT_CONFIG - string "CHIP Project Configuration file" - default "main/include/CHIPProjectConfig.h" - choice prompt "Rendezvous Mode" default RENDEZVOUS_MODE_BLE if BT_ENABLED diff --git a/examples/all-clusters-minimal-app/esp32/main/QRCodeScreen.cpp b/examples/all-clusters-minimal-app/esp32/main/QRCodeScreen.cpp index 578f44003f435e..ac39b9498e9f21 100644 --- a/examples/all-clusters-minimal-app/esp32/main/QRCodeScreen.cpp +++ b/examples/all-clusters-minimal-app/esp32/main/QRCodeScreen.cpp @@ -42,6 +42,8 @@ #include #include +#include + // TODO need sensible library tag when put in library extern const char TAG[]; diff --git a/examples/all-clusters-minimal-app/esp32/main/StatusScreen.cpp b/examples/all-clusters-minimal-app/esp32/main/StatusScreen.cpp index 55f42a32723823..0013bda66c5c70 100644 --- a/examples/all-clusters-minimal-app/esp32/main/StatusScreen.cpp +++ b/examples/all-clusters-minimal-app/esp32/main/StatusScreen.cpp @@ -45,6 +45,8 @@ #include #include +#include + #define MAX_LENGTH_SMALL_FONT 30 using namespace chip; diff --git a/examples/all-clusters-minimal-app/esp32/main/include/CHIPProjectConfig.h b/examples/all-clusters-minimal-app/esp32/main/include/CHIPProjectConfig.h deleted file mode 100644 index 9fff1bd10e67b4..00000000000000 --- a/examples/all-clusters-minimal-app/esp32/main/include/CHIPProjectConfig.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * - * Copyright (c) 2023 Project CHIP Authors - * All rights reserved. - * - * 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. - */ - -/** - * @file - * Example project configuration file for CHIP. - * - * This is a place to put application or project-specific overrides - * to the default configuration values for general CHIP features. - * - */ - -#pragma once - -/** - * @def CONFIG_BUILD_FOR_HOST_UNIT_TEST - * - * @brief Defines whether we're currently building for unit testing, which enables a set of features - * that are only utilized in those tests. This flag should not be enabled on devices. If you have a test - * that uses this flag, either appropriately conditionalize the entire test on this flag, or to exclude - * the compliation of that test source file entirely. - */ -#define CONFIG_BUILD_FOR_HOST_UNIT_TEST 1 diff --git a/examples/all-clusters-minimal-app/esp32/main/include/QRCodeScreen.h b/examples/all-clusters-minimal-app/esp32/main/include/QRCodeScreen.h index da0ca8de53fe20..c02cd619d3ca82 100644 --- a/examples/all-clusters-minimal-app/esp32/main/include/QRCodeScreen.h +++ b/examples/all-clusters-minimal-app/esp32/main/include/QRCodeScreen.h @@ -32,6 +32,7 @@ #include "ScreenManager.h" #include +#include #include class QRCodeScreen : public Screen diff --git a/examples/all-clusters-minimal-app/esp32/main/main.cpp b/examples/all-clusters-minimal-app/esp32/main/main.cpp index 0ac538607efd89..993dc609300943 100644 --- a/examples/all-clusters-minimal-app/esp32/main/main.cpp +++ b/examples/all-clusters-minimal-app/esp32/main/main.cpp @@ -36,7 +36,7 @@ #include #include -#include +#include #include #include #include diff --git a/examples/all-clusters-minimal-app/infineon/psoc6/src/AppTask.cpp b/examples/all-clusters-minimal-app/infineon/psoc6/src/AppTask.cpp index 7cbaf6f447d405..ccc271dd7a2d06 100644 --- a/examples/all-clusters-minimal-app/infineon/psoc6/src/AppTask.cpp +++ b/examples/all-clusters-minimal-app/infineon/psoc6/src/AppTask.cpp @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include diff --git a/examples/all-clusters-minimal-app/linux/main-common.cpp b/examples/all-clusters-minimal-app/linux/main-common.cpp index d9f0a51cd747cf..f0bf3cafe8553c 100644 --- a/examples/all-clusters-minimal-app/linux/main-common.cpp +++ b/examples/all-clusters-minimal-app/linux/main-common.cpp @@ -21,7 +21,6 @@ #include #include #include -#include #include #include #include diff --git a/examples/all-clusters-minimal-app/nrfconnect/main/AppTask.cpp b/examples/all-clusters-minimal-app/nrfconnect/main/AppTask.cpp index b3c8b951372c0f..86bfe7a9aa132b 100644 --- a/examples/all-clusters-minimal-app/nrfconnect/main/AppTask.cpp +++ b/examples/all-clusters-minimal-app/nrfconnect/main/AppTask.cpp @@ -26,6 +26,7 @@ #include #include +#include #include #include diff --git a/examples/all-clusters-minimal-app/telink/CMakeLists.txt b/examples/all-clusters-minimal-app/telink/CMakeLists.txt index a68471e379a842..3cfcc56d36783c 100644 --- a/examples/all-clusters-minimal-app/telink/CMakeLists.txt +++ b/examples/all-clusters-minimal-app/telink/CMakeLists.txt @@ -1,5 +1,5 @@ # -# Copyright (c) 2022 Project CHIP Authors +# Copyright (c) 2022-2024 Project CHIP Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # + cmake_minimum_required(VERSION 3.13.1) get_filename_component(CHIP_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/third_party/connectedhomeip REALPATH) @@ -20,47 +21,11 @@ get_filename_component(TELINK_COMMON ${CHIP_ROOT}/examples/platform/telink REALP get_filename_component(GEN_DIR ${CHIP_ROOT}/zzz_generated/ REALPATH) get_filename_component(ALL_CLUSTERS_COMMON_DIR ${CHIP_ROOT}/examples/all-clusters-app/all-clusters-common REALPATH) -if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/boards/${BOARD}.overlay") - set(LOCAL_DTC_OVERLAY_FILE "${CMAKE_CURRENT_SOURCE_DIR}/boards/${BOARD}.overlay") -else() - unset(LOCAL_DTC_OVERLAY_FILE) -endif() - -if(EXISTS "${CHIP_ROOT}/src/platform/telink/${BOARD}.overlay") - set(GLOBAL_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/${BOARD}.overlay") -else() - unset(GLOBAL_DTC_OVERLAY_FILE) -endif() - -if(EXISTS "${CHIP_ROOT}/src/platform/telink/${FLASH_SIZE}_flash.overlay") - set(FLASH_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/${FLASH_SIZE}_flash.overlay") - message(STATUS "Flash memory size is set to: " ${FLASH_SIZE} "b") -else() - set(FLASH_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/2m_flash.overlay") - message(STATUS "Flash memory size is set to: 2mb") -endif() - -if(DTC_OVERLAY_FILE) - set(DTC_OVERLAY_FILE - "${DTC_OVERLAY_FILE} ${GLOBAL_DTC_OVERLAY_FILE} ${FLASH_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}" - CACHE STRING "" FORCE - ) -else() - set(DTC_OVERLAY_FILE ${GLOBAL_DTC_OVERLAY_FILE} ${FLASH_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}) -endif() - -set(CONF_FILE prj.conf) - -# Load NCS/Zephyr build system -list(APPEND ZEPHYR_EXTRA_MODULES ${CHIP_ROOT}/config/telink/chip-module) -find_package(Zephyr HINTS $ENV{ZEPHYR_BASE}) - -project(chip-telink-all-clusters-minimal-app-example) - +include(${TELINK_COMMON}/common.cmake) include(${CHIP_ROOT}/config/telink/app/enable-gnu-std.cmake) include(${CHIP_ROOT}/src/app/chip_data_model.cmake) -target_compile_options(app PRIVATE -fpermissive) +project(chip-telink-all-clusters-minimal-app-example) target_include_directories(app PRIVATE include @@ -68,7 +33,8 @@ target_include_directories(app PRIVATE ${GEN_DIR}/app-common ${GEN_DIR}/all-clusters-minimal-app ${TELINK_COMMON}/common/include - ${TELINK_COMMON}/util/include) + ${TELINK_COMMON}/util/include + ${TELINK_COMMON}/zephyr_ext) target_sources(app PRIVATE src/AppTask.cpp @@ -78,9 +44,15 @@ target_sources(app PRIVATE ${ALL_CLUSTERS_COMMON_DIR}/src/binding-handler.cpp ${TELINK_COMMON}/common/src/mainCommon.cpp ${TELINK_COMMON}/common/src/AppTaskCommon.cpp - ${TELINK_COMMON}/util/src/LEDWidget.cpp + ${TELINK_COMMON}/util/src/LEDManager.cpp + ${TELINK_COMMON}/util/src/PWMManager.cpp ${TELINK_COMMON}/util/src/ButtonManager.cpp - ${TELINK_COMMON}/util/src/ThreadUtil.cpp) + ${TELINK_COMMON}/util/src/ThreadUtil.cpp + ${TELINK_COMMON}/zephyr_ext/zephyr_key_matrix.c + ${TELINK_COMMON}/zephyr_ext/zephyr_key_pool.c + ${TELINK_COMMON}/zephyr_ext/zephyr_led_pool.c + ${TELINK_COMMON}/zephyr_ext/zephyr_pwm_pool.c + ${TELINK_COMMON}/zephyr_ext/zephyr_ws2812.c) chip_configure_data_model(app INCLUDE_SERVER diff --git a/examples/all-clusters-minimal-app/telink/include/AppConfig.h b/examples/all-clusters-minimal-app/telink/include/AppConfig.h index 5ef62e04203e1b..38bbe54833078b 100644 --- a/examples/all-clusters-minimal-app/telink/include/AppConfig.h +++ b/examples/all-clusters-minimal-app/telink/include/AppConfig.h @@ -20,8 +20,5 @@ // ---- All Clusters Minimal Application example config ---- -#define APP_USE_EXAMPLE_START_BUTTON 0 -#define APP_USE_BLE_START_BUTTON 0 -#define APP_USE_THREAD_START_BUTTON 0 #define APP_SET_DEVICE_INFO_PROVIDER 0 #define APP_SET_NETWORK_COMM_ENDPOINT_SEC 1 diff --git a/examples/all-clusters-minimal-app/telink/prj.conf b/examples/all-clusters-minimal-app/telink/prj.conf index 8b63c719c3875c..0b226d2c74a374 100644 --- a/examples/all-clusters-minimal-app/telink/prj.conf +++ b/examples/all-clusters-minimal-app/telink/prj.conf @@ -1,5 +1,5 @@ # -# Copyright (c) 2022-2023 Project CHIP Authors +# Copyright (c) 2022-2024 Project CHIP Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ # limitations under the License. # -# This sample uses sample-defaults.conf to set options common for all +# This sample uses Kconfig.defaults to set options common for all # samples. This file should contain only options specific for this sample # or overrides of default values. @@ -25,10 +25,6 @@ CONFIG_STD_CPP17=y # enable GPIO CONFIG_GPIO=y -# CHIP configuration -CONFIG_CHIP_PROJECT_CONFIG="include/CHIPProjectConfig.h" -CONFIG_CHIP_OPENTHREAD_CONFIG="../../platform/telink/project_include/OpenThreadConfig.h" - # CHIP PID: 32769 == 0x8001 (all-clusters-minimal-app) CONFIG_CHIP_DEVICE_PRODUCT_ID=32769 diff --git a/examples/all-clusters-minimal-app/tizen/src/main.cpp b/examples/all-clusters-minimal-app/tizen/src/main.cpp index 327623911831bb..fd2a345c952dd8 100644 --- a/examples/all-clusters-minimal-app/tizen/src/main.cpp +++ b/examples/all-clusters-minimal-app/tizen/src/main.cpp @@ -20,7 +20,7 @@ #include #include #include -#include +#include #include #include diff --git a/examples/android/CHIPTool/app/src/main/cpp/native-lib.cpp b/examples/android/CHIPTool/app/src/main/cpp/native-lib.cpp index 4a0235adbff06e..abf57152cd153d 100644 --- a/examples/android/CHIPTool/app/src/main/cpp/native-lib.cpp +++ b/examples/android/CHIPTool/app/src/main/cpp/native-lib.cpp @@ -26,6 +26,8 @@ #include #include +#include + // This is just a sample function to demonstrate end-to-end calling in/out of CHIP stack // is working. std::string base38Encode(void) diff --git a/examples/bridge-app/asr/src/AppTask.cpp b/examples/bridge-app/asr/src/AppTask.cpp index 9583fb3a7017e4..ea95500d402f07 100755 --- a/examples/bridge-app/asr/src/AppTask.cpp +++ b/examples/bridge-app/asr/src/AppTask.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include diff --git a/examples/bridge-app/asr/src/DeviceCallbacks.cpp b/examples/bridge-app/asr/src/DeviceCallbacks.cpp index f16b4c956c8022..232e22799e7b65 100644 --- a/examples/bridge-app/asr/src/DeviceCallbacks.cpp +++ b/examples/bridge-app/asr/src/DeviceCallbacks.cpp @@ -32,7 +32,6 @@ #include #include #include -#include #include #include #include diff --git a/examples/bridge-app/asr/src/bridged-actions-stub.cpp b/examples/bridge-app/asr/src/bridged-actions-stub.cpp index b63fee3fd300a7..9e26bae9803fa1 100755 --- a/examples/bridge-app/asr/src/bridged-actions-stub.cpp +++ b/examples/bridge-app/asr/src/bridged-actions-stub.cpp @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include diff --git a/examples/bridge-app/asr/subdevice/SubDeviceManager.cpp b/examples/bridge-app/asr/subdevice/SubDeviceManager.cpp index 9d4eda96e98438..3508068c4832c6 100644 --- a/examples/bridge-app/asr/subdevice/SubDeviceManager.cpp +++ b/examples/bridge-app/asr/subdevice/SubDeviceManager.cpp @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include diff --git a/examples/bridge-app/esp32/main/DeviceCallbacks.cpp b/examples/bridge-app/esp32/main/DeviceCallbacks.cpp index b54c8b4ebb3934..13ced6a2e1c7c6 100644 --- a/examples/bridge-app/esp32/main/DeviceCallbacks.cpp +++ b/examples/bridge-app/esp32/main/DeviceCallbacks.cpp @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include diff --git a/examples/bridge-app/esp32/main/main.cpp b/examples/bridge-app/esp32/main/main.cpp index 07db2ba94a534f..016b75803cd69b 100644 --- a/examples/bridge-app/esp32/main/main.cpp +++ b/examples/bridge-app/esp32/main/main.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include diff --git a/examples/bridge-app/linux/Device.cpp b/examples/bridge-app/linux/Device.cpp index e049e270c49f42..d7862260f820d2 100644 --- a/examples/bridge-app/linux/Device.cpp +++ b/examples/bridge-app/linux/Device.cpp @@ -22,6 +22,8 @@ #include #include +#include + using namespace chip::app::Clusters::Actions; Device::Device(const char * szDeviceName, std::string szLocation) diff --git a/examples/bridge-app/linux/bridged-actions-stub.cpp b/examples/bridge-app/linux/bridged-actions-stub.cpp index 6127df0206a4d0..00f6913b8012c5 100644 --- a/examples/bridge-app/linux/bridged-actions-stub.cpp +++ b/examples/bridge-app/linux/bridged-actions-stub.cpp @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include diff --git a/examples/bridge-app/linux/include/Device.h b/examples/bridge-app/linux/include/Device.h index d5c8434b29eda1..1a5f5bba795394 100644 --- a/examples/bridge-app/linux/include/Device.h +++ b/examples/bridge-app/linux/include/Device.h @@ -24,6 +24,7 @@ #include #include +#include #include class Device diff --git a/examples/bridge-app/linux/main.cpp b/examples/bridge-app/linux/main.cpp index c569e7c06e8b45..3643f5ea1eb02a 100644 --- a/examples/bridge-app/linux/main.cpp +++ b/examples/bridge-app/linux/main.cpp @@ -22,12 +22,13 @@ #include #include +#include #include #include #include #include -#include #include +#include #include #include #include @@ -48,6 +49,7 @@ #include #include +#include #include using namespace chip; diff --git a/examples/bridge-app/telink/CMakeLists.txt b/examples/bridge-app/telink/CMakeLists.txt index f4da959953def8..1da3944812e014 100644 --- a/examples/bridge-app/telink/CMakeLists.txt +++ b/examples/bridge-app/telink/CMakeLists.txt @@ -1,5 +1,5 @@ # -# Copyright (c) 2023 Project CHIP Authors +# Copyright (c) 2023-2024 Project CHIP Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,53 +13,18 @@ # See the License for the specific language governing permissions and # limitations under the License. # + cmake_minimum_required(VERSION 3.13.1) get_filename_component(CHIP_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/third_party/connectedhomeip REALPATH) get_filename_component(TELINK_COMMON ${CHIP_ROOT}/examples/platform/telink REALPATH) get_filename_component(GEN_DIR ${CHIP_ROOT}/zzz_generated/ REALPATH) -if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/boards/${BOARD}.overlay") - set(LOCAL_DTC_OVERLAY_FILE "${CMAKE_CURRENT_SOURCE_DIR}/boards/${BOARD}.overlay") -else() - unset(LOCAL_DTC_OVERLAY_FILE) -endif() - -if(EXISTS "${CHIP_ROOT}/src/platform/telink/${BOARD}.overlay") - set(GLOBAL_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/${BOARD}.overlay") -else() - unset(GLOBAL_DTC_OVERLAY_FILE) -endif() - -if(EXISTS "${CHIP_ROOT}/src/platform/telink/${FLASH_SIZE}_flash.overlay") - set(FLASH_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/${FLASH_SIZE}_flash.overlay") - message(STATUS "Flash memory size is set to: " ${FLASH_SIZE} "b") -else() - set(FLASH_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/2m_flash.overlay") - message(STATUS "Flash memory size is set to: 2mb") -endif() - -if(DTC_OVERLAY_FILE) - set(DTC_OVERLAY_FILE - "${DTC_OVERLAY_FILE} ${GLOBAL_DTC_OVERLAY_FILE} ${FLASH_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}" - CACHE STRING "" FORCE - ) -else() - set(DTC_OVERLAY_FILE ${GLOBAL_DTC_OVERLAY_FILE} ${FLASH_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}) -endif() - -set(CONF_FILE prj.conf) - -# Load NCS/Zephyr build system -list(APPEND ZEPHYR_EXTRA_MODULES ${CHIP_ROOT}/config/telink/chip-module) -find_package(Zephyr HINTS $ENV{ZEPHYR_BASE}) - -project(chip-telink-bridge-example) - +include(${TELINK_COMMON}/common.cmake) include(${CHIP_ROOT}/config/telink/app/enable-gnu-std.cmake) include(${CHIP_ROOT}/src/app/chip_data_model.cmake) -target_compile_options(app PRIVATE -fpermissive) +project(chip-telink-bridge-example) target_include_directories(app PRIVATE include @@ -67,19 +32,24 @@ target_include_directories(app PRIVATE ${GEN_DIR}/bridge-app ${TELINK_COMMON}/common/include ${TELINK_COMMON}/util/include - ${TELINK_COMMON}/app/include) + ${TELINK_COMMON}/app/include + ${TELINK_COMMON}/zephyr_ext) target_sources(app PRIVATE src/AppTask.cpp - src/ZclCallbacks.cpp src/Device.cpp src/DeviceCallbacks.cpp ${TELINK_COMMON}/common/src/mainCommon.cpp ${TELINK_COMMON}/common/src/AppTaskCommon.cpp - ${TELINK_COMMON}/util/src/LEDWidget.cpp + ${TELINK_COMMON}/util/src/LEDManager.cpp ${TELINK_COMMON}/util/src/ButtonManager.cpp ${TELINK_COMMON}/util/src/ThreadUtil.cpp - ${TELINK_COMMON}/util/src/PWMDevice.cpp) + ${TELINK_COMMON}/util/src/PWMManager.cpp + ${TELINK_COMMON}/zephyr_ext/zephyr_key_matrix.c + ${TELINK_COMMON}/zephyr_ext/zephyr_key_pool.c + ${TELINK_COMMON}/zephyr_ext/zephyr_led_pool.c + ${TELINK_COMMON}/zephyr_ext/zephyr_pwm_pool.c + ${TELINK_COMMON}/zephyr_ext/zephyr_ws2812.c) chip_configure_data_model(app INCLUDE_SERVER diff --git a/examples/bridge-app/telink/include/AppConfig.h b/examples/bridge-app/telink/include/AppConfig.h index e5e26efb2871d1..e4af6138744261 100644 --- a/examples/bridge-app/telink/include/AppConfig.h +++ b/examples/bridge-app/telink/include/AppConfig.h @@ -20,11 +20,5 @@ // ---- Bridge App Example Config ---- -#define APP_USE_EXAMPLE_START_BUTTON 1 -#define APP_USE_BLE_START_BUTTON 0 -#define APP_USE_THREAD_START_BUTTON 1 #define APP_SET_DEVICE_INFO_PROVIDER 1 #define APP_SET_NETWORK_COMM_ENDPOINT_SEC 0 -#if defined(CONFIG_BOARD_TLSR9518ADK80D) || defined(CONFIG_BOARD_TLSR9528A) -#define APP_USE_IDENTIFY_PWM 1 -#endif diff --git a/examples/bridge-app/telink/include/AppTask.h b/examples/bridge-app/telink/include/AppTask.h index 6b8a60df890dbf..18275849c015a4 100644 --- a/examples/bridge-app/telink/include/AppTask.h +++ b/examples/bridge-app/telink/include/AppTask.h @@ -19,14 +19,20 @@ #pragma once #include "AppTaskCommon.h" -#include "PWMDevice.h" class AppTask : public AppTaskCommon { public: + enum Action_t : uint8_t + { + ON_ACTION = 0, + OFF_ACTION, + LEVEL_ACTION, + INVALID_ACTION + }; + void UpdateClusterState(void); static void InitServer(intptr_t context); - PWMDevice & GetPWMDevice(void) { return mPwmRgbBlueLed; } private: friend AppTask & GetAppTask(void); @@ -34,13 +40,8 @@ class AppTask : public AppTaskCommon CHIP_ERROR Init(void); - static void ActionInitiated(PWMDevice::Action_t aAction, int32_t aActor); - static void ActionCompleted(PWMDevice::Action_t aAction, int32_t aActor); - static void LightingActionEventHandler(AppEvent * aEvent); - PWMDevice mPwmRgbBlueLed; - static AppTask sAppTask; }; diff --git a/examples/bridge-app/telink/include/Device.h b/examples/bridge-app/telink/include/Device.h index bd91dcb9f346c0..19b3b1bae7c1af 100644 --- a/examples/bridge-app/telink/include/Device.h +++ b/examples/bridge-app/telink/include/Device.h @@ -20,6 +20,7 @@ #include #include +#include #include diff --git a/examples/bridge-app/telink/prj.conf b/examples/bridge-app/telink/prj.conf index fba10bf033c9e7..28b99fe97cce99 100644 --- a/examples/bridge-app/telink/prj.conf +++ b/examples/bridge-app/telink/prj.conf @@ -1,5 +1,5 @@ # -# Copyright (c) 2023 Project CHIP Authors +# Copyright (c) 2023-2024 Project CHIP Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ # limitations under the License. # -# This sample uses sample-defaults.conf to set options common for all +# This sample uses Kconfig.defaults to set options common for all # samples. This file should contain only options specific for this sample # or overrides of default values. @@ -22,10 +22,6 @@ CONFIG_CHIP=y CONFIG_STD_CPP17=y -# CHIP configuration -CONFIG_CHIP_PROJECT_CONFIG="include/CHIPProjectConfig.h" -CONFIG_CHIP_OPENTHREAD_CONFIG="../../platform/telink/project_include/OpenThreadConfig.h" - # 32770 == 0x8002 (example bridge-app) CONFIG_CHIP_DEVICE_PRODUCT_ID=32770 diff --git a/examples/bridge-app/telink/src/AppTask.cpp b/examples/bridge-app/telink/src/AppTask.cpp index 72a997c91e9511..76a59c4de5e293 100644 --- a/examples/bridge-app/telink/src/AppTask.cpp +++ b/examples/bridge-app/telink/src/AppTask.cpp @@ -18,15 +18,18 @@ #include "AppTask.h" #include "Device.h" +#include "PWMManager.h" #include #include +#include #include LOG_MODULE_DECLARE(app, CONFIG_CHIP_APP_LOG_LEVEL); namespace { -const struct pwm_dt_spec sPwmRgbSpecBlueLed = PWM_DT_SPEC_GET(DT_ALIAS(pwm_led0)); +bool sTurnedOn; +uint8_t sLevel; } // namespace AppTask AppTask::sAppTask; @@ -394,29 +397,32 @@ bool emberAfActionsClusterInstantActionCallback(app::CommandHandler * commandObj CHIP_ERROR AppTask::Init(void) { - // Init lighting manager - uint8_t minLightLevel = kDefaultMinLevel; - Clusters::LevelControl::Attributes::MinLevel::Get(kExampleEndpointId, &minLightLevel); + SetExampleButtonCallbacks(LightingActionEventHandler); + InitCommonParts(); - uint8_t maxLightLevel = kDefaultMaxLevel; - Clusters::LevelControl::Attributes::MaxLevel::Get(kExampleEndpointId, &maxLightLevel); + Protocols::InteractionModel::Status status; - // Initialize PWM LED - CHIP_ERROR err = sAppTask.mPwmRgbBlueLed.Init(&sPwmRgbSpecBlueLed, minLightLevel, maxLightLevel, maxLightLevel); - if (err != CHIP_NO_ERROR) + app::DataModel::Nullable level; + // Read brightness value + status = Clusters::LevelControl::Attributes::CurrentLevel::Get(kExampleEndpointId, level); + if (status == Protocols::InteractionModel::Status::Success && !level.IsNull()) { - LOG_ERR("Blue RGB PWM Device Init fail"); - return err; + sLevel = level.Value(); } - sAppTask.mPwmRgbBlueLed.SetCallbacks(ActionInitiated, ActionCompleted, nullptr); - -#if APP_USE_EXAMPLE_START_BUTTON - SetExampleButtonCallbacks(LightingActionEventHandler); -#endif - InitCommonParts(); + bool isOn; + // Read storedValue on/off value + status = Clusters::OnOff::Attributes::OnOff::Get(1, &isOn); + if (status == Protocols::InteractionModel::Status::Success) + { + sTurnedOn = isOn; + PwmManager::getInstance().setPwm(PwmManager::EAppPwm_Red, sTurnedOn); + } - memset(gDevices, 0, sizeof(gDevices)); + for (size_t i = 0; i < CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT; i++) + { + gDevices[i] = nullptr; + } gLight1.SetReachable(true); gLight2.SetReachable(true); @@ -530,66 +536,26 @@ Protocols::InteractionModel::Status HandleReadTempMeasurementAttribute(DeviceTem void AppTask::LightingActionEventHandler(AppEvent * aEvent) { - PWMDevice::Action_t action = PWMDevice::INVALID_ACTION; - int32_t actor = 0; + Action_t action = INVALID_ACTION; + int32_t actor = 0; if (aEvent->Type == AppEvent::kEventType_Lighting) { - action = static_cast(aEvent->LightingEvent.Action); + action = static_cast(aEvent->LightingEvent.Action); actor = aEvent->LightingEvent.Actor; } else if (aEvent->Type == AppEvent::kEventType_Button) { - action = sAppTask.mPwmRgbBlueLed.IsTurnedOn() ? PWMDevice::OFF_ACTION : PWMDevice::ON_ACTION; - actor = AppEvent::kEventType_Button; - } - - if (action != PWMDevice::INVALID_ACTION && (!sAppTask.mPwmRgbBlueLed.InitiateAction(action, actor, NULL))) - { - LOG_INF("Action is in progress or active"); - } -} - -void AppTask::ActionInitiated(PWMDevice::Action_t aAction, int32_t aActor) -{ - if (aAction == PWMDevice::ON_ACTION) - { - LOG_DBG("ON_ACTION initiated"); - } - else if (aAction == PWMDevice::OFF_ACTION) - { - LOG_DBG("OFF_ACTION initiated"); - } - else if (aAction == PWMDevice::LEVEL_ACTION) - { - LOG_DBG("LEVEL_ACTION initiated"); - } -} - -void AppTask::ActionCompleted(PWMDevice::Action_t aAction, int32_t aActor) -{ - if (aAction == PWMDevice::ON_ACTION) - { - LOG_DBG("ON_ACTION completed"); - } - else if (aAction == PWMDevice::OFF_ACTION) - { - LOG_DBG("OFF_ACTION completed"); - } - else if (aAction == PWMDevice::LEVEL_ACTION) - { - LOG_DBG("LEVEL_ACTION completed"); - } + sTurnedOn = !sTurnedOn; - if (aActor == AppEvent::kEventType_Button) - { - sAppTask.UpdateClusterState(); + PwmManager::getInstance().setPwm(PwmManager::EAppPwm_Red, sTurnedOn); + GetAppTask().UpdateClusterState(); } } void AppTask::UpdateClusterState(void) { - bool isTurnedOn = sAppTask.mPwmRgbBlueLed.IsTurnedOn(); + bool isTurnedOn = sTurnedOn; // write the new on/off value Protocols::InteractionModel::Status status = Clusters::OnOff::Attributes::OnOff::Set(kExampleEndpointId, isTurnedOn); @@ -598,7 +564,7 @@ void AppTask::UpdateClusterState(void) { LOG_ERR("Update OnOff fail: %x", to_underlying(status)); } - uint8_t setLevel = sAppTask.mPwmRgbBlueLed.GetLevel(); + uint8_t setLevel = sLevel; status = Clusters::LevelControl::Attributes::CurrentLevel::Set(kExampleEndpointId, setLevel); if (status != Protocols::InteractionModel::Status::Success) { diff --git a/examples/bridge-app/telink/src/Device.cpp b/examples/bridge-app/telink/src/Device.cpp index 053bf2ce187679..769f1ec420f154 100644 --- a/examples/bridge-app/telink/src/Device.cpp +++ b/examples/bridge-app/telink/src/Device.cpp @@ -21,6 +21,8 @@ #include #include +#include + using namespace ::chip::Platform; Device::Device(const char * szDeviceName, const char * szLocation) diff --git a/examples/bridge-app/telink/src/DeviceCallbacks.cpp b/examples/bridge-app/telink/src/DeviceCallbacks.cpp index 6742953d7ec2d2..b0657e586fabc2 100644 --- a/examples/bridge-app/telink/src/DeviceCallbacks.cpp +++ b/examples/bridge-app/telink/src/DeviceCallbacks.cpp @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include diff --git a/examples/bridge-app/telink/src/ZclCallbacks.cpp b/examples/bridge-app/telink/src/ZclCallbacks.cpp deleted file mode 100644 index e83993165acb51..00000000000000 --- a/examples/bridge-app/telink/src/ZclCallbacks.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/* - * - * Copyright (c) 2023 Project CHIP Authors - * All rights reserved. - * - * 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. - */ - -#include "AppTask.h" -#include "ColorFormat.h" -#include "PWMDevice.h" - -#include -#include -#include -#include -#include - -LOG_MODULE_DECLARE(app, CONFIG_CHIP_APP_LOG_LEVEL); - -using namespace chip; -using namespace chip::app::Clusters; -using namespace chip::app::Clusters::OnOff; - -/** @brief OnOff Cluster Init - * - * This function is called when a specific cluster is initialized. It gives the - * application an opportunity to take care of cluster initialization procedures. - * It is called exactly once for each endpoint where cluster is present. - * - * @param endpoint Ver.: always - * - */ -void emberAfOnOffClusterInitCallback(EndpointId endpoint) -{ - Protocols::InteractionModel::Status status; - bool storedValue; - - // Read storedValue on/off value - status = Attributes::OnOff::Get(1, &storedValue); - if (status == Protocols::InteractionModel::Status::Success) - { - // Set actual state to stored before reboot - GetAppTask().GetPWMDevice().Set(storedValue); - } - - GetAppTask().UpdateClusterState(); -} diff --git a/examples/chef/ameba/main/DeviceCallbacks.cpp b/examples/chef/ameba/main/DeviceCallbacks.cpp index fd8a63e5a846c4..90c783a8578f33 100644 --- a/examples/chef/ameba/main/DeviceCallbacks.cpp +++ b/examples/chef/ameba/main/DeviceCallbacks.cpp @@ -29,7 +29,6 @@ #include #include #include -#include #include #include #include diff --git a/examples/chef/ameba/main/chipinterface.cpp b/examples/chef/ameba/main/chipinterface.cpp index ad9946ef5a3719..f747cbbd886c42 100644 --- a/examples/chef/ameba/main/chipinterface.cpp +++ b/examples/chef/ameba/main/chipinterface.cpp @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/examples/chef/common/chef-fan-control-manager.cpp b/examples/chef/common/chef-fan-control-manager.cpp index 998491d4a61aeb..899892501bf4f1 100644 --- a/examples/chef/common/chef-fan-control-manager.cpp +++ b/examples/chef/common/chef-fan-control-manager.cpp @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include diff --git a/examples/chef/common/chef-laundry-washer-controls-delegate-impl.h b/examples/chef/common/chef-laundry-washer-controls-delegate-impl.h index 15a72482726ba0..f9d3d1bf8c7bdf 100644 --- a/examples/chef/common/chef-laundry-washer-controls-delegate-impl.h +++ b/examples/chef/common/chef-laundry-washer-controls-delegate-impl.h @@ -20,7 +20,6 @@ #include #include -#include #include #include diff --git a/examples/chef/common/chef-laundry-washer-mode.h b/examples/chef/common/chef-laundry-washer-mode.h index 2f59b0dfd04bab..5d35c03d4e50cd 100644 --- a/examples/chef/common/chef-laundry-washer-mode.h +++ b/examples/chef/common/chef-laundry-washer-mode.h @@ -19,7 +19,6 @@ #pragma once #include -#include #include #include #include diff --git a/examples/chef/common/chef-rvc-mode-delegate.h b/examples/chef/common/chef-rvc-mode-delegate.h index 3b08552776319a..5f96957420a441 100644 --- a/examples/chef/common/chef-rvc-mode-delegate.h +++ b/examples/chef/common/chef-rvc-mode-delegate.h @@ -19,7 +19,6 @@ #pragma once #include -#include #include #include #include diff --git a/examples/chef/common/clusters/audio-output/AudioOutputManager.h b/examples/chef/common/clusters/audio-output/AudioOutputManager.h index 5f9157de773ee7..ad64b7c9c96d5d 100644 --- a/examples/chef/common/clusters/audio-output/AudioOutputManager.h +++ b/examples/chef/common/clusters/audio-output/AudioOutputManager.h @@ -19,6 +19,7 @@ #pragma once #include +#include #include class AudioOutputManager : public chip::app::Clusters::AudioOutput::Delegate diff --git a/examples/chef/common/clusters/channel/ChannelManager.cpp b/examples/chef/common/clusters/channel/ChannelManager.cpp index 36df31af6de280..c47bf447dd3124 100644 --- a/examples/chef/common/clusters/channel/ChannelManager.cpp +++ b/examples/chef/common/clusters/channel/ChannelManager.cpp @@ -23,6 +23,7 @@ #include #include +#include #include using namespace chip; diff --git a/examples/chef/common/clusters/door-lock/chef-doorlock-stubs.cpp b/examples/chef/common/clusters/door-lock/chef-doorlock-stubs.cpp index 7d92300ca5659c..90b9fd017b0a01 100644 --- a/examples/chef/common/clusters/door-lock/chef-doorlock-stubs.cpp +++ b/examples/chef/common/clusters/door-lock/chef-doorlock-stubs.cpp @@ -17,7 +17,6 @@ */ #include -#include #include #ifdef MATTER_DM_PLUGIN_DOOR_LOCK_SERVER diff --git a/examples/chef/common/clusters/door-lock/chef-lock-endpoint.cpp b/examples/chef/common/clusters/door-lock/chef-lock-endpoint.cpp index 4770a9ce6e3c4b..c7fe5696d9ba74 100644 --- a/examples/chef/common/clusters/door-lock/chef-lock-endpoint.cpp +++ b/examples/chef/common/clusters/door-lock/chef-lock-endpoint.cpp @@ -17,7 +17,6 @@ */ #include -#include #include #include #include diff --git a/examples/chef/common/clusters/door-lock/chef-lock-manager.cpp b/examples/chef/common/clusters/door-lock/chef-lock-manager.cpp index 0b81cce895b264..b6c3f7a4a35090 100644 --- a/examples/chef/common/clusters/door-lock/chef-lock-manager.cpp +++ b/examples/chef/common/clusters/door-lock/chef-lock-manager.cpp @@ -15,7 +15,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include #include #include diff --git a/examples/chef/common/clusters/door-lock/chef-lock-manager.h b/examples/chef/common/clusters/door-lock/chef-lock-manager.h index 709f13c1addc66..f941620880678e 100644 --- a/examples/chef/common/clusters/door-lock/chef-lock-manager.h +++ b/examples/chef/common/clusters/door-lock/chef-lock-manager.h @@ -22,8 +22,6 @@ #include #include -#include - class LockManager { public: diff --git a/examples/chef/common/clusters/media-input/MediaInputManager.h b/examples/chef/common/clusters/media-input/MediaInputManager.h index 104db65e2bbe97..ebd4a436fdbf24 100644 --- a/examples/chef/common/clusters/media-input/MediaInputManager.h +++ b/examples/chef/common/clusters/media-input/MediaInputManager.h @@ -20,6 +20,8 @@ #include #include + +#include #include class MediaInputManager : public chip::app::Clusters::MediaInput::Delegate diff --git a/examples/chef/common/clusters/media-playback/MediaPlaybackManager.cpp b/examples/chef/common/clusters/media-playback/MediaPlaybackManager.cpp index 512da2966d68b6..14be124252a7c0 100644 --- a/examples/chef/common/clusters/media-playback/MediaPlaybackManager.cpp +++ b/examples/chef/common/clusters/media-playback/MediaPlaybackManager.cpp @@ -21,6 +21,8 @@ #include #include +#include + using namespace std; using namespace chip::app::DataModel; using namespace chip::app::Clusters::MediaPlayback; diff --git a/examples/chef/common/clusters/target-navigator/TargetNavigatorManager.cpp b/examples/chef/common/clusters/target-navigator/TargetNavigatorManager.cpp index 17acf11b39bf23..be20f92f53a8fe 100644 --- a/examples/chef/common/clusters/target-navigator/TargetNavigatorManager.cpp +++ b/examples/chef/common/clusters/target-navigator/TargetNavigatorManager.cpp @@ -20,6 +20,9 @@ #include "TargetNavigatorManager.h" #include +#include +#include + using namespace std; using namespace chip::app; using namespace chip::app::Clusters::TargetNavigator; diff --git a/examples/chef/common/clusters/target-navigator/TargetNavigatorManager.h b/examples/chef/common/clusters/target-navigator/TargetNavigatorManager.h index 21a08b9595cd82..e9528081661e8d 100644 --- a/examples/chef/common/clusters/target-navigator/TargetNavigatorManager.h +++ b/examples/chef/common/clusters/target-navigator/TargetNavigatorManager.h @@ -19,6 +19,8 @@ #include +#include + class TargetNavigatorManager : public chip::app::Clusters::TargetNavigator::Delegate { using TargetInfoType = chip::app::Clusters::TargetNavigator::Structs::TargetInfoStruct::Type; diff --git a/examples/chef/devices/rootnode_contactsensor_27f76aeaf5.matter b/examples/chef/devices/rootnode_contactsensor_27f76aeaf5.matter index a578cc06a5d79f..9f2c7509031e86 100644 --- a/examples/chef/devices/rootnode_contactsensor_27f76aeaf5.matter +++ b/examples/chef/devices/rootnode_contactsensor_27f76aeaf5.matter @@ -2114,6 +2114,7 @@ endpoint 0 { } } endpoint 1 { + device type ma_powersource = 17, version 1; device type ma_contactsensor = 21, version 1; @@ -2122,11 +2123,13 @@ endpoint 1 { ram attribute identifyType default = 0x0; callback attribute generatedCommandList; callback attribute acceptedCommandList; + callback attribute eventList; callback attribute attributeList; ram attribute featureMap default = 0; ram attribute clusterRevision default = 2; handle command Identify; + handle command TriggerEffect; } server cluster Descriptor { @@ -2142,15 +2145,25 @@ endpoint 1 { } server cluster PowerSource { - ram attribute status; - ram attribute order; - ram attribute description; + ram attribute status default = 1; + ram attribute order default = 1; + ram attribute description default = "Primary Battery"; + ram attribute batVoltage default = 4100; + ram attribute batPercentRemaining default = 95; + ram attribute batTimeRemaining default = 5184000; + ram attribute batChargeLevel default = 0; + ram attribute batReplacementNeeded default = 0; + ram attribute batReplaceability default = 1; + ram attribute batPresent default = 1; + ram attribute batCapacity default = 350; + ram attribute batChargeState default = 4; + ram attribute batFunctionalWhileCharging default = 1; callback attribute endpointList; callback attribute generatedCommandList; callback attribute acceptedCommandList; callback attribute eventList; callback attribute attributeList; - ram attribute featureMap default = 0; + ram attribute featureMap default = 0x06; ram attribute clusterRevision default = 1; } diff --git a/examples/chef/devices/rootnode_contactsensor_27f76aeaf5.zap b/examples/chef/devices/rootnode_contactsensor_27f76aeaf5.zap index 77bffd9fd09486..4a57e6a0b9e2fa 100644 --- a/examples/chef/devices/rootnode_contactsensor_27f76aeaf5.zap +++ b/examples/chef/devices/rootnode_contactsensor_27f76aeaf5.zap @@ -2316,13 +2316,21 @@ "profileId": 259, "label": "MA-contactsensor", "name": "MA-contactsensor" + }, + { + "code": 17, + "profileId": 259, + "label": "MA-powersource", + "name": "MA-powersource" } ], "deviceVersions": [ + 1, 1 ], "deviceIdentifiers": [ - 21 + 21, + 17 ], "deviceTypeName": "MA-contactsensor", "deviceTypeCode": 21, @@ -2343,6 +2351,14 @@ "source": "client", "isIncoming": 1, "isEnabled": 1 + }, + { + "name": "TriggerEffect", + "code": 64, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 } ], "attributes": [ @@ -2410,6 +2426,22 @@ "maxInterval": 65534, "reportableChange": 0 }, + { + "name": "EventList", + "code": 65530, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "AttributeList", "code": 65531, @@ -2632,7 +2664,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": "1", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -2648,7 +2680,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": "1", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -2664,7 +2696,167 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": "Primary Battery", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "BatVoltage", + "code": 11, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "4100", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "BatPercentRemaining", + "code": 12, + "mfgCode": null, + "side": "server", + "type": "int8u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "95", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "BatTimeRemaining", + "code": 13, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "5184000", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "BatChargeLevel", + "code": 14, + "mfgCode": null, + "side": "server", + "type": "BatChargeLevelEnum", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "BatReplacementNeeded", + "code": 15, + "mfgCode": null, + "side": "server", + "type": "boolean", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "BatReplaceability", + "code": 16, + "mfgCode": null, + "side": "server", + "type": "BatReplaceabilityEnum", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "BatPresent", + "code": 17, + "mfgCode": null, + "side": "server", + "type": "boolean", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "BatCapacity", + "code": 24, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "350", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "BatChargeState", + "code": 26, + "mfgCode": null, + "side": "server", + "type": "BatChargeStateEnum", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "4", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "BatFunctionalWhileCharging", + "code": 28, + "mfgCode": null, + "side": "server", + "type": "boolean", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -2760,7 +2952,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0", + "defaultValue": "0x06", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -4525,7 +4717,7 @@ { "endpointTypeName": "Anonymous Endpoint Type", "endpointTypeIndex": 1, - "profileId": 260, + "profileId": 259, "endpointId": 1, "networkId": 0, "parentEndpointIdentifier": null diff --git a/examples/chef/devices/rootnode_contactsensor_lFAGG1bfRO.matter b/examples/chef/devices/rootnode_contactsensor_lFAGG1bfRO.matter index f49d0a1e6e03b1..b8026a69abb6e2 100644 --- a/examples/chef/devices/rootnode_contactsensor_lFAGG1bfRO.matter +++ b/examples/chef/devices/rootnode_contactsensor_lFAGG1bfRO.matter @@ -569,6 +569,265 @@ cluster TimeFormatLocalization = 44 { readonly attribute int16u clusterRevision = 65533; } +/** This cluster is used to describe the configuration and capabilities of a physical power source that provides power to the Node. */ +cluster PowerSource = 47 { + revision 1; // NOTE: Default/not specifically set + + enum BatApprovedChemistryEnum : enum16 { + kUnspecified = 0; + kAlkaline = 1; + kLithiumCarbonFluoride = 2; + kLithiumChromiumOxide = 3; + kLithiumCopperOxide = 4; + kLithiumIronDisulfide = 5; + kLithiumManganeseDioxide = 6; + kLithiumThionylChloride = 7; + kMagnesium = 8; + kMercuryOxide = 9; + kNickelOxyhydride = 10; + kSilverOxide = 11; + kZincAir = 12; + kZincCarbon = 13; + kZincChloride = 14; + kZincManganeseDioxide = 15; + kLeadAcid = 16; + kLithiumCobaltOxide = 17; + kLithiumIon = 18; + kLithiumIonPolymer = 19; + kLithiumIronPhosphate = 20; + kLithiumSulfur = 21; + kLithiumTitanate = 22; + kNickelCadmium = 23; + kNickelHydrogen = 24; + kNickelIron = 25; + kNickelMetalHydride = 26; + kNickelZinc = 27; + kSilverZinc = 28; + kSodiumIon = 29; + kSodiumSulfur = 30; + kZincBromide = 31; + kZincCerium = 32; + } + + enum BatChargeFaultEnum : enum8 { + kUnspecified = 0; + kAmbientTooHot = 1; + kAmbientTooCold = 2; + kBatteryTooHot = 3; + kBatteryTooCold = 4; + kBatteryAbsent = 5; + kBatteryOverVoltage = 6; + kBatteryUnderVoltage = 7; + kChargerOverVoltage = 8; + kChargerUnderVoltage = 9; + kSafetyTimeout = 10; + } + + enum BatChargeLevelEnum : enum8 { + kOK = 0; + kWarning = 1; + kCritical = 2; + } + + enum BatChargeStateEnum : enum8 { + kUnknown = 0; + kIsCharging = 1; + kIsAtFullCharge = 2; + kIsNotCharging = 3; + } + + enum BatCommonDesignationEnum : enum16 { + kUnspecified = 0; + kAAA = 1; + kAA = 2; + kC = 3; + kD = 4; + k4v5 = 5; + k6v0 = 6; + k9v0 = 7; + k12AA = 8; + kAAAA = 9; + kA = 10; + kB = 11; + kF = 12; + kN = 13; + kNo6 = 14; + kSubC = 15; + kA23 = 16; + kA27 = 17; + kBA5800 = 18; + kDuplex = 19; + k4SR44 = 20; + k523 = 21; + k531 = 22; + k15v0 = 23; + k22v5 = 24; + k30v0 = 25; + k45v0 = 26; + k67v5 = 27; + kJ = 28; + kCR123A = 29; + kCR2 = 30; + k2CR5 = 31; + kCRP2 = 32; + kCRV3 = 33; + kSR41 = 34; + kSR43 = 35; + kSR44 = 36; + kSR45 = 37; + kSR48 = 38; + kSR54 = 39; + kSR55 = 40; + kSR57 = 41; + kSR58 = 42; + kSR59 = 43; + kSR60 = 44; + kSR63 = 45; + kSR64 = 46; + kSR65 = 47; + kSR66 = 48; + kSR67 = 49; + kSR68 = 50; + kSR69 = 51; + kSR516 = 52; + kSR731 = 53; + kSR712 = 54; + kLR932 = 55; + kA5 = 56; + kA10 = 57; + kA13 = 58; + kA312 = 59; + kA675 = 60; + kAC41E = 61; + k10180 = 62; + k10280 = 63; + k10440 = 64; + k14250 = 65; + k14430 = 66; + k14500 = 67; + k14650 = 68; + k15270 = 69; + k16340 = 70; + kRCR123A = 71; + k17500 = 72; + k17670 = 73; + k18350 = 74; + k18500 = 75; + k18650 = 76; + k19670 = 77; + k25500 = 78; + k26650 = 79; + k32600 = 80; + } + + enum BatFaultEnum : enum8 { + kUnspecified = 0; + kOverTemp = 1; + kUnderTemp = 2; + } + + enum BatReplaceabilityEnum : enum8 { + kUnspecified = 0; + kNotReplaceable = 1; + kUserReplaceable = 2; + kFactoryReplaceable = 3; + } + + enum PowerSourceStatusEnum : enum8 { + kUnspecified = 0; + kActive = 1; + kStandby = 2; + kUnavailable = 3; + } + + enum WiredCurrentTypeEnum : enum8 { + kAC = 0; + kDC = 1; + } + + enum WiredFaultEnum : enum8 { + kUnspecified = 0; + kOverVoltage = 1; + kUnderVoltage = 2; + } + + bitmap Feature : bitmap32 { + kWired = 0x1; + kBattery = 0x2; + kRechargeable = 0x4; + kReplaceable = 0x8; + } + + struct BatChargeFaultChangeType { + BatChargeFaultEnum current[] = 0; + BatChargeFaultEnum previous[] = 1; + } + + struct BatFaultChangeType { + BatFaultEnum current[] = 0; + BatFaultEnum previous[] = 1; + } + + struct WiredFaultChangeType { + WiredFaultEnum current[] = 0; + WiredFaultEnum previous[] = 1; + } + + info event WiredFaultChange = 0 { + WiredFaultEnum current[] = 0; + WiredFaultEnum previous[] = 1; + } + + info event BatFaultChange = 1 { + BatFaultEnum current[] = 0; + BatFaultEnum previous[] = 1; + } + + info event BatChargeFaultChange = 2 { + BatChargeFaultEnum current[] = 0; + BatChargeFaultEnum previous[] = 1; + } + + readonly attribute PowerSourceStatusEnum status = 0; + readonly attribute int8u order = 1; + readonly attribute char_string<60> description = 2; + readonly attribute optional nullable int32u wiredAssessedInputVoltage = 3; + readonly attribute optional nullable int16u wiredAssessedInputFrequency = 4; + readonly attribute optional WiredCurrentTypeEnum wiredCurrentType = 5; + readonly attribute optional nullable int32u wiredAssessedCurrent = 6; + readonly attribute optional int32u wiredNominalVoltage = 7; + readonly attribute optional int32u wiredMaximumCurrent = 8; + readonly attribute optional boolean wiredPresent = 9; + readonly attribute optional WiredFaultEnum activeWiredFaults[] = 10; + readonly attribute optional nullable int32u batVoltage = 11; + readonly attribute optional nullable int8u batPercentRemaining = 12; + readonly attribute optional nullable int32u batTimeRemaining = 13; + readonly attribute optional BatChargeLevelEnum batChargeLevel = 14; + readonly attribute optional boolean batReplacementNeeded = 15; + readonly attribute optional BatReplaceabilityEnum batReplaceability = 16; + readonly attribute optional boolean batPresent = 17; + readonly attribute optional BatFaultEnum activeBatFaults[] = 18; + readonly attribute optional char_string<60> batReplacementDescription = 19; + readonly attribute optional BatCommonDesignationEnum batCommonDesignation = 20; + readonly attribute optional char_string<20> batANSIDesignation = 21; + readonly attribute optional char_string<20> batIECDesignation = 22; + readonly attribute optional BatApprovedChemistryEnum batApprovedChemistry = 23; + readonly attribute optional int32u batCapacity = 24; + readonly attribute optional int8u batQuantity = 25; + readonly attribute optional BatChargeStateEnum batChargeState = 26; + readonly attribute optional nullable int32u batTimeToFullCharge = 27; + readonly attribute optional boolean batFunctionalWhileCharging = 28; + readonly attribute optional nullable int32u batChargingCurrent = 29; + readonly attribute optional BatChargeFaultEnum activeBatChargeFaults[] = 30; + readonly attribute endpoint_no endpointList[] = 31; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; +} + /** This cluster is used to manage global aspects of the Commissioning flow. */ cluster GeneralCommissioning = 48 { revision 1; // NOTE: Default/not specifically set @@ -1544,6 +1803,7 @@ endpoint 0 { } } endpoint 1 { + device type ma_powersource = 17, version 1; device type ma_contactsensor = 21, version 1; binding cluster Binding; @@ -1558,6 +1818,7 @@ endpoint 1 { ram attribute clusterRevision default = 2; handle command Identify; + handle command TriggerEffect; } server cluster Groups { @@ -1592,10 +1853,35 @@ endpoint 1 { callback attribute clusterRevision; } + server cluster PowerSource { + ram attribute status default = 1; + ram attribute order default = 1; + ram attribute description default = "Battery"; + ram attribute batVoltage default = 2590; + ram attribute batPercentRemaining default = 98; + ram attribute batTimeRemaining default = 52560000; + ram attribute batChargeLevel default = 0; + ram attribute batReplacementNeeded default = 0; + ram attribute batReplaceability default = 2; + ram attribute batPresent default = 1; + ram attribute batReplacementDescription default = "2x AA/LR6 Alkaline"; + ram attribute batCommonDesignation default = 2; + ram attribute batApprovedChemistry default = 1; + ram attribute batQuantity; + callback attribute endpointList; + callback attribute generatedCommandList; + callback attribute acceptedCommandList; + callback attribute eventList; + callback attribute attributeList; + ram attribute featureMap default = 0x0A; + ram attribute clusterRevision default = 1; + } + server cluster BooleanState { ram attribute stateValue default = 0; callback attribute generatedCommandList; callback attribute acceptedCommandList; + callback attribute eventList; callback attribute attributeList; ram attribute featureMap default = 0; ram attribute clusterRevision default = 1; diff --git a/examples/chef/devices/rootnode_contactsensor_lFAGG1bfRO.zap b/examples/chef/devices/rootnode_contactsensor_lFAGG1bfRO.zap index 40b85db5d09ef7..a47dc3a0b5c53e 100644 --- a/examples/chef/devices/rootnode_contactsensor_lFAGG1bfRO.zap +++ b/examples/chef/devices/rootnode_contactsensor_lFAGG1bfRO.zap @@ -2480,13 +2480,21 @@ "profileId": 259, "label": "MA-contactsensor", "name": "MA-contactsensor" + }, + { + "code": 17, + "profileId": 259, + "label": "MA-powersource", + "name": "MA-powersource" } ], "deviceVersions": [ + 1, 1 ], "deviceIdentifiers": [ - 21 + 21, + 17 ], "deviceTypeName": "MA-contactsensor", "deviceTypeCode": 21, @@ -2507,6 +2515,14 @@ "source": "client", "isIncoming": 1, "isEnabled": 1 + }, + { + "name": "TriggerEffect", + "code": 64, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 } ], "attributes": [ @@ -3008,6 +3024,352 @@ } ] }, + { + "name": "Power Source", + "code": 47, + "mfgCode": null, + "define": "POWER_SOURCE_CLUSTER", + "side": "server", + "enabled": 1, + "attributes": [ + { + "name": "Status", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "PowerSourceStatusEnum", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "Order", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "int8u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "Description", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "char_string", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "Battery", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "BatVoltage", + "code": 11, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "2590", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "BatPercentRemaining", + "code": 12, + "mfgCode": null, + "side": "server", + "type": "int8u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "98", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "BatTimeRemaining", + "code": 13, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "52560000", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "BatChargeLevel", + "code": 14, + "mfgCode": null, + "side": "server", + "type": "BatChargeLevelEnum", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "BatReplacementNeeded", + "code": 15, + "mfgCode": null, + "side": "server", + "type": "boolean", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "BatReplaceability", + "code": 16, + "mfgCode": null, + "side": "server", + "type": "BatReplaceabilityEnum", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "2", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "BatPresent", + "code": 17, + "mfgCode": null, + "side": "server", + "type": "boolean", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "BatReplacementDescription", + "code": 19, + "mfgCode": null, + "side": "server", + "type": "char_string", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "2x AA/LR6 Alkaline", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "BatCommonDesignation", + "code": 20, + "mfgCode": null, + "side": "server", + "type": "BatCommonDesignationEnum", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "2", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "BatApprovedChemistry", + "code": 23, + "mfgCode": null, + "side": "server", + "type": "BatApprovedChemistryEnum", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "BatQuantity", + "code": 25, + "mfgCode": null, + "side": "server", + "type": "int8u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "EndpointList", + "code": 31, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "GeneratedCommandList", + "code": 65528, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AcceptedCommandList", + "code": 65529, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "EventList", + "code": 65530, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AttributeList", + "code": 65531, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0A", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + }, { "name": "Boolean State", "code": 69, @@ -3064,6 +3426,22 @@ "maxInterval": 65534, "reportableChange": 0 }, + { + "name": "EventList", + "code": 65530, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "AttributeList", "code": 65531, @@ -3129,7 +3507,7 @@ { "endpointTypeName": "Anonymous Endpoint Type", "endpointTypeIndex": 1, - "profileId": 260, + "profileId": 259, "endpointId": 1, "networkId": 0, "parentEndpointIdentifier": null diff --git a/examples/chef/esp32/main/QRCodeScreen.cpp b/examples/chef/esp32/main/QRCodeScreen.cpp index 578f44003f435e..ac39b9498e9f21 100644 --- a/examples/chef/esp32/main/QRCodeScreen.cpp +++ b/examples/chef/esp32/main/QRCodeScreen.cpp @@ -42,6 +42,8 @@ #include #include +#include + // TODO need sensible library tag when put in library extern const char TAG[]; diff --git a/examples/chef/esp32/main/include/QRCodeScreen.h b/examples/chef/esp32/main/include/QRCodeScreen.h index e24fcd86d81e1a..f4994a3d6c372a 100644 --- a/examples/chef/esp32/main/include/QRCodeScreen.h +++ b/examples/chef/esp32/main/include/QRCodeScreen.h @@ -31,6 +31,7 @@ #if CONFIG_HAVE_DISPLAY #include +#include #include class QRCodeScreen : public Screen diff --git a/examples/chef/esp32/main/main.cpp b/examples/chef/esp32/main/main.cpp index 3744cacc225ef8..c5f29dc0f847d8 100644 --- a/examples/chef/esp32/main/main.cpp +++ b/examples/chef/esp32/main/main.cpp @@ -41,7 +41,6 @@ #include #include #include -#include #include #include diff --git a/examples/chef/telink/CMakeLists.txt b/examples/chef/telink/CMakeLists.txt index 71f0c549e6ed79..3c6b352e55b873 100755 --- a/examples/chef/telink/CMakeLists.txt +++ b/examples/chef/telink/CMakeLists.txt @@ -1,5 +1,5 @@ # -# Copyright (c) 2023 Project CHIP Authors +# Copyright (c) 2023-2024 Project CHIP Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # + cmake_minimum_required(VERSION 3.13.1) get_filename_component(CHIP_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/third_party/connectedhomeip REALPATH) @@ -24,47 +25,11 @@ include(${CHEF}/project_include.cmake) get_filename_component(GEN_DIR ${CHEF}/out/${SAMPLE_NAME}/zap-generated REALPATH) -if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/boards/${BOARD}.overlay") - set(LOCAL_DTC_OVERLAY_FILE "${CMAKE_CURRENT_SOURCE_DIR}/boards/${BOARD}.overlay") -else() - unset(LOCAL_DTC_OVERLAY_FILE) -endif() - -if(EXISTS "${CHIP_ROOT}/src/platform/telink/${BOARD}.overlay") - set(GLOBAL_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/${BOARD}.overlay") -else() - unset(GLOBAL_DTC_OVERLAY_FILE) -endif() - -if(EXISTS "${CHIP_ROOT}/src/platform/telink/${FLASH_SIZE}_flash.overlay") - set(FLASH_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/${FLASH_SIZE}_flash.overlay") - message(STATUS "Flash memory size is set to: " ${FLASH_SIZE} "b") -else() - set(FLASH_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/2m_flash.overlay") - message(STATUS "Flash memory size is set to: 2mb") -endif() - -if(DTC_OVERLAY_FILE) - set(DTC_OVERLAY_FILE - "${DTC_OVERLAY_FILE} ${GLOBAL_DTC_OVERLAY_FILE} ${FLASH_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}" - CACHE STRING "" FORCE - ) -else() - set(DTC_OVERLAY_FILE ${GLOBAL_DTC_OVERLAY_FILE} ${FLASH_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}) -endif() - -set(CONF_FILE prj.conf) - -# Load NCS/Zephyr build system -list(APPEND ZEPHYR_EXTRA_MODULES ${CHIP_ROOT}/config/telink/chip-module) -find_package(Zephyr HINTS $ENV{ZEPHYR_BASE}) - -project(chip-telink-chef-example) - +include(${TELINK_COMMON}/common.cmake) include(${CHIP_ROOT}/config/telink/app/enable-gnu-std.cmake) include(${CHIP_ROOT}/src/app/chip_data_model.cmake) -target_compile_options(app PRIVATE -fpermissive) +project(chip-telink-chef-example) target_include_directories(app PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} @@ -78,6 +43,7 @@ target_include_directories(app PRIVATE ${TELINK_COMMON}/common/include ${TELINK_COMMON}/util/include ${TELINK_COMMON}/app/include + ${TELINK_COMMON}/zephyr_ext ) if (CONFIG_CHIP_LIB_SHELL) @@ -96,9 +62,15 @@ target_sources(app PRIVATE src/AppTask.cpp ${TELINK_COMMON}/common/src/mainCommon.cpp ${TELINK_COMMON}/common/src/AppTaskCommon.cpp - ${TELINK_COMMON}/util/src/PWMDevice.cpp + ${TELINK_COMMON}/util/src/LEDManager.cpp ${TELINK_COMMON}/util/src/ButtonManager.cpp ${TELINK_COMMON}/util/src/ThreadUtil.cpp + ${TELINK_COMMON}/util/src/PWMManager.cpp + ${TELINK_COMMON}/zephyr_ext/zephyr_key_matrix.c + ${TELINK_COMMON}/zephyr_ext/zephyr_key_pool.c + ${TELINK_COMMON}/zephyr_ext/zephyr_led_pool.c + ${TELINK_COMMON}/zephyr_ext/zephyr_pwm_pool.c + ${TELINK_COMMON}/zephyr_ext/zephyr_ws2812.c ${CHEF}/common/stubs.cpp ) @@ -114,126 +86,5 @@ if(CONFIG_BOOTLOADER_MCUBOOT) endif() if (CONFIG_CHIP_PW_RPC) - -# Make all targets created below depend on zephyr_interface to inherit MCU-related compilation flags -link_libraries($) - -set(PIGWEED_ROOT "${CHIP_ROOT}/third_party/pigweed/repo") -include(${PIGWEED_ROOT}/pw_build/pigweed.cmake) -include(${PIGWEED_ROOT}/pw_protobuf_compiler/proto.cmake) - -include($ENV{PW_ROOT}/pw_assert/backend.cmake) -include($ENV{PW_ROOT}/pw_log/backend.cmake) -include($ENV{PW_ROOT}/pw_sys_io/backend.cmake) - -pw_set_module_config(pw_rpc_CONFIG pw_rpc.disable_global_mutex_config) -pw_set_backend(pw_log pw_log_basic) -pw_set_backend(pw_assert.check pw_assert_log.check_backend) -pw_set_backend(pw_assert.assert pw_assert.assert_compatibility_backend) -pw_set_backend(pw_sys_io pw_sys_io.telink) - -set(dir_pw_third_party_nanopb "${CHIP_ROOT}/third_party/nanopb/repo" CACHE STRING "" FORCE) - -add_subdirectory(third_party/connectedhomeip/third_party/pigweed/repo) -add_subdirectory(third_party/connectedhomeip/third_party/nanopb/repo) -add_subdirectory(third_party/connectedhomeip/examples/platform/telink/pw_sys_io) - -pw_proto_library(attributes_service - SOURCES - ${CHIP_ROOT}/examples/common/pigweed/protos/attributes_service.proto - INPUTS - ${CHIP_ROOT}/examples/common/pigweed/protos/attributes_service.options - PREFIX - attributes_service - STRIP_PREFIX - ${CHIP_ROOT}/examples/common/pigweed/protos - DEPS - pw_protobuf.common_proto -) - -pw_proto_library(descriptor_service - SOURCES - ${CHIP_ROOT}/examples/common/pigweed/protos/descriptor_service.proto - PREFIX - descriptor_service - STRIP_PREFIX - ${CHIP_ROOT}/examples/common/pigweed/protos - DEPS - pw_protobuf.common_proto -) - -pw_proto_library(device_service - SOURCES - ${CHIP_ROOT}/examples/common/pigweed/protos/device_service.proto - INPUTS - ${CHIP_ROOT}/examples/common/pigweed/protos/device_service.options - PREFIX - device_service - STRIP_PREFIX - ${CHIP_ROOT}/examples/common/pigweed/protos - DEPS - pw_protobuf.common_proto -) - -pw_proto_library(ot_cli_service - SOURCES - ${CHIP_ROOT}/examples/common/pigweed/protos/ot_cli_service.proto - INPUTS - ${CHIP_ROOT}/examples/common/pigweed/protos/ot_cli_service.options - STRIP_PREFIX - ${CHIP_ROOT}/examples/common/pigweed/protos - PREFIX - ot_cli_service - DEPS - pw_protobuf.common_proto -) - -pw_proto_library(thread_service - SOURCES - ${CHIP_ROOT}/examples/common/pigweed/protos/thread_service.proto - INPUTS - ${CHIP_ROOT}/examples/common/pigweed/protos/thread_service.options - STRIP_PREFIX - ${CHIP_ROOT}/examples/common/pigweed/protos - PREFIX - thread_service - DEPS - pw_protobuf.common_proto -) - -target_sources(app PRIVATE - ../../common/pigweed/RpcService.cpp - ../../common/pigweed/telink/PigweedLoggerMutex.cpp - ${TELINK_COMMON}/Rpc.cpp - ${TELINK_COMMON}/util/src/PigweedLogger.cpp -) - -target_include_directories(app PRIVATE - ${PIGWEED_ROOT}/pw_sys_io/public - ${CHIP_ROOT}/src/lib/support - ${CHIP_ROOT}/src/system - ${TELINK_COMMON} - ../../common - ../../common/pigweed - ../../common/pigweed/telink) - -target_compile_options(app PRIVATE - "-DPW_RPC_ATTRIBUTE_SERVICE=1" - "-DPW_RPC_DESCRIPTOR_SERVICE=1" - "-DPW_RPC_DEVICE_SERVICE=1" - "-DPW_RPC_THREAD_SERVICE=1" -) - -target_link_libraries(app PRIVATE - attributes_service.nanopb_rpc - descriptor_service.nanopb_rpc - device_service.nanopb_rpc - thread_service.nanopb_rpc - pw_checksum - pw_hdlc - pw_log - pw_rpc.server - pw_sys_io -) - + include(${TELINK_COMMON}/Rpc.cmake) endif(CONFIG_CHIP_PW_RPC) diff --git a/examples/chef/telink/include/AppConfig.h b/examples/chef/telink/include/AppConfig.h index b3092856c49902..b5c1335abf1774 100644 --- a/examples/chef/telink/include/AppConfig.h +++ b/examples/chef/telink/include/AppConfig.h @@ -20,8 +20,5 @@ // ---- Chef Example App Config ---- -#define APP_USE_EXAMPLE_START_BUTTON 0 -#define APP_USE_BLE_START_BUTTON 1 -#define APP_USE_THREAD_START_BUTTON 1 #define APP_SET_DEVICE_INFO_PROVIDER 1 #define APP_SET_NETWORK_COMM_ENDPOINT_SEC 0 diff --git a/examples/chef/telink/include/AppTask.h b/examples/chef/telink/include/AppTask.h index 3b91e9a3733786..13ede39ec8cfdb 100644 --- a/examples/chef/telink/include/AppTask.h +++ b/examples/chef/telink/include/AppTask.h @@ -20,6 +20,8 @@ #include "AppTaskCommon.h" +class ButtonManager; + class AppTask : public AppTaskCommon { public: @@ -28,6 +30,7 @@ class AppTask : public AppTaskCommon friend class AppTaskCommon; CHIP_ERROR Init(void); + void LinkButtons(ButtonManager & buttonManager); static AppTask sAppTask; }; diff --git a/examples/chef/telink/prj.conf b/examples/chef/telink/prj.conf index 5fdb2805860a94..72d253e97aa052 100755 --- a/examples/chef/telink/prj.conf +++ b/examples/chef/telink/prj.conf @@ -1,5 +1,5 @@ # -# Copyright (c) 2023 Project CHIP Authors +# Copyright (c) 2023-2024 Project CHIP Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ # limitations under the License. # -# This sample uses sample-defaults.conf to set options common for all +# This sample uses Kconfig.defaults to set options common for all # samples. This file should contain only options specific for this sample # or overrides of default values. diff --git a/examples/chef/telink/src/AppTask.cpp b/examples/chef/telink/src/AppTask.cpp index a9683f0d8c3610..4b3116d4fd675c 100644 --- a/examples/chef/telink/src/AppTask.cpp +++ b/examples/chef/telink/src/AppTask.cpp @@ -17,6 +17,7 @@ */ #include "AppTask.h" +#include "ButtonManager.h" #include LOG_MODULE_DECLARE(app, CONFIG_CHIP_APP_LOG_LEVEL); @@ -49,3 +50,10 @@ CHIP_ERROR AppTask::Init(void) return CHIP_NO_ERROR; } + +void AppTask::LinkButtons(ButtonManager & buttonManager) +{ + buttonManager.addCallback(FactoryResetButtonEventHandler, 0, true); + buttonManager.addCallback(ExampleActionButtonEventHandler, 1, true); + buttonManager.addCallback(StartBleAdvButtonEventHandler, 2, true); +} diff --git a/examples/chip-tool/commands/clusters/CustomArgument.h b/examples/chip-tool/commands/clusters/CustomArgument.h index f977cd20c1a027..c7d81414659755 100644 --- a/examples/chip-tool/commands/clusters/CustomArgument.h +++ b/examples/chip-tool/commands/clusters/CustomArgument.h @@ -24,6 +24,8 @@ #include #include +#include + #include "JsonParser.h" namespace { diff --git a/examples/chip-tool/commands/common/BDXDiagnosticLogsServerDelegate.cpp b/examples/chip-tool/commands/common/BDXDiagnosticLogsServerDelegate.cpp index 2a5b2d5d7c97a1..9be365ab27e2bf 100644 --- a/examples/chip-tool/commands/common/BDXDiagnosticLogsServerDelegate.cpp +++ b/examples/chip-tool/commands/common/BDXDiagnosticLogsServerDelegate.cpp @@ -18,6 +18,7 @@ #include "BDXDiagnosticLogsServerDelegate.h" +#include #include constexpr const char kTmpDir[] = "/tmp/"; diff --git a/examples/chip-tool/commands/common/CHIPCommand.cpp b/examples/chip-tool/commands/common/CHIPCommand.cpp index 29de06b5e0069c..c35eb11836d6c8 100644 --- a/examples/chip-tool/commands/common/CHIPCommand.cpp +++ b/examples/chip-tool/commands/common/CHIPCommand.cpp @@ -27,6 +27,8 @@ #include #include +#include + #if CHIP_CONFIG_TRANSPORT_TRACE_ENABLED #include "TraceDecoder.h" #include "TraceHandlers.h" diff --git a/examples/chip-tool/commands/common/CHIPCommand.h b/examples/chip-tool/commands/common/CHIPCommand.h index 55817b5213e589..50ab851d284502 100644 --- a/examples/chip-tool/commands/common/CHIPCommand.h +++ b/examples/chip-tool/commands/common/CHIPCommand.h @@ -37,7 +37,7 @@ #include #include -#pragma once +#include inline constexpr char kIdentityAlpha[] = "alpha"; inline constexpr char kIdentityBeta[] = "beta"; diff --git a/examples/chip-tool/commands/common/Command.cpp b/examples/chip-tool/commands/common/Command.cpp index 8d32a3fd1fc4f7..2c4f1eb3540e9f 100644 --- a/examples/chip-tool/commands/common/Command.cpp +++ b/examples/chip-tool/commands/common/Command.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include #include diff --git a/examples/chip-tool/commands/common/Command.h b/examples/chip-tool/commands/common/Command.h index 26b80e54b6b322..556716a5c1d2ca 100644 --- a/examples/chip-tool/commands/common/Command.h +++ b/examples/chip-tool/commands/common/Command.h @@ -30,6 +30,7 @@ #include #include #include +#include #include class Command; diff --git a/examples/chip-tool/commands/common/Commands.h b/examples/chip-tool/commands/common/Commands.h index bb6c62dcb035fe..e6a392cbeec248 100644 --- a/examples/chip-tool/commands/common/Commands.h +++ b/examples/chip-tool/commands/common/Commands.h @@ -24,6 +24,7 @@ #include "Command.h" #include +#include class Commands { diff --git a/examples/chip-tool/commands/common/CredentialIssuerCommands.h b/examples/chip-tool/commands/common/CredentialIssuerCommands.h index afb36773529e1e..fd096b31835723 100644 --- a/examples/chip-tool/commands/common/CredentialIssuerCommands.h +++ b/examples/chip-tool/commands/common/CredentialIssuerCommands.h @@ -20,6 +20,7 @@ #include #include +#include #include #include #include diff --git a/examples/chip-tool/commands/common/DeviceScanner.cpp b/examples/chip-tool/commands/common/DeviceScanner.cpp index 35d74bd06c844f..9d3dbca98f8db9 100644 --- a/examples/chip-tool/commands/common/DeviceScanner.cpp +++ b/examples/chip-tool/commands/common/DeviceScanner.cpp @@ -55,7 +55,7 @@ CHIP_ERROR DeviceScanner::Stop() void DeviceScanner::OnNodeDiscovered(const DiscoveredNodeData & nodeData) { - auto & commissionData = nodeData.commissionData; + auto & commissionData = nodeData.nodeData; auto discriminator = commissionData.longDiscriminator; auto vendorId = static_cast(commissionData.vendorId); diff --git a/examples/chip-tool/commands/common/DeviceScanner.h b/examples/chip-tool/commands/common/DeviceScanner.h index bcdcf26c84feb1..e8259ffc554897 100644 --- a/examples/chip-tool/commands/common/DeviceScanner.h +++ b/examples/chip-tool/commands/common/DeviceScanner.h @@ -25,6 +25,7 @@ #include #include +#include #include #include @@ -41,7 +42,7 @@ struct DeviceScannerResult chip::Optional mResolutionData; }; -class DeviceScanner : public chip::Dnssd::CommissioningResolveDelegate, +class DeviceScanner : public chip::Dnssd::DiscoverNodeDelegate, public chip::Dnssd::DnssdBrowseDelegate #if CONFIG_NETWORK_LAYER_BLE , @@ -55,7 +56,7 @@ class DeviceScanner : public chip::Dnssd::CommissioningResolveDelegate, CHIP_ERROR Get(uint16_t index, chip::Dnssd::CommonResolutionData & resolutionData); void Log() const; - /////////// CommissioningResolveDelegate Interface ///////// + /////////// DiscoverNodeDelegate Interface ///////// void OnNodeDiscovered(const chip::Dnssd::DiscoveredNodeData & nodeData) override; /////////// DnssdBrowseDelegate Interface ///////// diff --git a/examples/chip-tool/commands/common/RemoteDataModelLogger.cpp b/examples/chip-tool/commands/common/RemoteDataModelLogger.cpp index 37955e821e8b82..9e3026262db97d 100644 --- a/examples/chip-tool/commands/common/RemoteDataModelLogger.cpp +++ b/examples/chip-tool/commands/common/RemoteDataModelLogger.cpp @@ -209,7 +209,7 @@ CHIP_ERROR LogDiscoveredNodeData(const chip::Dnssd::DiscoveredNodeData & nodeDat VerifyOrReturnError(gDelegate != nullptr, CHIP_NO_ERROR); auto & resolutionData = nodeData.resolutionData; - auto & commissionData = nodeData.commissionData; + auto & commissionData = nodeData.nodeData; if (!chip::CanCastTo(resolutionData.numIPs)) { diff --git a/examples/chip-tool/commands/interactive/InteractiveCommands.cpp b/examples/chip-tool/commands/interactive/InteractiveCommands.cpp index 284c145cfe0569..92861f7711d566 100644 --- a/examples/chip-tool/commands/interactive/InteractiveCommands.cpp +++ b/examples/chip-tool/commands/interactive/InteractiveCommands.cpp @@ -22,6 +22,9 @@ #include +#include +#include + constexpr char kInteractiveModePrompt[] = ">>> "; constexpr char kInteractiveModeHistoryFileName[] = "chip_tool_history"; constexpr char kInteractiveModeStopCommand[] = "quit()"; diff --git a/examples/chip-tool/commands/interactive/InteractiveCommands.h b/examples/chip-tool/commands/interactive/InteractiveCommands.h index 88a33dcb26c96f..a3b66769ced308 100644 --- a/examples/chip-tool/commands/interactive/InteractiveCommands.h +++ b/examples/chip-tool/commands/interactive/InteractiveCommands.h @@ -24,6 +24,8 @@ #include +#include + class Commands; class InteractiveCommand : public CHIPCommand diff --git a/examples/chip-tool/commands/pairing/GetCommissionerNodeIdCommand.h b/examples/chip-tool/commands/pairing/GetCommissionerNodeIdCommand.h index 9d3d3deabd83d7..a541b1b9fe0f2d 100644 --- a/examples/chip-tool/commands/pairing/GetCommissionerNodeIdCommand.h +++ b/examples/chip-tool/commands/pairing/GetCommissionerNodeIdCommand.h @@ -19,6 +19,7 @@ #pragma once #include "../common/CHIPCommand.h" +#include "../common/RemoteDataModelLogger.h" class GetCommissionerNodeIdCommand : public CHIPCommand { diff --git a/examples/chip-tool/commands/pairing/GetCommissionerRootCertificateCommand.h b/examples/chip-tool/commands/pairing/GetCommissionerRootCertificateCommand.h index 7a350a9ca16bb8..f904cbbcfaa0a6 100644 --- a/examples/chip-tool/commands/pairing/GetCommissionerRootCertificateCommand.h +++ b/examples/chip-tool/commands/pairing/GetCommissionerRootCertificateCommand.h @@ -19,9 +19,12 @@ #pragma once #include "../common/CHIPCommand.h" +#include "../common/RemoteDataModelLogger.h" #include "ToTLVCert.h" +#include + class GetCommissionerRootCertificateCommand : public CHIPCommand { public: diff --git a/examples/chip-tool/commands/pairing/IssueNOCChainCommand.h b/examples/chip-tool/commands/pairing/IssueNOCChainCommand.h index 8b89f07f106006..a04ed4f3e9a27f 100644 --- a/examples/chip-tool/commands/pairing/IssueNOCChainCommand.h +++ b/examples/chip-tool/commands/pairing/IssueNOCChainCommand.h @@ -19,9 +19,12 @@ #pragma once #include "../common/CHIPCommand.h" +#include "../common/RemoteDataModelLogger.h" #include "ToTLVCert.h" +#include + class IssueNOCChainCommand : public CHIPCommand { public: diff --git a/examples/chip-tool/commands/pairing/PairingCommand.cpp b/examples/chip-tool/commands/pairing/PairingCommand.cpp index f872692dc45235..5ec206c25b7ea0 100644 --- a/examples/chip-tool/commands/pairing/PairingCommand.cpp +++ b/examples/chip-tool/commands/pairing/PairingCommand.cpp @@ -28,6 +28,8 @@ #include #include +#include + using namespace ::chip; using namespace ::chip::Controller; @@ -480,7 +482,7 @@ void PairingCommand::OnICDStayActiveComplete(NodeId deviceId, uint32_t promisedA void PairingCommand::OnDiscoveredDevice(const chip::Dnssd::DiscoveredNodeData & nodeData) { // Ignore nodes with closed commissioning window - VerifyOrReturn(nodeData.commissionData.commissioningMode != 0); + VerifyOrReturn(nodeData.nodeData.commissioningMode != 0); auto & resolutionData = nodeData.resolutionData; diff --git a/examples/chip-tool/commands/pairing/ToTLVCert.cpp b/examples/chip-tool/commands/pairing/ToTLVCert.cpp index 2c06b7f1629171..3a54d37d1a29e8 100644 --- a/examples/chip-tool/commands/pairing/ToTLVCert.cpp +++ b/examples/chip-tool/commands/pairing/ToTLVCert.cpp @@ -21,6 +21,8 @@ #include #include +#include + constexpr char kBase64Header[] = "base64:"; constexpr size_t kBase64HeaderLen = ArraySize(kBase64Header) - 1; diff --git a/examples/chip-tool/commands/payload/SetupPayloadGenerateCommand.cpp b/examples/chip-tool/commands/payload/SetupPayloadGenerateCommand.cpp index c6afc4a4715be5..1a9a7e4e4ab8e4 100644 --- a/examples/chip-tool/commands/payload/SetupPayloadGenerateCommand.cpp +++ b/examples/chip-tool/commands/payload/SetupPayloadGenerateCommand.cpp @@ -24,6 +24,8 @@ #include #include +#include + using namespace ::chip; void SetupPayloadGenerateCommand::ConfigurePayload(SetupPayload & payload) diff --git a/examples/chip-tool/commands/payload/SetupPayloadParseCommand.cpp b/examples/chip-tool/commands/payload/SetupPayloadParseCommand.cpp index 1bec63002776d4..7ab62c7da5101d 100644 --- a/examples/chip-tool/commands/payload/SetupPayloadParseCommand.cpp +++ b/examples/chip-tool/commands/payload/SetupPayloadParseCommand.cpp @@ -22,6 +22,8 @@ #include #include +#include + using namespace ::chip; namespace { diff --git a/examples/chip-tool/commands/payload/SetupPayloadParseCommand.h b/examples/chip-tool/commands/payload/SetupPayloadParseCommand.h index 08474023a1ff9f..925df0a51f1f00 100644 --- a/examples/chip-tool/commands/payload/SetupPayloadParseCommand.h +++ b/examples/chip-tool/commands/payload/SetupPayloadParseCommand.h @@ -21,6 +21,8 @@ #include "../common/Command.h" #include +#include + class SetupPayloadParseCommand : public Command { public: diff --git a/examples/chip-tool/commands/payload/SetupPayloadVerhoeff.cpp b/examples/chip-tool/commands/payload/SetupPayloadVerhoeff.cpp index 238e753708921c..d0dcc8ffaa8854 100644 --- a/examples/chip-tool/commands/payload/SetupPayloadVerhoeff.cpp +++ b/examples/chip-tool/commands/payload/SetupPayloadVerhoeff.cpp @@ -21,6 +21,8 @@ #include #include +#include + using namespace ::chip; CHIP_ERROR SetupPayloadVerhoeffVerify::Run() diff --git a/examples/chip-tool/commands/payload/SetupPayloadVerhoeff.h b/examples/chip-tool/commands/payload/SetupPayloadVerhoeff.h index 0f531e3dd822bb..bf61ead3589b12 100644 --- a/examples/chip-tool/commands/payload/SetupPayloadVerhoeff.h +++ b/examples/chip-tool/commands/payload/SetupPayloadVerhoeff.h @@ -21,6 +21,8 @@ #include "../common/Command.h" #include +#include + class SetupPayloadVerhoeffVerify : public Command { public: diff --git a/examples/common/pigweed/efr32/PigweedLoggerMutex.h b/examples/common/pigweed/efr32/PigweedLoggerMutex.h index 4df8b616895e39..a60b9a28f30141 100644 --- a/examples/common/pigweed/efr32/PigweedLoggerMutex.h +++ b/examples/common/pigweed/efr32/PigweedLoggerMutex.h @@ -20,8 +20,7 @@ #include "PigweedLogger.h" #include "pigweed/RpcService.h" -#include "semphr.h" -#include +#include namespace chip { namespace rpc { @@ -32,18 +31,18 @@ class PigweedLoggerMutex : public ::chip::rpc::Mutex PigweedLoggerMutex() {} void Lock() override { - SemaphoreHandle_t * sem = PigweedLogger::GetSemaphore(); + osMutexId_t * sem = PigweedLogger::GetMutex(); if (sem) { - xSemaphoreTake(*sem, portMAX_DELAY); + osMutexAcquire(*sem, osWaitForever); } } void Unlock() override { - SemaphoreHandle_t * sem = PigweedLogger::GetSemaphore(); + osMutexId_t * sem = PigweedLogger::GetMutex(); if (sem) { - xSemaphoreGive(*sem); + osMutexRelease(*sem); } } }; diff --git a/examples/common/pigweed/rpc_services/Attributes.h b/examples/common/pigweed/rpc_services/Attributes.h index 78e310f70ab5b5..e246c5361bd281 100644 --- a/examples/common/pigweed/rpc_services/Attributes.h +++ b/examples/common/pigweed/rpc_services/Attributes.h @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include diff --git a/examples/common/pigweed/rpc_services/Descriptor.h b/examples/common/pigweed/rpc_services/Descriptor.h index 48038831d62301..a6760cdcf61ce3 100644 --- a/examples/common/pigweed/rpc_services/Descriptor.h +++ b/examples/common/pigweed/rpc_services/Descriptor.h @@ -23,6 +23,7 @@ #include #include #include +#include #include namespace chip { diff --git a/examples/common/screen-framework/ScreenManager.cpp b/examples/common/screen-framework/ScreenManager.cpp index 0d3525956d3f35..6e2dfe141e03ec 100644 --- a/examples/common/screen-framework/ScreenManager.cpp +++ b/examples/common/screen-framework/ScreenManager.cpp @@ -30,6 +30,7 @@ #include #include +#include #include uint16_t ScreenFontHeight; diff --git a/examples/common/tracing/TraceDecoder.cpp b/examples/common/tracing/TraceDecoder.cpp index 1d6828b1dfe9b2..115c5d022712af 100644 --- a/examples/common/tracing/TraceDecoder.cpp +++ b/examples/common/tracing/TraceDecoder.cpp @@ -25,7 +25,9 @@ #include #include #include +#include #include +#include constexpr uint16_t kMaxLineLen = 4096; constexpr const char jsonPrefix[] = " json\t"; diff --git a/examples/common/tracing/TraceDecoder.h b/examples/common/tracing/TraceDecoder.h index 4630b556e329b7..9a99041578d94b 100644 --- a/examples/common/tracing/TraceDecoder.h +++ b/examples/common/tracing/TraceDecoder.h @@ -24,6 +24,8 @@ #include #include +#include + namespace chip { namespace trace { diff --git a/examples/common/websocket-server/WebSocketServer.cpp b/examples/common/websocket-server/WebSocketServer.cpp index 2dba035601ea0e..2f5fb9fd2bd0c9 100644 --- a/examples/common/websocket-server/WebSocketServer.cpp +++ b/examples/common/websocket-server/WebSocketServer.cpp @@ -23,6 +23,7 @@ #include #include +#include constexpr uint16_t kDefaultWebSocketServerPort = 9002; constexpr uint16_t kMaxMessageBufferLen = 8192; diff --git a/examples/contact-sensor-app/linux/main.cpp b/examples/contact-sensor-app/linux/main.cpp index 0b520bdd538e04..f1d2889c724377 100644 --- a/examples/contact-sensor-app/linux/main.cpp +++ b/examples/contact-sensor-app/linux/main.cpp @@ -17,7 +17,6 @@ */ #include -#include #include #if defined(CHIP_IMGUI_ENABLED) && CHIP_IMGUI_ENABLED diff --git a/examples/contact-sensor-app/nxp/k32w/k32w0/main/ZclCallbacks.cpp b/examples/contact-sensor-app/nxp/k32w/k32w0/main/ZclCallbacks.cpp index fafcb37290aab8..2a38dd8d1c84e2 100644 --- a/examples/contact-sensor-app/nxp/k32w/k32w0/main/ZclCallbacks.cpp +++ b/examples/contact-sensor-app/nxp/k32w/k32w0/main/ZclCallbacks.cpp @@ -27,7 +27,6 @@ #include #include #include -#include using namespace ::chip; using namespace ::chip::app; diff --git a/examples/contact-sensor-app/nxp/k32w/k32w1/main/ZclCallbacks.cpp b/examples/contact-sensor-app/nxp/k32w/k32w1/main/ZclCallbacks.cpp index 5937d134194c30..e69daab9803d23 100644 --- a/examples/contact-sensor-app/nxp/k32w/k32w1/main/ZclCallbacks.cpp +++ b/examples/contact-sensor-app/nxp/k32w/k32w1/main/ZclCallbacks.cpp @@ -28,7 +28,6 @@ #include #include #include -#include #if CONFIG_DIAG_LOGS_DEMO #include "DiagnosticLogsProviderDelegateImpl.h" diff --git a/examples/contact-sensor-app/telink/CMakeLists.txt b/examples/contact-sensor-app/telink/CMakeLists.txt index c29ef949914036..fb8098b36fdbee 100755 --- a/examples/contact-sensor-app/telink/CMakeLists.txt +++ b/examples/contact-sensor-app/telink/CMakeLists.txt @@ -1,5 +1,5 @@ # -# Copyright (c) 2022 Project CHIP Authors +# Copyright (c) 2022-2024 Project CHIP Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,60 +13,26 @@ # See the License for the specific language governing permissions and # limitations under the License. # + cmake_minimum_required(VERSION 3.13.1) get_filename_component(CHIP_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/third_party/connectedhomeip REALPATH) get_filename_component(TELINK_COMMON ${CHIP_ROOT}/examples/platform/telink REALPATH) get_filename_component(GEN_DIR ${CHIP_ROOT}/zzz_generated/ REALPATH) -if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/boards/${BOARD}.overlay") - set(LOCAL_DTC_OVERLAY_FILE "${CMAKE_CURRENT_SOURCE_DIR}/boards/${BOARD}.overlay") -else() - unset(LOCAL_DTC_OVERLAY_FILE) -endif() - -if(EXISTS "${CHIP_ROOT}/src/platform/telink/${BOARD}.overlay") - set(GLOBAL_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/${BOARD}.overlay") -else() - unset(GLOBAL_DTC_OVERLAY_FILE) -endif() - -if(EXISTS "${CHIP_ROOT}/src/platform/telink/${FLASH_SIZE}_flash.overlay") - set(FLASH_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/${FLASH_SIZE}_flash.overlay") - message(STATUS "Flash memory size is set to: " ${FLASH_SIZE} "b") -else() - set(FLASH_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/2m_flash.overlay") - message(STATUS "Flash memory size is set to: 2mb") -endif() - -if(DTC_OVERLAY_FILE) - set(DTC_OVERLAY_FILE - "${DTC_OVERLAY_FILE} ${GLOBAL_DTC_OVERLAY_FILE} ${FLASH_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}" - CACHE STRING "" FORCE - ) -else() - set(DTC_OVERLAY_FILE ${GLOBAL_DTC_OVERLAY_FILE} ${FLASH_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}) -endif() - -set(CONF_FILE prj.conf) - -# Load NCS/Zephyr build system -list(APPEND ZEPHYR_EXTRA_MODULES ${CHIP_ROOT}/config/telink/chip-module) -find_package(Zephyr HINTS $ENV{ZEPHYR_BASE}) - -project(chip-telink-contact-sensor-example) - +include(${TELINK_COMMON}/common.cmake) include(${CHIP_ROOT}/config/telink/app/enable-gnu-std.cmake) include(${CHIP_ROOT}/src/app/chip_data_model.cmake) -target_compile_options(app PRIVATE -fpermissive) +project(chip-telink-contact-sensor-example) target_include_directories(app PRIVATE include ${GEN_DIR}/app-common ${GEN_DIR}/contact-sensor-app ${TELINK_COMMON}/common/include - ${TELINK_COMMON}/util/include) + ${TELINK_COMMON}/util/include + ${TELINK_COMMON}/zephyr_ext) target_sources(app PRIVATE src/AppTask.cpp @@ -74,10 +40,15 @@ target_sources(app PRIVATE src/ZclCallbacks.cpp ${TELINK_COMMON}/common/src/mainCommon.cpp ${TELINK_COMMON}/common/src/AppTaskCommon.cpp - ${TELINK_COMMON}/util/src/LEDWidget.cpp + ${TELINK_COMMON}/util/src/LEDManager.cpp ${TELINK_COMMON}/util/src/ButtonManager.cpp ${TELINK_COMMON}/util/src/ThreadUtil.cpp - ${TELINK_COMMON}/util/src/PWMDevice.cpp) + ${TELINK_COMMON}/util/src/PWMManager.cpp + ${TELINK_COMMON}/zephyr_ext/zephyr_key_matrix.c + ${TELINK_COMMON}/zephyr_ext/zephyr_key_pool.c + ${TELINK_COMMON}/zephyr_ext/zephyr_led_pool.c + ${TELINK_COMMON}/zephyr_ext/zephyr_pwm_pool.c + ${TELINK_COMMON}/zephyr_ext/zephyr_ws2812.c) chip_configure_data_model(app INCLUDE_SERVER diff --git a/examples/contact-sensor-app/telink/include/AppConfig.h b/examples/contact-sensor-app/telink/include/AppConfig.h index feb2b82d7417fc..ecde0f2317eb92 100644 --- a/examples/contact-sensor-app/telink/include/AppConfig.h +++ b/examples/contact-sensor-app/telink/include/AppConfig.h @@ -19,11 +19,5 @@ #pragma once // ---- All Clusters Application example config ---- -#define APP_USE_EXAMPLE_START_BUTTON 1 -#define APP_USE_BLE_START_BUTTON 0 -#define APP_USE_THREAD_START_BUTTON 0 #define APP_SET_DEVICE_INFO_PROVIDER 1 #define APP_SET_NETWORK_COMM_ENDPOINT_SEC 0 -#if defined(CONFIG_BOARD_TLSR9518ADK80D) || defined(CONFIG_BOARD_TLSR9528A) -#define APP_USE_IDENTIFY_PWM 1 -#endif diff --git a/examples/contact-sensor-app/telink/include/AppTask.h b/examples/contact-sensor-app/telink/include/AppTask.h index 3ac0028c78e3bb..8d888daa25a6de 100644 --- a/examples/contact-sensor-app/telink/include/AppTask.h +++ b/examples/contact-sensor-app/telink/include/AppTask.h @@ -39,6 +39,7 @@ class AppTask : public AppTaskCommon friend class AppTaskCommon; CHIP_ERROR Init(void); + void LinkLeds(LedManager & ledManager); static void OnStateChanged(ContactSensorManager::State aState); diff --git a/examples/contact-sensor-app/telink/prj.conf b/examples/contact-sensor-app/telink/prj.conf index eefe9b944c8331..5eee03e2ce9a39 100755 --- a/examples/contact-sensor-app/telink/prj.conf +++ b/examples/contact-sensor-app/telink/prj.conf @@ -1,5 +1,5 @@ # -# Copyright (c) 2022-2023 Project CHIP Authors +# Copyright (c) 2022-2024 Project CHIP Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ # limitations under the License. # -# This sample uses sample-defaults.conf to set options common for all +# This sample uses Kconfig.defaults to set options common for all # samples. This file should contain only options specific for this sample # or overrides of default values. @@ -22,10 +22,6 @@ CONFIG_CHIP=y CONFIG_STD_CPP17=y -# CHIP configuration -CONFIG_CHIP_PROJECT_CONFIG="include/CHIPProjectConfig.h" -CONFIG_CHIP_OPENTHREAD_CONFIG="../../platform/telink/project_include/OpenThreadConfig.h" - # 32774 == 0x8006 (example contact-sensor-app) CONFIG_CHIP_DEVICE_PRODUCT_ID=32774 diff --git a/examples/contact-sensor-app/telink/src/AppTask.cpp b/examples/contact-sensor-app/telink/src/AppTask.cpp index dbcf9e1ce48405..8ddb43d7b7f084 100644 --- a/examples/contact-sensor-app/telink/src/AppTask.cpp +++ b/examples/contact-sensor-app/telink/src/AppTask.cpp @@ -17,6 +17,7 @@ */ #include "AppTask.h" +#include "LEDManager.h" #include @@ -25,25 +26,14 @@ LOG_MODULE_DECLARE(app, CONFIG_CHIP_APP_LOG_LEVEL); -namespace { -#if CONFIG_CHIP_ENABLE_APPLICATION_STATUS_LED -LEDWidget sContactSensorLED; -#endif -} // namespace - AppTask AppTask::sAppTask; CHIP_ERROR AppTask::Init(void) { -#if APP_USE_EXAMPLE_START_BUTTON SetExampleButtonCallbacks(ContactActionEventHandler); -#endif InitCommonParts(); -#if CONFIG_CHIP_ENABLE_APPLICATION_STATUS_LED - sContactSensorLED.Init(GPIO_DT_SPEC_GET(DT_ALIAS(led2), gpios)); - sContactSensorLED.Set(ContactSensorMgr().IsContactClosed()); -#endif + LedManager::getInstance().setLed(LedManager::EAppLed_App0, ContactSensorMgr().IsContactClosed()); UpdateDeviceState(); @@ -60,16 +50,12 @@ void AppTask::OnStateChanged(ContactSensorManager::State aState) if (ContactSensorManager::State::kContactClosed == aState) { LOG_INF("Contact state changed to CLOSED"); -#if CONFIG_CHIP_ENABLE_APPLICATION_STATUS_LED - sContactSensorLED.Set(true); -#endif + LedManager::getInstance().setLed(LedManager::EAppLed_App0, true); } else if (ContactSensorManager::State::kContactOpened == aState) { LOG_INF("Contact state changed to OPEN"); -#if CONFIG_CHIP_ENABLE_APPLICATION_STATUS_LED - sContactSensorLED.Set(false); -#endif + LedManager::getInstance().setLed(LedManager::EAppLed_App0, false); } if (sAppTask.IsSyncClusterToButtonAction()) @@ -155,8 +141,15 @@ void AppTask::UpdateDeviceStateInternal(intptr_t arg) /* get boolean state attribute value */ (void) app::Clusters::BooleanState::Attributes::StateValue::Get(1, &stateValueAttrValue); - ChipLogProgress(NotSpecified, "StateValue::Get : %d", stateValueAttrValue); + LedManager::getInstance().setLed(LedManager::EAppLed_App0, stateValueAttrValue); +} + +void AppTask::LinkLeds(LedManager & ledManager) +{ #if CONFIG_CHIP_ENABLE_APPLICATION_STATUS_LED - sContactSensorLED.Set(stateValueAttrValue); -#endif + ledManager.linkLed(LedManager::EAppLed_Status, 0); + ledManager.linkLed(LedManager::EAppLed_App0, 1); +#else + ledManager.linkLed(LedManager::EAppLed_App0, 0); +#endif // CONFIG_CHIP_ENABLE_APPLICATION_STATUS_LED } diff --git a/examples/darwin-framework-tool/commands/common/CHIPCommandBridge.mm b/examples/darwin-framework-tool/commands/common/CHIPCommandBridge.mm index 205b56d6a64e3d..bb232e3772135e 100644 --- a/examples/darwin-framework-tool/commands/common/CHIPCommandBridge.mm +++ b/examples/darwin-framework-tool/commands/common/CHIPCommandBridge.mm @@ -26,6 +26,9 @@ #include "MTRError_Utils.h" +#include +#include + static CHIPToolPersistentStorageDelegate * storage = nil; std::set CHIPCommandBridge::sDeferredCleanups; std::map CHIPCommandBridge::mControllers; diff --git a/examples/darwin-framework-tool/commands/interactive/InteractiveCommands.mm b/examples/darwin-framework-tool/commands/interactive/InteractiveCommands.mm index 2219b6231e63bc..2652e2c2364101 100644 --- a/examples/darwin-framework-tool/commands/interactive/InteractiveCommands.mm +++ b/examples/darwin-framework-tool/commands/interactive/InteractiveCommands.mm @@ -22,6 +22,8 @@ #include #include +#include + #include #include diff --git a/examples/dishwasher-app/asr/src/AppTask.cpp b/examples/dishwasher-app/asr/src/AppTask.cpp index 8e9cb88b8f5b34..8c038cfe3674e9 100644 --- a/examples/dishwasher-app/asr/src/AppTask.cpp +++ b/examples/dishwasher-app/asr/src/AppTask.cpp @@ -23,6 +23,7 @@ #include "qrcodegen.h" #include #include +#include #include #include #include diff --git a/examples/dishwasher-app/asr/src/DeviceCallbacks.cpp b/examples/dishwasher-app/asr/src/DeviceCallbacks.cpp index 23e6de9a118b03..9f9e7fd8d3e0e4 100644 --- a/examples/dishwasher-app/asr/src/DeviceCallbacks.cpp +++ b/examples/dishwasher-app/asr/src/DeviceCallbacks.cpp @@ -31,7 +31,6 @@ #include #include #include -#include #include #include #include diff --git a/examples/energy-management-app/energy-management-common/include/DeviceEnergyManagementDelegateImpl.h b/examples/energy-management-app/energy-management-common/include/DeviceEnergyManagementDelegateImpl.h index 973e1e622576a4..a61be0f3c1770c 100644 --- a/examples/energy-management-app/energy-management-common/include/DeviceEnergyManagementDelegateImpl.h +++ b/examples/energy-management-app/energy-management-common/include/DeviceEnergyManagementDelegateImpl.h @@ -20,7 +20,6 @@ #include "app/clusters/device-energy-management-server/device-energy-management-server.h" -#include #include #include diff --git a/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h b/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h index e6f5c8c324d91e..df0d08b76f7e4e 100644 --- a/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h +++ b/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h @@ -21,7 +21,6 @@ #include "app/clusters/energy-evse-server/energy-evse-server.h" #include -#include #include #include diff --git a/examples/energy-management-app/energy-management-common/include/device-energy-management-modes.h b/examples/energy-management-app/energy-management-common/include/device-energy-management-modes.h index 75d1a66fcb0f37..61c65892910ef9 100644 --- a/examples/energy-management-app/energy-management-common/include/device-energy-management-modes.h +++ b/examples/energy-management-app/energy-management-common/include/device-energy-management-modes.h @@ -19,7 +19,6 @@ #pragma once #include -#include #include #include #include diff --git a/examples/energy-management-app/energy-management-common/include/energy-evse-modes.h b/examples/energy-management-app/energy-management-common/include/energy-evse-modes.h index 97189b0069fa81..0e8fd42e21c6f7 100644 --- a/examples/energy-management-app/energy-management-common/include/energy-evse-modes.h +++ b/examples/energy-management-app/energy-management-common/include/energy-evse-modes.h @@ -19,7 +19,6 @@ #pragma once #include -#include #include #include #include diff --git a/examples/laundry-washer-app/nxp/common/main/ZclCallbacks.cpp b/examples/laundry-washer-app/nxp/common/main/ZclCallbacks.cpp index 0a26df6424b771..7602ab4d52ac21 100644 --- a/examples/laundry-washer-app/nxp/common/main/ZclCallbacks.cpp +++ b/examples/laundry-washer-app/nxp/common/main/ZclCallbacks.cpp @@ -25,7 +25,6 @@ #include #include #include -#include #include "laundry-washer-controls-delegate-impl.h" diff --git a/examples/light-switch-app/ameba/README.md b/examples/light-switch-app/ameba/README.md index bc7953a87f8da2..5af9d94f2c5983 100644 --- a/examples/light-switch-app/ameba/README.md +++ b/examples/light-switch-app/ameba/README.md @@ -26,11 +26,11 @@ The CHIP demo application is supported on - Pull docker image: - $ docker pull ghcr.io/project-chip/chip-build-ameba:42 + $ docker pull ghcr.io/project-chip/chip-build-ameba:47 - Run docker container: - $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:42 + $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:47 - Setup build environment: diff --git a/examples/light-switch-app/ameba/main/DeviceCallbacks.cpp b/examples/light-switch-app/ameba/main/DeviceCallbacks.cpp index 8463ccce3ada74..119fb710e5873e 100644 --- a/examples/light-switch-app/ameba/main/DeviceCallbacks.cpp +++ b/examples/light-switch-app/ameba/main/DeviceCallbacks.cpp @@ -28,7 +28,6 @@ #include #include #include -#include #include #include #include diff --git a/examples/light-switch-app/ameba/main/chipinterface.cpp b/examples/light-switch-app/ameba/main/chipinterface.cpp index 98bf21626b87a1..c141769ba7d483 100644 --- a/examples/light-switch-app/ameba/main/chipinterface.cpp +++ b/examples/light-switch-app/ameba/main/chipinterface.cpp @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/examples/light-switch-app/asr/src/AppTask.cpp b/examples/light-switch-app/asr/src/AppTask.cpp index f398b3496edd0c..6dcabc80a9e91c 100755 --- a/examples/light-switch-app/asr/src/AppTask.cpp +++ b/examples/light-switch-app/asr/src/AppTask.cpp @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include diff --git a/examples/light-switch-app/asr/src/DeviceCallbacks.cpp b/examples/light-switch-app/asr/src/DeviceCallbacks.cpp index e967094e0fbccd..80d2893d09aa72 100644 --- a/examples/light-switch-app/asr/src/DeviceCallbacks.cpp +++ b/examples/light-switch-app/asr/src/DeviceCallbacks.cpp @@ -31,7 +31,6 @@ #include #include #include -#include #include #include #include diff --git a/examples/light-switch-app/silabs/openthread.gni b/examples/light-switch-app/silabs/openthread.gni index 17cc5885460379..30c7efbde3d623 100644 --- a/examples/light-switch-app/silabs/openthread.gni +++ b/examples/light-switch-app/silabs/openthread.gni @@ -28,7 +28,7 @@ openthread_external_platform = # ICD Default configurations chip_enable_icd_server = true chip_subscription_timeout_resumption = false -sl_use_subscription_synching = true +sl_use_subscription_syncing = true # Openthread Configuration flags sl_ot_idle_interval_ms = 15000 # 15s Idle Intervals diff --git a/examples/light-switch-app/telink/CMakeLists.txt b/examples/light-switch-app/telink/CMakeLists.txt index 451727b9fe20ae..7b98b235ea66e1 100755 --- a/examples/light-switch-app/telink/CMakeLists.txt +++ b/examples/light-switch-app/telink/CMakeLists.txt @@ -1,5 +1,5 @@ # -# Copyright (c) 2022 Project CHIP Authors +# Copyright (c) 2022-2024 Project CHIP Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,53 +13,18 @@ # See the License for the specific language governing permissions and # limitations under the License. # + cmake_minimum_required(VERSION 3.13.1) get_filename_component(CHIP_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/third_party/connectedhomeip REALPATH) get_filename_component(TELINK_COMMON ${CHIP_ROOT}/examples/platform/telink REALPATH) get_filename_component(GEN_DIR ${CHIP_ROOT}/zzz_generated/ REALPATH) -if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/boards/${BOARD}.overlay") - set(LOCAL_DTC_OVERLAY_FILE "${CMAKE_CURRENT_SOURCE_DIR}/boards/${BOARD}.overlay") -else() - unset(LOCAL_DTC_OVERLAY_FILE) -endif() - -if(EXISTS "${CHIP_ROOT}/src/platform/telink/${BOARD}.overlay") - set(GLOBAL_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/${BOARD}.overlay") -else() - unset(GLOBAL_DTC_OVERLAY_FILE) -endif() - -if(EXISTS "${CHIP_ROOT}/src/platform/telink/${FLASH_SIZE}_flash.overlay") - set(FLASH_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/${FLASH_SIZE}_flash.overlay") - message(STATUS "Flash memory size is set to: " ${FLASH_SIZE} "b") -else() - set(FLASH_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/2m_flash.overlay") - message(STATUS "Flash memory size is set to: 2mb") -endif() - -if(DTC_OVERLAY_FILE) - set(DTC_OVERLAY_FILE - "${DTC_OVERLAY_FILE} ${GLOBAL_DTC_OVERLAY_FILE} ${FLASH_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}" - CACHE STRING "" FORCE - ) -else() - set(DTC_OVERLAY_FILE ${GLOBAL_DTC_OVERLAY_FILE} ${FLASH_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}) -endif() - -set(CONF_FILE prj.conf) - -# Load NCS/Zephyr build system -list(APPEND ZEPHYR_EXTRA_MODULES ${CHIP_ROOT}/config/telink/chip-module) -find_package(Zephyr HINTS $ENV{ZEPHYR_BASE}) - -project(chip-telink-light-switch-example) - +include(${TELINK_COMMON}/common.cmake) include(${CHIP_ROOT}/config/telink/app/enable-gnu-std.cmake) include(${CHIP_ROOT}/src/app/chip_data_model.cmake) -target_compile_options(app PRIVATE -fpermissive) +project(chip-telink-light-switch-example) target_include_directories(app PRIVATE include @@ -67,7 +32,8 @@ target_include_directories(app PRIVATE ${GEN_DIR}/light-switch-app ${TELINK_COMMON}/common/include ${TELINK_COMMON}/util/include - ${TELINK_COMMON}/app/include) + ${TELINK_COMMON}/app/include + ${TELINK_COMMON}/zephyr_ext) target_sources(app PRIVATE src/AppTask.cpp @@ -75,10 +41,15 @@ target_sources(app PRIVATE src/binding-handler.cpp ${TELINK_COMMON}/common/src/mainCommon.cpp ${TELINK_COMMON}/common/src/AppTaskCommon.cpp - ${TELINK_COMMON}/util/src/LEDWidget.cpp + ${TELINK_COMMON}/util/src/LEDManager.cpp ${TELINK_COMMON}/util/src/ButtonManager.cpp ${TELINK_COMMON}/util/src/ThreadUtil.cpp - ${TELINK_COMMON}/util/src/PWMDevice.cpp) + ${TELINK_COMMON}/util/src/PWMManager.cpp + ${TELINK_COMMON}/zephyr_ext/zephyr_key_matrix.c + ${TELINK_COMMON}/zephyr_ext/zephyr_key_pool.c + ${TELINK_COMMON}/zephyr_ext/zephyr_led_pool.c + ${TELINK_COMMON}/zephyr_ext/zephyr_pwm_pool.c + ${TELINK_COMMON}/zephyr_ext/zephyr_ws2812.c) chip_configure_data_model(app INCLUDE_SERVER @@ -89,155 +60,6 @@ if(CONFIG_BOOTLOADER_MCUBOOT) target_sources(app PRIVATE ${TELINK_COMMON}/util/src/OTAUtil.cpp) endif() -# Fix for unused swap parameter in: zephyr/include/zephyr/arch/riscv/irq.h:70 -add_compile_options(-Wno-error=unused-parameter) - if (CONFIG_CHIP_PW_RPC) - -# Make all targets created below depend on zephyr_interface to inherit MCU-related compilation flags -link_libraries($) - -set(PIGWEED_ROOT "${CHIP_ROOT}/third_party/pigweed/repo") -include(${PIGWEED_ROOT}/pw_build/pigweed.cmake) -include(${PIGWEED_ROOT}/pw_protobuf_compiler/proto.cmake) - -include($ENV{PW_ROOT}/pw_assert/backend.cmake) -include($ENV{PW_ROOT}/pw_log/backend.cmake) -include($ENV{PW_ROOT}/pw_sys_io/backend.cmake) - -pw_set_module_config(pw_rpc_CONFIG pw_rpc.disable_global_mutex_config) -pw_set_backend(pw_log pw_log_basic) -pw_set_backend(pw_assert.check pw_assert_log.check_backend) -pw_set_backend(pw_assert.assert pw_assert.assert_compatibility_backend) -pw_set_backend(pw_sys_io pw_sys_io.telink) - -set(dir_pw_third_party_nanopb "${CHIP_ROOT}/third_party/nanopb/repo" CACHE STRING "" FORCE) - -add_subdirectory(third_party/connectedhomeip/third_party/pigweed/repo) -add_subdirectory(third_party/connectedhomeip/third_party/nanopb/repo) -add_subdirectory(third_party/connectedhomeip/examples/platform/telink/pw_sys_io) - -pw_proto_library(attributes_service - SOURCES - ${CHIP_ROOT}/examples/common/pigweed/protos/attributes_service.proto - INPUTS - ${CHIP_ROOT}/examples/common/pigweed/protos/attributes_service.options - PREFIX - attributes_service - STRIP_PREFIX - ${CHIP_ROOT}/examples/common/pigweed/protos - DEPS - pw_protobuf.common_proto -) - -pw_proto_library(button_service - SOURCES - ${CHIP_ROOT}/examples/common/pigweed/protos/button_service.proto - PREFIX - button_service - STRIP_PREFIX - ${CHIP_ROOT}/examples/common/pigweed/protos - DEPS - pw_protobuf.common_proto -) - -pw_proto_library(descriptor_service - SOURCES - ${CHIP_ROOT}/examples/common/pigweed/protos/descriptor_service.proto - PREFIX - descriptor_service - STRIP_PREFIX - ${CHIP_ROOT}/examples/common/pigweed/protos - DEPS - pw_protobuf.common_proto -) - -pw_proto_library(device_service - SOURCES - ${CHIP_ROOT}/examples/common/pigweed/protos/device_service.proto - INPUTS - ${CHIP_ROOT}/examples/common/pigweed/protos/device_service.options - PREFIX - device_service - STRIP_PREFIX - ${CHIP_ROOT}/examples/common/pigweed/protos - DEPS - pw_protobuf.common_proto -) - -pw_proto_library(lighting_service - SOURCES - ${CHIP_ROOT}/examples/common/pigweed/protos/lighting_service.proto - STRIP_PREFIX - ${CHIP_ROOT}/examples/common/pigweed/protos - PREFIX - lighting_service - DEPS - pw_protobuf.common_proto -) - -pw_proto_library(ot_cli_service - SOURCES - ${CHIP_ROOT}/examples/common/pigweed/protos/ot_cli_service.proto - INPUTS - ${CHIP_ROOT}/examples/common/pigweed/protos/ot_cli_service.options - STRIP_PREFIX - ${CHIP_ROOT}/examples/common/pigweed/protos - PREFIX - ot_cli_service - DEPS - pw_protobuf.common_proto -) - -pw_proto_library(thread_service - SOURCES - ${CHIP_ROOT}/examples/common/pigweed/protos/thread_service.proto - INPUTS - ${CHIP_ROOT}/examples/common/pigweed/protos/thread_service.options - STRIP_PREFIX - ${CHIP_ROOT}/examples/common/pigweed/protos - PREFIX - thread_service - DEPS - pw_protobuf.common_proto -) - -target_sources(app PRIVATE - ../../common/pigweed/RpcService.cpp - ../../common/pigweed/telink/PigweedLoggerMutex.cpp - ${TELINK_COMMON}/Rpc.cpp - ${TELINK_COMMON}/util/src/PigweedLogger.cpp -) - -target_include_directories(app PRIVATE - ${PIGWEED_ROOT}/pw_sys_io/public - ${CHIP_ROOT}/src/lib/support - ${CHIP_ROOT}/src/system - ${TELINK_COMMON} - ../../common - ../../common/pigweed - ../../common/pigweed/telink) - -target_compile_options(app PRIVATE - "-DPW_RPC_ATTRIBUTE_SERVICE=1" - "-DPW_RPC_BUTTON_SERVICE=1" - "-DPW_RPC_DESCRIPTOR_SERVICE=1" - "-DPW_RPC_DEVICE_SERVICE=1" - "-DPW_RPC_LIGHTING_SERVICE=1" - "-DPW_RPC_THREAD_SERVICE=1") - -target_link_libraries(app PRIVATE - attributes_service.nanopb_rpc - button_service.nanopb_rpc - descriptor_service.nanopb_rpc - device_service.nanopb_rpc - lighting_service.nanopb_rpc - thread_service.nanopb_rpc - pw_checksum - pw_hdlc - pw_log - pw_rpc.server - pw_sys_io -) - + include(${TELINK_COMMON}/Rpc.cmake) endif(CONFIG_CHIP_PW_RPC) diff --git a/examples/light-switch-app/telink/include/AppConfig.h b/examples/light-switch-app/telink/include/AppConfig.h index 8258f39573039c..15715b0e8a0a27 100644 --- a/examples/light-switch-app/telink/include/AppConfig.h +++ b/examples/light-switch-app/telink/include/AppConfig.h @@ -20,11 +20,5 @@ // ---- Light Switch Example App Config ---- -#define APP_USE_EXAMPLE_START_BUTTON 1 -#define APP_USE_BLE_START_BUTTON 0 -#define APP_USE_THREAD_START_BUTTON 0 #define APP_SET_DEVICE_INFO_PROVIDER 1 #define APP_SET_NETWORK_COMM_ENDPOINT_SEC 0 -#if defined(CONFIG_BOARD_TLSR9518ADK80D) || defined(CONFIG_BOARD_TLSR9528A) -#define APP_USE_IDENTIFY_PWM 1 -#endif diff --git a/examples/light-switch-app/telink/prj.conf b/examples/light-switch-app/telink/prj.conf index ebb196bb76980f..99691f0ab11fdb 100755 --- a/examples/light-switch-app/telink/prj.conf +++ b/examples/light-switch-app/telink/prj.conf @@ -1,5 +1,5 @@ # -# Copyright (c) 2022-2023 Project CHIP Authors +# Copyright (c) 2022-2024 Project CHIP Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ # limitations under the License. # -# This sample uses sample-defaults.conf to set options common for all +# This sample uses Kconfig.defaults to set options common for all # samples. This file should contain only options specific for this sample # or overrides of default values. @@ -22,10 +22,6 @@ CONFIG_CHIP=y CONFIG_STD_CPP17=y -# CHIP configuration -CONFIG_CHIP_PROJECT_CONFIG="include/CHIPProjectConfig.h" -CONFIG_CHIP_OPENTHREAD_CONFIG="../../platform/telink/project_include/OpenThreadConfig.h" - # 32772 == 0x8004 (example light-switch-app) CONFIG_CHIP_DEVICE_PRODUCT_ID=32772 diff --git a/examples/light-switch-app/telink/src/AppTask.cpp b/examples/light-switch-app/telink/src/AppTask.cpp index 39b92cca42519d..96dcdd0b43ca48 100644 --- a/examples/light-switch-app/telink/src/AppTask.cpp +++ b/examples/light-switch-app/telink/src/AppTask.cpp @@ -25,9 +25,7 @@ AppTask AppTask::sAppTask; CHIP_ERROR AppTask::Init(void) { -#if APP_USE_EXAMPLE_START_BUTTON SetExampleButtonCallbacks(SwitchActionEventHandler); -#endif InitCommonParts(); // Configure Bindings diff --git a/examples/lighting-app/ameba/README.md b/examples/lighting-app/ameba/README.md index 44bc04a0811dc4..b496e1cde4ae91 100644 --- a/examples/lighting-app/ameba/README.md +++ b/examples/lighting-app/ameba/README.md @@ -23,11 +23,11 @@ The CHIP demo application is supported on - Pull docker image: - $ docker pull ghcr.io/project-chip/chip-build-ameba:42 + $ docker pull ghcr.io/project-chip/chip-build-ameba:47 - Run docker container: - $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:42 + $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:47 - Setup build environment: diff --git a/examples/lighting-app/ameba/main/DeviceCallbacks.cpp b/examples/lighting-app/ameba/main/DeviceCallbacks.cpp index 0ba785b9b9233e..7783e6818f5668 100644 --- a/examples/lighting-app/ameba/main/DeviceCallbacks.cpp +++ b/examples/lighting-app/ameba/main/DeviceCallbacks.cpp @@ -29,7 +29,6 @@ #include #include #include -#include #include #include #include diff --git a/examples/lighting-app/ameba/main/chipinterface.cpp b/examples/lighting-app/ameba/main/chipinterface.cpp index 1f05a9edb5b58e..461b8bea6143f6 100644 --- a/examples/lighting-app/ameba/main/chipinterface.cpp +++ b/examples/lighting-app/ameba/main/chipinterface.cpp @@ -31,7 +31,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/examples/lighting-app/asr/src/AppTask.cpp b/examples/lighting-app/asr/src/AppTask.cpp index b72ff5c8588f31..9bbd40af01a3a7 100755 --- a/examples/lighting-app/asr/src/AppTask.cpp +++ b/examples/lighting-app/asr/src/AppTask.cpp @@ -25,6 +25,7 @@ #include "qrcodegen.h" #include #include +#include #include #include #include diff --git a/examples/lighting-app/asr/src/DeviceCallbacks.cpp b/examples/lighting-app/asr/src/DeviceCallbacks.cpp index f486aba1f5d9e0..10dc52e7c22025 100644 --- a/examples/lighting-app/asr/src/DeviceCallbacks.cpp +++ b/examples/lighting-app/asr/src/DeviceCallbacks.cpp @@ -32,7 +32,6 @@ #include #include #include -#include #include #include #include diff --git a/examples/lighting-app/beken/main/DeviceCallbacks.cpp b/examples/lighting-app/beken/main/DeviceCallbacks.cpp index f2e5b099700d91..48b715feb76faf 100644 --- a/examples/lighting-app/beken/main/DeviceCallbacks.cpp +++ b/examples/lighting-app/beken/main/DeviceCallbacks.cpp @@ -30,7 +30,6 @@ #include #include #include -#include #include #include #include diff --git a/examples/lighting-app/cc13x2x7_26x2x7/.gn b/examples/lighting-app/cc13x2x7_26x2x7/.gn deleted file mode 100644 index cf974b2eb1df22..00000000000000 --- a/examples/lighting-app/cc13x2x7_26x2x7/.gn +++ /dev/null @@ -1,30 +0,0 @@ -# Copyright (c) 2020 Project CHIP Authors -# -# 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. - -import("//build_overrides/build.gni") - -# The location of the build configuration file. -buildconfig = "${build_root}/config/BUILDCONFIG.gn" - -# CHIP uses angle bracket includes. -check_system_includes = true - -default_args = { - target_cpu = "arm" - target_os = "freertos" - - import("//args.gni") - pw_build_PIP_REQUIREMENTS += - [ "${chip_root}/scripts/setup/requirements.ti.txt" ] -} diff --git a/examples/lighting-app/cc13x2x7_26x2x7/BUILD.gn b/examples/lighting-app/cc13x2x7_26x2x7/BUILD.gn deleted file mode 100644 index 1292b5f5e9626c..00000000000000 --- a/examples/lighting-app/cc13x2x7_26x2x7/BUILD.gn +++ /dev/null @@ -1,118 +0,0 @@ -# Copyright (c) 2020 Project CHIP Authors -# -# 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. - -import("//build_overrides/build.gni") -import("//build_overrides/chip.gni") -import("//build_overrides/openthread.gni") -import("//build_overrides/ti_simplelink_sdk.gni") - -import("${build_root}/config/defaults.gni") - -import("${chip_root}/src/platform/device.gni") - -import("${ti_simplelink_sdk_build_root}/ti_simplelink_executable.gni") -import("${ti_simplelink_sdk_build_root}/ti_simplelink_sdk.gni") - -assert(current_os == "freertos") - -project_dir = "${chip_root}/examples/lighting-app/cc13x2x7_26x2x7" - -ti_simplelink_sdk("sdk") { - include_dirs = [ "${project_dir}/include" ] - public_configs = [ ":lighting_app_config" ] -} - -ti_sysconfig("sysconfig") { - outputs = [ - "ti_radio_config.c", - "ti_radio_config.h", - "ti_drivers_config.c", - "ti_drivers_config.h", - "ti_ble_config.c", - "ti_ble_config.h", - "ti_dmm_application_policy.c", - "ti_dmm_application_policy.h", - ] - - if (chip_enable_ota_requestor) { - sources = [ "${project_dir}/chip_ota.syscfg" ] - } else { - sources = [ "${project_dir}/chip.syscfg" ] - outputs += [ - "ti_devices_config.c", - "ti_devices_config.h", - ] - } - - public_configs = [ ":sdk_cc13x2x7_26x2x7_dmm_config" ] - - cflags = [ - "-Wno-comment", - "@" + rebase_path("${target_gen_dir}/sysconfig/ti_ble_app_config.opt", - root_build_dir), - "@" + rebase_path("${target_gen_dir}/sysconfig/ti_build_config.opt", - root_build_dir), - ] -} - -ti_simplelink_executable("lighting_app") { - output_name = "chip-${ti_simplelink_board}-lighting-example.out" - - sources = [ - "${chip_root}/examples/providers/DeviceInfoProviderImpl.cpp", - "${project_dir}/src/AppTask.cpp", - "${project_dir}/src/LightingManager.cpp", - "${project_dir}/src/ZclCallbacks.cpp", - "${project_dir}/src/main.cpp", - ] - - deps = [ - ":sdk", - ":sysconfig", - "${chip_root}/examples/lighting-app/lighting-common", - "${chip_root}/examples/platform/cc13x2_26x2:cc13x2_26x2-attestation-credentials", - "${chip_root}/src/lib", - ] - - if (chip_openthread_ftd) { - deps += [ "${chip_root}/third_party/openthread/repo:libopenthread-ftd" ] - } else { - deps += [ "${chip_root}/third_party/openthread/repo:libopenthread-mtd" ] - } - - if (custom_factory_data) { - defines = [ "CC13XX_26XX_FACTORY_DATA" ] - } - - include_dirs = [ - "${project_dir}", - "${chip_root}/examples/providers/", - ] - - cflags = [ - "-Wno-implicit-fallthrough", - "-Wno-sign-compare", - "-Wconversion", - ] - - output_dir = root_out_dir -} - -group("cc13x2x7_26x2x7") { - deps = [ ":lighting_app" ] -} - -group("default") { - deps = [ ":cc13x2x7_26x2x7" ] -} diff --git a/examples/lighting-app/cc13x2x7_26x2x7/README.md b/examples/lighting-app/cc13x2x7_26x2x7/README.md deleted file mode 100644 index f6d77a423ac37a..00000000000000 --- a/examples/lighting-app/cc13x2x7_26x2x7/README.md +++ /dev/null @@ -1,297 +0,0 @@ -# Matter Lighting Example Application - -An example application showing the use of [Matter][matter] on the Texas -Instruments CC13XX_26XX family of Wireless MCUs. - ---- - -- [Matter Lighting Example Application](#matter-lighting-example-application) - - [Introduction](#introduction) - - [Device UI](#device-ui) - - [Building](#building) - - [Preparation](#preparation) - - [Compilation](#compilation) - - [Programming](#programming) - - [Code Composer Studio](#code-composer-studio) - - [UniFlash](#uniflash) - - [Viewing Logging Output](#viewing-logging-output) - - [Running the Example](#running-the-example) - - [TI Support](#ti-support) - ---- - -## Introduction - -The CC13XX_26XX lighting example application provides a working demonstration of -a connected light device. This uses the open-source Matter implementation and -the Texas Instruments SimpleLinkâ„¢ CC13XX and CC26XX software development kit. - -This example is enabled to build for CC2652R7 devices. - -The lighting example is intended to serve both as a means to explore the -workings of Matter, as well as a template for creating real products based on -the Texas Instruments devices. - -## Device UI - -| Action | Functionality | -| ------------------------------------------------ | -------------------------------------- | -| Left Button (`BTN-1`) Press (less than 1000 ms) | Light is turned on | -| Left Button (`BTN-1`) Press (more than 1000 ms) | Factory Reset | -| Right Button (`BTN-2`) Press (less than 1000 ms) | Light is turned off | -| Right Button (`BTN-2`) Press (more than 1000 ms) | BLE Advertisement (Enable/Disable) | -| Red LED Solid On State | Light is turned on | -| Red LED Off State | Light is turned off | -| Green LED Blinking State | Identify Trigger Effect in progress | -| Green LED Off State | No Identify Trigger Effect in progress | - -## Building - -### Preparation - -Some initial setup is necessary for preparing the build environment. This -section will need to be done when migrating to new versions of the SDK. This -guide assumes that the environment is linux based, and recommends Ubuntu 20.04. - -- Download and install [SysConfig][sysconfig]. This can be done simply with - the following commands. - - ``` - $ cd ~ - $ `wget https://dr-download.ti.com/software-development/ide-configuration-compiler-or-debugger/MD-nsUM6f7Vvb/1.16.2.3028/sysconfig-1.16.2_3028-setup.run` - $ chmod +x sysconfig-1.16.2_3028-setup.run - $ ./sysconfig-1.16.2_3028-setup.run - ``` - -- Run the bootstrap script to setup the build environment. - - ``` - $ cd ~/connectedhomeip - $ source ./scripts/bootstrap.sh - - ``` - -### Compilation - -It is necessary to activate the environment in every new shell. Then run GN and -Ninja to build the executable. - -- Activate the build environment with the repository activate script. - - ``` - $ cd ~/connectedhomeip - $ source ./scripts/activate.sh - - ``` - -- Run the build to produce a default executable. By default on Linux both the - TI SimpleLink SDK and Sysconfig are located in a `ti` folder in the user's - home directory, and you must provide the absolute path to them. For example - `/home/username/ti/sysconfig_1.16.2`. On Windows the default directory is - `C:\ti`. Take note of this install path, as it will be used in the next - step. - - ``` - $ cd ~/connectedhomeip/examples/lock-app/cc13x2x7_26x2x7 - $ gn gen out/debug --args="ti_sysconfig_root=\"$HOME/ti/sysconfig_1.16.2\"" - $ ninja -C out/debug - - ``` - - If you would like to define arguments on the command line you may add them - to the GN call. - - - ``` - gn gen out/debug --args="ti_sysconfig_root=\"$HOME/ti/sysconfig_1.16.2\"" - ``` - -## Programming - -Loading the built image onto a LaunchPad is supported through two methods; -Uniflash and Code Composer Studio (CCS). UniFlash can be used to load the image. -Code Composer Studio can be used to load the image and debug the source code. - -### Code Composer Studio - -Programming with CCS will allow for a full debug environment within the IDE. -This is accomplished by creating a target connection to the XDS110 debugger and -starting a project-less debug session. The CCS IDE will attempt to find the -source files on the local machine based on the debug information embedded within -the ELF. CCS may prompt you to find the source code if the image was built on -another machine or the source code is located in a different location than is -recorded within the ELF. - -Download and install [Code Composer Studio][ccs]. - -First open CCS and create a new workspace. - -Create a target connection (sometimes called the CCXML) for your target SoC and -debugger as described in the [Manual Method][ccs_manual_method] section of the -CCS User's Guide. - -Next initiate a project-less debug session as described in the [Manual -Launch][ccs_manual_launch] section of the CCS User's Guide. - -CCS should switch to the debug view described in the [After -Launch][ccs_after_launch] section of the User's Guide. The SoC core will likely -be disconnected and symbols will not be loaded. Connect to the core as described -in the [Debug View][ccs_debug_view] section of the User's Guide. Once the core -is connected, use the `Load` button on the toolbar to load the ELF image. - -Note that the default configuration of the CCXML uses 2-wire cJTAG instead of -the full 4-wire JTAG connection to match the default jumper configuration of the -LaunchPad. - -### UniFlash - -Uniflash is Texas Instrument's uniform programming tool for embedded processors. -This will allow you to erase, flash, and inspect the SoC without setting up a -debugging environment. - -Download and install [UniFlash][uniflash]. - -First open UniFlash. Debug probes connected to the computer will usually be -displayed under the Detected Devices due to the automatic device detection -feature. If your device does not show up in this view it my be disconnected, or -you may have to create a New Configuration. If you already have a CCXML for your -SoC and debug connection you can use that in the section at the bottom. Once -your device is selected, click the `Start` button within the section to launch -the session. - -Select the ELF image to load on the device with the `Browse` button. This file -is placed in the `out/debug` folder by this guide and ends with the `*.out` file -extension. For OTA enabled applications, the standalone image will instead end -with the `*-bim.hex` file extension. This this is a combined image with -application and and `BIM` included. The flag to enable or disable the OTA -feature is determined by "chip_enable_ota_requestor" in the application's -args.gni file. - -Finally click the `Load Image` button to load the executable image onto the -device. You should be able to see the log output over the XDS110 User UART. - -Note that programming the device through JTAG sets the Halt-in-Boot flag and may -cause issues when performing a software reset. This flag can be reset by -power-cycling the LaunchPad. - -## Viewing Logging Output - -By default the log output will be sent to the Application/User UART. Open a -terminal emulator to that port to see the output with the following options: - -| Parameter | Value | -| ------------ | -------- | -| Speed (baud) | `115200` | -| Data bits | `8` | -| Stop bits | `1` | -| Parity | `None` | -| Flow control | `None` | - -## Running the Example - -Once a device has been flashed with this example, it can now join and operate in -an existing Matter network. The following sections assume that a Matter network -is already active, and has at least one [OpenThread Border -Router][ot_border_router_setup]. - -For insight into what other components are needed to run this example, please -refer to our [Matter Getting Started Guide][matter-e2e-faq]. - -The steps below should be followed to commission the lighting device onto the -network and control it once it has been commissioned. - -**Step 0** - -Set up the CHIP tool by following the instructions outlined in our [Matter -Getting Started Guide][matter-e2e-faq]. - -**Step 1** - -Commission the light device onto the Matter network. Run the following command -on the CHIP tool: - -``` - -./chip-tool pairing ble-thread hex: 20202021 3840 - -``` - -Interacting with the application begins by enabling BLE advertisements and then -pairing the device into a Thread network. To provision this example onto a -Matter network, the device must be discoverable over Bluetooth LE. - -On the LaunchPad, press and hold the right button, labeled `BTN-2`, for more -than 1 second. Upon release, the Bluetooth LE advertising will begin. Once the -device is fully provisioned, BLE advertising will stop. - -Once the device has been successfully commissioned, you will see the following -message on the CHIP tool output: - -``` - -[1677648218.370754][39785:39790] CHIP:CTL: Received CommissioningComplete response, errorCode=0 -[1677648218.370821][39785:39790] CHIP:CTL: Successfully finished commissioning step 'SendComplete' - -``` - -An accompanying message will be seen from the device: - -``` - -Commissioning complete, notify platform driver to persist network credentials. - -``` - -**Step 2** - -Send commands to the lighting app. Here are some example commands: - -On - -``` -./chip-tool onoff on 1 -./chip-tool onoff toggee 1 (assuming the light is off) - -``` - -Off - -``` -./chip-tool onoff off 1 -./chip-tool onoff toggle 1 (assuming the light is on) - -``` - -Identify - -``` -./chip-tool identify identify 1 e.g. ./chip-tool identify identify 100 1 1 - -./chip-tool identify trigger-effect e.g. ./chip-tool identify trigger-effect 0x0000 0 1 1 - -``` - -## TI Support - -For technical support, please consider creating a post on TI's [E2E forum][e2e]. -Additionally, we welcome any feedback. - -[matter]: https://csa-iot.org/all-solutions/matter/ -[ccs]: https://www.ti.com/tool/CCSTUDIO -[ccs_after_launch]: - https://software-dl.ti.com/ccs/esd/documents/users_guide/ccs_debug-main.html?configuration#after-launch -[ccs_debug_view]: - https://software-dl.ti.com/ccs/esd/documents/users_guide/ccs_debug-main.html?configuration#debug-view -[ccs_manual_launch]: - https://software-dl.ti.com/ccs/esd/documents/users_guide/ccs_debug-main.html?configuration#manual-launch -[ccs_manual_method]: - https://software-dl.ti.com/ccs/esd/documents/users_guide/ccs_debug-main.html?configuration#manual-method -[e2e]: - https://e2e.ti.com/support/wireless-connectivity/zigbee-thread-group/zigbee-and-thread/f/zigbee-thread-forum -[matter-e2e-faq]: - https://e2e.ti.com/support/wireless-connectivity/zigbee-thread-group/zigbee-and-thread/f/zigbee-thread-forum/1082428/faq-cc2652r7-matter----getting-started-guide -[sysconfig]: https://www.ti.com/tool/SYSCONFIG -[ti_thread_dnd]: - https://www.ti.com/wireless-connectivity/thread/design-development.html -[ot_border_router_setup]: https://openthread.io/guides/border-router/build -[uniflash]: https://www.ti.com/tool/download/UNIFLASH diff --git a/examples/lighting-app/cc13x2x7_26x2x7/args.gni b/examples/lighting-app/cc13x2x7_26x2x7/args.gni deleted file mode 100644 index 8f2c82446b1cf0..00000000000000 --- a/examples/lighting-app/cc13x2x7_26x2x7/args.gni +++ /dev/null @@ -1,53 +0,0 @@ -# Copyright (c) 2020 Project CHIP Authors -# -# 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. - -import("//build_overrides/chip.gni") -import("${chip_root}/config/standalone/args.gni") -import("${chip_root}/examples/platform/cc13x2_26x2/args.gni") - -ti_simplelink_sdk_target = get_label_info(":sdk", "label_no_toolchain") -ti_simplelink_sysconfig_target = - get_label_info(":sysconfig", "label_no_toolchain") - -ti_simplelink_board = "LP_CC2652R7" - -# Size Optimizations -# use -Os instead of -Og, LWIP release build -optimize_debug_level = "s" -lwip_debug = false - -chip_enable_ota_requestor = true - -chip_openthread_ftd = false -openthread_external_platform = "${chip_root}/third_party/openthread/platforms/cc13x2_26x2:libopenthread-cc13x2_cc26x2" - -# Disable CHIP Logging -chip_progress_logging = false - -#chip_detail_logging = false -chip_automation_logging = false - -# BLE options -chip_config_network_layer_ble = true - -# Disable lock tracking, since our FreeRTOS configuration does not set -# INCLUDE_xSemaphoreGetMutexHolder -chip_stack_lock_tracking = "none" - -matter_device_vid = "0xFFF1" -matter_device_pid = "0x8005" -matter_software_ver = "0x0001" -matter_software_ver_str = "1.0d1" - -custom_factory_data = true diff --git a/examples/lighting-app/cc13x2x7_26x2x7/build_overrides b/examples/lighting-app/cc13x2x7_26x2x7/build_overrides deleted file mode 120000 index e578e73312ebd1..00000000000000 --- a/examples/lighting-app/cc13x2x7_26x2x7/build_overrides +++ /dev/null @@ -1 +0,0 @@ -../../build_overrides \ No newline at end of file diff --git a/examples/lighting-app/cc13x2x7_26x2x7/chip.syscfg b/examples/lighting-app/cc13x2x7_26x2x7/chip.syscfg deleted file mode 100644 index d190703b5322b7..00000000000000 --- a/examples/lighting-app/cc13x2x7_26x2x7/chip.syscfg +++ /dev/null @@ -1,237 +0,0 @@ -/* - * - * Copyright (c) 2020 Project CHIP Authors - * Copyright (c) 2020 Texas Instruments Incorporated - * All rights reserved. - * - * 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. - */ - - -/* Modules */ -var AESCCM = scripting.addModule("/ti/drivers/AESCCM"); -var AESECB = scripting.addModule("/ti/drivers/AESECB"); -var Button = scripting.addModule("/ti/drivers/apps/Button"); -var LED = scripting.addModule("/ti/drivers/apps/LED"); -var NVS = scripting.addModule("/ti/drivers/NVS"); -var RF = scripting.addModule("/ti/drivers/RF"); -var RFDesign = scripting.addModule("ti/devices/radioconfig/rfdesign"); -var RFCustom = scripting.addModule("/ti/devices/radioconfig/custom"); -var TRNG = scripting.addModule("/ti/drivers/TRNG"); -var SHA2 = scripting.addModule("/ti/drivers/SHA2"); -var UART2 = scripting.addModule("/ti/drivers/UART2"); -var ble = scripting.addModule("/ti/ble5stack/ble"); -var dmm = scripting.addModule("/ti/dmm/dmm"); -var AESCTRDRBG = scripting.addModule("/ti/drivers/AESCTRDRBG"); -var ECDH = scripting.addModule("/ti/drivers/ECDH"); - -/* Instances */ -var AESCCM1 = AESCCM.addInstance(); -var AESECB1 = AESECB.addInstance(); -var AESECB2 = AESECB.addInstance(); -var Button1 = Button.addInstance(); -var Button2 = Button.addInstance(); -var NVS1 = NVS.addInstance(); -var NVS2 = NVS.addInstance(); -var SHA21 = SHA2.addInstance(); -var LED1 = LED.addInstance(); -var LED2 = LED.addInstance(); -var TRNG1 = TRNG.addInstance(); -var TRNG2 = TRNG.addInstance(); -var TRNG3 = TRNG.addInstance(); -var UART2 = UART2.addInstance(); -var AESCTRDRBG1 = AESCTRDRBG.addInstance(); -var ECDH1 = ECDH.addInstance(); - -AESCTRDRBG1.$name = "CONFIG_AESCTRDRBG_0"; - -AESCCM1.$name = "CONFIG_AESCCM0"; - -AESECB1.$name = "CONFIG_AESECB0"; -AESECB2.$name = "CONFIG_AESECB_1"; - -ECDH1.$name = "CONFIG_ECDH0"; - -/* Left Button */ -Button1.$name = "CONFIG_BTN_LEFT"; -Button1.$hardware = system.deviceData.board.components["BTN-1"]; -Button1.gpioPin.$name = "CONFIG_GPIO_BTN1"; -Button1.gpioPin.pull = "Pull Up"; -Button1.gpioPin.interruptTrigger = "Falling Edge"; - -/* Left Button */ -Button2.$name = "CONFIG_BTN_RIGHT"; -Button2.$hardware = system.deviceData.board.components["BTN-2"]; -Button2.gpioPin.$name = "CONFIG_GPIO_BTN2"; -Button2.gpioPin.pull = "Pull Up"; -Button2.gpioPin.interruptTrigger = "Falling Edge"; - -/* ======== CCFG ======== */ -var CCFG = scripting.addModule("/ti/devices/CCFG"); -const ccfgSettings = system.getScript("/ti/common/lprf_ccfg_settings.js").ccfgSettings; -for(var setting in ccfgSettings) -{ - CCFG[setting] = ccfgSettings[setting]; -} - -CCFG.enableCodeGeneration = true; - -/* NVS */ -NVS1.$name = "CONFIG_NVSINTERNAL"; -NVS1.internalFlash.regionBase = 0xAA000; -NVS1.internalFlash.regionSize = 0x4000; - -NVS2.$name = "CONFIG_NVSEXTERNAL"; -NVS2.nvsType = "External"; // NVS Region Type -NVS2.$hardware = system.deviceData.board.components.MX25R8035F; - -/* RF */ -/* if an antenna component exists, assign it to the rf instance */ -if (system.deviceData.board && system.deviceData.board.components.RF) { - RF.$hardware = system.deviceData.board.components.RF; -} - -const rfDesignSettings = system.getScript("/ti/common/lprf_rf_design_settings.js").rfDesignSettings; -for(var setting in rfDesignSettings) -{ - RFDesign[setting] = rfDesignSettings[setting]; -} - -/* Handling for RF frontend characterization */ -if(RFDesign.rfDesign.match(/LP_CC2652PSIP/)) -{ - RFCustom.ieee = ["ieee154p10"]; - var rfCodeExportConfig = RFCustom.radioConfigieee154p10.codeExportConfig -} -else -{ - RFCustom.ieee = ["ieee154"]; - var rfCodeExportConfig = RFCustom.radioConfigieee154.codeExportConfig -} - -var cmdList = [ - "cmdIeeeTx", - "cmdIeeeRx", - "cmdIeeeCsma", - "cmdIeeeEdScan", - "cmdIeeeRxAck", - "cmdTxTest" -]; - -rfCodeExportConfig.useConst = true; -rfCodeExportConfig.useMulti = true; -rfCodeExportConfig.symGenMethod = "Custom"; - -const deviceId = system.deviceData.deviceId; - -// Add high PA options if present -if(deviceId.match(/CC(265[12]R|2674R|1352R1|1354R)/)) -{ - cmdList.push("cmdRadioSetup"); - rfCodeExportConfig.cmdRadioSetup = "RF_cmdIeeeRadioSetup"; -} -else if(deviceId.match(/CC(265[12]P|2674P|1352P)/)) -{ - cmdList.push("cmdRadioSetupPa"); - rfCodeExportConfig.cmdRadioSetupPa = "RF_cmdIeeeRadioSetup"; - rfCodeExportConfig.paExport = "combined"; -} -else if(deviceId.match(/CC(265[34]|1354)P/)) -{ - cmdList.push("cmdRadioSetupPa"); - rfCodeExportConfig.cmdRadioSetupPa = "RF_cmdIeeeRadioSetup"; - // currently not characterized for high PA -} -else -{ - throw new Error("Could not match platform to any known platform types"); -} - -rfCodeExportConfig.cmdList_ieee_15_4 = cmdList; - -/* Red LED */ -LED1.$name = "CONFIG_LED_RED"; -LED1.$hardware = system.deviceData.board.components.LED_RED; -LED1.gpioPin.$name = "CONFIG_GPIO_RLED"; -LED1.gpioPin.mode = "Output"; -LED1.gpioPin.callbackFunction = ""; - -/* Green LED */ -LED2.$name = "CONFIG_LED_GREEN"; -LED2.$hardware = system.deviceData.board.components.LED_GREEN; -LED2.gpioPin.$name = "CONFIG_GPIO_GLED"; -LED2.gpioPin.mode = "Output"; -LED2.gpioPin.callbackFunction = ""; - -/* Debug UART */ -UART2.$hardware = system.deviceData.board.components.XDS110UART; -UART2.$name = "CONFIG_UART2_DEBUG"; - -/* TRNG */ -TRNG1.$name = "CONFIG_TRNG_0"; -TRNG2.$name = "CONFIG_TRNG_THREAD"; -TRNG3.$name = "CONFIG_TRNG_APP"; - -/* BLE */ -ble.addressMode = "ADDRMODE_RP_WITH_PUBLIC_ID"; -ble.maxConnNum = 1; -ble.numOfAdvSets = 1; -ble.lockProject = true; -ble.oneLibSizeOpt = true; -ble.maxPDUSize = 255; -ble.radioConfig.codeExportConfig.$name = "ti_devices_radioconfig_code_export_param2"; -ble.connUpdateParamsPeripheral.$name = "ti_ble5stack_general_ble_conn_update_params0"; -ble.connUpdateParamsPeripheral.reqMinConnInt = 30; -ble.connUpdateParamsPeripheral.reqMaxConnInt = 50; - - -ble.advSet1.$name = "ti_ble5stack_broadcaster_advertisement_set0"; -ble.advSet1.advParam1.$name = "ti_ble5stack_broadcaster_advertisement_params0"; - -/* DMM */ -dmm.project = "ti_thread_thermostat_remote_display"; -dmm.stackRoles = ["blePeripheral","threadFTD"]; -dmm.lockStackRoles = true; -dmm.numApplicationStates = 10; -dmm.applicationState0 = "ANY"; -dmm.applicationState1 = "DMMPOLICY_BLE_IDLE"; -dmm.applicationState2 = "DMMPOLICY_BLE_ADV"; -dmm.applicationState3 = "DMMPOLICY_BLE_CONNECTING"; -dmm.applicationState4 = "DMMPOLICY_BLE_HIGH_BANDWIDTH"; -dmm.applicationState5 = "DMMPOLICY_BLE_CONNECTED"; -dmm.applicationState6 = "DMMPOLICY_BLE_OAD"; -dmm.applicationState7 = "DMMPOLICY_THREAD_IDLE"; -dmm.applicationState8 = "DMMPOLICY_THREAD_LINK_EST"; -dmm.applicationState9 = "DMMPOLICY_THREAD_DATA"; -dmm.policyArray.create(4); -dmm.policyArray[0].$name = "ti_dmm_policy_dmm_policy0"; -dmm.policyArray[0].blePeripheral.$name = "ti_dmm_policy_stack_dmm_stack_ble0"; -dmm.policyArray[0].blePeripheral.applicationStates = ["applicationState6"]; -dmm.policyArray[0].threadFTD.$name = "ti_dmm_policy_stack_dmm_stack_thread0"; -dmm.policyArray[0].threadFTD.pause = "DMMPOLICY_PAUSED"; -dmm.policyArray[1].$name = "ti_dmm_policy_dmm_policy1"; -dmm.policyArray[1].blePeripheral.$name = "ti_dmm_policy_stack_dmm_stack_ble1"; -dmm.policyArray[1].blePeripheral.applicationStates = ["applicationState3","applicationState4"]; -dmm.policyArray[1].blePeripheral.weight = 25; -dmm.policyArray[1].blePeripheral.appliedActivity = ["DMMPOLICY_APPLIED_ACTIVITY_BLE_CONNECTION"]; -dmm.policyArray[1].threadFTD.$name = "ti_dmm_policy_stack_dmm_stack_thread1"; -dmm.policyArray[2].$name = "ti_dmm_policy_dmm_policy2"; -dmm.policyArray[2].blePeripheral.$name = "ti_dmm_policy_stack_dmm_stack_ble2"; -dmm.policyArray[2].threadFTD.$name = "ti_dmm_policy_stack_dmm_stack_thread2"; -dmm.policyArray[2].threadFTD.weight = 30; -dmm.policyArray[2].threadFTD.applicationStates = ["applicationState8"]; -dmm.policyArray[2].threadFTD.appliedActivity = ["DMMPOLICY_APPLIED_ACTIVITY_ALL"]; -dmm.policyArray[3].$name = "ti_dmm_policy_dmm_policy3"; -dmm.policyArray[3].blePeripheral.$name = "ti_dmm_policy_stack_dmm_stack_ble3"; -dmm.policyArray[3].threadFTD.$name = "ti_dmm_policy_stack_dmm_stack_thread3"; -dmm.policyArray[3].threadFTD.weight = 1; diff --git a/examples/lighting-app/cc13x2x7_26x2x7/chip_ota.syscfg b/examples/lighting-app/cc13x2x7_26x2x7/chip_ota.syscfg deleted file mode 100644 index 995ad22af6b435..00000000000000 --- a/examples/lighting-app/cc13x2x7_26x2x7/chip_ota.syscfg +++ /dev/null @@ -1,238 +0,0 @@ -/* - * - * Copyright (c) 2020 Project CHIP Authors - * Copyright (c) 2020 Texas Instruments Incorporated - * All rights reserved. - * - * 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. - */ - - -/* Modules */ -var AESCCM = scripting.addModule("/ti/drivers/AESCCM"); -var AESECB = scripting.addModule("/ti/drivers/AESECB"); -var Button = scripting.addModule("/ti/drivers/apps/Button"); -var LED = scripting.addModule("/ti/drivers/apps/LED"); -var NVS = scripting.addModule("/ti/drivers/NVS"); -var RF = scripting.addModule("/ti/drivers/RF"); -var RFDesign = scripting.addModule("ti/devices/radioconfig/rfdesign"); -var RFCustom = scripting.addModule("/ti/devices/radioconfig/custom"); -var TRNG = scripting.addModule("/ti/drivers/TRNG"); -var SHA2 = scripting.addModule("/ti/drivers/SHA2"); -var UART2 = scripting.addModule("/ti/drivers/UART2"); -var ble = scripting.addModule("/ti/ble5stack/ble"); -var dmm = scripting.addModule("/ti/dmm/dmm"); -var AESCTRDRBG = scripting.addModule("/ti/drivers/AESCTRDRBG"); -var ECDH = scripting.addModule("/ti/drivers/ECDH"); - -/* Instances */ -var AESCCM1 = AESCCM.addInstance(); -var AESECB1 = AESECB.addInstance(); -var AESECB2 = AESECB.addInstance(); -var Button1 = Button.addInstance(); -var Button2 = Button.addInstance(); -var NVS1 = NVS.addInstance(); -var NVS2 = NVS.addInstance(); -var SHA21 = SHA2.addInstance(); -var LED1 = LED.addInstance(); -var LED2 = LED.addInstance(); -var TRNG1 = TRNG.addInstance(); -var TRNG2 = TRNG.addInstance(); -var TRNG3 = TRNG.addInstance(); -var UART2 = UART2.addInstance(); -var AESCTRDRBG1 = AESCTRDRBG.addInstance(); -var ECDH1 = ECDH.addInstance(); - -AESCTRDRBG1.$name = "CONFIG_AESCTRDRBG_0"; - -AESCCM1.$name = "CONFIG_AESCCM0"; - -AESECB1.$name = "CONFIG_AESECB0"; -AESECB2.$name = "CONFIG_AESECB_1"; - -ECDH1.$name = "CONFIG_ECDH0"; - -/* Left Button */ -Button1.$name = "CONFIG_BTN_LEFT"; -Button1.$hardware = system.deviceData.board.components["BTN-1"]; -Button1.gpioPin.$name = "CONFIG_GPIO_BTN1"; -Button1.gpioPin.pull = "Pull Up"; -Button1.gpioPin.interruptTrigger = "Falling Edge"; - -/* Left Button */ -Button2.$name = "CONFIG_BTN_RIGHT"; -Button2.$hardware = system.deviceData.board.components["BTN-2"]; -Button2.gpioPin.$name = "CONFIG_GPIO_BTN2"; -Button2.gpioPin.pull = "Pull Up"; -Button2.gpioPin.interruptTrigger = "Falling Edge"; - -/* ======== CCFG ======== */ -var CCFG = scripting.addModule("/ti/devices/CCFG"); -const ccfgSettings = system.getScript("/ti/common/lprf_ccfg_settings.js").ccfgSettings; -for(var setting in ccfgSettings) -{ - CCFG[setting] = ccfgSettings[setting]; -} - -// Disable CCFG generation, this is added by the BIM project -CCFG.enableCodeGeneration = false; - -/* NVS */ -NVS1.$name = "CONFIG_NVSINTERNAL"; -NVS1.internalFlash.regionBase = 0xAA000; -NVS1.internalFlash.regionSize = 0x4000; - -NVS2.$name = "CONFIG_NVSEXTERNAL"; -NVS2.nvsType = "External"; // NVS Region Type -NVS2.$hardware = system.deviceData.board.components.MX25R8035F; - -/* RF */ -/* if an antenna component exists, assign it to the rf instance */ -if (system.deviceData.board && system.deviceData.board.components.RF) { - RF.$hardware = system.deviceData.board.components.RF; -} - -const rfDesignSettings = system.getScript("/ti/common/lprf_rf_design_settings.js").rfDesignSettings; -for(var setting in rfDesignSettings) -{ - RFDesign[setting] = rfDesignSettings[setting]; -} - -/* Handling for RF frontend characterization */ -if(RFDesign.rfDesign.match(/LP_CC2652PSIP/)) -{ - RFCustom.ieee = ["ieee154p10"]; - var rfCodeExportConfig = RFCustom.radioConfigieee154p10.codeExportConfig -} -else -{ - RFCustom.ieee = ["ieee154"]; - var rfCodeExportConfig = RFCustom.radioConfigieee154.codeExportConfig -} - -var cmdList = [ - "cmdIeeeTx", - "cmdIeeeRx", - "cmdIeeeCsma", - "cmdIeeeEdScan", - "cmdIeeeRxAck", - "cmdTxTest" -]; - -rfCodeExportConfig.useConst = true; -rfCodeExportConfig.useMulti = true; -rfCodeExportConfig.symGenMethod = "Custom"; - -const deviceId = system.deviceData.deviceId; - -// Add high PA options if present -if(deviceId.match(/CC(265[12]R|2674R|1352R1|1354R)/)) -{ - cmdList.push("cmdRadioSetup"); - rfCodeExportConfig.cmdRadioSetup = "RF_cmdIeeeRadioSetup"; -} -else if(deviceId.match(/CC(265[12]P|2674P|1352P)/)) -{ - cmdList.push("cmdRadioSetupPa"); - rfCodeExportConfig.cmdRadioSetupPa = "RF_cmdIeeeRadioSetup"; - rfCodeExportConfig.paExport = "combined"; -} -else if(deviceId.match(/CC(265[34]|1354)P/)) -{ - cmdList.push("cmdRadioSetupPa"); - rfCodeExportConfig.cmdRadioSetupPa = "RF_cmdIeeeRadioSetup"; - // currently not characterized for high PA -} -else -{ - throw new Error("Could not match platform to any known platform types"); -} - -rfCodeExportConfig.cmdList_ieee_15_4 = cmdList; - -/* Red LED */ -LED1.$name = "CONFIG_LED_RED"; -LED1.$hardware = system.deviceData.board.components.LED_RED; -LED1.gpioPin.$name = "CONFIG_GPIO_RLED"; -LED1.gpioPin.mode = "Output"; -LED1.gpioPin.callbackFunction = ""; - -/* Green LED */ -LED2.$name = "CONFIG_LED_GREEN"; -LED2.$hardware = system.deviceData.board.components.LED_GREEN; -LED2.gpioPin.$name = "CONFIG_GPIO_GLED"; -LED2.gpioPin.mode = "Output"; -LED2.gpioPin.callbackFunction = ""; - -/* Debug UART */ -UART2.$hardware = system.deviceData.board.components.XDS110UART; -UART2.$name = "CONFIG_UART2_DEBUG"; - -/* TRNG */ -TRNG1.$name = "CONFIG_TRNG_0"; -TRNG2.$name = "CONFIG_TRNG_THREAD"; -TRNG3.$name = "CONFIG_TRNG_APP"; - -/* BLE */ -ble.addressMode = "ADDRMODE_RP_WITH_PUBLIC_ID"; -ble.maxConnNum = 1; -ble.numOfAdvSets = 1; -ble.lockProject = true; -ble.oneLibSizeOpt = true; -ble.maxPDUSize = 255; -ble.radioConfig.codeExportConfig.$name = "ti_devices_radioconfig_code_export_param2"; -ble.connUpdateParamsPeripheral.$name = "ti_ble5stack_general_ble_conn_update_params0"; -ble.connUpdateParamsPeripheral.reqMinConnInt = 30; -ble.connUpdateParamsPeripheral.reqMaxConnInt = 50; - - -ble.advSet1.$name = "ti_ble5stack_broadcaster_advertisement_set0"; -ble.advSet1.advParam1.$name = "ti_ble5stack_broadcaster_advertisement_params0"; - -/* DMM */ -dmm.project = "ti_thread_thermostat_remote_display"; -dmm.stackRoles = ["blePeripheral","threadFTD"]; -dmm.lockStackRoles = true; -dmm.numApplicationStates = 10; -dmm.applicationState0 = "ANY"; -dmm.applicationState1 = "DMMPOLICY_BLE_IDLE"; -dmm.applicationState2 = "DMMPOLICY_BLE_ADV"; -dmm.applicationState3 = "DMMPOLICY_BLE_CONNECTING"; -dmm.applicationState4 = "DMMPOLICY_BLE_HIGH_BANDWIDTH"; -dmm.applicationState5 = "DMMPOLICY_BLE_CONNECTED"; -dmm.applicationState6 = "DMMPOLICY_BLE_OAD"; -dmm.applicationState7 = "DMMPOLICY_THREAD_IDLE"; -dmm.applicationState8 = "DMMPOLICY_THREAD_LINK_EST"; -dmm.applicationState9 = "DMMPOLICY_THREAD_DATA"; -dmm.policyArray.create(4); -dmm.policyArray[0].$name = "ti_dmm_policy_dmm_policy0"; -dmm.policyArray[0].blePeripheral.$name = "ti_dmm_policy_stack_dmm_stack_ble0"; -dmm.policyArray[0].blePeripheral.applicationStates = ["applicationState6"]; -dmm.policyArray[0].threadFTD.$name = "ti_dmm_policy_stack_dmm_stack_thread0"; -dmm.policyArray[0].threadFTD.pause = "DMMPOLICY_PAUSED"; -dmm.policyArray[1].$name = "ti_dmm_policy_dmm_policy1"; -dmm.policyArray[1].blePeripheral.$name = "ti_dmm_policy_stack_dmm_stack_ble1"; -dmm.policyArray[1].blePeripheral.applicationStates = ["applicationState3","applicationState4"]; -dmm.policyArray[1].blePeripheral.weight = 25; -dmm.policyArray[1].blePeripheral.appliedActivity = ["DMMPOLICY_APPLIED_ACTIVITY_BLE_CONNECTION"]; -dmm.policyArray[1].threadFTD.$name = "ti_dmm_policy_stack_dmm_stack_thread1"; -dmm.policyArray[2].$name = "ti_dmm_policy_dmm_policy2"; -dmm.policyArray[2].blePeripheral.$name = "ti_dmm_policy_stack_dmm_stack_ble2"; -dmm.policyArray[2].threadFTD.$name = "ti_dmm_policy_stack_dmm_stack_thread2"; -dmm.policyArray[2].threadFTD.weight = 30; -dmm.policyArray[2].threadFTD.applicationStates = ["applicationState8"]; -dmm.policyArray[2].threadFTD.appliedActivity = ["DMMPOLICY_APPLIED_ACTIVITY_ALL"]; -dmm.policyArray[3].$name = "ti_dmm_policy_dmm_policy3"; -dmm.policyArray[3].blePeripheral.$name = "ti_dmm_policy_stack_dmm_stack_ble3"; -dmm.policyArray[3].threadFTD.$name = "ti_dmm_policy_stack_dmm_stack_thread3"; -dmm.policyArray[3].threadFTD.weight = 1; diff --git a/examples/lighting-app/cc13x2x7_26x2x7/include/CHIPProjectConfig.h b/examples/lighting-app/cc13x2x7_26x2x7/include/CHIPProjectConfig.h deleted file mode 100644 index 88e08c63321770..00000000000000 --- a/examples/lighting-app/cc13x2x7_26x2x7/include/CHIPProjectConfig.h +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright (c) 2020 Project CHIP Authors - * Copyright (c) 2019 Google LLC. - * All rights reserved. - * - * 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. - */ - -/** - * @file - * Example project configuration file for CHIP. - * - * This is a place to put application or project-specific overrides - * to the default configuration values for general CHIP features. - * - */ - -#ifndef CHIP_PROJECT_CONFIG_H -#define CHIP_PROJECT_CONFIG_H - -#if BUILD_RELEASE // release build -// Note: Default Pairing/PIN/Serial Numbers being used. These should not be enabled for production builds -#endif // BUILD_RELEASE - -// Use a default pairing code if one hasn't been provisioned in flash. -#define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE 20202021 -#define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR 0xF00 - -/** - * CHIP_DEVICE_CONFIG_TEST_SERIAL_NUMBER - * - * Enables the use of a hard-coded default serial number if none - * is found in CHIP NV storage. - */ -#define CHIP_DEVICE_CONFIG_TEST_SERIAL_NUMBER "TEST_SN" - -/** - * CHIP_DEVICE_CONFIG_DEVICE_HARDWARE_VERSION - * - * The hardware version number assigned to device or product by the device vendor. This - * number is scoped to the device product id, and typically corresponds to a revision of the - * physical device, a change to its packaging, and/or a change to its marketing presentation. - * This value is generally *not* incremented for device software versions. - */ -#ifndef CHIP_DEVICE_CONFIG_DEVICE_HARDWARE_VERSION -#define CHIP_DEVICE_CONFIG_DEVICE_HARDWARE_VERSION 1 -#endif - -/** - * Values set by args.gni: - * CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID - * CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID - * CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING - * CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION - */ - -/** - * CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE - * - * Enable support for CHIP-over-BLE (CHIPOBLE). - */ -#define CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE 1 - -/** - * CHIP_DEVICE_CONFIG_EVENT_LOGGING_DEBUG_BUFFER_SIZE - * - * A size, in bytes, of the individual debug event logging buffer. - */ -#define CHIP_DEVICE_CONFIG_EVENT_LOGGING_DEBUG_BUFFER_SIZE (512) - -#define MATTER_CC13XX_26XX_PLATFORM_LOG_ENABLED 1 - -/** - * CHIP_DEVICE_CONFIG_ENABLE_THREAD_SRP_CLIENT - * - * Enable the OpenThread SRP client to allow for CHIP device discovery. - */ -#define CHIP_DEVICE_CONFIG_ENABLE_THREAD_SRP_CLIENT 1 - -/** - * CHIP_CONFIG_EVENT_LOGGING_DEFAULT_IMPORTANCE - * - * For a development build, set the default importance of events to be logged as Debug. - * Since debug is the lowest importance level, this means all standard, critical, info and - * debug importance level vi events get logged. - */ -#if BUILD_RELEASE -#define CHIP_CONFIG_EVENT_LOGGING_DEFAULT_IMPORTANCE chip::Profiles::DataManagement::Production -#else -#define CHIP_CONFIG_EVENT_LOGGING_DEFAULT_IMPORTANCE chip::Profiles::DataManagement::Debug -#endif // BUILD_RELEASE - -#define CHIP_DEVICE_CONFIG_ENABLE_EXTENDED_DISCOVERY 1 - -/** - * @def CHIP_IM_MAX_NUM_COMMAND_HANDLER - * - * @brief Defines the maximum number of CommandHandler, limits the number of active commands transactions on server. - */ -#define CHIP_IM_MAX_NUM_COMMAND_HANDLER 2 - -/** - * @def CHIP_IM_MAX_NUM_WRITE_HANDLER - * - * @brief Defines the maximum number of WriteHandler, limits the number of active write transactions on server. - */ -#define CHIP_IM_MAX_NUM_WRITE_HANDLER 2 - -#endif // CHIP_PROJECT_CONFIG_H diff --git a/examples/lighting-app/cc13x2x7_26x2x7/src/AppConfig.h b/examples/lighting-app/cc13x2x7_26x2x7/src/AppConfig.h deleted file mode 100644 index a818b21d641875..00000000000000 --- a/examples/lighting-app/cc13x2x7_26x2x7/src/AppConfig.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2020 Project CHIP Authors - * All rights reserved. - * - * 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. - */ - -#ifndef APP_CONFIG_H -#define APP_CONFIG_H - -// Logging -#ifdef __cplusplus -extern "C" { -#endif - -int cc13xx_26xxLogInit(void); -void cc13xx_26xxLog(const char * aFormat, ...); -#define PLAT_LOG(...) cc13xx_26xxLog(__VA_ARGS__); - -#define ACTUATOR_MOVEMENT_PERIOD_MS 1000 - -#ifdef __cplusplus -} -#endif -#endif // APP_CONFIG_H diff --git a/examples/lighting-app/cc13x2x7_26x2x7/src/AppEvent.h b/examples/lighting-app/cc13x2x7_26x2x7/src/AppEvent.h deleted file mode 100644 index 9c55e1bf674531..00000000000000 --- a/examples/lighting-app/cc13x2x7_26x2x7/src/AppEvent.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * - * Copyright (c) 2021 Project CHIP Authors - * All rights reserved. - * - * 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. - */ -#ifndef APP_EVENT_H -#define APP_EVENT_H - -struct AppEvent; -typedef void (*EventHandler)(AppEvent *); - -struct AppEvent -{ - enum AppEventType - { - kEventType_None = 0, - kEventType_ButtonLeft, - kEventType_ButtonRight, - kEventType_AppEvent, - kEventType_IdentifyStart, - kEventType_IdentifyStop, - kEventType_Light, - kEventType_Timer, - }; - - enum AppEventButtonType - { - kAppEventButtonType_None = 0, - kAppEventButtonType_Clicked, - kAppEventButtonType_LongClicked, - }; - - enum AppEventIdentifyType - { - kAppEventIdentifyType_Blink = 0, - kAppEventIdentifyType_Breathe, - kAppEventIdentifyType_Okay, - kAppEventIdentifyType_Finish, - kAppEventIdentifyType_Stop, - }; - - enum AppEventType Type; - - union - { - struct - { - enum AppEventButtonType Type; - } ButtonEvent; - - struct - { - void * Context; - } TimerEvent; - - struct - { - uint8_t Action; - int32_t Actor; - void * Context; - } LightEvent; - - struct - { - enum AppEventIdentifyType Type; - } IdentifyEvent; - }; - - EventHandler Handler; -}; - -#endif // APP_EVENT_H diff --git a/examples/lighting-app/cc13x2x7_26x2x7/src/AppTask.cpp b/examples/lighting-app/cc13x2x7_26x2x7/src/AppTask.cpp deleted file mode 100644 index 7d84e656927d09..00000000000000 --- a/examples/lighting-app/cc13x2x7_26x2x7/src/AppTask.cpp +++ /dev/null @@ -1,547 +0,0 @@ -/* - * - * Copyright (c) 2020 Project CHIP Authors - * Copyright (c) 2020 Texas Instruments Incorporated - * All rights reserved. - * - * 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. - */ - -#include "AppTask.h" -#include "AppConfig.h" -#include "AppEvent.h" - -#include "FreeRTOS.h" - -#include -#include -#include - -#include -#include - -#if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR -#include -#include -#include -#include -#include -#endif - -#include -#include - -#include - -#include -#include -#include -#include -#include - -#include -#include - -/* syscfg */ -#include - -#define APP_TASK_STACK_SIZE (4096) -#define APP_TASK_PRIORITY 4 -#define APP_EVENT_QUEUE_SIZE 10 - -#define IDENTIFY_TRIGGER_EFFECT_BLINK 0 -#define IDENTIFY_TRIGGER_EFFECT_BREATHE 1 -#define IDENTIFY_TRIGGER_EFFECT_OKAY 2 -#define IDENTIFY_TRIGGER_EFFECT_FINISH_STOP 3 - -static uint32_t identify_trigger_effect = IDENTIFY_TRIGGER_EFFECT_FINISH_STOP; - -#define LIGHTING_APPLICATION_IDENTIFY_ENDPOINT 1 - -using namespace ::chip; -using namespace ::chip::app; -using namespace ::chip::Credentials; -using namespace ::chip::DeviceLayer; - -static TaskHandle_t sAppTaskHandle; -static QueueHandle_t sAppEventQueue; - -static LED_Handle sAppRedHandle; -static LED_Handle sAppGreenHandle; -static Button_Handle sAppLeftHandle; -static Button_Handle sAppRightHandle; -static DeviceInfoProviderImpl sExampleDeviceInfoProvider; - -AppTask AppTask::sAppTask; - -#if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR -static DefaultOTARequestor sRequestorCore; -static DefaultOTARequestorStorage sRequestorStorage; -static DefaultOTARequestorDriver sRequestorUser; -static BDXDownloader sDownloader; -static OTAImageProcessorImpl sImageProcessor; - -void InitializeOTARequestor(void) -{ - // Initialize and interconnect the Requestor and Image Processor objects - SetRequestorInstance(&sRequestorCore); - - sRequestorStorage.Init(Server::GetInstance().GetPersistentStorage()); - sRequestorCore.Init(Server::GetInstance(), sRequestorStorage, sRequestorUser, sDownloader); - sImageProcessor.SetOTADownloader(&sDownloader); - sDownloader.SetImageProcessorDelegate(&sImageProcessor); - sRequestorUser.Init(&sRequestorCore, &sImageProcessor); -} -#endif - -::Identify stIdentify = { LIGHTING_APPLICATION_IDENTIFY_ENDPOINT, AppTask::IdentifyStartHandler, AppTask::IdentifyStopHandler, - Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator, AppTask::TriggerIdentifyEffectHandler }; - -int AppTask::StartAppTask() -{ - int ret = 0; - - sAppEventQueue = xQueueCreate(APP_EVENT_QUEUE_SIZE, sizeof(AppEvent)); - if (sAppEventQueue == NULL) - { - PLAT_LOG("Failed to allocate app event queue"); - while (1) - ; - } - - // Start App task. - if (xTaskCreate(AppTaskMain, "APP", APP_TASK_STACK_SIZE / sizeof(StackType_t), NULL, APP_TASK_PRIORITY, &sAppTaskHandle) != - pdPASS) - { - PLAT_LOG("Failed to create app task"); - while (1) - ; - } - return ret; -} - -// Action initiated callback -void uiTurnOn(void) -{ - PLAT_LOG("Light On initiated"); - LED_setOn(sAppRedHandle, LED_BRIGHTNESS_MAX); - LED_startBlinking(sAppRedHandle, 110 /* ms */, LED_BLINK_FOREVER); -} - -// Action completed callback -void uiTurnedOn(void) -{ - PLAT_LOG("Light On completed"); - LED_stopBlinking(sAppRedHandle); - LED_setOn(sAppRedHandle, LED_BRIGHTNESS_MAX); -} - -// Action initiated callback -void uiTurnOff(void) -{ - PLAT_LOG("Light Off initiated"); - LED_setOn(sAppRedHandle, LED_BRIGHTNESS_MAX); - LED_startBlinking(sAppRedHandle, 110 /* ms */, LED_BLINK_FOREVER); -} - -// Action completed callback -void uiTurnedOff(void) -{ - PLAT_LOG("Light Off completed"); - LED_stopBlinking(sAppRedHandle); - LED_setOff(sAppRedHandle); -} - -int AppTask::Init() -{ - LED_Params ledParams; - Button_Params buttonParams; - - cc13xx_26xxLogInit(); - - // Init Chip memory management before the stack - Platform::MemoryInit(); - - CHIP_ERROR ret = PlatformMgr().InitChipStack(); - if (ret != CHIP_NO_ERROR) - { - PLAT_LOG("PlatformMgr().InitChipStack() failed"); - while (1) - ; - } - - // Initialize device attestation config -#ifdef CC13X2_26X2_ATTESTATION_CREDENTIALS -#ifdef CC13XX_26XX_FACTORY_DATA - SetDeviceInstanceInfoProvider(&mFactoryDataProvider); - SetDeviceAttestationCredentialsProvider(&mFactoryDataProvider); - SetCommissionableDataProvider(&mFactoryDataProvider); -#else - SetDeviceAttestationCredentialsProvider(CC13X2_26X2::GetCC13X2_26X2DacProvider()); -#endif -#else - SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider()); -#endif - - ret = ThreadStackMgr().InitThreadStack(); - if (ret != CHIP_NO_ERROR) - { - PLAT_LOG("ThreadStackMgr().InitThreadStack() failed"); - while (1) - ; - } -#if CHIP_DEVICE_CONFIG_THREAD_FTD - ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_Router); -#else - ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_MinimalEndDevice); -#endif - if (ret != CHIP_NO_ERROR) - { - PLAT_LOG("ConnectivityMgr().SetThreadDeviceType() failed"); - while (1) - ; - } - - ret = PlatformMgr().StartEventLoopTask(); - if (ret != CHIP_NO_ERROR) - { - PLAT_LOG("PlatformMgr().StartEventLoopTask() failed"); - while (1) - ; - } - - ret = ThreadStackMgrImpl().StartThreadTask(); - if (ret != CHIP_NO_ERROR) - { - PLAT_LOG("ThreadStackMgr().StartThreadTask() failed"); - while (1) - ; - } - - // Init ZCL Data Model and start server - PLAT_LOG("Initialize Server"); - static CommonCaseDeviceServerInitParams initParams; - (void) initParams.InitializeStaticResourcesBeforeServerInit(); - - // Initialize info provider - sExampleDeviceInfoProvider.SetStorageDelegate(initParams.persistentStorageDelegate); - SetDeviceInfoProvider(&sExampleDeviceInfoProvider); - - Server::GetInstance().Init(initParams); - - // Initialize LEDs - PLAT_LOG("Initialize LEDs"); - LED_init(); - - LED_Params_init(&ledParams); // default PWM LED - sAppRedHandle = LED_open(CONFIG_LED_RED, &ledParams); - LED_setOff(sAppRedHandle); - - LED_Params_init(&ledParams); // default PWM LED - sAppGreenHandle = LED_open(CONFIG_LED_GREEN, &ledParams); - LED_setOff(sAppGreenHandle); - - // Initialize buttons - PLAT_LOG("Initialize buttons"); - Button_init(); - - Button_Params_init(&buttonParams); - buttonParams.buttonEventMask = Button_EV_CLICKED | Button_EV_LONGCLICKED; - buttonParams.longPressDuration = 1000U; // ms - sAppLeftHandle = Button_open(CONFIG_BTN_LEFT, &buttonParams); - Button_setCallback(sAppLeftHandle, ButtonLeftEventHandler); - - Button_Params_init(&buttonParams); - buttonParams.buttonEventMask = Button_EV_CLICKED | Button_EV_LONGCLICKED; - buttonParams.longPressDuration = 1000U; // ms - sAppRightHandle = Button_open(CONFIG_BTN_RIGHT, &buttonParams); - Button_setCallback(sAppRightHandle, ButtonRightEventHandler); - - ret = LightMgr().Init(); - - if (ret != CHIP_NO_ERROR) - { - PLAT_LOG("LightMgr().Init() failed"); - while (1) - ; - } - - LightMgr().SetCallbacks(ActionInitiated, ActionCompleted); - - ConfigurationMgr().LogDeviceConfig(); - -#if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR - InitializeOTARequestor(); -#endif - // QR code will be used with CHIP Tool - PrintOnboardingCodes(RendezvousInformationFlags(RendezvousInformationFlag::kBLE)); - - return 0; -} - -void AppTask::AppTaskMain(void * pvParameter) -{ - AppEvent event; - - sAppTask.Init(); - - while (1) - { - /* Task pend until we have stuff to do */ - if (xQueueReceive(sAppEventQueue, &event, portMAX_DELAY) == pdTRUE) - { - sAppTask.DispatchEvent(&event); - } - } -} - -void AppTask::ButtonLeftEventHandler(Button_Handle handle, Button_EventMask events) -{ - AppEvent event; - event.Type = AppEvent::kEventType_ButtonLeft; - - if (events & Button_EV_CLICKED) - { - event.ButtonEvent.Type = AppEvent::kAppEventButtonType_Clicked; - } - else if (events & Button_EV_LONGCLICKED) - { - event.ButtonEvent.Type = AppEvent::kAppEventButtonType_LongClicked; - } - // button callbacks are in ISR context - if (xQueueSendFromISR(sAppEventQueue, &event, NULL) != pdPASS) - { - /* Failed to post the message */ - } -} - -void AppTask::ButtonRightEventHandler(Button_Handle handle, Button_EventMask events) -{ - AppEvent event; - event.Type = AppEvent::kEventType_ButtonRight; - - if (events & Button_EV_CLICKED) - { - event.ButtonEvent.Type = AppEvent::kAppEventButtonType_Clicked; - } - else if (events & Button_EV_LONGCLICKED) - { - event.ButtonEvent.Type = AppEvent::kAppEventButtonType_LongClicked; - } - // button callbacks are in ISR context - if (xQueueSendFromISR(sAppEventQueue, &event, NULL) != pdPASS) - { - /* Failed to post the message */ - } -} - -void AppTask::ActionInitiated(LightingManager::Action_t aAction, int32_t aActor) -{ - if (aAction == LightingManager::ON_ACTION) - { - uiTurnOn(); - } - else if (aAction == LightingManager::OFF_ACTION) - { - uiTurnOff(); - } -} - -void AppTask::ActionCompleted(LightingManager::Action_t aAction) -{ - if (aAction == LightingManager::ON_ACTION) - { - uiTurnedOn(); - } - else if (aAction == LightingManager::OFF_ACTION) - { - uiTurnedOff(); - } -} - -void AppTask::PostEvent(const AppEvent * aEvent) -{ - if (sAppEventQueue != NULL) - { - BaseType_t status; - if (xPortIsInsideInterrupt()) - { - BaseType_t higherPrioTaskWoken = pdFALSE; - status = xQueueSendFromISR(sAppEventQueue, aEvent, &higherPrioTaskWoken); - -#ifdef portYIELD_FROM_ISR - portYIELD_FROM_ISR(higherPrioTaskWoken); -#elif portEND_SWITCHING_ISR // portYIELD_FROM_ISR or portEND_SWITCHING_ISR - portEND_SWITCHING_ISR(higherPrioTaskWoken); -#else // portYIELD_FROM_ISR or portEND_SWITCHING_ISR -#error "Must have portYIELD_FROM_ISR or portEND_SWITCHING_ISR" -#endif // portYIELD_FROM_ISR or portEND_SWITCHING_ISR - } - else - { - status = xQueueSend(sAppEventQueue, aEvent, 1); - } - - if (status != pdTRUE) - { - PLAT_LOG("Failed to post event to app task event queue"); - } - } - else - { - PLAT_LOG("Event Queue is NULL should never happen"); - } -} - -void AppTask::DispatchEvent(AppEvent * aEvent) -{ - int32_t actor; - - switch (aEvent->Type) - { - case AppEvent::kEventType_Light: { - actor = aEvent->LightEvent.Actor; - LightMgr().IsLightOn() ? LightMgr().InitiateAction(actor, LightingManager::OFF_ACTION) - : LightMgr().InitiateAction(actor, LightingManager::ON_ACTION); - } - case AppEvent::kEventType_ButtonLeft: - if (AppEvent::kAppEventButtonType_Clicked == aEvent->ButtonEvent.Type) - { - actor = AppEvent::kEventType_ButtonLeft; - LightMgr().InitiateAction(actor, LightingManager::ON_ACTION); - } - else if (AppEvent::kAppEventButtonType_LongClicked == aEvent->ButtonEvent.Type) - { - chip::Server::GetInstance().ScheduleFactoryReset(); - } - break; - - case AppEvent::kEventType_ButtonRight: - if (AppEvent::kAppEventButtonType_Clicked == aEvent->ButtonEvent.Type) - { - actor = AppEvent::kEventType_ButtonRight; - LightMgr().InitiateAction(actor, LightingManager::OFF_ACTION); - } - else if (AppEvent::kAppEventButtonType_LongClicked == aEvent->ButtonEvent.Type) - { - // Enable BLE advertisements - if (!ConnectivityMgr().IsBLEAdvertisingEnabled()) - { - if (Server::GetInstance().GetCommissioningWindowManager().OpenBasicCommissioningWindow() == CHIP_NO_ERROR) - { - PLAT_LOG("Enabled BLE Advertisements"); - } - else - { - PLAT_LOG("OpenBasicCommissioningWindow() failed"); - } - } - else - { - // Disable BLE advertisements - ConnectivityMgr().SetBLEAdvertisingEnabled(false); - PLAT_LOG("Disabled BLE Advertisements"); - } - } - break; - - case AppEvent::kEventType_IdentifyStart: - switch (identify_trigger_effect) - { - case IDENTIFY_TRIGGER_EFFECT_BLINK: - LED_setOn(sAppGreenHandle, LED_BRIGHTNESS_MAX); - LED_startBlinking(sAppGreenHandle, 1000, LED_BLINK_FOREVER); - break; - case IDENTIFY_TRIGGER_EFFECT_BREATHE: - LED_setOn(sAppGreenHandle, LED_BRIGHTNESS_MAX); - LED_startBlinking(sAppGreenHandle, 100, LED_BLINK_FOREVER); - break; - case IDENTIFY_TRIGGER_EFFECT_OKAY: - LED_setOn(sAppGreenHandle, LED_BRIGHTNESS_MAX); - LED_startBlinking(sAppGreenHandle, 500, LED_BLINK_FOREVER); - break; - default: - break; - } - PLAT_LOG("Identify started"); - break; - - case AppEvent::kEventType_IdentifyStop: - LED_stopBlinking(sAppGreenHandle); - LED_setOff(sAppGreenHandle); - PLAT_LOG("Identify stopped"); - break; - - case AppEvent::kEventType_AppEvent: - if (NULL != aEvent->Handler) - { - aEvent->Handler(aEvent); - } - break; - - case AppEvent::kEventType_None: - default: - break; - } -} - -void AppTask::IdentifyStartHandler(::Identify *) -{ - AppEvent event; - event.Type = AppEvent::kEventType_IdentifyStart; - sAppTask.PostEvent(&event); -} - -void AppTask::IdentifyStopHandler(::Identify *) -{ - AppEvent event; - event.Type = AppEvent::kEventType_IdentifyStop; - sAppTask.PostEvent(&event); -} - -void AppTask::TriggerIdentifyEffectHandler(::Identify * identify) -{ - switch (identify->mCurrentEffectIdentifier) - { - case Clusters::Identify::EffectIdentifierEnum::kBlink: - PLAT_LOG("Starting blink identifier effect"); - identify_trigger_effect = IDENTIFY_TRIGGER_EFFECT_BLINK; - IdentifyStartHandler(identify); - break; - case Clusters::Identify::EffectIdentifierEnum::kBreathe: - PLAT_LOG("Starting breathe identifier effect"); - identify_trigger_effect = IDENTIFY_TRIGGER_EFFECT_BREATHE; - IdentifyStartHandler(identify); - break; - case Clusters::Identify::EffectIdentifierEnum::kOkay: - PLAT_LOG("Starting okay identifier effect"); - identify_trigger_effect = IDENTIFY_TRIGGER_EFFECT_OKAY; - IdentifyStartHandler(identify); - break; - case Clusters::Identify::EffectIdentifierEnum::kChannelChange: - PLAT_LOG("Channel Change identifier effect not implemented"); - break; - case Clusters::Identify::EffectIdentifierEnum::kFinishEffect: - PLAT_LOG("Finish identifier effect"); - identify_trigger_effect = IDENTIFY_TRIGGER_EFFECT_FINISH_STOP; - IdentifyStopHandler(identify); - break; - case Clusters::Identify::EffectIdentifierEnum::kStopEffect: - PLAT_LOG("Stop identifier effect"); - identify_trigger_effect = IDENTIFY_TRIGGER_EFFECT_FINISH_STOP; - IdentifyStopHandler(identify); - break; - default: - PLAT_LOG("No identifier effect"); - } -} diff --git a/examples/lighting-app/cc13x2x7_26x2x7/src/AppTask.h b/examples/lighting-app/cc13x2x7_26x2x7/src/AppTask.h deleted file mode 100644 index c82a122fef4ea8..00000000000000 --- a/examples/lighting-app/cc13x2x7_26x2x7/src/AppTask.h +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (c) 2020 Project CHIP Authors - * Copyright (c) 2019 Google LLC. - * All rights reserved. - * - * 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. - */ - -#pragma once - -#include -#include - -#include "FreeRTOS.h" -#include "semphr.h" -#include "task.h" - -#include "AppEvent.h" -#include "LightingManager.h" - -#include - -#ifdef CC13XX_26XX_FACTORY_DATA -#include -#endif - -// Application-defined error codes in the CHIP_ERROR space. -#define APP_ERROR_EVENT_QUEUE_FAILED CHIP_APPLICATION_ERROR(0x01) -#define APP_ERROR_CREATE_TASK_FAILED CHIP_APPLICATION_ERROR(0x02) -#define APP_ERROR_UNHANDLED_EVENT CHIP_APPLICATION_ERROR(0x03) -#define APP_ERROR_CREATE_TIMER_FAILED CHIP_APPLICATION_ERROR(0x04) -#define APP_ERROR_START_TIMER_FAILED CHIP_APPLICATION_ERROR(0x05) -#define APP_ERROR_STOP_TIMER_FAILED CHIP_APPLICATION_ERROR(0x06) -#define APP_ERROR_ALLOCATION_FAILED CHIP_APPLICATION_ERROR(0x07) -struct Identify; - -class AppTask -{ - -public: - int StartAppTask(); - static void AppTaskMain(void * pvParameter); - - static AppTask & GetAppTask() { return sAppTask; } - - void PostLightActionRequest(int32_t aActor, LightingManager::Action_t aAction); - void PostEvent(const AppEvent * event); - - static void IdentifyStartHandler(::Identify *); - static void IdentifyStopHandler(::Identify *); - static void TriggerIdentifyEffectHandler(::Identify * identify); - -private: - friend AppTask & GetAppTask(void); - - int Init(); - - static void ActionInitiated(LightingManager::Action_t aAction, int32_t aActor); - static void ActionCompleted(LightingManager::Action_t aAction); - - void DispatchEvent(AppEvent * event); - static void UpdateClusterState(intptr_t context); - static void SingleButtonEventHandler(AppEvent * aEvent); - static void ButtonTimerEventHandler(AppEvent * aEvent); - - static void ButtonLeftEventHandler(Button_Handle handle, Button_EventMask events); - static void ButtonRightEventHandler(Button_Handle handle, Button_EventMask events); - static void TimerEventHandler(void * p_context); - - enum Function_t - { - kFunction_NoneSelected = 0, - kFunction_SoftwareUpdate = 0, - kFunction_FactoryReset, - kFunction_Invalid - } Function; - - Function_t mFunction; - bool mFunctionTimerActive; - - static AppTask sAppTask; - -#ifdef CC13XX_26XX_FACTORY_DATA - chip::DeviceLayer::FactoryDataProvider mFactoryDataProvider; -#endif -}; - -inline AppTask & GetAppTask(void) -{ - return AppTask::sAppTask; -} diff --git a/examples/lighting-app/cc13x2x7_26x2x7/src/LightingManager.cpp b/examples/lighting-app/cc13x2x7_26x2x7/src/LightingManager.cpp deleted file mode 100644 index ed5fc52e7e5638..00000000000000 --- a/examples/lighting-app/cc13x2x7_26x2x7/src/LightingManager.cpp +++ /dev/null @@ -1,176 +0,0 @@ -/* - * - * Copyright (c) 2020 Project CHIP Authors - * Copyright (c) 2019 Google LLC. - * All rights reserved. - * - * 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. - */ - -#include "LightingManager.h" - -#include "AppConfig.h" -#include "AppTask.h" -#include - -using namespace chip; -using namespace ::chip::DeviceLayer; - -LightingManager LightingManager::sLight; - -TimerHandle_t sLightTimer; - -CHIP_ERROR LightingManager::Init() -{ - // Create FreeRTOS sw timer for light timer. - sLightTimer = xTimerCreate("lightTmr", // Just a text name, not used by the RTOS kernel - 1, // == default timer period (mS) - false, // no timer reload (==one-shot) - (void *) this, // init timer id = light obj context - TimerEventHandler // timer callback handler - ); - - if (sLightTimer == NULL) - { - PLAT_LOG("sLightTimer timer create failed"); - } - - bool currentLedState; - // read current on/off value on endpoint one. - OnOffServer::Instance().getOnOffValue(1, ¤tLedState); - - mState = currentLedState ? kState_OnCompleted : kState_OffCompleted; - - return CHIP_NO_ERROR; -} - -void LightingManager::SetCallbacks(Callback_fn_initiated aActionInitiated_CB, Callback_fn_completed aActionCompleted_CB) -{ - mActionInitiated_CB = aActionInitiated_CB; - mActionCompleted_CB = aActionCompleted_CB; -} - -bool LightingManager::IsActionInProgress() -{ - return (mState == kState_OffInitiated || mState == kState_OnInitiated); -} - -bool LightingManager::IsLightOn() -{ - return (mState == kState_OnCompleted); -} - -bool LightingManager::InitiateAction(int32_t aActor, Action_t aAction) -{ - bool action_initiated = false; - State_t new_state; - - // Initiate Turn On/Off Action only when the previous one is complete. - if (mState == kState_OffCompleted && aAction == ON_ACTION) - { - action_initiated = true; - - new_state = kState_OnInitiated; - } - else if (mState == kState_OnCompleted && aAction == OFF_ACTION) - { - action_initiated = true; - - new_state = kState_OffInitiated; - } - - if (action_initiated) - { - StartTimer(ACTUATOR_MOVEMENT_PERIOD_MS); - - // Since the timer started successfully, update the state and trigger callback - mState = new_state; - - if (mActionInitiated_CB) - { - mActionInitiated_CB(aAction, aActor); - } - } - - return action_initiated; -} - -void LightingManager::StartTimer(uint32_t aTimeoutMs) -{ - if (xTimerIsTimerActive(sLightTimer)) - { - PLAT_LOG("app timer already started!"); - CancelTimer(); - } - - // timer is not active, change its period to required value (== restart). - // FreeRTOS- Block for a maximum of 100 ticks if the change period command - // cannot immediately be sent to the timer command queue. - if (xTimerChangePeriod(sLightTimer, pdMS_TO_TICKS(aTimeoutMs), 100) != pdPASS) - { - PLAT_LOG("sLightTimer timer start() failed"); - } -} - -void LightingManager::CancelTimer(void) -{ - if (xTimerStop(sLightTimer, 0) == pdFAIL) - { - PLAT_LOG("sLightTimer stop() failed"); - } -} - -void LightingManager::TimerEventHandler(TimerHandle_t xTimer) -{ - // Get light obj context from timer id. - LightingManager * light = static_cast(pvTimerGetTimerID(xTimer)); - - // The timer event handler will be called in the context of the timer task - // once sLightTimer expires. Post an event to apptask queue with the actual handler - // so that the event can be handled in the context of the apptask. - AppEvent event; - event.Type = AppEvent::kEventType_AppEvent; - event.LightEvent.Context = light; - - event.Handler = ActuatorMovementTimerEventHandler; - - AppTask::GetAppTask().PostEvent(&event); -} - -void LightingManager::ActuatorMovementTimerEventHandler(AppEvent * aEvent) -{ - Action_t actionCompleted = INVALID_ACTION; - - LightingManager * light = static_cast(aEvent->LightEvent.Context); - - if (light->mState == kState_OffInitiated) - { - light->mState = kState_OffCompleted; - actionCompleted = OFF_ACTION; - OnOffServer::Instance().setOnOffValue(1, 0, false); - } - else if (light->mState == kState_OnInitiated) - { - light->mState = kState_OnCompleted; - actionCompleted = ON_ACTION; - OnOffServer::Instance().setOnOffValue(1, 1, false); - } - - if (actionCompleted != INVALID_ACTION) - { - if (light->mActionCompleted_CB) - { - light->mActionCompleted_CB(actionCompleted); - } - } -} diff --git a/examples/lighting-app/cc13x2x7_26x2x7/src/LightingManager.h b/examples/lighting-app/cc13x2x7_26x2x7/src/LightingManager.h deleted file mode 100644 index 818feed45ee87a..00000000000000 --- a/examples/lighting-app/cc13x2x7_26x2x7/src/LightingManager.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - * - * Copyright (c) 2019 Google LLC. - * All rights reserved. - * - * 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. - */ - -#pragma once - -#include -#include - -#include "AppEvent.h" - -#include "FreeRTOS.h" -#include "timers.h" // provides FreeRTOS timer support -#include - -#include - -class LightingManager -{ -public: - enum Action_t - { - ON_ACTION = 0, - OFF_ACTION, - - INVALID_ACTION - } Action; - - enum State_t - { - kState_OffInitiated = 0, - kState_OffCompleted, - kState_OnInitiated, - kState_OnCompleted, - } State; - - CHIP_ERROR Init(); - bool IsLightOn(); - bool IsActionInProgress(); - bool InitiateAction(int32_t aActor, Action_t aAction); - - typedef void (*Callback_fn_initiated)(Action_t, int32_t aActor); - typedef void (*Callback_fn_completed)(Action_t); - void SetCallbacks(Callback_fn_initiated aActionInitiated_CB, Callback_fn_completed aActionCompleted_CB); - - static void OnTriggerOffWithEffect(OnOffEffect * effect); - -private: - friend LightingManager & LightMgr(void); - State_t mState; - - Callback_fn_initiated mActionInitiated_CB; - Callback_fn_completed mActionCompleted_CB; - - void CancelTimer(void); - void StartTimer(uint32_t aTimeoutMs); - - static void TimerEventHandler(TimerHandle_t xTimer); - static void ActuatorMovementTimerEventHandler(AppEvent * aEvent); - static void OffEffectTimerEventHandler(AppEvent * aEvent); - - static LightingManager sLight; -}; - -inline LightingManager & LightMgr(void) -{ - return LightingManager::sLight; -} diff --git a/examples/lighting-app/cc13x2x7_26x2x7/src/ZclCallbacks.cpp b/examples/lighting-app/cc13x2x7_26x2x7/src/ZclCallbacks.cpp deleted file mode 100644 index 7bb20a45944545..00000000000000 --- a/examples/lighting-app/cc13x2x7_26x2x7/src/ZclCallbacks.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/* - * - * Copyright (c) 2020 Project CHIP Authors - * - * 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. - */ - -/** - * @file - * This file implements the handler for data model messages. - */ - -#include "AppConfig.h" -#include "LightingManager.h" - -#include -#include -#include -#include - -using namespace ::chip; -using namespace ::chip::app::Clusters; - -void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & attributePath, uint8_t type, uint16_t size, - uint8_t * value) -{ - ClusterId clusterId = attributePath.mClusterId; - AttributeId attributeId = attributePath.mAttributeId; - ChipLogProgress(Zcl, "Cluster callback: " ChipLogFormatMEI, ChipLogValueMEI(clusterId)); - - if (clusterId == OnOff::Id && attributeId == OnOff::Attributes::OnOff::Id) - { - LightMgr().InitiateAction(AppEvent::kEventType_Light, *value ? LightingManager::ON_ACTION : LightingManager::OFF_ACTION); - } - else if (clusterId == Identify::Id) - { - ChipLogProgress(Zcl, "Identify attribute ID: " ChipLogFormatMEI " Type: %u Value: %u, length %u", - ChipLogValueMEI(attributeId), type, *value, size); - } - else if (clusterId == Groups::Id) - { - ChipLogProgress(Zcl, "Groups attribute ID: " ChipLogFormatMEI " Type: %u Value: %u, length %u", - ChipLogValueMEI(attributeId), type, *value, size); - } -} - -/** @brief OnOff Cluster Init - * - * This function is called when a specific cluster is initialized. It gives the - * application an opportunity to take care of cluster initialization procedures. - * It is called exactly once for each endpoint where cluster is present. - * - * @param endpoint Ver.: always - * - * TODO Issue #3841 - * emberAfOnOffClusterInitCallback happens before the stack initialize the cluster - * attributes to the default value. - * The logic here expects something similar to the deprecated Plugins callback - * emberAfPluginOnOffClusterServerPostInitCallback. - * - */ -void emberAfOnOffClusterInitCallback(EndpointId endpoint) -{ - // TODO: implement any additional Cluster Server init actions -} diff --git a/examples/lighting-app/cc13x2x7_26x2x7/src/main.cpp b/examples/lighting-app/cc13x2x7_26x2x7/src/main.cpp deleted file mode 100644 index 4fdb88703acab6..00000000000000 --- a/examples/lighting-app/cc13x2x7_26x2x7/src/main.cpp +++ /dev/null @@ -1,105 +0,0 @@ -/* - * - * Copyright (c) 2020 Project CHIP Authors - * Copyright (c) 2020 Texas Instruments Incorporated - * - * 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. - */ - -#include -#include - -#include - -#include "AppConfig.h" -#include "AppTask.h" - -#include - -/* Driver Header files */ -#include -#include -#include - -#include -#include -#include -#include - -#include -#define TOTAL_ICALL_HEAP_SIZE (0xc600) - -using namespace ::chip; -using namespace ::chip::Inet; -using namespace ::chip::DeviceLayer; - -__attribute__((section(".heap"))) uint8_t GlobalHeapZoneBuffer[TOTAL_ICALL_HEAP_SIZE]; -uint32_t heapSize = TOTAL_ICALL_HEAP_SIZE; - -// ================================================================================ -// FreeRTOS Callbacks -// ================================================================================ -extern "C" void vApplicationStackOverflowHook(void) -{ - while (1) - { - ; - } -} - -/* Wrapper functions for using the queue registry regardless of whether it is enabled or disabled */ -extern "C" void vQueueAddToRegistryWrapper(QueueHandle_t xQueue, const char * pcQueueName) -{ - /* This function is intentionally left empty as the Queue Registry is disabled */ -} - -extern "C" void vQueueUnregisterQueueWrapper(QueueHandle_t xQueue) -{ - /* This function is intentionally left empty as the Queue Registry is disabled */ -} - -// ================================================================================ -// Main Code -// ================================================================================ -int main(void) -{ - Board_init(); - bpool((void *) GlobalHeapZoneBuffer, TOTAL_ICALL_HEAP_SIZE); - - GPIO_init(); - - NVS_init(); - - ECDH_init(); - - ECDSA_init(); - - AESECB_init(); - - SHA2_init(); - - int ret = GetAppTask().StartAppTask(); - if (ret != 0) - { - // can't log until the kernel is started - // PLAT_LOG("GetAppTask().StartAppTask() failed"); - while (1) - ; - } - - vTaskStartScheduler(); - - // Should never get here. - while (1) - ; -} diff --git a/examples/lighting-app/cc13x2x7_26x2x7/third_party/connectedhomeip b/examples/lighting-app/cc13x2x7_26x2x7/third_party/connectedhomeip deleted file mode 120000 index c866b86874994d..00000000000000 --- a/examples/lighting-app/cc13x2x7_26x2x7/third_party/connectedhomeip +++ /dev/null @@ -1 +0,0 @@ -../../../.. \ No newline at end of file diff --git a/examples/lighting-app/esp32/main/DeviceWithDisplay.cpp b/examples/lighting-app/esp32/main/DeviceWithDisplay.cpp index b869ba5ae61fbb..2027bbf0883ef4 100644 --- a/examples/lighting-app/esp32/main/DeviceWithDisplay.cpp +++ b/examples/lighting-app/esp32/main/DeviceWithDisplay.cpp @@ -25,6 +25,8 @@ #include #include +#include + using namespace ::chip; using namespace ::chip::Credentials; using namespace ::chip::DeviceManager; diff --git a/examples/lighting-app/esp32/main/QRCodeScreen.cpp b/examples/lighting-app/esp32/main/QRCodeScreen.cpp index d4113c4d0889b9..a75c29e9170d06 100644 --- a/examples/lighting-app/esp32/main/QRCodeScreen.cpp +++ b/examples/lighting-app/esp32/main/QRCodeScreen.cpp @@ -42,6 +42,8 @@ #include #include +#include + namespace { constexpr int kVersion = 4; diff --git a/examples/lighting-app/esp32/main/StatusScreen.cpp b/examples/lighting-app/esp32/main/StatusScreen.cpp index 698a12d835ce06..b97da9d671af7e 100644 --- a/examples/lighting-app/esp32/main/StatusScreen.cpp +++ b/examples/lighting-app/esp32/main/StatusScreen.cpp @@ -45,6 +45,8 @@ #include #include +#include + #define MAX_LENGTH_SMALL_FONT 30 using namespace chip; diff --git a/examples/lighting-app/esp32/main/include/QRCodeScreen.h b/examples/lighting-app/esp32/main/include/QRCodeScreen.h index 3479c7d0256103..e6eb45d6ca2251 100644 --- a/examples/lighting-app/esp32/main/include/QRCodeScreen.h +++ b/examples/lighting-app/esp32/main/include/QRCodeScreen.h @@ -25,6 +25,7 @@ #include "ScreenManager.h" #include +#include #include class QRCodeScreen : public Screen diff --git a/examples/lighting-app/infineon/cyw30739/src/LightingManager.cpp b/examples/lighting-app/infineon/cyw30739/src/LightingManager.cpp index 3d750b9446ea11..a121801134a24c 100644 --- a/examples/lighting-app/infineon/cyw30739/src/LightingManager.cpp +++ b/examples/lighting-app/infineon/cyw30739/src/LightingManager.cpp @@ -19,7 +19,6 @@ #include "LightingManager.h" #include -#include #include #include diff --git a/examples/lighting-app/linux/LightingAppCommandDelegate.cpp b/examples/lighting-app/linux/LightingAppCommandDelegate.cpp index 61946938e294c0..cc5af976eb8b1a 100644 --- a/examples/lighting-app/linux/LightingAppCommandDelegate.cpp +++ b/examples/lighting-app/linux/LightingAppCommandDelegate.cpp @@ -24,8 +24,11 @@ #include #include #include +#include #include +#include + using namespace chip; using namespace chip::app; using namespace chip::app::Clusters; diff --git a/examples/lighting-app/linux/main.cpp b/examples/lighting-app/linux/main.cpp index 149898bf86360f..56cafc2e527509 100644 --- a/examples/lighting-app/linux/main.cpp +++ b/examples/lighting-app/linux/main.cpp @@ -26,6 +26,8 @@ #include #include +#include + #if defined(CHIP_IMGUI_ENABLED) && CHIP_IMGUI_ENABLED #include #include diff --git a/examples/lighting-app/nxp/k32w/k32w0/BUILD.gn b/examples/lighting-app/nxp/k32w/k32w0/BUILD.gn index 43a9860b5da48a..322c728a063ba7 100644 --- a/examples/lighting-app/nxp/k32w/k32w0/BUILD.gn +++ b/examples/lighting-app/nxp/k32w/k32w0/BUILD.gn @@ -112,6 +112,7 @@ k32w0_executable("light_app") { "${chip_root}/examples/common/QRCode", "${chip_root}/examples/lighting-app/nxp/zap/", "${chip_root}/examples/providers:device_info_provider", + "${chip_root}/src/app:test-event-trigger", "${chip_root}/src/lib", "${chip_root}/src/platform:syscalls_stub", "${chip_root}/third_party/mbedtls:mbedtls", diff --git a/examples/lighting-app/nxp/k32w/k32w0/main/ZclCallbacks.cpp b/examples/lighting-app/nxp/k32w/k32w0/main/ZclCallbacks.cpp index 5a4eee6e2c09e4..caccdf51b0665b 100644 --- a/examples/lighting-app/nxp/k32w/k32w0/main/ZclCallbacks.cpp +++ b/examples/lighting-app/nxp/k32w/k32w0/main/ZclCallbacks.cpp @@ -25,7 +25,6 @@ #include #include #include -#include using namespace ::chip; using namespace ::chip::app::Clusters; diff --git a/examples/lighting-app/nxp/k32w/k32w1/main/AppTask.cpp b/examples/lighting-app/nxp/k32w/k32w1/main/AppTask.cpp index 96f5a5b96b3248..4c1d0875470ee4 100644 --- a/examples/lighting-app/nxp/k32w/k32w1/main/AppTask.cpp +++ b/examples/lighting-app/nxp/k32w/k32w1/main/AppTask.cpp @@ -236,7 +236,7 @@ void AppTask::InitServer(intptr_t arg) #endif #if defined(USE_SMU2_DYNAMIC) - VerifyOrDie(SMU2::Init(initParams.persistentStorageDelegate) == CHIP_NO_ERROR); + VerifyOrDie(SMU2::Init() == CHIP_NO_ERROR); #endif // Init ZCL Data Model and start server diff --git a/examples/lighting-app/nxp/k32w/k32w1/main/ZclCallbacks.cpp b/examples/lighting-app/nxp/k32w/k32w1/main/ZclCallbacks.cpp index a9c6aee8798c49..97a3fb9aa72a98 100644 --- a/examples/lighting-app/nxp/k32w/k32w1/main/ZclCallbacks.cpp +++ b/examples/lighting-app/nxp/k32w/k32w1/main/ZclCallbacks.cpp @@ -25,7 +25,6 @@ #include #include #include -#include using namespace ::chip; using namespace ::chip::app::Clusters; diff --git a/examples/lighting-app/silabs/build_for_wifi_args.gni b/examples/lighting-app/silabs/build_for_wifi_args.gni index bbb57ae35a4343..7e33551c30a97c 100644 --- a/examples/lighting-app/silabs/build_for_wifi_args.gni +++ b/examples/lighting-app/silabs/build_for_wifi_args.gni @@ -18,6 +18,9 @@ silabs_sdk_target = get_label_info(":sdk", "label_no_toolchain") chip_enable_openthread = false import("${chip_root}/src/platform/silabs/wifi_args.gni") +# Not needed for the Lighting-app +chip_enable_read_client = false + chip_enable_ota_requestor = true app_data_model = "${chip_root}/examples/lighting-app/silabs/data_model:silabs-lighting" diff --git a/examples/lighting-app/silabs/data_model/lighting-thread-app.matter b/examples/lighting-app/silabs/data_model/lighting-thread-app.matter index 415281989cae5d..0cb630900c3ddf 100644 --- a/examples/lighting-app/silabs/data_model/lighting-thread-app.matter +++ b/examples/lighting-app/silabs/data_model/lighting-thread-app.matter @@ -745,265 +745,6 @@ cluster TimeFormatLocalization = 44 { readonly attribute int16u clusterRevision = 65533; } -/** This cluster is used to describe the configuration and capabilities of a physical power source that provides power to the Node. */ -cluster PowerSource = 47 { - revision 1; // NOTE: Default/not specifically set - - enum BatApprovedChemistryEnum : enum16 { - kUnspecified = 0; - kAlkaline = 1; - kLithiumCarbonFluoride = 2; - kLithiumChromiumOxide = 3; - kLithiumCopperOxide = 4; - kLithiumIronDisulfide = 5; - kLithiumManganeseDioxide = 6; - kLithiumThionylChloride = 7; - kMagnesium = 8; - kMercuryOxide = 9; - kNickelOxyhydride = 10; - kSilverOxide = 11; - kZincAir = 12; - kZincCarbon = 13; - kZincChloride = 14; - kZincManganeseDioxide = 15; - kLeadAcid = 16; - kLithiumCobaltOxide = 17; - kLithiumIon = 18; - kLithiumIonPolymer = 19; - kLithiumIronPhosphate = 20; - kLithiumSulfur = 21; - kLithiumTitanate = 22; - kNickelCadmium = 23; - kNickelHydrogen = 24; - kNickelIron = 25; - kNickelMetalHydride = 26; - kNickelZinc = 27; - kSilverZinc = 28; - kSodiumIon = 29; - kSodiumSulfur = 30; - kZincBromide = 31; - kZincCerium = 32; - } - - enum BatChargeFaultEnum : enum8 { - kUnspecified = 0; - kAmbientTooHot = 1; - kAmbientTooCold = 2; - kBatteryTooHot = 3; - kBatteryTooCold = 4; - kBatteryAbsent = 5; - kBatteryOverVoltage = 6; - kBatteryUnderVoltage = 7; - kChargerOverVoltage = 8; - kChargerUnderVoltage = 9; - kSafetyTimeout = 10; - } - - enum BatChargeLevelEnum : enum8 { - kOK = 0; - kWarning = 1; - kCritical = 2; - } - - enum BatChargeStateEnum : enum8 { - kUnknown = 0; - kIsCharging = 1; - kIsAtFullCharge = 2; - kIsNotCharging = 3; - } - - enum BatCommonDesignationEnum : enum16 { - kUnspecified = 0; - kAAA = 1; - kAA = 2; - kC = 3; - kD = 4; - k4v5 = 5; - k6v0 = 6; - k9v0 = 7; - k12AA = 8; - kAAAA = 9; - kA = 10; - kB = 11; - kF = 12; - kN = 13; - kNo6 = 14; - kSubC = 15; - kA23 = 16; - kA27 = 17; - kBA5800 = 18; - kDuplex = 19; - k4SR44 = 20; - k523 = 21; - k531 = 22; - k15v0 = 23; - k22v5 = 24; - k30v0 = 25; - k45v0 = 26; - k67v5 = 27; - kJ = 28; - kCR123A = 29; - kCR2 = 30; - k2CR5 = 31; - kCRP2 = 32; - kCRV3 = 33; - kSR41 = 34; - kSR43 = 35; - kSR44 = 36; - kSR45 = 37; - kSR48 = 38; - kSR54 = 39; - kSR55 = 40; - kSR57 = 41; - kSR58 = 42; - kSR59 = 43; - kSR60 = 44; - kSR63 = 45; - kSR64 = 46; - kSR65 = 47; - kSR66 = 48; - kSR67 = 49; - kSR68 = 50; - kSR69 = 51; - kSR516 = 52; - kSR731 = 53; - kSR712 = 54; - kLR932 = 55; - kA5 = 56; - kA10 = 57; - kA13 = 58; - kA312 = 59; - kA675 = 60; - kAC41E = 61; - k10180 = 62; - k10280 = 63; - k10440 = 64; - k14250 = 65; - k14430 = 66; - k14500 = 67; - k14650 = 68; - k15270 = 69; - k16340 = 70; - kRCR123A = 71; - k17500 = 72; - k17670 = 73; - k18350 = 74; - k18500 = 75; - k18650 = 76; - k19670 = 77; - k25500 = 78; - k26650 = 79; - k32600 = 80; - } - - enum BatFaultEnum : enum8 { - kUnspecified = 0; - kOverTemp = 1; - kUnderTemp = 2; - } - - enum BatReplaceabilityEnum : enum8 { - kUnspecified = 0; - kNotReplaceable = 1; - kUserReplaceable = 2; - kFactoryReplaceable = 3; - } - - enum PowerSourceStatusEnum : enum8 { - kUnspecified = 0; - kActive = 1; - kStandby = 2; - kUnavailable = 3; - } - - enum WiredCurrentTypeEnum : enum8 { - kAC = 0; - kDC = 1; - } - - enum WiredFaultEnum : enum8 { - kUnspecified = 0; - kOverVoltage = 1; - kUnderVoltage = 2; - } - - bitmap Feature : bitmap32 { - kWired = 0x1; - kBattery = 0x2; - kRechargeable = 0x4; - kReplaceable = 0x8; - } - - struct BatChargeFaultChangeType { - BatChargeFaultEnum current[] = 0; - BatChargeFaultEnum previous[] = 1; - } - - struct BatFaultChangeType { - BatFaultEnum current[] = 0; - BatFaultEnum previous[] = 1; - } - - struct WiredFaultChangeType { - WiredFaultEnum current[] = 0; - WiredFaultEnum previous[] = 1; - } - - info event WiredFaultChange = 0 { - WiredFaultEnum current[] = 0; - WiredFaultEnum previous[] = 1; - } - - info event BatFaultChange = 1 { - BatFaultEnum current[] = 0; - BatFaultEnum previous[] = 1; - } - - info event BatChargeFaultChange = 2 { - BatChargeFaultEnum current[] = 0; - BatChargeFaultEnum previous[] = 1; - } - - readonly attribute PowerSourceStatusEnum status = 0; - readonly attribute int8u order = 1; - readonly attribute char_string<60> description = 2; - readonly attribute optional nullable int32u wiredAssessedInputVoltage = 3; - readonly attribute optional nullable int16u wiredAssessedInputFrequency = 4; - readonly attribute optional WiredCurrentTypeEnum wiredCurrentType = 5; - readonly attribute optional nullable int32u wiredAssessedCurrent = 6; - readonly attribute optional int32u wiredNominalVoltage = 7; - readonly attribute optional int32u wiredMaximumCurrent = 8; - readonly attribute optional boolean wiredPresent = 9; - readonly attribute optional WiredFaultEnum activeWiredFaults[] = 10; - readonly attribute optional nullable int32u batVoltage = 11; - readonly attribute optional nullable int8u batPercentRemaining = 12; - readonly attribute optional nullable int32u batTimeRemaining = 13; - readonly attribute optional BatChargeLevelEnum batChargeLevel = 14; - readonly attribute optional boolean batReplacementNeeded = 15; - readonly attribute optional BatReplaceabilityEnum batReplaceability = 16; - readonly attribute optional boolean batPresent = 17; - readonly attribute optional BatFaultEnum activeBatFaults[] = 18; - readonly attribute optional char_string<60> batReplacementDescription = 19; - readonly attribute optional BatCommonDesignationEnum batCommonDesignation = 20; - readonly attribute optional char_string<20> batANSIDesignation = 21; - readonly attribute optional char_string<20> batIECDesignation = 22; - readonly attribute optional BatApprovedChemistryEnum batApprovedChemistry = 23; - readonly attribute optional int32u batCapacity = 24; - readonly attribute optional int8u batQuantity = 25; - readonly attribute optional BatChargeStateEnum batChargeState = 26; - readonly attribute optional nullable int32u batTimeToFullCharge = 27; - readonly attribute optional boolean batFunctionalWhileCharging = 28; - readonly attribute optional nullable int32u batChargingCurrent = 29; - readonly attribute optional BatChargeFaultEnum activeBatChargeFaults[] = 30; - readonly attribute endpoint_no endpointList[] = 31; - readonly attribute command_id generatedCommandList[] = 65528; - readonly attribute command_id acceptedCommandList[] = 65529; - readonly attribute event_id eventList[] = 65530; - readonly attribute attrib_id attributeList[] = 65531; - readonly attribute bitmap32 featureMap = 65532; - readonly attribute int16u clusterRevision = 65533; -} - /** This cluster is used to manage global aspects of the Commissioning flow. */ cluster GeneralCommissioning = 48 { revision 1; // NOTE: Default/not specifically set @@ -1253,53 +994,6 @@ cluster NetworkCommissioning = 49 { command access(invoke: administer) QueryIdentity(QueryIdentityRequest): QueryIdentityResponse = 9; } -/** The cluster provides commands for retrieving unstructured diagnostic logs from a Node that may be used to aid in diagnostics. */ -cluster DiagnosticLogs = 50 { - revision 1; // NOTE: Default/not specifically set - - enum IntentEnum : enum8 { - kEndUserSupport = 0; - kNetworkDiag = 1; - kCrashLogs = 2; - } - - enum StatusEnum : enum8 { - kSuccess = 0; - kExhausted = 1; - kNoLogs = 2; - kBusy = 3; - kDenied = 4; - } - - enum TransferProtocolEnum : enum8 { - kResponsePayload = 0; - kBDX = 1; - } - - readonly attribute command_id generatedCommandList[] = 65528; - readonly attribute command_id acceptedCommandList[] = 65529; - readonly attribute event_id eventList[] = 65530; - readonly attribute attrib_id attributeList[] = 65531; - readonly attribute bitmap32 featureMap = 65532; - readonly attribute int16u clusterRevision = 65533; - - request struct RetrieveLogsRequestRequest { - IntentEnum intent = 0; - TransferProtocolEnum requestedProtocol = 1; - optional char_string<32> transferFileDesignator = 2; - } - - response struct RetrieveLogsResponse = 1 { - StatusEnum status = 0; - long_octet_string logContent = 1; - optional epoch_us UTCTimeStamp = 2; - optional systime_us timeSinceBoot = 3; - } - - /** Retrieving diagnostic logs from a Node */ - command RetrieveLogsRequest(RetrieveLogsRequestRequest): RetrieveLogsResponse = 0; -} - /** The General Diagnostics Cluster, along with other diagnostics clusters, provide a means to acquire standardized diagnostics metrics that MAY be used by a Node to assist a user or Administrative Node in diagnosing potential problems. */ cluster GeneralDiagnostics = 51 { revision 2; @@ -1431,43 +1125,6 @@ cluster GeneralDiagnostics = 51 { command PayloadTestRequest(PayloadTestRequestRequest): PayloadTestResponse = 3; } -/** The Software Diagnostics Cluster provides a means to acquire standardized diagnostics metrics that MAY be used by a Node to assist a user or Administrative Node in diagnosing potential problems. */ -cluster SoftwareDiagnostics = 52 { - revision 1; // NOTE: Default/not specifically set - - bitmap Feature : bitmap32 { - kWatermarks = 0x1; - } - - struct ThreadMetricsStruct { - int64u id = 0; - optional char_string<8> name = 1; - optional int32u stackFreeCurrent = 2; - optional int32u stackFreeMinimum = 3; - optional int32u stackSize = 4; - } - - info event SoftwareFault = 0 { - int64u id = 0; - optional char_string name = 1; - optional octet_string faultRecording = 2; - } - - readonly attribute optional ThreadMetricsStruct threadMetrics[] = 0; - readonly attribute optional int64u currentHeapFree = 1; - readonly attribute optional int64u currentHeapUsed = 2; - readonly attribute optional int64u currentHeapHighWatermark = 3; - readonly attribute command_id generatedCommandList[] = 65528; - readonly attribute command_id acceptedCommandList[] = 65529; - readonly attribute event_id eventList[] = 65530; - readonly attribute attrib_id attributeList[] = 65531; - readonly attribute bitmap32 featureMap = 65532; - readonly attribute int16u clusterRevision = 65533; - - /** Reception of this command SHALL reset the values: The StackFreeMinimum field of the ThreadMetrics attribute, CurrentHeapHighWaterMark attribute. */ - command access(invoke: manage) ResetWatermarks(): DefaultSuccess = 0; -} - /** The Thread Network Diagnostics Cluster provides a means to acquire standardized diagnostics metrics that MAY be used by a Node to assist a user or Administrative Node in diagnosing potential problems */ cluster ThreadNetworkDiagnostics = 53 { revision 2; @@ -1888,43 +1545,6 @@ cluster GroupKeyManagement = 63 { fabric command access(invoke: administer) KeySetReadAllIndices(): KeySetReadAllIndicesResponse = 4; } -/** The Fixed Label Cluster provides a feature for the device to tag an endpoint with zero or more read only -labels. */ -cluster FixedLabel = 64 { - revision 1; // NOTE: Default/not specifically set - - struct LabelStruct { - char_string<16> label = 0; - char_string<16> value = 1; - } - - readonly attribute LabelStruct labelList[] = 0; - readonly attribute command_id generatedCommandList[] = 65528; - readonly attribute command_id acceptedCommandList[] = 65529; - readonly attribute event_id eventList[] = 65530; - readonly attribute attrib_id attributeList[] = 65531; - readonly attribute bitmap32 featureMap = 65532; - readonly attribute int16u clusterRevision = 65533; -} - -/** The User Label Cluster provides a feature to tag an endpoint with zero or more labels. */ -cluster UserLabel = 65 { - revision 1; // NOTE: Default/not specifically set - - struct LabelStruct { - char_string<16> label = 0; - char_string<16> value = 1; - } - - attribute access(write: manage) LabelStruct labelList[] = 0; - readonly attribute command_id generatedCommandList[] = 65528; - readonly attribute command_id acceptedCommandList[] = 65529; - readonly attribute event_id eventList[] = 65530; - readonly attribute attrib_id attributeList[] = 65531; - readonly attribute bitmap32 featureMap = 65532; - readonly attribute int16u clusterRevision = 65533; -} - /** Attributes and commands for scene configuration and manipulation. */ provisional cluster ScenesManagement = 98 { revision 1; @@ -2515,13 +2135,6 @@ endpoint 0 { handle command ReorderNetwork; } - server cluster DiagnosticLogs { - ram attribute featureMap default = 0; - ram attribute clusterRevision default = 1; - - handle command RetrieveLogsRequest; - } - server cluster GeneralDiagnostics { emits event BootReason; callback attribute networkInterfaces; @@ -2541,18 +2154,6 @@ endpoint 0 { handle command TimeSnapshotResponse; } - server cluster SoftwareDiagnostics { - emits event SoftwareFault; - callback attribute threadMetrics; - callback attribute currentHeapFree; - callback attribute currentHeapUsed; - callback attribute currentHeapHighWatermark; - callback attribute featureMap; - ram attribute clusterRevision default = 1; - - handle command ResetWatermarks; - } - server cluster ThreadNetworkDiagnostics { callback attribute channel; callback attribute routingRole; @@ -2673,22 +2274,9 @@ endpoint 0 { handle command KeySetReadAllIndices; handle command KeySetReadAllIndicesResponse; } - - server cluster FixedLabel { - callback attribute labelList; - ram attribute featureMap default = 0; - ram attribute clusterRevision default = 1; - } - - server cluster UserLabel { - callback attribute labelList; - ram attribute featureMap default = 0; - ram attribute clusterRevision default = 1; - } } endpoint 1 { - device type ma_powersource = 17, version 1; - device type ma_dimmablelight = 257, version 1; + device type ma_extendedcolorlight = 269, version 1; server cluster Identify { @@ -2767,7 +2355,7 @@ endpoint 1 { callback attribute eventList; callback attribute attributeList; ram attribute featureMap default = 3; - ram attribute clusterRevision default = 6; + ram attribute clusterRevision default = 5; handle command MoveToLevel; handle command Move; @@ -2792,26 +2380,6 @@ endpoint 1 { callback attribute clusterRevision; } - server cluster PowerSource { - ram attribute status default = 0; - ram attribute order default = 0; - ram attribute description default = "USB"; - ram attribute wiredAssessedInputVoltage; - ram attribute wiredAssessedInputFrequency; - ram attribute wiredCurrentType default = 1; - ram attribute wiredAssessedCurrent; - ram attribute wiredNominalVoltage default = 5000; - ram attribute wiredMaximumCurrent default = 1000; - ram attribute wiredPresent default = 1; - callback attribute endpointList; - callback attribute generatedCommandList; - callback attribute acceptedCommandList; - callback attribute eventList; - callback attribute attributeList; - ram attribute featureMap default = 1; - ram attribute clusterRevision default = 2; - } - server cluster ScenesManagement { ram attribute lastConfiguredBy; ram attribute sceneTableSize default = 16; @@ -2860,6 +2428,10 @@ endpoint 1 { ram attribute colorTempPhysicalMaxMireds default = 0xFEFF; ram attribute coupleColorTempToLevelMinMireds; persist attribute startUpColorTemperatureMireds; + callback attribute generatedCommandList; + callback attribute acceptedCommandList; + callback attribute eventList; + callback attribute attributeList; ram attribute featureMap default = 0x1F; ram attribute clusterRevision default = 6; diff --git a/examples/lighting-app/silabs/data_model/lighting-thread-app.zap b/examples/lighting-app/silabs/data_model/lighting-thread-app.zap index b894a2f5a70c00..437aac9d67bdac 100644 --- a/examples/lighting-app/silabs/data_model/lighting-thread-app.zap +++ b/examples/lighting-app/silabs/data_model/lighting-thread-app.zap @@ -17,6 +17,12 @@ } ], "package": [ + { + "pathRelativity": "relativeToZap", + "path": "../../../../src/app/zap-templates/app-templates.json", + "type": "gen-templates-json", + "version": "chip-v1" + }, { "pathRelativity": "relativeToZap", "path": "../../../../src/app/zap-templates/zcl/zcl.json", @@ -24,12 +30,6 @@ "category": "matter", "version": 1, "description": "Matter SDK ZCL data" - }, - { - "pathRelativity": "relativeToZap", - "path": "../../../../src/app/zap-templates/app-templates.json", - "type": "gen-templates-json", - "version": "chip-v1" } ], "endpointTypes": [ @@ -1494,58 +1494,6 @@ } ] }, - { - "name": "Diagnostic Logs", - "code": 50, - "mfgCode": null, - "define": "DIAGNOSTIC_LOGS_CLUSTER", - "side": "server", - "enabled": 1, - "commands": [ - { - "name": "RetrieveLogsRequest", - "code": 0, - "mfgCode": null, - "source": "client", - "isIncoming": 1, - "isEnabled": 1 - } - ], - "attributes": [ - { - "name": "FeatureMap", - "code": 65532, - "mfgCode": null, - "side": "server", - "type": "bitmap32", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "0", - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, - { - "name": "ClusterRevision", - "code": 65533, - "mfgCode": null, - "side": "server", - "type": "int16u", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "1", - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - } - ] - }, { "name": "General Diagnostics", "code": 51, @@ -1767,131 +1715,6 @@ } ] }, - { - "name": "Software Diagnostics", - "code": 52, - "mfgCode": null, - "define": "SOFTWARE_DIAGNOSTICS_CLUSTER", - "side": "server", - "enabled": 1, - "commands": [ - { - "name": "ResetWatermarks", - "code": 0, - "mfgCode": null, - "source": "client", - "isIncoming": 1, - "isEnabled": 1 - } - ], - "attributes": [ - { - "name": "ThreadMetrics", - "code": 0, - "mfgCode": null, - "side": "server", - "type": "array", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": null, - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, - { - "name": "CurrentHeapFree", - "code": 1, - "mfgCode": null, - "side": "server", - "type": "int64u", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": null, - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, - { - "name": "CurrentHeapUsed", - "code": 2, - "mfgCode": null, - "side": "server", - "type": "int64u", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": null, - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, - { - "name": "CurrentHeapHighWatermark", - "code": 3, - "mfgCode": null, - "side": "server", - "type": "int64u", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": null, - "reportable": 1, - "minInterval": 0, - "maxInterval": 65344, - "reportableChange": 0 - }, - { - "name": "FeatureMap", - "code": 65532, - "mfgCode": null, - "side": "server", - "type": "bitmap32", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": null, - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, - { - "name": "ClusterRevision", - "code": 65533, - "mfgCode": null, - "side": "server", - "type": "int16u", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "1", - "reportable": 1, - "minInterval": 0, - "maxInterval": 65344, - "reportableChange": 0 - } - ], - "events": [ - { - "name": "SoftwareFault", - "code": 0, - "mfgCode": null, - "side": "server", - "included": 1 - } - ] - }, { "name": "Thread Network Diagnostics", "code": 53, @@ -3451,229 +3274,105 @@ "reportableChange": 0 } ] - }, + } + ] + }, + { + "id": 2, + "name": "MA-dimmablelight", + "deviceTypeRef": { + "code": 269, + "profileId": 259, + "label": "MA-extendedcolorlight", + "name": "MA-extendedcolorlight" + }, + "deviceTypes": [ + { + "code": 269, + "profileId": 259, + "label": "MA-extendedcolorlight", + "name": "MA-extendedcolorlight" + } + ], + "deviceVersions": [ + 1 + ], + "deviceIdentifiers": [ + 269 + ], + "deviceTypeName": "MA-extendedcolorlight", + "deviceTypeCode": 269, + "deviceTypeProfileId": 259, + "clusters": [ { - "name": "Fixed Label", - "code": 64, + "name": "Identify", + "code": 3, "mfgCode": null, - "define": "FIXED_LABEL_CLUSTER", + "define": "IDENTIFY_CLUSTER", "side": "server", "enabled": 1, + "commands": [ + { + "name": "Identify", + "code": 0, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "TriggerEffect", + "code": 64, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + } + ], "attributes": [ { - "name": "LabelList", + "name": "IdentifyTime", "code": 0, "mfgCode": null, "side": "server", - "type": "array", + "type": "int16u", "included": 1, - "storageOption": "External", + "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": null, - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, + "defaultValue": "0x0000", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, "reportableChange": 0 }, { - "name": "FeatureMap", - "code": 65532, + "name": "IdentifyType", + "code": 1, "mfgCode": null, "side": "server", - "type": "bitmap32", + "type": "IdentifyTypeEnum", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0", - "reportable": 1, + "defaultValue": "0x0", + "reportable": 0, "minInterval": 1, "maxInterval": 65534, "reportableChange": 0 }, { - "name": "ClusterRevision", - "code": 65533, + "name": "GeneratedCommandList", + "code": 65528, "mfgCode": null, "side": "server", - "type": "int16u", + "type": "array", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "1", - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - } - ] - }, - { - "name": "User Label", - "code": 65, - "mfgCode": null, - "define": "USER_LABEL_CLUSTER", - "side": "server", - "enabled": 1, - "attributes": [ - { - "name": "LabelList", - "code": 0, - "mfgCode": null, - "side": "server", - "type": "array", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": null, - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, - { - "name": "FeatureMap", - "code": 65532, - "mfgCode": null, - "side": "server", - "type": "bitmap32", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "0", - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, - { - "name": "ClusterRevision", - "code": 65533, - "mfgCode": null, - "side": "server", - "type": "int16u", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "1", - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - } - ] - } - ] - }, - { - "id": 2, - "name": "MA-dimmablelight", - "deviceTypeRef": { - "code": 257, - "profileId": 259, - "label": "MA-dimmablelight", - "name": "MA-dimmablelight" - }, - "deviceTypes": [ - { - "code": 257, - "profileId": 259, - "label": "MA-dimmablelight", - "name": "MA-dimmablelight" - }, - { - "code": 17, - "profileId": 259, - "label": "MA-powersource", - "name": "MA-powersource" - } - ], - "deviceVersions": [ - 1, - 1 - ], - "deviceIdentifiers": [ - 257, - 17 - ], - "deviceTypeName": "MA-dimmablelight", - "deviceTypeCode": 257, - "deviceTypeProfileId": 259, - "clusters": [ - { - "name": "Identify", - "code": 3, - "mfgCode": null, - "define": "IDENTIFY_CLUSTER", - "side": "server", - "enabled": 1, - "commands": [ - { - "name": "Identify", - "code": 0, - "mfgCode": null, - "source": "client", - "isIncoming": 1, - "isEnabled": 1 - }, - { - "name": "TriggerEffect", - "code": 64, - "mfgCode": null, - "source": "client", - "isIncoming": 1, - "isEnabled": 1 - } - ], - "attributes": [ - { - "name": "IdentifyTime", - "code": 0, - "mfgCode": null, - "side": "server", - "type": "int16u", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "0x0000", - "reportable": 1, - "minInterval": 0, - "maxInterval": 65344, - "reportableChange": 0 - }, - { - "name": "IdentifyType", - "code": 1, - "mfgCode": null, - "side": "server", - "type": "IdentifyTypeEnum", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "0x0", - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, - { - "name": "GeneratedCommandList", - "code": 65528, - "mfgCode": null, - "side": "server", - "type": "array", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": null, + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -3862,7 +3561,7 @@ "singleton": 0, "bounded": 0, "defaultValue": "", - "reportable": 1, + "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 @@ -4034,7 +3733,7 @@ "singleton": 0, "bounded": 0, "defaultValue": "0x00", - "reportable": 1, + "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 @@ -4050,7 +3749,7 @@ "singleton": 0, "bounded": 0, "defaultValue": "0x01", - "reportable": 1, + "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 @@ -4066,7 +3765,7 @@ "singleton": 0, "bounded": 0, "defaultValue": "0x0000", - "reportable": 1, + "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 @@ -4082,7 +3781,7 @@ "singleton": 0, "bounded": 0, "defaultValue": "0x0000", - "reportable": 1, + "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 @@ -4098,7 +3797,7 @@ "singleton": 0, "bounded": 0, "defaultValue": "0xFF", - "reportable": 1, + "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 @@ -4286,7 +3985,7 @@ "singleton": 0, "bounded": 0, "defaultValue": "0x01", - "reportable": 1, + "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 @@ -4302,7 +4001,7 @@ "singleton": 0, "bounded": 0, "defaultValue": "0x0000", - "reportable": 1, + "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 @@ -4318,7 +4017,7 @@ "singleton": 0, "bounded": 0, "defaultValue": "0x01", - "reportable": 1, + "reportable": 0, "minInterval": 1, "maxInterval": 65534, "reportableChange": 0 @@ -4398,7 +4097,7 @@ "singleton": 0, "bounded": 0, "defaultValue": "0x00", - "reportable": 1, + "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 @@ -4430,7 +4129,7 @@ "singleton": 0, "bounded": 0, "defaultValue": "0xFF", - "reportable": 1, + "reportable": 0, "minInterval": 1, "maxInterval": 65534, "reportableChange": 0 @@ -4494,7 +4193,7 @@ "singleton": 0, "bounded": 0, "defaultValue": "255", - "reportable": 1, + "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 @@ -4589,7 +4288,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "6", + "defaultValue": "5", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -4632,7 +4331,7 @@ "singleton": 0, "bounded": 0, "defaultValue": null, - "reportable": 1, + "reportable": 0, "minInterval": 1, "maxInterval": 65534, "reportableChange": 0 @@ -4648,7 +4347,7 @@ "singleton": 0, "bounded": 0, "defaultValue": null, - "reportable": 1, + "reportable": 0, "minInterval": 1, "maxInterval": 65534, "reportableChange": 0 @@ -4664,7 +4363,7 @@ "singleton": 0, "bounded": 0, "defaultValue": null, - "reportable": 1, + "reportable": 0, "minInterval": 1, "maxInterval": 65534, "reportableChange": 0 @@ -4767,288 +4466,6 @@ } ] }, - { - "name": "Power Source", - "code": 47, - "mfgCode": null, - "define": "POWER_SOURCE_CLUSTER", - "side": "server", - "enabled": 1, - "attributes": [ - { - "name": "Status", - "code": 0, - "mfgCode": null, - "side": "server", - "type": "PowerSourceStatusEnum", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "0", - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, - { - "name": "Order", - "code": 1, - "mfgCode": null, - "side": "server", - "type": "int8u", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "0", - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, - { - "name": "Description", - "code": 2, - "mfgCode": null, - "side": "server", - "type": "char_string", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "USB", - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, - { - "name": "WiredAssessedInputVoltage", - "code": 3, - "mfgCode": null, - "side": "server", - "type": "int32u", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": null, - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, - { - "name": "WiredAssessedInputFrequency", - "code": 4, - "mfgCode": null, - "side": "server", - "type": "int16u", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": null, - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, - { - "name": "WiredCurrentType", - "code": 5, - "mfgCode": null, - "side": "server", - "type": "WiredCurrentTypeEnum", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "1", - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, - { - "name": "WiredAssessedCurrent", - "code": 6, - "mfgCode": null, - "side": "server", - "type": "int32u", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": null, - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, - { - "name": "WiredNominalVoltage", - "code": 7, - "mfgCode": null, - "side": "server", - "type": "int32u", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "5000", - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, - { - "name": "WiredMaximumCurrent", - "code": 8, - "mfgCode": null, - "side": "server", - "type": "int32u", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "1000", - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, - { - "name": "WiredPresent", - "code": 9, - "mfgCode": null, - "side": "server", - "type": "boolean", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "1", - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, - { - "name": "EndpointList", - "code": 31, - "mfgCode": null, - "side": "server", - "type": "array", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": null, - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, - { - "name": "GeneratedCommandList", - "code": 65528, - "mfgCode": null, - "side": "server", - "type": "array", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": null, - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, - { - "name": "AcceptedCommandList", - "code": 65529, - "mfgCode": null, - "side": "server", - "type": "array", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": null, - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, - { - "name": "EventList", - "code": 65530, - "mfgCode": null, - "side": "server", - "type": "array", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": null, - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, - { - "name": "AttributeList", - "code": 65531, - "mfgCode": null, - "side": "server", - "type": "array", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": null, - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, - { - "name": "FeatureMap", - "code": 65532, - "mfgCode": null, - "side": "server", - "type": "bitmap32", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "1", - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, - { - "name": "ClusterRevision", - "code": 65533, - "mfgCode": null, - "side": "server", - "type": "int16u", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "2", - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - } - ] - }, { "name": "Scenes Management", "code": 98, @@ -5515,7 +4932,7 @@ "singleton": 0, "bounded": 0, "defaultValue": "0x0000", - "reportable": 1, + "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 @@ -5531,7 +4948,7 @@ "singleton": 0, "bounded": 0, "defaultValue": "0x616B", - "reportable": 1, + "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 @@ -5547,7 +4964,7 @@ "singleton": 0, "bounded": 0, "defaultValue": "0x607D", - "reportable": 1, + "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 @@ -5563,7 +4980,7 @@ "singleton": 0, "bounded": 0, "defaultValue": "0x00FA", - "reportable": 1, + "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 @@ -5579,7 +4996,7 @@ "singleton": 0, "bounded": 0, "defaultValue": "0x01", - "reportable": 1, + "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 @@ -5595,7 +5012,7 @@ "singleton": 0, "bounded": 0, "defaultValue": "0x00", - "reportable": 1, + "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 @@ -5611,7 +5028,7 @@ "singleton": 0, "bounded": 0, "defaultValue": "", - "reportable": 1, + "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 @@ -5643,7 +5060,7 @@ "singleton": 0, "bounded": 0, "defaultValue": "0x01", - "reportable": 1, + "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 @@ -5739,7 +5156,7 @@ "singleton": 0, "bounded": 0, "defaultValue": "0x1F", - "reportable": 1, + "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 @@ -5755,7 +5172,7 @@ "singleton": 0, "bounded": 0, "defaultValue": "0x0000", - "reportable": 1, + "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 @@ -5771,7 +5188,7 @@ "singleton": 0, "bounded": 0, "defaultValue": "0xFEFF", - "reportable": 1, + "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 @@ -5787,7 +5204,7 @@ "singleton": 0, "bounded": 0, "defaultValue": "", - "reportable": 1, + "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 @@ -5803,11 +5220,75 @@ "singleton": 0, "bounded": 0, "defaultValue": "", - "reportable": 1, + "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, + { + "name": "GeneratedCommandList", + "code": 65528, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AcceptedCommandList", + "code": 65529, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "EventList", + "code": 65530, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AttributeList", + "code": 65531, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "FeatureMap", "code": 65532, diff --git a/examples/lighting-app/silabs/openthread.gni b/examples/lighting-app/silabs/openthread.gni index 71fa3271ea5073..b39a1cb8e5878d 100644 --- a/examples/lighting-app/silabs/openthread.gni +++ b/examples/lighting-app/silabs/openthread.gni @@ -23,5 +23,8 @@ app_data_model = chip_enable_ota_requestor = true chip_enable_openthread = true +# Not needed for the Lighting-app +chip_enable_read_client = false + openthread_external_platform = "${chip_root}/third_party/openthread/platforms/efr32:libopenthread-efr32" diff --git a/examples/lighting-app/telink/CMakeLists.txt b/examples/lighting-app/telink/CMakeLists.txt index 9620a00e1127e5..056f6d4173c49a 100644 --- a/examples/lighting-app/telink/CMakeLists.txt +++ b/examples/lighting-app/telink/CMakeLists.txt @@ -1,5 +1,5 @@ # -# Copyright (c) 2022 Project CHIP Authors +# Copyright (c) 2022-2024 Project CHIP Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,85 +13,18 @@ # See the License for the specific language governing permissions and # limitations under the License. # + cmake_minimum_required(VERSION 3.13.1) get_filename_component(CHIP_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/third_party/connectedhomeip REALPATH) get_filename_component(TELINK_COMMON ${CHIP_ROOT}/examples/platform/telink REALPATH) get_filename_component(GEN_DIR ${CHIP_ROOT}/zzz_generated/ REALPATH) -set(ignoreMe "${TLNK_USB_DONGLE}") - -if(${TLNK_MARS_BOARD} MATCHES y) - if(EXISTS "${CHIP_ROOT}/src/platform/telink/${BOARD}_mars.overlay") - set(MARS_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/${BOARD}_mars.overlay") - else() - unset(MARS_DTC_OVERLAY_FILE) - endif() - if(EXISTS "${CHIP_ROOT}/src/platform/telink/${BOARD}_mars.conf") - set(MARS_CONF_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/${BOARD}_mars.conf") - else() - unset(MARS_CONF_OVERLAY_FILE) - endif() -else() - unset(MARS_CONF_OVERLAY_FILE) -endif() - -if(${TLNK_USB_DONGLE} MATCHES y) - if(EXISTS "${CHIP_ROOT}/src/platform/telink/${BOARD}_usb.overlay") - set(USB_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/${BOARD}_usb.overlay") - else() - unset(USB_DTC_OVERLAY_FILE) - endif() - if(EXISTS "${CHIP_ROOT}/src/platform/telink/${BOARD}_usb.conf") - set(USB_CONF_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/${BOARD}_usb.conf") - else() - unset(USB_CONF_OVERLAY_FILE) - endif() -else() - unset(USB_CONF_OVERLAY_FILE) -endif() - -if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/boards/${BOARD}.overlay") - set(LOCAL_DTC_OVERLAY_FILE "${CMAKE_CURRENT_SOURCE_DIR}/boards/${BOARD}.overlay") -else() - unset(LOCAL_DTC_OVERLAY_FILE) -endif() - -if(EXISTS "${CHIP_ROOT}/src/platform/telink/${BOARD}.overlay") - set(GLOBAL_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/${BOARD}.overlay") -else() - unset(GLOBAL_DTC_OVERLAY_FILE) -endif() - -if(EXISTS "${CHIP_ROOT}/src/platform/telink/${FLASH_SIZE}_flash.overlay") - set(FLASH_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/${FLASH_SIZE}_flash.overlay") - message(STATUS "Flash memory size is set to: " ${FLASH_SIZE} "b") -else() - set(FLASH_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/2m_flash.overlay") - message(STATUS "Flash memory size is set to: 2mb") -endif() - -if(DTC_OVERLAY_FILE) - set(DTC_OVERLAY_FILE - "${DTC_OVERLAY_FILE} ${GLOBAL_DTC_OVERLAY_FILE} ${USB_DTC_OVERLAY_FILE} ${MARS_DTC_OVERLAY_FILE} ${FLASH_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}" - CACHE STRING "" FORCE - ) -else() - set(DTC_OVERLAY_FILE ${GLOBAL_DTC_OVERLAY_FILE} ${USB_DTC_OVERLAY_FILE} ${MARS_DTC_OVERLAY_FILE} ${FLASH_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}) -endif() - -set(CONF_FILE ${USB_CONF_OVERLAY_FILE} ${MARS_CONF_OVERLAY_FILE} prj.conf) - -# Load NCS/Zephyr build system -list(APPEND ZEPHYR_EXTRA_MODULES ${CHIP_ROOT}/config/telink/chip-module) -find_package(Zephyr HINTS $ENV{ZEPHYR_BASE}) - -project(chip-telink-lighting-example) - +include(${TELINK_COMMON}/common.cmake) include(${CHIP_ROOT}/config/telink/app/enable-gnu-std.cmake) include(${CHIP_ROOT}/src/app/chip_data_model.cmake) -target_compile_options(app PRIVATE -fpermissive) +project(chip-telink-lighting-example) target_include_directories(app PRIVATE include @@ -99,19 +32,24 @@ target_include_directories(app PRIVATE ${GEN_DIR}/lighting-app ${TELINK_COMMON}/common/include ${TELINK_COMMON}/util/include - ${TELINK_COMMON}/app/include) + ${TELINK_COMMON}/app/include + ${TELINK_COMMON}/zephyr_ext) target_sources(app PRIVATE src/AppTask.cpp src/ZclCallbacks.cpp ${TELINK_COMMON}/common/src/mainCommon.cpp ${TELINK_COMMON}/common/src/AppTaskCommon.cpp - ${TELINK_COMMON}/util/src/LEDWidget.cpp + ${TELINK_COMMON}/util/src/LEDManager.cpp ${TELINK_COMMON}/util/src/ButtonManager.cpp ${TELINK_COMMON}/util/src/ThreadUtil.cpp - ${TELINK_COMMON}/util/src/PWMDevice.cpp - ${TELINK_COMMON}/util/src/WS2812Device.cpp - ${TELINK_COMMON}/util/src/ColorFormat.cpp) + ${TELINK_COMMON}/util/src/PWMManager.cpp + ${TELINK_COMMON}/util/src/ColorFormat.cpp + ${TELINK_COMMON}/zephyr_ext/zephyr_key_matrix.c + ${TELINK_COMMON}/zephyr_ext/zephyr_key_pool.c + ${TELINK_COMMON}/zephyr_ext/zephyr_led_pool.c + ${TELINK_COMMON}/zephyr_ext/zephyr_pwm_pool.c + ${TELINK_COMMON}/zephyr_ext/zephyr_ws2812.c) chip_configure_data_model(app INCLUDE_SERVER @@ -122,155 +60,6 @@ if(CONFIG_BOOTLOADER_MCUBOOT) target_sources(app PRIVATE ${TELINK_COMMON}/util/src/OTAUtil.cpp) endif() -# Fix for unused swap parameter in: zephyr/include/zephyr/arch/riscv/irq.h:70 -add_compile_options(-Wno-error=unused-parameter) - if (CONFIG_CHIP_PW_RPC) - -# Make all targets created below depend on zephyr_interface to inherit MCU-related compilation flags -link_libraries($) - -set(PIGWEED_ROOT "${CHIP_ROOT}/third_party/pigweed/repo") -include(${PIGWEED_ROOT}/pw_build/pigweed.cmake) -include(${PIGWEED_ROOT}/pw_protobuf_compiler/proto.cmake) - -include($ENV{PW_ROOT}/pw_assert/backend.cmake) -include($ENV{PW_ROOT}/pw_log/backend.cmake) -include($ENV{PW_ROOT}/pw_sys_io/backend.cmake) - -pw_set_module_config(pw_rpc_CONFIG pw_rpc.disable_global_mutex_config) -pw_set_backend(pw_log pw_log_basic) -pw_set_backend(pw_assert.check pw_assert_log.check_backend) -pw_set_backend(pw_assert.assert pw_assert.assert_compatibility_backend) -pw_set_backend(pw_sys_io pw_sys_io.telink) - -set(dir_pw_third_party_nanopb "${CHIP_ROOT}/third_party/nanopb/repo" CACHE STRING "" FORCE) - -add_subdirectory(third_party/connectedhomeip/third_party/pigweed/repo) -add_subdirectory(third_party/connectedhomeip/third_party/nanopb/repo) -add_subdirectory(third_party/connectedhomeip/examples/platform/telink/pw_sys_io) - -pw_proto_library(attributes_service - SOURCES - ${CHIP_ROOT}/examples/common/pigweed/protos/attributes_service.proto - INPUTS - ${CHIP_ROOT}/examples/common/pigweed/protos/attributes_service.options - PREFIX - attributes_service - STRIP_PREFIX - ${CHIP_ROOT}/examples/common/pigweed/protos - DEPS - pw_protobuf.common_proto -) - -pw_proto_library(button_service - SOURCES - ${CHIP_ROOT}/examples/common/pigweed/protos/button_service.proto - PREFIX - button_service - STRIP_PREFIX - ${CHIP_ROOT}/examples/common/pigweed/protos - DEPS - pw_protobuf.common_proto -) - -pw_proto_library(descriptor_service - SOURCES - ${CHIP_ROOT}/examples/common/pigweed/protos/descriptor_service.proto - PREFIX - descriptor_service - STRIP_PREFIX - ${CHIP_ROOT}/examples/common/pigweed/protos - DEPS - pw_protobuf.common_proto -) - -pw_proto_library(device_service - SOURCES - ${CHIP_ROOT}/examples/common/pigweed/protos/device_service.proto - INPUTS - ${CHIP_ROOT}/examples/common/pigweed/protos/device_service.options - PREFIX - device_service - STRIP_PREFIX - ${CHIP_ROOT}/examples/common/pigweed/protos - DEPS - pw_protobuf.common_proto -) - -pw_proto_library(lighting_service - SOURCES - ${CHIP_ROOT}/examples/common/pigweed/protos/lighting_service.proto - STRIP_PREFIX - ${CHIP_ROOT}/examples/common/pigweed/protos - PREFIX - lighting_service - DEPS - pw_protobuf.common_proto -) - -pw_proto_library(ot_cli_service - SOURCES - ${CHIP_ROOT}/examples/common/pigweed/protos/ot_cli_service.proto - INPUTS - ${CHIP_ROOT}/examples/common/pigweed/protos/ot_cli_service.options - STRIP_PREFIX - ${CHIP_ROOT}/examples/common/pigweed/protos - PREFIX - ot_cli_service - DEPS - pw_protobuf.common_proto -) - -pw_proto_library(thread_service - SOURCES - ${CHIP_ROOT}/examples/common/pigweed/protos/thread_service.proto - INPUTS - ${CHIP_ROOT}/examples/common/pigweed/protos/thread_service.options - STRIP_PREFIX - ${CHIP_ROOT}/examples/common/pigweed/protos - PREFIX - thread_service - DEPS - pw_protobuf.common_proto -) - -target_sources(app PRIVATE - ../../common/pigweed/RpcService.cpp - ../../common/pigweed/telink/PigweedLoggerMutex.cpp - ${TELINK_COMMON}/Rpc.cpp - ${TELINK_COMMON}/util/src/PigweedLogger.cpp -) - -target_include_directories(app PRIVATE - ${PIGWEED_ROOT}/pw_sys_io/public - ${CHIP_ROOT}/src/lib/support - ${CHIP_ROOT}/src/system - ${TELINK_COMMON} - ../../common - ../../common/pigweed - ../../common/pigweed/telink) - -target_compile_options(app PRIVATE - "-DPW_RPC_ATTRIBUTE_SERVICE=1" - "-DPW_RPC_BUTTON_SERVICE=1" - "-DPW_RPC_DESCRIPTOR_SERVICE=1" - "-DPW_RPC_DEVICE_SERVICE=1" - "-DPW_RPC_LIGHTING_SERVICE=1" - "-DPW_RPC_THREAD_SERVICE=1") - -target_link_libraries(app PRIVATE - attributes_service.nanopb_rpc - button_service.nanopb_rpc - descriptor_service.nanopb_rpc - device_service.nanopb_rpc - lighting_service.nanopb_rpc - thread_service.nanopb_rpc - pw_checksum - pw_hdlc - pw_log - pw_rpc.server - pw_sys_io -) - + include(${TELINK_COMMON}/Rpc.cmake) endif(CONFIG_CHIP_PW_RPC) diff --git a/examples/lighting-app/telink/README.md b/examples/lighting-app/telink/README.md index 2f696170f3cca2..f4dfefe2b9795e 100644 --- a/examples/lighting-app/telink/README.md +++ b/examples/lighting-app/telink/README.md @@ -98,30 +98,6 @@ be used to specify the the effect. It is able to be in following effects: | Blinks (950 ms on/50 ms off) | Finish ( `Clusters::Identify::EffectIdentifierEnum::kFinishEffect`) | | LED off | Stop (`Clusters::Identify::EffectIdentifierEnum::kStopEffect`) | -#### Indicate current state of lightbulb - -By default, only **Blue** LED is used to show current state of lightbulb (only -for lightning-app). - -To enable RGB functionality in Your application set this config: - -In Matter examples/lighting-app/telink/include/**AppConfig.h**, set the define -`USE_RGB_PWM`: - -```bash - define USE_RGB_PWM 1 -``` - -To get current state of lightbulb in RGB mode, connect 3-color LED module to -following pins: - -| Name | Pin | -| :---: | :-----------------: | -| Red | PE2 (pin 8 of J34) | -| Green | PE0 (pin 5 of J34) | -| Blue | PB4 (pin 20 of J34) | -| GND | GND (pin 24 of J50) | - ### CHIP tool commands 1. Build diff --git a/examples/lighting-app/telink/include/AppConfig.h b/examples/lighting-app/telink/include/AppConfig.h index b616746393ff03..a3639efb3183af 100644 --- a/examples/lighting-app/telink/include/AppConfig.h +++ b/examples/lighting-app/telink/include/AppConfig.h @@ -20,14 +20,5 @@ // ---- Lighting Example App Config ---- -#define APP_USE_EXAMPLE_START_BUTTON 1 -#define APP_USE_BLE_START_BUTTON 1 -#define APP_USE_THREAD_START_BUTTON 1 #define APP_SET_DEVICE_INFO_PROVIDER 1 #define APP_SET_NETWORK_COMM_ENDPOINT_SEC 0 -#if defined(CONFIG_BOARD_TLSR9518ADK80D) || defined(CONFIG_BOARD_TLSR9528A) -#define APP_USE_IDENTIFY_PWM 1 -#endif - -// Lighting LED config -#define USE_RGB_PWM 0 diff --git a/examples/lighting-app/telink/include/AppTask.h b/examples/lighting-app/telink/include/AppTask.h index 67b69ef84e2e45..c835c88e097c11 100644 --- a/examples/lighting-app/telink/include/AppTask.h +++ b/examples/lighting-app/telink/include/AppTask.h @@ -19,22 +19,29 @@ #pragma once #include "AppTaskCommon.h" -#include "PWMDevice.h" class AppTask : public AppTaskCommon { public: + enum Fixture_Action : uint8_t + { + ON_ACTION = 0, + OFF_ACTION, + LEVEL_ACTION, + COLOR_ACTION_XY, + COLOR_ACTION_HSV, + COLOR_ACTION_CT, + + INVALID_ACTION + }; + #ifdef CONFIG_CHIP_ENABLE_POWER_ON_FACTORY_RESET void PowerOnFactoryReset(void); #endif /* CONFIG_CHIP_ENABLE_POWER_ON_FACTORY_RESET */ - void SetInitiateAction(PWMDevice::Action_t aAction, int32_t aActor, uint8_t * value); - void UpdateClusterState(void); -#ifdef CONFIG_WS2812_STRIP - WS2812Device & GetLightingDevice(void) { return mWS2812Device; } -#else - PWMDevice & GetLightingDevice(void) { return mPwmRgbBlueLed; } -#endif /* CONFIG_WS2812_STRIP */ + bool IsTurnedOn() const; + void SetInitiateAction(Fixture_Action aAction, int32_t aActor, uint8_t * value); + void UpdateClusterState(void); private: friend AppTask & GetAppTask(void); @@ -42,9 +49,6 @@ class AppTask : public AppTaskCommon CHIP_ERROR Init(void); - static void ActionInitiated(PWMDevice::Action_t aAction, int32_t aActor); - static void ActionCompleted(PWMDevice::Action_t aAction, int32_t aActor); - static void LightingActionEventHandler(AppEvent * aEvent); #ifdef CONFIG_CHIP_ENABLE_POWER_ON_FACTORY_RESET static void PowerOnFactoryResetEventHandler(AppEvent * aEvent); @@ -54,16 +58,6 @@ class AppTask : public AppTaskCommon static k_timer sPowerOnFactoryResetTimer; #endif /* CONFIG_CHIP_ENABLE_POWER_ON_FACTORY_RESET */ -#ifdef CONFIG_WS2812_STRIP - WS2812Device mWS2812Device; -#else - PWMDevice mPwmRgbBlueLed; -#if USE_RGB_PWM - PWMDevice mPwmRgbGreenLed; - PWMDevice mPwmRgbRedLed; -#endif -#endif /* CONFIG_WS2812_STRIP */ - static AppTask sAppTask; }; diff --git a/examples/lighting-app/telink/prj.conf b/examples/lighting-app/telink/prj.conf index f4b2a44e1c672c..ca11bfdde52621 100644 --- a/examples/lighting-app/telink/prj.conf +++ b/examples/lighting-app/telink/prj.conf @@ -1,5 +1,5 @@ # -# Copyright (c) 2021-2023 Project CHIP Authors +# Copyright (c) 2021-2024 Project CHIP Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ # limitations under the License. # -# This sample uses sample-defaults.conf to set options common for all +# This sample uses Kconfig.defaults to set options common for all # samples. This file should contain only options specific for this sample # or overrides of default values. @@ -22,10 +22,6 @@ CONFIG_CHIP=y CONFIG_STD_CPP17=y -# CHIP configuration -CONFIG_CHIP_PROJECT_CONFIG="include/CHIPProjectConfig.h" -CONFIG_CHIP_OPENTHREAD_CONFIG="../../platform/telink/project_include/OpenThreadConfig.h" - # 32773 == 0x8005 (example lighting-app) CONFIG_CHIP_DEVICE_PRODUCT_ID=32773 @@ -51,7 +47,7 @@ CONFIG_CHIP_FACTORY_DATA_BUILD=n CONFIG_CHIP_FACTORY_DATA_MERGE_WITH_FIRMWARE=n CONFIG_CHIP_CERTIFICATION_DECLARATION_STORAGE=n -#Enable PWM +# Enable PWM CONFIG_PWM=y # Enable Power Management diff --git a/examples/lighting-app/telink/src/AppTask.cpp b/examples/lighting-app/telink/src/AppTask.cpp index 54dd2703c16ce9..bb4dc4150db2be 100644 --- a/examples/lighting-app/telink/src/AppTask.cpp +++ b/examples/lighting-app/telink/src/AppTask.cpp @@ -20,34 +20,29 @@ #include #include "ColorFormat.h" -#include "PWMDevice.h" +#include "PWMManager.h" #include LOG_MODULE_DECLARE(app, CONFIG_CHIP_APP_LOG_LEVEL); namespace { -#ifdef CONFIG_WS2812_STRIP -const struct device * const ws2812_dev = DEVICE_DT_GET(DT_ALIAS(led_strip)); -#else -const struct pwm_dt_spec sPwmRgbSpecBlueLed = PWM_DT_SPEC_GET_OR(DT_ALIAS(pwm_led0), {}); -#if USE_RGB_PWM -const struct pwm_dt_spec sPwmRgbSpecGreenLed = PWM_DT_SPEC_GET_OR(DT_ALIAS(pwm_led1), {}); -const struct pwm_dt_spec sPwmRgbSpecRedLed = PWM_DT_SPEC_GET_OR(DT_ALIAS(pwm_led2), {}); -#endif -#endif // CONFIG_WS2812_STRIP - -#if defined(CONFIG_WS2812_STRIP) || USE_RGB_PWM +bool sfixture_on; uint8_t sBrightness; -PWMDevice::Action_t sColorAction = PWMDevice::INVALID_ACTION; +AppTask::Fixture_Action sColorAction = AppTask::INVALID_ACTION; XyColor_t sXY; HsvColor_t sHSV; CtColor_t sCT; -#endif // CONFIG_WS2812_STRIP || USE_RGB_PWM +RgbColor_t sLedRgb; } // namespace AppTask AppTask::sAppTask; +bool AppTask::IsTurnedOn() const +{ + return sfixture_on; +} + #ifdef CONFIG_CHIP_ENABLE_POWER_ON_FACTORY_RESET void AppTask::PowerOnFactoryReset(void) { @@ -61,143 +56,47 @@ void AppTask::PowerOnFactoryReset(void) CHIP_ERROR AppTask::Init(void) { - CHIP_ERROR err; - - // Init lighting manager - uint8_t minLightLevel = kDefaultMinLevel; - Clusters::LevelControl::Attributes::MinLevel::Get(kExampleEndpointId, &minLightLevel); + SetExampleButtonCallbacks(LightingActionEventHandler); + InitCommonParts(); - uint8_t maxLightLevel = kDefaultMaxLevel; - Clusters::LevelControl::Attributes::MaxLevel::Get(kExampleEndpointId, &maxLightLevel); + Protocols::InteractionModel::Status status; -#ifdef CONFIG_WS2812_STRIP - err = sAppTask.mWS2812Device.Init(ws2812_dev, STRIP_NUM_PIXELS(led_strip)); - if (err != CHIP_NO_ERROR) + app::DataModel::Nullable brightness; + // Read brightness value + status = Clusters::LevelControl::Attributes::CurrentLevel::Get(kExampleEndpointId, brightness); + if (status == Protocols::InteractionModel::Status::Success && !brightness.IsNull()) { - LOG_ERR("WS2812 Device Init fail"); - return err; - } -#else - err = sAppTask.mPwmRgbBlueLed.Init(&sPwmRgbSpecBlueLed, minLightLevel, maxLightLevel, maxLightLevel); - if (err != CHIP_NO_ERROR) - { - LOG_ERR("Blue RGB PWM Device Init fail"); - return err; - } -#if USE_RGB_PWM - err = sAppTask.mPwmRgbRedLed.Init(&sPwmRgbSpecRedLed, minLightLevel, maxLightLevel, maxLightLevel); - if (err != CHIP_NO_ERROR) - { - LOG_ERR("Red RGB PWM Device Init fail"); - return err; + sBrightness = brightness.Value(); } - err = sAppTask.mPwmRgbGreenLed.Init(&sPwmRgbSpecGreenLed, minLightLevel, maxLightLevel, maxLightLevel); - if (err != CHIP_NO_ERROR) + memset(&sLedRgb, sBrightness, sizeof(RgbColor_t)); + + bool storedValue; + // Read storedValue on/off value + status = Clusters::OnOff::Attributes::OnOff::Get(1, &storedValue); + if (status == Protocols::InteractionModel::Status::Success) { - LOG_ERR("Green RGB PWM Device Init fail"); - return err; + // Set actual state to stored before reboot + SetInitiateAction(storedValue ? ON_ACTION : OFF_ACTION, static_cast(AppEvent::kEventType_Lighting), nullptr); } -#endif - sAppTask.mPwmRgbBlueLed.SetCallbacks(ActionInitiated, ActionCompleted, nullptr); -#endif // CONFIG_WS2812_STRIP - -#if APP_USE_EXAMPLE_START_BUTTON - SetExampleButtonCallbacks(LightingActionEventHandler); -#endif - InitCommonParts(); return CHIP_NO_ERROR; } void AppTask::LightingActionEventHandler(AppEvent * aEvent) { -#ifdef CONFIG_WS2812_STRIP - if (aEvent->Type == AppEvent::kEventType_Button) - { - if (sAppTask.mWS2812Device.IsTurnedOn()) - { - sAppTask.mWS2812Device.Set(SET_RGB_TURN_OFF); - } - else - { - sAppTask.mWS2812Device.Set(SET_RGB_TURN_ON); - } - - sAppTask.UpdateClusterState(); - } -#else - PWMDevice::Action_t action = PWMDevice::INVALID_ACTION; - int32_t actor = 0; + Fixture_Action action = INVALID_ACTION; + int32_t actor = 0; if (aEvent->Type == AppEvent::kEventType_Lighting) { - action = static_cast(aEvent->LightingEvent.Action); + action = static_cast(aEvent->LightingEvent.Action); actor = aEvent->LightingEvent.Actor; } else if (aEvent->Type == AppEvent::kEventType_Button) { -#if USE_RGB_PWM - if (sAppTask.mPwmRgbRedLed.IsTurnedOn() || sAppTask.mPwmRgbGreenLed.IsTurnedOn() || sAppTask.mPwmRgbBlueLed.IsTurnedOn()) - { - action = PWMDevice::OFF_ACTION; - } - else - { - action = PWMDevice::ON_ACTION; - } -#else - action = sAppTask.mPwmRgbBlueLed.IsTurnedOn() ? PWMDevice::OFF_ACTION : PWMDevice::ON_ACTION; -#endif - actor = AppEvent::kEventType_Button; - } - - if (action != PWMDevice::INVALID_ACTION && - ( -#if USE_RGB_PWM - !sAppTask.mPwmRgbRedLed.InitiateAction(action, actor, NULL) || - !sAppTask.mPwmRgbGreenLed.InitiateAction(action, actor, NULL) || -#endif - !sAppTask.mPwmRgbBlueLed.InitiateAction(action, actor, NULL))) - { - LOG_INF("Action is in progress or active"); - } -#endif // CONFIG_WS2812_STRIP -} - -void AppTask::ActionInitiated(PWMDevice::Action_t aAction, int32_t aActor) -{ - if (aAction == PWMDevice::ON_ACTION) - { - LOG_DBG("ON_ACTION initiated"); - } - else if (aAction == PWMDevice::OFF_ACTION) - { - LOG_DBG("OFF_ACTION initiated"); - } - else if (aAction == PWMDevice::LEVEL_ACTION) - { - LOG_DBG("LEVEL_ACTION initiated"); - } -} + sfixture_on = !sfixture_on; -void AppTask::ActionCompleted(PWMDevice::Action_t aAction, int32_t aActor) -{ - if (aAction == PWMDevice::ON_ACTION) - { - LOG_DBG("ON_ACTION completed"); - } - else if (aAction == PWMDevice::OFF_ACTION) - { - LOG_DBG("OFF_ACTION completed"); - } - else if (aAction == PWMDevice::LEVEL_ACTION) - { - LOG_DBG("LEVEL_ACTION completed"); - } - - if (aActor == AppEvent::kEventType_Button) - { sAppTask.UpdateClusterState(); } } @@ -205,38 +104,8 @@ void AppTask::ActionCompleted(PWMDevice::Action_t aAction, int32_t aActor) void AppTask::UpdateClusterState(void) { Protocols::InteractionModel::Status status; - bool isTurnedOn; - uint8_t setLevel; - -#if defined(CONFIG_WS2812_STRIP) || USE_RGB_PWM -#ifdef CONFIG_WS2812_STRIP - isTurnedOn = sAppTask.mWS2812Device.IsTurnedOn(); -#else - isTurnedOn = - sAppTask.mPwmRgbRedLed.IsTurnedOn() || sAppTask.mPwmRgbGreenLed.IsTurnedOn() || sAppTask.mPwmRgbBlueLed.IsTurnedOn(); -#endif // CONFIG_WS2812_STRIP - - if (sColorAction == PWMDevice::COLOR_ACTION_XY || sColorAction == PWMDevice::COLOR_ACTION_HSV || - sColorAction == PWMDevice::COLOR_ACTION_CT) - { - setLevel = sBrightness; - } - else - { -#ifdef CONFIG_WS2812_STRIP - setLevel = sAppTask.mWS2812Device.GetBlueLevel(); - if (setLevel > kDefaultMaxLevel) - { - setLevel = kDefaultMaxLevel; - } -#else - setLevel = sAppTask.mPwmRgbBlueLed.GetLevel(); -#endif // CONFIG_WS2812_STRIP - } -#else - isTurnedOn = sAppTask.mPwmRgbBlueLed.IsTurnedOn(); - setLevel = sAppTask.mPwmRgbBlueLed.GetLevel(); -#endif // CONFIG_WS2812_STRIP || USE_RGB_PWM + bool isTurnedOn = sfixture_on; + uint8_t setLevel = sBrightness; // write the new on/off value status = Clusters::OnOff::Attributes::OnOff::Set(kExampleEndpointId, isTurnedOn); @@ -252,100 +121,86 @@ void AppTask::UpdateClusterState(void) } } -void AppTask::SetInitiateAction(PWMDevice::Action_t aAction, int32_t aActor, uint8_t * value) +void AppTask::SetInitiateAction(Fixture_Action aAction, int32_t aActor, uint8_t * value) { -#if defined(CONFIG_WS2812_STRIP) || USE_RGB_PWM bool setRgbAction = false; - RgbColor_t rgb; -#endif // CONFIG_WS2812_STRIP || USE_RGB_PWM - if (aAction == PWMDevice::ON_ACTION || aAction == PWMDevice::OFF_ACTION) + if (aAction == ON_ACTION || aAction == OFF_ACTION) { -#ifdef CONFIG_WS2812_STRIP - if (aAction == PWMDevice::ON_ACTION) + if (aAction == ON_ACTION) { - sAppTask.mWS2812Device.Set(SET_RGB_TURN_ON); + sfixture_on = true; + PwmManager::getInstance().setPwm(PwmManager::EAppPwm_Red, (((uint32_t) sLedRgb.r * 1000) / UINT8_MAX)); + PwmManager::getInstance().setPwm(PwmManager::EAppPwm_Green, (((uint32_t) sLedRgb.g * 1000) / UINT8_MAX)); + PwmManager::getInstance().setPwm(PwmManager::EAppPwm_Blue, (((uint32_t) sLedRgb.b * 1000) / UINT8_MAX)); } - else if (aAction == PWMDevice::OFF_ACTION) + else { - sAppTask.mWS2812Device.Set(SET_RGB_TURN_OFF); + sfixture_on = false; + PwmManager::getInstance().setPwm(PwmManager::EAppPwm_Red, false); + PwmManager::getInstance().setPwm(PwmManager::EAppPwm_Green, false); + PwmManager::getInstance().setPwm(PwmManager::EAppPwm_Blue, false); } -#else - sAppTask.mPwmRgbBlueLed.InitiateAction(aAction, aActor, value); -#if USE_RGB_PWM - sAppTask.mPwmRgbRedLed.InitiateAction(aAction, aActor, value); - sAppTask.mPwmRgbGreenLed.InitiateAction(aAction, aActor, value); -#endif -#endif // CONFIG_WS2812_STRIP } - else if (aAction == PWMDevice::LEVEL_ACTION) + else if (aAction == LEVEL_ACTION) { -#if defined(CONFIG_WS2812_STRIP) || USE_RGB_PWM // Save a new brightness for ColorControl sBrightness = *value; - if (sColorAction == PWMDevice::COLOR_ACTION_XY) + if (sColorAction == COLOR_ACTION_XY) { - rgb = XYToRgb(sBrightness, sXY.x, sXY.y); + sLedRgb = XYToRgb(sBrightness, sXY.x, sXY.y); } - else if (sColorAction == PWMDevice::COLOR_ACTION_HSV) + else if (sColorAction == COLOR_ACTION_HSV) { - sHSV.v = sBrightness; - rgb = HsvToRgb(sHSV); + sHSV.v = sBrightness; + sLedRgb = HsvToRgb(sHSV); } else { - memset(&rgb, sBrightness, sizeof(RgbColor_t)); + memset(&sLedRgb, sBrightness, sizeof(RgbColor_t)); } - ChipLogProgress(Zcl, "New brightness: %u | R: %u, G: %u, B: %u", sBrightness, rgb.r, rgb.g, rgb.b); + ChipLogProgress(Zcl, "New brightness: %u | R: %u, G: %u, B: %u", sBrightness, sLedRgb.r, sLedRgb.g, sLedRgb.b); setRgbAction = true; -#else - sAppTask.mPwmRgbBlueLed.InitiateAction(aAction, aActor, value); -#endif // CONFIG_WS2812_STRIP || USE_RGB_PWM } -#if defined(CONFIG_WS2812_STRIP) || USE_RGB_PWM - else if (aAction == PWMDevice::COLOR_ACTION_XY) + else if (aAction == COLOR_ACTION_XY) { - sXY = *reinterpret_cast(value); - rgb = XYToRgb(sBrightness, sXY.x, sXY.y); - ChipLogProgress(Zcl, "XY to RGB: X: %u, Y: %u, Level: %u | R: %u, G: %u, B: %u", sXY.x, sXY.y, sBrightness, rgb.r, rgb.g, - rgb.b); + sXY = *reinterpret_cast(value); + sLedRgb = XYToRgb(sBrightness, sXY.x, sXY.y); + ChipLogProgress(Zcl, "XY to RGB: X: %u, Y: %u, Level: %u | R: %u, G: %u, B: %u", sXY.x, sXY.y, sBrightness, sLedRgb.r, + sLedRgb.g, sLedRgb.b); setRgbAction = true; - sColorAction = PWMDevice::COLOR_ACTION_XY; + sColorAction = COLOR_ACTION_XY; } - else if (aAction == PWMDevice::COLOR_ACTION_HSV) + else if (aAction == COLOR_ACTION_HSV) { - sHSV = *reinterpret_cast(value); - sHSV.v = sBrightness; - rgb = HsvToRgb(sHSV); - ChipLogProgress(Zcl, "HSV to RGB: H: %u, S: %u, V: %u | R: %u, G: %u, B: %u", sHSV.h, sHSV.s, sHSV.v, rgb.r, rgb.g, rgb.b); + sHSV = *reinterpret_cast(value); + sHSV.v = sBrightness; + sLedRgb = HsvToRgb(sHSV); + ChipLogProgress(Zcl, "HSV to RGB: H: %u, S: %u, V: %u | R: %u, G: %u, B: %u", sHSV.h, sHSV.s, sHSV.v, sLedRgb.r, sLedRgb.g, + sLedRgb.b); setRgbAction = true; - sColorAction = PWMDevice::COLOR_ACTION_HSV; + sColorAction = COLOR_ACTION_HSV; } - else if (aAction == PWMDevice::COLOR_ACTION_CT) + else if (aAction == COLOR_ACTION_CT) { sCT = *reinterpret_cast(value); if (sCT.ctMireds) { - rgb = CTToRgb(sCT); - ChipLogProgress(Zcl, "ColorTemp to RGB: CT: %u | R: %u, G: %u, B: %u", sCT.ctMireds, rgb.r, rgb.g, rgb.b); + sLedRgb = CTToRgb(sCT); + ChipLogProgress(Zcl, "ColorTemp to RGB: CT: %u | R: %u, G: %u, B: %u", sCT.ctMireds, sLedRgb.r, sLedRgb.g, sLedRgb.b); setRgbAction = true; - sColorAction = PWMDevice::COLOR_ACTION_CT; + sColorAction = COLOR_ACTION_CT; } } if (setRgbAction) { -#ifdef CONFIG_WS2812_STRIP - sAppTask.mWS2812Device.SetLevel(&rgb); -#else - sAppTask.mPwmRgbRedLed.InitiateAction(aAction, aActor, &rgb.r); - sAppTask.mPwmRgbGreenLed.InitiateAction(aAction, aActor, &rgb.g); - sAppTask.mPwmRgbBlueLed.InitiateAction(aAction, aActor, &rgb.b); -#endif // CONFIG_WS2812_STRIP + PwmManager::getInstance().setPwm(PwmManager::EAppPwm_Red, (((uint32_t) sLedRgb.r * 1000) / UINT8_MAX)); + PwmManager::getInstance().setPwm(PwmManager::EAppPwm_Green, (((uint32_t) sLedRgb.g * 1000) / UINT8_MAX)); + PwmManager::getInstance().setPwm(PwmManager::EAppPwm_Blue, (((uint32_t) sLedRgb.b * 1000) / UINT8_MAX)); } -#endif // CONFIG_WS2812_STRIP || USE_RGB_PWM } #ifdef CONFIG_CHIP_ENABLE_POWER_ON_FACTORY_RESET @@ -359,15 +214,9 @@ void AppTask::PowerOnFactoryResetEventHandler(AppEvent * aEvent) { LOG_INF("Lighting App Power On Factory Reset Handler"); sPowerOnFactoryResetTimerCnt = 1; -#ifdef CONFIG_WS2812_STRIP - sAppTask.mWS2812Device.Set(sPowerOnFactoryResetTimerCnt % 2); -#else - sAppTask.mPwmRgbBlueLed.Set(sPowerOnFactoryResetTimerCnt % 2); -#if USE_RGB_PWM - sAppTask.mPwmRgbRedLed.Set(sPowerOnFactoryResetTimerCnt % 2); - sAppTask.mPwmRgbGreenLed.Set(sPowerOnFactoryResetTimerCnt % 2); -#endif -#endif // CONFIG_WS2812_STRIP + PwmManager::getInstance().setPwm(PwmManager::EAppPwm_Red, (bool) (sPowerOnFactoryResetTimerCnt % 2)); + PwmManager::getInstance().setPwm(PwmManager::EAppPwm_Green, (bool) (sPowerOnFactoryResetTimerCnt % 2)); + PwmManager::getInstance().setPwm(PwmManager::EAppPwm_Blue, (bool) (sPowerOnFactoryResetTimerCnt % 2)); k_timer_init(&sPowerOnFactoryResetTimer, PowerOnFactoryResetTimerEvent, nullptr); k_timer_start(&sPowerOnFactoryResetTimer, K_MSEC(kPowerOnFactoryResetIndicationTimeMs), K_MSEC(kPowerOnFactoryResetIndicationTimeMs)); @@ -377,15 +226,9 @@ void AppTask::PowerOnFactoryResetTimerEvent(struct k_timer * timer) { sPowerOnFactoryResetTimerCnt++; LOG_INF("Lighting App Power On Factory Reset Handler %u", sPowerOnFactoryResetTimerCnt); -#ifdef CONFIG_WS2812_STRIP - sAppTask.mWS2812Device.Set(sPowerOnFactoryResetTimerCnt % 2); -#else - sAppTask.mPwmRgbBlueLed.Set(sPowerOnFactoryResetTimerCnt % 2); -#if USE_RGB_PWM - sAppTask.mPwmRgbRedLed.Set(sPowerOnFactoryResetTimerCnt % 2); - sAppTask.mPwmRgbGreenLed.Set(sPowerOnFactoryResetTimerCnt % 2); -#endif -#endif // CONFIG_WS2812_STRIP + PwmManager::getInstance().setPwm(PwmManager::EAppPwm_Red, (bool) (sPowerOnFactoryResetTimerCnt % 2)); + PwmManager::getInstance().setPwm(PwmManager::EAppPwm_Green, (bool) (sPowerOnFactoryResetTimerCnt % 2)); + PwmManager::getInstance().setPwm(PwmManager::EAppPwm_Blue, (bool) (sPowerOnFactoryResetTimerCnt % 2)); if (sPowerOnFactoryResetTimerCnt > kPowerOnFactoryResetIndicationMax) { k_timer_stop(timer); diff --git a/examples/lighting-app/telink/src/ZclCallbacks.cpp b/examples/lighting-app/telink/src/ZclCallbacks.cpp index 7aebb1ba69bae1..75b43f7c39eee1 100644 --- a/examples/lighting-app/telink/src/ZclCallbacks.cpp +++ b/examples/lighting-app/telink/src/ZclCallbacks.cpp @@ -18,7 +18,6 @@ #include "AppTask.h" #include "ColorFormat.h" -#include "PWMDevice.h" #include #include @@ -30,7 +29,6 @@ LOG_MODULE_DECLARE(app, CONFIG_CHIP_APP_LOG_LEVEL); using namespace chip; using namespace chip::app::Clusters; -using namespace chip::app::Clusters::OnOff; void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & attributePath, uint8_t type, uint16_t size, uint8_t * value) @@ -43,15 +41,15 @@ void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & if (clusterId == OnOff::Id && attributeId == OnOff::Attributes::OnOff::Id) { ChipLogDetail(Zcl, "Cluster OnOff: attribute OnOff set to %u", *value); - GetAppTask().SetInitiateAction(*value ? PWMDevice::ON_ACTION : PWMDevice::OFF_ACTION, + GetAppTask().SetInitiateAction(*value ? AppTask::ON_ACTION : AppTask::OFF_ACTION, static_cast(AppEvent::kEventType_Lighting), value); } else if (clusterId == LevelControl::Id && attributeId == LevelControl::Attributes::CurrentLevel::Id) { - if (GetAppTask().GetLightingDevice().IsTurnedOn()) + if (GetAppTask().IsTurnedOn()) { ChipLogDetail(Zcl, "Cluster LevelControl: attribute CurrentLevel set to %u", *value); - GetAppTask().SetInitiateAction(PWMDevice::LEVEL_ACTION, static_cast(AppEvent::kEventType_Lighting), value); + GetAppTask().SetInitiateAction(AppTask::LEVEL_ACTION, static_cast(AppEvent::kEventType_Lighting), value); } else { @@ -81,7 +79,7 @@ void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & } ChipLogDetail(Zcl, "New XY color: %u|%u", xy.x, xy.y); - GetAppTask().SetInitiateAction(PWMDevice::COLOR_ACTION_XY, static_cast(AppEvent::kEventType_Lighting), + GetAppTask().SetInitiateAction(AppTask::COLOR_ACTION_XY, static_cast(AppEvent::kEventType_Lighting), (uint8_t *) &xy); } /* HSV color space */ @@ -103,14 +101,14 @@ void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & hsv.s = *value; } ChipLogDetail(Zcl, "New HSV color: hue = %u| saturation = %u", hsv.h, hsv.s); - GetAppTask().SetInitiateAction(PWMDevice::COLOR_ACTION_HSV, static_cast(AppEvent::kEventType_Lighting), + GetAppTask().SetInitiateAction(AppTask::COLOR_ACTION_HSV, static_cast(AppEvent::kEventType_Lighting), (uint8_t *) &hsv); } /* Temperature Mireds color space */ else if (attributeId == ColorControl::Attributes::ColorTemperatureMireds::Id) { ChipLogDetail(Zcl, "New Temperature Mireds color = %u", *(uint16_t *) value); - GetAppTask().SetInitiateAction(PWMDevice::COLOR_ACTION_CT, static_cast(AppEvent::kEventType_Lighting), value); + GetAppTask().SetInitiateAction(AppTask::COLOR_ACTION_CT, static_cast(AppEvent::kEventType_Lighting), value); } else { @@ -118,28 +116,3 @@ void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & } } } - -/** @brief OnOff Cluster Init - * - * This function is called when a specific cluster is initialized. It gives the - * application an opportunity to take care of cluster initialization procedures. - * It is called exactly once for each endpoint where cluster is present. - * - * @param endpoint Ver.: always - * - */ -void emberAfOnOffClusterInitCallback(EndpointId endpoint) -{ - Protocols::InteractionModel::Status status; - bool storedValue; - - // Read storedValue on/off value - status = Attributes::OnOff::Get(1, &storedValue); - if (status == Protocols::InteractionModel::Status::Success) - { - // Set actual state to stored before reboot - GetAppTask().GetLightingDevice().Set(storedValue); - } - - GetAppTask().UpdateClusterState(); -} diff --git a/examples/lit-icd-app/silabs/build_for_wifi_args.gni b/examples/lit-icd-app/silabs/build_for_wifi_args.gni index 3531a31ffde406..56cd70b217e81e 100644 --- a/examples/lit-icd-app/silabs/build_for_wifi_args.gni +++ b/examples/lit-icd-app/silabs/build_for_wifi_args.gni @@ -23,10 +23,12 @@ import("${chip_root}/src/platform/silabs/wifi_args.gni") chip_enable_ota_requestor = true app_data_model = "${chip_root}/examples/lit-icd-app/lit-icd-common" +sl_enable_test_event_trigger = true + # ICD Default configurations chip_enable_icd_server = true chip_subscription_timeout_resumption = false -sl_use_subscription_synching = true +sl_use_subscription_syncing = true icd_enforce_sit_slow_poll_limit = true chip_enable_icd_lit = true diff --git a/examples/lit-icd-app/silabs/openthread.gni b/examples/lit-icd-app/silabs/openthread.gni index 9d06737d622a2d..b12529c2cab39a 100644 --- a/examples/lit-icd-app/silabs/openthread.gni +++ b/examples/lit-icd-app/silabs/openthread.gni @@ -26,10 +26,12 @@ chip_enable_openthread = true openthread_external_platform = "${chip_root}/third_party/openthread/platforms/efr32:libopenthread-efr32" +sl_enable_test_event_trigger = true + # ICD Default configurations chip_enable_icd_server = true chip_subscription_timeout_resumption = false -sl_use_subscription_synching = true +sl_use_subscription_syncing = true icd_enforce_sit_slow_poll_limit = true chip_icd_report_on_active_mode = true chip_enable_icd_lit = true diff --git a/examples/lock-app/asr/src/AppTask.cpp b/examples/lock-app/asr/src/AppTask.cpp index a90d0013761324..4d359a4bc6eab3 100644 --- a/examples/lock-app/asr/src/AppTask.cpp +++ b/examples/lock-app/asr/src/AppTask.cpp @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include diff --git a/examples/lock-app/asr/src/DeviceCallbacks.cpp b/examples/lock-app/asr/src/DeviceCallbacks.cpp index 8782f038f29677..c4670d59ea0125 100644 --- a/examples/lock-app/asr/src/DeviceCallbacks.cpp +++ b/examples/lock-app/asr/src/DeviceCallbacks.cpp @@ -33,7 +33,6 @@ #include #include #include -#include #include #include #include diff --git a/examples/lock-app/cc13x2x7_26x2x7/.gn b/examples/lock-app/cc13x2x7_26x2x7/.gn deleted file mode 100644 index cf974b2eb1df22..00000000000000 --- a/examples/lock-app/cc13x2x7_26x2x7/.gn +++ /dev/null @@ -1,30 +0,0 @@ -# Copyright (c) 2020 Project CHIP Authors -# -# 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. - -import("//build_overrides/build.gni") - -# The location of the build configuration file. -buildconfig = "${build_root}/config/BUILDCONFIG.gn" - -# CHIP uses angle bracket includes. -check_system_includes = true - -default_args = { - target_cpu = "arm" - target_os = "freertos" - - import("//args.gni") - pw_build_PIP_REQUIREMENTS += - [ "${chip_root}/scripts/setup/requirements.ti.txt" ] -} diff --git a/examples/lock-app/cc13x2x7_26x2x7/BUILD.gn b/examples/lock-app/cc13x2x7_26x2x7/BUILD.gn deleted file mode 100644 index 8cf4f38dc771f2..00000000000000 --- a/examples/lock-app/cc13x2x7_26x2x7/BUILD.gn +++ /dev/null @@ -1,118 +0,0 @@ -# Copyright (c) 2020 Project CHIP Authors -# -# 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. - -import("//build_overrides/build.gni") -import("//build_overrides/chip.gni") -import("//build_overrides/openthread.gni") -import("//build_overrides/ti_simplelink_sdk.gni") - -import("${build_root}/config/defaults.gni") - -import("${chip_root}/src/platform/device.gni") - -import("${ti_simplelink_sdk_build_root}/ti_simplelink_executable.gni") -import("${ti_simplelink_sdk_build_root}/ti_simplelink_sdk.gni") - -assert(current_os == "freertos") - -project_dir = "${chip_root}/examples/lock-app/cc13x2x7_26x2x7" - -ti_simplelink_sdk("sdk") { - include_dirs = [ "${project_dir}/include" ] - public_configs = [ ":lock_app_config" ] -} - -ti_sysconfig("sysconfig") { - outputs = [ - "ti_radio_config.c", - "ti_radio_config.h", - "ti_drivers_config.c", - "ti_drivers_config.h", - "ti_ble_config.c", - "ti_ble_config.h", - "ti_dmm_application_policy.c", - "ti_dmm_application_policy.h", - ] - - if (chip_enable_ota_requestor) { - sources = [ "${project_dir}/chip_ota.syscfg" ] - } else { - sources = [ "${project_dir}/chip.syscfg" ] - outputs += [ - "ti_devices_config.c", - "ti_devices_config.h", - ] - } - - public_configs = [ ":sdk_cc13x2x7_26x2x7_dmm_config" ] - - cflags = [ - "-Wno-comment", - "@" + rebase_path("${target_gen_dir}/sysconfig/ti_ble_app_config.opt", - root_build_dir), - "@" + rebase_path("${target_gen_dir}/sysconfig/ti_build_config.opt", - root_build_dir), - ] -} - -ti_simplelink_executable("lock_app") { - output_name = "chip-${ti_simplelink_board}-lock-example.out" - - sources = [ - "${chip_root}/examples/providers/DeviceInfoProviderImpl.cpp", - "${project_dir}/src/AppTask.cpp", - "${project_dir}/src/LockManager.cpp", - "${project_dir}/src/ZclCallbacks.cpp", - "${project_dir}/src/main.cpp", - ] - - deps = [ - ":sdk", - ":sysconfig", - "${chip_root}/examples/lock-app/lock-common", - "${chip_root}/examples/platform/cc13x2_26x2:cc13x2_26x2-attestation-credentials", - "${chip_root}/src/lib", - ] - - if (chip_openthread_ftd) { - deps += [ "${chip_root}/third_party/openthread/repo:libopenthread-ftd" ] - } else { - deps += [ "${chip_root}/third_party/openthread/repo:libopenthread-mtd" ] - } - - if (custom_factory_data) { - defines = [ "CC13XX_26XX_FACTORY_DATA" ] - } - - include_dirs = [ - "${project_dir}", - "${chip_root}/examples/providers/", - ] - - cflags = [ - "-Wno-implicit-fallthrough", - "-Wno-sign-compare", - "-Wconversion", - ] - - output_dir = root_out_dir -} - -group("cc13x2x7_26x2x7") { - deps = [ ":lock_app" ] -} - -group("default") { - deps = [ ":cc13x2x7_26x2x7" ] -} diff --git a/examples/lock-app/cc13x2x7_26x2x7/README.md b/examples/lock-app/cc13x2x7_26x2x7/README.md deleted file mode 100644 index 7b056d2cab29b5..00000000000000 --- a/examples/lock-app/cc13x2x7_26x2x7/README.md +++ /dev/null @@ -1,326 +0,0 @@ -# Matter Lock Example Application - -An example application showing the use of [Matter][matter] on the Texas -Instruments CC13XX_26XX family of Wireless MCUs. - ---- - -- [Matter Lock Example Application](#matter-lock-example-application) - - [Introduction](#introduction) - - [Device UI](#device-ui) - - [Building](#building) - - [Preparation](#preparation) - - [Compilation](#compilation) - - [Programming](#programming) - - [Code Composer Studio](#code-composer-studio) - - [UniFlash](#uniflash) - - [Running the Example](#running-the-example) - - [Provisioning](#provisioning) - - [Bluetooth LE Advertising](#bluetooth-le-advertising) - - [Bluetooth LE Rendezvous](#bluetooth-le-rendezvous) - - [TI Support](#ti-support) - ---- - -## Introduction - -The CC13XX_26XX lock example application provides a working demonstration of a -connected door lock device. This uses the open-source Matter implementation and -the Texas Instruments SimpleLinkâ„¢ CC13XX and CC26XX software development kit. - -This example is enabled to build for CC2652R7 devices. - -The lock example is intended to serve both as a means to explore the workings of -Matter, as well as a template for creating real products based on the Texas -Instruments devices. - -## Device UI - -| Action | Functionality | -| ------------------------------------------------ | ---------------------------------------- | -| Left Button (`BTN-1`) Press (less than 1000 ms) | Change state to unlocked | -| Right Button (`BTN-2`) Press (less than 1000 ms) | Change state to locked | -| Left Button (`BTN-1`) Press (more than 1000 ms) | Factory Reset | -| Right Button (`BTN-2`) Press (more than 1000 ms) | BLE Advertisement (Enable/Disable) | -| Red & Green LED Blinking State | Lock state transition to locked/unlocked | -| Red LED On State | Lock state locked | -| Red & Green LED Off State | Lock state unlocked | - -## Building - -### Preparation - -Some initial setup is necessary for preparing the build environment. This -section will need to be done when migrating to new versions of the SDK. This -guide assumes that the environment is linux based, and recommends Ubuntu 20.04. - -- Download and install [SysConfig][sysconfig]. This can be done simply with - the following commands. - - ``` - $ cd ~ - $ `https://dr-download.ti.com/software-development/ide-configuration-compiler-or-debugger/MD-nsUM6f7Vvb/1.16.2.3028/sysconfig-1.16.2_3028-setup.run` - $ chmod +x sysconfig-1.16.2_3028-setup.run - $ ./sysconfig-1.16.2_3028-setup.run - ``` - -- Run the bootstrap script to setup the build environment. - - ``` - $ cd ~/connectedhomeip - $ source ./scripts/bootstrap.sh - - ``` - -### Compilation - -It is necessary to activate the environment in every new shell. Then run GN and -Ninja to build the executable. - -- Activate the build environment with the repository activate script. - - ``` - $ cd ~/connectedhomeip - $ source ./scripts/activate.sh - - ``` - -- Run the build to produce a default executable. By default on Linux both the - TI SimpleLink SDK and Sysconfig are located in a `ti` folder in the user's - home directory, and you must provide the absolute path to them. For example - `/home/username/ti/sysconfig_1.16.2`. On Windows the default directory is - `C:\ti`. Take note of this install path, as it will be used in the next - step. - - ``` - $ cd ~/connectedhomeip/examples/lock-app/cc13x2x7_26x2x7 - OR - $ cd ~/connectedhomeip/examples/lock-app/cc13x4_26x4 - $ gn gen out/debug --args="ti_sysconfig_root=\"$HOME/ti/sysconfig_1.16.2\"" - $ ninja -C out/debug - - ``` - - If you would like to define arguments on the command line you may add them - to the GN call. - - - ``` - gn gen out/debug --args="ti_sysconfig_root=\"$HOME/ti/sysconfig_1.16.2\" target_defines=[\"CC13X2_26X2_ATTESTATION_CREDENTIALS=1\"]" - ``` - -## Programming - -Loading the built image onto a LaunchPad is supported through two methods; -Uniflash and Code Composer Studio (CCS). UniFlash can be used to load the image. -Code Composer Studio can be used to load the image and debug the source code. - -### Code Composer Studio - -Programming with CCS will allow for a full debug environment within the IDE. -This is accomplished by creating a target connection to the XDS110 debugger and -starting a project-less debug session. The CCS IDE will attempt to find the -source files on the local machine based on the debug information embedded within -the ELF. CCS may prompt you to find the source code if the image was built on -another machine or the source code is located in a different location than is -recorded within the ELF. - -Download and install [Code Composer Studio][ccs]. - -First open CCS and create a new workspace. - -Create a target connection (sometimes called the CCXML) for your target SoC and -debugger as described in the [Manual Method][ccs_manual_method] section of the -CCS User's Guide. - -Next initiate a project-less debug session as described in the [Manual -Launch][ccs_manual_launch] section of the CCS User's Guide. - -CCS should switch to the debug view described in the [After -Launch][ccs_after_launch] section of the User's Guide. The SoC core will likely -be disconnected and symbols will not be loaded. Connect to the core as described -in the [Debug View][ccs_debug_view] section of the User's Guide. Once the core -is connected, use the `Load` button on the toolbar to load the ELF image. - -Note that the default configuration of the CCXML uses 2-wire cJTAG instead of -the full 4-wire JTAG connection to match the default jumper configuration of the -LaunchPad. - -### UniFlash - -Uniflash is Texas Instrument's uniform programming tool for embedded processors. -This will allow you to erase, flash, and inspect the SoC without setting up a -debugging environment. - -Download and install [UniFlash][uniflash]. - -First open UniFlash. Debug probes connected to the computer will usually be -displayed under the Detected Devices due to the automatic device detection -feature. If your device does not show up in this view it my be disconnected, or -you may have to create a New Configuration. If you already have a CCXML for your -SoC and debug connection you can use that in the section at the bottom. Once -your device is selected, click the `Start` button within the section to launch -the session. - -Select the ELF image to load on the device with the `Browse` button. This file -is placed in the `out/debug` folder by this guide and ends with the `*.out` file -extension. For OTA enabled applications, the standalone image will instead end -with the `*-bim.hex` file extension. This this is a combined image with -application and and `BIM` included. The flag to enable or disable the OTA -feature is determined by "chip_enable_ota_requestor" in the application's -args.gni file. - -Finally click the `Load Image` button to load the executable image onto the -device. You should be able to see the log output over the XDS110 User UART. - -Note that programming the device through JTAG sets the Halt-in-Boot flag and may -cause issues when performing a software reset. This flag can be reset by -power-cycling the LaunchPad. - -## Running the Example - -By default the log output will be sent to the Application/User UART. Open a -terminal emulator to that port to see the output with the following options: - -| Parameter | Value | -| ------------ | -------- | -| Speed (baud) | `115200` | -| Data bits | `8` | -| Stop bits | `1` | -| Parity | `None` | -| Flow control | `None` | - -## Running the Example - -Once a device has been flashed with this example, it can now join and operate in -an existing Matter network. The following sections assume that a Matter network -is already active, and has at least one [OpenThread Border -Router][ot_border_router_setup]. - -For insight into what other components are needed to run this example, please -refer to our [Matter Getting Started Guide][matter-e2e-faq]. - -The steps below should be followed to commission the device onto the network and -control it once it has been commissioned. - -**Step 0** - -Set up the CHIP tool by following the instructions outlined in our [Matter -Getting Started Guide][matter-e2e-faq]. - -**Step 1** - -Commission the device onto the Matter network. Run the following command on the -CHIP tool: - -``` - -./chip-tool pairing ble-thread hex: 20202021 3840 - -``` - -Interacting with the application begins by enabling BLE advertisements and then -pairing the device into a Thread network. To provision this example onto a -Matter network, the device must be discoverable over Bluetooth LE. - -On the LaunchPad, press and hold the right button, labeled `BTN-2`, for more -than 1 second. Upon release, the Bluetooth LE advertising will begin. Once the -device is fully provisioned, BLE advertising will stop. - -Once the device has been successfully commissioned, you will see the following -message on the CHIP tool output: - -``` - -[1677648218.370754][39785:39790] CHIP:CTL: Received CommissioningComplete response, errorCode=0 -[1677648218.370821][39785:39790] CHIP:CTL: Successfully finished commissioning step 'SendComplete' - -``` - -An accompanying message will be seen from the device: - -``` - -Commissioning complete, notify platform driver to persist network credentials. - -``` - -**Step 2** The example Doorlock cluster operations have the following format: - -``` -./chip-tool doorlock -./chip-tool doorlock set-user -./chip-tool -``` - -Send commands to the lock-app. Here are some example commands: - -Set a new user "`TST`" with user index of 1 with a default pin of 123456 - -``` -./chip-tool doorlock set-user 0 1 `TST` 6452 1 0 0 1 1 --timedInteractionTimeoutMs 1000 -./chip-tool doorlock set-credential 0 '{ "credentialType" : 1 , "credentialIndex" : 1 }' 123456 1 null null 1 1 --timedInteractionTimeoutMs 1000 -``` - -Require a pin mode for lock operations: - -``` -./chip-tool doorlock write require-pinfor-remote-operation 1 1 1 -``` - -Lock the Door - -``` -./chip-tool doorlock lock-door 1 1 --timedInteractionTimeoutMs 1000 --PinCode 123456 -``` - -Unlock the door - -``` -./chip-tool doorlock unlock-door 1 1 --timedInteractionTimeoutMs 1000 --PinCode 123456 -``` - -### Provisioning - -Interacting with the application begins by enabling BLE advertisements and then -pairing the device into a Thread network. - -#### Bluetooth LE Advertising - -To provision this example onto a Thread network, the device must be discoverable -over Bluetooth LE. BLE advertising is started by long pressing the right button -(greater than 1000ms), labeled `BTN-2` on the silkscreen. Once the device is -fully provisioned, BLE advertising will stop. - -#### Bluetooth LE Rendezvous - -Pairing this application with `ble-thread` can be done with any of the enabled -[CHIP Controller](../../../src/controller/README.md) applications. Use the -information printed on the console to aide in pairing the device. The controller -application can also be used to control the example app with the cluster -commands. - -## TI Support - -For technical support, please consider creating a post on TI's [E2E forum][e2e]. -Additionally, we welcome any feedback. - -[matter]: https://csa-iot.org/all-solutions/matter/ -[ccs]: https://www.ti.com/tool/CCSTUDIO -[ccs_after_launch]: - https://software-dl.ti.com/ccs/esd/documents/users_guide/ccs_debug-main.html?configuration#after-launch -[ccs_debug_view]: - https://software-dl.ti.com/ccs/esd/documents/users_guide/ccs_debug-main.html?configuration#debug-view -[ccs_manual_launch]: - https://software-dl.ti.com/ccs/esd/documents/users_guide/ccs_debug-main.html?configuration#manual-launch -[ccs_manual_method]: - https://software-dl.ti.com/ccs/esd/documents/users_guide/ccs_debug-main.html?configuration#manual-method -[e2e]: - https://e2e.ti.com/support/wireless-connectivity/zigbee-thread-group/zigbee-and-thread/f/zigbee-thread-forum -[matter-e2e-faq]: - https://e2e.ti.com/support/wireless-connectivity/zigbee-thread-group/zigbee-and-thread/f/zigbee-thread-forum/1082428/faq-cc2652r7-matter----getting-started-guide -[sysconfig]: https://www.ti.com/tool/SYSCONFIG -[ti_thread_dnd]: - https://www.ti.com/wireless-connectivity/thread/design-development.html -[ot_border_router_setup]: https://openthread.io/guides/border-router/build -[uniflash]: https://www.ti.com/tool/download/UNIFLASH diff --git a/examples/lock-app/cc13x2x7_26x2x7/args.gni b/examples/lock-app/cc13x2x7_26x2x7/args.gni deleted file mode 100644 index b10e4def1a1a7c..00000000000000 --- a/examples/lock-app/cc13x2x7_26x2x7/args.gni +++ /dev/null @@ -1,53 +0,0 @@ -# Copyright (c) 2020 Project CHIP Authors -# -# 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. - -import("//build_overrides/chip.gni") -import("${chip_root}/config/standalone/args.gni") -import("${chip_root}/examples/platform/cc13x2_26x2/args.gni") - -ti_simplelink_sdk_target = get_label_info(":sdk", "label_no_toolchain") -ti_simplelink_sysconfig_target = - get_label_info(":sysconfig", "label_no_toolchain") - -ti_simplelink_board = "LP_CC2652R7" - -# Size Optimizations -# use -Os instead of -Og, LWIP release build -optimize_debug_level = "s" -lwip_debug = false - -chip_enable_ota_requestor = true - -chip_openthread_ftd = false -openthread_external_platform = "${chip_root}/third_party/openthread/platforms/cc13x2_26x2:libopenthread-cc13x2_cc26x2" - -# Disable CHIP Logging -chip_progress_logging = false - -#chip_detail_logging = false -#chip_automation_logging = false - -# BLE options -chip_config_network_layer_ble = true - -# Disable lock tracking, since our FreeRTOS configuration does not set -# INCLUDE_xSemaphoreGetMutexHolder -chip_stack_lock_tracking = "none" - -matter_device_vid = "0xFFF1" -matter_device_pid = "0x8006" -matter_software_ver = "0x0001" -matter_software_ver_str = "1.0d1" - -custom_factory_data = true diff --git a/examples/lock-app/cc13x2x7_26x2x7/build_overrides b/examples/lock-app/cc13x2x7_26x2x7/build_overrides deleted file mode 120000 index e578e73312ebd1..00000000000000 --- a/examples/lock-app/cc13x2x7_26x2x7/build_overrides +++ /dev/null @@ -1 +0,0 @@ -../../build_overrides \ No newline at end of file diff --git a/examples/lock-app/cc13x2x7_26x2x7/chip.syscfg b/examples/lock-app/cc13x2x7_26x2x7/chip.syscfg deleted file mode 100644 index d190703b5322b7..00000000000000 --- a/examples/lock-app/cc13x2x7_26x2x7/chip.syscfg +++ /dev/null @@ -1,237 +0,0 @@ -/* - * - * Copyright (c) 2020 Project CHIP Authors - * Copyright (c) 2020 Texas Instruments Incorporated - * All rights reserved. - * - * 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. - */ - - -/* Modules */ -var AESCCM = scripting.addModule("/ti/drivers/AESCCM"); -var AESECB = scripting.addModule("/ti/drivers/AESECB"); -var Button = scripting.addModule("/ti/drivers/apps/Button"); -var LED = scripting.addModule("/ti/drivers/apps/LED"); -var NVS = scripting.addModule("/ti/drivers/NVS"); -var RF = scripting.addModule("/ti/drivers/RF"); -var RFDesign = scripting.addModule("ti/devices/radioconfig/rfdesign"); -var RFCustom = scripting.addModule("/ti/devices/radioconfig/custom"); -var TRNG = scripting.addModule("/ti/drivers/TRNG"); -var SHA2 = scripting.addModule("/ti/drivers/SHA2"); -var UART2 = scripting.addModule("/ti/drivers/UART2"); -var ble = scripting.addModule("/ti/ble5stack/ble"); -var dmm = scripting.addModule("/ti/dmm/dmm"); -var AESCTRDRBG = scripting.addModule("/ti/drivers/AESCTRDRBG"); -var ECDH = scripting.addModule("/ti/drivers/ECDH"); - -/* Instances */ -var AESCCM1 = AESCCM.addInstance(); -var AESECB1 = AESECB.addInstance(); -var AESECB2 = AESECB.addInstance(); -var Button1 = Button.addInstance(); -var Button2 = Button.addInstance(); -var NVS1 = NVS.addInstance(); -var NVS2 = NVS.addInstance(); -var SHA21 = SHA2.addInstance(); -var LED1 = LED.addInstance(); -var LED2 = LED.addInstance(); -var TRNG1 = TRNG.addInstance(); -var TRNG2 = TRNG.addInstance(); -var TRNG3 = TRNG.addInstance(); -var UART2 = UART2.addInstance(); -var AESCTRDRBG1 = AESCTRDRBG.addInstance(); -var ECDH1 = ECDH.addInstance(); - -AESCTRDRBG1.$name = "CONFIG_AESCTRDRBG_0"; - -AESCCM1.$name = "CONFIG_AESCCM0"; - -AESECB1.$name = "CONFIG_AESECB0"; -AESECB2.$name = "CONFIG_AESECB_1"; - -ECDH1.$name = "CONFIG_ECDH0"; - -/* Left Button */ -Button1.$name = "CONFIG_BTN_LEFT"; -Button1.$hardware = system.deviceData.board.components["BTN-1"]; -Button1.gpioPin.$name = "CONFIG_GPIO_BTN1"; -Button1.gpioPin.pull = "Pull Up"; -Button1.gpioPin.interruptTrigger = "Falling Edge"; - -/* Left Button */ -Button2.$name = "CONFIG_BTN_RIGHT"; -Button2.$hardware = system.deviceData.board.components["BTN-2"]; -Button2.gpioPin.$name = "CONFIG_GPIO_BTN2"; -Button2.gpioPin.pull = "Pull Up"; -Button2.gpioPin.interruptTrigger = "Falling Edge"; - -/* ======== CCFG ======== */ -var CCFG = scripting.addModule("/ti/devices/CCFG"); -const ccfgSettings = system.getScript("/ti/common/lprf_ccfg_settings.js").ccfgSettings; -for(var setting in ccfgSettings) -{ - CCFG[setting] = ccfgSettings[setting]; -} - -CCFG.enableCodeGeneration = true; - -/* NVS */ -NVS1.$name = "CONFIG_NVSINTERNAL"; -NVS1.internalFlash.regionBase = 0xAA000; -NVS1.internalFlash.regionSize = 0x4000; - -NVS2.$name = "CONFIG_NVSEXTERNAL"; -NVS2.nvsType = "External"; // NVS Region Type -NVS2.$hardware = system.deviceData.board.components.MX25R8035F; - -/* RF */ -/* if an antenna component exists, assign it to the rf instance */ -if (system.deviceData.board && system.deviceData.board.components.RF) { - RF.$hardware = system.deviceData.board.components.RF; -} - -const rfDesignSettings = system.getScript("/ti/common/lprf_rf_design_settings.js").rfDesignSettings; -for(var setting in rfDesignSettings) -{ - RFDesign[setting] = rfDesignSettings[setting]; -} - -/* Handling for RF frontend characterization */ -if(RFDesign.rfDesign.match(/LP_CC2652PSIP/)) -{ - RFCustom.ieee = ["ieee154p10"]; - var rfCodeExportConfig = RFCustom.radioConfigieee154p10.codeExportConfig -} -else -{ - RFCustom.ieee = ["ieee154"]; - var rfCodeExportConfig = RFCustom.radioConfigieee154.codeExportConfig -} - -var cmdList = [ - "cmdIeeeTx", - "cmdIeeeRx", - "cmdIeeeCsma", - "cmdIeeeEdScan", - "cmdIeeeRxAck", - "cmdTxTest" -]; - -rfCodeExportConfig.useConst = true; -rfCodeExportConfig.useMulti = true; -rfCodeExportConfig.symGenMethod = "Custom"; - -const deviceId = system.deviceData.deviceId; - -// Add high PA options if present -if(deviceId.match(/CC(265[12]R|2674R|1352R1|1354R)/)) -{ - cmdList.push("cmdRadioSetup"); - rfCodeExportConfig.cmdRadioSetup = "RF_cmdIeeeRadioSetup"; -} -else if(deviceId.match(/CC(265[12]P|2674P|1352P)/)) -{ - cmdList.push("cmdRadioSetupPa"); - rfCodeExportConfig.cmdRadioSetupPa = "RF_cmdIeeeRadioSetup"; - rfCodeExportConfig.paExport = "combined"; -} -else if(deviceId.match(/CC(265[34]|1354)P/)) -{ - cmdList.push("cmdRadioSetupPa"); - rfCodeExportConfig.cmdRadioSetupPa = "RF_cmdIeeeRadioSetup"; - // currently not characterized for high PA -} -else -{ - throw new Error("Could not match platform to any known platform types"); -} - -rfCodeExportConfig.cmdList_ieee_15_4 = cmdList; - -/* Red LED */ -LED1.$name = "CONFIG_LED_RED"; -LED1.$hardware = system.deviceData.board.components.LED_RED; -LED1.gpioPin.$name = "CONFIG_GPIO_RLED"; -LED1.gpioPin.mode = "Output"; -LED1.gpioPin.callbackFunction = ""; - -/* Green LED */ -LED2.$name = "CONFIG_LED_GREEN"; -LED2.$hardware = system.deviceData.board.components.LED_GREEN; -LED2.gpioPin.$name = "CONFIG_GPIO_GLED"; -LED2.gpioPin.mode = "Output"; -LED2.gpioPin.callbackFunction = ""; - -/* Debug UART */ -UART2.$hardware = system.deviceData.board.components.XDS110UART; -UART2.$name = "CONFIG_UART2_DEBUG"; - -/* TRNG */ -TRNG1.$name = "CONFIG_TRNG_0"; -TRNG2.$name = "CONFIG_TRNG_THREAD"; -TRNG3.$name = "CONFIG_TRNG_APP"; - -/* BLE */ -ble.addressMode = "ADDRMODE_RP_WITH_PUBLIC_ID"; -ble.maxConnNum = 1; -ble.numOfAdvSets = 1; -ble.lockProject = true; -ble.oneLibSizeOpt = true; -ble.maxPDUSize = 255; -ble.radioConfig.codeExportConfig.$name = "ti_devices_radioconfig_code_export_param2"; -ble.connUpdateParamsPeripheral.$name = "ti_ble5stack_general_ble_conn_update_params0"; -ble.connUpdateParamsPeripheral.reqMinConnInt = 30; -ble.connUpdateParamsPeripheral.reqMaxConnInt = 50; - - -ble.advSet1.$name = "ti_ble5stack_broadcaster_advertisement_set0"; -ble.advSet1.advParam1.$name = "ti_ble5stack_broadcaster_advertisement_params0"; - -/* DMM */ -dmm.project = "ti_thread_thermostat_remote_display"; -dmm.stackRoles = ["blePeripheral","threadFTD"]; -dmm.lockStackRoles = true; -dmm.numApplicationStates = 10; -dmm.applicationState0 = "ANY"; -dmm.applicationState1 = "DMMPOLICY_BLE_IDLE"; -dmm.applicationState2 = "DMMPOLICY_BLE_ADV"; -dmm.applicationState3 = "DMMPOLICY_BLE_CONNECTING"; -dmm.applicationState4 = "DMMPOLICY_BLE_HIGH_BANDWIDTH"; -dmm.applicationState5 = "DMMPOLICY_BLE_CONNECTED"; -dmm.applicationState6 = "DMMPOLICY_BLE_OAD"; -dmm.applicationState7 = "DMMPOLICY_THREAD_IDLE"; -dmm.applicationState8 = "DMMPOLICY_THREAD_LINK_EST"; -dmm.applicationState9 = "DMMPOLICY_THREAD_DATA"; -dmm.policyArray.create(4); -dmm.policyArray[0].$name = "ti_dmm_policy_dmm_policy0"; -dmm.policyArray[0].blePeripheral.$name = "ti_dmm_policy_stack_dmm_stack_ble0"; -dmm.policyArray[0].blePeripheral.applicationStates = ["applicationState6"]; -dmm.policyArray[0].threadFTD.$name = "ti_dmm_policy_stack_dmm_stack_thread0"; -dmm.policyArray[0].threadFTD.pause = "DMMPOLICY_PAUSED"; -dmm.policyArray[1].$name = "ti_dmm_policy_dmm_policy1"; -dmm.policyArray[1].blePeripheral.$name = "ti_dmm_policy_stack_dmm_stack_ble1"; -dmm.policyArray[1].blePeripheral.applicationStates = ["applicationState3","applicationState4"]; -dmm.policyArray[1].blePeripheral.weight = 25; -dmm.policyArray[1].blePeripheral.appliedActivity = ["DMMPOLICY_APPLIED_ACTIVITY_BLE_CONNECTION"]; -dmm.policyArray[1].threadFTD.$name = "ti_dmm_policy_stack_dmm_stack_thread1"; -dmm.policyArray[2].$name = "ti_dmm_policy_dmm_policy2"; -dmm.policyArray[2].blePeripheral.$name = "ti_dmm_policy_stack_dmm_stack_ble2"; -dmm.policyArray[2].threadFTD.$name = "ti_dmm_policy_stack_dmm_stack_thread2"; -dmm.policyArray[2].threadFTD.weight = 30; -dmm.policyArray[2].threadFTD.applicationStates = ["applicationState8"]; -dmm.policyArray[2].threadFTD.appliedActivity = ["DMMPOLICY_APPLIED_ACTIVITY_ALL"]; -dmm.policyArray[3].$name = "ti_dmm_policy_dmm_policy3"; -dmm.policyArray[3].blePeripheral.$name = "ti_dmm_policy_stack_dmm_stack_ble3"; -dmm.policyArray[3].threadFTD.$name = "ti_dmm_policy_stack_dmm_stack_thread3"; -dmm.policyArray[3].threadFTD.weight = 1; diff --git a/examples/lock-app/cc13x2x7_26x2x7/chip_ota.syscfg b/examples/lock-app/cc13x2x7_26x2x7/chip_ota.syscfg deleted file mode 100644 index 995ad22af6b435..00000000000000 --- a/examples/lock-app/cc13x2x7_26x2x7/chip_ota.syscfg +++ /dev/null @@ -1,238 +0,0 @@ -/* - * - * Copyright (c) 2020 Project CHIP Authors - * Copyright (c) 2020 Texas Instruments Incorporated - * All rights reserved. - * - * 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. - */ - - -/* Modules */ -var AESCCM = scripting.addModule("/ti/drivers/AESCCM"); -var AESECB = scripting.addModule("/ti/drivers/AESECB"); -var Button = scripting.addModule("/ti/drivers/apps/Button"); -var LED = scripting.addModule("/ti/drivers/apps/LED"); -var NVS = scripting.addModule("/ti/drivers/NVS"); -var RF = scripting.addModule("/ti/drivers/RF"); -var RFDesign = scripting.addModule("ti/devices/radioconfig/rfdesign"); -var RFCustom = scripting.addModule("/ti/devices/radioconfig/custom"); -var TRNG = scripting.addModule("/ti/drivers/TRNG"); -var SHA2 = scripting.addModule("/ti/drivers/SHA2"); -var UART2 = scripting.addModule("/ti/drivers/UART2"); -var ble = scripting.addModule("/ti/ble5stack/ble"); -var dmm = scripting.addModule("/ti/dmm/dmm"); -var AESCTRDRBG = scripting.addModule("/ti/drivers/AESCTRDRBG"); -var ECDH = scripting.addModule("/ti/drivers/ECDH"); - -/* Instances */ -var AESCCM1 = AESCCM.addInstance(); -var AESECB1 = AESECB.addInstance(); -var AESECB2 = AESECB.addInstance(); -var Button1 = Button.addInstance(); -var Button2 = Button.addInstance(); -var NVS1 = NVS.addInstance(); -var NVS2 = NVS.addInstance(); -var SHA21 = SHA2.addInstance(); -var LED1 = LED.addInstance(); -var LED2 = LED.addInstance(); -var TRNG1 = TRNG.addInstance(); -var TRNG2 = TRNG.addInstance(); -var TRNG3 = TRNG.addInstance(); -var UART2 = UART2.addInstance(); -var AESCTRDRBG1 = AESCTRDRBG.addInstance(); -var ECDH1 = ECDH.addInstance(); - -AESCTRDRBG1.$name = "CONFIG_AESCTRDRBG_0"; - -AESCCM1.$name = "CONFIG_AESCCM0"; - -AESECB1.$name = "CONFIG_AESECB0"; -AESECB2.$name = "CONFIG_AESECB_1"; - -ECDH1.$name = "CONFIG_ECDH0"; - -/* Left Button */ -Button1.$name = "CONFIG_BTN_LEFT"; -Button1.$hardware = system.deviceData.board.components["BTN-1"]; -Button1.gpioPin.$name = "CONFIG_GPIO_BTN1"; -Button1.gpioPin.pull = "Pull Up"; -Button1.gpioPin.interruptTrigger = "Falling Edge"; - -/* Left Button */ -Button2.$name = "CONFIG_BTN_RIGHT"; -Button2.$hardware = system.deviceData.board.components["BTN-2"]; -Button2.gpioPin.$name = "CONFIG_GPIO_BTN2"; -Button2.gpioPin.pull = "Pull Up"; -Button2.gpioPin.interruptTrigger = "Falling Edge"; - -/* ======== CCFG ======== */ -var CCFG = scripting.addModule("/ti/devices/CCFG"); -const ccfgSettings = system.getScript("/ti/common/lprf_ccfg_settings.js").ccfgSettings; -for(var setting in ccfgSettings) -{ - CCFG[setting] = ccfgSettings[setting]; -} - -// Disable CCFG generation, this is added by the BIM project -CCFG.enableCodeGeneration = false; - -/* NVS */ -NVS1.$name = "CONFIG_NVSINTERNAL"; -NVS1.internalFlash.regionBase = 0xAA000; -NVS1.internalFlash.regionSize = 0x4000; - -NVS2.$name = "CONFIG_NVSEXTERNAL"; -NVS2.nvsType = "External"; // NVS Region Type -NVS2.$hardware = system.deviceData.board.components.MX25R8035F; - -/* RF */ -/* if an antenna component exists, assign it to the rf instance */ -if (system.deviceData.board && system.deviceData.board.components.RF) { - RF.$hardware = system.deviceData.board.components.RF; -} - -const rfDesignSettings = system.getScript("/ti/common/lprf_rf_design_settings.js").rfDesignSettings; -for(var setting in rfDesignSettings) -{ - RFDesign[setting] = rfDesignSettings[setting]; -} - -/* Handling for RF frontend characterization */ -if(RFDesign.rfDesign.match(/LP_CC2652PSIP/)) -{ - RFCustom.ieee = ["ieee154p10"]; - var rfCodeExportConfig = RFCustom.radioConfigieee154p10.codeExportConfig -} -else -{ - RFCustom.ieee = ["ieee154"]; - var rfCodeExportConfig = RFCustom.radioConfigieee154.codeExportConfig -} - -var cmdList = [ - "cmdIeeeTx", - "cmdIeeeRx", - "cmdIeeeCsma", - "cmdIeeeEdScan", - "cmdIeeeRxAck", - "cmdTxTest" -]; - -rfCodeExportConfig.useConst = true; -rfCodeExportConfig.useMulti = true; -rfCodeExportConfig.symGenMethod = "Custom"; - -const deviceId = system.deviceData.deviceId; - -// Add high PA options if present -if(deviceId.match(/CC(265[12]R|2674R|1352R1|1354R)/)) -{ - cmdList.push("cmdRadioSetup"); - rfCodeExportConfig.cmdRadioSetup = "RF_cmdIeeeRadioSetup"; -} -else if(deviceId.match(/CC(265[12]P|2674P|1352P)/)) -{ - cmdList.push("cmdRadioSetupPa"); - rfCodeExportConfig.cmdRadioSetupPa = "RF_cmdIeeeRadioSetup"; - rfCodeExportConfig.paExport = "combined"; -} -else if(deviceId.match(/CC(265[34]|1354)P/)) -{ - cmdList.push("cmdRadioSetupPa"); - rfCodeExportConfig.cmdRadioSetupPa = "RF_cmdIeeeRadioSetup"; - // currently not characterized for high PA -} -else -{ - throw new Error("Could not match platform to any known platform types"); -} - -rfCodeExportConfig.cmdList_ieee_15_4 = cmdList; - -/* Red LED */ -LED1.$name = "CONFIG_LED_RED"; -LED1.$hardware = system.deviceData.board.components.LED_RED; -LED1.gpioPin.$name = "CONFIG_GPIO_RLED"; -LED1.gpioPin.mode = "Output"; -LED1.gpioPin.callbackFunction = ""; - -/* Green LED */ -LED2.$name = "CONFIG_LED_GREEN"; -LED2.$hardware = system.deviceData.board.components.LED_GREEN; -LED2.gpioPin.$name = "CONFIG_GPIO_GLED"; -LED2.gpioPin.mode = "Output"; -LED2.gpioPin.callbackFunction = ""; - -/* Debug UART */ -UART2.$hardware = system.deviceData.board.components.XDS110UART; -UART2.$name = "CONFIG_UART2_DEBUG"; - -/* TRNG */ -TRNG1.$name = "CONFIG_TRNG_0"; -TRNG2.$name = "CONFIG_TRNG_THREAD"; -TRNG3.$name = "CONFIG_TRNG_APP"; - -/* BLE */ -ble.addressMode = "ADDRMODE_RP_WITH_PUBLIC_ID"; -ble.maxConnNum = 1; -ble.numOfAdvSets = 1; -ble.lockProject = true; -ble.oneLibSizeOpt = true; -ble.maxPDUSize = 255; -ble.radioConfig.codeExportConfig.$name = "ti_devices_radioconfig_code_export_param2"; -ble.connUpdateParamsPeripheral.$name = "ti_ble5stack_general_ble_conn_update_params0"; -ble.connUpdateParamsPeripheral.reqMinConnInt = 30; -ble.connUpdateParamsPeripheral.reqMaxConnInt = 50; - - -ble.advSet1.$name = "ti_ble5stack_broadcaster_advertisement_set0"; -ble.advSet1.advParam1.$name = "ti_ble5stack_broadcaster_advertisement_params0"; - -/* DMM */ -dmm.project = "ti_thread_thermostat_remote_display"; -dmm.stackRoles = ["blePeripheral","threadFTD"]; -dmm.lockStackRoles = true; -dmm.numApplicationStates = 10; -dmm.applicationState0 = "ANY"; -dmm.applicationState1 = "DMMPOLICY_BLE_IDLE"; -dmm.applicationState2 = "DMMPOLICY_BLE_ADV"; -dmm.applicationState3 = "DMMPOLICY_BLE_CONNECTING"; -dmm.applicationState4 = "DMMPOLICY_BLE_HIGH_BANDWIDTH"; -dmm.applicationState5 = "DMMPOLICY_BLE_CONNECTED"; -dmm.applicationState6 = "DMMPOLICY_BLE_OAD"; -dmm.applicationState7 = "DMMPOLICY_THREAD_IDLE"; -dmm.applicationState8 = "DMMPOLICY_THREAD_LINK_EST"; -dmm.applicationState9 = "DMMPOLICY_THREAD_DATA"; -dmm.policyArray.create(4); -dmm.policyArray[0].$name = "ti_dmm_policy_dmm_policy0"; -dmm.policyArray[0].blePeripheral.$name = "ti_dmm_policy_stack_dmm_stack_ble0"; -dmm.policyArray[0].blePeripheral.applicationStates = ["applicationState6"]; -dmm.policyArray[0].threadFTD.$name = "ti_dmm_policy_stack_dmm_stack_thread0"; -dmm.policyArray[0].threadFTD.pause = "DMMPOLICY_PAUSED"; -dmm.policyArray[1].$name = "ti_dmm_policy_dmm_policy1"; -dmm.policyArray[1].blePeripheral.$name = "ti_dmm_policy_stack_dmm_stack_ble1"; -dmm.policyArray[1].blePeripheral.applicationStates = ["applicationState3","applicationState4"]; -dmm.policyArray[1].blePeripheral.weight = 25; -dmm.policyArray[1].blePeripheral.appliedActivity = ["DMMPOLICY_APPLIED_ACTIVITY_BLE_CONNECTION"]; -dmm.policyArray[1].threadFTD.$name = "ti_dmm_policy_stack_dmm_stack_thread1"; -dmm.policyArray[2].$name = "ti_dmm_policy_dmm_policy2"; -dmm.policyArray[2].blePeripheral.$name = "ti_dmm_policy_stack_dmm_stack_ble2"; -dmm.policyArray[2].threadFTD.$name = "ti_dmm_policy_stack_dmm_stack_thread2"; -dmm.policyArray[2].threadFTD.weight = 30; -dmm.policyArray[2].threadFTD.applicationStates = ["applicationState8"]; -dmm.policyArray[2].threadFTD.appliedActivity = ["DMMPOLICY_APPLIED_ACTIVITY_ALL"]; -dmm.policyArray[3].$name = "ti_dmm_policy_dmm_policy3"; -dmm.policyArray[3].blePeripheral.$name = "ti_dmm_policy_stack_dmm_stack_ble3"; -dmm.policyArray[3].threadFTD.$name = "ti_dmm_policy_stack_dmm_stack_thread3"; -dmm.policyArray[3].threadFTD.weight = 1; diff --git a/examples/lock-app/cc13x2x7_26x2x7/include/CHIPProjectConfig.h b/examples/lock-app/cc13x2x7_26x2x7/include/CHIPProjectConfig.h deleted file mode 100644 index 6e6a2562178da4..00000000000000 --- a/examples/lock-app/cc13x2x7_26x2x7/include/CHIPProjectConfig.h +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright (c) 2020 Project CHIP Authors - * Copyright (c) 2019 Google LLC. - * All rights reserved. - * - * 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. - */ - -/** - * @file - * Example project configuration file for CHIP. - * - * This is a place to put application or project-specific overrides - * to the default configuration values for general CHIP features. - * - */ - -#ifndef CHIP_PROJECT_CONFIG_H -#define CHIP_PROJECT_CONFIG_H - -#if BUILD_RELEASE // release build -// Note: Default Pairing/PIN/Serial Numbers being used. These should not be enabled for production builds -#endif // BUILD_RELEASE - -// Use a default pairing code if one hasn't been provisioned in flash. -#define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE 20202021 -#define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR 0xF00 - -/** - * CHIP_DEVICE_CONFIG_TEST_SERIAL_NUMBER - * - * Enables the use of a hard-coded default serial number if none - * is found in CHIP NV storage. - */ -#define CHIP_DEVICE_CONFIG_TEST_SERIAL_NUMBER "TEST_SN" - -/** - * CHIP_DEVICE_CONFIG_DEVICE_HARDWARE_VERSION - * - * The hardware version number assigned to device or product by the device vendor. This - * number is scoped to the device product id, and typically corresponds to a revision of the - * physical device, a change to its packaging, and/or a change to its marketing presentation. - * This value is generally *not* incremented for device software versions. - */ -#ifndef CHIP_DEVICE_CONFIG_DEVICE_HARDWARE_VERSION -#define CHIP_DEVICE_CONFIG_DEVICE_HARDWARE_VERSION 1 -#endif - -/** - * Values set by args.gni: - * CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID - * CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID - * CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING - * CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION - */ - -/** - * CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE - * - * Enable support for CHIP-over-BLE (CHIPOBLE). - */ -#define CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE 1 - -/** - * CHIP_DEVICE_CONFIG_ENABLE_CHIP_TIME_SERVICE_TIME_SYNC - * - * Enables synchronizing the device's real time clock with a remote CHIP Time service - * using the CHIP Time Sync protocol. - */ -// #define CHIP_DEVICE_CONFIG_ENABLE_CHIP_TIME_SERVICE_TIME_SYNC 1 - -/** - * CHIP_DEVICE_CONFIG_EVENT_LOGGING_DEBUG_BUFFER_SIZE - * - * A size, in bytes, of the individual debug event logging buffer. - */ -#define CHIP_DEVICE_CONFIG_EVENT_LOGGING_DEBUG_BUFFER_SIZE (512) - -#define MATTER_CC13XX_26XX_PLATFORM_LOG_ENABLED 1 - -/** - * CHIP_DEVICE_CONFIG_ENABLE_THREAD_SRP_CLIENT - * - * Enable the OpenThread SRP client to allow for CHIP device discovery. - */ -#define CHIP_DEVICE_CONFIG_ENABLE_THREAD_SRP_CLIENT 1 - -/** - * CHIP_CONFIG_EVENT_LOGGING_DEFAULT_IMPORTANCE - * - * For a development build, set the default importance of events to be logged as Debug. - * Since debug is the lowest importance level, this means all standard, critical, info and - * debug importance level vi events get logged. - */ -#if BUILD_RELEASE -#define CHIP_CONFIG_EVENT_LOGGING_DEFAULT_IMPORTANCE chip::Profiles::DataManagement::Production -#else -#define CHIP_CONFIG_EVENT_LOGGING_DEFAULT_IMPORTANCE chip::Profiles::DataManagement::Debug -#endif // BUILD_RELEASE - -#define CHIP_DEVICE_CONFIG_ENABLE_EXTENDED_DISCOVERY 1 - -/** - * @def CHIP_IM_MAX_NUM_COMMAND_HANDLER - * - * @brief Defines the maximum number of CommandHandler, limits the number of active commands transactions on server. - */ -#define CHIP_IM_MAX_NUM_COMMAND_HANDLER 2 - -/** - * @def CHIP_IM_MAX_NUM_WRITE_HANDLER - * - * @brief Defines the maximum number of WriteHandler, limits the number of active write transactions on server. - */ -#define CHIP_IM_MAX_NUM_WRITE_HANDLER 2 - -#endif // CHIP_PROJECT_CONFIG_H diff --git a/examples/lock-app/cc13x2x7_26x2x7/src/AppConfig.h b/examples/lock-app/cc13x2x7_26x2x7/src/AppConfig.h deleted file mode 100644 index a818b21d641875..00000000000000 --- a/examples/lock-app/cc13x2x7_26x2x7/src/AppConfig.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2020 Project CHIP Authors - * All rights reserved. - * - * 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. - */ - -#ifndef APP_CONFIG_H -#define APP_CONFIG_H - -// Logging -#ifdef __cplusplus -extern "C" { -#endif - -int cc13xx_26xxLogInit(void); -void cc13xx_26xxLog(const char * aFormat, ...); -#define PLAT_LOG(...) cc13xx_26xxLog(__VA_ARGS__); - -#define ACTUATOR_MOVEMENT_PERIOD_MS 1000 - -#ifdef __cplusplus -} -#endif -#endif // APP_CONFIG_H diff --git a/examples/lock-app/cc13x2x7_26x2x7/src/AppEvent.h b/examples/lock-app/cc13x2x7_26x2x7/src/AppEvent.h deleted file mode 100644 index dc4ce143338e1e..00000000000000 --- a/examples/lock-app/cc13x2x7_26x2x7/src/AppEvent.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * - * Copyright (c) 2021 Project CHIP Authors - * All rights reserved. - * - * 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. - */ - -#ifndef APP_EVENT_H -#define APP_EVENT_H - -struct AppEvent; -typedef void (*EventHandler)(AppEvent *); - -struct AppEvent -{ - enum AppEventType - { - kEventType_None = 0, - kEventType_ButtonLeft, - kEventType_ButtonRight, - kEventType_AppEvent, - kEventType_IdentifyStart, - kEventType_IdentifyStop, - }; - - enum AppEventButtonType - { - kAppEventButtonType_None = 0, - kAppEventButtonType_Clicked, - kAppEventButtonType_LongClicked, - }; - - enum AppEventType Type; - - union - { - struct - { - enum AppEventButtonType Type; - } ButtonEvent; - - struct - { - void * Context; - } BoltLockEvent; - - struct - { - uint8_t Action; - int32_t Actor; - } LockEvent; - }; - - EventHandler Handler; -}; - -#endif // APP_EVENT_H diff --git a/examples/lock-app/cc13x2x7_26x2x7/src/AppTask.cpp b/examples/lock-app/cc13x2x7_26x2x7/src/AppTask.cpp deleted file mode 100644 index 380b05e32ca668..00000000000000 --- a/examples/lock-app/cc13x2x7_26x2x7/src/AppTask.cpp +++ /dev/null @@ -1,568 +0,0 @@ -/* - * - * Copyright (c) 2020 Project CHIP Authors - * Copyright (c) 2020 Texas Instruments Incorporated - * All rights reserved. - * - * 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. - */ - -#include "AppTask.h" -#include "AppConfig.h" -#include "AppEvent.h" - -#include "FreeRTOS.h" - -#include -#include - -#include -#include - -#if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR -#include -#include -#include -#include -#include -#endif - -#include -#include - -#include - -#include -#include -#include -#include -#include - -#include -#include - -/* syscfg */ -#include - -#define APP_TASK_STACK_SIZE (4096) -#define APP_TASK_PRIORITY 4 -#define APP_EVENT_QUEUE_SIZE 10 - -using namespace ::chip; -using namespace ::chip::app; -using namespace ::chip::Credentials; -using namespace ::chip::DeviceLayer; -using namespace ::chip::app::Clusters::DoorLock; - -static TaskHandle_t sAppTaskHandle; -static QueueHandle_t sAppEventQueue; - -static LED_Handle sAppRedHandle; -static LED_Handle sAppGreenHandle; -static Button_Handle sAppLeftHandle; -static Button_Handle sAppRightHandle; -static DeviceInfoProviderImpl sExampleDeviceInfoProvider; - -AppTask AppTask::sAppTask; - -#if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR -static DefaultOTARequestor sRequestorCore; -static DefaultOTARequestorStorage sRequestorStorage; -static DefaultOTARequestorDriver sRequestorUser; -static BDXDownloader sDownloader; -static OTAImageProcessorImpl sImageProcessor; - -void InitializeOTARequestor(void) -{ - // Initialize and interconnect the Requestor and Image Processor objects - SetRequestorInstance(&sRequestorCore); - - sRequestorStorage.Init(Server::GetInstance().GetPersistentStorage()); - sRequestorCore.Init(Server::GetInstance(), sRequestorStorage, sRequestorUser, sDownloader); - sImageProcessor.SetOTADownloader(&sDownloader); - sDownloader.SetImageProcessorDelegate(&sImageProcessor); - sRequestorUser.Init(&sRequestorCore, &sImageProcessor); -} -#endif - -::Identify stIdentify = { 0, AppTask::IdentifyStartHandler, AppTask::IdentifyStopHandler, - Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator, AppTask::TriggerIdentifyEffectHandler }; - -int AppTask::StartAppTask() -{ - int ret = 0; - - sAppEventQueue = xQueueCreate(APP_EVENT_QUEUE_SIZE, sizeof(AppEvent)); - if (sAppEventQueue == NULL) - { - PLAT_LOG("Failed to allocate app event queue"); - while (1) - ; - } - - // Start App task. - if (xTaskCreate(AppTaskMain, "APP", APP_TASK_STACK_SIZE / sizeof(StackType_t), NULL, APP_TASK_PRIORITY, &sAppTaskHandle) != - pdPASS) - { - PLAT_LOG("Failed to create app task"); - while (1) - ; - } - return ret; -} - -void uiLocking(void) -{ - PLAT_LOG("Lock initiated"); - LED_setOn(sAppGreenHandle, LED_BRIGHTNESS_MAX); - LED_startBlinking(sAppGreenHandle, 50 /* ms */, LED_BLINK_FOREVER); - LED_setOn(sAppRedHandle, LED_BRIGHTNESS_MAX); - LED_startBlinking(sAppRedHandle, 110 /* ms */, LED_BLINK_FOREVER); -} - -void uiLocked(void) -{ - PLAT_LOG("Lock completed"); - LED_stopBlinking(sAppGreenHandle); - LED_setOff(sAppGreenHandle); - LED_stopBlinking(sAppRedHandle); - LED_setOn(sAppRedHandle, LED_BRIGHTNESS_MAX); -} - -void uiUnlocking(void) -{ - PLAT_LOG("Unlock initiated"); - LED_setOn(sAppGreenHandle, LED_BRIGHTNESS_MAX); - LED_startBlinking(sAppGreenHandle, 50 /* ms */, LED_BLINK_FOREVER); - LED_setOn(sAppRedHandle, LED_BRIGHTNESS_MAX); - LED_startBlinking(sAppRedHandle, 110 /* ms */, LED_BLINK_FOREVER); -} - -void uiUnlocked(void) -{ - PLAT_LOG("Unlock completed"); - LED_stopBlinking(sAppGreenHandle); - LED_setOff(sAppGreenHandle); - LED_stopBlinking(sAppRedHandle); - LED_setOff(sAppRedHandle); -} - -int AppTask::Init() -{ - LED_Params ledParams; - Button_Params buttonParams; - - cc13xx_26xxLogInit(); - - // Init Chip memory management before the stack - Platform::MemoryInit(); - - CHIP_ERROR ret = PlatformMgr().InitChipStack(); - if (ret != CHIP_NO_ERROR) - { - PLAT_LOG("PlatformMgr().InitChipStack() failed"); - while (1) - ; - } - - ret = ThreadStackMgr().InitThreadStack(); - if (ret != CHIP_NO_ERROR) - { - PLAT_LOG("ThreadStackMgr().InitThreadStack() failed"); - while (1) - ; - } -#if CHIP_DEVICE_CONFIG_THREAD_FTD - ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_Router); -#else - ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_MinimalEndDevice); -#endif - if (ret != CHIP_NO_ERROR) - { - PLAT_LOG("ConnectivityMgr().SetThreadDeviceType() failed"); - while (1) - ; - } - - ret = PlatformMgr().StartEventLoopTask(); - if (ret != CHIP_NO_ERROR) - { - PLAT_LOG("PlatformMgr().StartEventLoopTask() failed"); - while (1) - ; - } - - ret = ThreadStackMgrImpl().StartThreadTask(); - if (ret != CHIP_NO_ERROR) - { - PLAT_LOG("ThreadStackMgr().StartThreadTask() failed"); - while (1) - ; - } - - // Initialize device attestation config -#ifdef CC13X2_26X2_ATTESTATION_CREDENTIALS -#ifdef CC13XX_26XX_FACTORY_DATA - SetDeviceInstanceInfoProvider(&mFactoryDataProvider); - SetDeviceAttestationCredentialsProvider(&mFactoryDataProvider); - SetCommissionableDataProvider(&mFactoryDataProvider); -#else - SetDeviceAttestationCredentialsProvider(CC13X2_26X2::GetCC13X2_26X2DacProvider()); -#endif -#else - SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider()); -#endif - - // Init ZCL Data Model and start server - PLAT_LOG("Initialize Server"); - static CommonCaseDeviceServerInitParams initParams; - (void) initParams.InitializeStaticResourcesBeforeServerInit(); - - // Initialize info provider - sExampleDeviceInfoProvider.SetStorageDelegate(initParams.persistentStorageDelegate); - SetDeviceInfoProvider(&sExampleDeviceInfoProvider); - - Server::GetInstance().Init(initParams); - - // Initialize LEDs - PLAT_LOG("Initialize LEDs"); - LED_init(); - - LED_Params_init(&ledParams); // default PWM LED - sAppRedHandle = LED_open(CONFIG_LED_RED, &ledParams); - LED_setOff(sAppRedHandle); - - LED_Params_init(&ledParams); // default PWM LED - sAppGreenHandle = LED_open(CONFIG_LED_GREEN, &ledParams); - LED_setOff(sAppGreenHandle); - - // Initialize buttons - PLAT_LOG("Initialize buttons"); - Button_init(); - - Button_Params_init(&buttonParams); - buttonParams.buttonEventMask = Button_EV_CLICKED | Button_EV_LONGCLICKED; - buttonParams.longPressDuration = 1000U; // ms - sAppLeftHandle = Button_open(CONFIG_BTN_LEFT, &buttonParams); - Button_setCallback(sAppLeftHandle, ButtonLeftEventHandler); - - Button_Params_init(&buttonParams); - buttonParams.buttonEventMask = Button_EV_CLICKED | Button_EV_LONGCLICKED; - buttonParams.longPressDuration = 1000U; // ms - sAppRightHandle = Button_open(CONFIG_BTN_RIGHT, &buttonParams); - Button_setCallback(sAppRightHandle, ButtonRightEventHandler); - - PlatformMgr().LockChipStack(); - { - uint8_t numberOfCredentialsPerUser = 0; - uint16_t numberOfUsers = 0; - uint8_t numberOfWeekdaySchedulesPerUser = 0; - uint8_t numberOfYeardaySchedulesPerUser = 0; - uint8_t numberOfHolidaySchedules = 0; - chip::app::DataModel::Nullable state; - EndpointId endpointId{ 1 }; - - if (!DoorLockServer::Instance().GetNumberOfCredentialsSupportedPerUser(endpointId, numberOfCredentialsPerUser)) - { - numberOfCredentialsPerUser = 5; - } - - if (!DoorLockServer::Instance().GetNumberOfUserSupported(endpointId, numberOfUsers)) - { - numberOfUsers = 10; - } - - if (!DoorLockServer::Instance().GetNumberOfWeekDaySchedulesPerUserSupported(endpointId, numberOfWeekdaySchedulesPerUser)) - { - numberOfWeekdaySchedulesPerUser = 10; - } - - if (!DoorLockServer::Instance().GetNumberOfYearDaySchedulesPerUserSupported(endpointId, numberOfYeardaySchedulesPerUser)) - { - numberOfYeardaySchedulesPerUser = 10; - } - - if (!DoorLockServer::Instance().GetNumberOfHolidaySchedulesSupported(endpointId, numberOfHolidaySchedules)) - { - numberOfHolidaySchedules = 10; - } - - Attributes::LockState::Get(endpointId, state); - ret = LockMgr().Init(state, - CC13X2_26X2DoorLock::LockInitParams::ParamBuilder() - .SetNumberOfUsers(numberOfUsers) - .SetNumberOfCredentialsPerUser(numberOfCredentialsPerUser) - .SetNumberOfWeekdaySchedulesPerUser(numberOfWeekdaySchedulesPerUser) - .SetNumberOfYeardaySchedulesPerUser(numberOfYeardaySchedulesPerUser) - .SetNumberOfHolidaySchedules(numberOfHolidaySchedules) - .GetLockParam()); - - if (state.Value() == DlLockState::kLocked) - { - uiLocked(); - } - else - { - uiUnlocked(); - } - } - - PlatformMgr().UnlockChipStack(); - - if (ret != CHIP_NO_ERROR) - { - PLAT_LOG("LockMgr().Init() failed"); - while (1) - ; - } - - LockMgr().SetCallbacks(ActionInitiated, ActionCompleted); - - ConfigurationMgr().LogDeviceConfig(); - -#if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR - InitializeOTARequestor(); -#endif - // QR code will be used with CHIP Tool - PrintOnboardingCodes(RendezvousInformationFlags(RendezvousInformationFlag::kBLE)); - - return 0; -} - -void AppTask::AppTaskMain(void * pvParameter) -{ - AppEvent event; - - sAppTask.Init(); - - LockMgr().ReadConfigValues(); - - while (1) - { - /* Task pend until we have stuff to do */ - if (xQueueReceive(sAppEventQueue, &event, portMAX_DELAY) == pdTRUE) - { - sAppTask.DispatchEvent(&event); - } - } -} - -void AppTask::ButtonLeftEventHandler(Button_Handle handle, Button_EventMask events) -{ - AppEvent event; - event.Type = AppEvent::kEventType_ButtonLeft; - - if (events & Button_EV_CLICKED) - { - event.ButtonEvent.Type = AppEvent::kAppEventButtonType_Clicked; - } - else if (events & Button_EV_LONGCLICKED) - { - event.ButtonEvent.Type = AppEvent::kAppEventButtonType_LongClicked; - } - // button callbacks are in ISR context - if (xQueueSendFromISR(sAppEventQueue, &event, NULL) != pdPASS) - { - /* Failed to post the message */ - } -} - -void AppTask::ButtonRightEventHandler(Button_Handle handle, Button_EventMask events) -{ - AppEvent event; - event.Type = AppEvent::kEventType_ButtonRight; - - if (events & Button_EV_CLICKED) - { - event.ButtonEvent.Type = AppEvent::kAppEventButtonType_Clicked; - } - else if (events & Button_EV_LONGCLICKED) - { - event.ButtonEvent.Type = AppEvent::kAppEventButtonType_LongClicked; - } - // button callbacks are in ISR context - if (xQueueSendFromISR(sAppEventQueue, &event, NULL) != pdPASS) - { - /* Failed to post the message */ - } -} - -void AppTask::ActionInitiated(LockManager::Action_t aAction) -{ - if (aAction == LockManager::LOCK_ACTION) - { - uiLocking(); - } - else if (aAction == LockManager::UNLOCK_ACTION) - { - uiUnlocking(); - } -} - -void AppTask::ActionCompleted(LockManager::Action_t aAction) -{ - if (aAction == LockManager::LOCK_ACTION) - { - uiLocked(); - } - else if (aAction == LockManager::UNLOCK_ACTION) - { - uiUnlocked(); - } -} - -void AppTask::PostEvent(const AppEvent * aEvent) -{ - if (sAppEventQueue != NULL) - { - BaseType_t status; - if (xPortIsInsideInterrupt()) - { - BaseType_t higherPrioTaskWoken = pdFALSE; - status = xQueueSendFromISR(sAppEventQueue, aEvent, &higherPrioTaskWoken); - -#ifdef portYIELD_FROM_ISR - portYIELD_FROM_ISR(higherPrioTaskWoken); -#elif portEND_SWITCHING_ISR // portYIELD_FROM_ISR or portEND_SWITCHING_ISR - portEND_SWITCHING_ISR(higherPrioTaskWoken); -#else // portYIELD_FROM_ISR or portEND_SWITCHING_ISR -#error "Must have portYIELD_FROM_ISR or portEND_SWITCHING_ISR" -#endif // portYIELD_FROM_ISR or portEND_SWITCHING_ISR - } - else - { - status = xQueueSend(sAppEventQueue, aEvent, 1); - } - - if (status != pdTRUE) - { - PLAT_LOG("Failed to post event to app task event queue"); - } - } - else - { - PLAT_LOG("Event Queue is NULL should never happen"); - } -} - -void AppTask::DispatchEvent(AppEvent * aEvent) -{ - switch (aEvent->Type) - { - case AppEvent::kEventType_ButtonLeft: - if (AppEvent::kAppEventButtonType_Clicked == aEvent->ButtonEvent.Type) - { - LockMgr().InitiateAction(LockManager::UNLOCK_ACTION); - } - else if (AppEvent::kAppEventButtonType_LongClicked == aEvent->ButtonEvent.Type) - { - chip::Server::GetInstance().ScheduleFactoryReset(); - } - break; - - case AppEvent::kEventType_ButtonRight: - if (AppEvent::kAppEventButtonType_Clicked == aEvent->ButtonEvent.Type) - { - LockMgr().InitiateAction(LockManager::LOCK_ACTION); - } - else if (AppEvent::kAppEventButtonType_LongClicked == aEvent->ButtonEvent.Type) - { - // Enable BLE advertisements - if (!ConnectivityMgr().IsBLEAdvertisingEnabled()) - { - if (Server::GetInstance().GetCommissioningWindowManager().OpenBasicCommissioningWindow() == CHIP_NO_ERROR) - { - PLAT_LOG("Enabled BLE Advertisements"); - } - else - { - PLAT_LOG("OpenBasicCommissioningWindow() failed"); - } - } - else - { - // Disable BLE advertisements - ConnectivityMgr().SetBLEAdvertisingEnabled(false); - PLAT_LOG("Disabled BLE Advertisements"); - } - } - break; - - case AppEvent::kEventType_IdentifyStart: - LED_setOn(sAppGreenHandle, LED_BRIGHTNESS_MAX); - LED_startBlinking(sAppGreenHandle, 500, LED_BLINK_FOREVER); - PLAT_LOG("Identify started"); - break; - - case AppEvent::kEventType_IdentifyStop: - LED_stopBlinking(sAppGreenHandle); - - LED_setOff(sAppGreenHandle); - PLAT_LOG("Identify stopped"); - break; - - case AppEvent::kEventType_AppEvent: - if (NULL != aEvent->Handler) - { - aEvent->Handler(aEvent); - } - break; - - case AppEvent::kEventType_None: - default: - break; - } -} - -void AppTask::IdentifyStartHandler(::Identify *) -{ - AppEvent event; - event.Type = AppEvent::kEventType_IdentifyStart; - sAppTask.PostEvent(&event); -} - -void AppTask::IdentifyStopHandler(::Identify *) -{ - AppEvent event; - event.Type = AppEvent::kEventType_IdentifyStop; - sAppTask.PostEvent(&event); -} - -void AppTask::TriggerIdentifyEffectHandler(::Identify * identify) -{ - switch (identify->mCurrentEffectIdentifier) - { - case Clusters::Identify::EffectIdentifierEnum::kBlink: - PLAT_LOG("Starting blink identifier effect"); - IdentifyStartHandler(identify); - break; - case Clusters::Identify::EffectIdentifierEnum::kBreathe: - PLAT_LOG("Breathe identifier effect not implemented"); - break; - case Clusters::Identify::EffectIdentifierEnum::kOkay: - PLAT_LOG("Okay identifier effect not implemented"); - break; - case Clusters::Identify::EffectIdentifierEnum::kChannelChange: - PLAT_LOG("Channel Change identifier effect not implemented"); - break; - case Clusters::Identify::EffectIdentifierEnum::kFinishEffect: - PLAT_LOG("Finish identifier effect not implemented"); - break; - case Clusters::Identify::EffectIdentifierEnum::kStopEffect: - PLAT_LOG("Stop identifier effect"); - IdentifyStopHandler(identify); - break; - default: - PLAT_LOG("No identifier effect"); - } -} diff --git a/examples/lock-app/cc13x2x7_26x2x7/src/AppTask.h b/examples/lock-app/cc13x2x7_26x2x7/src/AppTask.h deleted file mode 100644 index 7778fd5f2a5e1f..00000000000000 --- a/examples/lock-app/cc13x2x7_26x2x7/src/AppTask.h +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (c) 2020 Project CHIP Authors - * Copyright (c) 2019 Google LLC. - * All rights reserved. - * - * 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. - */ - -#pragma once - -#include -#include - -#include "FreeRTOS.h" -#include "semphr.h" -#include "task.h" - -#include "AppEvent.h" -#include "LockManager.h" - -#include - -#ifdef CC13XX_26XX_FACTORY_DATA -#include -#endif - -// Application-defined error codes in the CHIP_ERROR space. -#define APP_ERROR_EVENT_QUEUE_FAILED CHIP_APPLICATION_ERROR(0x01) -#define APP_ERROR_CREATE_TASK_FAILED CHIP_APPLICATION_ERROR(0x02) -#define APP_ERROR_UNHANDLED_EVENT CHIP_APPLICATION_ERROR(0x03) -#define APP_ERROR_CREATE_TIMER_FAILED CHIP_APPLICATION_ERROR(0x04) -#define APP_ERROR_START_TIMER_FAILED CHIP_APPLICATION_ERROR(0x05) -#define APP_ERROR_STOP_TIMER_FAILED CHIP_APPLICATION_ERROR(0x06) -#define APP_ERROR_ALLOCATION_FAILED CHIP_APPLICATION_ERROR(0x07) - -struct Identify; - -class AppTask -{ - -public: - int StartAppTask(); - static void AppTaskMain(void * pvParameter); - - void PostLockActionRequest(int32_t aActor, LockManager::Action_t aAction); - void PostEvent(const AppEvent * event); - - static void IdentifyStartHandler(::Identify *); - static void IdentifyStopHandler(::Identify *); - static void TriggerIdentifyEffectHandler(::Identify * identify); - -private: - friend AppTask & GetAppTask(void); - - int Init(); - - // should this be done by BoltLock Manager? I don't want to unravel this spaghetti quite yet - static void ActionInitiated(LockManager::Action_t aAction); - static void ActionCompleted(LockManager::Action_t aAction); - - void DispatchEvent(AppEvent * event); - - static void ButtonLeftEventHandler(Button_Handle handle, Button_EventMask events); - static void ButtonRightEventHandler(Button_Handle handle, Button_EventMask events); - static void TimerEventHandler(void * p_context); - - enum Function_t - { - kFunction_NoneSelected = 0, - kFunction_SoftwareUpdate = 0, - kFunction_FactoryReset, - - kFunction_Invalid - } Function; - - Function_t mFunction; - bool mFunctionTimerActive; - bool mSyncClusterToButtonAction; - - static AppTask sAppTask; - -#ifdef CC13XX_26XX_FACTORY_DATA - chip::DeviceLayer::FactoryDataProvider mFactoryDataProvider; -#endif -}; - -inline AppTask & GetAppTask(void) -{ - return AppTask::sAppTask; -} diff --git a/examples/lock-app/cc13x2x7_26x2x7/src/LockManager.cpp b/examples/lock-app/cc13x2x7_26x2x7/src/LockManager.cpp deleted file mode 100644 index babc79cfc5b5f7..00000000000000 --- a/examples/lock-app/cc13x2x7_26x2x7/src/LockManager.cpp +++ /dev/null @@ -1,707 +0,0 @@ -/* - * - * Copyright (c) 2020 Project CHIP Authors - * Copyright (c) 2019 Google LLC. - * All rights reserved. - * - * 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. - */ - -#include "LockManager.h" - -#include "AppConfig.h" -#include "AppTask.h" -#include "platform/KeyValueStoreManager.h" -#include -#include -#include -#include - -LockManager LockManager::sLock; - -TimerHandle_t sLockTimer; - -using namespace CC13X2_26X2DoorLock::LockInitParams; -using namespace chip::DeviceLayer::PersistedStorage; - -// persisted storage keys -const char LockUser[] = "a/lu"; -const char Credential[] = "a/c"; -const char LockUserName[] = "a/lun"; -const char CredentialData[] = "a/cd"; -const char UserCredentials[] = "a/uc"; -const char WeekDaySchedules[] = "a/wds"; -const char YearDaySchedules[] = "a/yds"; -const char HolidaySchedules[] = "a/hs"; - -CHIP_ERROR LockManager::Init(chip::app::DataModel::Nullable state, LockParam lockParam) -{ - - LockParams = lockParam; - - if (LockParams.numberOfUsers > kMaxUsers) - { - PLAT_LOG("Max number of users is greater than %d, the maximum amount of users currently supported on this platform", - kMaxUsers); - return APP_ERROR_ALLOCATION_FAILED; - } - - if (LockParams.numberOfCredentialsPerUser > kMaxCredentialsPerUser) - { - PLAT_LOG("Max number of credentials per user is greater than %d, the maximum amount of users currently supported on this " - "platform", - kMaxCredentialsPerUser); - return APP_ERROR_ALLOCATION_FAILED; - } - - if (LockParams.numberOfWeekdaySchedulesPerUser > kMaxWeekdaySchedulesPerUser) - { - PLAT_LOG("Max number of schedules is greater than %d, the maximum amount of schedules currently supported on this platform", - kMaxWeekdaySchedulesPerUser); - return APP_ERROR_ALLOCATION_FAILED; - } - - if (LockParams.numberOfYeardaySchedulesPerUser > kMaxYeardaySchedulesPerUser) - { - PLAT_LOG("Max number of schedules is greater than %d, the maximum amount of schedules currently supported on this platform", - kMaxYeardaySchedulesPerUser); - return APP_ERROR_ALLOCATION_FAILED; - } - - if (LockParams.numberOfHolidaySchedules > kMaxHolidaySchedules) - { - PLAT_LOG("Max number of schedules is greater than %d, the maximum amount of schedules currently supported on this platform", - kMaxHolidaySchedules); - return APP_ERROR_ALLOCATION_FAILED; - } - - // Create FreeRTOS sw timer for lock timer. - sLockTimer = xTimerCreate("lockTmr", // Just a text name, not used by the RTOS kernel - 1, // == default timer period (mS) - false, // no timer reload (==one-shot) - (void *) this, // init timer id = lock obj context - TimerEventHandler // timer callback handler - ); - - if (sLockTimer == NULL) - { - PLAT_LOG("sLockTimer timer create failed"); - return APP_ERROR_CREATE_TIMER_FAILED; - } - - if (state.Value() == DlLockState::kUnlocked) - { - mState = kState_UnlockCompleted; - } - else - { - mState = kState_LockCompleted; - } - - return CHIP_NO_ERROR; -} - -bool LockManager::IsValidUserIndex(uint16_t userIndex) -{ - return (userIndex < kMaxUsers); -} - -bool LockManager::IsValidCredentialIndex(uint16_t credentialIndex, CredentialTypeEnum type) -{ - if (CredentialTypeEnum::kProgrammingPIN == type) - { - return (0 == credentialIndex); // 0 is required index for Programming PIN - } - return (credentialIndex < kMaxCredentialsPerUser); -} - -bool LockManager::IsValidWeekdayScheduleIndex(uint8_t scheduleIndex) -{ - return (scheduleIndex < kMaxWeekdaySchedulesPerUser); -} - -bool LockManager::IsValidYeardayScheduleIndex(uint8_t scheduleIndex) -{ - return (scheduleIndex < kMaxYeardaySchedulesPerUser); -} - -bool LockManager::IsValidHolidayScheduleIndex(uint8_t scheduleIndex) -{ - return (scheduleIndex < kMaxHolidaySchedules); -} - -bool LockManager::ReadConfigValues() -{ - size_t outLen; - KeyValueStoreMgr().Get(LockUser, reinterpret_cast(&mLockUsers), - sizeof(EmberAfPluginDoorLockUserInfo) * ArraySize(mLockUsers), &outLen); - - KeyValueStoreMgr().Get(Credential, reinterpret_cast(&mLockCredentials), - sizeof(EmberAfPluginDoorLockCredentialInfo) * ArraySize(mLockCredentials), &outLen); - - KeyValueStoreMgr().Get(LockUserName, reinterpret_cast(mUserNames), sizeof(mUserNames), &outLen); - - KeyValueStoreMgr().Get(CredentialData, reinterpret_cast(mCredentialData), sizeof(mCredentialData), &outLen); - - KeyValueStoreMgr().Get(UserCredentials, reinterpret_cast(mCredentials), - sizeof(CredentialStruct) * LockParams.numberOfUsers * LockParams.numberOfCredentialsPerUser, &outLen); - - KeyValueStoreMgr().Get(WeekDaySchedules, reinterpret_cast(mWeekdaySchedule), - sizeof(EmberAfPluginDoorLockWeekDaySchedule) * LockParams.numberOfWeekdaySchedulesPerUser * - LockParams.numberOfUsers, - &outLen); - - KeyValueStoreMgr().Get(YearDaySchedules, reinterpret_cast(mYeardaySchedule), - sizeof(EmberAfPluginDoorLockYearDaySchedule) * LockParams.numberOfYeardaySchedulesPerUser * - LockParams.numberOfUsers, - &outLen); - - KeyValueStoreMgr().Get(HolidaySchedules, reinterpret_cast(&(mHolidaySchedule)), - sizeof(EmberAfPluginDoorLockHolidaySchedule) * LockParams.numberOfHolidaySchedules, &outLen); - - return true; -} - -void LockManager::SetCallbacks(Callback_fn_initiated aActionInitiated_CB, Callback_fn_completed aActionCompleted_CB) -{ - mActionInitiated_CB = aActionInitiated_CB; - mActionCompleted_CB = aActionCompleted_CB; -} - -bool LockManager::InitiateAction(Action_t aAction) -{ - bool action_initiated = false; - State_t new_state; - - // Initiate Turn Lock/Unlock Action only when the previous one is complete. - if (mState == kState_LockCompleted && aAction == UNLOCK_ACTION) - { - action_initiated = true; - - new_state = kState_UnlockInitiated; - } - else if (mState == kState_UnlockCompleted && aAction == LOCK_ACTION) - { - action_initiated = true; - - new_state = kState_LockInitiated; - } - - if (action_initiated) - { - - StartTimer(ACTUATOR_MOVEMENT_PERIOD_MS); - - // Since the timer started successfully, update the state and trigger callback - mState = new_state; - - if (mActionInitiated_CB) - { - mActionInitiated_CB(aAction); - } - } - - return action_initiated; -} - -void LockManager::StartTimer(uint32_t aTimeoutMs) -{ - if (xTimerIsTimerActive(sLockTimer)) - { - PLAT_LOG("app timer already started!"); - CancelTimer(); - } - - // timer is not active, change its period to required value (== restart). - // FreeRTOS- Block for a maximum of 100 ticks if the change period command - // cannot immediately be sent to the timer command queue. - if (xTimerChangePeriod(sLockTimer, pdMS_TO_TICKS(aTimeoutMs), 100) != pdPASS) - { - PLAT_LOG("sLockTimer timer start() failed"); - } -} - -void LockManager::CancelTimer(void) -{ - if (xTimerStop(sLockTimer, 0) == pdFAIL) - { - PLAT_LOG("sLockTimer stop() failed"); - } -} - -void LockManager::TimerEventHandler(TimerHandle_t xTimer) -{ - // Get lock obj context from timer id. - LockManager * lock = static_cast(pvTimerGetTimerID(xTimer)); - - // The timer event handler will be called in the context of the timer task - // once sLockTimer expires. Post an event to apptask queue with the actual handler - // so that the event can be handled in the context of the apptask. - AppEvent event; - event.Type = AppEvent::kEventType_AppEvent; - event.BoltLockEvent.Context = lock; - event.Handler = ActuatorMovementTimerEventHandler; - GetAppTask().PostEvent(&event); -} - -void LockManager::ActuatorMovementTimerEventHandler(AppEvent * aEvent) -{ - Action_t actionCompleted = INVALID_ACTION; - - LockManager * lock = static_cast(aEvent->BoltLockEvent.Context); - - if (lock->mState == kState_LockInitiated) - { - lock->mState = kState_LockCompleted; - actionCompleted = LOCK_ACTION; - DoorLockServer::Instance().SetLockState(1, DlLockState::kLocked); - } - else if (lock->mState == kState_UnlockInitiated) - { - lock->mState = kState_UnlockCompleted; - actionCompleted = UNLOCK_ACTION; - DoorLockServer::Instance().SetLockState(1, DlLockState::kUnlocked); - } - - if (actionCompleted != INVALID_ACTION) - { - if (lock->mActionCompleted_CB) - { - lock->mActionCompleted_CB(actionCompleted); - } - } -} - -bool LockManager::Lock(chip::EndpointId endpointId, const Optional & pin, OperationErrorEnum & err) -{ - return checkPin(endpointId, DlLockState::kLocked, pin, err); -} - -bool LockManager::Unlock(chip::EndpointId endpointId, const Optional & pin, OperationErrorEnum & err) -{ - return checkPin(endpointId, DlLockState::kUnlocked, pin, err); -} - -bool LockManager::GetUser(chip::EndpointId endpointId, uint16_t userIndex, EmberAfPluginDoorLockUserInfo & user) -{ - VerifyOrReturnValue(userIndex > 0, false); // indices are one-indexed - - userIndex--; - - VerifyOrReturnValue(IsValidUserIndex(userIndex), false); - - ChipLogProgress(Zcl, "Door Lock App: LockManager::GetUser [endpoint=%d,userIndex=%hu]", endpointId, userIndex); - - const auto & userInDb = mLockUsers[userIndex]; - - user.userStatus = userInDb.userStatus; - if (UserStatusEnum::kAvailable == user.userStatus) - { - ChipLogDetail(Zcl, "Found unoccupied user [endpoint=%d]", endpointId); - return true; - } - - user.userName = chip::CharSpan(userInDb.userName.data(), userInDb.userName.size()); - user.credentials = chip::Span(mCredentials[userIndex], userInDb.credentials.size()); - user.userUniqueId = userInDb.userUniqueId; - user.userType = userInDb.userType; - user.credentialRule = userInDb.credentialRule; - // So far there's no way to actually create the credential outside Matter, so here we always set the creation/modification - // source to Matter - user.creationSource = DlAssetSource::kMatterIM; - user.createdBy = userInDb.createdBy; - user.modificationSource = DlAssetSource::kMatterIM; - user.lastModifiedBy = userInDb.lastModifiedBy; - - ChipLogDetail(Zcl, - "Found occupied user " - "[endpoint=%d,name=\"%.*s\",credentialsCount=%u,uniqueId=%lx,type=%u,credentialRule=%u," - "createdBy=%d,lastModifiedBy=%d]", - endpointId, static_cast(user.userName.size()), user.userName.data(), user.credentials.size(), - user.userUniqueId, to_underlying(user.userType), to_underlying(user.credentialRule), user.createdBy, - user.lastModifiedBy); - - return true; -} - -bool LockManager::SetUser(chip::EndpointId endpointId, uint16_t userIndex, chip::FabricIndex creator, chip::FabricIndex modifier, - const chip::CharSpan & userName, uint32_t uniqueId, UserStatusEnum userStatus, UserTypeEnum usertype, - CredentialRuleEnum credentialRule, const CredentialStruct * credentials, size_t totalCredentials) -{ - ChipLogProgress(Zcl, - "Door Lock App: LockManager::SetUser " - "[endpoint=%d,userIndex=%d,creator=%d,modifier=%d,userName=%s,uniqueId=%ld " - "userStatus=%u,userType=%u,credentialRule=%u,credentials=%p,totalCredentials=%u]", - endpointId, userIndex, creator, modifier, userName.data(), uniqueId, to_underlying(userStatus), - to_underlying(usertype), to_underlying(credentialRule), credentials, totalCredentials); - - VerifyOrReturnValue(userIndex > 0, false); // indices are one-indexed - - userIndex--; - - VerifyOrReturnValue(IsValidUserIndex(userIndex), false); - - auto & userInStorage = mLockUsers[userIndex]; - - if (userName.size() > DOOR_LOCK_MAX_USER_NAME_SIZE) - { - ChipLogError(Zcl, "Cannot set user - user name is too long [endpoint=%d,index=%d]", endpointId, userIndex); - return false; - } - - if (totalCredentials > LockParams.numberOfCredentialsPerUser) - { - ChipLogError(Zcl, "Cannot set user - total number of credentials is too big [endpoint=%d,index=%d,totalCredentials=%u]", - endpointId, userIndex, totalCredentials); - return false; - } - - chip::Platform::CopyString(mUserNames[userIndex], userName); - userInStorage.userName = chip::CharSpan(mUserNames[userIndex], userName.size()); - userInStorage.userUniqueId = uniqueId; - userInStorage.userStatus = userStatus; - userInStorage.userType = usertype; - userInStorage.credentialRule = credentialRule; - userInStorage.lastModifiedBy = modifier; - userInStorage.createdBy = creator; - - for (size_t i = 0; i < totalCredentials; ++i) - { - mCredentials[userIndex][i] = credentials[i]; - mCredentials[userIndex][i].credentialType = CredentialTypeEnum::kPin; - mCredentials[userIndex][i].credentialIndex = i + 1; - } - - userInStorage.credentials = chip::Span(mCredentials[userIndex], totalCredentials); - - // Save user information in NVM flash - KeyValueStoreMgr().Put(LockUser, reinterpret_cast(&mLockUsers), - sizeof(EmberAfPluginDoorLockUserInfo) * LockParams.numberOfUsers); - - KeyValueStoreMgr().Put(UserCredentials, reinterpret_cast(mCredentials), - sizeof(CredentialStruct) * LockParams.numberOfUsers * LockParams.numberOfCredentialsPerUser); - - KeyValueStoreMgr().Put(LockUserName, reinterpret_cast(mUserNames), sizeof(mUserNames)); - - ChipLogProgress(Zcl, "Successfully set the user [mEndpointId=%d,index=%d]", endpointId, userIndex); - - return true; -} - -bool LockManager::GetCredential(chip::EndpointId endpointId, uint16_t credentialIndex, CredentialTypeEnum credentialType, - EmberAfPluginDoorLockCredentialInfo & credential) -{ - - if (CredentialTypeEnum::kProgrammingPIN == credentialType) - { - VerifyOrReturnValue(IsValidCredentialIndex(credentialIndex, credentialType), - false); // programming pin index is only index allowed to contain 0 - } - else - { - VerifyOrReturnValue(IsValidCredentialIndex(--credentialIndex, credentialType), false); // otherwise, indices are one-indexed - } - - ChipLogProgress(Zcl, "Lock App: LockManager::GetCredential [credentialType=%u], credentialIndex=%d", - to_underlying(credentialType), credentialIndex); - - const auto & credentialInStorage = mLockCredentials[credentialIndex]; - - credential.status = credentialInStorage.status; - ChipLogDetail(Zcl, "CredentialStatus: %d, CredentialIndex: %d ", (int) credential.status, credentialIndex); - - if (DlCredentialStatus::kAvailable == credential.status) - { - ChipLogDetail(Zcl, "Found unoccupied credential "); - return true; - } - credential.credentialType = credentialInStorage.credentialType; - credential.credentialData = credentialInStorage.credentialData; - credential.createdBy = credentialInStorage.createdBy; - credential.lastModifiedBy = credentialInStorage.lastModifiedBy; - // So far there's no way to actually create the credential outside Matter, so here we always set the creation/modification - // source to Matter - credential.creationSource = DlAssetSource::kMatterIM; - credential.modificationSource = DlAssetSource::kMatterIM; - - ChipLogDetail(Zcl, "Found occupied credential [type=%u,dataSize=%u]", to_underlying(credential.credentialType), - credential.credentialData.size()); - - return true; -} - -bool LockManager::SetCredential(chip::EndpointId endpointId, uint16_t credentialIndex, chip::FabricIndex creator, - chip::FabricIndex modifier, DlCredentialStatus credentialStatus, CredentialTypeEnum credentialType, - const chip::ByteSpan & credentialData) -{ - - if (CredentialTypeEnum::kProgrammingPIN == credentialType) - { - VerifyOrReturnValue(IsValidCredentialIndex(credentialIndex, credentialType), - false); // programming pin index is only index allowed to contain 0 - } - else - { - VerifyOrReturnValue(IsValidCredentialIndex(--credentialIndex, credentialType), false); // otherwise, indices are one-indexed - } - - ChipLogProgress(Zcl, - "Door Lock App: LockManager::SetCredential " - "[credentialStatus=%u,credentialType=%u,credentialDataSize=%u,creator=%d,modifier=%d]", - to_underlying(credentialStatus), to_underlying(credentialType), credentialData.size(), creator, modifier); - - auto & credentialInStorage = mLockCredentials[credentialIndex]; - - credentialInStorage.status = credentialStatus; - credentialInStorage.credentialType = credentialType; - credentialInStorage.createdBy = creator; - credentialInStorage.lastModifiedBy = modifier; - - memcpy(mCredentialData[credentialIndex], credentialData.data(), credentialData.size()); - credentialInStorage.credentialData = chip::ByteSpan{ mCredentialData[credentialIndex], credentialData.size() }; - - // Save credential information in NVM flash - KeyValueStoreMgr().Put(Credential, reinterpret_cast(&mLockCredentials), - sizeof(EmberAfPluginDoorLockCredentialInfo) * LockParams.numberOfCredentialsPerUser); - - KeyValueStoreMgr().Put(CredentialData, reinterpret_cast(&mCredentialData), sizeof(mCredentialData)); - - ChipLogProgress(Zcl, "Successfully set the credential [credentialType=%u]", to_underlying(credentialType)); - - return true; -} - -DlStatus LockManager::GetWeekdaySchedule(chip::EndpointId endpointId, uint8_t weekdayIndex, uint16_t userIndex, - EmberAfPluginDoorLockWeekDaySchedule & schedule) -{ - - VerifyOrReturnValue(weekdayIndex > 0, DlStatus::kFailure); // indices are one-indexed - VerifyOrReturnValue(userIndex > 0, DlStatus::kFailure); // indices are one-indexed - - weekdayIndex--; - userIndex--; - - VerifyOrReturnValue(IsValidWeekdayScheduleIndex(weekdayIndex), DlStatus::kFailure); - VerifyOrReturnValue(IsValidUserIndex(userIndex), DlStatus::kFailure); - - const auto & scheduleInStorage = mWeekdaySchedule[userIndex][weekdayIndex]; - if (DlScheduleStatus::kAvailable == scheduleInStorage.status) - { - return DlStatus::kNotFound; - } - - schedule = scheduleInStorage.schedule; - - return DlStatus::kSuccess; -} - -DlStatus LockManager::SetWeekdaySchedule(chip::EndpointId endpointId, uint8_t weekdayIndex, uint16_t userIndex, - DlScheduleStatus status, DaysMaskMap daysMask, uint8_t startHour, uint8_t startMinute, - uint8_t endHour, uint8_t endMinute) -{ - - VerifyOrReturnValue(weekdayIndex > 0, DlStatus::kFailure); // indices are one-indexed - VerifyOrReturnValue(userIndex > 0, DlStatus::kFailure); // indices are one-indexed - - weekdayIndex--; - userIndex--; - - VerifyOrReturnValue(IsValidWeekdayScheduleIndex(weekdayIndex), DlStatus::kFailure); - VerifyOrReturnValue(IsValidUserIndex(userIndex), DlStatus::kFailure); - - auto & scheduleInStorage = mWeekdaySchedule[userIndex][weekdayIndex]; - - scheduleInStorage.schedule.daysMask = daysMask; - scheduleInStorage.schedule.startHour = startHour; - scheduleInStorage.schedule.startMinute = startMinute; - scheduleInStorage.schedule.endHour = endHour; - scheduleInStorage.schedule.endMinute = endMinute; - scheduleInStorage.status = status; - - // Save schedule information in NVM flash - KeyValueStoreMgr().Put(WeekDaySchedules, reinterpret_cast(mWeekdaySchedule), - sizeof(EmberAfPluginDoorLockWeekDaySchedule) * LockParams.numberOfWeekdaySchedulesPerUser * - LockParams.numberOfUsers); - - return DlStatus::kSuccess; -} - -DlStatus LockManager::GetYeardaySchedule(chip::EndpointId endpointId, uint8_t yearDayIndex, uint16_t userIndex, - EmberAfPluginDoorLockYearDaySchedule & schedule) -{ - VerifyOrReturnValue(yearDayIndex > 0, DlStatus::kFailure); // indices are one-indexed - VerifyOrReturnValue(userIndex > 0, DlStatus::kFailure); // indices are one-indexed - - yearDayIndex--; - userIndex--; - - VerifyOrReturnValue(IsValidYeardayScheduleIndex(yearDayIndex), DlStatus::kFailure); - VerifyOrReturnValue(IsValidUserIndex(userIndex), DlStatus::kFailure); - - const auto & scheduleInStorage = mYeardaySchedule[userIndex][yearDayIndex]; - if (DlScheduleStatus::kAvailable == scheduleInStorage.status) - { - return DlStatus::kNotFound; - } - - schedule = scheduleInStorage.schedule; - - return DlStatus::kSuccess; -} - -DlStatus LockManager::SetYeardaySchedule(chip::EndpointId endpointId, uint8_t yearDayIndex, uint16_t userIndex, - DlScheduleStatus status, uint32_t localStartTime, uint32_t localEndTime) -{ - VerifyOrReturnValue(yearDayIndex > 0, DlStatus::kFailure); // indices are one-indexed - VerifyOrReturnValue(userIndex > 0, DlStatus::kFailure); // indices are one-indexed - - yearDayIndex--; - userIndex--; - - VerifyOrReturnValue(IsValidYeardayScheduleIndex(yearDayIndex), DlStatus::kFailure); - VerifyOrReturnValue(IsValidUserIndex(userIndex), DlStatus::kFailure); - - auto & scheduleInStorage = mYeardaySchedule[userIndex][yearDayIndex]; - - scheduleInStorage.schedule.localStartTime = localStartTime; - scheduleInStorage.schedule.localEndTime = localEndTime; - scheduleInStorage.status = status; - - // Save schedule information in NVM flash - KeyValueStoreMgr().Put(YearDaySchedules, reinterpret_cast(mYeardaySchedule), - sizeof(EmberAfPluginDoorLockYearDaySchedule) * LockParams.numberOfYeardaySchedulesPerUser * - LockParams.numberOfUsers); - - return DlStatus::kSuccess; -} - -DlStatus LockManager::GetHolidaySchedule(chip::EndpointId endpointId, uint8_t holidayIndex, - EmberAfPluginDoorLockHolidaySchedule & schedule) -{ - VerifyOrReturnValue(holidayIndex > 0, DlStatus::kFailure); // indices are one-indexed - - holidayIndex--; - - VerifyOrReturnValue(IsValidHolidayScheduleIndex(holidayIndex), DlStatus::kFailure); - - const auto & scheduleInStorage = mHolidaySchedule[holidayIndex]; - if (DlScheduleStatus::kAvailable == scheduleInStorage.status) - { - return DlStatus::kNotFound; - } - - schedule = scheduleInStorage.schedule; - - return DlStatus::kSuccess; -} - -DlStatus LockManager::SetHolidaySchedule(chip::EndpointId endpointId, uint8_t holidayIndex, DlScheduleStatus status, - uint32_t localStartTime, uint32_t localEndTime, OperatingModeEnum operatingMode) -{ - VerifyOrReturnValue(holidayIndex > 0, DlStatus::kFailure); // indices are one-indexed - - holidayIndex--; - - VerifyOrReturnValue(IsValidHolidayScheduleIndex(holidayIndex), DlStatus::kFailure); - - auto & scheduleInStorage = mHolidaySchedule[holidayIndex]; - - scheduleInStorage.schedule.localStartTime = localStartTime; - scheduleInStorage.schedule.localEndTime = localEndTime; - scheduleInStorage.schedule.operatingMode = operatingMode; - scheduleInStorage.status = status; - - // Save schedule information in NVM flash - KeyValueStoreMgr().Put(HolidaySchedules, reinterpret_cast(&(mHolidaySchedule)), - sizeof(EmberAfPluginDoorLockHolidaySchedule) * LockParams.numberOfHolidaySchedules); - - return DlStatus::kSuccess; -} - -const char * LockManager::lockStateToString(DlLockState lockState) const -{ - switch (lockState) - { - case DlLockState::kNotFullyLocked: - return "Not Fully Locked"; - case DlLockState::kLocked: - return "Locked"; - case DlLockState::kUnlocked: - return "Unlocked"; - case DlLockState::kUnlatched: - return "Unlatched"; - case DlLockState::kUnknownEnumValue: - break; - default: - break; - } - - return "Unknown"; -} - -bool LockManager::checkPin(chip::EndpointId endpointId, DlLockState lockState, const Optional & pin, - OperationErrorEnum & err) -{ - // Assume pin is required until told otherwise - bool requirePin = true; - chip::app::Clusters::DoorLock::Attributes::RequirePINforRemoteOperation::Get(endpointId, &requirePin); - - // If a pin code is not given - if (!pin.HasValue()) - { - ChipLogDetail(Zcl, "Door Lock App: PIN code is not specified [endpointId=%d]", endpointId); - - // If a pin code is not required - if (!requirePin) - { - ChipLogDetail(Zcl, "Door Lock App: setting door lock state to \"%s\" [endpointId=%d]", lockStateToString(lockState), - endpointId); - - return true; - } - - ChipLogError(Zcl, "Door Lock App: PIN code is not specified, but it is required [endpointId=%d]", endpointId); - - err = OperationErrorEnum::kInvalidCredential; - DoorLockServer::Instance().HandleWrongCodeEntry(endpointId); - return false; - } - - // Check the PIN code - for (uint8_t i = 0; i < kMaxCredentials; i++) - { - if (mLockCredentials[i].credentialType != CredentialTypeEnum::kPin || - mLockCredentials[i].status == DlCredentialStatus::kAvailable) - { - continue; - } - - if (mLockCredentials[i].credentialData.data_equal(pin.Value())) - { - ChipLogDetail(Zcl, - "Lock App: specified PIN code was found in the database, setting lock state to \"%s\" [endpointId=%d]", - lockStateToString(lockState), endpointId); - - return true; - } - } - - ChipLogDetail(Zcl, - "Door Lock App: specified PIN code was not found in the database, ignoring command to set lock state to \"%s\" " - "[endpointId=%d]", - lockStateToString(lockState), endpointId); - - err = OperationErrorEnum::kInvalidCredential; - DoorLockServer::Instance().HandleWrongCodeEntry(endpointId); - return false; -} diff --git a/examples/lock-app/cc13x2x7_26x2x7/src/LockManager.h b/examples/lock-app/cc13x2x7_26x2x7/src/LockManager.h deleted file mode 100644 index 74129260bd9172..00000000000000 --- a/examples/lock-app/cc13x2x7_26x2x7/src/LockManager.h +++ /dev/null @@ -1,221 +0,0 @@ -/* - * - * Copyright (c) 2019 Google LLC. - * All rights reserved. - * - * 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. - */ - -#pragma once - -#include - -#include -#include - -#include "AppEvent.h" - -#include "FreeRTOS.h" -#include "timers.h" // provides FreeRTOS timer support - -#include - -struct WeekDaysScheduleInfo -{ - DlScheduleStatus status; - EmberAfPluginDoorLockWeekDaySchedule schedule; -}; - -struct YearDayScheduleInfo -{ - DlScheduleStatus status; - EmberAfPluginDoorLockYearDaySchedule schedule; -}; - -struct HolidayScheduleInfo -{ - DlScheduleStatus status; - EmberAfPluginDoorLockHolidaySchedule schedule; -}; - -namespace CC13X2_26X2DoorLock { -namespace ResourceRanges { -// Used to size arrays -static constexpr uint16_t kMaxUsers = 10; -static constexpr uint8_t kMaxCredentialsPerUser = 10; -static constexpr uint8_t kMaxWeekdaySchedulesPerUser = 10; -static constexpr uint8_t kMaxYeardaySchedulesPerUser = 10; -static constexpr uint8_t kMaxHolidaySchedules = 10; -static constexpr uint8_t kMaxCredentialSize = 8; - -// Indices received for user/credential/schedules are 1-indexed -static constexpr uint8_t kStartIndexValue = 1; - -static constexpr uint8_t kMaxCredentials = kMaxUsers * kMaxCredentialsPerUser; -} // namespace ResourceRanges - -namespace LockInitParams { - -struct LockParam -{ - // Read from zap attributes - uint16_t numberOfUsers = 0; - uint8_t numberOfCredentialsPerUser = 0; - uint8_t numberOfWeekdaySchedulesPerUser = 0; - uint8_t numberOfYeardaySchedulesPerUser = 0; - uint8_t numberOfHolidaySchedules = 0; -}; - -class ParamBuilder -{ -public: - ParamBuilder & SetNumberOfUsers(uint16_t numberOfUsers) - { - lockParam_.numberOfUsers = numberOfUsers; - return *this; - } - ParamBuilder & SetNumberOfCredentialsPerUser(uint8_t numberOfCredentialsPerUser) - { - lockParam_.numberOfCredentialsPerUser = numberOfCredentialsPerUser; - return *this; - } - ParamBuilder & SetNumberOfWeekdaySchedulesPerUser(uint8_t numberOfWeekdaySchedulesPerUser) - { - lockParam_.numberOfWeekdaySchedulesPerUser = numberOfWeekdaySchedulesPerUser; - return *this; - } - ParamBuilder & SetNumberOfYeardaySchedulesPerUser(uint8_t numberOfYeardaySchedulesPerUser) - { - lockParam_.numberOfYeardaySchedulesPerUser = numberOfYeardaySchedulesPerUser; - return *this; - } - ParamBuilder & SetNumberOfHolidaySchedules(uint8_t numberOfHolidaySchedules) - { - lockParam_.numberOfHolidaySchedules = numberOfHolidaySchedules; - return *this; - } - LockParam GetLockParam() { return lockParam_; } - -private: - LockParam lockParam_; -}; - -} // namespace LockInitParams -} // namespace CC13X2_26X2DoorLock - -using namespace ::chip; -using namespace CC13X2_26X2DoorLock::ResourceRanges; - -class LockManager -{ -public: - enum Action_t - { - LOCK_ACTION = 0, - UNLOCK_ACTION, - - INVALID_ACTION - } Action; - - enum State_t - { - kState_LockInitiated = 0, - kState_LockCompleted, - kState_UnlockInitiated, - kState_UnlockCompleted, - } State; - - CHIP_ERROR Init(chip::app::DataModel::Nullable state, - CC13X2_26X2DoorLock::LockInitParams::LockParam lockParam); - bool InitiateAction(Action_t aAction); - - typedef void (*Callback_fn_initiated)(Action_t); - typedef void (*Callback_fn_completed)(Action_t); - void SetCallbacks(Callback_fn_initiated aActionInitiated_CB, Callback_fn_completed aActionCompleted_CB); - - bool Lock(chip::EndpointId endpointId, const Optional & pin, OperationErrorEnum & err); - bool Unlock(chip::EndpointId endpointId, const Optional & pin, OperationErrorEnum & err); - - bool GetUser(chip::EndpointId endpointId, uint16_t userIndex, EmberAfPluginDoorLockUserInfo & user); - bool SetUser(chip::EndpointId endpointId, uint16_t userIndex, chip::FabricIndex creator, chip::FabricIndex modifier, - const chip::CharSpan & userName, uint32_t uniqueId, UserStatusEnum userStatus, UserTypeEnum usertype, - CredentialRuleEnum credentialRule, const CredentialStruct * credentials, size_t totalCredentials); - - bool GetCredential(chip::EndpointId endpointId, uint16_t credentialIndex, CredentialTypeEnum credentialType, - EmberAfPluginDoorLockCredentialInfo & credential); - - bool SetCredential(chip::EndpointId endpointId, uint16_t credentialIndex, chip::FabricIndex creator, chip::FabricIndex modifier, - DlCredentialStatus credentialStatus, CredentialTypeEnum credentialType, - const chip::ByteSpan & credentialData); - - DlStatus GetWeekdaySchedule(chip::EndpointId endpointId, uint8_t weekdayIndex, uint16_t userIndex, - EmberAfPluginDoorLockWeekDaySchedule & schedule); - - DlStatus SetWeekdaySchedule(chip::EndpointId endpointId, uint8_t weekdayIndex, uint16_t userIndex, DlScheduleStatus status, - DaysMaskMap daysMask, uint8_t startHour, uint8_t startMinute, uint8_t endHour, uint8_t endMinute); - - DlStatus GetYeardaySchedule(chip::EndpointId endpointId, uint8_t yearDayIndex, uint16_t userIndex, - EmberAfPluginDoorLockYearDaySchedule & schedule); - - DlStatus SetYeardaySchedule(chip::EndpointId endpointId, uint8_t yearDayIndex, uint16_t userIndex, DlScheduleStatus status, - uint32_t localStartTime, uint32_t localEndTime); - - DlStatus GetHolidaySchedule(chip::EndpointId endpointId, uint8_t holidayIndex, EmberAfPluginDoorLockHolidaySchedule & schedule); - - DlStatus SetHolidaySchedule(chip::EndpointId endpointId, uint8_t holidayIndex, DlScheduleStatus status, uint32_t localStartTime, - uint32_t localEndTime, OperatingModeEnum operatingMode); - - bool IsValidUserIndex(uint16_t userIndex); - bool IsValidCredentialIndex(uint16_t credentialIndex, CredentialTypeEnum type); - bool IsValidWeekdayScheduleIndex(uint8_t scheduleIndex); - bool IsValidYeardayScheduleIndex(uint8_t scheduleIndex); - bool IsValidHolidayScheduleIndex(uint8_t scheduleIndex); - - bool checkPin(chip::EndpointId endpointId, DlLockState lockState, const Optional & pin, - OperationErrorEnum & err); - const char * lockStateToString(DlLockState lockState) const; - - bool ReadConfigValues(); - -private: - friend LockManager & LockMgr(); - State_t mState; - - Callback_fn_initiated mActionInitiated_CB; - Callback_fn_completed mActionCompleted_CB; - - void CancelTimer(void); - void StartTimer(uint32_t aTimeoutMs); - - static void TimerEventHandler(TimerHandle_t xTimer); - static void AutoLockTimerEventHandler(AppEvent * aEvent); - static void ActuatorMovementTimerEventHandler(AppEvent * aEvent); - - EmberAfPluginDoorLockUserInfo mLockUsers[kMaxUsers]; - EmberAfPluginDoorLockCredentialInfo mLockCredentials[kMaxCredentials]; - WeekDaysScheduleInfo mWeekdaySchedule[kMaxUsers][kMaxWeekdaySchedulesPerUser]; - YearDayScheduleInfo mYeardaySchedule[kMaxUsers][kMaxYeardaySchedulesPerUser]; - HolidayScheduleInfo mHolidaySchedule[kMaxHolidaySchedules]; - - char mUserNames[ArraySize(mLockUsers)][DOOR_LOCK_MAX_USER_NAME_SIZE]; - uint8_t mCredentialData[kMaxCredentials][kMaxCredentialSize]; - CredentialStruct mCredentials[kMaxUsers][kMaxCredentialsPerUser]; - - static LockManager sLock; - CC13X2_26X2DoorLock::LockInitParams::LockParam LockParams; -}; - -inline LockManager & LockMgr() -{ - return LockManager::sLock; -} diff --git a/examples/lock-app/cc13x2x7_26x2x7/src/ZclCallbacks.cpp b/examples/lock-app/cc13x2x7_26x2x7/src/ZclCallbacks.cpp deleted file mode 100644 index 1777326dc4d017..00000000000000 --- a/examples/lock-app/cc13x2x7_26x2x7/src/ZclCallbacks.cpp +++ /dev/null @@ -1,154 +0,0 @@ -/* - * - * Copyright (c) 2020 Project CHIP Authors - * - * 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. - */ - -/** - * @file - * This file implements the handler for data model messages. - */ - -#include "AppConfig.h" -#include "LockManager.h" -#include - -#include -#include -#include -#include -#include -#include - -using namespace ::chip::app::Clusters; -using namespace ::chip::DeviceLayer::Internal; -using ::chip::app::DataModel::Nullable; - -void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & attributePath, uint8_t type, uint16_t size, - uint8_t * value) -{ - ClusterId clusterId = attributePath.mClusterId; - AttributeId attributeId = attributePath.mAttributeId; - ChipLogProgress(Zcl, "Cluster callback: " ChipLogFormatMEI, ChipLogValueMEI(clusterId)); - - if (clusterId == DoorLock::Id && attributeId == DoorLock::Attributes::LockState::Id) - { - ChipLogProgress(Zcl, "Door lock cluster: " ChipLogFormatMEI, ChipLogValueMEI(clusterId)); - } -} - -/** @brief DoorLock Cluster Init - * - * This function is called when a specific cluster is initialized. It gives the - * application an opportunity to take care of cluster initialization procedures. - * It is called exactly once for each endpoint where cluster is present. - * - * @param endpoint Ver.: always - * - */ -void emberAfDoorLockClusterInitCallback(EndpointId endpoint) {} - -bool emberAfPluginDoorLockOnDoorLockCommand(chip::EndpointId endpointId, const Nullable & fabricIdx, - const Nullable & nodeId, const Optional & pinCode, - OperationErrorEnum & err) -{ - ChipLogProgress(Zcl, "Door Lock App: Lock Command endpoint=%d", endpointId); - bool status = LockMgr().Lock(endpointId, pinCode, err); - if (status == true) - { - LockMgr().InitiateAction(LockManager::LOCK_ACTION); - } - return status; -} - -bool emberAfPluginDoorLockOnDoorUnlockCommand(chip::EndpointId endpointId, const Nullable & fabricIdx, - const Nullable & nodeId, const Optional & pinCode, - OperationErrorEnum & err) -{ - ChipLogProgress(Zcl, "Door Lock App: Unlock Command endpoint=%d", endpointId); - bool status = LockMgr().Unlock(endpointId, pinCode, err); - if (status == true) - { - LockMgr().InitiateAction(LockManager::UNLOCK_ACTION); - } - - return status; -} - -bool emberAfPluginDoorLockGetCredential(chip::EndpointId endpointId, uint16_t credentialIndex, CredentialTypeEnum credentialType, - EmberAfPluginDoorLockCredentialInfo & credential) -{ - return LockMgr().GetCredential(endpointId, credentialIndex, credentialType, credential); -} - -bool emberAfPluginDoorLockSetCredential(chip::EndpointId endpointId, uint16_t credentialIndex, chip::FabricIndex creator, - chip::FabricIndex modifier, DlCredentialStatus credentialStatus, - CredentialTypeEnum credentialType, const chip::ByteSpan & credentialData) -{ - return LockMgr().SetCredential(endpointId, credentialIndex, creator, modifier, credentialStatus, credentialType, - credentialData); -} - -bool emberAfPluginDoorLockGetUser(chip::EndpointId endpointId, uint16_t userIndex, EmberAfPluginDoorLockUserInfo & user) -{ - return LockMgr().GetUser(endpointId, userIndex, user); -} - -bool emberAfPluginDoorLockSetUser(chip::EndpointId endpointId, uint16_t userIndex, chip::FabricIndex creator, - chip::FabricIndex modifier, const chip::CharSpan & userName, uint32_t uniqueId, - UserStatusEnum userStatus, UserTypeEnum usertype, CredentialRuleEnum credentialRule, - const CredentialStruct * credentials, size_t totalCredentials) -{ - - return LockMgr().SetUser(endpointId, userIndex, creator, modifier, userName, uniqueId, userStatus, usertype, credentialRule, - credentials, totalCredentials); -} - -DlStatus emberAfPluginDoorLockGetSchedule(chip::EndpointId endpointId, uint8_t weekdayIndex, uint16_t userIndex, - EmberAfPluginDoorLockWeekDaySchedule & schedule) -{ - return LockMgr().GetWeekdaySchedule(endpointId, weekdayIndex, userIndex, schedule); -} - -DlStatus emberAfPluginDoorLockGetSchedule(chip::EndpointId endpointId, uint8_t yearDayIndex, uint16_t userIndex, - EmberAfPluginDoorLockYearDaySchedule & schedule) -{ - return LockMgr().GetYeardaySchedule(endpointId, yearDayIndex, userIndex, schedule); -} - -DlStatus emberAfPluginDoorLockGetSchedule(chip::EndpointId endpointId, uint8_t holidayIndex, - EmberAfPluginDoorLockHolidaySchedule & holidaySchedule) -{ - return LockMgr().GetHolidaySchedule(endpointId, holidayIndex, holidaySchedule); -} - -DlStatus emberAfPluginDoorLockSetSchedule(chip::EndpointId endpointId, uint8_t weekdayIndex, uint16_t userIndex, - DlScheduleStatus status, DaysMaskMap daysMask, uint8_t startHour, uint8_t startMinute, - uint8_t endHour, uint8_t endMinute) -{ - return LockMgr().SetWeekdaySchedule(endpointId, weekdayIndex, userIndex, status, daysMask, startHour, startMinute, endHour, - endMinute); -} - -DlStatus emberAfPluginDoorLockSetSchedule(chip::EndpointId endpointId, uint8_t yearDayIndex, uint16_t userIndex, - DlScheduleStatus status, uint32_t localStartTime, uint32_t localEndTime) -{ - return LockMgr().SetYeardaySchedule(endpointId, yearDayIndex, userIndex, status, localStartTime, localEndTime); -} - -DlStatus emberAfPluginDoorLockSetSchedule(chip::EndpointId endpointId, uint8_t holidayIndex, DlScheduleStatus status, - uint32_t localStartTime, uint32_t localEndTime, OperatingModeEnum operatingMode) -{ - return LockMgr().SetHolidaySchedule(endpointId, holidayIndex, status, localStartTime, localEndTime, operatingMode); -} diff --git a/examples/lock-app/cc13x2x7_26x2x7/src/main.cpp b/examples/lock-app/cc13x2x7_26x2x7/src/main.cpp deleted file mode 100644 index 4fdb88703acab6..00000000000000 --- a/examples/lock-app/cc13x2x7_26x2x7/src/main.cpp +++ /dev/null @@ -1,105 +0,0 @@ -/* - * - * Copyright (c) 2020 Project CHIP Authors - * Copyright (c) 2020 Texas Instruments Incorporated - * - * 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. - */ - -#include -#include - -#include - -#include "AppConfig.h" -#include "AppTask.h" - -#include - -/* Driver Header files */ -#include -#include -#include - -#include -#include -#include -#include - -#include -#define TOTAL_ICALL_HEAP_SIZE (0xc600) - -using namespace ::chip; -using namespace ::chip::Inet; -using namespace ::chip::DeviceLayer; - -__attribute__((section(".heap"))) uint8_t GlobalHeapZoneBuffer[TOTAL_ICALL_HEAP_SIZE]; -uint32_t heapSize = TOTAL_ICALL_HEAP_SIZE; - -// ================================================================================ -// FreeRTOS Callbacks -// ================================================================================ -extern "C" void vApplicationStackOverflowHook(void) -{ - while (1) - { - ; - } -} - -/* Wrapper functions for using the queue registry regardless of whether it is enabled or disabled */ -extern "C" void vQueueAddToRegistryWrapper(QueueHandle_t xQueue, const char * pcQueueName) -{ - /* This function is intentionally left empty as the Queue Registry is disabled */ -} - -extern "C" void vQueueUnregisterQueueWrapper(QueueHandle_t xQueue) -{ - /* This function is intentionally left empty as the Queue Registry is disabled */ -} - -// ================================================================================ -// Main Code -// ================================================================================ -int main(void) -{ - Board_init(); - bpool((void *) GlobalHeapZoneBuffer, TOTAL_ICALL_HEAP_SIZE); - - GPIO_init(); - - NVS_init(); - - ECDH_init(); - - ECDSA_init(); - - AESECB_init(); - - SHA2_init(); - - int ret = GetAppTask().StartAppTask(); - if (ret != 0) - { - // can't log until the kernel is started - // PLAT_LOG("GetAppTask().StartAppTask() failed"); - while (1) - ; - } - - vTaskStartScheduler(); - - // Should never get here. - while (1) - ; -} diff --git a/examples/lock-app/cc13x2x7_26x2x7/third_party/connectedhomeip b/examples/lock-app/cc13x2x7_26x2x7/third_party/connectedhomeip deleted file mode 120000 index c866b86874994d..00000000000000 --- a/examples/lock-app/cc13x2x7_26x2x7/third_party/connectedhomeip +++ /dev/null @@ -1 +0,0 @@ -../../../.. \ No newline at end of file diff --git a/examples/lock-app/cc13x4_26x4/README.md b/examples/lock-app/cc13x4_26x4/README.md index 535a414e588178..b8b43d6ec6a218 100644 --- a/examples/lock-app/cc13x4_26x4/README.md +++ b/examples/lock-app/cc13x4_26x4/README.md @@ -93,8 +93,6 @@ Ninja to build the executable. step. ``` - $ cd ~/connectedhomeip/examples/lock-app/cc13x2x7_26x2x7 - OR $ cd ~/connectedhomeip/examples/lock-app/cc13x4_26x4 $ gn gen out/debug --args="ti_sysconfig_root=\"$HOME/ti/sysconfig_1.18.1\"" $ ninja -C out/debug diff --git a/examples/lock-app/cc13x4_26x4/src/AppTask.cpp b/examples/lock-app/cc13x4_26x4/src/AppTask.cpp index 1b65334c47f886..ec6a1d048c0276 100644 --- a/examples/lock-app/cc13x4_26x4/src/AppTask.cpp +++ b/examples/lock-app/cc13x4_26x4/src/AppTask.cpp @@ -267,7 +267,7 @@ int AppTask::Init() Attributes::LockState::Get(endpointId, state); ret = LockMgr().Init(state, - CC13X2_26X2DoorLock::LockInitParams::ParamBuilder() + CC13X4_26X4DoorLock::LockInitParams::ParamBuilder() .SetNumberOfUsers(numberOfUsers) .SetNumberOfCredentialsPerUser(numberOfCredentialsPerUser) .SetNumberOfWeekdaySchedulesPerUser(numberOfWeekdaySchedulesPerUser) diff --git a/examples/lock-app/cc13x4_26x4/src/LockManager.cpp b/examples/lock-app/cc13x4_26x4/src/LockManager.cpp index 57cd1964dd92a1..5f4d6e2ff1c578 100644 --- a/examples/lock-app/cc13x4_26x4/src/LockManager.cpp +++ b/examples/lock-app/cc13x4_26x4/src/LockManager.cpp @@ -31,7 +31,7 @@ LockManager LockManager::sLock; TimerHandle_t sLockTimer; -using namespace CC13X2_26X2DoorLock::LockInitParams; +using namespace CC13X4_26X4DoorLock::LockInitParams; using namespace chip::DeviceLayer::PersistedStorage; // persisted storage keys diff --git a/examples/lock-app/cc13x4_26x4/src/LockManager.h b/examples/lock-app/cc13x4_26x4/src/LockManager.h index 74129260bd9172..13b30b2eccadb0 100644 --- a/examples/lock-app/cc13x4_26x4/src/LockManager.h +++ b/examples/lock-app/cc13x4_26x4/src/LockManager.h @@ -48,7 +48,7 @@ struct HolidayScheduleInfo EmberAfPluginDoorLockHolidaySchedule schedule; }; -namespace CC13X2_26X2DoorLock { +namespace CC13X4_26X4DoorLock { namespace ResourceRanges { // Used to size arrays static constexpr uint16_t kMaxUsers = 10; @@ -111,10 +111,10 @@ class ParamBuilder }; } // namespace LockInitParams -} // namespace CC13X2_26X2DoorLock +} // namespace CC13X4_26X4DoorLock using namespace ::chip; -using namespace CC13X2_26X2DoorLock::ResourceRanges; +using namespace CC13X4_26X4DoorLock::ResourceRanges; class LockManager { @@ -136,7 +136,7 @@ class LockManager } State; CHIP_ERROR Init(chip::app::DataModel::Nullable state, - CC13X2_26X2DoorLock::LockInitParams::LockParam lockParam); + CC13X4_26X4DoorLock::LockInitParams::LockParam lockParam); bool InitiateAction(Action_t aAction); typedef void (*Callback_fn_initiated)(Action_t); @@ -212,7 +212,7 @@ class LockManager CredentialStruct mCredentials[kMaxUsers][kMaxCredentialsPerUser]; static LockManager sLock; - CC13X2_26X2DoorLock::LockInitParams::LockParam LockParams; + CC13X4_26X4DoorLock::LockInitParams::LockParam LockParams; }; inline LockManager & LockMgr() diff --git a/examples/lock-app/linux/src/LockAppCommandDelegate.cpp b/examples/lock-app/linux/src/LockAppCommandDelegate.cpp index 356888b992fde2..7f2a1c87ec6d9f 100644 --- a/examples/lock-app/linux/src/LockAppCommandDelegate.cpp +++ b/examples/lock-app/linux/src/LockAppCommandDelegate.cpp @@ -21,6 +21,7 @@ #include #include +#include #include using chip::to_underlying; diff --git a/examples/lock-app/lock-common/include/LockManager.h b/examples/lock-app/lock-common/include/LockManager.h index eea60d568ef06b..71dcf6f02dc072 100644 --- a/examples/lock-app/lock-common/include/LockManager.h +++ b/examples/lock-app/lock-common/include/LockManager.h @@ -22,8 +22,6 @@ #include #include -#include - class LockManager { public: diff --git a/examples/lock-app/lock-common/src/ZCLDoorLockCallbacks.cpp b/examples/lock-app/lock-common/src/ZCLDoorLockCallbacks.cpp index 2b0b8810f4ff6e..a67c51bfc90428 100644 --- a/examples/lock-app/lock-common/src/ZCLDoorLockCallbacks.cpp +++ b/examples/lock-app/lock-common/src/ZCLDoorLockCallbacks.cpp @@ -18,7 +18,6 @@ #include #include -#include #include #include "LockManager.h" diff --git a/examples/lock-app/silabs/build_for_wifi_args.gni b/examples/lock-app/silabs/build_for_wifi_args.gni index 25c5a2435d332f..84596e9258fbcc 100644 --- a/examples/lock-app/silabs/build_for_wifi_args.gni +++ b/examples/lock-app/silabs/build_for_wifi_args.gni @@ -24,7 +24,7 @@ app_data_model = "${chip_root}/examples/lock-app/lock-common" # ICD Default configurations chip_enable_icd_server = true chip_subscription_timeout_resumption = false -sl_use_subscription_synching = true +sl_use_subscription_syncing = true # ICD Matter Configuration flags sl_idle_mode_duration_s = 600 # 10min Idle Mode Duration diff --git a/examples/lock-app/silabs/openthread.gni b/examples/lock-app/silabs/openthread.gni index 3bfa566596aeaf..8d1c75d267238c 100644 --- a/examples/lock-app/silabs/openthread.gni +++ b/examples/lock-app/silabs/openthread.gni @@ -28,7 +28,7 @@ openthread_external_platform = # ICD Default configurations chip_enable_icd_server = true chip_subscription_timeout_resumption = false -sl_use_subscription_synching = true +sl_use_subscription_syncing = true # Openthread Configuration flags sl_ot_idle_interval_ms = 5000 # 5s Idle Intervals diff --git a/examples/lock-app/telink/CMakeLists.txt b/examples/lock-app/telink/CMakeLists.txt index 58a9e4fb5bab8f..ee3b67b82eb15d 100755 --- a/examples/lock-app/telink/CMakeLists.txt +++ b/examples/lock-app/telink/CMakeLists.txt @@ -1,5 +1,5 @@ # -# Copyright (c) 2023 Project CHIP Authors +# Copyright (c) 2023-2024 Project CHIP Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,53 +13,18 @@ # See the License for the specific language governing permissions and # limitations under the License. # + cmake_minimum_required(VERSION 3.13.1) get_filename_component(CHIP_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/third_party/connectedhomeip REALPATH) get_filename_component(TELINK_COMMON ${CHIP_ROOT}/examples/platform/telink REALPATH) get_filename_component(GEN_DIR ${CHIP_ROOT}/zzz_generated/ REALPATH) -if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/boards/${BOARD}.overlay") - set(LOCAL_DTC_OVERLAY_FILE "${CMAKE_CURRENT_SOURCE_DIR}/boards/${BOARD}.overlay") -else() - unset(LOCAL_DTC_OVERLAY_FILE) -endif() - -if(EXISTS "${CHIP_ROOT}/src/platform/telink/${BOARD}.overlay") - set(GLOBAL_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/${BOARD}.overlay") -else() - unset(GLOBAL_DTC_OVERLAY_FILE) -endif() - -if(EXISTS "${CHIP_ROOT}/src/platform/telink/${FLASH_SIZE}_flash.overlay") - set(FLASH_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/${FLASH_SIZE}_flash.overlay") - message(STATUS "Flash memory size is set to: " ${FLASH_SIZE} "b") -else() - set(FLASH_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/2m_flash.overlay") - message(STATUS "Flash memory size is set to: 2mb") -endif() - -if(DTC_OVERLAY_FILE) - set(DTC_OVERLAY_FILE - "${DTC_OVERLAY_FILE} ${GLOBAL_DTC_OVERLAY_FILE} ${FLASH_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}" - CACHE STRING "" FORCE - ) -else() - set(DTC_OVERLAY_FILE ${GLOBAL_DTC_OVERLAY_FILE} ${FLASH_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}) -endif() - -set(CONF_FILE prj.conf) - -# Load NCS/Zephyr build system -list(APPEND ZEPHYR_EXTRA_MODULES ${CHIP_ROOT}/config/telink/chip-module) -find_package(Zephyr HINTS $ENV{ZEPHYR_BASE}) - -project(chip-telink-lock-example) - +include(${TELINK_COMMON}/common.cmake) include(${CHIP_ROOT}/config/telink/app/enable-gnu-std.cmake) include(${CHIP_ROOT}/src/app/chip_data_model.cmake) -target_compile_options(app PRIVATE -fpermissive) +project(chip-telink-lock-example) target_include_directories(app PRIVATE include @@ -67,7 +32,8 @@ target_include_directories(app PRIVATE ${GEN_DIR}/lock-app ${TELINK_COMMON}/common/include ${TELINK_COMMON}/util/include - ${TELINK_COMMON}/app/include) + ${TELINK_COMMON}/app/include + ${TELINK_COMMON}/zephyr_ext) target_sources(app PRIVATE src/AppTask.cpp @@ -76,10 +42,15 @@ target_sources(app PRIVATE src/LockSettingsStorage.cpp ${TELINK_COMMON}/common/src/mainCommon.cpp ${TELINK_COMMON}/common/src/AppTaskCommon.cpp - ${TELINK_COMMON}/util/src/LEDWidget.cpp + ${TELINK_COMMON}/util/src/LEDManager.cpp ${TELINK_COMMON}/util/src/ButtonManager.cpp ${TELINK_COMMON}/util/src/ThreadUtil.cpp - ${TELINK_COMMON}/util/src/PWMDevice.cpp) + ${TELINK_COMMON}/util/src/PWMManager.cpp + ${TELINK_COMMON}/zephyr_ext/zephyr_key_matrix.c + ${TELINK_COMMON}/zephyr_ext/zephyr_key_pool.c + ${TELINK_COMMON}/zephyr_ext/zephyr_led_pool.c + ${TELINK_COMMON}/zephyr_ext/zephyr_pwm_pool.c + ${TELINK_COMMON}/zephyr_ext/zephyr_ws2812.c) chip_configure_data_model(app INCLUDE_SERVER diff --git a/examples/lock-app/telink/include/AppConfig.h b/examples/lock-app/telink/include/AppConfig.h index cb4b0c2b488d86..756ff5b3bfa15f 100644 --- a/examples/lock-app/telink/include/AppConfig.h +++ b/examples/lock-app/telink/include/AppConfig.h @@ -37,11 +37,5 @@ #define APP_DEFAULT_YEARDAY_SCHEDULE_PER_USER_COUNT 5 #define APP_DEFAULT_HOLYDAY_SCHEDULE_PER_USER_COUNT 5 -#define APP_USE_EXAMPLE_START_BUTTON 1 -#define APP_USE_BLE_START_BUTTON 0 -#define APP_USE_THREAD_START_BUTTON 0 #define APP_SET_DEVICE_INFO_PROVIDER 1 #define APP_SET_NETWORK_COMM_ENDPOINT_SEC 0 -#if defined(CONFIG_BOARD_TLSR9518ADK80D) || defined(CONFIG_BOARD_TLSR9528A) -#define APP_USE_IDENTIFY_PWM 1 -#endif diff --git a/examples/lock-app/telink/include/AppTask.h b/examples/lock-app/telink/include/AppTask.h index fb0f4113d4af9f..cec70dd8bb6c8f 100644 --- a/examples/lock-app/telink/include/AppTask.h +++ b/examples/lock-app/telink/include/AppTask.h @@ -37,6 +37,8 @@ class AppTask : public AppTaskCommon friend class AppTaskCommon; CHIP_ERROR Init(void); + void LinkButtons(ButtonManager & buttonManager); + void LinkLeds(LedManager & ledManager); static void LockActionEventHandler(AppEvent * event); static void LockStateChanged(LockManager::State_t state); diff --git a/examples/lock-app/telink/prj.conf b/examples/lock-app/telink/prj.conf index 738b4090c8be80..2ec882cd327251 100755 --- a/examples/lock-app/telink/prj.conf +++ b/examples/lock-app/telink/prj.conf @@ -1,5 +1,5 @@ # -# Copyright (c) 2023 Project CHIP Authors +# Copyright (c) 2023-2024 Project CHIP Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ # limitations under the License. # -# This sample uses sample-defaults.conf to set options common for all +# This sample uses Kconfig.defaults to set options common for all # samples. This file should contain only options specific for this sample # or overrides of default values. @@ -22,10 +22,6 @@ CONFIG_CHIP=y CONFIG_STD_CPP17=y -# CHIP configuration -CONFIG_CHIP_PROJECT_CONFIG="include/CHIPProjectConfig.h" -CONFIG_CHIP_OPENTHREAD_CONFIG="../../platform/telink/project_include/OpenThreadConfig.h" - # 32774 == 0x8006 (example lock-app) CONFIG_CHIP_DEVICE_PRODUCT_ID=32774 diff --git a/examples/lock-app/telink/src/AppTask.cpp b/examples/lock-app/telink/src/AppTask.cpp index 19748544f8d15d..46e34db66710e5 100644 --- a/examples/lock-app/telink/src/AppTask.cpp +++ b/examples/lock-app/telink/src/AppTask.cpp @@ -18,6 +18,7 @@ #include "AppTask.h" #include "ButtonManager.h" +#include "LEDManager.h" #include #include #include @@ -33,33 +34,14 @@ using namespace ::chip::DeviceLayer; using namespace ::chip::DeviceLayer::Internal; using namespace TelinkDoorLock::LockInitParams; -namespace { -#if CONFIG_CHIP_ENABLE_APPLICATION_STATUS_LED -LEDWidget sLockLED; -#endif -} // namespace - AppTask AppTask::sAppTask; -static const struct gpio_dt_spec sLockJammedInputDt = GPIO_DT_SPEC_GET(DT_NODELABEL(key_5), gpios); -static const struct gpio_dt_spec sLockStatusInputDt = GPIO_DT_SPEC_GET(DT_NODELABEL(key_6), gpios); -Button sLockJammedAction; -Button sLockStatusChangedAction; CHIP_ERROR AppTask::Init(void) { -#if APP_USE_EXAMPLE_START_BUTTON SetExampleButtonCallbacks(LockActionEventHandler); -#endif - sLockJammedAction.Configure(&sLockJammedInputDt, LockJammedEventHandler); - sLockStatusChangedAction.Configure(&sLockStatusInputDt, LockStateEventHandler); - ButtonManagerInst().AddButton(sLockJammedAction); - ButtonManagerInst().AddButton(sLockStatusChangedAction); InitCommonParts(); -#if CONFIG_CHIP_ENABLE_APPLICATION_STATUS_LED - sLockLED.Init(GPIO_DT_SPEC_GET(DT_ALIAS(led2), gpios)); - sLockLED.Set(LockMgr().IsLocked()); -#endif + LedManager::getInstance().setLed(LedManager::EAppLed_App0, LockMgr().IsLocked()); chip::app::DataModel::Nullable state; chip::EndpointId endpointId{ kExampleEndpointId }; @@ -167,45 +149,31 @@ void AppTask::LockStateChanged(LockManager::State_t state) { case LockManager::State_t::kState_LockInitiated: LOG_INF("Callback: Lock action initiated"); -#if CONFIG_CHIP_ENABLE_APPLICATION_STATUS_LED - sLockLED.Blink(50, 50); -#endif + LedManager::getInstance().setLed(LedManager::EAppLed_App0, 50, 50); break; case LockManager::State_t::kState_LockCompleted: LOG_INF("Callback: Lock action completed"); -#if CONFIG_CHIP_ENABLE_APPLICATION_STATUS_LED - sLockLED.Set(true); -#endif + LedManager::getInstance().setLed(LedManager::EAppLed_App0, true); break; case LockManager::State_t::kState_UnlockInitiated: LOG_INF("Callback: Unlock action initiated"); -#if CONFIG_CHIP_ENABLE_APPLICATION_STATUS_LED - sLockLED.Blink(50, 50); -#endif + LedManager::getInstance().setLed(LedManager::EAppLed_App0, 50, 50); break; case LockManager::State_t::kState_UnlockCompleted: LOG_INF("Callback: Unlock action completed"); -#if CONFIG_CHIP_ENABLE_APPLICATION_STATUS_LED - sLockLED.Set(false); -#endif + LedManager::getInstance().setLed(LedManager::EAppLed_App0, false); break; case LockManager::State_t::kState_UnlatchInitiated: LOG_INF("Callback: Unbolt action initiated"); -#if CONFIG_CHIP_ENABLE_APPLICATION_STATUS_LED - sLockLED.Blink(75, 25); -#endif + LedManager::getInstance().setLed(LedManager::EAppLed_App0, 75, 25); break; case LockManager::State_t::kState_UnlatchCompleted: LOG_INF("Callback: Unbolt action completed"); -#if CONFIG_CHIP_ENABLE_APPLICATION_STATUS_LED - sLockLED.Blink(25, 75); -#endif + LedManager::getInstance().setLed(LedManager::EAppLed_App0, 25, 75); break; case LockManager::State_t::kState_NotFulyLocked: LOG_INF("Callback: Lock not fully locked. Unexpected state"); -#if CONFIG_CHIP_ENABLE_APPLICATION_STATUS_LED - sLockLED.Blink(10, 90); -#endif + LedManager::getInstance().setLed(LedManager::EAppLed_App0, 10, 90); break; } } @@ -257,3 +225,21 @@ void AppTask::LockStateActionHandler(AppEvent * aEvent) /* Generating Door Lock Status event */ DoorLockServer::Instance().SetDoorState(kExampleEndpointId, mDoorState); } + +void AppTask::LinkButtons(ButtonManager & buttonManager) +{ + buttonManager.addCallback(FactoryResetButtonEventHandler, 0, true); + buttonManager.addCallback(ExampleActionButtonEventHandler, 1, true); + buttonManager.addCallback(LockJammedEventHandler, 2, true); + buttonManager.addCallback(LockStateEventHandler, 3, true); +} + +void AppTask::LinkLeds(LedManager & ledManager) +{ +#if CONFIG_CHIP_ENABLE_APPLICATION_STATUS_LED + ledManager.linkLed(LedManager::EAppLed_Status, 0); + ledManager.linkLed(LedManager::EAppLed_App0, 1); +#else + ledManager.linkLed(LedManager::EAppLed_App0, 0); +#endif // CONFIG_CHIP_ENABLE_APPLICATION_STATUS_LED +} diff --git a/examples/ota-provider-app/ota-provider-common/OTAProviderExample.cpp b/examples/ota-provider-app/ota-provider-common/OTAProviderExample.cpp index 234ee940b6d9db..381d3b43f7b763 100644 --- a/examples/ota-provider-app/ota-provider-common/OTAProviderExample.cpp +++ b/examples/ota-provider-app/ota-provider-common/OTAProviderExample.cpp @@ -22,7 +22,6 @@ #include #include #include -#include #include #include #include diff --git a/examples/ota-requestor-app/ameba/README.md b/examples/ota-requestor-app/ameba/README.md index 7c10b157e4f8db..aef1e40ab7e566 100644 --- a/examples/ota-requestor-app/ameba/README.md +++ b/examples/ota-requestor-app/ameba/README.md @@ -6,11 +6,11 @@ A prototype application that demonstrates OTA Requestor capabilities. - Pull docker image: - $ docker pull ghcr.io/project-chip/chip-build-ameba:42 + $ docker pull ghcr.io/project-chip/chip-build-ameba:47 - Run docker container: - $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:42 + $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:47 - Setup build environment: diff --git a/examples/ota-requestor-app/ameba/main/DeviceCallbacks.cpp b/examples/ota-requestor-app/ameba/main/DeviceCallbacks.cpp index bd53af45ed4f61..61223f9997d69e 100644 --- a/examples/ota-requestor-app/ameba/main/DeviceCallbacks.cpp +++ b/examples/ota-requestor-app/ameba/main/DeviceCallbacks.cpp @@ -29,7 +29,6 @@ #include #include #include -#include #include #include #include diff --git a/examples/ota-requestor-app/ameba/main/chipinterface.cpp b/examples/ota-requestor-app/ameba/main/chipinterface.cpp index 841e95c1720df8..dfac5c97f2ecf6 100644 --- a/examples/ota-requestor-app/ameba/main/chipinterface.cpp +++ b/examples/ota-requestor-app/ameba/main/chipinterface.cpp @@ -24,7 +24,7 @@ #include #include -#include +#include #include #include diff --git a/examples/ota-requestor-app/asr/src/AppTask.cpp b/examples/ota-requestor-app/asr/src/AppTask.cpp index 56910e92019f55..78c4ec47b8be1f 100755 --- a/examples/ota-requestor-app/asr/src/AppTask.cpp +++ b/examples/ota-requestor-app/asr/src/AppTask.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include diff --git a/examples/ota-requestor-app/asr/src/DeviceCallbacks.cpp b/examples/ota-requestor-app/asr/src/DeviceCallbacks.cpp index a1fa28e413f647..2ad405f665b671 100644 --- a/examples/ota-requestor-app/asr/src/DeviceCallbacks.cpp +++ b/examples/ota-requestor-app/asr/src/DeviceCallbacks.cpp @@ -30,7 +30,6 @@ #include #include #include -#include #include #include #include diff --git a/examples/ota-requestor-app/esp32/main/main.cpp b/examples/ota-requestor-app/esp32/main/main.cpp index c3ee1d5803b207..e375ded305e1dc 100644 --- a/examples/ota-requestor-app/esp32/main/main.cpp +++ b/examples/ota-requestor-app/esp32/main/main.cpp @@ -16,7 +16,6 @@ */ #include "DeviceCallbacks.h" -#include "app/util/af.h" #include "esp_heap_caps_init.h" #include "esp_log.h" #include "esp_netif.h" @@ -26,6 +25,7 @@ #include "freertos/task.h" #include "nvs_flash.h" #include +#include #include #include #include diff --git a/examples/ota-requestor-app/genio/src/AppTask.cpp b/examples/ota-requestor-app/genio/src/AppTask.cpp index 50d1d080a5b7b4..ff78e703e4be81 100644 --- a/examples/ota-requestor-app/genio/src/AppTask.cpp +++ b/examples/ota-requestor-app/genio/src/AppTask.cpp @@ -21,6 +21,7 @@ #include #include #include +#include #include diff --git a/examples/ota-requestor-app/linux/main.cpp b/examples/ota-requestor-app/linux/main.cpp index 0cc7271618b400..80b16222c61912 100644 --- a/examples/ota-requestor-app/linux/main.cpp +++ b/examples/ota-requestor-app/linux/main.cpp @@ -22,7 +22,6 @@ #include #include #include -#include #include using chip::BDXDownloader; diff --git a/examples/ota-requestor-app/telink/CMakeLists.txt b/examples/ota-requestor-app/telink/CMakeLists.txt index 31be460d8a346c..62ed3c85deb51a 100644 --- a/examples/ota-requestor-app/telink/CMakeLists.txt +++ b/examples/ota-requestor-app/telink/CMakeLists.txt @@ -1,5 +1,5 @@ # -# Copyright (c) 2022 Project CHIP Authors +# Copyright (c) 2022-2024 Project CHIP Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,53 +13,18 @@ # See the License for the specific language governing permissions and # limitations under the License. # + cmake_minimum_required(VERSION 3.13.1) get_filename_component(CHIP_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/third_party/connectedhomeip REALPATH) get_filename_component(TELINK_COMMON ${CHIP_ROOT}/examples/platform/telink REALPATH) get_filename_component(GEN_DIR ${CHIP_ROOT}/zzz_generated/ REALPATH) -if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/boards/${BOARD}.overlay") - set(LOCAL_DTC_OVERLAY_FILE "${CMAKE_CURRENT_SOURCE_DIR}/boards/${BOARD}.overlay") -else() - unset(LOCAL_DTC_OVERLAY_FILE) -endif() - -if(EXISTS "${CHIP_ROOT}/src/platform/telink/${BOARD}.overlay") - set(GLOBAL_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/${BOARD}.overlay") -else() - unset(GLOBAL_DTC_OVERLAY_FILE) -endif() - -if(EXISTS "${CHIP_ROOT}/src/platform/telink/${FLASH_SIZE}_flash.overlay") - set(FLASH_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/${FLASH_SIZE}_flash.overlay") - message(STATUS "Flash memory size is set to: " ${FLASH_SIZE} "b") -else() - set(FLASH_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/2m_flash.overlay") - message(STATUS "Flash memory size is set to: 2mb") -endif() - -if(DTC_OVERLAY_FILE) - set(DTC_OVERLAY_FILE - "${DTC_OVERLAY_FILE} ${GLOBAL_DTC_OVERLAY_FILE} ${FLASH_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}" - CACHE STRING "" FORCE - ) -else() - set(DTC_OVERLAY_FILE ${GLOBAL_DTC_OVERLAY_FILE} ${FLASH_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}) -endif() - -set(CONF_FILE prj.conf) - -# Load NCS/Zephyr build system -list(APPEND ZEPHYR_EXTRA_MODULES ${CHIP_ROOT}/config/telink/chip-module) -find_package(Zephyr HINTS $ENV{ZEPHYR_BASE}) - -project(chip-telink-ota-requestor-example) - +include(${TELINK_COMMON}/common.cmake) include(${CHIP_ROOT}/config/telink/app/enable-gnu-std.cmake) include(${CHIP_ROOT}/src/app/chip_data_model.cmake) -target_compile_options(app PRIVATE -fpermissive) +project(chip-telink-ota-requestor-example) target_include_directories(app PRIVATE include @@ -67,17 +32,23 @@ target_include_directories(app PRIVATE ${GEN_DIR}/ota-requestor-app ${TELINK_COMMON}/common/include ${TELINK_COMMON}/util/include - ${TELINK_COMMON}/app/include) + ${TELINK_COMMON}/app/include + ${TELINK_COMMON}/zephyr_ext) target_sources(app PRIVATE src/AppTask.cpp src/ZclCallbacks.cpp ${TELINK_COMMON}/common/src/mainCommon.cpp ${TELINK_COMMON}/common/src/AppTaskCommon.cpp - ${TELINK_COMMON}/util/src/LEDWidget.cpp + ${TELINK_COMMON}/util/src/LEDManager.cpp ${TELINK_COMMON}/util/src/ButtonManager.cpp ${TELINK_COMMON}/util/src/ThreadUtil.cpp - ${TELINK_COMMON}/util/src/PWMDevice.cpp) + ${TELINK_COMMON}/util/src/PWMManager.cpp + ${TELINK_COMMON}/zephyr_ext/zephyr_key_matrix.c + ${TELINK_COMMON}/zephyr_ext/zephyr_key_pool.c + ${TELINK_COMMON}/zephyr_ext/zephyr_led_pool.c + ${TELINK_COMMON}/zephyr_ext/zephyr_pwm_pool.c + ${TELINK_COMMON}/zephyr_ext/zephyr_ws2812.c) chip_configure_data_model(app INCLUDE_SERVER diff --git a/examples/ota-requestor-app/telink/include/AppConfig.h b/examples/ota-requestor-app/telink/include/AppConfig.h index 05e62e8b612725..70d3394a96d697 100644 --- a/examples/ota-requestor-app/telink/include/AppConfig.h +++ b/examples/ota-requestor-app/telink/include/AppConfig.h @@ -20,11 +20,5 @@ // ---- OTA Requestor Example App Config ---- -#define APP_USE_EXAMPLE_START_BUTTON 0 -#define APP_USE_BLE_START_BUTTON 0 -#define APP_USE_THREAD_START_BUTTON 1 #define APP_SET_DEVICE_INFO_PROVIDER 1 #define APP_SET_NETWORK_COMM_ENDPOINT_SEC 1 -#if defined(CONFIG_BOARD_TLSR9518ADK80D) || defined(CONFIG_BOARD_TLSR9528A) -#define APP_USE_IDENTIFY_PWM 1 -#endif diff --git a/examples/ota-requestor-app/telink/prj.conf b/examples/ota-requestor-app/telink/prj.conf index 9538841fbc7230..ca5d0a9cff26a0 100755 --- a/examples/ota-requestor-app/telink/prj.conf +++ b/examples/ota-requestor-app/telink/prj.conf @@ -1,5 +1,5 @@ # -# Copyright (c) 2022-2023 Project CHIP Authors +# Copyright (c) 2022-2024 Project CHIP Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ # limitations under the License. # -# This sample uses sample-defaults.conf to set options common for all +# This sample uses Kconfig.defaults to set options common for all # samples. This file should contain only options specific for this sample # or overrides of default values. @@ -22,10 +22,6 @@ CONFIG_CHIP=y CONFIG_STD_CPP17=y -# CHIP configuration -CONFIG_CHIP_PROJECT_CONFIG="include/CHIPProjectConfig.h" -CONFIG_CHIP_OPENTHREAD_CONFIG="../../platform/telink/project_include/OpenThreadConfig.h" - # 32776 == 0x8008 (example ota-requestor-app) CONFIG_CHIP_DEVICE_PRODUCT_ID=32776 diff --git a/examples/persistent-storage/cc13x2x7_26x2x7/.gn b/examples/persistent-storage/cc13x2x7_26x2x7/.gn deleted file mode 100644 index 3d48789e30ab3d..00000000000000 --- a/examples/persistent-storage/cc13x2x7_26x2x7/.gn +++ /dev/null @@ -1,28 +0,0 @@ -# Copyright (c) 2020 Project CHIP Authors -# -# 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. - -import("//build_overrides/build.gni") - -# The location of the build configuration file. -buildconfig = "${build_root}/config/BUILDCONFIG.gn" - -# CHIP uses angle bracket includes. -check_system_includes = true - -default_args = { - target_cpu = "arm" - target_os = "freertos" - - import("//args.gni") -} diff --git a/examples/persistent-storage/cc13x2x7_26x2x7/BUILD.gn b/examples/persistent-storage/cc13x2x7_26x2x7/BUILD.gn deleted file mode 100644 index 0a8930dff1adb2..00000000000000 --- a/examples/persistent-storage/cc13x2x7_26x2x7/BUILD.gn +++ /dev/null @@ -1,94 +0,0 @@ -# Copyright (c) 2020 Project CHIP Authors -# -# 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. - -import("//build_overrides/build.gni") -import("//build_overrides/chip.gni") -import("//build_overrides/openthread.gni") -import("//build_overrides/ti_simplelink_sdk.gni") - -import("${build_root}/config/defaults.gni") - -import("${ti_simplelink_sdk_build_root}/ti_simplelink_executable.gni") -import("${ti_simplelink_sdk_build_root}/ti_simplelink_sdk.gni") - -assert(current_os == "freertos") - -project_dir = "${chip_root}/examples/persistent-storage/cc13x2x7_26x2x7" - -ti_simplelink_sdk("sdk") { - include_dirs = [ "${project_dir}/include" ] - - defines = [] - if (is_debug) { - defines += [ "BUILD_RELEASE=0" ] - } else { - defines += [ "BUILD_RELEASE=1" ] - } -} - -ti_sysconfig("sysconfig") { - sources = [ "${project_dir}/chip.syscfg" ] - - outputs = [ - "ti_devices_config.c", - "ti_drivers_config.c", - "ti_drivers_config.h", - ] - - public_configs = [ ":sdk_cc13x2x7_26x2x7_dmm_config" ] - - cflags = [ - "-Wno-comment", - "@" + rebase_path("${target_gen_dir}/sysconfig/ti_ble_app_config.opt", - root_build_dir), - "@" + rebase_path("${target_gen_dir}/sysconfig/ti_build_config.opt", - root_build_dir), - ] -} - -ti_simplelink_executable("persistent_storage") { - output_name = "chip-${ti_simplelink_board}-persistent_storage.out" - - sources = [ - "${project_dir}/../KeyValueStorageTest.cpp", - "${project_dir}/main.cpp", - ] - - deps = [ - ":sdk", - ":sysconfig", - "${chip_root}/src/lib", - ] - - include_dirs = [ - "${project_dir}", - "${project_dir}/..", - ] - - cflags = [ - "-Wno-implicit-fallthrough", - "-Wno-sign-compare", - "-Wconversion", - ] - - output_dir = root_out_dir -} - -group("cc13x2x7_26x2x7") { - deps = [ ":persistent_storage" ] -} - -group("default") { - deps = [ ":cc13x2x7_26x2x7" ] -} diff --git a/examples/persistent-storage/cc13x2x7_26x2x7/README.md b/examples/persistent-storage/cc13x2x7_26x2x7/README.md deleted file mode 100644 index 87e4add6701eca..00000000000000 --- a/examples/persistent-storage/cc13x2x7_26x2x7/README.md +++ /dev/null @@ -1,255 +0,0 @@ -# Matter Persistent Storage Example Application - -An example test application showing the persistent storage system for -[Matter][matter] on the Texas Instruments CC13X2_26X2 family of Wireless MCUs. - ---- - -- [Matter Persistent Storage Application](#matter-persistent-storage-example-application) - - [Introduction](#introduction) - - [Device UI](#device-ui) - - [Building](#building) - - [Preparation](#preparation) - - [Compilation](#compilation) - - [Programming](#programming) - - [Code Composer Studio](#code-composer-studio) - - [UniFlash](#uniflash) - - [Viewing Logging Output](#viewing-logging-output) - - [TI Support](#ti-support) - ---- - -## Introduction - -This example serves to test the key value storage implementation and API and -offers information on proper usage of the KVS system. - -This example is enabled to build for CC2652R7 devices. This upcoming devices are -currently not yet in full production. For more information on device -availability or early access to an engineering build of our Matter-enabled SDK, -please reach out [here][ti_cc13x2_26x2_r7_matter_request]. - -## Device UI - -Over the debug UART connection you should see the output: - -``` -Running Tests: -TestEmptyString(): PASSED -TestString(): PASSED -TestUint32(): PASSED -TestArray(): PASSED -TestStruct(): PASSED -TestUpdateValue(): PASSED -TestMultiRead(): PASSED -``` - -This indicates a successful run of the test suite. - -## Building - -### Preparation - -Some initial setup is necessary for preparing the build environment. This -section will need to be done when migrating to new versions of the SDK. This -guide assumes that the environment is linux based, and recommends Ubuntu 20.04. - -- An engineering SDK from TI is required. Please request access for it - [here][ti_cc13x2_26x2_r7_matter_request]. - - - Follow the default installation instructions when executing the - installer. - - - The version of OpenThread used in this repository is newer than the one - packaged with the TI SDK. Check the following section for a list of - changes needed. - -- Download and install [SysConfig][sysconfig]. - - - This may have already been installed with your SimpleLink SDK install. - -- If you have installed different versions, the build defaults will need to be - changed to reflect this in - `${chip_root}/examples/build_overrides/ti_simplelink_sdk.gni`. - -- Install Python 3.8 for the GN build system: - - ``` - # Linux - $ sudo apt-get install python3.8 python3.8-distutils python3.8-dev python3.8-venv - # Distutils listed due to a package manager error on Ubuntu 18.04 - - ``` - - - You will have to ensure that the default version of Python 3 is Python - 3.8. - - - Check python3 version: - - ``` - $ python3 --version - Python 3.8.0 - ``` - - - If it is not Python 3.8: - - ``` - $ sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 1 - ``` - - - This may affect your environment in other ways if there was a - specific dependency on the prior python3 version (e.g. apt). - After completing the build process for this example, you can - revert the python3 version, for instance: - - ``` - $ sudo update-alternatives --config python3 - There are 2 choices for the alternative python3 (providing /usr/bin/python3). - - Selection Path Priority Status - ------------------------------------------------------------- - 0 /usr/bin/python3.8 1 auto mode - 1 /usr/bin/python3.6 1 manual mode - * 2 /usr/bin/python3.8 1 manual mode - - Press to keep the current choice[*], or type selection number: 1 - update-alternatives: using /usr/bin/python3.6 to provide /usr/bin/python3 (python3) in manual mode - ``` - -- Run the bootstrap script to setup the build environment. - - ``` - $ cd ~/connectedhomeip - $ source ./scripts/bootstrap.sh - - ``` - -### Compilation - -It is necessary to activate the environment in every new shell. Then run GN and -Ninja to build the executable. - -- Activate the build environment with the repository activate script. - - ``` - $ cd ~/connectedhomeip - $ source ./scripts/activate.sh - - ``` - -- Run the build to produce a default executable. By default on Linux both the - TI SimpleLink SDK and Sysconfig are located in a `ti` folder in the user's - home directory, and you must provide the absolute path to them. For example - `/home/username/ti/sysconfig_1.16.2`. On Windows the default directory is - `C:\ti`. Take note of this install path, as it will be used in the next - step. - - ``` - $ cd ~/connectedhomeip/examples/lock-app/cc13x2x7_26x2x7 - $ export TI_SYSCONFIG_ROOT=$HOME/ti/sysconfig_1.16.2 - $ gn gen out/debug --args="ti_sysconfig_root=\"${TI_SYSCONFIG_ROOT}\"" - $ ninja -C out/debug - - ``` - -## Programming - -Loading the built image onto a LaunchPad is supported through two methods; -Uniflash and Code Composer Studio (CCS). UniFlash can be used to load the image. -Code Composer Studio can be used to load the image and debug the source code. - -### Code Composer Studio - -Programming with CCS will allow for a full debug environment within the IDE. -This is accomplished by creating a target connection to the XDS110 debugger and -starting a project-less debug session. The CCS IDE will attempt to find the -source files on the local machine based on the debug information embedded within -the ELF. CCS may prompt you to find the source code if the image was built on -another machine or the source code is located in a different location than is -recorded within the ELF. - -Download and install [Code Composer Studio][ccs]. - -First open CCS and create a new workspace. - -Create a target connection (sometimes called the CCXML) for your target SoC and -debugger as described in the [Manual Method][ccs_manual_method] section of the -CCS User's Guide. - -Next initiate a project-less debug session as described in the [Manual -Launch][ccs_manual_launch] section of the CCS User's Guide. - -CCS should switch to the debug view described in the [After -Launch][ccs_after_launch] section of the User's Guide. The SoC core will likely -be disconnected and symbols will not be loaded. Connect to the core as described -in the [Debug View][ccs_debug_view] section of the User's Guide. Once the core -is connected, use the `Load` button on the toolbar to load the ELF image. - -Note that the default configuration of the CCXML uses 2-wire cJTAG instead of -the full 4-wire JTAG connection to match the default jumper configuration of the -LaunchPad. - -### UniFlash - -Uniflash is Texas Instrument's uniform programming tool for embedded processors. -This will allow you to erase, flash, and inspect the SoC without setting up a -debugging environment. - -Download and install [UniFlash][uniflash]. - -First open UniFlash. Debug probes connected to the computer will usually be -displayed under the Detected Devices due to the automatic device detection -feature. If your device does not show up in this view it my be disconnected, or -you may have to create a New Configuration. If you already have a CCXML for your -SoC and debug connection you can use that in the section at the bottom. Once -your device is selected, click the `Start` button within the section to launch -the session. - -Select the ELF image to load on the device with the `Browse` button. This file -is placed in the `out/debug` folder by this guide and ends with the `*.out` file -extension. For OTA enabled applications, the standalone image will instead end -with the `*-bim.hex` file extension. This this is a combined image with -application and and `BIM` included. The flag to enable or disable the OTA -feature is determined by "chip_enable_ota_requestor" in the application's -args.gni file. - -Finally click the `Load Image` button to load the executable image onto the -device. You should be able to see the log output over the XDS110 User UART. - -Note that programming the device through JTAG sets the Halt-in-Boot flag and may -cause issues when performing a software reset. This flag can be reset by -power-cycling the LaunchPad. - -## Viewing Logging Output - -By default the log output will be sent to the Application/User UART. Open a -terminal emulator to that port to see the output with the following options: - -| Parameter | Value | -| ------------ | -------- | -| Speed (baud) | `115200` | -| Data bits | `8` | -| Stop bits | `1` | -| Parity | `None` | -| Flow control | `None` | - -## TI Support - -For technical support, please consider creating a post on TI's [E2E forum][e2e]. -Additionally, we welcome any feedback. - -[matter]: https://csa-iot.org/all-solutions/matter/ -[ccs]: https://www.ti.com/tool/CCSTUDIO -[ccs_after_launch]: - https://software-dl.ti.com/ccs/esd/documents/users_guide/ccs_debug-main.html?configuration#after-launch -[ccs_debug_view]: - https://software-dl.ti.com/ccs/esd/documents/users_guide/ccs_debug-main.html?configuration#debug-view -[ccs_manual_launch]: - https://software-dl.ti.com/ccs/esd/documents/users_guide/ccs_debug-main.html?configuration#manual-launch -[ccs_manual_method]: - https://software-dl.ti.com/ccs/esd/documents/users_guide/ccs_debug-main.html?configuration#manual-method -[e2e]: - https://e2e.ti.com/support/wireless-connectivity/zigbee-thread-group/zigbee-and-thread/f/zigbee-thread-forum -[sysconfig]: https://www.ti.com/tool/SYSCONFIG -[ti_cc13x2_26x2_r7_matter_request]: https://ti.com/chip_sdk -[uniflash]: https://www.ti.com/tool/download/UNIFLASH diff --git a/examples/persistent-storage/cc13x2x7_26x2x7/args.gni b/examples/persistent-storage/cc13x2x7_26x2x7/args.gni deleted file mode 100644 index ad8a3f88326649..00000000000000 --- a/examples/persistent-storage/cc13x2x7_26x2x7/args.gni +++ /dev/null @@ -1,30 +0,0 @@ -# Copyright (c) 2020 Project CHIP Authors -# -# 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. - -import("//build_overrides/chip.gni") -import("${chip_root}/config/standalone/args.gni") -import("${chip_root}/examples/platform/cc13x2_26x2/args.gni") - -ti_simplelink_sdk_target = get_label_info(":sdk", "label_no_toolchain") -ti_simplelink_sysconfig_target = - get_label_info(":sysconfig", "label_no_toolchain") - -ti_simplelink_board = "LP_CC2652R7" - -# use -Os instead of -Og -#optimize_debug_level = "s" -#lwip_debug = false - -# BLE options -chip_config_network_layer_ble = true diff --git a/examples/persistent-storage/cc13x2x7_26x2x7/build_overrides b/examples/persistent-storage/cc13x2x7_26x2x7/build_overrides deleted file mode 120000 index e578e73312ebd1..00000000000000 --- a/examples/persistent-storage/cc13x2x7_26x2x7/build_overrides +++ /dev/null @@ -1 +0,0 @@ -../../build_overrides \ No newline at end of file diff --git a/examples/persistent-storage/cc13x2x7_26x2x7/chip.syscfg b/examples/persistent-storage/cc13x2x7_26x2x7/chip.syscfg deleted file mode 100644 index 995ad22af6b435..00000000000000 --- a/examples/persistent-storage/cc13x2x7_26x2x7/chip.syscfg +++ /dev/null @@ -1,238 +0,0 @@ -/* - * - * Copyright (c) 2020 Project CHIP Authors - * Copyright (c) 2020 Texas Instruments Incorporated - * All rights reserved. - * - * 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. - */ - - -/* Modules */ -var AESCCM = scripting.addModule("/ti/drivers/AESCCM"); -var AESECB = scripting.addModule("/ti/drivers/AESECB"); -var Button = scripting.addModule("/ti/drivers/apps/Button"); -var LED = scripting.addModule("/ti/drivers/apps/LED"); -var NVS = scripting.addModule("/ti/drivers/NVS"); -var RF = scripting.addModule("/ti/drivers/RF"); -var RFDesign = scripting.addModule("ti/devices/radioconfig/rfdesign"); -var RFCustom = scripting.addModule("/ti/devices/radioconfig/custom"); -var TRNG = scripting.addModule("/ti/drivers/TRNG"); -var SHA2 = scripting.addModule("/ti/drivers/SHA2"); -var UART2 = scripting.addModule("/ti/drivers/UART2"); -var ble = scripting.addModule("/ti/ble5stack/ble"); -var dmm = scripting.addModule("/ti/dmm/dmm"); -var AESCTRDRBG = scripting.addModule("/ti/drivers/AESCTRDRBG"); -var ECDH = scripting.addModule("/ti/drivers/ECDH"); - -/* Instances */ -var AESCCM1 = AESCCM.addInstance(); -var AESECB1 = AESECB.addInstance(); -var AESECB2 = AESECB.addInstance(); -var Button1 = Button.addInstance(); -var Button2 = Button.addInstance(); -var NVS1 = NVS.addInstance(); -var NVS2 = NVS.addInstance(); -var SHA21 = SHA2.addInstance(); -var LED1 = LED.addInstance(); -var LED2 = LED.addInstance(); -var TRNG1 = TRNG.addInstance(); -var TRNG2 = TRNG.addInstance(); -var TRNG3 = TRNG.addInstance(); -var UART2 = UART2.addInstance(); -var AESCTRDRBG1 = AESCTRDRBG.addInstance(); -var ECDH1 = ECDH.addInstance(); - -AESCTRDRBG1.$name = "CONFIG_AESCTRDRBG_0"; - -AESCCM1.$name = "CONFIG_AESCCM0"; - -AESECB1.$name = "CONFIG_AESECB0"; -AESECB2.$name = "CONFIG_AESECB_1"; - -ECDH1.$name = "CONFIG_ECDH0"; - -/* Left Button */ -Button1.$name = "CONFIG_BTN_LEFT"; -Button1.$hardware = system.deviceData.board.components["BTN-1"]; -Button1.gpioPin.$name = "CONFIG_GPIO_BTN1"; -Button1.gpioPin.pull = "Pull Up"; -Button1.gpioPin.interruptTrigger = "Falling Edge"; - -/* Left Button */ -Button2.$name = "CONFIG_BTN_RIGHT"; -Button2.$hardware = system.deviceData.board.components["BTN-2"]; -Button2.gpioPin.$name = "CONFIG_GPIO_BTN2"; -Button2.gpioPin.pull = "Pull Up"; -Button2.gpioPin.interruptTrigger = "Falling Edge"; - -/* ======== CCFG ======== */ -var CCFG = scripting.addModule("/ti/devices/CCFG"); -const ccfgSettings = system.getScript("/ti/common/lprf_ccfg_settings.js").ccfgSettings; -for(var setting in ccfgSettings) -{ - CCFG[setting] = ccfgSettings[setting]; -} - -// Disable CCFG generation, this is added by the BIM project -CCFG.enableCodeGeneration = false; - -/* NVS */ -NVS1.$name = "CONFIG_NVSINTERNAL"; -NVS1.internalFlash.regionBase = 0xAA000; -NVS1.internalFlash.regionSize = 0x4000; - -NVS2.$name = "CONFIG_NVSEXTERNAL"; -NVS2.nvsType = "External"; // NVS Region Type -NVS2.$hardware = system.deviceData.board.components.MX25R8035F; - -/* RF */ -/* if an antenna component exists, assign it to the rf instance */ -if (system.deviceData.board && system.deviceData.board.components.RF) { - RF.$hardware = system.deviceData.board.components.RF; -} - -const rfDesignSettings = system.getScript("/ti/common/lprf_rf_design_settings.js").rfDesignSettings; -for(var setting in rfDesignSettings) -{ - RFDesign[setting] = rfDesignSettings[setting]; -} - -/* Handling for RF frontend characterization */ -if(RFDesign.rfDesign.match(/LP_CC2652PSIP/)) -{ - RFCustom.ieee = ["ieee154p10"]; - var rfCodeExportConfig = RFCustom.radioConfigieee154p10.codeExportConfig -} -else -{ - RFCustom.ieee = ["ieee154"]; - var rfCodeExportConfig = RFCustom.radioConfigieee154.codeExportConfig -} - -var cmdList = [ - "cmdIeeeTx", - "cmdIeeeRx", - "cmdIeeeCsma", - "cmdIeeeEdScan", - "cmdIeeeRxAck", - "cmdTxTest" -]; - -rfCodeExportConfig.useConst = true; -rfCodeExportConfig.useMulti = true; -rfCodeExportConfig.symGenMethod = "Custom"; - -const deviceId = system.deviceData.deviceId; - -// Add high PA options if present -if(deviceId.match(/CC(265[12]R|2674R|1352R1|1354R)/)) -{ - cmdList.push("cmdRadioSetup"); - rfCodeExportConfig.cmdRadioSetup = "RF_cmdIeeeRadioSetup"; -} -else if(deviceId.match(/CC(265[12]P|2674P|1352P)/)) -{ - cmdList.push("cmdRadioSetupPa"); - rfCodeExportConfig.cmdRadioSetupPa = "RF_cmdIeeeRadioSetup"; - rfCodeExportConfig.paExport = "combined"; -} -else if(deviceId.match(/CC(265[34]|1354)P/)) -{ - cmdList.push("cmdRadioSetupPa"); - rfCodeExportConfig.cmdRadioSetupPa = "RF_cmdIeeeRadioSetup"; - // currently not characterized for high PA -} -else -{ - throw new Error("Could not match platform to any known platform types"); -} - -rfCodeExportConfig.cmdList_ieee_15_4 = cmdList; - -/* Red LED */ -LED1.$name = "CONFIG_LED_RED"; -LED1.$hardware = system.deviceData.board.components.LED_RED; -LED1.gpioPin.$name = "CONFIG_GPIO_RLED"; -LED1.gpioPin.mode = "Output"; -LED1.gpioPin.callbackFunction = ""; - -/* Green LED */ -LED2.$name = "CONFIG_LED_GREEN"; -LED2.$hardware = system.deviceData.board.components.LED_GREEN; -LED2.gpioPin.$name = "CONFIG_GPIO_GLED"; -LED2.gpioPin.mode = "Output"; -LED2.gpioPin.callbackFunction = ""; - -/* Debug UART */ -UART2.$hardware = system.deviceData.board.components.XDS110UART; -UART2.$name = "CONFIG_UART2_DEBUG"; - -/* TRNG */ -TRNG1.$name = "CONFIG_TRNG_0"; -TRNG2.$name = "CONFIG_TRNG_THREAD"; -TRNG3.$name = "CONFIG_TRNG_APP"; - -/* BLE */ -ble.addressMode = "ADDRMODE_RP_WITH_PUBLIC_ID"; -ble.maxConnNum = 1; -ble.numOfAdvSets = 1; -ble.lockProject = true; -ble.oneLibSizeOpt = true; -ble.maxPDUSize = 255; -ble.radioConfig.codeExportConfig.$name = "ti_devices_radioconfig_code_export_param2"; -ble.connUpdateParamsPeripheral.$name = "ti_ble5stack_general_ble_conn_update_params0"; -ble.connUpdateParamsPeripheral.reqMinConnInt = 30; -ble.connUpdateParamsPeripheral.reqMaxConnInt = 50; - - -ble.advSet1.$name = "ti_ble5stack_broadcaster_advertisement_set0"; -ble.advSet1.advParam1.$name = "ti_ble5stack_broadcaster_advertisement_params0"; - -/* DMM */ -dmm.project = "ti_thread_thermostat_remote_display"; -dmm.stackRoles = ["blePeripheral","threadFTD"]; -dmm.lockStackRoles = true; -dmm.numApplicationStates = 10; -dmm.applicationState0 = "ANY"; -dmm.applicationState1 = "DMMPOLICY_BLE_IDLE"; -dmm.applicationState2 = "DMMPOLICY_BLE_ADV"; -dmm.applicationState3 = "DMMPOLICY_BLE_CONNECTING"; -dmm.applicationState4 = "DMMPOLICY_BLE_HIGH_BANDWIDTH"; -dmm.applicationState5 = "DMMPOLICY_BLE_CONNECTED"; -dmm.applicationState6 = "DMMPOLICY_BLE_OAD"; -dmm.applicationState7 = "DMMPOLICY_THREAD_IDLE"; -dmm.applicationState8 = "DMMPOLICY_THREAD_LINK_EST"; -dmm.applicationState9 = "DMMPOLICY_THREAD_DATA"; -dmm.policyArray.create(4); -dmm.policyArray[0].$name = "ti_dmm_policy_dmm_policy0"; -dmm.policyArray[0].blePeripheral.$name = "ti_dmm_policy_stack_dmm_stack_ble0"; -dmm.policyArray[0].blePeripheral.applicationStates = ["applicationState6"]; -dmm.policyArray[0].threadFTD.$name = "ti_dmm_policy_stack_dmm_stack_thread0"; -dmm.policyArray[0].threadFTD.pause = "DMMPOLICY_PAUSED"; -dmm.policyArray[1].$name = "ti_dmm_policy_dmm_policy1"; -dmm.policyArray[1].blePeripheral.$name = "ti_dmm_policy_stack_dmm_stack_ble1"; -dmm.policyArray[1].blePeripheral.applicationStates = ["applicationState3","applicationState4"]; -dmm.policyArray[1].blePeripheral.weight = 25; -dmm.policyArray[1].blePeripheral.appliedActivity = ["DMMPOLICY_APPLIED_ACTIVITY_BLE_CONNECTION"]; -dmm.policyArray[1].threadFTD.$name = "ti_dmm_policy_stack_dmm_stack_thread1"; -dmm.policyArray[2].$name = "ti_dmm_policy_dmm_policy2"; -dmm.policyArray[2].blePeripheral.$name = "ti_dmm_policy_stack_dmm_stack_ble2"; -dmm.policyArray[2].threadFTD.$name = "ti_dmm_policy_stack_dmm_stack_thread2"; -dmm.policyArray[2].threadFTD.weight = 30; -dmm.policyArray[2].threadFTD.applicationStates = ["applicationState8"]; -dmm.policyArray[2].threadFTD.appliedActivity = ["DMMPOLICY_APPLIED_ACTIVITY_ALL"]; -dmm.policyArray[3].$name = "ti_dmm_policy_dmm_policy3"; -dmm.policyArray[3].blePeripheral.$name = "ti_dmm_policy_stack_dmm_stack_ble3"; -dmm.policyArray[3].threadFTD.$name = "ti_dmm_policy_stack_dmm_stack_thread3"; -dmm.policyArray[3].threadFTD.weight = 1; diff --git a/examples/persistent-storage/cc13x2x7_26x2x7/include/AppConfig.h b/examples/persistent-storage/cc13x2x7_26x2x7/include/AppConfig.h deleted file mode 100644 index 77f2cc37421d36..00000000000000 --- a/examples/persistent-storage/cc13x2x7_26x2x7/include/AppConfig.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2020 Project CHIP Authors - * All rights reserved. - * - * 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. - */ - -#ifndef APP_CONFIG_H -#define APP_CONFIG_H - -// Logging -#ifdef __cplusplus -extern "C" { -#endif - -int cc13x2_26x2LogInit(void); -void cc13x2_26x2Log(const char * aFormat, ...); -#define PLAT_LOG(...) cc13x2_26x2Log(__VA_ARGS__); - -#ifdef __cplusplus -} -#endif -#endif // APP_CONFIG_H diff --git a/examples/persistent-storage/cc13x2x7_26x2x7/include/CHIPProjectConfig.h b/examples/persistent-storage/cc13x2x7_26x2x7/include/CHIPProjectConfig.h deleted file mode 100644 index 2bcf489732b312..00000000000000 --- a/examples/persistent-storage/cc13x2x7_26x2x7/include/CHIPProjectConfig.h +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Copyright (c) 2020 Project CHIP Authors - * Copyright (c) 2019 Google LLC. - * All rights reserved. - * - * 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. - */ - -/** - * @file - * Example project configuration file for CHIP. - * - * This is a place to put application or project-specific overrides - * to the default configuration values for general CHIP features. - * - */ - -#ifndef CHIP_PROJECT_CONFIG_H -#define CHIP_PROJECT_CONFIG_H - -#if BUILD_RELEASE // release build - -// Security and Authentication enabled for release build. -#define CHIP_CONFIG_SECURITY_TEST_MODE 0 - -#else // development build - -// Security and Authentication disabled for development build. -// For convenience, enable CHIP Security Test Mode and disable the requirement for -// authentication in various protocols. -// WARNING: These options make it possible to circumvent basic CHIP security functionality, -// including message encryption. Because of this they MUST NEVER BE ENABLED IN PRODUCTION BUILDS. -#define CHIP_CONFIG_SECURITY_TEST_MODE 0 - -// Use a default pairing code if one hasn't been provisioned in flash. -#define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE 20202021 -#define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR 0xF00 - -/** - * CHIP_DEVICE_CONFIG_TEST_SERIAL_NUMBER - * - * Enables the use of a hard-coded default serial number if none - * is found in CHIP NV storage. - */ -#define CHIP_DEVICE_CONFIG_TEST_SERIAL_NUMBER "TEST_SN" - -#endif // BUILD_RELEASE - -/** - * CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID - * - * 0xFFF1: Test vendor. - */ -#define CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID 0xFFF1 - -/** - * CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID - * - * 0x8009: example persistent-storage - */ -#define CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID 0x8009 - -/** - * CHIP_DEVICE_CONFIG_DEVICE_HARDWARE_VERSION - * - * The hardware version number assigned to device or product by the device vendor. This - * number is scoped to the device product id, and typically corresponds to a revision of the - * physical device, a change to its packaging, and/or a change to its marketing presentation. - * This value is generally *not* incremented for device software versions. - */ -#define CHIP_DEVICE_CONFIG_DEVICE_HARDWARE_VERSION 1 - -/** - * CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING - * - * A string identifying the software version running on the device. - * CHIP currently expects the software version to be in the format - * {MAJOR_VERSION}.0d{MINOR_VERSION} - */ -#ifndef CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING -#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING "1.0d1" -#endif -/** - * CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE - * - * Enable support for CHIP-over-BLE (CHIPOBLE). - */ -#define CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE 1 - -/** - * CHIP_DEVICE_CONFIG_EVENT_LOGGING_DEBUG_BUFFER_SIZE - * - * A size, in bytes, of the individual debug event logging buffer. - */ -#define CHIP_DEVICE_CONFIG_EVENT_LOGGING_DEBUG_BUFFER_SIZE (512) - -/** - * CHIP_DEVICE_CONFIG_ENABLE_THREAD_SRP_CLIENT - * - * Enable the OpenThread SRP client to allow for CHIP device discovery. - */ -#define CHIP_DEVICE_CONFIG_ENABLE_THREAD_SRP_CLIENT 1 - -/** - * CHIP_CONFIG_EVENT_LOGGING_DEFAULT_IMPORTANCE - * - * For a development build, set the default importance of events to be logged as Debug. - * Since debug is the lowest importance level, this means all standard, critical, info and - * debug importance level vi events get logged. - */ -#if BUILD_RELEASE -#define CHIP_CONFIG_EVENT_LOGGING_DEFAULT_IMPORTANCE chip::Profiles::DataManagement::Production -#else -#define CHIP_CONFIG_EVENT_LOGGING_DEFAULT_IMPORTANCE chip::Profiles::DataManagement::Debug -#endif // BUILD_RELEASE - -/** - * @def CHIP_IM_MAX_NUM_COMMAND_HANDLER - * - * @brief Defines the maximum number of CommandHandler, limits the number of active commands transactions on server. - */ -#define CHIP_IM_MAX_NUM_COMMAND_HANDLER 2 - -/** - * @def CHIP_IM_MAX_NUM_WRITE_HANDLER - * - * @brief Defines the maximum number of WriteHandler, limits the number of active write transactions on server. - */ -#define CHIP_IM_MAX_NUM_WRITE_HANDLER 2 - -#endif // CHIP_PROJECT_CONFIG_H diff --git a/examples/persistent-storage/cc13x2x7_26x2x7/include/OpenThreadConfig.h b/examples/persistent-storage/cc13x2x7_26x2x7/include/OpenThreadConfig.h deleted file mode 100644 index 4079b251280ddc..00000000000000 --- a/examples/persistent-storage/cc13x2x7_26x2x7/include/OpenThreadConfig.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * - * Copyright (c) 2020 Project CHIP Authors - * Copyright (c) 2019 Google LLC. - * All rights reserved. - * - * 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. - */ - -/** - * @file - * Overrides to default OpenThread configuration. - * - */ - -#ifndef OPENTHREAD_PLATFORM_CONFIG_H -#define OPENTHREAD_PLATFORM_CONFIG_H - -// Disable the Nordic-supplied OpenThread logging facilities and use -// the facilities provided by the CHIP Device Layer -#define OPENTHREAD_CONFIG_LOG_OUTPUT OPENTHREAD_CONFIG_LOG_OUTPUT_APP - -// When operating in a less than ideal RF environment, having a more forgiving configuration -// of OpenThread makes thread a great deal more reliable. -#define OPENTHREAD_CONFIG_TMF_ADDRESS_QUERY_MAX_RETRY_DELAY 120 // default is 28800 -#define OPENTHREAD_CONFIG_MAC_DEFAULT_MAX_FRAME_RETRIES_DIRECT 15 // default is 3 -#define OPENTHREAD_CONFIG_MAC_DEFAULT_MAX_FRAME_RETRIES_INDIRECT 1 // default is 0 -#define OPENTHREAD_CONFIG_MAC_MAX_TX_ATTEMPTS_INDIRECT_POLLS 16 // default is 4 - -// Enable periodic parent search to speed up finding a better parent. -#define OPENTHREAD_CONFIG_PARENT_SEARCH_ENABLE 1 // default is 0 -#define OPENTHREAD_CONFIG_PARENT_SEARCH_RSS_THRESHOLD -45 // default is -65 -#define OPENTHREAD_CONFIG_MLE_INFORM_PREVIOUS_PARENT_ON_REATTACH 1 // default is 0 - -// Use smaller maximum interval to speed up reattaching. -#define OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_MAXIMUM_INTERVAL (60 * 10 * 1000) // default 1200000 ms - -#define OPENTHREAD_CONFIG_JOINER_ENABLE 1 -#define OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE 0 -#define UART_AS_SERIAL_TRANSPORT 1 -#define OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE 1 - -#define OPENTHREAD_CONFIG_IP6_SLAAC_ENABLE 1 -#define OPENTHREAD_CONFIG_ECDSA_ENABLE 1 -#define OPENTHREAD_CONFIG_SRP_CLIENT_ENABLE 1 - -// Use the TI-supplied default platform configuration for remainder -#include "openthread-core-cc13x2_26x2-config.h" - -#endif // OPENTHREAD_PLATFORM_CONFIG_H diff --git a/examples/persistent-storage/cc13x2x7_26x2x7/main.cpp b/examples/persistent-storage/cc13x2x7_26x2x7/main.cpp deleted file mode 100644 index 15e439fddb667b..00000000000000 --- a/examples/persistent-storage/cc13x2x7_26x2x7/main.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/* - * - * Copyright (c) 2020 Project CHIP Authors - * Copyright (c) 2020 Texas Instruments Incorporated - * - * 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. - */ - -#include -#include - -#include - -#include "KeyValueStorageTest.h" -#include - -#include -#include - -/* Driver Header files */ -#include -#include -#include - -#include -#define TOTAL_ICALL_HEAP_SIZE (0xf000) - -__attribute__((section(".heap"))) uint8_t GlobalHeapZoneBuffer[TOTAL_ICALL_HEAP_SIZE]; -uint32_t heapSize = TOTAL_ICALL_HEAP_SIZE; - -// ================================================================================ -// FreeRTOS Callbacks -// ================================================================================ -extern "C" void vApplicationStackOverflowHook(void) -{ - while (true) - { - ; - } -} - -// ================================================================================ -// Main Code -// ================================================================================ - -static TaskHandle_t sTestTaskHandle; -void TestTask(void * pvParameter) -{ - cc13x2_26x2LogInit(); - - chip::DeviceLayer::Internal::CC13X2_26X2Config().Init(); - - while (true) - { - PLAT_LOG("Running Tests:"); - chip::RunKvsTest(); - vTaskDelay(60 * configTICK_RATE_HZ); // Run every minute - } -} - -int main(void) -{ - Board_init(); - bpool((void *) GlobalHeapZoneBuffer, TOTAL_ICALL_HEAP_SIZE); - - NVS_init(); - - UART_init(); - - // Run tests - xTaskCreate(TestTask, "Test", 2048, NULL, 1, &sTestTaskHandle); - - vTaskStartScheduler(); - - // Should never get here. - while (true) - ; -} diff --git a/examples/persistent-storage/cc13x2x7_26x2x7/third_party/connectedhomeip b/examples/persistent-storage/cc13x2x7_26x2x7/third_party/connectedhomeip deleted file mode 120000 index c866b86874994d..00000000000000 --- a/examples/persistent-storage/cc13x2x7_26x2x7/third_party/connectedhomeip +++ /dev/null @@ -1 +0,0 @@ -../../../.. \ No newline at end of file diff --git a/examples/pigweed-app/ameba/README.md b/examples/pigweed-app/ameba/README.md index c9bd9f82ce7a35..49c7de27831809 100644 --- a/examples/pigweed-app/ameba/README.md +++ b/examples/pigweed-app/ameba/README.md @@ -31,11 +31,11 @@ following features are available: - Pull docker image: - $ docker pull ghcr.io/project-chip/chip-build-ameba:42 + $ docker pull ghcr.io/project-chip/chip-build-ameba:47 - Run docker container: - $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:42 + $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:47 - Setup build environment: diff --git a/examples/placeholder/linux/InteractiveServer.cpp b/examples/placeholder/linux/InteractiveServer.cpp index daebcb6dfc6cfa..10d82ba5a902bc 100644 --- a/examples/placeholder/linux/InteractiveServer.cpp +++ b/examples/placeholder/linux/InteractiveServer.cpp @@ -19,10 +19,14 @@ #include "InteractiveServer.h" #include +#include #include #include #include +#include +#include + using namespace chip::DeviceLayer; namespace { diff --git a/examples/placeholder/linux/include/static-supported-modes-manager.h b/examples/placeholder/linux/include/static-supported-modes-manager.h index ef90de38697f4c..b4ce50b8cd49a3 100644 --- a/examples/placeholder/linux/include/static-supported-modes-manager.h +++ b/examples/placeholder/linux/include/static-supported-modes-manager.h @@ -19,7 +19,6 @@ #pragma once #include -#include #include #include diff --git a/examples/placeholder/linux/include/static-supported-temperature-levels.h b/examples/placeholder/linux/include/static-supported-temperature-levels.h index 3fdce87e109317..9698df8c094cc8 100644 --- a/examples/placeholder/linux/include/static-supported-temperature-levels.h +++ b/examples/placeholder/linux/include/static-supported-temperature-levels.h @@ -19,7 +19,6 @@ #pragma once #include -#include #include namespace chip { diff --git a/examples/placeholder/linux/src/bridged-actions-stub.cpp b/examples/placeholder/linux/src/bridged-actions-stub.cpp index 5df0ba11f74011..ea6e824738a857 100644 --- a/examples/placeholder/linux/src/bridged-actions-stub.cpp +++ b/examples/placeholder/linux/src/bridged-actions-stub.cpp @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include diff --git a/examples/platform/cc13x2_26x2/BUILD.gn b/examples/platform/cc13x2_26x2/BUILD.gn deleted file mode 100644 index 06beceb9d75d01..00000000000000 --- a/examples/platform/cc13x2_26x2/BUILD.gn +++ /dev/null @@ -1,44 +0,0 @@ -# Copyright (c) 2020 Project CHIP Authors -# -# 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. - -import("//build_overrides/chip.gni") - -config("chip_examples_project_config") { - include_dirs = [ "project_include" ] -} - -source_set("openthread_core_config_cc13x2_26x2_chip_examples") { - sources = [ "project_include/OpenThreadConfig.h" ] - public_configs = [ ":chip_examples_project_config" ] -} - -config("attestation-credentials-config") { - include_dirs = [ "${chip_root}" ] - - defines = [ "CC13X2_26X2_ATTESTATION_CREDENTIALS" ] -} - -source_set("cc13x2_26x2-attestation-credentials") { - sources = [ - "CC13X2_26X2DeviceAttestationCreds.cpp", - "CC13X2_26X2DeviceAttestationCreds.h", - ] - - public_deps = [ - "${chip_root}/src/credentials", - "${chip_root}/src/platform:platform_base", - ] - - public_configs = [ ":attestation-credentials-config" ] -} diff --git a/examples/platform/cc13x2_26x2/CC13X2_26X2DeviceAttestationCreds.cpp b/examples/platform/cc13x2_26x2/CC13X2_26X2DeviceAttestationCreds.cpp deleted file mode 100644 index aa3469b030f4c7..00000000000000 --- a/examples/platform/cc13x2_26x2/CC13X2_26X2DeviceAttestationCreds.cpp +++ /dev/null @@ -1,258 +0,0 @@ -/* - * - * Copyright (c) 2022 Project CHIP Authors - * - * 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. - */ -#include "CC13X2_26X2DeviceAttestationCreds.h" -#include -#include -#include -#include - -extern uint32_t __attestation_credentials_base; - -namespace chip { -namespace Credentials { -namespace CC13X2_26X2 { - -namespace { -typedef struct -{ - const uint32_t len; - uint8_t const * data; -} data_ptr; - -typedef struct -{ - data_ptr dac_priv_key; - data_ptr dac_pub_key; - data_ptr dac_cert; - data_ptr pai_cert; -} factoryData; - -const uint8_t gDacPrivKey[] = { - 0x50, 0x5a, 0x21, 0x1d, 0xbd, 0xa8, 0x71, 0x33, 0x0d, 0x63, 0x5d, 0xa3, 0xb0, 0x7e, 0xb1, 0xc5, - 0x08, 0x8a, 0x8f, 0xc7, 0x01, 0x24, 0xfb, 0xb3, 0x3e, 0x93, 0xd5, 0x06, 0x05, 0x82, 0xc7, 0xc5, -}; - -const uint8_t gDacPubKey[] = { - 0x04, 0xc5, 0x65, 0xfd, 0xad, 0xfd, 0x16, 0xdd, 0x62, 0xe4, 0x3f, 0x19, 0x60, 0xb9, 0x93, 0xbb, 0x57, - 0x2c, 0xfd, 0xd8, 0x1f, 0x6d, 0x71, 0x67, 0x67, 0x1b, 0x77, 0x45, 0xdc, 0xbe, 0x6f, 0x65, 0xaf, 0x66, - 0x5a, 0x1d, 0x93, 0x1c, 0x05, 0xb9, 0xf9, 0xa3, 0xe9, 0x45, 0x66, 0x85, 0x60, 0x2c, 0x05, 0xc6, 0x96, - 0x46, 0xb8, 0xf7, 0x59, 0x98, 0xdb, 0xaa, 0x68, 0x7a, 0x5c, 0x56, 0x49, 0x02, 0xda, -}; - -const uint8_t gDacCert[] = { - 0x30, 0x82, 0x01, 0xf7, 0x30, 0x82, 0x01, 0x9d, 0xa0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x08, 0x46, 0x88, 0xeb, 0x94, 0xad, 0x32, - 0xb2, 0xe4, 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x30, 0x4d, 0x31, 0x1f, 0x30, 0x1d, 0x06, - 0x03, 0x55, 0x04, 0x03, 0x0c, 0x16, 0x4d, 0x61, 0x74, 0x74, 0x65, 0x72, 0x20, 0x44, 0x65, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x6d, - 0x65, 0x6e, 0x74, 0x20, 0x50, 0x41, 0x49, 0x31, 0x14, 0x30, 0x12, 0x06, 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0xa2, 0x7c, - 0x02, 0x01, 0x0c, 0x04, 0x46, 0x46, 0x46, 0x31, 0x31, 0x14, 0x30, 0x12, 0x06, 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0xa2, - 0x7c, 0x02, 0x02, 0x0c, 0x04, 0x38, 0x30, 0x30, 0x36, 0x30, 0x20, 0x17, 0x0d, 0x32, 0x31, 0x30, 0x36, 0x32, 0x38, 0x31, 0x34, - 0x32, 0x33, 0x34, 0x33, 0x5a, 0x18, 0x0f, 0x39, 0x39, 0x39, 0x39, 0x31, 0x32, 0x33, 0x31, 0x32, 0x33, 0x35, 0x39, 0x35, 0x39, - 0x5a, 0x30, 0x52, 0x31, 0x24, 0x30, 0x22, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x1b, 0x4d, 0x61, 0x74, 0x74, 0x65, 0x72, 0x20, - 0x44, 0x65, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x44, 0x41, 0x43, 0x20, 0x30, 0x30, 0x30, 0x30, 0x31, - 0x14, 0x30, 0x12, 0x06, 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0xa2, 0x7c, 0x02, 0x01, 0x0c, 0x04, 0x46, 0x46, 0x46, 0x31, - 0x31, 0x14, 0x30, 0x12, 0x06, 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0xa2, 0x7c, 0x02, 0x02, 0x0c, 0x04, 0x38, 0x30, 0x30, - 0x36, 0x30, 0x59, 0x30, 0x13, 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02, 0x01, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, - 0x03, 0x01, 0x07, 0x03, 0x42, 0x00, 0x04, 0xc5, 0x65, 0xfd, 0xad, 0xfd, 0x16, 0xdd, 0x62, 0xe4, 0x3f, 0x19, 0x60, 0xb9, 0x93, - 0xbb, 0x57, 0x2c, 0xfd, 0xd8, 0x1f, 0x6d, 0x71, 0x67, 0x67, 0x1b, 0x77, 0x45, 0xdc, 0xbe, 0x6f, 0x65, 0xaf, 0x66, 0x5a, 0x1d, - 0x93, 0x1c, 0x05, 0xb9, 0xf9, 0xa3, 0xe9, 0x45, 0x66, 0x85, 0x60, 0x2c, 0x05, 0xc6, 0x96, 0x46, 0xb8, 0xf7, 0x59, 0x98, 0xdb, - 0xaa, 0x68, 0x7a, 0x5c, 0x56, 0x49, 0x02, 0xda, 0xa3, 0x60, 0x30, 0x5e, 0x30, 0x0c, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x01, 0x01, - 0xff, 0x04, 0x02, 0x30, 0x00, 0x30, 0x0e, 0x06, 0x03, 0x55, 0x1d, 0x0f, 0x01, 0x01, 0xff, 0x04, 0x04, 0x03, 0x02, 0x07, 0x80, - 0x30, 0x1d, 0x06, 0x03, 0x55, 0x1d, 0x0e, 0x04, 0x16, 0x04, 0x14, 0x9b, 0x40, 0x60, 0x6f, 0x9e, 0x04, 0x7f, 0xb8, 0x60, 0x78, - 0x8e, 0x3d, 0xc1, 0x12, 0xd7, 0x5e, 0x87, 0x95, 0x77, 0x68, 0x30, 0x1f, 0x06, 0x03, 0x55, 0x1d, 0x23, 0x04, 0x18, 0x30, 0x16, - 0x80, 0x14, 0x43, 0x34, 0x57, 0x12, 0xba, 0x2c, 0x87, 0xef, 0x25, 0x49, 0x7b, 0x11, 0xd7, 0x98, 0x58, 0x9b, 0x84, 0x35, 0x7f, - 0x88, 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x03, 0x48, 0x00, 0x30, 0x45, 0x02, 0x21, 0x00, - 0xb9, 0x28, 0xf9, 0x3e, 0xe3, 0x87, 0xef, 0x3e, 0x00, 0x72, 0x88, 0x22, 0x84, 0xbd, 0x8a, 0xdd, 0x5c, 0xd6, 0xd0, 0x55, 0x81, - 0xbf, 0xcc, 0x55, 0x17, 0xcf, 0x9e, 0x9b, 0xcd, 0xd4, 0x37, 0xda, 0x02, 0x20, 0x10, 0x07, 0x9c, 0xcf, 0x7f, 0x1f, 0x2d, 0xda, - 0x46, 0xac, 0xe9, 0x67, 0xae, 0x5b, 0xe9, 0x66, 0xe7, 0xf2, 0x8a, 0xdf, 0xa0, 0x28, 0xb8, 0xf8, 0x7f, 0x93, 0x9e, 0xd4, 0x15, - 0x8d, 0xc0, 0xf8, -}; - -const uint8_t gPaiCert[] = { - 0x30, 0x82, 0x01, 0xdc, 0x30, 0x82, 0x01, 0x81, 0xa0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x08, 0x7f, 0x7e, 0xf3, 0xdb, 0x08, 0xa3, - 0x8f, 0x68, 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x30, 0x30, 0x31, 0x18, 0x30, 0x16, 0x06, - 0x03, 0x55, 0x04, 0x03, 0x0c, 0x0f, 0x4d, 0x61, 0x74, 0x74, 0x65, 0x72, 0x20, 0x54, 0x65, 0x73, 0x74, 0x20, 0x50, 0x41, 0x41, - 0x31, 0x14, 0x30, 0x12, 0x06, 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0xa2, 0x7c, 0x02, 0x01, 0x0c, 0x04, 0x46, 0x46, 0x46, - 0x31, 0x30, 0x20, 0x17, 0x0d, 0x32, 0x31, 0x30, 0x36, 0x32, 0x38, 0x31, 0x34, 0x32, 0x33, 0x34, 0x33, 0x5a, 0x18, 0x0f, 0x39, - 0x39, 0x39, 0x39, 0x31, 0x32, 0x33, 0x31, 0x32, 0x33, 0x35, 0x39, 0x35, 0x39, 0x5a, 0x30, 0x4d, 0x31, 0x1f, 0x30, 0x1d, 0x06, - 0x03, 0x55, 0x04, 0x03, 0x0c, 0x16, 0x4d, 0x61, 0x74, 0x74, 0x65, 0x72, 0x20, 0x44, 0x65, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x6d, - 0x65, 0x6e, 0x74, 0x20, 0x50, 0x41, 0x49, 0x31, 0x14, 0x30, 0x12, 0x06, 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0xa2, 0x7c, - 0x02, 0x01, 0x0c, 0x04, 0x46, 0x46, 0x46, 0x31, 0x31, 0x14, 0x30, 0x12, 0x06, 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0xa2, - 0x7c, 0x02, 0x02, 0x0c, 0x04, 0x38, 0x30, 0x30, 0x36, 0x30, 0x59, 0x30, 0x13, 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02, - 0x01, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, 0x07, 0x03, 0x42, 0x00, 0x04, 0x42, 0x93, 0x55, 0x77, 0x35, 0x35, - 0x15, 0xce, 0xfa, 0x8f, 0x0e, 0x30, 0xe2, 0x34, 0x7e, 0x90, 0xee, 0xd6, 0xfd, 0x51, 0x5b, 0xe8, 0x82, 0xd1, 0xbc, 0xba, 0x74, - 0x83, 0xd7, 0xff, 0x6e, 0xf4, 0xde, 0xdf, 0x98, 0xf7, 0xf7, 0x4f, 0x17, 0x42, 0x1d, 0xe5, 0x45, 0x0c, 0xff, 0xfb, 0x3e, 0x7f, - 0x6d, 0x4f, 0x62, 0x28, 0x53, 0x41, 0x14, 0xfb, 0xb8, 0x5c, 0x2d, 0x52, 0xd1, 0x82, 0xb6, 0x6a, 0xa3, 0x66, 0x30, 0x64, 0x30, - 0x12, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x01, 0x01, 0xff, 0x04, 0x08, 0x30, 0x06, 0x01, 0x01, 0xff, 0x02, 0x01, 0x00, 0x30, 0x0e, - 0x06, 0x03, 0x55, 0x1d, 0x0f, 0x01, 0x01, 0xff, 0x04, 0x04, 0x03, 0x02, 0x01, 0x06, 0x30, 0x1d, 0x06, 0x03, 0x55, 0x1d, 0x0e, - 0x04, 0x16, 0x04, 0x14, 0x43, 0x34, 0x57, 0x12, 0xba, 0x2c, 0x87, 0xef, 0x25, 0x49, 0x7b, 0x11, 0xd7, 0x98, 0x58, 0x9b, 0x84, - 0x35, 0x7f, 0x88, 0x30, 0x1f, 0x06, 0x03, 0x55, 0x1d, 0x23, 0x04, 0x18, 0x30, 0x16, 0x80, 0x14, 0x6a, 0xfd, 0x22, 0x77, 0x1f, - 0x51, 0x1f, 0xec, 0xbf, 0x16, 0x41, 0x97, 0x67, 0x10, 0xdc, 0xdc, 0x31, 0xa1, 0x71, 0x7e, 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, - 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x03, 0x49, 0x00, 0x30, 0x46, 0x02, 0x21, 0x00, 0xff, 0x25, 0xf1, 0xd1, 0x54, 0xc3, 0x13, - 0x7e, 0x0e, 0x08, 0x6d, 0x82, 0xab, 0x0b, 0x11, 0xb5, 0x66, 0x18, 0x39, 0xb7, 0x12, 0xb1, 0x34, 0x2c, 0x6c, 0xde, 0x94, 0xfb, - 0xe3, 0x18, 0xa9, 0x2b, 0x02, 0x21, 0x00, 0x92, 0xe2, 0x81, 0xf9, 0x8a, 0x2f, 0xcc, 0x14, 0xcd, 0xf4, 0x07, 0x50, 0xd2, 0x80, - 0xd7, 0xdf, 0xea, 0x3f, 0x4d, 0xa4, 0x6f, 0x35, 0x7a, 0xfe, 0xac, 0xb8, 0x9b, 0x26, 0x77, 0x06, 0xd2, 0x8a, -}; - -const factoryData gFactoryData = -{ - .dac_priv_key = { - .len = sizeof(gDacPrivKey), - .data = gDacPrivKey, - }, - .dac_pub_key = { - .len = sizeof(gDacPubKey), - .data = gDacPubKey, - }, - .dac_cert = { - .len = sizeof(gDacCert), - .data = gDacCert, - }, - .pai_cert = { - .len = sizeof(gPaiCert), - .data = gPaiCert, - }, -}; - -CHIP_ERROR LoadKeypairFromRaw(ByteSpan private_key, ByteSpan public_key, Crypto::P256Keypair & keypair) -{ - Crypto::P256SerializedKeypair serialized_keypair; - ReturnErrorOnFailure(serialized_keypair.SetLength(private_key.size() + public_key.size())); - memcpy(serialized_keypair.Bytes(), public_key.data(), public_key.size()); - memcpy(serialized_keypair.Bytes() + public_key.size(), private_key.data(), private_key.size()); - return keypair.Deserialize(serialized_keypair); -} - -class DeviceAttestationCredsCC13X2_26X2 : public DeviceAttestationCredentialsProvider -{ - -public: - CHIP_ERROR GetCertificationDeclaration(MutableByteSpan & out_buffer) override; - CHIP_ERROR GetFirmwareInformation(MutableByteSpan & out_firmware_info_buffer) override; - CHIP_ERROR GetDeviceAttestationCert(MutableByteSpan & out_buffer) override; - CHIP_ERROR GetProductAttestationIntermediateCert(MutableByteSpan & out_buffer) override; - CHIP_ERROR SignWithDeviceAttestationKey(const ByteSpan & message_to_sign, MutableByteSpan & out_buffer) override; - -private: - factoryData const * mFactoryData = &gFactoryData; -}; - -CHIP_ERROR DeviceAttestationCredsCC13X2_26X2::GetCertificationDeclaration(MutableByteSpan & out_buffer) -{ - //-> format_version = 1 - //-> vendor_id = 0xFFF1 - //-> product_id_array = [ 0x8000, 0x8001, 0x8002, 0x8003, 0x8004, 0x8005, 0x8006, 0x8007, 0x8008, 0x8009, 0x800A, 0x800B, - // 0x800C, 0x800D, 0x800E, 0x800F, 0x8010, 0x8011, 0x8012, 0x8013, 0x8014, 0x8015, 0x8016, 0x8017, 0x8018, 0x8019, 0x801A, - // 0x801B, 0x801C, 0x801D, 0x801E, 0x801F, 0x8020, 0x8021, 0x8022, 0x8023, 0x8024, 0x8025, 0x8026, 0x8027, 0x8028, 0x8029, - // 0x802A, 0x802B, 0x802C, 0x802D, 0x802E, 0x802F, 0x8030, 0x8031, 0x8032, 0x8033, 0x8034, 0x8035, 0x8036, 0x8037, 0x8038, - // 0x8039, 0x803A, 0x803B, 0x803C, 0x803D, 0x803E, 0x803F, 0x8040, 0x8041, 0x8042, 0x8043, 0x8044, 0x8045, 0x8046, 0x8047, - // 0x8048, 0x8049, 0x804A, 0x804B, 0x804C, 0x804D, 0x804E, 0x804F, 0x8050, 0x8051, 0x8052, 0x8053, 0x8054, 0x8055, 0x8056, - // 0x8057, 0x8058, 0x8059, 0x805A, 0x805B, 0x805C, 0x805D, 0x805E, 0x805F, 0x8060, 0x8061, 0x8062, 0x8063 ] - //-> device_type_id = 0x0016 - //-> certificate_id = "ZIG20142ZB330003-24" - //-> security_level = 0 - //-> security_information = 0 - //-> version_number = 0x2694 - //-> certification_type = 0 - //-> dac_origin_vendor_id is not present - //-> dac_origin_product_id is not present - static const uint8_t kCdForAllExamples[] = { - 0x30, 0x82, 0x02, 0x19, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x07, 0x02, 0xa0, 0x82, 0x02, 0x0a, 0x30, - 0x82, 0x02, 0x06, 0x02, 0x01, 0x03, 0x31, 0x0d, 0x30, 0x0b, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, - 0x01, 0x30, 0x82, 0x01, 0x71, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x07, 0x01, 0xa0, 0x82, 0x01, 0x62, - 0x04, 0x82, 0x01, 0x5e, 0x15, 0x24, 0x00, 0x01, 0x25, 0x01, 0xf1, 0xff, 0x36, 0x02, 0x05, 0x00, 0x80, 0x05, 0x01, 0x80, - 0x05, 0x02, 0x80, 0x05, 0x03, 0x80, 0x05, 0x04, 0x80, 0x05, 0x05, 0x80, 0x05, 0x06, 0x80, 0x05, 0x07, 0x80, 0x05, 0x08, - 0x80, 0x05, 0x09, 0x80, 0x05, 0x0a, 0x80, 0x05, 0x0b, 0x80, 0x05, 0x0c, 0x80, 0x05, 0x0d, 0x80, 0x05, 0x0e, 0x80, 0x05, - 0x0f, 0x80, 0x05, 0x10, 0x80, 0x05, 0x11, 0x80, 0x05, 0x12, 0x80, 0x05, 0x13, 0x80, 0x05, 0x14, 0x80, 0x05, 0x15, 0x80, - 0x05, 0x16, 0x80, 0x05, 0x17, 0x80, 0x05, 0x18, 0x80, 0x05, 0x19, 0x80, 0x05, 0x1a, 0x80, 0x05, 0x1b, 0x80, 0x05, 0x1c, - 0x80, 0x05, 0x1d, 0x80, 0x05, 0x1e, 0x80, 0x05, 0x1f, 0x80, 0x05, 0x20, 0x80, 0x05, 0x21, 0x80, 0x05, 0x22, 0x80, 0x05, - 0x23, 0x80, 0x05, 0x24, 0x80, 0x05, 0x25, 0x80, 0x05, 0x26, 0x80, 0x05, 0x27, 0x80, 0x05, 0x28, 0x80, 0x05, 0x29, 0x80, - 0x05, 0x2a, 0x80, 0x05, 0x2b, 0x80, 0x05, 0x2c, 0x80, 0x05, 0x2d, 0x80, 0x05, 0x2e, 0x80, 0x05, 0x2f, 0x80, 0x05, 0x30, - 0x80, 0x05, 0x31, 0x80, 0x05, 0x32, 0x80, 0x05, 0x33, 0x80, 0x05, 0x34, 0x80, 0x05, 0x35, 0x80, 0x05, 0x36, 0x80, 0x05, - 0x37, 0x80, 0x05, 0x38, 0x80, 0x05, 0x39, 0x80, 0x05, 0x3a, 0x80, 0x05, 0x3b, 0x80, 0x05, 0x3c, 0x80, 0x05, 0x3d, 0x80, - 0x05, 0x3e, 0x80, 0x05, 0x3f, 0x80, 0x05, 0x40, 0x80, 0x05, 0x41, 0x80, 0x05, 0x42, 0x80, 0x05, 0x43, 0x80, 0x05, 0x44, - 0x80, 0x05, 0x45, 0x80, 0x05, 0x46, 0x80, 0x05, 0x47, 0x80, 0x05, 0x48, 0x80, 0x05, 0x49, 0x80, 0x05, 0x4a, 0x80, 0x05, - 0x4b, 0x80, 0x05, 0x4c, 0x80, 0x05, 0x4d, 0x80, 0x05, 0x4e, 0x80, 0x05, 0x4f, 0x80, 0x05, 0x50, 0x80, 0x05, 0x51, 0x80, - 0x05, 0x52, 0x80, 0x05, 0x53, 0x80, 0x05, 0x54, 0x80, 0x05, 0x55, 0x80, 0x05, 0x56, 0x80, 0x05, 0x57, 0x80, 0x05, 0x58, - 0x80, 0x05, 0x59, 0x80, 0x05, 0x5a, 0x80, 0x05, 0x5b, 0x80, 0x05, 0x5c, 0x80, 0x05, 0x5d, 0x80, 0x05, 0x5e, 0x80, 0x05, - 0x5f, 0x80, 0x05, 0x60, 0x80, 0x05, 0x61, 0x80, 0x05, 0x62, 0x80, 0x05, 0x63, 0x80, 0x18, 0x24, 0x03, 0x16, 0x2c, 0x04, - 0x13, 0x5a, 0x49, 0x47, 0x32, 0x30, 0x31, 0x34, 0x32, 0x5a, 0x42, 0x33, 0x33, 0x30, 0x30, 0x30, 0x33, 0x2d, 0x32, 0x34, - 0x24, 0x05, 0x00, 0x24, 0x06, 0x00, 0x25, 0x07, 0x94, 0x26, 0x24, 0x08, 0x00, 0x18, 0x31, 0x7d, 0x30, 0x7b, 0x02, 0x01, - 0x03, 0x80, 0x14, 0x62, 0xfa, 0x82, 0x33, 0x59, 0xac, 0xfa, 0xa9, 0x96, 0x3e, 0x1c, 0xfa, 0x14, 0x0a, 0xdd, 0xf5, 0x04, - 0xf3, 0x71, 0x60, 0x30, 0x0b, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x01, 0x30, 0x0a, 0x06, 0x08, - 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x04, 0x47, 0x30, 0x45, 0x02, 0x20, 0x24, 0xe5, 0xd1, 0xf4, 0x7a, 0x7d, - 0x7b, 0x0d, 0x20, 0x6a, 0x26, 0xef, 0x69, 0x9b, 0x7c, 0x97, 0x57, 0xb7, 0x2d, 0x46, 0x90, 0x89, 0xde, 0x31, 0x92, 0xe6, - 0x78, 0xc7, 0x45, 0xe7, 0xf6, 0x0c, 0x02, 0x21, 0x00, 0xf8, 0xaa, 0x2f, 0xa7, 0x11, 0xfc, 0xb7, 0x9b, 0x97, 0xe3, 0x97, - 0xce, 0xda, 0x66, 0x7b, 0xae, 0x46, 0x4e, 0x2b, 0xd3, 0xff, 0xdf, 0xc3, 0xcc, 0xed, 0x7a, 0xa8, 0xca, 0x5f, 0x4c, 0x1a, - 0x7c, - }; - - return CopySpanToMutableSpan(ByteSpan{ kCdForAllExamples }, out_buffer); -} - -CHIP_ERROR DeviceAttestationCredsCC13X2_26X2::GetFirmwareInformation(MutableByteSpan & out_firmware_info_buffer) -{ - out_firmware_info_buffer.reduce_size(0); - - return CHIP_NO_ERROR; -} - -CHIP_ERROR DeviceAttestationCredsCC13X2_26X2::GetDeviceAttestationCert(MutableByteSpan & out_buffer) -{ - ReturnErrorCodeIf(out_buffer.size() < mFactoryData->dac_cert.len, CHIP_ERROR_BUFFER_TOO_SMALL); - ReturnErrorCodeIf(!mFactoryData->dac_cert.data, CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND); - - return CopySpanToMutableSpan(ByteSpan{ mFactoryData->dac_cert.data, mFactoryData->dac_cert.len }, out_buffer); -} - -CHIP_ERROR DeviceAttestationCredsCC13X2_26X2::GetProductAttestationIntermediateCert(MutableByteSpan & out_buffer) -{ - ReturnErrorCodeIf(out_buffer.size() < mFactoryData->pai_cert.len, CHIP_ERROR_BUFFER_TOO_SMALL); - ReturnErrorCodeIf(!mFactoryData->pai_cert.data, CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND); - - return CopySpanToMutableSpan(ByteSpan{ mFactoryData->pai_cert.data, mFactoryData->pai_cert.len }, out_buffer); -} - -CHIP_ERROR DeviceAttestationCredsCC13X2_26X2::SignWithDeviceAttestationKey(const ByteSpan & message_to_sign, - MutableByteSpan & out_buffer) -{ - Crypto::P256ECDSASignature signature; - Crypto::P256Keypair keypair; - - VerifyOrReturnError(!out_buffer.empty(), CHIP_ERROR_INVALID_ARGUMENT); - VerifyOrReturnError(!message_to_sign.empty(), CHIP_ERROR_INVALID_ARGUMENT); - VerifyOrReturnError(out_buffer.size() >= signature.Capacity(), CHIP_ERROR_BUFFER_TOO_SMALL); - - // In a non-exemplary implementation, the public key is not needed here. It is used here merely because - // Crypto::P256Keypair is only (currently) constructable from raw keys if both private/public keys are present. - ReturnErrorOnFailure(LoadKeypairFromRaw(ByteSpan(mFactoryData->dac_priv_key.data, mFactoryData->dac_priv_key.len), - ByteSpan(mFactoryData->dac_pub_key.data, mFactoryData->dac_pub_key.len), keypair)); - ReturnErrorOnFailure(keypair.ECDSA_sign_msg(message_to_sign.data(), message_to_sign.size(), signature)); - - return CopySpanToMutableSpan(ByteSpan{ signature.ConstBytes(), signature.Length() }, out_buffer); -} - -} // namespace - -DeviceAttestationCredentialsProvider * GetCC13X2_26X2DacProvider() -{ - static DeviceAttestationCredsCC13X2_26X2 dac_provider; - return &dac_provider; -} - -} // namespace CC13X2_26X2 -} // namespace Credentials -} // namespace chip diff --git a/examples/platform/cc13x2_26x2/args.gni b/examples/platform/cc13x2_26x2/args.gni deleted file mode 100644 index ff1f8159857fc6..00000000000000 --- a/examples/platform/cc13x2_26x2/args.gni +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright (c) 2020 Project CHIP Authors -# -# 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. - -import("//build_overrides/chip.gni") - -import("${chip_root}/src/platform/cc13xx_26xx/cc13x2_26x2/args.gni") - -openthread_config_file = "" -openthread_core_config_deps = [ "${chip_root}/examples/platform/cc13x2_26x2:openthread_core_config_cc13x2_26x2_chip_examples" ] - -chip_ble_project_config_include = "" -chip_device_project_config_include = "" -chip_project_config_include = "" -chip_inet_project_config_include = "" -chip_system_project_config_include = "" diff --git a/examples/platform/cc13x2_26x2/project_include/OpenThreadConfig.h b/examples/platform/cc13x2_26x2/project_include/OpenThreadConfig.h deleted file mode 100644 index dea83922096149..00000000000000 --- a/examples/platform/cc13x2_26x2/project_include/OpenThreadConfig.h +++ /dev/null @@ -1,99 +0,0 @@ -/* - * - * Copyright (c) 2020 Project CHIP Authors - * Copyright (c) 2019 Google LLC. - * All rights reserved. - * - * 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. - */ - -/** - * @file - * Overrides to default OpenThread configuration. - * - */ - -#pragma once - -#ifdef DeviceFamily_CC13X2_CC26X2 - -/* Number of message buffers reduced to fit into CC26x2x3 RAM */ -#define OPENTHREAD_CONFIG_NUM_MESSAGE_BUFFERS 22 - -#endif // DeviceFamily_CC13X2_CC26X2 - -#define OPENTHREAD_CONFIG_LOG_OUTPUT OPENTHREAD_CONFIG_LOG_OUTPUT_APP - -// When operating in a less than ideal RF environment, having a more forgiving configuration -// of OpenThread makes thread a great deal more reliable. -#define OPENTHREAD_CONFIG_TMF_ADDRESS_QUERY_MAX_RETRY_DELAY 120 // default is 28800 -#define OPENTHREAD_CONFIG_MAC_DEFAULT_MAX_FRAME_RETRIES_DIRECT 15 // default is 3 -#define OPENTHREAD_CONFIG_MAC_DEFAULT_MAX_FRAME_RETRIES_INDIRECT 1 // default is 0 -#define OPENTHREAD_CONFIG_MAC_MAX_TX_ATTEMPTS_INDIRECT_POLLS 16 // default is 4 - -// Enable periodic parent search to speed up finding a better parent. -#define OPENTHREAD_CONFIG_PARENT_SEARCH_ENABLE 1 // default is 0 -#define OPENTHREAD_CONFIG_PARENT_SEARCH_RSS_THRESHOLD -45 // default is -65 -#define OPENTHREAD_CONFIG_MLE_INFORM_PREVIOUS_PARENT_ON_REATTACH 1 // default is 0 - -// Use smaller maximum interval to speed up reattaching. -#define OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_MAXIMUM_INTERVAL (60 * 10 * 1000) // default 1200000 ms - -#define OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE 1 -// #define OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE 0 -#define UART_AS_SERIAL_TRANSPORT 1 -#define OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE 1 - -#define OPENTHREAD_CONFIG_IP6_SLAAC_ENABLE 1 -#define OPENTHREAD_CONFIG_ECDSA_ENABLE 1 -#define OPENTHREAD_CONFIG_SRP_CLIENT_ENABLE 1 -#define OPENTHREAD_CONFIG_DNS_CLIENT_ENABLE 1 -#define OPENTHREAD_CONFIG_DNS_CLIENT_SERVICE_DISCOVERY_ENABLE 1 - -#define OPENTHREAD_CONFIG_COAP_SECURE_API_ENABLE 0 -#define OPENTHREAD_CONFIG_BORDER_AGENT_ENABLE 0 -#define OPENTHREAD_CONFIG_COMMISSIONER_ENABLE 0 -#define OPENTHREAD_CONFIG_JOINER_ENABLE 0 - -#define OPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS 0 -// TCP disabled until OpenThread has a GN/Ninja build for the tcplp library -#define OPENTHREAD_CONFIG_TCP_ENABLE 0 - -#define OPENTHREAD_CONFIG_THREAD_VERSION OT_THREAD_VERSION_1_3 - -// #define OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE 1 -// #define OPENTHREAD_CONFIG_COAP_API_ENABLE 1 -#define OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE 0 -#define OPENTHREAD_CONFIG_COAP_API_ENABLE 0 -#define OPENTHREAD_CONFIG_DHCP6_CLIENT_ENABLE 0 -#define OPENTHREAD_CONFIG_DHCP6_SERVER_ENABLE 0 -#define OPENTHREAD_CONFIG_DIAG_ENABLE 0 -#define OPENTHREAD_CONFIG_DNSSD_SERVER_ENABLE 0 -#define OPENTHREAD_CONFIG_DUA_ENABLE 1 -#define OPENTHREAD_CONFIG_LINK_RAW_ENABLE 1 -#define OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE 1 -#define OPENTHREAD_CONFIG_MAC_CSL_TRANSMITTER_ENABLE 1 -#define OPENTHREAD_CONFIG_MAC_FILTER_ENABLE 0 -#define OPENTHREAD_CONFIG_MAC_SOFTWARE_ACK_TIMEOUT_ENABLE 1 -#define OPENTHREAD_CONFIG_MAC_SOFTWARE_CSMA_BACKOFF_ENABLE 1 -#define OPENTHREAD_CONFIG_MAC_SOFTWARE_RETRANSMIT_ENABLE 1 -#define OPENTHREAD_CONFIG_MLE_LINK_METRICS_INITIATOR_ENABLE 1 -#define OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE 1 -#define OPENTHREAD_CONFIG_MLR_ENABLE 1 -#define OPENTHREAD_CONFIG_NETDATA_PUBLISHER_ENABLE 1 -#define OPENTHREAD_CONFIG_SRP_CLIENT_AUTO_START_DEFAULT_MODE 1 -#define OPENTHREAD_CONFIG_SRP_SERVER_ENABLE 0 -#define OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE 1 - -// Use the TI-supplied default platform configuration for remainder -#include "openthread-core-cc13xx_cc26xx-config-matter.h" diff --git a/examples/platform/esp32/mode-support/static-supported-modes-manager.h b/examples/platform/esp32/mode-support/static-supported-modes-manager.h index cdd79688c5212c..8d6bb3c665ff0c 100644 --- a/examples/platform/esp32/mode-support/static-supported-modes-manager.h +++ b/examples/platform/esp32/mode-support/static-supported-modes-manager.h @@ -19,7 +19,6 @@ #pragma once #include -#include namespace chip { namespace app { diff --git a/examples/platform/esp32/pw_sys_io/sys_io_esp32.cc b/examples/platform/esp32/pw_sys_io/sys_io_esp32.cc index c5591a1f129762..5991b9c6e27674 100644 --- a/examples/platform/esp32/pw_sys_io/sys_io_esp32.cc +++ b/examples/platform/esp32/pw_sys_io/sys_io_esp32.cc @@ -29,6 +29,7 @@ #include #include #include +#include #define ECHO_TEST_TXD (CONFIG_EXAMPLE_UART_TXD) #define ECHO_TEST_RXD (CONFIG_EXAMPLE_UART_RXD) diff --git a/examples/platform/linux/ControllerShellCommands.cpp b/examples/platform/linux/ControllerShellCommands.cpp index 49b1e20dc97eb8..aefbb3fafa4353 100644 --- a/examples/platform/linux/ControllerShellCommands.cpp +++ b/examples/platform/linux/ControllerShellCommands.cpp @@ -124,8 +124,8 @@ static CHIP_ERROR display(bool printHeader) else { streamer_printf(sout, " Entry %d instanceName=%s host=%s longDiscriminator=%d vendorId=%d productId=%d\r\n", i, - next->commissionData.instanceName, next->resolutionData.hostName, - next->commissionData.longDiscriminator, next->commissionData.vendorId, next->commissionData.productId); + next->nodeData.instanceName, next->resolutionData.hostName, next->nodeData.longDiscriminator, + next->nodeData.vendorId, next->nodeData.productId); } } diff --git a/examples/platform/linux/NamedPipeCommands.cpp b/examples/platform/linux/NamedPipeCommands.cpp index 9ec28b012188c3..c77165e9000cf8 100644 --- a/examples/platform/linux/NamedPipeCommands.cpp +++ b/examples/platform/linux/NamedPipeCommands.cpp @@ -26,6 +26,8 @@ #include #include +#include + static constexpr const size_t kChipEventCmdBufSize = 256; CHIP_ERROR NamedPipeCommands::Start(std::string & path, NamedPipeCommandDelegate * delegate) diff --git a/examples/platform/linux/Options.cpp b/examples/platform/linux/Options.cpp index 8bf5c0b7f4e4b4..083b8ddf8dd420 100644 --- a/examples/platform/linux/Options.cpp +++ b/examples/platform/linux/Options.cpp @@ -19,6 +19,7 @@ #include #include #include +#include #include "Options.h" diff --git a/examples/platform/linux/system_rpc_server.cc b/examples/platform/linux/system_rpc_server.cc index c4e45be56360a6..6323ad597d0cfe 100644 --- a/examples/platform/linux/system_rpc_server.cc +++ b/examples/platform/linux/system_rpc_server.cc @@ -32,6 +32,8 @@ #include "pw_rpc_system_server/rpc_server.h" #include "pw_stream/socket_stream.h" +#include + namespace pw::rpc::system_server { namespace { diff --git a/examples/platform/openiotsdk/app/openiotsdk_platform.cpp b/examples/platform/openiotsdk/app/openiotsdk_platform.cpp index 29662d6e8df4e9..761b5488eeab9b 100644 --- a/examples/platform/openiotsdk/app/openiotsdk_platform.cpp +++ b/examples/platform/openiotsdk/app/openiotsdk_platform.cpp @@ -32,6 +32,7 @@ #endif #include +#include #include #include #include @@ -43,7 +44,6 @@ #ifdef USE_CHIP_DATA_MODEL #include #include -#include #include #include #endif // USE_CHIP_DATA_MODEL diff --git a/examples/platform/silabs/BaseApplication.cpp b/examples/platform/silabs/BaseApplication.cpp index d8df720686ca4b..a6986db57d2b3e 100644 --- a/examples/platform/silabs/BaseApplication.cpp +++ b/examples/platform/silabs/BaseApplication.cpp @@ -45,6 +45,7 @@ #include #include #include +#include #if CHIP_ENABLE_OPENTHREAD #include @@ -78,7 +79,6 @@ #ifndef APP_TASK_STACK_SIZE #define APP_TASK_STACK_SIZE (4096) #endif -#define APP_TASK_PRIORITY 2 #ifndef APP_EVENT_QUEUE_SIZE // Allow apps to define a different app queue size #define APP_EVENT_QUEUE_SIZE 10 #endif @@ -123,18 +123,18 @@ bool sHaveBLEConnections = false; constexpr uint32_t kLightTimerPeriod = static_cast(pdMS_TO_TICKS(10)); uint8_t sAppEventQueueBuffer[APP_EVENT_QUEUE_SIZE * sizeof(AppEvent)]; -StaticQueue_t sAppEventQueueStruct; // TODO abstract type for static controlblock +osMessageQueue_t sAppEventQueueStruct; constexpr osMessageQueueAttr_t appEventQueueAttr = { .cb_mem = &sAppEventQueueStruct, - .cb_size = sizeof(sAppEventQueueBuffer), + .cb_size = osMessageQueueCbSize, .mq_mem = sAppEventQueueBuffer, .mq_size = sizeof(sAppEventQueueBuffer) }; uint8_t appStack[APP_TASK_STACK_SIZE]; -StaticTask_t appTaskStruct; // TODO abstract type for static controlblock +osThread_t appTaskControlBlock; constexpr osThreadAttr_t appTaskAttr = { .name = APP_TASK_NAME, .attr_bits = osThreadDetached, - .cb_mem = &appTaskStruct, - .cb_size = sizeof(appTaskStruct), + .cb_mem = &appTaskControlBlock, + .cb_size = osThreadCbSize, .stack_mem = appStack, .stack_size = APP_TASK_STACK_SIZE, .priority = osPriorityNormal }; diff --git a/examples/platform/silabs/MatterConfig.cpp b/examples/platform/silabs/MatterConfig.cpp index d41a4154697716..d85f10d0612ea1 100644 --- a/examples/platform/silabs/MatterConfig.cpp +++ b/examples/platform/silabs/MatterConfig.cpp @@ -21,8 +21,7 @@ #include "BaseApplication.h" #include "OTAConfig.h" #include - -#include +#include #include @@ -55,10 +54,13 @@ static chip::DeviceLayer::Internal::Efr32PsaOperationalKeystore gOperationalKeys #endif #include "SilabsDeviceDataProvider.h" -#include "SilabsTestEventTriggerDelegate.h" #include #include +#ifdef SL_MATTER_TEST_EVENT_TRIGGER_ENABLED +#include "SilabsTestEventTriggerDelegate.h" // nogncheck +#endif + #if CHIP_CONFIG_SYNCHRONOUS_REPORTS_ENABLED #include #else @@ -80,27 +82,16 @@ static chip::DeviceLayer::Internal::Efr32PsaOperationalKeystore gOperationalKeys #include -#include "FreeRTOSConfig.h" -#include "event_groups.h" -#include "task.h" - /********************************************************** * Defines *********************************************************/ -#define MAIN_TASK_STACK_SIZE (1024 * 5) -#define MAIN_TASK_PRIORITY (configMAX_PRIORITIES - 1) - using namespace ::chip; using namespace ::chip::Inet; using namespace ::chip::DeviceLayer; using namespace ::chip::Credentials::Silabs; using namespace chip::DeviceLayer::Silabs; -TaskHandle_t main_Task; -volatile int apperror_cnt; -static chip::DeviceLayer::DeviceInfoProviderImpl gExampleDeviceInfoProvider; - #if CHIP_ENABLE_OPENTHREAD #include #include @@ -156,7 +147,20 @@ CHIP_ERROR SilabsMatterConfig::InitOpenThread(void) #endif // CHIP_ENABLE_OPENTHREAD namespace { -void application_start(void * unused) + +constexpr uint32_t kMainTaskStackSize = (1024 * 5); +// Task is dynamically allocated with max priority. This task gets deleted once the inits are completed. +constexpr osThreadAttr_t kMainTaskAttr = { .name = "main", + .attr_bits = osThreadDetached, + .cb_mem = NULL, + .cb_size = 0U, + .stack_mem = NULL, + .stack_size = kMainTaskStackSize, + .priority = osPriorityRealtime7 }; +osThreadId_t sMainTaskHandle; +static chip::DeviceLayer::DeviceInfoProviderImpl gExampleDeviceInfoProvider; + +void ApplicationStart(void * unused) { CHIP_ERROR err = SilabsMatterConfig::InitMatter(BLE_DEV_NAME); if (err != CHIP_NO_ERROR) @@ -175,7 +179,8 @@ void application_start(void * unused) if (err != CHIP_NO_ERROR) appError(err); - vTaskDelete(main_Task); + VerifyOrDie(osThreadTerminate(sMainTaskHandle) == osOK); // Deleting the main task should never fail. + sMainTaskHandle = nullptr; } } // namespace @@ -183,8 +188,9 @@ void SilabsMatterConfig::AppInit() { GetPlatform().Init(); - xTaskCreate(application_start, "main_task", MAIN_TASK_STACK_SIZE, NULL, MAIN_TASK_PRIORITY, &main_Task); + sMainTaskHandle = osThreadNew(ApplicationStart, nullptr, &kMainTaskAttr); SILABS_LOG("Starting scheduler"); + VerifyOrDie(sMainTaskHandle); // We can't proceed if the Main Task creation failed. GetPlatform().StartScheduler(); // Should never get here. @@ -216,12 +222,6 @@ void SilabsMatterConfig::ConnectivityEventCallback(const ChipDeviceEvent * event } } -#if SILABS_TEST_EVENT_TRIGGER_ENABLED -static uint8_t sTestEventTriggerEnableKey[TestEventTriggerDelegate::kEnableKeyLength] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, - 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, - 0xcc, 0xdd, 0xee, 0xff }; -#endif // SILABS_TEST_EVENT_TRIGGER_ENABLED - CHIP_ERROR SilabsMatterConfig::InitMatter(const char * appName) { CHIP_ERROR err; @@ -280,18 +280,10 @@ CHIP_ERROR SilabsMatterConfig::InitMatter(const char * appName) initParams.reportScheduler = &sReportScheduler; -#if SILABS_TEST_EVENT_TRIGGER_ENABLED - if (Encoding::HexToBytes(SILABS_TEST_EVENT_TRIGGER_ENABLE_KEY, strlen(SILABS_TEST_EVENT_TRIGGER_ENABLE_KEY), - sTestEventTriggerEnableKey, - TestEventTriggerDelegate::kEnableKeyLength) != TestEventTriggerDelegate::kEnableKeyLength) - { - SILABS_LOG("Failed to convert the EnableKey string to octstr type value"); - memset(sTestEventTriggerEnableKey, 0, sizeof(sTestEventTriggerEnableKey)); - } - // TODO(#31723): Show to customers that they can do `Server::GetInstance().GetTestEventTriggerDelegate().AddHandler()` - static SilabsTestEventTriggerDelegate sTestEventTriggerDelegate{ ByteSpan(sTestEventTriggerEnableKey) }; +#ifdef SL_MATTER_TEST_EVENT_TRIGGER_ENABLED + static SilabsTestEventTriggerDelegate sTestEventTriggerDelegate; initParams.testEventTriggerDelegate = &sTestEventTriggerDelegate; -#endif // SILABS_TEST_EVENT_TRIGGER_ENABLED +#endif // SL_MATTER_TEST_EVENT_TRIGGER_ENABLED #if CHIP_CRYPTO_PLATFORM && !(defined(SLI_SI91X_MCU_INTERFACE)) // When building with EFR32 crypto, use the opaque key store @@ -300,13 +292,6 @@ CHIP_ERROR SilabsMatterConfig::InitMatter(const char * appName) initParams.operationalKeystore = &gOperationalKeystore; #endif -#ifdef PERFORMANCE_TEST_ENABLED - // Set up Test Event Trigger command of the General Diagnostics cluster. Used only in performance testing - // TODO(#31723): Show to customers that they can do `Server::GetInstance().GetTestEventTriggerDelegate().AddHandler()` - static SilabsTestEventTriggerDelegate sTestEventTriggerDelegate{ ByteSpan(kTestEventTriggerEnableKey) }; - initParams.testEventTriggerDelegate = &sTestEventTriggerDelegate; -#endif - // Initialize the remaining (not overridden) providers to the SDK example defaults (void) initParams.InitializeStaticResourcesBeforeServerInit(); diff --git a/examples/platform/silabs/PigweedLogger.cpp b/examples/platform/silabs/PigweedLogger.cpp index 280b232374ffcb..d136f663e9405e 100644 --- a/examples/platform/silabs/PigweedLogger.cpp +++ b/examples/platform/silabs/PigweedLogger.cpp @@ -24,16 +24,13 @@ * needs to use HDLC/UART for another purpose like the RPC server. */ -#include - -#include "semphr.h" -#include -#include -#include - +#include "PigweedLogger.h" #include "pw_span/span.h" #include #include +#include +#include +#include #include namespace PigweedLogger { @@ -44,7 +41,7 @@ constexpr size_t kWriteBufferSize = 128; // Buffer for constructing HDLC frames // Exclusive access to the backend is needed to make sure that log messages coming // from different threads are not interwoven. -SemaphoreHandle_t sLoggerLock; +osMutexId_t sLoggerLock; static pw::stream::SysIoWriter sWriter; static size_t sWriteBufferPos; @@ -60,7 +57,7 @@ static void send(void) void init(void) { - sLoggerLock = xSemaphoreCreateMutex(); + sLoggerLock = osMutexNew(nullptr); assert(sLoggerLock != NULL); pw_sys_io_Init(); @@ -68,7 +65,7 @@ void init(void) int putString(const char * buffer, size_t size) { - xSemaphoreTake(sLoggerLock, portMAX_DELAY); + osMutexAcquire(sLoggerLock, osWaitForever); assert(sWriteBufferPos < kWriteBufferSize); for (size_t i = 0; i < size; ++i) @@ -90,11 +87,11 @@ int putString(const char * buffer, size_t size) send(); } - xSemaphoreGive(sLoggerLock); + osMutexRelease(sLoggerLock); return size; } -SemaphoreHandle_t * GetSemaphore() +osMutexId_t * GetMutex() { return &sLoggerLock; } diff --git a/examples/platform/silabs/PigweedLogger.h b/examples/platform/silabs/PigweedLogger.h index 9907ade58772da..746724d02c46ea 100644 --- a/examples/platform/silabs/PigweedLogger.h +++ b/examples/platform/silabs/PigweedLogger.h @@ -17,15 +17,13 @@ #pragma once -#include - -#include "semphr.h" +#include #include namespace PigweedLogger { void init(void); int putString(const char * buffer, size_t size); -SemaphoreHandle_t * GetSemaphore(); +osMutexId_t * GetMutex(); } // namespace PigweedLogger diff --git a/examples/platform/silabs/Rpc.cpp b/examples/platform/silabs/Rpc.cpp index c78426847c1a42..d265e65af7848c 100644 --- a/examples/platform/silabs/Rpc.cpp +++ b/examples/platform/silabs/Rpc.cpp @@ -17,11 +17,11 @@ */ #include "AppTask.h" -#include "FreeRTOS.h" #include "PigweedLoggerMutex.h" #include "pigweed/RpcService.h" #include "pw_sys_io_efr32/init.h" -#include "task.h" +#include +#include #if defined(PW_RPC_ATTRIBUTE_SERVICE) && PW_RPC_ATTRIBUTE_SERVICE #include "pigweed/rpc_services/Attributes.h" @@ -94,7 +94,7 @@ class Efr32Device final : public Device public: pw::Status Reboot(const chip_rpc_RebootRequest & request, pw_protobuf_Empty & response) override { - TickType_t delayMs = kRebootTimerPeriodMs; + uint32_t delayMs = kRebootTimerPeriodMs; if (request.delay_ms != 0) { delayMs = request.delay_ms; @@ -104,27 +104,36 @@ class Efr32Device final : public Device ChipLogProgress(NotSpecified, "Did not receive a reboot delay. Defaulting to %d ms", static_cast(kRebootTimerPeriodMs)); } - mRebootTimer = xTimerCreateStatic("Reboot", pdMS_TO_TICKS(delayMs), false, nullptr, RebootHandler, &mRebootTimerBuffer); - xTimerStart(mRebootTimer, 0); + + mRebootTimer = osTimerNew(RebootHandler, osTimerOnce, nullptr, &mRebootTimerAttr); + uint32_t delayTicks = ((uint64_t) osKernelGetTickFreq() * delayMs) / 1000; + osTimerStart(mRebootTimer, delayTicks); return pw::OkStatus(); } private: static constexpr uint32_t kRebootTimerPeriodMs = 1000; - TimerHandle_t mRebootTimer; - StaticTimer_t mRebootTimerBuffer; + osTimerId_t mRebootTimer; + osTimer_t mRebootTimerBuffer; + osTimerAttr_t mRebootTimerAttr = { .name = "Reboot", .cb_mem = &mRebootTimerBuffer, .cb_size = osTimerCbSize }; - static void RebootHandler(TimerHandle_t) { NVIC_SystemReset(); } + static void RebootHandler(void * timerCbArg) { NVIC_SystemReset(); } }; #endif // defined(PW_RPC_DEVICE_SERVICE) && PW_RPC_DEVICE_SERVICE namespace { -#define RPC_TASK_STACK_SIZE 4096 -#define RPC_TASK_PRIORITY 1 -static TaskHandle_t sRpcTaskHandle; -StaticTask_t sRpcTaskBuffer; -StackType_t sRpcTaskStack[RPC_TASK_STACK_SIZE]; +static osThreadId_t sRpcTaskHandle; +osThread_t sRpcTaskControlBlock; +constexpr uint32_t kRpcTaskSize = 4096; +uint8_t sRpcTaskStack[kRpcTaskSize]; +constexpr osThreadAttr_t kRpcTaskAttr = { .name = "RPC", + .attr_bits = osThreadDetached, + .cb_mem = &sRpcTaskControlBlock, + .cb_size = osThreadCbSize, + .stack_mem = sRpcTaskStack, + .stack_size = kRpcTaskSize, + .priority = osPriorityLow }; #if defined(PW_RPC_ATTRIBUTE_SERVICE) && PW_RPC_ATTRIBUTE_SERVICE Attributes attributes_service; @@ -214,8 +223,7 @@ void Init() pw_sys_io_Init(); // Start App task. - sRpcTaskHandle = xTaskCreateStatic(RunRpcService, "RPC_TASK", ArraySize(sRpcTaskStack), nullptr, RPC_TASK_PRIORITY, - sRpcTaskStack, &sRpcTaskBuffer); + sRpcTaskHandle = osThreadNew(RunRpcService, nullptr, &kRpcTaskAttr); } } // namespace rpc diff --git a/examples/platform/silabs/SiWx917/BUILD.gn b/examples/platform/silabs/SiWx917/BUILD.gn index 73e70c18e1d7f8..e8fce7e11279f6 100644 --- a/examples/platform/silabs/SiWx917/BUILD.gn +++ b/examples/platform/silabs/SiWx917/BUILD.gn @@ -34,9 +34,6 @@ declare_args() { # Argument to force enable WPA3 security on rs91x rs91x_wpa3_transition = true - # use commissionable data for SiWx917 - siwx917_commissionable_data = false - #default WiFi SSID chip_default_wifi_ssid = "" @@ -44,11 +41,11 @@ declare_args() { chip_default_wifi_psk = "" # Enable TestEventTrigger in GeneralDiagnostics cluster - silabs_test_event_trigger_enabled = false + sl_enable_test_event_trigger = false # The EnableKey in hex string format used by TestEventTrigger command in - # GeneralDiagnostics cluster. The length of the string should be 32. - silabs_test_event_trigger_enable_key = "00112233445566778899aabbccddeeff" + # GeneralDiagnostics cluster. The length of the string should be 16 bytes. + sl_test_event_trigger_enable_key = "00112233445566778899AABBCCDDEEFF" } # Sanity check @@ -80,6 +77,30 @@ config("chip_examples_project_config") { ] } +config("test-event-trigger-config") { + defines = [ "SL_MATTER_TEST_EVENT_TRIGGER_ENABLED" ] + + if (is_debug) { + defines += [ "SL_MATTER_TEST_EVENT_TRIGGER_ENABLE_KEY=\"${sl_test_event_trigger_enable_key}\"" ] + } +} + +source_set("test-event-trigger") { + sources = [ + "${silabs_common_plat_dir}/SilabsTestEventTriggerDelegate.cpp", + "${silabs_common_plat_dir}/SilabsTestEventTriggerDelegate.h", + ] + + public_configs = [ ":test-event-trigger-config" ] + + public_deps = [ + ":silabs-factory-data-provider", + "${chip_root}/src/app:test-event-trigger", + "${chip_root}/src/lib/core", + "${chip_root}/src/lib/support", + ] +} + source_set("siwx917-matter-shell") { if (chip_build_libshell) { defines = [ "ENABLE_CHIP_SHELL" ] @@ -124,11 +145,16 @@ source_set("silabs-factory-data-provider") { public_deps = [ "${chip_root}/src/credentials", + "${chip_root}/src/lib/support", "${chip_root}/src/platform:platform_base", "${chip_root}/src/setup_payload", ] public_configs = [ ":siwx917-common-config" ] + + if (sl_enable_test_event_trigger) { + public_configs += [ ":test-event-trigger-config" ] + } } config("siwx917-common-config") { @@ -152,10 +178,6 @@ config("siwx917-common-config") { defines += [ "HEAP_MONITORING" ] } - if (siwx917_commissionable_data) { - defines += [ "SIWX917_USE_COMISSIONABLE_DATA=1" ] - } - ldflags = [ "-Wl,--no-warn-rwx-segment" ] } @@ -274,18 +296,16 @@ source_set("siwx917-common") { public_deps += [ ":silabs-factory-data-provider" ] } - if (silabs_test_event_trigger_enabled) { - sources += - [ "${silabs_common_plat_dir}/SilabsTestEventTriggerDelegate.cpp" ] - defines += [ "SILABS_TEST_EVENT_TRIGGER_ENABLE_KEY=\"${silabs_test_event_trigger_enable_key}\"" ] - } - public_deps += [ "${chip_root}/examples/providers:device_info_provider", "${chip_root}/src/lib", "${chip_root}/src/setup_payload", ] + if (sl_enable_test_event_trigger) { + public_deps += [ ":test-event-trigger" ] + } + if (app_data_model != "") { public_deps += [ app_data_model ] } diff --git a/examples/platform/silabs/SiWx917/uart.cpp b/examples/platform/silabs/SiWx917/uart.cpp index 91df5d51e71795..863beef67f7f04 100644 --- a/examples/platform/silabs/SiWx917/uart.cpp +++ b/examples/platform/silabs/SiWx917/uart.cpp @@ -49,7 +49,7 @@ void callback_event(uint32_t event) break; case SL_USART_EVENT_RECEIVE_COMPLETE: #ifdef ENABLE_CHIP_SHELL - chip::NotifyShellProcessFromISR(); + chip::NotifyShellProcess(); #endif case SL_USART_EVENT_TRANSFER_COMPLETE: break; diff --git a/examples/platform/silabs/SilabsDeviceAttestationCreds.cpp b/examples/platform/silabs/SilabsDeviceAttestationCreds.cpp index bc69573c13286b..810529c26399ab 100644 --- a/examples/platform/silabs/SilabsDeviceAttestationCreds.cpp +++ b/examples/platform/silabs/SilabsDeviceAttestationCreds.cpp @@ -21,6 +21,7 @@ #include #include #include +#include #include #include @@ -171,18 +172,6 @@ DeviceAttestationCredentialsProvider * GetSilabsDacProvider() namespace DeviceLayer { namespace Silabs { -namespace { - -void MigrateUint32(uint32_t old_key, uint32_t new_key) -{ - uint32_t value = 0; - if (SilabsConfig::ConfigValueExists(old_key) && (CHIP_NO_ERROR == SilabsConfig::ReadConfigValue(old_key, value))) - { - SilabsConfig::WriteConfigValue(new_key, value); - } -} - -} // namespace void MigrateDacProvider(void) { @@ -195,14 +184,14 @@ void MigrateDacProvider(void) constexpr uint32_t kOldKey_Creds_CD_Offset = SilabsConfigKey(SilabsConfig::kMatterConfig_KeyBase, 0x27); constexpr uint32_t kOldKey_Creds_CD_Size = SilabsConfigKey(SilabsConfig::kMatterConfig_KeyBase, 0x28); - MigrateUint32(kOldKey_Creds_KeyId, SilabsConfig::kConfigKey_Creds_KeyId); - MigrateUint32(kOldKey_Creds_Base_Addr, SilabsConfig::kConfigKey_Creds_Base_Addr); - MigrateUint32(kOldKey_Creds_DAC_Offset, SilabsConfig::kConfigKey_Creds_DAC_Offset); - MigrateUint32(kOldKey_Creds_DAC_Size, SilabsConfig::kConfigKey_Creds_DAC_Size); - MigrateUint32(kOldKey_Creds_PAI_Offset, SilabsConfig::kConfigKey_Creds_PAI_Offset); - MigrateUint32(kOldKey_Creds_PAI_Size, SilabsConfig::kConfigKey_Creds_PAI_Size); - MigrateUint32(kOldKey_Creds_CD_Offset, SilabsConfig::kConfigKey_Creds_CD_Offset); - MigrateUint32(kOldKey_Creds_CD_Size, SilabsConfig::kConfigKey_Creds_CD_Size); + MigrationManager::MigrateUint32(kOldKey_Creds_KeyId, SilabsConfig::kConfigKey_Creds_KeyId); + MigrationManager::MigrateUint32(kOldKey_Creds_Base_Addr, SilabsConfig::kConfigKey_Creds_Base_Addr); + MigrationManager::MigrateUint32(kOldKey_Creds_DAC_Offset, SilabsConfig::kConfigKey_Creds_DAC_Offset); + MigrationManager::MigrateUint32(kOldKey_Creds_DAC_Size, SilabsConfig::kConfigKey_Creds_DAC_Size); + MigrationManager::MigrateUint32(kOldKey_Creds_PAI_Offset, SilabsConfig::kConfigKey_Creds_PAI_Offset); + MigrationManager::MigrateUint32(kOldKey_Creds_PAI_Size, SilabsConfig::kConfigKey_Creds_PAI_Size); + MigrationManager::MigrateUint32(kOldKey_Creds_CD_Offset, SilabsConfig::kConfigKey_Creds_CD_Offset); + MigrationManager::MigrateUint32(kOldKey_Creds_CD_Size, SilabsConfig::kConfigKey_Creds_CD_Size); } } // namespace Silabs diff --git a/examples/platform/silabs/SilabsDeviceDataProvider.cpp b/examples/platform/silabs/SilabsDeviceDataProvider.cpp index eb0f8fee82ff1c..7d80eaaafda2bd 100644 --- a/examples/platform/silabs/SilabsDeviceDataProvider.cpp +++ b/examples/platform/silabs/SilabsDeviceDataProvider.cpp @@ -18,17 +18,13 @@ #include "SilabsDeviceDataProvider.h" #include #include +#include #include #include #include #include -#ifdef SIWX917_USE_COMISSIONABLE_DATA -#include "DeviceConfig.h" -#include "silabs_utils.h" -#include -#include -#endif // SIWX917_USE_COMISSIONABLE_DATA +#include namespace chip { namespace DeviceLayer { @@ -37,142 +33,6 @@ namespace Silabs { // using namespace chip::Credentials; using namespace chip::DeviceLayer::Internal; -// TODO Remove once Commander supports (doesn't erase) NVM3 for 917 -#ifdef SIWX917_USE_COMISSIONABLE_DATA -void SilabsDeviceDataProvider::setupPayload(uint8_t * outBuf) -{ - SetupPayload payload; - std::string result; - ChipError err = CHIP_NO_ERROR; - payload.version = 0; - payload.discriminator.SetLongValue(discriminatorValue); - payload.setUpPINCode = passcode; - payload.rendezvousInformation.SetValue(static_cast(rendezvousFlag)); - payload.commissioningFlow = static_cast(commissionableFlow); - payload.vendorID = vendorId; - payload.productID = productId; - - QRCodeSetupPayloadGenerator generator(payload); - err = generator.payloadBase38Representation(result); - if (err != CHIP_NO_ERROR) - { - SILABS_LOG("Failed to get the payload: %d", err); - } - SILABS_LOG("Payload value in string format : %s", result.c_str()); - std::vector result1; - // skipping the MT: from the payload during decoding - err = base38Decode(result.substr(3), result1); - if (err == CHIP_NO_ERROR) - { - for (uint8_t i = 0; i < result1.size(); i++) - { - outBuf[i] = result1.at(i); - } - } -} - -// writing to the flash based on the value given in the DeviceConfig.h -CHIP_ERROR SilabsDeviceDataProvider::FlashFactoryData() -{ - // flashing the value to the nvm3 section of the flash - // TODO: remove this once it is removed SiWx917 have the nvm3 simiplicity commander support - CHIP_ERROR err; - // Checking for the value of CM and flag - if ((commissionableFlow > 3) || (rendezvousFlag > 7)) - { - return CHIP_ERROR_INTERNAL; - } - if (discriminatorValue != 0) - { - err = SilabsConfig::WriteConfigValue(SilabsConfig::kConfigKey_SetupDiscriminator, discriminatorValue); - if (err != CHIP_NO_ERROR) - { - return err; - } - } - uint8_t payload[kTotalPayloadDataSizeInBytes]; - setupPayload(payload); - err = SilabsConfig::WriteConfigValueBin(SilabsConfig::kConfigKey_SetupPayloadBitSet, payload, kTotalPayloadDataSizeInBytes); - if (err != CHIP_NO_ERROR) - { - return err; - } - if (spake2Interation != 0) - { - err = SilabsConfig::WriteConfigValue(SilabsConfig::kConfigKey_Spake2pIterationCount, spake2Interation); - if (err != CHIP_NO_ERROR) - { - return err; - } - } - if (spake2Salt != NULL) - { - err = SilabsConfig::WriteConfigValueStr(SilabsConfig::kConfigKey_Spake2pSalt, spake2Salt); - if (err != CHIP_NO_ERROR) - { - return err; - } - } - if (spake2Verifier != NULL) - { - err = SilabsConfig::WriteConfigValueStr(SilabsConfig::kConfigKey_Spake2pVerifier, spake2Verifier); - if (err != CHIP_NO_ERROR) - { - return err; - } - } - if (productId != 0) - { - err = SilabsConfig::WriteConfigValue(SilabsConfig::kConfigKey_ProductId, productId); - if (err != CHIP_NO_ERROR) - { - return err; - } - } - if (vendorId != 0) - { - err = SilabsConfig::WriteConfigValue(SilabsConfig::kConfigKey_VendorId, vendorId); - if (err != CHIP_NO_ERROR) - { - return err; - } - } - if (strlen(productName) != 0) - { - err = SilabsConfig::WriteConfigValueStr(SilabsConfig::kConfigKey_ProductName, productName); - if (err != CHIP_NO_ERROR) - { - return err; - } - } - if (strlen(vendorName) != 0) - { - err = SilabsConfig::WriteConfigValueStr(SilabsConfig::kConfigKey_VendorName, vendorName); - if (err != CHIP_NO_ERROR) - { - return err; - } - } - if (strlen(hwVersionString) != 0) - { - err = SilabsConfig::WriteConfigValueStr(SilabsConfig::kConfigKey_HardwareVersionString, hwVersionString); - if (err != CHIP_NO_ERROR) - { - return err; - } - } - if (rotatingId != 0) - { - err = SilabsConfig::WriteConfigValue(SilabsConfig::kConfigKey_UniqueId, rotatingId); - if (err != CHIP_NO_ERROR) - { - return err; - } - } - return CHIP_NO_ERROR; -} -#endif - CHIP_ERROR SilabsDeviceDataProvider::GetSetupDiscriminator(uint16_t & setupDiscriminator) { CHIP_ERROR err; @@ -508,6 +368,43 @@ CHIP_ERROR SilabsDeviceDataProvider::GetProductLabel(char * buf, size_t bufSize) return SilabsConfig::ReadConfigValueStr(SilabsConfig::KConfigKey_ProductLabel, buf, bufSize, productLabelLen); } +#ifdef SL_MATTER_TEST_EVENT_TRIGGER_ENABLED +/** + * @brief Reads the test event trigger key from NVM. If the key isn't present, returns default value if defined. + * + * @param[out] keySpan output buffer. Must be at least large enough for 16 bytes (ken length) + * @return CHIP_ERROR + */ +CHIP_ERROR SilabsDeviceDataProvider::GetTestEventTriggerKey(MutableByteSpan & keySpan) +{ + constexpr size_t kEnableKeyLength = 16; // Expected byte size of the EnableKey + CHIP_ERROR err = CHIP_NO_ERROR; + size_t keyLength = 0; + + VerifyOrReturnError(keySpan.size() >= kEnableKeyLength, CHIP_ERROR_BUFFER_TOO_SMALL); + + err = SilabsConfig::ReadConfigValueBin(SilabsConfig::kConfigKey_Test_Event_Trigger_Key, keySpan.data(), kEnableKeyLength, + keyLength); +#ifndef NDEBUG + if (err == CHIP_DEVICE_ERROR_CONFIG_NOT_FOUND) + { + + constexpr char enableKey[] = SL_MATTER_TEST_EVENT_TRIGGER_ENABLE_KEY; + if (Encoding::HexToBytes(enableKey, strlen(enableKey), keySpan.data(), kEnableKeyLength) != kEnableKeyLength) + { + // enableKey Hex String doesn't have the correct length + memset(keySpan.data(), 0, keySpan.size()); + return CHIP_ERROR_INTERNAL; + } + err = CHIP_NO_ERROR; + } +#endif // NDEBUG + + keySpan.reduce_size(kEnableKeyLength); + return err; +} +#endif // SL_MATTER_TEST_EVENT_TRIGGER_ENABLED + SilabsDeviceDataProvider & SilabsDeviceDataProvider::GetDeviceDataProvider() { static SilabsDeviceDataProvider sDataProvider; diff --git a/examples/platform/silabs/SilabsDeviceDataProvider.h b/examples/platform/silabs/SilabsDeviceDataProvider.h index f29e6be24d9d72..76caac04bd60b8 100644 --- a/examples/platform/silabs/SilabsDeviceDataProvider.h +++ b/examples/platform/silabs/SilabsDeviceDataProvider.h @@ -37,12 +37,6 @@ class SilabsDeviceDataProvider : public CommissionableDataProvider, Internal::GenericDeviceInstanceInfoProvider(ConfigurationManagerImpl::GetDefaultInstance()) {} -// TODO Remove once Commander supports (doesn't erase) NVM3 for 917 -#ifdef SIWX917_USE_COMISSIONABLE_DATA - void setupPayload(uint8_t * outBuf); - CHIP_ERROR FlashFactoryData(); -#endif /* SIWX917_USE_COMISSIONABLE_DATA */ - static SilabsDeviceDataProvider & GetDeviceDataProvider(); CHIP_ERROR GetSetupPayload(MutableCharSpan & payloadBuf); // ===== Members functions that implement the CommissionableDataProvider @@ -68,6 +62,9 @@ class SilabsDeviceDataProvider : public CommissionableDataProvider, CHIP_ERROR GetPartNumber(char * buf, size_t bufSize) override; CHIP_ERROR GetProductURL(char * buf, size_t bufSzie) override; CHIP_ERROR GetProductLabel(char * buf, size_t bufSize) override; + + // ===== Member functions that are Silabs Specific + CHIP_ERROR GetTestEventTriggerKey(MutableByteSpan & keySpan); }; } // namespace Silabs diff --git a/examples/platform/silabs/SilabsTestEventTriggerDelegate.cpp b/examples/platform/silabs/SilabsTestEventTriggerDelegate.cpp index f9a11df74d7ae9..ef42c0d3a9dfd2 100644 --- a/examples/platform/silabs/SilabsTestEventTriggerDelegate.cpp +++ b/examples/platform/silabs/SilabsTestEventTriggerDelegate.cpp @@ -17,6 +17,7 @@ */ #include "SilabsTestEventTriggerDelegate.h" +#include "SilabsDeviceDataProvider.h" using namespace ::chip::DeviceLayer; @@ -24,7 +25,14 @@ namespace chip { bool SilabsTestEventTriggerDelegate::DoesEnableKeyMatch(const ByteSpan & enableKey) const { - return !mEnableKey.empty() && mEnableKey.data_equal(enableKey); + uint8_t storedEnableKey[TestEventTriggerDelegate::kEnableKeyLength]; + MutableByteSpan enableKeySpan(storedEnableKey); + + // Return false if we were not able to get the enableKey + VerifyOrReturnValue( + Silabs::SilabsDeviceDataProvider::GetDeviceDataProvider().GetTestEventTriggerKey(enableKeySpan) == CHIP_NO_ERROR, false); + + return (!enableKeySpan.empty() && enableKeySpan.data_equal(enableKey)); } } // namespace chip diff --git a/examples/platform/silabs/SilabsTestEventTriggerDelegate.h b/examples/platform/silabs/SilabsTestEventTriggerDelegate.h index 03ceabd69a7898..c691c0eff9759b 100644 --- a/examples/platform/silabs/SilabsTestEventTriggerDelegate.h +++ b/examples/platform/silabs/SilabsTestEventTriggerDelegate.h @@ -25,31 +25,12 @@ #include #include -/** - * @brief User handler for handling the test event trigger - * - * @note If TestEventTrigger is enabled, it needs to be implemented in the app - * - * @param eventTrigger Event trigger to handle - * - * @warning *** DO NOT USE FOR STANDARD CLUSTER EVENT TRIGGERS *** - * - * TODO(#31723): Rename `emberAfHandleEventTrigger` to `SilabsHandleGlobalTestEventTrigger` - * - * @retval true on success - * @retval false if error happened - */ -bool emberAfHandleEventTrigger(uint64_t eventTrigger); - namespace chip { -class SilabsTestEventTriggerDelegate : public TestEventTriggerDelegate, TestEventTriggerHandler +class SilabsTestEventTriggerDelegate : public TestEventTriggerDelegate { public: - explicit SilabsTestEventTriggerDelegate(const ByteSpan & enableKey) : mEnableKey(enableKey) - { - VerifyOrDie(AddHandler(this) == CHIP_NO_ERROR); - } + explicit SilabsTestEventTriggerDelegate() = default; /** * @brief Checks to see if `enableKey` provided matches value chosen by the manufacturer. @@ -57,21 +38,6 @@ class SilabsTestEventTriggerDelegate : public TestEventTriggerDelegate, TestEven * @return True or False. */ bool DoesEnableKeyMatch(const ByteSpan & enableKey) const override; - - /** - * @brief Delegates handling to global `emberAfHandleEventTrigger` function. DO NOT EXTEND. - * - * @param eventTrigger - trigger to process. - * @return CHIP_NO_ERROR if properly handled, else another CHIP_ERROR. - */ - CHIP_ERROR HandleEventTrigger(uint64_t eventTrigger) override - { - // WARNING: LEGACY SUPPORT ONLY, DO NOT EXTEND FOR STANDARD CLUSTERS - return (emberAfHandleEventTrigger(eventTrigger)) ? CHIP_NO_ERROR : CHIP_ERROR_INVALID_ARGUMENT; - } - -private: - ByteSpan mEnableKey; }; } // namespace chip diff --git a/examples/platform/silabs/SoftwareFaultReports.cpp b/examples/platform/silabs/SoftwareFaultReports.cpp index eab4278e1246cb..813a66037fbe84 100644 --- a/examples/platform/silabs/SoftwareFaultReports.cpp +++ b/examples/platform/silabs/SoftwareFaultReports.cpp @@ -20,7 +20,7 @@ #include "FreeRTOS.h" #include "silabs_utils.h" #include -#include +#include #include #include #include diff --git a/examples/platform/silabs/efr32/BUILD.gn b/examples/platform/silabs/efr32/BUILD.gn index 8b7b1ebf86e264..aa6c72a98c24b2 100644 --- a/examples/platform/silabs/efr32/BUILD.gn +++ b/examples/platform/silabs/efr32/BUILD.gn @@ -41,11 +41,11 @@ declare_args() { chip_default_wifi_psk = "" # Enable TestEventTrigger in GeneralDiagnostics cluster - silabs_test_event_trigger_enabled = false + sl_enable_test_event_trigger = false # The EnableKey in hex string format used by TestEventTrigger command in - # GeneralDiagnostics cluster. The length of the string should be 32. - silabs_test_event_trigger_enable_key = "00112233445566778899aabbccddeeff" + # GeneralDiagnostics cluster. The length of the string should be 16 bytes. + sl_test_event_trigger_enable_key = "00112233445566778899AABBCCDDEEFF" } silabs_common_plat_dir = "${chip_root}/examples/platform/silabs" @@ -94,6 +94,30 @@ config("chip_examples_project_config") { ] } +config("test-event-trigger-config") { + defines = [ "SL_MATTER_TEST_EVENT_TRIGGER_ENABLED" ] + + if (is_debug) { + defines += [ "SL_MATTER_TEST_EVENT_TRIGGER_ENABLE_KEY=\"${sl_test_event_trigger_enable_key}\"" ] + } +} + +source_set("test-event-trigger") { + sources = [ + "${silabs_common_plat_dir}/SilabsTestEventTriggerDelegate.cpp", + "${silabs_common_plat_dir}/SilabsTestEventTriggerDelegate.h", + ] + + public_configs = [ ":test-event-trigger-config" ] + + public_deps = [ + ":silabs-factory-data-provider", + "${chip_root}/src/app:test-event-trigger", + "${chip_root}/src/lib/core", + "${chip_root}/src/lib/support", + ] +} + source_set("openthread_core_config_efr32_chip_examples") { if (chip_enable_openthread) { sources = [ "project_include/OpenThreadConfig.h" ] @@ -154,9 +178,14 @@ source_set("silabs-factory-data-provider") { public_deps = [ "${chip_root}/src/credentials", + "${chip_root}/src/lib/support", "${chip_root}/src/platform:platform_base", "${chip_root}/src/setup_payload", ] + + if (sl_enable_test_event_trigger) { + public_configs = [ ":test-event-trigger-config" ] + } } config("efr32-common-config") { @@ -206,6 +235,7 @@ config("silabs-wifi-config") { if (sl_wfx_config_softap) { defines += [ "SL_WFX_CONFIG_SOFTAP" ] } + if (sl_wfx_config_scan) { defines += [ "SL_WFX_CONFIG_SCAN" ] } @@ -213,6 +243,7 @@ config("silabs-wifi-config") { if (chip_enable_wifi_ipv4) { defines += [ "CHIP_DEVICE_CONFIG_ENABLE_IPV4" ] } + if (rs91x_wpa3_transition) { # TODO: Change this macro once WF200 support is provided defines += [ "WIFI_ENABLE_SECURITY_WPA3_TRANSITION=1" ] @@ -322,15 +353,6 @@ source_set("efr32-common") { public_deps += [ ":silabs-factory-data-provider" ] } - if (silabs_test_event_trigger_enabled) { - sources += - [ "${silabs_common_plat_dir}/SilabsTestEventTriggerDelegate.cpp" ] - defines += [ - "SILABS_TEST_EVENT_TRIGGER_ENABLED=true", - "SILABS_TEST_EVENT_TRIGGER_ENABLE_KEY=\"${silabs_test_event_trigger_enable_key}\"", - ] - } - public_deps += [ "${chip_root}/examples/providers:device_info_provider", "${chip_root}/src/app/server", @@ -338,6 +360,10 @@ source_set("efr32-common") { "${chip_root}/src/setup_payload", ] + if (sl_enable_test_event_trigger) { + public_deps += [ ":test-event-trigger" ] + } + if (app_data_model != "") { public_deps += [ app_data_model ] } diff --git a/examples/platform/silabs/efr32/uart.cpp b/examples/platform/silabs/efr32/uart.cpp index 3941114218a664..2b29cca0db0a92 100644 --- a/examples/platform/silabs/efr32/uart.cpp +++ b/examples/platform/silabs/efr32/uart.cpp @@ -16,11 +16,9 @@ * limitations under the License. */ #include "AppConfig.h" -#include "FreeRTOS.h" -#include "event_groups.h" #include "matter_shell.h" -#include "semphr.h" -#include "task.h" +#include +#include #ifdef __cplusplus extern "C" { @@ -108,8 +106,6 @@ static uint16_t lastCount; // Nb of bytes already processed from the active dmaB #else #define UART_MAX_QUEUE_SIZE 25 #endif -#define UART_TASK_SIZE 256 -#define UART_TASK_NAME "UART" #ifdef CHIP_CONFIG_LOG_MESSAGE_MAX_SIZE #define UART_TX_MAX_BUF_LEN (CHIP_CONFIG_LOG_MESSAGE_MAX_SIZE + 2) // \r\n @@ -117,9 +113,18 @@ static uint16_t lastCount; // Nb of bytes already processed from the active dmaB #define UART_TX_MAX_BUF_LEN (258) #endif -static TaskHandle_t sUartTaskHandle; -static StackType_t uartStack[UART_TASK_SIZE * sizeof(StackType_t)]; -static StaticTask_t uartTaskStruct; +static constexpr uint32_t kUartTxCompleteFlag = 1; +static osThreadId_t sUartTaskHandle; +constexpr uint32_t kUartTaskSize = 1024; +static uint8_t uartStack[kUartTaskSize]; +static osThread_t sUartTaskControlBlock; +constexpr osThreadAttr_t kUartTaskAttr = { .name = "UART", + .attr_bits = osThreadDetached, + .cb_mem = &sUartTaskControlBlock, + .cb_size = osThreadCbSize, + .stack_mem = uartStack, + .stack_size = kUartTaskSize, + .priority = osPriorityRealtime }; typedef struct { @@ -127,9 +132,13 @@ typedef struct uint16_t length = 0; } UartTxStruct_t; +static osMessageQueueId_t sUartTxQueue; +static osMessageQueue_t sUartTxQueueStruct; uint8_t sUartTxQueueBuffer[UART_MAX_QUEUE_SIZE * sizeof(UartTxStruct_t)]; -static StaticQueue_t sUartTxQueueStruct; -static QueueHandle_t sUartTxQueue; +constexpr osMessageQueueAttr_t kUartTxQueueAttr = { .cb_mem = &sUartTxQueueStruct, + .cb_size = osMessageQueueCbSize, + .mq_mem = sUartTxQueueBuffer, + .mq_size = sizeof(sUartTxQueueBuffer) }; // Rx buffer for the receive Fifo static uint8_t sRxFifoBuffer[MAX_BUFFER_SIZE]; @@ -264,8 +273,8 @@ void uartConsoleInit(void) UARTDRV_Receive(vcom_handle, sRxDmaBuffer, MAX_DMA_BUFFER_SIZE, UART_rx_callback); UARTDRV_Receive(vcom_handle, sRxDmaBuffer2, MAX_DMA_BUFFER_SIZE, UART_rx_callback); - sUartTxQueue = xQueueCreateStatic(UART_MAX_QUEUE_SIZE, sizeof(UartTxStruct_t), sUartTxQueueBuffer, &sUartTxQueueStruct); - sUartTaskHandle = xTaskCreateStatic(uartMainLoop, UART_TASK_NAME, UART_TASK_SIZE, nullptr, 30, uartStack, &uartTaskStruct); + sUartTxQueue = osMessageQueueNew(UART_MAX_QUEUE_SIZE, sizeof(UartTxStruct_t), &kUartTxQueueAttr); + sUartTaskHandle = osThreadNew(uartMainLoop, nullptr, &kUartTaskAttr); assert(sUartTaskHandle); assert(sUartTxQueue); @@ -291,7 +300,7 @@ void uartConsoleInit(void) void USART_IRQHandler(void) { #ifdef ENABLE_CHIP_SHELL - chip::NotifyShellProcessFromISR(); + chip::NotifyShellProcess(); #elif !defined(PW_RPC_ENABLED) otSysEventSignalPending(); #endif @@ -311,9 +320,8 @@ void USART_IRQHandler(void) */ void UART_tx_callback(struct UARTDRV_HandleData * handle, Ecode_t transferStatus, uint8_t * data, UARTDRV_Count_t transferCount) { - BaseType_t xHigherPriorityTaskWoken; - - vTaskNotifyGiveFromISR(sUartTaskHandle, &xHigherPriorityTaskWoken) portYIELD_FROM_ISR(xHigherPriorityTaskWoken); + // This function may be called from Interrupt Service Routines. + osThreadFlagsSet(sUartTaskHandle, kUartTxCompleteFlag); } /* @@ -333,7 +341,7 @@ static void UART_rx_callback(UARTDRV_Handle_t handle, Ecode_t transferStatus, ui UARTDRV_Receive(vcom_handle, data, transferCount, UART_rx_callback); #ifdef ENABLE_CHIP_SHELL - chip::NotifyShellProcessFromISR(); + chip::NotifyShellProcess(); #elif !defined(PW_RPC_ENABLED) otSysEventSignalPending(); #endif @@ -363,20 +371,10 @@ int16_t uartConsoleWrite(const char * Buf, uint16_t BufLength) memcpy(workBuffer.data, Buf, BufLength); workBuffer.length = BufLength; - if (xPortIsInsideInterrupt()) + if (osMessageQueuePut(sUartTxQueue, &workBuffer, osPriorityNormal, 0) == osOK) { - BaseType_t xHigherPriorityTaskWoken; - xQueueSendFromISR(sUartTxQueue, &workBuffer, &xHigherPriorityTaskWoken); - portYIELD_FROM_ISR(xHigherPriorityTaskWoken); return BufLength; } - else - { - if (pdTRUE == xQueueSend(sUartTxQueue, &workBuffer, portMAX_DELAY)) - { - return BufLength; - } - } return UART_CONSOLE_ERR; } @@ -400,20 +398,10 @@ int16_t uartLogWrite(const char * log, uint16_t length) memcpy(workBuffer.data + length, "\r\n", 2); workBuffer.length = length + 2; - if (xPortIsInsideInterrupt()) + if (osMessageQueuePut(sUartTxQueue, &workBuffer, osPriorityNormal, 0) == osOK) { - BaseType_t xHigherPriorityTaskWoken; - xQueueSendFromISR(sUartTxQueue, &workBuffer, &xHigherPriorityTaskWoken); - portYIELD_FROM_ISR(xHigherPriorityTaskWoken); return length; } - else - { - if (pdTRUE == xQueueSend(sUartTxQueue, &workBuffer, 0)) - { - return length; - } - } return UART_CONSOLE_ERR; } @@ -453,11 +441,11 @@ void uartMainLoop(void * args) while (1) { - BaseType_t eventReceived = xQueueReceive(sUartTxQueue, &workBuffer, portMAX_DELAY); + osStatus_t eventReceived = osMessageQueueGet(sUartTxQueue, &workBuffer, nullptr, osWaitForever); while (eventReceived == pdTRUE) { uartSendBytes(workBuffer.data, workBuffer.length); - eventReceived = xQueueReceive(sUartTxQueue, &workBuffer, 0); + eventReceived = osMessageQueueGet(sUartTxQueue, &workBuffer, nullptr, 0); } } } @@ -470,13 +458,14 @@ void uartMainLoop(void * args) */ void uartSendBytes(uint8_t * buffer, uint16_t nbOfBytes) { - #if defined(SL_CATALOG_POWER_MANAGER_PRESENT) sl_power_manager_add_em_requirement(SL_POWER_MANAGER_EM1); -#endif +#endif // SL_CATALOG_POWER_MANAGER_PRESENT + #if SL_UARTCTRL_MUX sl_wfx_host_pre_uart_transfer(); #endif // SL_UARTCTRL_MUX + #if (defined(EFR32MG24) && defined(WF200_WIFI)) // Blocking transmit for the MG24 + WF200 since UART TX is multiplexed with // WF200 SPI IRQ @@ -484,15 +473,16 @@ void uartSendBytes(uint8_t * buffer, uint16_t nbOfBytes) #else // Non Blocking Transmit UARTDRV_Transmit(vcom_handle, (uint8_t *) buffer, nbOfBytes, UART_tx_callback); - ulTaskNotifyTake(pdTRUE, portMAX_DELAY); + osThreadFlagsWait(kUartTxCompleteFlag, osFlagsWaitAny, osWaitForever); #endif /* EFR32MG24 && WF200_WIFI */ + #if SL_UARTCTRL_MUX sl_wfx_host_post_uart_transfer(); #endif // SL_UARTCTRL_MUX #if defined(SL_CATALOG_POWER_MANAGER_PRESENT) sl_power_manager_remove_em_requirement(SL_POWER_MANAGER_EM1); -#endif +#endif // SL_CATALOG_POWER_MANAGER_PRESENT } #ifdef __cplusplus diff --git a/examples/platform/silabs/matter-platform.slcp b/examples/platform/silabs/matter-platform.slcp index bc30556be60fe5..3e1c52a6ec66f5 100644 --- a/examples/platform/silabs/matter-platform.slcp +++ b/examples/platform/silabs/matter-platform.slcp @@ -31,22 +31,19 @@ sdk: {id: gecko_sdk, version: 4.3.1} toolchain_settings: [] component: -- {id: bluetooth_feature_nvm} +#bluetooth components +- {id: gatt_configuration} - {id: bluetooth_feature_gatt_server} -- {id: nvm3_lib} -- {id: bluetooth_feature_sm} -- {id: bluetooth_feature_gap} - {id: bluetooth_feature_legacy_advertiser} -- {id: gatt_configuration} -- {id: freertos} +- {id: bluetooth_feature_connection} +- {id: bluetooth_feature_system} - {id: bluetooth_stack} +# Other components +- {id: nvm3_lib} +- {id: freertos} - {id: brd4002a} - {id: rail_util_pti} -- {id: bluetooth_feature_gatt} -- {id: bluetooth_feature_connection} - {id: rail_lib_multiprotocol} -- {id: bluetooth_feature_system} -- {id: bluetooth_feature_scanner} - {id: rail_util_power_manager_init} - {id: psa_crypto} - {id: psa_crypto_aes} @@ -62,7 +59,6 @@ component: - {id: mbedtls_platform_dynamic_memory_allocation_config_init_runtime } - {id: mbedtls_base64} - {id: ot_psa_crypto} -- {id: bluetooth_crypto} - {id: iostream_rtt} # Necessary componenets for ot coap cert lib # - {id: mbedtls_dtls} # Requried by COAP lib diff --git a/examples/platform/silabs/matter_shell.cpp b/examples/platform/silabs/matter_shell.cpp index 9a59adb4306dc6..03a50ea7f708cf 100644 --- a/examples/platform/silabs/matter_shell.cpp +++ b/examples/platform/silabs/matter_shell.cpp @@ -17,21 +17,28 @@ #include "matter_shell.h" #include -#include +#include #include #include -#include +#include using namespace ::chip; using chip::Shell::Engine; namespace { -#define SHELL_TASK_STACK_SIZE 2048 -#define SHELL_TASK_PRIORITY 5 -TaskHandle_t shellTaskHandle; -StackType_t shellStack[SHELL_TASK_STACK_SIZE / sizeof(StackType_t)]; -StaticTask_t shellTaskStruct; +constexpr uint32_t kShellProcessFlag = 1; +constexpr uint32_t kShellTaskStackSize = 2048; +uint8_t shellTaskStack[kShellTaskStackSize]; +osThread_t shellTaskControlBlock; +constexpr osThreadAttr_t kShellTaskAttr = { .name = "shell", + .attr_bits = osThreadDetached, + .cb_mem = &shellTaskControlBlock, + .cb_size = osThreadCbSize, + .stack_mem = shellTaskStack, + .stack_size = kShellTaskStackSize, + .priority = osPriorityBelowNormal }; +osThreadId_t shellTaskHandle; void MatterShellTask(void * args) { @@ -40,33 +47,17 @@ void MatterShellTask(void * args) } // namespace -extern "C" unsigned int sleep(unsigned int seconds) -{ - const TickType_t xDelay = pdMS_TO_TICKS(1000 * seconds); - vTaskDelay(xDelay); - return 0; -} - namespace chip { void NotifyShellProcess() { - xTaskNotifyGive(shellTaskHandle); -} - -void NotifyShellProcessFromISR() -{ - BaseType_t yieldRequired = pdFALSE; - if (shellTaskHandle != NULL) - { - vTaskNotifyGiveFromISR(shellTaskHandle, &yieldRequired); - } - portYIELD_FROM_ISR(yieldRequired); + // This function may be called from Interrupt Service Routines. + osThreadFlagsSet(shellTaskHandle, kShellProcessFlag); } void WaitForShellActivity() { - ulTaskNotifyTake(pdTRUE, portMAX_DELAY); + osThreadFlagsWait(kShellProcessFlag, osFlagsWaitAny, osWaitForever); } void startShellTask() @@ -79,8 +70,8 @@ void startShellTask() cmd_misc_init(); cmd_otcli_init(); - shellTaskHandle = xTaskCreateStatic(MatterShellTask, "matter_cli", ArraySize(shellStack), NULL, SHELL_TASK_PRIORITY, shellStack, - &shellTaskStruct); + shellTaskHandle = osThreadNew(MatterShellTask, nullptr, &kShellTaskAttr); + VerifyOrDie(shellTaskHandle); } } // namespace chip diff --git a/examples/platform/silabs/matter_shell.h b/examples/platform/silabs/matter_shell.h index 9b818bfe8a412b..d32ee62ded5591 100644 --- a/examples/platform/silabs/matter_shell.h +++ b/examples/platform/silabs/matter_shell.h @@ -20,7 +20,6 @@ namespace chip { void NotifyShellProcess(); -void NotifyShellProcessFromISR(); void WaitForShellActivity(); void startShellTask(); diff --git a/examples/platform/telink/Rpc.cmake b/examples/platform/telink/Rpc.cmake new file mode 100644 index 00000000000000..e4ae124144475e --- /dev/null +++ b/examples/platform/telink/Rpc.cmake @@ -0,0 +1,163 @@ +# +# Copyright (c) 2024 Project CHIP Authors +# +# 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. + +# Fix for unused swap parameter in: zephyr/include/zephyr/arch/riscv/irq.h:70 +add_compile_options(-Wno-error=unused-parameter) + +# Make all targets created below depend on zephyr_interface to inherit MCU-related compilation flags +link_libraries($) + +set(PIGWEED_ROOT "${CHIP_ROOT}/third_party/pigweed/repo") +include(${PIGWEED_ROOT}/pw_build/pigweed.cmake) +include(${PIGWEED_ROOT}/pw_protobuf_compiler/proto.cmake) + +include($ENV{PW_ROOT}/pw_assert/backend.cmake) +include($ENV{PW_ROOT}/pw_log/backend.cmake) +include($ENV{PW_ROOT}/pw_sys_io/backend.cmake) + +pw_set_module_config(pw_rpc_CONFIG pw_rpc.disable_global_mutex_config) +pw_set_backend(pw_log pw_log_basic) +pw_set_backend(pw_assert.check pw_assert_log.check_backend) +pw_set_backend(pw_assert.assert pw_assert.assert_compatibility_backend) +pw_set_backend(pw_sys_io pw_sys_io.telink) + +set(dir_pw_third_party_nanopb "${CHIP_ROOT}/third_party/nanopb/repo" CACHE STRING "" FORCE) + +add_subdirectory(third_party/connectedhomeip/third_party/pigweed/repo) +add_subdirectory(third_party/connectedhomeip/third_party/nanopb/repo) +add_subdirectory(third_party/connectedhomeip/examples/platform/telink/pw_sys_io) + +pw_proto_library(attributes_service + SOURCES + ${CHIP_ROOT}/examples/common/pigweed/protos/attributes_service.proto + INPUTS + ${CHIP_ROOT}/examples/common/pigweed/protos/attributes_service.options + PREFIX + attributes_service + STRIP_PREFIX + ${CHIP_ROOT}/examples/common/pigweed/protos + DEPS + pw_protobuf.common_proto +) + +pw_proto_library(button_service + SOURCES + ${CHIP_ROOT}/examples/common/pigweed/protos/button_service.proto + PREFIX + button_service + STRIP_PREFIX + ${CHIP_ROOT}/examples/common/pigweed/protos + DEPS + pw_protobuf.common_proto +) + +pw_proto_library(descriptor_service + SOURCES + ${CHIP_ROOT}/examples/common/pigweed/protos/descriptor_service.proto + PREFIX + descriptor_service + STRIP_PREFIX + ${CHIP_ROOT}/examples/common/pigweed/protos + DEPS + pw_protobuf.common_proto +) + +pw_proto_library(device_service + SOURCES + ${CHIP_ROOT}/examples/common/pigweed/protos/device_service.proto + INPUTS + ${CHIP_ROOT}/examples/common/pigweed/protos/device_service.options + PREFIX + device_service + STRIP_PREFIX + ${CHIP_ROOT}/examples/common/pigweed/protos + DEPS + pw_protobuf.common_proto +) + +pw_proto_library(lighting_service + SOURCES + ${CHIP_ROOT}/examples/common/pigweed/protos/lighting_service.proto + STRIP_PREFIX + ${CHIP_ROOT}/examples/common/pigweed/protos + PREFIX + lighting_service + DEPS + pw_protobuf.common_proto +) + +pw_proto_library(ot_cli_service + SOURCES + ${CHIP_ROOT}/examples/common/pigweed/protos/ot_cli_service.proto + INPUTS + ${CHIP_ROOT}/examples/common/pigweed/protos/ot_cli_service.options + STRIP_PREFIX + ${CHIP_ROOT}/examples/common/pigweed/protos + PREFIX + ot_cli_service + DEPS + pw_protobuf.common_proto +) + +pw_proto_library(thread_service + SOURCES + ${CHIP_ROOT}/examples/common/pigweed/protos/thread_service.proto + INPUTS + ${CHIP_ROOT}/examples/common/pigweed/protos/thread_service.options + STRIP_PREFIX + ${CHIP_ROOT}/examples/common/pigweed/protos + PREFIX + thread_service + DEPS + pw_protobuf.common_proto +) + +target_sources(app PRIVATE + ../../common/pigweed/RpcService.cpp + ../../common/pigweed/telink/PigweedLoggerMutex.cpp + ${TELINK_COMMON}/Rpc.cpp + ${TELINK_COMMON}/util/src/PigweedLogger.cpp +) + +target_include_directories(app PRIVATE + ${PIGWEED_ROOT}/pw_sys_io/public + ${CHIP_ROOT}/src/lib/support + ${CHIP_ROOT}/src/system + ${TELINK_COMMON} + ../../common + ../../common/pigweed + ../../common/pigweed/telink) + +target_compile_options(app PRIVATE + "-DPW_RPC_ATTRIBUTE_SERVICE=1" + "-DPW_RPC_BUTTON_SERVICE=1" + "-DPW_RPC_DESCRIPTOR_SERVICE=1" + "-DPW_RPC_DEVICE_SERVICE=1" + "-DPW_RPC_LIGHTING_SERVICE=1" + "-DPW_RPC_THREAD_SERVICE=1") + +target_link_libraries(app PRIVATE + attributes_service.nanopb_rpc + button_service.nanopb_rpc + descriptor_service.nanopb_rpc + device_service.nanopb_rpc + lighting_service.nanopb_rpc + thread_service.nanopb_rpc + pw_checksum + pw_hdlc + pw_log + pw_rpc.server + pw_sys_io +) diff --git a/examples/platform/telink/common.cmake b/examples/platform/telink/common.cmake new file mode 100644 index 00000000000000..314e74063be605 --- /dev/null +++ b/examples/platform/telink/common.cmake @@ -0,0 +1,104 @@ +# +# Copyright (c) 2024 Project CHIP Authors +# +# 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. + +string(REPLACE "_retention" "" BASE_BOARD ${BOARD}) + +if(FLASH_SIZE) + message(STATUS "Flash memory size is set to: " ${FLASH_SIZE} "b") +else() + set(FLASH_SIZE "2m") + message(STATUS "Flash memory size is set to: 2mb (default)") +endif() + +if(${TLNK_MARS_BOARD} MATCHES y) + set(MARS_BOOT_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/${BASE_BOARD}_mars_boot.overlay") + if(NOT EXISTS "${MARS_BOOT_DTC_OVERLAY_FILE}") + message(FATAL_ERROR "${MARS_BOOT_DTC_OVERLAY_FILE} doesn't exist") + endif() + set(MARS_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/${BOARD}_mars.overlay") + if(NOT EXISTS "${MARS_DTC_OVERLAY_FILE}") + message(FATAL_ERROR "${MARS_DTC_OVERLAY_FILE} doesn't exist") + endif() + set(MARS_CONF_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/${BOARD}_mars.conf") + if(NOT EXISTS "${MARS_CONF_OVERLAY_FILE}") + message(FATAL_ERROR "${MARS_CONF_OVERLAY_FILE} doesn't exist") + endif() +else() + unset(MARS_BOOT_DTC_OVERLAY_FILE) + unset(MARS_DTC_OVERLAY_FILE) + unset(MARS_CONF_OVERLAY_FILE) +endif() + +if(${TLNK_USB_DONGLE} MATCHES y) + set(USB_BOOT_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/${BASE_BOARD}_usb_boot.overlay") + if(NOT EXISTS "${USB_BOOT_DTC_OVERLAY_FILE}") + message(FATAL_ERROR "${USB_BOOT_DTC_OVERLAY_FILE} doesn't exist") + endif() + set(USB_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/${BOARD}_usb.overlay") + if(NOT EXISTS "${USB_DTC_OVERLAY_FILE}") + message(FATAL_ERROR "${USB_DTC_OVERLAY_FILE} doesn't exist") + endif() + set(USB_CONF_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/${BOARD}_usb.conf") + if(NOT EXISTS "${USB_CONF_OVERLAY_FILE}") + message(FATAL_ERROR "${USB_CONF_OVERLAY_FILE} doesn't exist") + endif() +else() + unset(USB_BOOT_DTC_OVERLAY_FILE) + unset(USB_DTC_OVERLAY_FILE) + unset(USB_CONF_OVERLAY_FILE) +endif() + +set(GLOBAL_BOOT_CONF_OVERLAY_FILE "${CHIP_ROOT}/config/telink/app/bootloader.conf") +if(NOT EXISTS "${GLOBAL_BOOT_CONF_OVERLAY_FILE}") + message(FATAL_ERROR "${GLOBAL_BOOT_CONF_OVERLAY_FILE} doesn't exist") +endif() + +set(LOCAL_DTC_OVERLAY_FILE "${CMAKE_CURRENT_SOURCE_DIR}/boards/${BASE_BOARD}.overlay") +if(NOT EXISTS "${LOCAL_DTC_OVERLAY_FILE}") + message(STATUS "${LOCAL_DTC_OVERLAY_FILE} doesn't exist") + unset(LOCAL_DTC_OVERLAY_FILE) +endif() + +set(GLOBAL_BOOT_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/${BASE_BOARD}.overlay") +if(NOT EXISTS "${GLOBAL_BOOT_DTC_OVERLAY_FILE}") + message(FATAL_ERROR "${GLOBAL_BOOT_DTC_OVERLAY_FILE} doesn't exist") +endif() + +set(GLOBAL_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/${BOARD}.overlay") +if(NOT EXISTS "${GLOBAL_DTC_OVERLAY_FILE}") + message(FATAL_ERROR "${GLOBAL_DTC_OVERLAY_FILE} doesn't exist") +endif() + +set(FLASH_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/${BASE_BOARD}_${FLASH_SIZE}_flash.overlay") +if(NOT EXISTS "${FLASH_DTC_OVERLAY_FILE}") + message(FATAL_ERROR "${FLASH_DTC_OVERLAY_FILE} doesn't exist") +endif() + +if(DTC_OVERLAY_FILE) + set(DTC_OVERLAY_FILE + "${DTC_OVERLAY_FILE} ${GLOBAL_DTC_OVERLAY_FILE} ${USB_DTC_OVERLAY_FILE} ${MARS_DTC_OVERLAY_FILE} ${FLASH_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}" + CACHE STRING "" FORCE + ) +else() + set(DTC_OVERLAY_FILE ${GLOBAL_DTC_OVERLAY_FILE} ${USB_DTC_OVERLAY_FILE} ${MARS_DTC_OVERLAY_FILE} ${FLASH_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}) +endif() + +if(NOT CONF_FILE) + set(CONF_FILE ${USB_CONF_OVERLAY_FILE} ${MARS_CONF_OVERLAY_FILE} prj.conf) +endif() + +# Load NCS/Zephyr build system +list(APPEND ZEPHYR_EXTRA_MODULES ${CHIP_ROOT}/config/telink/chip-module) +find_package(Zephyr HINTS $ENV{ZEPHYR_BASE}) diff --git a/examples/platform/telink/common/include/AppTaskCommon.h b/examples/platform/telink/common/include/AppTaskCommon.h index 7bacaeb4377ee4..6218427e963a51 100644 --- a/examples/platform/telink/common/include/AppTaskCommon.h +++ b/examples/platform/telink/common/include/AppTaskCommon.h @@ -1,6 +1,6 @@ /* * - * Copyright (c) 2022-2023 Project CHIP Authors + * Copyright (c) 2022-2024 Project CHIP Authors * All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,18 +21,6 @@ #include "AppConfig.h" #include "AppEventCommon.h" -#if CONFIG_CHIP_ENABLE_APPLICATION_STATUS_LED -#include "LEDWidget.h" -#endif - -#ifdef APP_USE_IDENTIFY_PWM -#include "PWMDevice.h" -#endif - -#ifdef CONFIG_WS2812_STRIP -#include "WS2812Device.h" -#endif - #include #include #include @@ -64,6 +52,10 @@ inline constexpr uint8_t kButtonPushEvent = 1; inline constexpr uint8_t kButtonReleaseEvent = 0; } // namespace +class LedManager; +class PwmManager; +class ButtonManager; + class AppTaskCommon { public: @@ -80,12 +72,8 @@ class AppTaskCommon { kButtonId_ExampleAction = 1, kButtonId_FactoryReset, -#if APP_USE_THREAD_START_BUTTON kButtonId_StartThread, -#endif -#if APP_USE_BLE_START_BUTTON kButtonId_StartBleAdv -#endif } ButtonId; #endif @@ -95,44 +83,34 @@ class AppTaskCommon void DispatchEvent(AppEvent * event); void GetEvent(AppEvent * aEvent); + void InitLeds(); + virtual void LinkLeds(LedManager & ledManager); + void InitPwms(); + virtual void LinkPwms(PwmManager & pwmManager); void InitButtons(void); + virtual void LinkButtons(ButtonManager & buttonManager); static void FactoryResetTimerTimeoutCallback(k_timer * timer); static void FactoryResetTimerEventHandler(AppEvent * aEvent); static void FactoryResetButtonEventHandler(void); static void FactoryResetHandler(AppEvent * aEvent); -#if APP_USE_BLE_START_BUTTON static void StartBleAdvButtonEventHandler(void); static void StartBleAdvHandler(AppEvent * aEvent); -#endif -#if APP_USE_THREAD_START_BUTTON || !CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE +#if !CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE && CHIP_DEVICE_CONFIG_ENABLE_THREAD static void StartThreadButtonEventHandler(void); static void StartThreadHandler(AppEvent * aEvent); #endif -#if APP_USE_EXAMPLE_START_BUTTON static void ExampleActionButtonEventHandler(void); void SetExampleButtonCallbacks(EventHandler aAction_CB); EventHandler ExampleActionEventHandler; -#endif static void ChipEventHandler(const chip::DeviceLayer::ChipDeviceEvent * event, intptr_t arg); -#ifdef APP_USE_IDENTIFY_PWM - PWMDevice mPwmIdentifyLed; - - static void ActionIdentifyStateUpdateHandler(k_timer * timer); - static void UpdateIdentifyStateEventHandler(AppEvent * aEvent); -#endif - -#if CONFIG_CHIP_ENABLE_APPLICATION_STATUS_LED - static void UpdateLedStateEventHandler(AppEvent * aEvent); - static void LEDStateUpdateHandler(LEDWidget * ledWidget); static void UpdateStatusLED(void); -#endif #if CONFIG_CHIP_FACTORY_DATA chip::DeviceLayer::FactoryDataProvider mFactoryDataProvider; diff --git a/examples/platform/telink/common/include/SensorManagerCommon.h b/examples/platform/telink/common/include/SensorManagerCommon.h index 7181f8212a944c..25e800b078e021 100644 --- a/examples/platform/telink/common/include/SensorManagerCommon.h +++ b/examples/platform/telink/common/include/SensorManagerCommon.h @@ -46,7 +46,6 @@ class SensorManager static void SensorBanForNextMeasurTimerTimeoutCallback(k_timer * timer); #ifdef USE_COLOR_TEMPERATURE_LIGHT - WS2812Device mWS2812Device; void SetColorTemperatureLight(int8_t temp); #endif // USE_COLOR_TEMPERATURE_LIGHT diff --git a/examples/platform/telink/common/src/AppTaskCommon.cpp b/examples/platform/telink/common/src/AppTaskCommon.cpp index a77f4363df65f5..9f268b74da3e55 100644 --- a/examples/platform/telink/common/src/AppTaskCommon.cpp +++ b/examples/platform/telink/common/src/AppTaskCommon.cpp @@ -1,6 +1,6 @@ /* * - * Copyright (c) 2022-2023 Project CHIP Authors + * Copyright (c) 2022-2024 Project CHIP Authors * All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,6 +21,8 @@ #include "BLEManagerImpl.h" #include "ButtonManager.h" +#include "LEDManager.h" +#include "PWMManager.h" #include "ThreadUtil.h" @@ -29,6 +31,7 @@ #include #include #include +#include #if CONFIG_BOOTLOADER_MCUBOOT #include @@ -50,25 +53,6 @@ constexpr int kFactoryResetCalcTimeout = 3000; constexpr int kFactoryResetTriggerCntr = 3; constexpr int kAppEventQueueSize = 10; -#if CONFIG_CHIP_BUTTON_MANAGER_IRQ_MODE -const struct gpio_dt_spec sFactoryResetButtonDt = GPIO_DT_SPEC_GET(DT_NODELABEL(key_1), gpios); -#if APP_USE_BLE_START_BUTTON -const struct gpio_dt_spec sBleStartButtonDt = GPIO_DT_SPEC_GET(DT_NODELABEL(key_2), gpios); -#endif -#if APP_USE_THREAD_START_BUTTON -const struct gpio_dt_spec sThreadStartButtonDt = GPIO_DT_SPEC_GET(DT_NODELABEL(key_3), gpios); -#endif -#if APP_USE_EXAMPLE_START_BUTTON -const struct gpio_dt_spec sExampleActionButtonDt = GPIO_DT_SPEC_GET(DT_NODELABEL(key_4), gpios); -#endif -#else -const struct gpio_dt_spec sButtonCol1Dt = GPIO_DT_SPEC_GET(DT_NODELABEL(key_matrix_col1), gpios); -const struct gpio_dt_spec sButtonCol2Dt = GPIO_DT_SPEC_GET(DT_NODELABEL(key_matrix_col2), gpios); -const struct gpio_dt_spec sButtonRow1Dt = GPIO_DT_SPEC_GET(DT_NODELABEL(key_matrix_row1), gpios); -const struct gpio_dt_spec sButtonRow2Dt = GPIO_DT_SPEC_GET(DT_NODELABEL(key_matrix_row2), gpios); -#endif - -#ifdef APP_USE_IDENTIFY_PWM constexpr uint32_t kIdentifyBlinkRateMs = 200; constexpr uint32_t kIdentifyOkayOnRateMs = 50; constexpr uint32_t kIdentifyOkayOffRateMs = 950; @@ -77,36 +61,18 @@ constexpr uint32_t kIdentifyFinishOffRateMs = 50; constexpr uint32_t kIdentifyChannelChangeRateMs = 1000; constexpr uint32_t kIdentifyBreatheRateMs = 1000; -const struct pwm_dt_spec sPwmIdentifySpecGreenLed = PWM_DT_SPEC_GET(DT_ALIAS(pwm_led3)); -#endif - #if APP_SET_NETWORK_COMM_ENDPOINT_SEC constexpr EndpointId kNetworkCommissioningEndpointSecondary = 0xFFFE; #endif K_MSGQ_DEFINE(sAppEventQueue, sizeof(AppEvent), kAppEventQueueSize, alignof(AppEvent)); -#if CONFIG_CHIP_ENABLE_APPLICATION_STATUS_LED -LEDWidget sStatusLED; -#endif - -Button sFactoryResetButton; -#if APP_USE_BLE_START_BUTTON -Button sBleAdvStartButton; -#endif -#if APP_USE_EXAMPLE_START_BUTTON -Button sExampleActionButton; -#endif -#if APP_USE_THREAD_START_BUTTON -Button sThreadStartButton; -#endif - k_timer sFactoryResetTimer; uint8_t sFactoryResetCntr = 0; bool sIsCommissioningFailed = false; -bool sIsThreadProvisioned = false; -bool sIsThreadEnabled = false; +bool sIsNetworkProvisioned = false; +bool sIsNetworkEnabled = false; bool sIsThreadAttached = false; bool sHaveBLEConnections = false; @@ -114,7 +80,8 @@ bool sHaveBLEConnections = false; chip::DeviceLayer::DeviceInfoProviderImpl gExampleDeviceInfoProvider; #endif -#ifdef APP_USE_IDENTIFY_PWM +#ifndef IDENTIFY_CLUSTER_DISABLED + void OnIdentifyTriggerEffect(Identify * identify) { AppTaskCommon::IdentifyEffectHandler(identify->mCurrentEffectIdentifier); @@ -127,6 +94,7 @@ Identify sIdentify = { Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator, OnIdentifyTriggerEffect, }; + #endif #if CONFIG_CHIP_FACTORY_DATA @@ -197,6 +165,7 @@ class AppFabricTableDelegate : public FabricTable::Delegate class PlatformMgrDelegate : public DeviceLayer::PlatformManagerDelegate { // Disable openthread before reset to prevent writing to NVS +#if CHIP_DEVICE_CONFIG_ENABLE_THREAD void OnShutDown() override { if (ThreadStackManagerImpl().IsThreadEnabled()) @@ -204,6 +173,7 @@ class PlatformMgrDelegate : public DeviceLayer::PlatformManagerDelegate ThreadStackManagerImpl().Finalize(); } } +#endif // CHIP_DEVICE_CONFIG_ENABLE_THREAD }; #if CONFIG_CHIP_LIB_SHELL @@ -246,7 +216,7 @@ CHIP_ERROR AppTaskCommon::StartApp(void) AppEvent event = {}; -#if !CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE +#if !CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE && CHIP_DEVICE_CONFIG_ENABLE_THREAD StartThreadButtonEventHandler(); #endif @@ -270,13 +240,10 @@ CHIP_ERROR AppTaskCommon::InitCommonParts(void) CHIP_ERROR err; LOG_INF("SW Version: %u, %s", CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION, CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING); - // Initialize status LED -#if CONFIG_CHIP_ENABLE_APPLICATION_STATUS_LED - LEDWidget::SetStateUpdateCallback(LEDStateUpdateHandler); - sStatusLED.Init(GPIO_DT_SPEC_GET_OR(DT_ALIAS(system_state_led), gpios, {})); - + InitLeds(); UpdateStatusLED(); -#endif + + InitPwms(); InitButtons(); @@ -284,18 +251,6 @@ CHIP_ERROR AppTaskCommon::InitCommonParts(void) k_timer_init(&sFactoryResetTimer, &AppTask::FactoryResetTimerTimeoutCallback, nullptr); k_timer_user_data_set(&sFactoryResetTimer, this); -#ifdef APP_USE_IDENTIFY_PWM - // Initialize PWM Identify led - err = GetAppTask().mPwmIdentifyLed.Init(&sPwmIdentifySpecGreenLed, kDefaultMinLevel, kDefaultMaxLevel, kDefaultMaxLevel); - if (err != CHIP_NO_ERROR) - { - LOG_ERR("Green IDENTIFY PWM Device Init fail"); - return err; - } - - GetAppTask().mPwmIdentifyLed.SetCallbacks(nullptr, nullptr, ActionIdentifyStateUpdateHandler); -#endif - // Initialize CHIP server #if CONFIG_CHIP_FACTORY_DATA ReturnErrorOnFailure(mFactoryDataProvider.Init()); @@ -369,179 +324,144 @@ void AppTaskCommon::ButtonEventHandler(ButtonId_t btnId, bool btnPressed) switch (btnId) { -#if APP_USE_EXAMPLE_START_BUTTON case kButtonId_ExampleAction: ExampleActionButtonEventHandler(); break; -#endif case kButtonId_FactoryReset: FactoryResetButtonEventHandler(); break; -#if APP_USE_THREAD_START_BUTTON +#if !CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE case kButtonId_StartThread: StartThreadButtonEventHandler(); break; #endif -#if APP_USE_BLE_START_BUTTON case kButtonId_StartBleAdv: StartBleAdvButtonEventHandler(); break; -#endif } } #endif -void AppTaskCommon::InitButtons(void) +void AppTaskCommon::InitLeds() { -#if CONFIG_CHIP_BUTTON_MANAGER_IRQ_MODE - sFactoryResetButton.Configure(&sFactoryResetButtonDt, FactoryResetButtonEventHandler); -#if APP_USE_BLE_START_BUTTON - sBleAdvStartButton.Configure(&sBleStartButtonDt, StartBleAdvButtonEventHandler); -#endif -#if APP_USE_EXAMPLE_START_BUTTON - if (ExampleActionEventHandler) - { - sExampleActionButton.Configure(&sExampleActionButtonDt, ExampleActionButtonEventHandler); - } -#endif -#if APP_USE_THREAD_START_BUTTON - sThreadStartButton.Configure(&sThreadStartButtonDt, StartThreadButtonEventHandler); -#endif -#else - sFactoryResetButton.Configure(&sButtonRow1Dt, &sButtonCol1Dt, FactoryResetButtonEventHandler); -#if APP_USE_BLE_START_BUTTON - sBleAdvStartButton.Configure(&sButtonRow2Dt, &sButtonCol2Dt, StartBleAdvButtonEventHandler); -#endif -#if APP_USE_EXAMPLE_START_BUTTON - if (ExampleActionEventHandler) - { - sExampleActionButton.Configure(&sButtonRow1Dt, &sButtonCol2Dt, ExampleActionButtonEventHandler); - } -#endif -#if APP_USE_THREAD_START_BUTTON - sThreadStartButton.Configure(&sButtonRow2Dt, &sButtonCol1Dt, StartThreadButtonEventHandler); -#endif -#endif + LedManager & ledManager = LedManager::getInstance(); - ButtonManagerInst().AddButton(sFactoryResetButton); -#if APP_USE_BLE_START_BUTTON - ButtonManagerInst().AddButton(sBleAdvStartButton); -#endif -#if APP_USE_THREAD_START_BUTTON - ButtonManagerInst().AddButton(sThreadStartButton); -#endif -#if APP_USE_EXAMPLE_START_BUTTON - if (ExampleActionEventHandler) - { - ButtonManagerInst().AddButton(sExampleActionButton); - } -#endif + LinkLeds(ledManager); + + ledManager.linkBackend(LedPool::getInstance()); } +void AppTaskCommon::LinkLeds(LedManager & ledManager) +{ #if CONFIG_CHIP_ENABLE_APPLICATION_STATUS_LED -void AppTaskCommon::UpdateLedStateEventHandler(AppEvent * aEvent) + ledManager.linkLed(LedManager::EAppLed_Status, 0); +#endif // CONFIG_CHIP_ENABLE_APPLICATION_STATUS_LED +} + +void AppTaskCommon::InitPwms() { - if (aEvent->Type == AppEvent::kEventType_UpdateLedState) - { - aEvent->UpdateLedStateEvent.LedWidget->UpdateState(); - } + PwmManager & pwmManager = PwmManager::getInstance(); + + LinkPwms(pwmManager); + +#if CONFIG_WS2812_STRIP + pwmManager.linkBackend(Ws2812Strip::getInstance()); +#else + pwmManager.linkBackend(PwmPool::getInstance()); +#endif // CONFIG_WS2812_STRIP } -void AppTaskCommon::LEDStateUpdateHandler(LEDWidget * ledWidget) +void AppTaskCommon::LinkPwms(PwmManager & pwmManager) { - AppEvent event; - event.Type = AppEvent::kEventType_UpdateLedState; - event.Handler = UpdateLedStateEventHandler; - event.UpdateLedStateEvent.LedWidget = ledWidget; - GetAppTask().PostEvent(&event); +#if CONFIG_WS2812_STRIP + pwmManager.linkPwm(PwmManager::EAppPwm_Red, 0); + pwmManager.linkPwm(PwmManager::EAppPwm_Green, 1); + pwmManager.linkPwm(PwmManager::EAppPwm_Blue, 2); +#else + pwmManager.linkPwm(PwmManager::EAppPwm_Indication, 0); + pwmManager.linkPwm(PwmManager::EAppPwm_Red, 1); + pwmManager.linkPwm(PwmManager::EAppPwm_Green, 2); + pwmManager.linkPwm(PwmManager::EAppPwm_Blue, 3); +#endif // CONFIG_WS2812_STRIP +} + +void AppTaskCommon::InitButtons(void) +{ + ButtonManager & buttonManager = ButtonManager::getInstance(); + + LinkButtons(buttonManager); + +#if CONFIG_CHIP_BUTTON_MANAGER_IRQ_MODE + buttonManager.linkBackend(ButtonPool::getInstance()); +#else + buttonManager.linkBackend(ButtonMatrix::getInstance()); +#endif // CONFIG_CHIP_BUTTON_MANAGER_IRQ_MODE +} + +void AppTaskCommon::LinkButtons(ButtonManager & buttonManager) +{ + buttonManager.addCallback(FactoryResetButtonEventHandler, 0, true); + buttonManager.addCallback(ExampleActionButtonEventHandler, 1, true); + buttonManager.addCallback(StartBleAdvButtonEventHandler, 2, true); +#if !CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE && CHIP_DEVICE_CONFIG_ENABLE_THREAD + buttonManager.addCallback(StartThreadButtonEventHandler, 3, true); +#endif } void AppTaskCommon::UpdateStatusLED() { - if (sIsThreadProvisioned && sIsThreadEnabled) + if (sIsNetworkProvisioned && sIsNetworkEnabled) { if (sIsThreadAttached) { - sStatusLED.Blink(950, 50); + LedManager::getInstance().setLed(LedManager::EAppLed_Status, 950, 50); } else { - sStatusLED.Blink(100, 100); + LedManager::getInstance().setLed(LedManager::EAppLed_Status, 100, 100); } } else { - sStatusLED.Blink(50, 950); + LedManager::getInstance().setLed(LedManager::EAppLed_Status, 50, 950); } } -#endif - -#ifdef APP_USE_IDENTIFY_PWM -void AppTaskCommon::ActionIdentifyStateUpdateHandler(k_timer * timer) -{ - AppEvent event; - event.Type = AppEvent::kEventType_UpdateLedState; - event.Handler = UpdateIdentifyStateEventHandler; - GetAppTask().PostEvent(&event); -} - -void AppTaskCommon::UpdateIdentifyStateEventHandler(AppEvent * aEvent) -{ - GetAppTask().mPwmIdentifyLed.UpdateAction(); -} void AppTaskCommon::IdentifyEffectHandler(Clusters::Identify::EffectIdentifierEnum aEffect) { - AppEvent event; - event.Type = AppEvent::kEventType_IdentifyStart; - switch (aEffect) { case Clusters::Identify::EffectIdentifierEnum::kBlink: ChipLogProgress(Zcl, "Clusters::Identify::EffectIdentifierEnum::kBlink"); - event.Handler = [](AppEvent *) { - GetAppTask().mPwmIdentifyLed.InitiateBlinkAction(kIdentifyBlinkRateMs, kIdentifyBlinkRateMs); - }; + PwmManager::getInstance().setPwmBlink(PwmManager::EAppPwm_Indication, kIdentifyBlinkRateMs, kIdentifyBlinkRateMs); break; case Clusters::Identify::EffectIdentifierEnum::kBreathe: ChipLogProgress(Zcl, "Clusters::Identify::EffectIdentifierEnum::kBreathe"); - event.Handler = [](AppEvent *) { - GetAppTask().mPwmIdentifyLed.InitiateBreatheAction(PWMDevice::kBreatheType_Both, kIdentifyBreatheRateMs); - }; + PwmManager::getInstance().setPwmBreath(PwmManager::EAppPwm_Indication, kIdentifyBreatheRateMs); break; case Clusters::Identify::EffectIdentifierEnum::kOkay: ChipLogProgress(Zcl, "Clusters::Identify::EffectIdentifierEnum::kOkay"); - event.Handler = [](AppEvent *) { - GetAppTask().mPwmIdentifyLed.InitiateBlinkAction(kIdentifyOkayOnRateMs, kIdentifyOkayOffRateMs); - }; + PwmManager::getInstance().setPwmBlink(PwmManager::EAppPwm_Indication, kIdentifyOkayOnRateMs, kIdentifyOkayOffRateMs); break; case Clusters::Identify::EffectIdentifierEnum::kChannelChange: ChipLogProgress(Zcl, "Clusters::Identify::EffectIdentifierEnum::kChannelChange"); - event.Handler = [](AppEvent *) { - GetAppTask().mPwmIdentifyLed.InitiateBlinkAction(kIdentifyChannelChangeRateMs, kIdentifyChannelChangeRateMs); - }; + PwmManager::getInstance().setPwmBlink(PwmManager::EAppPwm_Indication, kIdentifyChannelChangeRateMs, + kIdentifyChannelChangeRateMs); break; case Clusters::Identify::EffectIdentifierEnum::kFinishEffect: ChipLogProgress(Zcl, "Clusters::Identify::EffectIdentifierEnum::kFinishEffect"); - event.Handler = [](AppEvent *) { - GetAppTask().mPwmIdentifyLed.InitiateBlinkAction(kIdentifyFinishOnRateMs, kIdentifyFinishOffRateMs); - }; + PwmManager::getInstance().setPwmBlink(PwmManager::EAppPwm_Indication, kIdentifyFinishOnRateMs, kIdentifyFinishOffRateMs); break; case Clusters::Identify::EffectIdentifierEnum::kStopEffect: ChipLogProgress(Zcl, "Clusters::Identify::EffectIdentifierEnum::kStopEffect"); - event.Handler = [](AppEvent *) { GetAppTask().mPwmIdentifyLed.StopAction(); }; - event.Type = AppEvent::kEventType_IdentifyStop; + PwmManager::getInstance().setPwm(PwmManager::EAppPwm_Indication, false); break; default: ChipLogProgress(Zcl, "No identifier effect"); return; } - - GetAppTask().PostEvent(&event); } -#endif -#if APP_USE_BLE_START_BUTTON void AppTaskCommon::StartBleAdvButtonEventHandler(void) { AppEvent event; @@ -574,7 +494,6 @@ void AppTaskCommon::StartBleAdvHandler(AppEvent * aEvent) LOG_ERR("OpenBasicCommissioningWindow fail"); } } -#endif void AppTaskCommon::FactoryResetButtonEventHandler(void) { @@ -629,7 +548,7 @@ void AppTaskCommon::FactoryResetTimerEventHandler(AppEvent * aEvent) LOG_INF("Factory Reset Trigger Counter is cleared"); } -#if APP_USE_THREAD_START_BUTTON || !CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE +#if !CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE && CHIP_DEVICE_CONFIG_ENABLE_THREAD void AppTaskCommon::StartThreadButtonEventHandler(void) { AppEvent event; @@ -662,7 +581,6 @@ void AppTaskCommon::StartThreadHandler(AppEvent * aEvent) } #endif -#if APP_USE_EXAMPLE_START_BUTTON void AppTaskCommon::ExampleActionButtonEventHandler(void) { AppEvent event; @@ -682,7 +600,6 @@ void AppTaskCommon::SetExampleButtonCallbacks(EventHandler aAction_CB) { ExampleActionEventHandler = aAction_CB; } -#endif void AppTaskCommon::ChipEventHandler(const ChipDeviceEvent * event, intptr_t /* arg */) { @@ -690,9 +607,7 @@ void AppTaskCommon::ChipEventHandler(const ChipDeviceEvent * event, intptr_t /* { case DeviceEventType::kCHIPoBLEAdvertisingChange: sHaveBLEConnections = ConnectivityMgr().NumBLEConnections() != 0; -#if CONFIG_CHIP_ENABLE_APPLICATION_STATUS_LED UpdateStatusLED(); -#endif #ifdef CONFIG_CHIP_NFC_COMMISSIONING if (event->CHIPoBLEAdvertisingChange.Result == kActivity_Started) { @@ -711,14 +626,7 @@ void AppTaskCommon::ChipEventHandler(const ChipDeviceEvent * event, intptr_t /* } #endif break; - case DeviceEventType::kThreadStateChange: - sIsThreadProvisioned = ConnectivityMgr().IsThreadProvisioned(); - sIsThreadEnabled = ConnectivityMgr().IsThreadEnabled(); - sIsThreadAttached = ConnectivityMgr().IsThreadAttached(); -#if CONFIG_CHIP_ENABLE_APPLICATION_STATUS_LED - UpdateStatusLED(); -#endif - break; +#if CHIP_DEVICE_CONFIG_ENABLE_THREAD case DeviceEventType::kDnssdInitialized: #if CONFIG_CHIP_OTA_REQUESTOR InitBasicOTARequestor(); @@ -730,6 +638,15 @@ void AppTaskCommon::ChipEventHandler(const ChipDeviceEvent * event, intptr_t /* #endif /* CONFIG_BOOTLOADER_MCUBOOT */ #if CONFIG_CHIP_OTA_REQUESTOR } +#endif + break; + case DeviceEventType::kThreadStateChange: + sIsNetworkProvisioned = ConnectivityMgr().IsThreadProvisioned(); + sIsNetworkEnabled = ConnectivityMgr().IsThreadEnabled(); + sIsThreadAttached = ConnectivityMgr().IsThreadAttached(); +#endif /* CHIP_DEVICE_CONFIG_ENABLE_THREAD */ +#if CONFIG_CHIP_ENABLE_APPLICATION_STATUS_LED + UpdateStatusLED(); #endif break; default: diff --git a/examples/platform/telink/common/src/SensorManagerCommon.cpp b/examples/platform/telink/common/src/SensorManagerCommon.cpp index 1c4d5f9990a0cb..0164749ce7167b 100644 --- a/examples/platform/telink/common/src/SensorManagerCommon.cpp +++ b/examples/platform/telink/common/src/SensorManagerCommon.cpp @@ -17,6 +17,7 @@ */ #include "SensorManagerCommon.h" +#include "PWMManager.h" #ifdef CONFIG_CHIP_USE_MARS_SENSOR #include #endif // CONFIG_CHIP_USE_MARS_SENSOR @@ -36,7 +37,6 @@ constexpr uint16_t kSensorBanForNextMeasurTimeout = 1000; // 1s timeout const struct device * const sht3xd_dev = DEVICE_DT_GET_ONE(sensirion_sht3xd); #ifdef USE_COLOR_TEMPERATURE_LIGHT -const struct device * const ws2812_dev = DEVICE_DT_GET(DT_ALIAS(led_strip)); #define TEMP_LOW_LIM 0 // °C #define TEMP_HIGH_LIM 40 // °C @@ -60,16 +60,6 @@ CHIP_ERROR SensorManager::Init() #ifdef USE_COLOR_TEMPERATURE_LIGHT RgbColor_t rgb = { 0 }; - - CHIP_ERROR err = sSensorManager.mWS2812Device.Init(ws2812_dev, STRIP_NUM_PIXELS(led_strip)); - if (err != CHIP_NO_ERROR) - { - LOG_ERR("WS2812 Device Init fail"); - return err; - } - - sSensorManager.mWS2812Device.SetLevel(&rgb); - sSensorManager.mWS2812Device.Set(SET_RGB_TURN_ON); #endif // USE_COLOR_TEMPERATURE_LIGHT // Initialise the timer to ban sensor measurement @@ -245,7 +235,9 @@ void SensorManager::SetColorTemperatureLight(int8_t temp) LOG_ERR("Couldn't set the Color Temperature Light"); } - sSensorManager.mWS2812Device.SetLevel(&rgb); + PwmManager::getInstance().setPwm(PwmManager::EAppPwm_Red, ((uint32_t) rgb.r * 1000) / 0xff); + PwmManager::getInstance().setPwm(PwmManager::EAppPwm_Green, ((uint32_t) rgb.g * 1000) / 0xff); + PwmManager::getInstance().setPwm(PwmManager::EAppPwm_Blue, ((uint32_t) rgb.b * 1000) / 0xff); } #endif // USE_COLOR_TEMPERATURE_LIGHT #endif // CONFIG_CHIP_USE_MARS_SENSOR diff --git a/examples/platform/telink/common/src/mainCommon.cpp b/examples/platform/telink/common/src/mainCommon.cpp index ea13dc2f51252f..c80ab4c609e971 100644 --- a/examples/platform/telink/common/src/mainCommon.cpp +++ b/examples/platform/telink/common/src/mainCommon.cpp @@ -1,6 +1,6 @@ /* * - * Copyright (c) 2021-2023 Project CHIP Authors + * Copyright (c) 2021-2024 Project CHIP Authors * All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -128,9 +128,12 @@ int main(void) LOG_ERR("StartEventLoopTask fail"); goto exit; } + #ifdef CONFIG_CHIP_ENABLE_POWER_ON_FACTORY_RESET FactoryResetOnBoot(); #endif /* CONFIG_CHIP_ENABLE_POWER_ON_FACTORY_RESET */ + +#if CHIP_DEVICE_CONFIG_ENABLE_THREAD err = ThreadStackMgr().InitThreadStack(); if (err != CHIP_NO_ERROR) { @@ -152,6 +155,9 @@ int main(void) LOG_ERR("SetThreadDeviceType fail"); goto exit; } +#else + return CHIP_ERROR_INTERNAL; +#endif /* CHIP_DEVICE_CONFIG_ENABLE_THREAD */ err = GetAppTask().StartApp(); diff --git a/examples/platform/telink/util/include/ButtonManager.h b/examples/platform/telink/util/include/ButtonManager.h index e9ea1b60b17816..c61f165dbca94e 100644 --- a/examples/platform/telink/util/include/ButtonManager.h +++ b/examples/platform/telink/util/include/ButtonManager.h @@ -17,53 +17,125 @@ #pragma once -#include -#include +#include +#include -#define STATE_HIGH 1 -#define STATE_LOW 0 +class ButtonBackend +{ +public: + virtual bool linkHW(void (*on_button_change)(size_t button, bool pressed, void * context), void * context) = 0; +}; -class Button +class ButtonManager { public: - void Configure(const gpio_dt_spec * input_button_dt, const gpio_dt_spec * output_button_dt, void (*callback)(void)); - void Configure(const gpio_dt_spec * input_button_dt, void (*callback)(void)); - void Poll(Button * previous); - void PollIRQ(const struct device * dev, uint32_t pins); - void SetCallback(void (*callback)(void)); + static ButtonManager & getInstance(); + void addCallback(void (*callback)(void), size_t button, bool pressed); + void rmCallback(void (*callback)(void)); + void rmCallback(size_t button, bool pressed); + void linkBackend(ButtonBackend & backend); + + ButtonManager(ButtonManager const &) = delete; + void operator=(ButtonManager const &) = delete; private: - int Init(void); - int Deinit(void); - - const struct gpio_dt_spec * mInput_button; - const struct gpio_dt_spec * mOutput_matrix_pin; - int mPreviousState = STATE_LOW; - struct gpio_callback mButton_cb_data; - void (*mCallback)(void) = NULL; + struct Event + { + size_t button; + bool pressed; + void (*callback)(void); + + friend bool operator<(const Event & lhs, const Event & rhs) + { + if (lhs.button < rhs.button) + { + return true; + } + else if (lhs.button > rhs.button) + { + return false; + } + else if (lhs.pressed < rhs.pressed) + { + return true; + } + else if (lhs.pressed > rhs.pressed) + { + return false; + } + else if (lhs.callback < rhs.callback) + { + return true; + } + else + { + return false; + } + } + friend bool operator>(const Event & lhs, const Event & rhs) + { + if (lhs.button > rhs.button) + { + return true; + } + else if (lhs.button < rhs.button) + { + return false; + } + else if (lhs.pressed > rhs.pressed) + { + return true; + } + else if (lhs.pressed < rhs.pressed) + { + return false; + } + else if (lhs.callback > rhs.callback) + { + return true; + } + else + { + return false; + } + } + }; + + ButtonManager(); + + static void onButton(size_t button, bool pressed, void * buttonMgr); + + std::set m_events; }; -class ButtonManager +#if CONFIG_CHIP_BUTTON_MANAGER_IRQ_MODE + +class ButtonPool : public ButtonBackend { public: - void Init(void); - void Poll(void); - void PollIRQ(const struct device * dev, uint32_t pins); - void AddButton(Button & button); - void SetCallback(unsigned int index, void (*callback)(void)); + static ButtonPool & getInstance(); + bool linkHW(void (*on_button_change)(size_t button, bool pressed, void * context), void * context); + + ButtonPool(ButtonPool const &) = delete; + void operator=(ButtonPool const &) = delete; private: - std::vector