Skip to content

Commit

Permalink
riscv: telink: clean code and update CI .
Browse files Browse the repository at this point in the history
- clean dual mode logic .
- update CI for b92 and tl3218x .
- fix the switch logic part .

Signed-off-by: Haiwen Xia <[email protected]>
  • Loading branch information
haiwentelink committed Dec 17, 2024
1 parent 4532287 commit a1b798b
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 258 deletions.
235 changes: 6 additions & 229 deletions .github/workflows/examples-telink.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,75 +60,6 @@ jobs:
# - name: Update Zephyr to specific revision (for developers purpose)
# run: scripts/run_in_build_env.sh "python3 scripts/tools/telink/update_zephyr.py 8b29ee6b118ebe6eeec3224dbe343474e11403d8"

- name: Build example Telink (B92 retention) Air Quality Sensor App
# Run test for master and s07641069 PRs
if: github.event.pull_request.number == null || github.event.pull_request.head.repo.full_name == 's07641069/connectedhomeip'
run: |
./scripts/run_in_build_env.sh \
"./scripts/build/build_examples.py --target 'telink-tlsr9528a_retention-air-quality-sensor' build"
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
telink tlsr9528a_retention air-quality-sensor-app \
out/telink-tlsr9528a_retention-air-quality-sensor/zephyr/zephyr.elf \
/tmp/bloat_reports/
- name: clean out build output
run: rm -rf ./out

- name: Build example Telink (W91) All Clusters App
# Run test for master and s07641069 PRs
if: github.event.pull_request.number == null || github.event.pull_request.head.repo.full_name == 's07641069/connectedhomeip'
continue-on-error: true
run: |
./scripts/run_in_build_env.sh \
"./scripts/build/build_examples.py --target 'telink-tlsr9118bdk40d-all-clusters' build"
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
telink tlsr9118bdk40d all-clusters-app \
out/telink-tlsr9118bdk40d-all-clusters/zephyr/zephyr.elf \
/tmp/bloat_reports/
- name: clean out build output
run: rm -rf ./out

- name: Build example Telink (B92) All Clusters Minimal App
# Run test for master and s07641069 PRs
if: github.event.pull_request.number == null || github.event.pull_request.head.repo.full_name == 's07641069/connectedhomeip'
run: |
./scripts/run_in_build_env.sh \
"./scripts/build/build_examples.py --target 'telink-tlsr9528a-all-clusters-minimal' build"
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
telink tlsr9528a all-clusters-minimal-app \
out/telink-tlsr9528a-all-clusters-minimal/zephyr/zephyr.elf \
/tmp/bloat_reports/
- name: clean out build output
run: rm -rf ./out

- name: Build example Telink (B95) Bridge App
# Run test for master and all PRs
run: |
./scripts/run_in_build_env.sh \
"./scripts/build/build_examples.py --target 'telink-tlsr9258a-bridge' build"
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
telink tlsr9258a bridge-app \
out/telink-tlsr9258a-bridge/zephyr/zephyr.elf \
/tmp/bloat_reports/
- name: clean out build output
run: rm -rf ./out

- name: Build example Telink (B92 retention) Contact Sensor App
# Run test for master and all PRs
run: |
./scripts/run_in_build_env.sh \
"./scripts/build/build_examples.py --target 'telink-tlsr9528a_retention-contact-sensor' build"
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
telink tlsr9528a_retention contact-sensor-app \
out/telink-tlsr9528a_retention-contact-sensor/zephyr/zephyr.elf \
/tmp/bloat_reports/
- name: clean out build output
run: rm -rf ./out

- name: Build tools required for Factory Data
# Run test for master and all PRs
run: |
Expand All @@ -140,33 +71,6 @@ jobs:
- name: clean out build output (keep tools)
run: rm -rf ./out/telink*

- name: Build example Telink (W91) Lighting App with OTA, Factory Data
# Run test for master and all PRs
continue-on-error: true
run: |
./scripts/run_in_build_env.sh \
"./scripts/build/build_examples.py --target 'telink-tlsr9118bdk40d-light-ota-factory-data' build"
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
telink tlsr9118bdk40d lighting-app-ota-factory-data \
out/telink-tlsr9118bdk40d-light-ota-factory-data/zephyr/zephyr.elf \
/tmp/bloat_reports/
- name: clean out build output (keep tools)
run: rm -rf ./out/telink*

- name: Build example Telink (B91) Lighting App with OTA, RPC, Factory Data and 4Mb flash
# Run test for master and all PRs
run: |
./scripts/run_in_build_env.sh \
"./scripts/build/build_examples.py --target 'telink-tlsr9518adk80d-light-ota-rpc-factory-data-4mb' build"
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
telink tlsr9518adk80d lighting-app-ota-rpc-factory-data-4mb \
out/telink-tlsr9518adk80d-light-ota-rpc-factory-data-4mb/zephyr/zephyr.elf \
/tmp/bloat_reports/
- name: clean out build output (keep tools)
run: rm -rf ./out/telink*

- name: Build example Telink (tl321x) Lighting App with OTA (LZMA), Shell, Factory Data
# Run test for master and all PRs
run: |
Expand All @@ -180,145 +84,18 @@ jobs:
- name: clean out build output (keep tools)
run: rm -rf ./out/telink*

- name: Build example Telink (B92) Light Switch App with OTA (LZMA), Shell, Factory Data
- name: Build example Telink (tlsr9528a) Lighting App with OTA (LZMA), Shell, Factory Data
# Run test for master and all PRs
run: |
./scripts/run_in_build_env.sh \
"./scripts/build/build_examples.py --target 'telink-tlsr9528a-light-switch-ota-compress-lzma-shell-factory-data' build"
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
telink tlsr9528a light-switch-app-ota-compress-lzma-shell-factory-data \
out/telink-tlsr9528a-light-switch-ota-compress-lzma-shell-factory-data/zephyr/zephyr.elf \
/tmp/bloat_reports/
- name: clean out build output
run: rm -rf ./out

- name: Build example Telink (B92) Lock App with DFU
# Run test for master and s07641069 PRs
if: github.event.pull_request.number == null || github.event.pull_request.head.repo.full_name == 's07641069/connectedhomeip'
run: |
./scripts/run_in_build_env.sh \
"./scripts/build/build_examples.py --target 'telink-tlsr9528a-lock-dfu' build"
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
telink tlsr9528a lock-app-dfu \
out/telink-tlsr9528a-lock-dfu/zephyr/zephyr.elf \
/tmp/bloat_reports/
- name: clean out build output
run: rm -rf ./out

- name: Build example Telink (B95) OTA Requestor App
# Run test for master and s07641069 PRs
if: github.event.pull_request.number == null || github.event.pull_request.head.repo.full_name == 's07641069/connectedhomeip'
run: |
./scripts/run_in_build_env.sh \
"./scripts/build/build_examples.py --target 'telink-tlsr9258a-ota-requestor' build"
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
telink tlsr9258a ota-requestor-app \
out/telink-tlsr9258a-ota-requestor/zephyr/zephyr.elf \
/tmp/bloat_reports/
- name: clean out build output
run: rm -rf ./out

- name: Build example Telink (B91 USB) Pump App
# Run test for master and s07641069 PRs
if: github.event.pull_request.number == null || github.event.pull_request.head.repo.full_name == 's07641069/connectedhomeip'
run: |
./scripts/run_in_build_env.sh \
"./scripts/build/build_examples.py --target 'telink-tlsr9518adk80d-pump-usb' build"
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
telink tlsr9518adk80d pump-app-usb \
out/telink-tlsr9518adk80d-pump-usb/zephyr/zephyr.elf \
/tmp/bloat_reports/
- name: clean out build output
run: rm -rf ./out

- name: Build example Telink (B91) Pump Controller App
# Run test for master and s07641069 PRs
if: github.event.pull_request.number == null || github.event.pull_request.head.repo.full_name == 's07641069/connectedhomeip'
run: |
./scripts/run_in_build_env.sh \
"./scripts/build/build_examples.py --target 'telink-tlsr9518adk80d-pump-controller' build"
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
telink tlsr9518adk80d pump-controller-app \
out/telink-tlsr9518adk80d-pump-controller/zephyr/zephyr.elf \
/tmp/bloat_reports/
- name: clean out build output
run: rm -rf ./out

- name: Build example Telink (B91) Shell App
# Run test for master and s07641069 PRs
if: github.event.pull_request.number == null || github.event.pull_request.head.repo.full_name == 's07641069/connectedhomeip'
run: |
./scripts/run_in_build_env.sh \
"./scripts/build/build_examples.py --target 'telink-tlsr9518adk80d-shell' build"
"./scripts/build/build_examples.py --target 'telink-tlsr9528a-light-ota-shell-factory-data' build"
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
telink tlsr9518adk80d shell \
out/telink-tlsr9518adk80d-shell/zephyr/zephyr.elf \
telink tlsr9528a light-app-ota-compress-lzma-shell-factory-data \
out/telink-tlsr9528a-light-ota-compress-lzma-shell-factory-data/zephyr/zephyr.elf \
/tmp/bloat_reports/
- name: clean out build output
run: rm -rf ./out

- name: Build example Telink (B92 retention) Smoke CO Alarm App
# Run test for master and s07641069 PRs
if: github.event.pull_request.number == null || github.event.pull_request.head.repo.full_name == 's07641069/connectedhomeip'
run: |
./scripts/run_in_build_env.sh \
"./scripts/build/build_examples.py --target 'telink-tlsr9528a_retention-smoke-co-alarm' build"
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
telink tlsr9528a_retention smoke_co_alarm-app \
out/telink-tlsr9528a_retention-smoke-co-alarm/zephyr/zephyr.elf \
/tmp/bloat_reports/
- name: clean out build output
run: rm -rf ./out

- name: Build example Telink (B91 Mars) Temperature Measurement App with OTA
# Run test for master and s07641069 PRs
if: github.event.pull_request.number == null || github.event.pull_request.head.repo.full_name == 's07641069/connectedhomeip'
run: |
./scripts/run_in_build_env.sh \
"./scripts/build/build_examples.py --target 'telink-tlsr9518adk80d-temperature-measurement-mars-ota' build"
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
telink tlsr9518adk80d temperature-measurement-app-mars-ota \
out/telink-tlsr9518adk80d-temperature-measurement-mars-ota/zephyr/zephyr.elf \
/tmp/bloat_reports/
- name: clean out build output
run: rm -rf ./out

- name: Build example Telink (B91) Thermostat App
# Run test for master and s07641069 PRs
if: github.event.pull_request.number == null || github.event.pull_request.head.repo.full_name == 's07641069/connectedhomeip'
run: |
./scripts/run_in_build_env.sh \
"./scripts/build/build_examples.py --target 'telink-tlsr9518adk80d-thermostat' build"
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
telink tlsr9518adk80d thermostat \
out/telink-tlsr9518adk80d-thermostat/zephyr/zephyr.elf \
/tmp/bloat_reports/
- name: clean out build output
run: rm -rf ./out

- name: Build example Telink (W91) Window Covering App
# Run test for master and s07641069 PRs
if: github.event.pull_request.number == null || github.event.pull_request.head.repo.full_name == 's07641069/connectedhomeip'
continue-on-error: true
run: |
./scripts/run_in_build_env.sh \
"./scripts/build/build_examples.py --target 'telink-tlsr9118bdk40d-window-covering' build"
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
telink tlsr9118bdk40d window-covering \
out/telink-tlsr9118bdk40d-window-covering/zephyr/zephyr.elf \
/tmp/bloat_reports/
- name: clean out build output
run: rm -rf ./out
- name: clean out build output (keep tools)
run: rm -rf ./out/telink*

- name: Uploading Size Reports
uses: ./.github/actions/upload-size-reports
Expand Down
8 changes: 8 additions & 0 deletions examples/lighting-app/telink/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,14 @@ CHIP_ERROR AppTask::Init(void)
SetExampleButtonCallbacks(LightingActionEventHandler);
InitCommonParts();

if(sBoot_zb){
/* Switch from the touch link, need to restore previous values */
sfixture_on = user_para.onoff;
sBrightness = user_para.lightness;
sAppTask.UpdateClusterState();
printk("Matter: Updated ZB On/Off state and brightness.\n");
}

Protocols::InteractionModel::Status status;

app::DataModel::Nullable<uint8_t> brightness;
Expand Down
18 changes: 15 additions & 3 deletions examples/platform/telink/common/include/AppTaskCommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,26 @@
#include <zephyr/storage/flash_map.h>
#include <zephyr/sys/reboot.h>

#define USER_INIT_VAL 0xff
#define USER_ZB_SW_VAL 0xaa
#define USER_MATTER_PAIR_VAL 0x55
#define USER_INIT_VAL 0xff
#define USER_ZB_SW_VAL 0xaa
#define USER_MATTER_PAIR_VAL 0x55
#define USER_PARA_MAC_OFFSET 0x100
#define USER_PARTITION user_para_partition
#define USER_PARTITION_DEVICE FIXED_PARTITION_DEVICE(USER_PARTITION)
#define USER_PARTITION_OFFSET FIXED_PARTITION_OFFSET(USER_PARTITION)
#define USER_PARTITION_SIZE FIXED_PARTITION_SIZE(USER_PARTITION)

typedef struct{
uint8_t val ;
uint8_t rfu;
uint8_t onoff;
uint8_t lightness;
}user_para_t;

extern user_para_t user_para;
extern uint8_t para_lightness;
extern uint8_t sBoot_zb;

#include <cstdint>

using namespace ::chip;
Expand Down
Loading

0 comments on commit a1b798b

Please sign in to comment.