Skip to content

Commit ab37069

Browse files
Merge branch 'master' into tc-idm-4.3-(python)
2 parents cba575c + eb515e1 commit ab37069

File tree

164 files changed

+7289
-3341
lines changed

Some content is hidden

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

164 files changed

+7289
-3341
lines changed

.github/workflows/examples-qpg.yaml

-2
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,6 @@ jobs:
6363
--enable-flashbundle \
6464
--target qpg-qpg6105-lock \
6565
--target qpg-qpg6105-light \
66-
--target qpg-qpg6105-shell \
67-
--target qpg-qpg6105-persistent-storage \
6866
--target qpg-qpg6105-light-switch \
6967
--target qpg-qpg6105-thermostat \
7068
build \

.github/workflows/examples-stm32.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ jobs:
5050
uses: ./.github/actions/checkout-submodules-and-bootstrap
5151
with:
5252
platform: stm32
53-
53+
extra-submodule-parameters: --recursive
5454
- name: Set up environment for size reports
5555
uses: ./.github/actions/setup-size-reports
5656
if: ${{ !env.ACT }}

.gitmodules

+1-1
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@
313313
[submodule "third_party/st/STM32CubeWB"]
314314
path = third_party/st/STM32CubeWB
315315
url = https://github.com/STMicroelectronics/STM32CubeWB.git
316-
branch = v1.17.0
316+
branch = v1.18.0
317317
platforms = stm32
318318
[submodule "p6/lwip-network-interface-integration"]
319319
path = third_party/infineon/psoc6/psoc6_sdk/libs/lwip-network-interface-integration

.gn

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ script_executable = "python3"
2525

2626
default_args = {
2727
pw_unit_test_AUTOMATIC_RUNNER = "$dir_pigweed/targets/host/run_test"
28+
pw_unit_test_CONFIG = "//config/pw_unit_test:define_overrides"
2829

2930
pw_build_PIP_CONSTRAINTS = [ "//scripts/setup/constraints.txt" ]
3031
pw_build_PIP_REQUIREMENTS = [ "//scripts/setup/requirements.build.txt" ]

config/pw_unit_test/BUILD.gn

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Copyright (c) 2024 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/pigweed.gni")
18+
19+
import("${chip_root}/build/chip/tests.gni")
20+
21+
import("$dir_pw_build/target_types.gni")
22+
pw_source_set("define_overrides") {
23+
public_configs = [ ":define_options" ]
24+
}
25+
26+
config("define_options") {
27+
if (chip_fake_platform && chip_link_tests) {
28+
defines = [ "PW_UNIT_TEST_CONFIG_MEMORY_POOL_SIZE=65536" ]
29+
} else {
30+
defines = [ "PW_UNIT_TEST_CONFIG_MEMORY_POOL_SIZE=16384" ]
31+
}
32+
}

config/qpg/chip-gn/build.sh

+2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ env
2323
GN_ROOT_TARGET=$(dirname "$0")
2424
CHIP_ROOT=$GN_ROOT_TARGET/../../../
2525
OUTDIR=$CHIP_ROOT/out
26+
GN_ARGS="qpg_target_ic=\"qpg6105\" qpg_flavour=\"_ext_flash\""
2627

2728
mkdir -p "$OUTDIR"
2829
gn \
@@ -33,6 +34,7 @@ gn \
3334
--export-compile-commands \
3435
gen \
3536
--check \
37+
--args="$GN_ARGS" \
3638
--fail-on-unused-args \
3739
"$OUTDIR"
3840
ninja -C "$OUTDIR"

docs/getting_started/first_example.md

+123
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
# An SDK example
2+
3+
The SDK provides a number of example devices and controllers that can be used to
4+
familiarize yourself with the SDK and the Matter ecosystem.
5+
6+
## Example Devices
7+
8+
The example devices (occasionally referred to as "apps") are located in the
9+
[examples](../../examples/) directory. The examples often implement one
10+
particular device type. Some have implementations for various platforms.
11+
12+
The linux platform examples are provided as examples, and are used in the CI.
13+
These can be used for preliminary testing.
14+
15+
The all-clusters-app is used by the QA team for testing. This app implements
16+
nearly all the available clusters and does not conform to a specific device
17+
type. This app is not a good starting place for product development.
18+
19+
## Example Controllers
20+
21+
The SDK has two example controllers that can be used to interact with devices
22+
for testing.
23+
24+
[chip-tool](../../examples/chip-tool/) is a C++ command line controller with an
25+
interactive shell. More information on chip-tool can be found in the
26+
[chip-tool guide](../guides/chip_tool_guide.md).
27+
28+
[chip-repl](../../src/controller/python/chip-repl.py) is a shell for the python
29+
controller. The chip-repl is part of the python controller framework, often used
30+
for testing. More information about the python controller can be found in the
31+
[python testing](../testing/python.md) documentation.
32+
33+
## Building your first demo app (lighting)
34+
35+
The examples directory contains a set of apps using an example device
36+
composition \.zap file. For more information about device composition and zap,
37+
see [ZAP documentation](./zap.md).
38+
39+
This quick start guide will walk you through
40+
41+
- Building an app (lighting app) for the host platform
42+
- Interacting with the app using chip\-tool \(controller\)
43+
44+
### Building the lighting app
45+
46+
- Install prerequisites from docs/guides/BUILDING\.md
47+
- Run bootstrap or activate to install all the required tools etc.
48+
- `. scripts/bootstrap.sh` \- run this first\, or if builds fail
49+
- `. scripts/activate.sh` \- faster\, use if you’ve already bootstrapped
50+
and are just starting a new terminal
51+
52+
The build system we use is Ninja / GN. You can use a standard gn gen / ninja to
53+
build as normal, or use the scripts to build specific variants. More information
54+
about the build system can be found at [BUILDING.md](../guides/BUILDING.md). The
55+
official quickstart guide for the build system is located ag
56+
https://gn.googlesource.com/gn/+/master/docs/quick_start.md and a full reference
57+
can be found at https://gn.googlesource.com/gn/+/main/docs/reference.md.
58+
59+
To build with the scripts, use scripts/build/build_examples\.py -
60+
`scripts/build/build_examples.py targets` -
61+
`scripts/build/build_examples.py --target <your target> build` - builds to
62+
`out/<target_name>/`
63+
64+
Scripts can be used to build both the lighting app and chip tool
65+
66+
- Lighting app \(device\)
67+
- `./scripts/build/build_examples.py --target linux-x64-light-no-ble build`
68+
- This will build an executable to
69+
`./out/linux-x64-light-no-ble/chip-lighting-app`
70+
71+
* NOTE that the host name (linux-x64 here) may be different on different
72+
systems ex. darwin
73+
74+
- chip-tool (controller)
75+
- `./scripts/build/build_examples.py --target linux-x64-chip-tool build`
76+
- This will build an executable to `./out/linux-x64-chip-tool/chip-tool`
77+
78+
### Building / Interacting with Matter Examples
79+
80+
The first thing you need to do is to commission the device. First start up the
81+
app in one terminal. By default it will start up with the default discriminator
82+
(3840) and passcode (20202021) and save its non-volatile information in a KVS in
83+
/temp/chip_kvs. You can change these, and multiple other options on the command
84+
line. For a full description, use the `--help` command.
85+
86+
Start the lighting app in one terminal using
87+
88+
`./out/linux-x64-light-no-ble/chip-lighting-app`
89+
90+
The lighting app will print out all its setup information. You can get the setup
91+
codes, discriminator and passcode from the logs.
92+
93+
Open a new terminal to use chip tool. Commission the device using:
94+
95+
`./out/linux-x64-chip-tool/chip-tool pairing code 0x12344321 MT:-24J0AFN00KA0648G0`
96+
97+
NOTE: pairing is the old name for commissioning. 0x12344321 is the node ID you
98+
want to assign to the node. 0x12344321 is the default for testing.
99+
MT:-24J0AFN00KA0648G0 is the QR code for a device with the default discriminator
100+
and passcode. If you have changed these, the code will be different.
101+
102+
#### Basic device interactions - Sending a command
103+
104+
`./chip-tool onoff on 0x12344321 1`
105+
106+
where:
107+
108+
- onoff is the cluster name
109+
- on is the command name
110+
- 0x12344321 is the node ID you used for commissioning
111+
- 1 is the endpoint
112+
113+
#### Basic device interactions - Reading an attribute
114+
115+
`./chip-tool onoff read on-off 0x12344321 1`
116+
117+
where:
118+
119+
- onoff is the cluster name
120+
- read is the desired action
121+
- on is the attribute name
122+
- 0x12344321 is the node ID you used for commissioning
123+
- 1 is the endpoint

docs/getting_started/index.md

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ The following docs are a brief introduction to SDK development.
1111
1212
```
1313

14+
- [Running your first example](./first_example.md)
1415
- [SDK Basics](./SDKBasics.md)
1516
- [ZAP](./zap.md)
1617
- [Discover from a host computer](./discovery_from_a_host_computer.md)

examples/all-clusters-app/all-clusters-common/all-clusters-app.matter

+2-2
Original file line numberDiff line numberDiff line change
@@ -3752,7 +3752,7 @@ cluster ActivatedCarbonFilterMonitoring = 114 {
37523752
}
37533753

37543754
/** This cluster is used to configure a boolean sensor. */
3755-
provisional cluster BooleanStateConfiguration = 128 {
3755+
cluster BooleanStateConfiguration = 128 {
37563756
revision 1;
37573757

37583758
bitmap AlarmModeBitmap : bitmap8 {
@@ -3810,7 +3810,7 @@ provisional cluster BooleanStateConfiguration = 128 {
38103810
}
38113811

38123812
/** This cluster is used to configure a valve. */
3813-
provisional cluster ValveConfigurationAndControl = 129 {
3813+
cluster ValveConfigurationAndControl = 129 {
38143814
revision 1;
38153815

38163816
enum StatusCodeEnum : enum8 {

examples/kotlin-matter-controller/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ the top Matter directory:
109109
```
110110

111111
The Java executable file `kotlin-matter-controller` will be generated at
112-
`out/android-x86-kotlin-matter-controller/bin/`
112+
`out/linux-x64-kotlin-matter-controller/bin/`
113113

114114
Run the kotlin-matter-controller
115115

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ qpg_executable("light_switch_app") {
137137
}
138138
}
139139

140-
ldscript = "${qpg_sdk_root}/Libraries/Qorvo/QorvoStack/gen/QorvoStack_${qpg_target_ic}/QorvoStack_${qpg_target_ic}.ld"
140+
ldscript = "${qpg_sdk_root}/Libraries/Qorvo/QorvoStack/gen/QorvoStack_${qpg_target_ic}${qpg_flavour}/QorvoStack_${qpg_target_ic}${qpg_flavour}.ld"
141141

142142
inputs = [ ldscript ]
143143

examples/light-switch-app/qpg/args.gni

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ chip_enable_icd_lit = true
3030
chip_stack_lock_tracking = "none"
3131

3232
matter_device_vid = "0xFFF1"
33-
matter_device_pid = "0x8006"
33+
matter_device_pid = "0x8004"
3434

3535
pw_log_BACKEND = "${chip_root}/src/lib/support/pw_log_chip"
3636
pw_assert_BACKEND = "$dir_pw_assert_log:check_backend"

examples/light-switch-app/qpg/include/CHIPProjectConfig.h

+15-2
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,18 @@
4040
* CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION
4141
*
4242
* A uint32_t identifying the software version running on the device.
43+
* First two bytes are reflecting the Matter standard
44+
* Last two bytes are reflecting the SDK version of which the first nibble of the first byte represents the major
45+
* version and the second nibble of the first byte has the minor number. The last byte holds the patch number.
46+
* example for SDK v0.1.5 with Matter v1.2 standard:
47+
* 0x01020105
4348
*/
4449
#ifndef CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION
45-
#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION 0x0003 // Can't be removed, needed for OTA file generation.
50+
#ifndef OTA_TEST_IMAGE
51+
#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION 0x01020105
52+
#else
53+
#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION 0x01020106
54+
#endif
4655
#endif
4756

4857
/**
@@ -53,7 +62,11 @@
5362
* {MAJOR_VERSION}.0d{MINOR_VERSION}
5463
*/
5564
#ifndef CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING
56-
#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING "1.1" // Can't be removed, needed for OTA file generation.
65+
#ifndef OTA_TEST_IMAGE
66+
#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING "1.2-0.1.5"
67+
#else
68+
#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING "1.2-0.1.6"
69+
#endif
5770
#endif
5871

5972
/**

examples/light-switch-app/qpg/include/SwitchManager.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ class SwitchManager
5454
};
5555

5656
void Init(void);
57-
static void GenericSwitchInitialPress(void);
58-
static void GenericSwitchReleasePress(void);
57+
static void GenericSwitchInitialPressHandler(AppEvent * aEvent);
58+
static void GenericSwitchReleasePressHandler(AppEvent * aEvent);
5959
static void ToggleHandler(AppEvent * aEvent);
6060
static void LevelHandler(AppEvent * aEvent);
6161
static void ColorHandler(AppEvent * aEvent);

examples/light-switch-app/qpg/src/AppTask.cpp

+10-6
Original file line numberDiff line numberDiff line change
@@ -297,13 +297,13 @@ void AppTask::ButtonEventHandler(uint8_t btnIdx, bool btnPressed)
297297
case APP_FUNCTION2_SWITCH: {
298298
if (!btnPressed)
299299
{
300-
ChipLogProgress(NotSpecified, "Switch initial press");
301-
SwitchMgr().GenericSwitchInitialPress();
300+
ChipLogProgress(NotSpecified, "Switch release press");
301+
button_event.Handler = SwitchMgr().GenericSwitchReleasePressHandler;
302302
}
303303
else
304304
{
305-
ChipLogProgress(NotSpecified, "Switch release press");
306-
SwitchMgr().GenericSwitchReleasePress();
305+
ChipLogProgress(NotSpecified, "Switch initial press");
306+
button_event.Handler = SwitchMgr().GenericSwitchInitialPressHandler;
307307
}
308308
break;
309309
}
@@ -516,11 +516,15 @@ void AppTask::UpdateLEDs(void)
516516
// If the system has ble connection(s) uptill the stage above, THEN blink
517517
// the LEDs at an even rate of 100ms.
518518
//
519-
// Otherwise, blink the LED ON for a very short time.
519+
// Otherwise, turn the LED OFF.
520520
if (sIsThreadProvisioned && sIsThreadEnabled)
521521
{
522522
qvIO_LedSet(SYSTEM_STATE_LED, true);
523523
}
524+
else if (sIsThreadProvisioned && !sIsThreadEnabled)
525+
{
526+
qvIO_LedBlink(SYSTEM_STATE_LED, 950, 50);
527+
}
524528
else if (sHaveBLEConnections)
525529
{
526530
qvIO_LedBlink(SYSTEM_STATE_LED, 100, 100);
@@ -532,7 +536,7 @@ void AppTask::UpdateLEDs(void)
532536
else
533537
{
534538
// not commissioned yet
535-
qvIO_LedBlink(SYSTEM_STATE_LED, 50, 950);
539+
qvIO_LedSet(SYSTEM_STATE_LED, false);
536540
}
537541
}
538542

examples/light-switch-app/qpg/src/SwitchManager.cpp

+26-6
Original file line numberDiff line numberDiff line change
@@ -107,20 +107,40 @@ void SwitchManager::ColorHandler(AppEvent * aEvent)
107107
DeviceLayer::PlatformMgr().ScheduleWork(SwitchWorkerFunction, reinterpret_cast<intptr_t>(data));
108108
}
109109

110-
void SwitchManager::GenericSwitchInitialPress(void)
110+
void SwitchManager::GenericSwitchInitialPressHandler(AppEvent * aEvent)
111111
{
112112
// Press moves Position from 0 (idle) to 1 (press)
113113
uint8_t newPosition = 1;
114114

115-
SystemLayer().ScheduleLambda(
116-
[newPosition] { chip::app::Clusters::Switch::Attributes::CurrentPosition::Set(GENERICSWITCH_ENDPOINT_ID, newPosition); });
115+
if (aEvent->Type != AppEvent::kEventType_Button)
116+
{
117+
ChipLogError(NotSpecified, "Event type not supported!");
118+
return;
119+
}
120+
121+
ChipLogProgress(NotSpecified, "GenericSwitchInitialPress new position %d", newPosition);
122+
SystemLayer().ScheduleLambda([newPosition] {
123+
chip::app::Clusters::Switch::Attributes::CurrentPosition::Set(GENERICSWITCH_ENDPOINT_ID, newPosition);
124+
// InitialPress event takes newPosition as event data
125+
chip::app::Clusters::SwitchServer::Instance().OnInitialPress(GENERICSWITCH_ENDPOINT_ID, newPosition);
126+
});
117127
}
118128

119-
void SwitchManager::GenericSwitchReleasePress(void)
129+
void SwitchManager::GenericSwitchReleasePressHandler(AppEvent * aEvent)
120130
{
121131
// Release moves Position from 1 (press) to 0
122132
uint8_t newPosition = 0;
123133

124-
SystemLayer().ScheduleLambda(
125-
[newPosition] { chip::app::Clusters::Switch::Attributes::CurrentPosition::Set(GENERICSWITCH_ENDPOINT_ID, newPosition); });
134+
if (aEvent->Type != AppEvent::kEventType_Button)
135+
{
136+
ChipLogError(NotSpecified, "Event type not supported!");
137+
return;
138+
}
139+
140+
ChipLogProgress(NotSpecified, "GenericSwitchReleasePress new position %d", newPosition);
141+
SystemLayer().ScheduleLambda([newPosition] {
142+
chip::app::Clusters::Switch::Attributes::CurrentPosition::Set(GENERICSWITCH_ENDPOINT_ID, newPosition);
143+
// Short Release event takes newPosition as event data
144+
chip::app::Clusters::SwitchServer::Instance().OnShortRelease(GENERICSWITCH_ENDPOINT_ID, newPosition);
145+
});
126146
}

0 commit comments

Comments
 (0)