Skip to content

Commit 586ddc2

Browse files
Adam-MaciugaArekBalysNordic
authored andcommitted
samples: matter: closure: new sample
Created a new sample from template this sample shows how to implemet the closure device Signed-off-by: Adam Maciuga <[email protected]>
1 parent fbb0826 commit 586ddc2

File tree

62 files changed

+7720
-13231
lines changed

Some content is hidden

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

62 files changed

+7720
-13231
lines changed

applications/matter_bridge/src/bridge.matter

Lines changed: 0 additions & 2086 deletions
This file was deleted.

applications/matter_weather_station/src/weather-station.matter

Lines changed: 0 additions & 2143 deletions
This file was deleted.
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#
2+
# Copyright (c) 2025 Nordic Semiconductor ASA
3+
#
4+
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
#
6+
7+
8+
cmake_minimum_required(VERSION 3.20.0)
9+
10+
find_package(Zephyr HINTS $ENV{ZEPHYR_BASE})
11+
12+
project(matter-closure)
13+
14+
# Enable GNU STD support.
15+
include(${ZEPHYR_CONNECTEDHOMEIP_MODULE_DIR}/config/nrfconnect/app/enable-gnu-std.cmake)
16+
17+
# NORDIC SDK APP START
18+
19+
# Include all source files that are located in the Matter common directory.
20+
include(${ZEPHYR_NRF_MODULE_DIR}/samples/matter/common/cmake/source_common.cmake)
21+
22+
# Include Data Model utils
23+
include(${ZEPHYR_NRF_MODULE_DIR}/samples/matter/common/cmake/data_model.cmake)
24+
25+
include(${ZEPHYR_NRF_MODULE_DIR}/samples/matter/common/cmake/zap_helpers.cmake)
26+
ncs_get_zap_parent_dir(ZAP_PARENT_DIR)
27+
28+
target_include_directories(app PRIVATE
29+
src
30+
${ZEPHYR_NRF_MODULE_DIR}/samples/matter/common/src/util
31+
${ZAP_PARENT_DIR}
32+
)
33+
34+
target_sources(app PRIVATE
35+
src/app_task.cpp
36+
src/main.cpp
37+
src/closure_manager.cpp
38+
src/closure_control_endpoint.cpp
39+
src/garage_door_impl.cpp
40+
)
41+
42+
ncs_configure_data_model()
43+
# NORDIC SDK APP END

samples/matter/closure/Kconfig

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#
2+
# Copyright (c) 2025 Nordic Semiconductor
3+
#
4+
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
#
6+
mainmenu "Matter nRF Connect Closure Example Application"
7+
8+
# Sample configuration used for Thread networking
9+
if OPENTHREAD
10+
11+
choice OPENTHREAD_NORDIC_LIBRARY_CONFIGURATION
12+
default OPENTHREAD_NORDIC_LIBRARY_FTD
13+
endchoice
14+
15+
choice OPENTHREAD_DEVICE_TYPE
16+
default OPENTHREAD_FTD
17+
endchoice
18+
19+
endif # OPENTHREAD
20+
21+
config CHIP_WIFI
22+
default y if SHIELD_NRF7002EB2
23+
24+
source "$(ZEPHYR_CONNECTEDHOMEIP_MODULE_DIR)/config/nrfconnect/chip-module/Kconfig.features"
25+
source "$(ZEPHYR_CONNECTEDHOMEIP_MODULE_DIR)/config/nrfconnect/chip-module/Kconfig.defaults"
26+
source "$(ZEPHYR_NRF_MODULE_DIR)/samples/matter/common/src/Kconfig"
27+
source "Kconfig.zephyr"
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
#
2+
# Copyright (c) 2025 Nordic Semiconductor ASA
3+
#
4+
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
#
6+
7+
#### Radio core selection
8+
config NRF_DEFAULT_IPC_RADIO
9+
default y
10+
11+
# Enable IEEE802.15.4 serialization to network core
12+
# This config automatically pulls in the `overlay-802154.conf` in the ipc_radio image
13+
config NETCORE_IPC_RADIO_IEEE802154
14+
default y if SOC_SERIES_NRF53X
15+
16+
# Enable Bluetooth serialization to network core
17+
# This config automatically pulls in the `overlay-bt_hci_ipc.conf` in the ipc_radio image
18+
config NETCORE_IPC_RADIO_BT_HCI_IPC
19+
default y if SOC_SERIES_NRF53X
20+
21+
#### Bootloader
22+
choice BOOTLOADER
23+
default BOOTLOADER_MCUBOOT
24+
endchoice
25+
26+
if BOOTLOADER_MCUBOOT
27+
28+
#### DFU multi-image support
29+
config DFU_MULTI_IMAGE_PACKAGE_BUILD
30+
default y
31+
32+
config DFU_MULTI_IMAGE_PACKAGE_APP
33+
default y
34+
35+
config PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY
36+
default y
37+
38+
#### DFU network core configuration
39+
if SOC_SERIES_NRF53X
40+
41+
choice MCUBOOT_MODE
42+
default MCUBOOT_MODE_OVERWRITE_ONLY
43+
endchoice
44+
45+
choice BOOT_SIGNATURE_TYPE
46+
default BOOT_SIGNATURE_TYPE_RSA
47+
endchoice
48+
49+
config SECURE_BOOT_NETCORE
50+
default y
51+
52+
config NETCORE_APP_UPDATE
53+
default y
54+
55+
config DFU_MULTI_IMAGE_PACKAGE_NET
56+
default y
57+
58+
endif # SOC_SERIES_NRF53X
59+
60+
if BOARD_NRF54L15DK || BOARD_NRF54LM20DK
61+
62+
# Disable checking the external drivers for nRF54L15 and nRF54LM20 DKs.
63+
config PM_OVERRIDE_EXTERNAL_DRIVER_CHECK
64+
default y
65+
66+
endif # BOARD_NRF54L15DK || BOARD_NRF54LM20DK
67+
68+
endif # BOOTLOADER_MCUBOOT
69+
70+
#### Enable generating factory data
71+
config MATTER_FACTORY_DATA_GENERATE
72+
default y
73+
74+
source "share/sysbuild/Kconfig"

samples/matter/closure/VERSION

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
VERSION_MAJOR = 3
2+
VERSION_MINOR = 1
3+
PATCHLEVEL = 99
4+
VERSION_TWEAK = 0
5+
EXTRAVERSION =
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
/*
2+
* Copyright (c) 2025 Nordic Semiconductor ASA
3+
*
4+
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
*/
6+
7+
/ {
8+
chosen {
9+
nordic,pm-ext-flash = &mx25r64;
10+
};
11+
12+
aliases{
13+
pwm-led1 = &pwm_led1;
14+
};
15+
16+
pwmleds {
17+
pwm_led1: pwm_led_1 {
18+
pwms = <&pwm0 1 PWM_MSEC(20) PWM_POLARITY_INVERTED>;
19+
};
20+
};
21+
};
22+
23+
&pwm0 {
24+
pinctrl-0 = <&pwm0_default_alt>;
25+
pinctrl-1 = <&pwm0_sleep_alt>;
26+
pinctrl-names = "default", "sleep";
27+
};
28+
29+
&pinctrl {
30+
pwm0_default_alt: pwm0_default_alt {
31+
group1 {
32+
psels = <NRF_PSEL(PWM_OUT1, 0, 14)>;
33+
nordic,invert;
34+
};
35+
};
36+
37+
pwm0_sleep_alt: pwm0_sleep_alt {
38+
group1 {
39+
psels = <NRF_PSEL(PWM_OUT1, 0, 14)>;
40+
low-power-enable;
41+
};
42+
};
43+
};
44+
45+
/* Disable unused peripherals to reduce power consumption */
46+
&adc {
47+
status = "disabled";
48+
};
49+
50+
&uart1 {
51+
status = "disabled";
52+
};
53+
54+
&i2c0 {
55+
status = "disabled";
56+
};
57+
58+
&spi1 {
59+
status = "disabled";
60+
};
61+
62+
&spi3 {
63+
status = "disabled";
64+
};
65+
66+
&usbd {
67+
status = "disabled";
68+
};
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
/*
2+
* Copyright (c) 2025 Nordic Semiconductor ASA
3+
*
4+
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
*/
6+
7+
#include <zephyr/dt-bindings/ipc_service/static_vrings.h>
8+
9+
/ {
10+
chosen {
11+
nordic,pm-ext-flash = &mx25r64;
12+
};
13+
14+
aliases {
15+
pwm-led1 = &pwm_led1;
16+
};
17+
18+
pwmleds {
19+
compatible = "pwm-leds";
20+
pwm_led1: pwm_led_1 {
21+
pwms = <&pwm0 1 PWM_MSEC(20) PWM_POLARITY_INVERTED>;
22+
};
23+
};
24+
};
25+
26+
/* Set IPC thread priority to the highest value to not collide with other threads. */
27+
&ipc0 {
28+
zephyr,priority = <0 PRIO_COOP>;
29+
};
30+
31+
&pwm0 {
32+
pinctrl-0 = <&pwm0_default_alt>;
33+
pinctrl-1 = <&pwm0_sleep_alt>;
34+
pinctrl-names = "default", "sleep";
35+
};
36+
37+
&pinctrl {
38+
pwm0_default_alt: pwm0_default_alt {
39+
group1 {
40+
psels = <NRF_PSEL(PWM_OUT1, 0, 29)>;
41+
nordic,invert;
42+
};
43+
};
44+
45+
pwm0_sleep_alt: pwm0_sleep_alt {
46+
group1 {
47+
psels = <NRF_PSEL(PWM_OUT1, 0, 29)>;
48+
low-power-enable;
49+
};
50+
};
51+
};
52+
53+
/* Disable unused peripherals to reduce power consumption */
54+
&adc {
55+
status = "disabled";
56+
};
57+
58+
&i2c1 {
59+
status = "disabled";
60+
};
61+
62+
&spi2 {
63+
status = "disabled";
64+
};
65+
66+
&usbd {
67+
status = "disabled";
68+
};
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
/*
2+
* Copyright (c) 2025 Nordic Semiconductor ASA
3+
*
4+
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
*/
6+
7+
/ {
8+
chosen {
9+
nordic,pm-ext-flash = &mx25r64;
10+
};
11+
12+
aliases {
13+
/* Configure PWM module for led1 (LED2 on the board) */
14+
pwm-led1 = &pwm_led1;
15+
16+
/* Use watchdog wdt31 as the application watchdog */
17+
watchdog0 = &wdt31;
18+
};
19+
20+
pwmleds {
21+
compatible = "pwm-leds";
22+
23+
pwm_led1: pwm_led_1 {
24+
pwms = <&pwm20 1 PWM_MSEC(20) PWM_POLARITY_NORMAL>;
25+
};
26+
};
27+
};
28+
29+
/* restore full RRAM and SRAM space - by default some parts are dedicated to FLRP */
30+
&cpuapp_rram {
31+
reg = <0x0 DT_SIZE_K(1524)>;
32+
};
33+
34+
&cpuapp_sram {
35+
reg = <0x20000000 DT_SIZE_K(256)>;
36+
ranges = <0x0 0x20000000 0x40000>;
37+
};
38+
39+
/* TODO: re-enable HWFC once it's fixed */
40+
&uart20 {
41+
/delete-property/ hw-flow-control;
42+
};
43+
44+
&mx25r64 {
45+
status = "okay";
46+
};
47+
48+
&pwm20 {
49+
status = "okay";
50+
pinctrl-0 = <&pwm_default>;
51+
pinctrl-1 = <&pwm_sleep>;
52+
pinctrl-names = "default", "sleep";
53+
};
54+
55+
&pinctrl {
56+
pwm_default: pwm_default {
57+
group1 {
58+
psels = <NRF_PSEL(PWM_OUT1, 1, 10)>, <NRF_PSEL(PWM_OUT2, 1, 14)>;
59+
};
60+
};
61+
62+
pwm_sleep: pwm_sleep {
63+
group1 {
64+
psels = <NRF_PSEL(PWM_OUT1, 1, 10)>, <NRF_PSEL(PWM_OUT2, 1, 14)>;
65+
low-power-enable;
66+
};
67+
};
68+
};
69+
70+
&wdt31 {
71+
status = "okay";
72+
};

0 commit comments

Comments
 (0)