Skip to content

Commit fa2aae9

Browse files
[QPG] Adding thermostat and light-switch apps for QPG platform (project-chip#31366)
* [QPG] Added light-switch app to gn build * [QPG] Added thermostat app to gn build * [QPG] Added requirements needed * [QPG] Light-switch and thermostat added to build targets * [QPG] Bump qpg_sdk subrepo * Restyled by gn * Fixes * Fixed switch zap and matter files * Fix zap and matter for thermostat part 1 --------- Co-authored-by: Restyled.io <commits@restyled.io>
1 parent 4bae97e commit fa2aae9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+19168
-2
lines changed

.github/workflows/examples-qpg.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ jobs:
6363
--target qpg-qpg6105-light \
6464
--target qpg-qpg6105-shell \
6565
--target qpg-qpg6105-persistent-storage \
66+
--target qpg-qpg6105-light-switch \
67+
--target qpg-qpg6105-thermostat \
6668
build \
6769
--copy-artifacts-to out/artifacts \
6870
"

config/qpg/toolchain/BUILD.gn

+7
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@ arm_toolchain("qpg_lighting_app") {
3131
}
3232
}
3333

34+
arm_toolchain("qpg_light_switch_app") {
35+
toolchain_args = {
36+
current_os = "freertos"
37+
import("${chip_root}/examples/light-switch-app/qpg/args.gni")
38+
}
39+
}
40+
3441
arm_toolchain("qpg_shell_app") {
3542
toolchain_args = {
3643
current_os = "freertos"

docs/examples/index.md

+2
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ lighting-app/qpg/APPLICATION
131131
:maxdepth: 1
132132
133133
light-switch-app/**/README
134+
light-switch-app/qpg/APPLICATION
134135
```
135136

136137
## Lock example
@@ -282,6 +283,7 @@ temperature-measurement-app/**/README
282283
283284
thermostat/**/README
284285
thermostat/**/Readme
286+
thermostat/qpg/APPLICATION
285287
```
286288

287289
## TV example

examples/light-switch-app/qpg/.gn

+28
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/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+
27+
import("//args.gni")
28+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Matter QPG6105 Light Switch Example Application
2+
3+
## Light-switch-app
4+
5+
A light switch example application showing the use of
6+
[Matter](https://github.com/project-chip/connectedhomeip) on the Qorvo QPG6105
7+
can be found in this folder.
8+
9+
## Qorvo SDK
10+
11+
More detailed information on the Qorvo SDK can be found in the
12+
[Qorvo Matter SDK](https://github.com/Qorvo/QMatter).
13+
14+
## More information
15+
16+
For more information on our product line and support options, please visit
17+
[www.qorvo.com](https://www.qorvo.com) or contact us at <LPW.support@qorvo.com>
+154
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
# Copyright(c) 2021 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/openthread.gni")
18+
import("//build_overrides/qpg_sdk.gni")
19+
20+
import("${build_root}/config/defaults.gni")
21+
import("${chip_root}/src/platform/device.gni")
22+
import("${qpg_sdk_build_root}/qpg_executable.gni")
23+
import("${qpg_sdk_build_root}/qpg_sdk.gni")
24+
25+
# declares chip_build_libshell = false
26+
import("${chip_root}/src/lib/lib.gni")
27+
28+
# declares chip_enable_pw_rpc = false
29+
import("${chip_root}/examples/common/pigweed/pigweed_rpcs.gni")
30+
if (chip_enable_pw_rpc) {
31+
import("//build_overrides/pigweed.gni")
32+
import("$dir_pw_build/target_types.gni")
33+
}
34+
35+
assert(current_os == "freertos")
36+
37+
qpg_project_dir = "${chip_root}/examples/light-switch-app/qpg"
38+
examples_plat_dir = "${chip_root}/examples/platform/qpg"
39+
40+
qpg_sdk("sdk") {
41+
include_dirs = [
42+
"${chip_root}/src/platform/qpg",
43+
"${examples_plat_dir}",
44+
"${qpg_project_dir}/include",
45+
]
46+
47+
defines = [ "PW_RPC_ENABLED=${chip_enable_pw_rpc}" ]
48+
}
49+
50+
qpg_executable("light_switch_app") {
51+
output_name = "chip-${qpg_target_ic}-light-switch-example.out"
52+
53+
sources = [
54+
"${chip_root}/src/app/clusters/general-diagnostics-server/GenericFaultTestEventTriggerDelegate.cpp",
55+
"${examples_plat_dir}/app/main.cpp",
56+
"${examples_plat_dir}/ota/ota.cpp",
57+
"src/AppTask.cpp",
58+
"src/SwitchManager.cpp",
59+
"src/ZclCallbacks.cpp",
60+
"src/binding-handler.cpp",
61+
]
62+
63+
deps = [
64+
":sdk",
65+
"${chip_root}/examples/light-switch-app/qpg/zap/",
66+
"${chip_root}/examples/providers:device_info_provider",
67+
"${chip_root}/src/lib",
68+
"${chip_root}/src/setup_payload",
69+
"${chip_root}/third_party/openthread/platforms:libopenthread-platform",
70+
"${chip_root}/third_party/openthread/platforms:libopenthread-platform-utils",
71+
"${chip_root}/third_party/qpg_sdk:qpg_switch_factorydata_lib",
72+
"${chip_root}/third_party/qpg_sdk:qpg_switch_firmwaredata_lib",
73+
]
74+
75+
if (chip_openthread_ftd) {
76+
deps += [ "${chip_root}/third_party/openthread/repo:libopenthread-ftd" ]
77+
} else {
78+
deps += [ "${chip_root}/third_party/openthread/repo:libopenthread-mtd" ]
79+
}
80+
81+
include_dirs = [
82+
"include",
83+
"${examples_plat_dir}/ota",
84+
]
85+
86+
defines = []
87+
88+
if (chip_enable_pw_rpc) {
89+
defines += [
90+
"PW_RPC_ATTRIBUTE_SERVICE=1",
91+
"PW_RPC_BUTTON_SERVICE=1",
92+
"PW_RPC_DEVICE_SERVICE=1",
93+
"PW_RPC_LOCKING_SERVICE=1",
94+
]
95+
96+
sources += [
97+
"${chip_root}/examples/common/pigweed/RpcService.cpp",
98+
"${chip_root}/examples/common/pigweed/qpg/PigweedLoggerMutex.cpp",
99+
"${examples_plat_dir}/PigweedLogger.cpp",
100+
"${examples_plat_dir}/Rpc.cpp",
101+
"${examples_plat_dir}/uart.c",
102+
]
103+
104+
deps += [
105+
"$dir_pw_hdlc:rpc_channel_output",
106+
"$dir_pw_stream:sys_io_stream",
107+
"${chip_root}/config/qpg/lib/pw_rpc:pw_rpc",
108+
"${chip_root}/examples/common/pigweed:attributes_service.nanopb_rpc",
109+
"${chip_root}/examples/common/pigweed:button_service.nanopb_rpc",
110+
"${chip_root}/examples/common/pigweed:device_service.nanopb_rpc",
111+
"${chip_root}/examples/common/pigweed:locking_service.nanopb_rpc",
112+
"${examples_plat_dir}/pw_sys_io:pw_sys_io_qpg",
113+
]
114+
115+
deps += pw_build_LINK_DEPS
116+
117+
include_dirs += [
118+
"${chip_root}/examples/common",
119+
"${chip_root}/examples/common/pigweed/qpg",
120+
]
121+
} else {
122+
# The below gives compiler erros in pigweed, therefore it is only enabled
123+
# when rpc is not
124+
cflags = [ "-Wconversion" ]
125+
}
126+
127+
if (chip_build_libshell) {
128+
deps += [ "${examples_plat_dir}:qpg-matter-shell" ]
129+
} else {
130+
if (chip_openthread_ftd) {
131+
deps +=
132+
[ "${chip_root}/third_party/openthread/repo:libopenthread-cli-ftd" ]
133+
} else {
134+
deps +=
135+
[ "${chip_root}/third_party/openthread/repo:libopenthread-cli-mtd" ]
136+
}
137+
}
138+
139+
ldscript = "${qpg_sdk_root}/Libraries/Qorvo/QorvoStack/gen/QorvoStack_${qpg_target_ic}/QorvoStack_${qpg_target_ic}.ld"
140+
141+
inputs = [ ldscript ]
142+
143+
ldflags = [ "-T" + rebase_path(ldscript, root_build_dir) ]
144+
145+
output_dir = root_out_dir
146+
}
147+
148+
group("qpg") {
149+
deps = [ ":light_switch_app" ]
150+
}
151+
152+
group("default") {
153+
deps = [ ":qpg" ]
154+
}
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
orphan: true
3+
---
4+
5+
# Matter QPG6105 SDK
6+
7+
## Qorvo SDK
8+
9+
More detailed information on the Qorvo SDK can be found in the
10+
[Qorvo Matter SDK](https://github.com/Qorvo/QMatter).
11+
12+
## More information
13+
14+
For more information on our product line and support options, please visit
15+
[www.qorvo.com](https://www.qorvo.com) or contact us at <LPW.support@qorvo.com>
+35
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("//build_overrides/pigweed.gni")
17+
import("${chip_root}/config/standalone/args.gni")
18+
import("${chip_root}/examples/platform/qpg/args.gni")
19+
20+
qpg_sdk_target = get_label_info(":sdk", "label_no_toolchain")
21+
22+
chip_enable_ota_requestor = true
23+
chip_openthread_ftd = false
24+
enable_sleepy_device = true
25+
chip_enable_icd_server = true
26+
27+
# Disable lock tracking, since our FreeRTOS configuration does not set
28+
# INCLUDE_xSemaphoreGetMutexHolder
29+
chip_stack_lock_tracking = "none"
30+
31+
matter_device_vid = "0xFFF1"
32+
matter_device_pid = "0x8006"
33+
34+
pw_log_BACKEND = "${chip_root}/src/lib/support/pw_log_chip"
35+
pw_assert_BACKEND = "$dir_pw_assert_log:check_backend"
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,34 @@
1+
/*
2+
*
3+
* Copyright (c) 2020 Project CHIP Authors
4+
* All rights reserved.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
#ifndef APP_CONFIG_H
20+
#define APP_CONFIG_H
21+
22+
#define APP_TASK_NAME "APP"
23+
24+
// Mapping of Functional buttons
25+
#define APP_FUNCTION1_BUTTON BTN_SW1
26+
#define APP_FUNCTION2_SWITCH BTN_SW2
27+
#define APP_FUNCTION3_BUTTON BTN_SW3
28+
#define APP_FUNCTION4_BUTTON BTN_SW4
29+
#define APP_FUNCTION5_BUTTON BTN_SW5
30+
31+
// Mapping of LEDs
32+
#define SYSTEM_STATE_LED LED_GREEN
33+
34+
#endif // APP_CONFIG_H
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/*
2+
*
3+
* Copyright (c) 2020 Project CHIP Authors
4+
* All rights reserved.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
#ifndef APP_EVENT_H
20+
#define APP_EVENT_H
21+
22+
struct AppEvent;
23+
typedef void (*EventHandler)(AppEvent *);
24+
25+
struct AppEvent
26+
{
27+
enum AppEventTypes
28+
{
29+
kEventType_Button = 0,
30+
kEventType_Timer,
31+
};
32+
33+
uint16_t Type;
34+
35+
union
36+
{
37+
struct
38+
{
39+
uint8_t ButtonIdx;
40+
uint8_t Action;
41+
} ButtonEvent;
42+
struct
43+
{
44+
void * Context;
45+
} TimerEvent;
46+
};
47+
48+
EventHandler Handler;
49+
};
50+
51+
#endif // APP_EVENT_H

0 commit comments

Comments
 (0)