Skip to content

Commit f69f96c

Browse files
Add Multi-Sensor-App to repository
1 parent 723571b commit f69f96c

26 files changed

+16246
-0
lines changed

.github/workflows/silabs-build-examples.yaml

+7
Original file line numberDiff line numberDiff line change
@@ -99,3 +99,10 @@ jobs:
9999
with:
100100
example-app: "fan-control-app"
101101
output-directory: "./out/fan-control-app"
102+
103+
build-multi-sensor-app:
104+
name: Build Multi-Sensor-App variations
105+
uses: ./.github/workflows/silabs-common-build.yaml
106+
with:
107+
example-app: "multi-sensor-app"
108+
output-directory: "./out/multi-sensor-app"

examples/multi-sensor-app/silabs/.gn

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Copyright (c) 2020 Project CHIP Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
import("//build_overrides/build.gni")
16+
17+
# The location of the build configuration file.
18+
buildconfig = "${build_root}/config/BUILDCONFIG.gn"
19+
20+
# CHIP uses angle bracket includes.
21+
check_system_includes = true
22+
23+
default_args = {
24+
target_cpu = "arm"
25+
target_os = "freertos"
26+
chip_openthread_ftd = true
27+
28+
import("//openthread.gni")
29+
}
+180
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
1+
# Copyright (c) 2020 Project CHIP Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
import("//build_overrides/build.gni")
16+
import("//build_overrides/chip.gni")
17+
import("//build_overrides/efr32_sdk.gni")
18+
import("//build_overrides/pigweed.gni")
19+
20+
import("${build_root}/config/defaults.gni")
21+
import("${silabs_sdk_build_root}/silabs_executable.gni")
22+
23+
import("${chip_root}/examples/common/pigweed/pigweed_rpcs.gni")
24+
import("${chip_root}/src/platform/device.gni")
25+
import("${chip_root}/third_party/silabs/silabs_board.gni")
26+
27+
assert(current_os == "freertos")
28+
29+
silabs_project_dir = "${chip_root}/examples/multi-sensor-app/silabs"
30+
examples_common_plat_dir = "${chip_root}/examples/platform/silabs"
31+
32+
if (wifi_soc) {
33+
import("${silabs_sdk_build_root}/SiWx917_sdk.gni")
34+
examples_plat_dir = "${chip_root}/examples/platform/silabs/SiWx917"
35+
} else {
36+
import("${silabs_sdk_build_root}/efr32_sdk.gni")
37+
examples_plat_dir = "${chip_root}/examples/platform/silabs/efr32"
38+
}
39+
40+
import("${examples_common_plat_dir}/args.gni")
41+
42+
declare_args() {
43+
# Dump memory usage at link time.
44+
chip_print_memory_usage = false
45+
46+
# Configures the frequency at which the sensor values are measured
47+
sl_sensor_timer_period_s = 60
48+
49+
# Configures the threshold necessary to trigger a report
50+
sl_sensor_report_threshold = 100
51+
}
52+
53+
if (slc_generate) {
54+
# Generate Project Specific config (Board, hardware used etc..)
55+
print(exec_script("${chip_root}/third_party/silabs/slc_gen/run_slc.py",
56+
[
57+
rebase_path(chip_root),
58+
"${silabs_board}",
59+
"${disable_lcd}",
60+
"${use_wstk_buttons}",
61+
"${use_wstk_leds}",
62+
"${use_external_flash}",
63+
"${silabs_mcu}",
64+
rebase_path(slc_gen_path),
65+
],
66+
"list lines"))
67+
}
68+
69+
if (wifi_soc) {
70+
siwx917_sdk("sdk") {
71+
sources = [
72+
"${examples_common_plat_dir}/FreeRTOSConfig.h",
73+
"${silabs_project_dir}/include/CHIPProjectConfig.h",
74+
]
75+
76+
include_dirs = [
77+
"${chip_root}/src/platform/silabs/SiWx917",
78+
"${silabs_project_dir}/include",
79+
"${examples_plat_dir}",
80+
"${chip_root}/src/lib",
81+
"${examples_common_plat_dir}",
82+
]
83+
}
84+
} else {
85+
efr32_sdk("sdk") {
86+
sources = [
87+
"${examples_common_plat_dir}/FreeRTOSConfig.h",
88+
"${silabs_project_dir}/include/CHIPProjectConfig.h",
89+
]
90+
91+
include_dirs = [
92+
"${chip_root}/src/platform/silabs/efr32",
93+
"${silabs_project_dir}/include",
94+
"${examples_plat_dir}",
95+
"${chip_root}/src/lib",
96+
"${examples_common_plat_dir}",
97+
]
98+
99+
if (use_wf200) {
100+
# TODO efr32_sdk should not need a header from this location
101+
include_dirs += [ "${examples_plat_dir}/wf200" ]
102+
}
103+
104+
if (chip_enable_ble_rs911x) {
105+
# TODO efr32_sdk should not need a header from this location
106+
include_dirs += [
107+
"${examples_plat_dir}/rs911x",
108+
"${examples_plat_dir}/rs911x/hal",
109+
]
110+
}
111+
}
112+
}
113+
114+
silabs_executable("multi-sensor-app") {
115+
output_name = "matter-silabs-multi-sensor-example.out"
116+
117+
defines = [
118+
"SL_MATTER_SENSOR_TIMER_PERIOD_S=${sl_sensor_timer_period_s}",
119+
"SL_MATTER_SENSOR_REPORT_THRESHOLD=${sl_sensor_report_threshold}",
120+
]
121+
122+
include_dirs = [ "include" ]
123+
124+
if (silabs_board == "BRD2704A") {
125+
defines += [ "SL_STATUS_LED=0" ]
126+
}
127+
128+
sources = [
129+
"${examples_common_plat_dir}/main.cpp",
130+
"src/AppTask.cpp",
131+
"src/DataModelCallbacks.cpp",
132+
"src/SensorManager.cpp",
133+
]
134+
135+
if (!disable_lcd) {
136+
sources += [ "src/SensorsUI.cpp" ]
137+
}
138+
139+
deps = [
140+
":sdk",
141+
app_data_model,
142+
]
143+
144+
if (wifi_soc) {
145+
deps += [ "${examples_plat_dir}:siwx917-common" ]
146+
} else {
147+
deps += [ "${examples_plat_dir}:efr32-common" ]
148+
}
149+
150+
ldscript = "${examples_common_plat_dir}/ldscripts/${silabs_family}.ld"
151+
152+
inputs = [ ldscript ]
153+
154+
ldflags = [ "-T" + rebase_path(ldscript, root_build_dir) ]
155+
156+
if (chip_print_memory_usage) {
157+
ldflags += [
158+
"-Wl,--print-memory-usage",
159+
"-fstack-usage",
160+
]
161+
}
162+
163+
# WiFi Settings
164+
if (chip_enable_wifi) {
165+
ldflags += [
166+
"-Wl,--defsym",
167+
"-Wl,SILABS_WIFI=1",
168+
]
169+
}
170+
171+
output_dir = root_out_dir
172+
}
173+
174+
group("efr32") {
175+
deps = [ ":multi-sensor-app" ]
176+
}
177+
178+
group("default") {
179+
deps = [ ":efr32" ]
180+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Copyright (c) 2020 Project CHIP Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
import("//build_overrides/chip.gni")
16+
import("${chip_root}/config/standalone/args.gni")
17+
import("${chip_root}/src/platform/silabs/wifi_args.gni")
18+
19+
silabs_sdk_target = get_label_info(":sdk", "label_no_toolchain")
20+
21+
app_data_model = "${chip_root}/examples/multi-sensor-app/silabs/data_model:multi-sensor-data-model"
22+
chip_enable_ota_requestor = true
23+
chip_enable_openthread = false
24+
25+
sl_enable_test_event_trigger = true
26+
27+
chip_enable_icd_server = true
28+
chip_enable_icd_lit = true
29+
30+
sl_idle_mode_duration_s = 1800 # 30min Idle Mode Duration
31+
sl_active_mode_duration_ms = 0 # 0 Active Mode Duration
32+
sl_active_mode_threshold_ms = 5000 # 5s Active Mode Threshold
33+
34+
sl_use_subscription_syncing = true
35+
chip_subscription_timeout_resumption = false
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Copyright (c) 2020 Project CHIP Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
import("//build_overrides/build.gni")
16+
17+
# The location of the build configuration file.
18+
buildconfig = "${build_root}/config/BUILDCONFIG.gn"
19+
20+
# CHIP uses angle bracket includes.
21+
check_system_includes = true
22+
23+
default_args = {
24+
target_cpu = "arm"
25+
target_os = "freertos"
26+
chip_enable_wifi = true
27+
chip_device_platform = "SiWx917"
28+
29+
import("//build_for_wifi_args.gni")
30+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../build_overrides
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#ifndef SL_MATTER_SENSOR_CONFIG_H
2+
#define SL_MATTER_SENSOR_CONFIG_H
3+
4+
// <<< Use Configuration Wizard in Context Menu >>>
5+
6+
// <h> Matter multi-sensor application Configuration Header
7+
// This header defines the multi-sensor application specific configurations.
8+
// </h>
9+
10+
// <o SL_MATTER_SENSOR_TIMER_PERIOD_S> Timer period for the timer that reads the sensor value (s) <f.d>
11+
// <0..4294967295:30>
12+
// <i> The application will check the sensor value every SL_MATTER_SENSOR_TIMER_PERIOD_S seconds
13+
// <i> and update the data model attributes each time. Reading the sensor value and updating it
14+
// <i> does not always trigger an update to the controller.
15+
// <d> 60
16+
#define SL_MATTER_SENSOR_TIMER_PERIOD_S 60
17+
18+
// <o SL_MATTER_SENSOR_REPORT_THRESHOLD> Attribute report centi-unit change threshold
19+
// <0..255:1>
20+
// <i> Configuration option that dictates how much the attribute value must change, from the last report
21+
// <i> to trigger Subscription update to controllers. A single step in the configuration option increasing
22+
// <i> the attribute threshold of centi-unit. For a temperature sensor, 1 unit equals to 0.01 centigrade.
23+
// <d> 100
24+
#define SL_MATTER_SENSOR_REPORT_THRESHOLD 100
25+
26+
// <<< end of configuration section >>>
27+
28+
#endif // SL_MATTER_SENSOR_CONFIG_H
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Copyright (c) 2020 Project CHIP Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
import("//build_overrides/chip.gni")
16+
import("${chip_root}/src/app/chip_data_model.gni")
17+
import("${chip_root}/src/platform/device.gni")
18+
19+
chip_data_model("multi-sensor-data-model") {
20+
if (chip_enable_wifi) {
21+
network = "wifi"
22+
} else {
23+
network = "thread"
24+
}
25+
26+
zap_file = "multi-sensor-${network}-app.zap"
27+
is_server = true
28+
}

0 commit comments

Comments
 (0)