Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ __pycache__/

# build
/build*
/samples/**/build*
/twister-out*

# docs
Expand Down
14 changes: 10 additions & 4 deletions samples/light_bulb/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ project("Zigbee + Matter Light Bulb with FOTA")
if(CONFIG_CHIP)
# Enable GNU STD support for Matter
include(${ZEPHYR_CONNECTEDHOMEIP_MODULE_DIR}/config/nrfconnect/app/enable-gnu-std.cmake)


# Include all source files that are located in the Matter common directory.
include(${ZEPHYR_NRF_MODULE_DIR}/samples/matter/common/cmake/source_common.cmake)

# Include Data Model utils (simplified for Zigbee coexistence)
include(${ZEPHYR_NRF_MODULE_DIR}/samples/matter/common/cmake/data_model.cmake)

Expand All @@ -35,16 +38,19 @@ if(CONFIG_CHIP)

# NORDIC SDK APP START
target_sources(app PRIVATE
src/main_matter.c
src/matter_init.cpp
src/main.cpp
src/app_task_zigbee.cpp
src/app_task_matter.cpp
${CHIP_ROOT}/src/app/persistence/DeferredAttributePersistenceProvider.cpp
)

ncs_configure_data_model()
# NORDIC SDK APP END
else()
# Zigbee-only build
target_sources(app PRIVATE
src/main.c
src/main.cpp
src/app_task_zigbee.cpp
)

target_include_directories(app PRIVATE include)
Expand Down
51 changes: 0 additions & 51 deletions samples/light_bulb/CMakeLists_matter.txt

This file was deleted.

25 changes: 22 additions & 3 deletions samples/light_bulb/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,26 @@
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

source "Kconfig.zephyr"
# Sample configuration used for Thread networking
if OPENTHREAD

choice OPENTHREAD_NORDIC_LIBRARY_CONFIGURATION
default OPENTHREAD_NORDIC_LIBRARY_FTD
endchoice

choice OPENTHREAD_DEVICE_TYPE
default OPENTHREAD_FTD
endchoice

endif # OPENTHREAD

# Include Matter common sample Kconfig if Matter is enabled
rsource "$(ZEPHYR_NRF_MODULE_DIR)/samples/matter/common/src/Kconfig"
config MPSL_THREAD_COOP_PRIO
default 8

if CHIP
source "$(ZEPHYR_CONNECTEDHOMEIP_MODULE_DIR)/config/nrfconnect/chip-module/Kconfig.features"
source "$(ZEPHYR_CONNECTEDHOMEIP_MODULE_DIR)/config/nrfconnect/chip-module/Kconfig.defaults"
source "$(ZEPHYR_NRF_MODULE_DIR)/samples/matter/common/src/Kconfig"
endif

source "Kconfig.zephyr"
4 changes: 0 additions & 4 deletions samples/light_bulb/Kconfig_sysbuild_matter_fota
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,3 @@ config DFU_MULTI_IMAGE_PACKAGE_NET
endif # SOC_SERIES_NRF53X

endif # BOOTLOADER_MCUBOOT

#### Enable generating Matter factory data
config MATTER_FACTORY_DATA_GENERATE
default y
20 changes: 8 additions & 12 deletions samples/light_bulb/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@

/ {
chosen {
ncs,zigbee-timer = &timer24;
ncs,zigbee-timer = &timer23;
ncs,zboss-trace-uart = &uart20;
};

aliases {
/* Configure PWM module for led1 (LED2 on the board) */
pwm-led1 = &pwm_led3;
};

pwmleds {
Expand All @@ -17,16 +23,6 @@
};
};

// restore full RRAM and SRAM space - by default some parts are dedicated to FLRP
&cpuapp_rram {
reg = <0x0 DT_SIZE_K(2036)>;
};

&cpuapp_sram {
reg = <0x20000000 DT_SIZE_K(512)>;
ranges = <0x0 0x20000000 DT_SIZE_K(512)>;
};

&pwm20 {
status = "okay";
pinctrl-0 = <&pwm_default>;
Expand All @@ -48,6 +44,6 @@
};
};

&timer24 {
&timer23 {
status = "okay";
};
48 changes: 48 additions & 0 deletions samples/light_bulb/include/app_task_matter.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* Copyright (c) 2026 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
*/

#pragma once

#include "board/board.h"
#include "pwm/pwm_device.h"

#include <platform/CHIPDeviceLayer.h>

struct k_timer;
struct Identify;

enum class LightingActor : uint8_t { Remote, Button };

struct LightingEvent {
uint8_t Action;
LightingActor Actor;
};

class AppTask {
public:
static AppTask &Instance() {
static AppTask sAppTask;
return sAppTask;
};

CHIP_ERROR StartApp();

void UpdateClusterState();
void InitPWMDDevice();
Nrf::PWMDevice &GetPWMDevice() { return mPWMDevice; }

private:
CHIP_ERROR Init();

static void LightingActionEventHandler(const LightingEvent &event);
static void ButtonEventHandler(Nrf::ButtonState state,
Nrf::ButtonMask hasChanged);

static void ActionInitiated(Nrf::PWMDevice::Action_t action, int32_t actor);
static void ActionCompleted(Nrf::PWMDevice::Action_t action, int32_t actor);

Nrf::PWMDevice mPWMDevice;
};
12 changes: 12 additions & 0 deletions samples/light_bulb/include/app_task_zigbee.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*
* Copyright (c) 2026 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
*/

#ifndef APP_TASK_ZIGBEE_H
#define APP_TASK_ZIGBEE_H 1

void ZigbeeStart(void);

#endif /* APP_TASK_ZIGBEE_H */
Loading