Skip to content

Commit 3770370

Browse files
interfers07641069
authored andcommitted
[Telink] Add Window app demo (#25240)
* [Telink] Window App demo draft * [Telink] modified action buttons & Updated CI * [Telink] Fix CI build and spelling * [Telink] PWM LED fixed, code cleanup * [Telink] small fixes * [Telink] review fixes & styling --------- Co-authored-by: Alex Tsitsiura <s07641069@gmail.com>
1 parent d6fe99a commit 3770370

20 files changed

+2073
-1
lines changed

.github/workflows/examples-telink.yaml

+12
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,18 @@ jobs:
214214
- name: clean out build output
215215
run: rm -rf ./out
216216

217+
- name: Build example Telink Window Covering App
218+
run: |
219+
./scripts/run_in_build_env.sh \
220+
"./scripts/build/build_examples.py --target 'telink-tlsr9518adk80d-window-covering' build"
221+
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
222+
telink tlsr9518adk80d window-covering \
223+
out/telink-tlsr9518adk80d-window-covering/zephyr/zephyr.elf \
224+
/tmp/bloat_reports/
225+
226+
- name: clean out build output
227+
run: rm -rf ./out
228+
217229
- name: Uploading Size Reports
218230
uses: actions/upload-artifact@v3
219231
if: ${{ !env.ACT }}

.vscode/tasks.json

+1
Original file line numberDiff line numberDiff line change
@@ -647,6 +647,7 @@
647647
"telink-tlsr9518adk80d-pump-controller-app",
648648
"telink-tlsr9518adk80d-temperature-measurement",
649649
"telink-tlsr9518adk80d-thermostat",
650+
"telink-tlsr9518adk80d-window-covering",
650651
"tizen-arm-light"
651652
]
652653
},

examples/window-app/telink/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build/
+225
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,225 @@
1+
#
2+
# Copyright (c) 2023 Project CHIP Authors
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
cmake_minimum_required(VERSION 3.13.1)
17+
18+
set(BOARD tlsr9518adk80d)
19+
20+
get_filename_component(CHIP_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/third_party/connectedhomeip REALPATH)
21+
get_filename_component(TELINK_COMMON ${CHIP_ROOT}/examples/platform/telink REALPATH)
22+
get_filename_component(GEN_DIR ${CHIP_ROOT}/zzz_generated/ REALPATH)
23+
24+
set(CONF_FILE ${CHIP_ROOT}/config/telink/app/zephyr.conf prj.conf)
25+
26+
# Load NCS/Zephyr build system
27+
list(APPEND ZEPHYR_EXTRA_MODULES ${CHIP_ROOT}/config/telink/chip-module)
28+
find_package(Zephyr HINTS $ENV{ZEPHYR_BASE})
29+
30+
project(chip-telink-window-app-example)
31+
32+
include(${CHIP_ROOT}/config/telink/app/enable-gnu-std.cmake)
33+
include(${CHIP_ROOT}/src/app/chip_data_model.cmake)
34+
35+
target_compile_options(app PRIVATE -fpermissive)
36+
37+
target_include_directories(app PRIVATE
38+
include
39+
${GEN_DIR}/app-common
40+
${GEN_DIR}/window-app
41+
${TELINK_COMMON}/util/include
42+
${TELINK_COMMON}/app/include)
43+
44+
add_definitions(
45+
"-DCHIP_ADDRESS_RESOLVE_IMPL_INCLUDE_HEADER=<lib/address_resolve/AddressResolve_DefaultImpl.h>"
46+
)
47+
48+
target_sources(app PRIVATE
49+
src/AppTask.cpp
50+
src/main.cpp
51+
src/ZclCallbacks.cpp
52+
src/WindowCovering.cpp
53+
${TELINK_COMMON}/util/src/LEDWidget.cpp
54+
${TELINK_COMMON}/util/src/ButtonManager.cpp
55+
${TELINK_COMMON}/util/src/ThreadUtil.cpp
56+
${TELINK_COMMON}/util/src/PWMDevice.cpp
57+
)
58+
59+
chip_configure_data_model(app
60+
INCLUDE_SERVER
61+
ZAP_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../common/window-app.zap
62+
)
63+
64+
if(CONFIG_CHIP_OTA_REQUESTOR)
65+
target_sources(app PRIVATE ${TELINK_COMMON}/util/src/OTAUtil.cpp)
66+
endif()
67+
68+
# Fix for unused swap parameter in: zephyr/include/zephyr/arch/riscv/irq.h:70
69+
add_compile_options(-Wno-error=unused-parameter)
70+
71+
if (CONFIG_CHIP_PW_RPC)
72+
73+
# Make all targets created below depend on zephyr_interface to inherit MCU-related compilation flags
74+
link_libraries($<BUILD_INTERFACE:zephyr_interface>)
75+
76+
set(PIGWEED_ROOT "${CHIP_ROOT}/third_party/pigweed/repo")
77+
include(${PIGWEED_ROOT}/pw_build/pigweed.cmake)
78+
include(${PIGWEED_ROOT}/pw_protobuf_compiler/proto.cmake)
79+
80+
pw_set_module_config(pw_rpc_CONFIG pw_rpc.disable_global_mutex_config)
81+
pw_set_backend(pw_log pw_log_basic)
82+
pw_set_backend(pw_assert.check pw_assert_log.check_backend)
83+
pw_set_backend(pw_assert.assert pw_assert.assert_compatibility_backend)
84+
pw_set_backend(pw_sys_io pw_sys_io.telink)
85+
pw_set_backend(pw_trace pw_trace_tokenized)
86+
set(dir_pw_third_party_nanopb "${CHIP_ROOT}/third_party/nanopb/repo" CACHE STRING "" FORCE)
87+
88+
add_subdirectory(third_party/connectedhomeip/third_party/pigweed/repo)
89+
add_subdirectory(third_party/connectedhomeip/third_party/nanopb/repo)
90+
add_subdirectory(third_party/connectedhomeip/examples/platform/telink/pw_sys_io)
91+
92+
pw_proto_library(attributes_service
93+
SOURCES
94+
${CHIP_ROOT}/examples/common/pigweed/protos/attributes_service.proto
95+
INPUTS
96+
${CHIP_ROOT}/examples/common/pigweed/protos/attributes_service.options
97+
PREFIX
98+
attributes_service
99+
STRIP_PREFIX
100+
${CHIP_ROOT}/examples/common/pigweed/protos
101+
DEPS
102+
pw_protobuf.common_proto
103+
)
104+
105+
pw_proto_library(button_service
106+
SOURCES
107+
${CHIP_ROOT}/examples/common/pigweed/protos/button_service.proto
108+
PREFIX
109+
button_service
110+
STRIP_PREFIX
111+
${CHIP_ROOT}/examples/common/pigweed/protos
112+
DEPS
113+
pw_protobuf.common_proto
114+
)
115+
116+
pw_proto_library(descriptor_service
117+
SOURCES
118+
${CHIP_ROOT}/examples/common/pigweed/protos/descriptor_service.proto
119+
PREFIX
120+
descriptor_service
121+
STRIP_PREFIX
122+
${CHIP_ROOT}/examples/common/pigweed/protos
123+
DEPS
124+
pw_protobuf.common_proto
125+
)
126+
127+
pw_proto_library(device_service
128+
SOURCES
129+
${CHIP_ROOT}/examples/common/pigweed/protos/device_service.proto
130+
INPUTS
131+
${CHIP_ROOT}/examples/common/pigweed/protos/device_service.options
132+
PREFIX
133+
device_service
134+
STRIP_PREFIX
135+
${CHIP_ROOT}/examples/common/pigweed/protos
136+
DEPS
137+
pw_protobuf.common_proto
138+
)
139+
140+
pw_proto_library(lighting_service
141+
SOURCES
142+
${CHIP_ROOT}/examples/common/pigweed/protos/lighting_service.proto
143+
STRIP_PREFIX
144+
${CHIP_ROOT}/examples/common/pigweed/protos
145+
PREFIX
146+
lighting_service
147+
DEPS
148+
pw_protobuf.common_proto
149+
)
150+
151+
pw_proto_library(ot_cli_service
152+
SOURCES
153+
${CHIP_ROOT}/examples/common/pigweed/protos/ot_cli_service.proto
154+
INPUTS
155+
${CHIP_ROOT}/examples/common/pigweed/protos/ot_cli_service.options
156+
STRIP_PREFIX
157+
${CHIP_ROOT}/examples/common/pigweed/protos
158+
PREFIX
159+
ot_cli_service
160+
DEPS
161+
pw_protobuf.common_proto
162+
)
163+
164+
pw_proto_library(thread_service
165+
SOURCES
166+
${CHIP_ROOT}/examples/common/pigweed/protos/thread_service.proto
167+
INPUTS
168+
${CHIP_ROOT}/examples/common/pigweed/protos/thread_service.options
169+
STRIP_PREFIX
170+
${CHIP_ROOT}/examples/common/pigweed/protos
171+
PREFIX
172+
thread_service
173+
DEPS
174+
pw_protobuf.common_proto
175+
)
176+
177+
target_sources(app PRIVATE
178+
../../common/pigweed/RpcService.cpp
179+
../../common/pigweed/telink/PigweedLoggerMutex.cpp
180+
${TELINK_COMMON}/Rpc.cpp
181+
${TELINK_COMMON}/util/src/PigweedLogger.cpp
182+
)
183+
184+
target_include_directories(app PRIVATE
185+
${PIGWEED_ROOT}/pw_sys_io/public
186+
${CHIP_ROOT}/src/lib/support
187+
${CHIP_ROOT}/src/system
188+
${TELINK_COMMON}
189+
../../common
190+
../../common/pigweed
191+
../../common/pigweed/telink)
192+
193+
target_compile_options(app PRIVATE
194+
"-DPW_RPC_ATTRIBUTE_SERVICE=1"
195+
"-DPW_RPC_BUTTON_SERVICE=1"
196+
"-DPW_RPC_DESCRIPTOR_SERVICE=1"
197+
"-DPW_RPC_DEVICE_SERVICE=1"
198+
"-DPW_RPC_LIGHTING_SERVICE=1"
199+
"-DPW_RPC_THREAD_SERVICE=1"
200+
"-DPW_RPC_TRACING_SERVICE=1"
201+
"-DPW_TRACE_BACKEND_SET=1")
202+
203+
target_link_libraries(app PRIVATE
204+
attributes_service.nanopb_rpc
205+
button_service.nanopb_rpc
206+
descriptor_service.nanopb_rpc
207+
device_service.nanopb_rpc
208+
lighting_service.nanopb_rpc
209+
thread_service.nanopb_rpc
210+
pw_checksum
211+
pw_hdlc
212+
pw_log
213+
pw_rpc.server
214+
pw_trace_tokenized
215+
pw_trace_tokenized.trace_buffer
216+
pw_trace_tokenized.rpc_service
217+
pw_trace_tokenized.protos.nanopb_rpc
218+
)
219+
220+
target_link_options(app
221+
PUBLIC
222+
"-T${PIGWEED_ROOT}/pw_tokenizer/pw_tokenizer_linker_sections.ld"
223+
)
224+
225+
endif(CONFIG_CHIP_PW_RPC)

0 commit comments

Comments
 (0)