Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NXP][k32w1] Rework reference apps #34926

Merged
merged 52 commits into from
Aug 15, 2024
Merged
Changes from 1 commit
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
432a3d5
[NXP][platform][common] Update pw RPC flag in streamer_nxp
marius-alex-tache Apr 26, 2024
61e1ed1
[NXP][examples][common] Fix binding issue due to generated Zap flag r…
Martin-NXP Mar 11, 2024
17d3fcd
[NXP][examples][common] make-pretty update
dinabenamar Mar 21, 2024
7d8b409
[NXP][examples][common] Fix contact-sensor-app always returning empty…
marian-chereji-nxp Apr 17, 2024
52050ce
[NXP][examples][common] Call init using the base class reference
marius-alex-tache Mar 7, 2024
7ab8b46
[NXP][examples][common] Update app task common code
marius-alex-tache Mar 13, 2024
49f046f
[NXP][examples][common] Add additional common components
marius-alex-tache Mar 11, 2024
fb11017
[NXP][examples][common] Add missing header in Identify
marius-alex-tache Apr 25, 2024
620f5b3
[NXP][examples][common] Add multi-image OTA requestor initiator
marius-alex-tache Apr 25, 2024
0cdbd93
[NXP][examples][common] Update pw RPC implementation
marius-alex-tache Apr 26, 2024
8497a83
[NXP][examples][common] Small updates to common app code
marius-alex-tache May 8, 2024
20e3f0c
[NXP][examples][common] Make Animate pure virtual
marius-alex-tache May 20, 2024
e99c091
[NXP][examples][common] Add pw RPC init
marius-alex-tache May 21, 2024
c711556
[NXP][examples][common] Allow platforms to redefine the path to the F…
dinabenamar Apr 19, 2024
04549f1
[NXP][examples][common] Add TestEventTriggerDelegate
andrei-menzopol Jun 13, 2024
2c80ef5
[NXP][examples][common] Minor updates for some components
marius-alex-tache Jul 19, 2024
a01f2e0
[NXP][examples][common] Add initial version of lighting app
marius-alex-tache Apr 25, 2024
90f9450
[NXP][examples][common] Add initial version of contact sensor
marius-alex-tache Jul 19, 2024
701c801
[NXP][openthread][k32w1] Update mbedtls target
marius-alex-tache Jun 27, 2024
76b82ae
[NXP][platform][k32w] OTA/FactoryData changes
andrei-menzopol Apr 19, 2024
59a8fbf
[NXP][platform][k32w1] SDK 2.15 platform updates
andrei-menzopol Feb 23, 2024
2f20b3d
[NXP][platform][k32w1] Add "chip_key_storage" solution selector and l…
marian-chereji-nxp Feb 29, 2024
35976e6
[NXP][platform][k32w1] Add Zephyr NVS based key storage build option
marian-chereji-nxp Feb 28, 2024
5286a60
[NXP][examples][k32w1] App updates
marius-alex-tache Jun 26, 2024
2ff7754
[NXP][examples][k32w1] Update ZclCallbacks after transition to common…
marius-alex-tache Jul 19, 2024
f67e410
[NXP][k32w1] Remove k32w parent folder
marius-alex-tache Jul 19, 2024
91810b4
[NXP][platform][k32w1] Add FactoryDataDriver implementation
marius-alex-tache Jul 19, 2024
6d0de7b
[NXP][platform][k32w] Remove k32w/common
marius-alex-tache Jul 11, 2024
6ef126c
[NXP][scripts] Minor updates for NXP related scripts
marius-alex-tache Jun 27, 2024
d74e6d9
[NXP][platform][common] Add nxp_factory_data, nxp_ota gn targets
marius-alex-tache Feb 7, 2024
0e505b3
[NXP][platform][common] Create NXPConfigNVS.cpp file, remove NXPConfi…
Martin-NXP Feb 29, 2024
2498362
[NXP] revert mcxw71 headers
marius-alex-tache Aug 12, 2024
0659f55
[NXP][k32w1] Add default logging target
marius-alex-tache Aug 12, 2024
8365373
[NXP][k32w1] Update paths to reference nxp_matter_support
marius-alex-tache Aug 12, 2024
3eee1ac
[NXP] Bump nxp_matter_support
marius-alex-tache Aug 12, 2024
331c1de
Restyled by whitespace
restyled-commits Aug 12, 2024
1a1c128
Restyled by clang-format
restyled-commits Aug 12, 2024
06fb4d0
Restyled by gn
restyled-commits Aug 12, 2024
34c5e39
Restyled by prettier-markdown
restyled-commits Aug 12, 2024
8afe39b
Restyled by autopep8
restyled-commits Aug 12, 2024
6bf2a79
Restyled by isort
restyled-commits Aug 12, 2024
1ce6752
[NXP][k32w1] Fix gn import order
marius-alex-tache Aug 12, 2024
e0b5178
[NXP][k32w1] Fix wrong README reference
marius-alex-tache Aug 12, 2024
f9afafd
[NXP][k32w1] Update workflow docker image
marius-alex-tache Aug 12, 2024
e43140b
[NXP][rw61x] Adding nxp_ota and nxp_factory_data as they are now mand…
chapongatien Jul 17, 2024
2e62c7c
[NXP][platform][common] Fix build warning
yeaissa May 21, 2024
64f2686
Restyled by gn
restyled-commits Aug 12, 2024
29c29ec
[NXP][platform] Remove deprecated files
marius-alex-tache Aug 13, 2024
983ac33
[NXP][workflow] Create separate jobs for k32w0/k32w1
marius-alex-tache Aug 13, 2024
a31bd00
[NXP][k32w0] Adding nxp_ota and nxp_factory_data as they are now mand…
marius-alex-tache Jul 18, 2024
1c2025c
[NXP][scripts] Fix script issue when there is no --args
Martin-NXP Jul 31, 2024
084b400
[NXP][k32w1] Disable SMU2
marius-alex-tache Aug 14, 2024
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
Prev Previous commit
Next Next commit
[NXP][examples][common] Add initial version of lighting app
- Copy lighting app sources to common folder
- Add device callbacks
- Use common OTA support
- Use common app factory data
- Use led widgets for lighting app
- Use common app task and button management
- Decouple lighting manager from app task
- Update LED status function
- Update lighting manager related flags
	Flags:
	- LIGHTING_MANAGER_ENABLE_DIMMABLE_LED to enable dimmable LED feature
	- LIGHTING_MANAGER_ENABLE_STATUS_LED to enable status LED usage
	These flags can be overwritten in AppConfig.h.
- Make lighting manager more configurable
- Create button manager
	The ButtonManager class should define the buttons callbacks and
	all callback delegates.

	Moved AppMatterButton_registerButtons implementation inside the
	button manager source file.
- Update lighting manager interface
- Replace lighting manager calls with feedback manager
	LightingManager now implements the UserFeedbackInterface abstract class and the
	dimmable feature was moved to a new class: LightingManagerDimmable.
- Move identify code in a separate file
- Remove deprecated #include statements from all files.
- Add commissioning complete state
	A boolean static member is added to AppTask. It is set when the
	kCommissioningComplete event is received. It should be used by
	other components if they need a way to check the state of the device.
- Add button action to switch to ICD active mode
- Add support for BooleanState in device callbacks
- Add diagnostic logs usage demo
- Enclose feedback manager calls in CONFIG_ENABLE_FEEDBACK flag
	This flag should be defined whenever the application must provide
	some kind of user interface feedback, such as LED animation.
	In case of low power, this flag will not be defined.
- Remove unused features (e.g. diagnostic logs)
- Overwrite event queue and ticks to wait
- Call PlatformMgrImpl API for PreInitMatterStack actions
- Replace PW_RPC_ENABLED with CONFIG_ENABLE_PW_RPC

Signed-off-by: marius-alex-tache <marius.tache@nxp.com>
(cherry picked from commit bed6655227d44900279cbd0ef547771da9143895)
  • Loading branch information
marius-alex-tache committed Aug 14, 2024
commit a01f2e0d58e4fd7e6a875a24b19aa80e29e6b0cf
37 changes: 37 additions & 0 deletions examples/lighting-app/nxp/common/AppTask.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
*
* Copyright (c) 2024 Project CHIP Authors
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#include "AppTask.h"

#include <platform/CHIPDeviceLayer.h>

void LightingApp::AppTask::PreInitMatterStack()
{
ChipLogProgress(DeviceLayer, "Welcome to NXP Lighting Demo App");
}

LightingApp::AppTask & LightingApp::AppTask::GetDefaultInstance()
{
static LightingApp::AppTask sAppTask;
return sAppTask;
}

chip::NXP::App::AppTaskBase & chip::NXP::App::GetAppTask()
{
return LightingApp::AppTask::GetDefaultInstance();
}
89 changes: 89 additions & 0 deletions examples/lighting-app/nxp/common/DeviceCallbacks.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
/*
*
* Copyright (c) 2024 Project CHIP Authors
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#include <lib/support/logging/CHIPLogging.h>

#include "DeviceCallbacks.h"
#if CONFIG_ENABLE_FEEDBACK
#include "UserInterfaceFeedback.h"
#endif

#include <app-common/zap-generated/ids/Attributes.h>
#include <app-common/zap-generated/ids/Clusters.h>

using namespace ::chip;
using namespace ::chip::app::Clusters;

void LightingApp::DeviceCallbacks::PostAttributeChangeCallback(chip::EndpointId endpoint, chip::ClusterId clusterId,
chip::AttributeId attributeId, uint8_t type, uint16_t size,
uint8_t * value)
{
if (clusterId == OnOff::Id)
{
if (attributeId != OnOff::Attributes::OnOff::Id)
{
ChipLogProgress(Zcl, "Unknown attribute ID: " ChipLogFormatMEI, ChipLogValueMEI(attributeId));
return;
}
#if CONFIG_ENABLE_FEEDBACK
FeedbackMgr().RestoreState();
#endif
}
else if (clusterId == LevelControl::Id)
{
if (attributeId != LevelControl::Attributes::CurrentLevel::Id)
{
ChipLogProgress(Zcl, "Unknown attribute ID: " ChipLogFormatMEI, ChipLogValueMEI(attributeId));
return;
}
#if LIGHTING_MANAGER_ENABLE_DIMMABLE_LED
if (*value > 1 && *value < 254)
{
ChipLogProgress(Zcl, "Setting value: %d", *value);
// The cluster attribute value will be read in RestoreState and the proper action will be taken: e.g. ApplyDim.
#if CONFIG_ENABLE_FEEDBACK
FeedbackMgr().RestoreState();
#endif
}
#endif
}
else if (clusterId == ColorControl::Id)
{
ChipLogProgress(Zcl, "Color Control attribute ID: " ChipLogFormatMEI " Type: %u Value: %u, length %u",
ChipLogValueMEI(attributeId), type, *value, size);

// WIP Apply attribute change to Light
}
else if (clusterId == OnOffSwitchConfiguration::Id)
{
ChipLogProgress(Zcl, "OnOff Switch Configuration attribute ID: " ChipLogFormatMEI " Type: %u Value: %u, length %u",
ChipLogValueMEI(attributeId), type, *value, size);

// WIP Apply attribute change to Light
}
else
{
ChipLogProgress(Zcl, "Unknown attribute ID: " ChipLogFormatMEI, ChipLogValueMEI(attributeId));
}
}

chip::DeviceManager::CHIPDeviceManagerCallbacks & chip::NXP::App::GetDeviceCallbacks()
{
static LightingApp::DeviceCallbacks sDeviceCallbacks;
return sDeviceCallbacks;
}
27 changes: 27 additions & 0 deletions examples/lighting-app/nxp/common/include/AppEvent.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
*
* Copyright (c) 2024 Project CHIP Authors
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#pragma once

struct AppEvent;
typedef void (*EventHandler)(const AppEvent &);

struct AppEvent
{
EventHandler Handler;
};
46 changes: 46 additions & 0 deletions examples/lighting-app/nxp/common/include/AppTask.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
*
* Copyright (c) 2024 Project CHIP Authors
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#pragma once

#include "AppConfig.h"
#include "AppTaskFreeRTOS.h"

#include <platform/CHIPDeviceLayer.h>

namespace LightingApp {

class AppTask : public chip::NXP::App::AppTaskFreeRTOS
{
public:
// AppTaskFreeRTOS virtual methods
void PreInitMatterStack() override;

// This returns an instance of this class.
static AppTask & GetDefaultInstance();
};

} // namespace LightingApp

/**
* Returns the application-specific implementation of the AppTaskBase object.
*
* Applications can use this to gain access to features of the AppTaskBase
* that are specific to the selected application.
*/
chip::NXP::App::AppTaskBase & GetAppTask();
51 changes: 51 additions & 0 deletions examples/lighting-app/nxp/common/include/DeviceCallbacks.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
*
* Copyright (c) 2024 Project CHIP Authors
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/**
* @file DeviceCallbacks.h
*
* Lighting app implementation for the DeviceManager callbacks for all applications
*
**/

#pragma once

#include "CHIPDeviceManager.h"
#include "CommonDeviceCallbacks.h"

namespace LightingApp {

class DeviceCallbacks : public chip::NXP::App::CommonDeviceCallbacks
{
public:
void PostAttributeChangeCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, chip::AttributeId attributeId,
uint8_t type, uint16_t size, uint8_t * value) override;
};

} // namespace LightingApp

namespace chip::NXP::App {
/**
* Returns the application-specific implementation of the CommonDeviceCallbacks object.
*
* Applications can use this to gain access to features of the CommonDeviceCallbacks
* that are specific to the selected application.
*/
chip::DeviceManager::CHIPDeviceManagerCallbacks & GetDeviceCallbacks();

} // namespace chip::NXP::App
39 changes: 39 additions & 0 deletions examples/lighting-app/nxp/common/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
*
* Copyright (c) 2024 Project CHIP Authors
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#include "AppTask.h"
#include "FreeRTOS.h"

#if configAPPLICATION_ALLOCATED_HEAP
uint8_t __attribute__((section(".heap"))) ucHeap[configTOTAL_HEAP_SIZE];
#endif

#if FSL_OSA_MAIN_FUNC_ENABLE
extern "C" void main_task(void const * argument)
{
chip::DeviceLayer::PlatformMgrImpl().HardwareInit();
chip::NXP::App::GetAppTask().Start();
}
#else
extern "C" int main(int argc, char * argv[])
{
chip::DeviceLayer::PlatformMgrImpl().HardwareInit();
chip::NXP::App::GetAppTask().Start();
vTaskStartScheduler();
}
#endif