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 contact sensor
Signed-off-by: marius-alex-tache <marius.tache@nxp.com>
(cherry picked from commit 637580aa6c63048ae1a956807c284165c2af17ed)
marius-alex-tache committed Aug 14, 2024
commit 90f9450c538596ed29ebe2277cf85ebb44201d6a
53 changes: 53 additions & 0 deletions examples/contact-sensor-app/nxp/common/AppTask.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
*
* 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"

#if CONFIG_LOW_POWER
#include "PWR_Interface.h"
#endif

#include <platform/CHIPDeviceLayer.h>

void ContactSensorApp::AppTask::PreInitMatterStack()
{
ChipLogProgress(DeviceLayer, "Welcome to NXP Contact Sensor Demo App");
}

#if CONFIG_LOW_POWER
void ContactSensorApp::AppTask::AppMatter_DisallowDeviceToSleep()
{
PWR_DisallowDeviceToSleep();
}

void ContactSensorApp::AppTask::AppMatter_AllowDeviceToSleep()
{
PWR_AllowDeviceToSleep();
}
#endif

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

chip::NXP::App::AppTaskBase & chip::NXP::App::GetAppTask()
{
return ContactSensorApp::AppTask::GetDefaultInstance();
}
69 changes: 69 additions & 0 deletions examples/contact-sensor-app/nxp/common/DeviceCallbacks.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/*
*
* 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>
#include <app/EventLogging.h>

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

void logBooleanStateEvent(bool state)
{
chip::EventNumber eventNumber;
chip::app::Clusters::BooleanState::Events::StateChange::Type event{ state };
if (CHIP_NO_ERROR != chip::app::LogEvent(event, 1, eventNumber))
{
ChipLogProgress(Zcl, "booleanstate: failed to reacord state-change event");
}
}

void ContactSensorApp::DeviceCallbacks::PostAttributeChangeCallback(chip::EndpointId endpoint, chip::ClusterId clusterId,
chip::AttributeId attributeId, uint8_t type, uint16_t size,
uint8_t * value)
{
if (clusterId == BooleanState::Id)
{
if (attributeId != BooleanState::Attributes::StateValue::Id)
{
ChipLogProgress(Zcl, "Unknown attribute ID: " ChipLogFormatMEI, ChipLogValueMEI(attributeId));
return;
}
#if CONFIG_ENABLE_FEEDBACK
FeedbackMgr().RestoreState();
#endif
logBooleanStateEvent(static_cast<bool>(*value));
}
else
{
ChipLogProgress(Zcl, "Unknown attribute ID: " ChipLogFormatMEI, ChipLogValueMEI(attributeId));
}
}

chip::DeviceManager::CHIPDeviceManagerCallbacks & chip::NXP::App::GetDeviceCallbacks()
{
static ContactSensorApp::DeviceCallbacks sDeviceCallbacks;
return sDeviceCallbacks;
}
38 changes: 38 additions & 0 deletions examples/contact-sensor-app/nxp/common/ZclCallbacks.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
*
* 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 <app-common/zap-generated/cluster-objects.h>
#include <lib/support/logging/CHIPLogging.h>

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

/** @brief BooleanState Cluster Init
*
* This function is called when a specific cluster is initialized. It gives the
* application an opportunity to take care of cluster initialization procedures.
* It is called exactly once for each endpoint where cluster is present.
*/
void emberAfBooleanStateClusterInitCallback(chip::EndpointId endpoint)
{
ChipLogProgress(Zcl, "emberAfBooleanStateClusterInitCallback\n");
#if CONFIG_ENABLE_FEEDBACK
FeedbackMgr().RestoreState();
#endif
}
27 changes: 27 additions & 0 deletions examples/contact-sensor-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;
};
50 changes: 50 additions & 0 deletions examples/contact-sensor-app/nxp/common/include/AppTask.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
*
* 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 ContactSensorApp {

class AppTask : public chip::NXP::App::AppTaskFreeRTOS
{
public:
// AppTaskFreeRTOS virtual methods
void PreInitMatterStack() override;
#if CONFIG_LOW_POWER
void AppMatter_DisallowDeviceToSleep() override;
void AppMatter_AllowDeviceToSleep() override;
#endif

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

} // namespace ContactSensorApp

/**
* 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();
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 ContactSensorApp {

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 ContactSensorApp

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/contact-sensor-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