Skip to content

Commit

Permalink
[K32W0] SDK 2.6.12 changes (#28489)
Browse files Browse the repository at this point in the history
* k32w0: Re-use Thread task for BLE processing

Signed-off-by: Doru Gucea <[email protected]>

* k32w0: Use generic FreeRTOS functions

Avoid using messaging/allocation functions specific to K32W0-SDK
and use instead generic FreeRTOS functions.

This opens the path for a common BLE Manager between K32W0/K32W1.

Signed-off-by: Doru Gucea <[email protected]>

* k32w0: event queues: use generic FreeRTOS functions

Signed-off-by: Doru Gucea <[email protected]>

* k32w0: avoid useless advertising restarting

There is no need to restart advertising after a connect event.

Signed-off-by: Doru Gucea <[email protected]>

* [K32W0] Place BLE common code in a single file

Only specific BLE initialization code is placed under k32w0 folder.

Signed-off-by: Doru Gucea <[email protected]>

* [K32W0] Place specific initialization code in an abstract method

Signed-off-by: Doru Gucea <[email protected]>

* [K32W0] Avoid useless stop of ble advertising

Signed-off-by: Doru Gucea <[email protected]>

* [K32W0] Remove unused function

Signed-off-by: Doru Gucea <[email protected]>

* k32w0: remove useless controller code

NVIC Priority set is done inside the controller library.

Signed-off-by: Doru Gucea <[email protected]>

* [K32W0] Small fixes

- return codes;
- comments.

Signed-off-by: Doru Gucea <[email protected]>

* [K32W0] Add LP API header

The LP API was not included in BleManagerImpl when building
in low power mode.

Signed-off-by: Marius Tache <[email protected]>

* [K32W0] Clear unsupported thread metrics

Thread metrics optional fields should call ClearValue explicitly,
to make sure no garbage is returned in the response message.

Signed-off-by: Marius Tache <[email protected]>

* [K32W0] Disable CHIP_DEVICE_CONFIG_BLE_SET_PHY_2M_REQ for lock/contact sensor

This define enables/disables the Gap_LeSetPhy request to switch to 2M.
It is disabled here for interoperability reasons just to be extra cautious.
Both devices may send a Link Layer control procedure in parallel resulting in a
LPM Error Transaction Collision.
If the peer device doesn't accept our reject command, this can result in a BLE
connection timeout.

Signed-off-by: Marius Tache <[email protected]>

* [K32W0] FRO 32K mode should be used with 32Mhz cpu clock

Signed-off-by: Marius Tache <[email protected]>

* [K32W0] Remove OTA API dependency in factory data provider

If factory data is used, then it is expected that the internal flash
section is written, so the factory data provider can memcpy directly,
without additional checks that were previously done in OtaUtils.

Using the OTA API for reading internal flash data just seems unnatural.
In the absence of another API, just memcpy directly assuming the section
was written.

Signed-off-by: Marius Tache <[email protected]>

* [K32W0] Rename factory data flag

CONFIG_CHIP_K32W0_REAL_FACTORY_DATA renamed to CONFIG_CHIP_LOAD_REAL_FACTORY_DATA.
Also replaced format string in factory data provider logs.

Signed-off-by: Marius Tache <[email protected]>

* [K32W0] Rename K32W0FactoryDataProvider to FactoryDataProvider

Signed-off-by: Marius Tache <[email protected]>

* [K32W0] Move FactoryDataProvider to K32W common area

Update #include statements to use an absolute path.

Signed-off-by: Marius Tache <[email protected]>

* [K32W0] Add FactoryDataProviderImpl

FactoryDataProviderImpl has two main features:
- CHIP_DEVICE_CONFIG_USE_CUSTOM_PROVIDER - enables application factory data provider
- CONFIG_CHIP_K32W0_OTA_FACTORY_DATA_PROCESSOR - enables factory data OTA

Enclose the corresponding functions in their respective flags.

Applications should instantiate a FactoryDataProviderImpl instance,
which can be default or custom.

Signed-off-by: Marius Tache <[email protected]>

* [K32W0] Add support for kSoftwareUpdateCompleted boot reason

A new K32WConfig key is introduced: kConfigKey_SoftwareUpdateCompleted
This key is stored in OTA HandleApply, before the device is reset.
Upon initialization, if the reset is caused by a system reset (ResetMCU),
then if this key exists, the boot reason is kSoftwareUpdateCompleted.

Signed-off-by: Marius Tache <[email protected]>

* [K32W0] POWER_GetResetCause() should be called once for each startup, and its return value should be processed bit by bit

* [K32W0] the priority is watchdog reset, when software reset and watchdog reset are set at the same time in POWER_GetResetCause()

* [K32W0] Remove ble connections state

Other changes:
* Set fast advertising flag when advertising is stopped
* Add device connected state

Signed-off-by: Marius Tache <[email protected]>

* [K32W0] Remove unused members

Signed-off-by: Marius Tache <[email protected]>

* [K32W0] Move global variables to class members

Add HandleForceDisconnect method.

Signed-off-by: Marius Tache <[email protected]>

* [K32W0] Event queue should be emptied in DoBleProcessing

Signed-off-by: Marius Tache <[email protected]>

* [K32W0] Cancel BLE advertising timer upon connection close event

Signed-off-by: Marius Tache <[email protected]>

* [K32W0] Schedule stop advertising from Matter task

Stop advertising was wrongly scheduled from the timer service daemon task,
which has the highest priority. This caused BLE controller task to be preempted
when doing the switch from fast to slow advertising mode, which caused some events
to not be captured on time, resulting in a failed advertising stop.

Stop advertising is now scheduled to run from Matter task.

Signed-off-by: Marius Tache <[email protected]>

* [K32W0] Add instructions to overwrite board configuration files

The example uses template/reference board configuration files.

To overwrite the board configuration files, set `override_is_DK6=false` in the
`k32w0_sdk` target from the app `BUILD.gn`:

```
k32w0_sdk("sdk") {
    override_is_DK6 = false
    ...
}
```

This variable will be used by `k32w0_sdk.gni` to overwrite `chip_with_DK6` option,
thus the reference board configuration files will no longer be used.

Signed-off-by: Marius Tache <[email protected]>

* [K32W0] Restructure RAM storage

RAM storage class was moved to k32w0 folder.

RamStorageKey files were removed and implementation was moved
inside RamStorage.

Signed-off-by: Marius Tache <[email protected]>

* [K32W0] Add extendedSearch option

Increase number of KVS keys to 200.

Signed-off-by: Marius Tache <[email protected]>

* [K32W0] Remove unused ksdk_mbedtls file

Not in the scope of the ticket.

Signed-off-by: Marius Tache <[email protected]>

* [K32W0] Extended search should be taken into account when factory resetting

If extended search was enabled for a RAM storage instance, then factory reset
should remove all PDM ids used, starting with the base one.

Signed-off-by: Marius Tache <[email protected]>

* [K32W0] Update SDK version in README files

Signed-off-by: Marius Tache <[email protected]>

* [K32W0] Set rotating device id unique id length to max by default

Signed-off-by: Marius Tache <[email protected]>

* [K32W0] Use west to get K32W0 SDK

* [K32W0] Remove deprecated function pointer

Signed-off-by: Marius Tache <[email protected]>

* [NXP] Bump ot-nxp to latest

Signed-off-by: Marius Tache <[email protected]>

* Restyled by whitespace
Restyled by clang-format
Restyled by gn
Restyled by prettier-markdown
Restyled by prettier-yaml

* [K32W0] update cPWR_UsePowerDownMode to chip_with_low_power

  update cPWR_UsePowerDownMode usage to a more generic chip_with_low_power
  in order to be able to be used by multiple platforms

Signed-off-by: Marius Vilvoi <[email protected]>

* [K32W0] Remove unused flag in README files

Signed-off-by: Marius Tache <[email protected]>

* [K32W0] Remove redundant header file

Signed-off-by: Marius Tache <[email protected]>

* [K32W0] Update path for building K32W041 as this missing files are only under the K32W061 board

* [K32W0] Update docker image version in examples job

Signed-off-by: Marius Tache <[email protected]>

* Restyled by whitespace
Restyled by gn
Restyled by prettier-markdown

* [K32W0] Update documentation for reference apps

The user can specify a custom SDK by setting NXP_K32W0_SDK_ROOT.
If such an env variabile is not defined, then the gn env will
implicitly set it to the SDK found in the repo:
third_party/nxp/k32w0_sdk/repo/core

Signed-off-by: Marius Tache <[email protected]>

* Restyled by gn

* Restyled by prettier-markdown

* [K32W0] BLE processing should be done under the corresponding flag

Signed-off-by: Marius Tache <[email protected]>

---------

Signed-off-by: Doru Gucea <[email protected]>
Signed-off-by: Marius Tache <[email protected]>
Signed-off-by: Marius Vilvoi <[email protected]>
Co-authored-by: Doru Gucea <[email protected]>
Co-authored-by: tanyue518 <[email protected]>
Co-authored-by: Gabriel Couturier <[email protected]>
Co-authored-by: Restyled.io <[email protected]>
Co-authored-by: Marius Vilvoi <[email protected]>
  • Loading branch information
6 people authored Aug 9, 2023
1 parent afd843d commit 0ecb4e1
Show file tree
Hide file tree
Showing 59 changed files with 2,632 additions and 6,724 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/examples-k32w.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
if: github.actor != 'restyled-io[bot]'

container:
image: ghcr.io/project-chip/chip-build-k32w:1
image: ghcr.io/project-chip/chip-build-k32w:5
volumes:
- "/tmp/bloat_reports:/tmp/bloat_reports"
steps:
Expand Down
63 changes: 52 additions & 11 deletions examples/contact-sensor-app/nxp/k32w/k32w0/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ network.
- [Bluetooth LE Rendezvous](#bluetooth-le-rendezvous)
- [Device UI](#device-ui)
- [Building](#building)
- [Known issues buiulding](#known-issues-building)
- [Overwrite board config files](#overwrite-board-config-files)
- [Known issues building](#known-issues-building)
- [Manufacturing data](#manufacturing-data)
- [Flashing and debugging](#flashing-and-debugging)
- [Pigweed Tokenizer](#pigweed-tokenizer)
Expand Down Expand Up @@ -176,19 +177,43 @@ contact status.
In order to build the Project CHIP example, we recommend using a Linux
distribution (the demo-application was compiled on Ubuntu 20.04).

- Download
[K32W061DK6 SDK 2.6.11](https://cache.nxp.com/lgfiles/bsps/SDK_2_6_11_K32W061DK6.zip).

- Start building the application either with Secure Element or without
- Start building the application either with Secure Element or without, SDK is
downloaded with west tool.

- without Secure Element

```
user@ubuntu:~/Desktop/git/connectedhomeip$ export NXP_K32W0_SDK_ROOT=/home/user/Desktop/SDK_2_6_11_K32W061DK6/
user@ubuntu:~/Desktop/git/connectedhomeip$ ./third_party/nxp/k32w0_sdk/sdk_fixes/patch_k32w_sdk.sh
user@ubuntu:~/Desktop/git/connectedhomeip$ source ./scripts/activate.sh
user@ubuntu:~/Desktop/git/connectedhomeip$ cd third_party/nxp/k32w0_sdk/repo
user@ubuntu:~/Desktop/git/connectedhomeip/third_party/nxp/k32w0_sdk/repo$ west init -l manifest --mf west.yml
user@ubuntu:~/Desktop/git/connectedhomeip/third_party/nxp/k32w0_sdk/repo$ west update
```
In case there are local modification to the already installed git NXP SDK:
Use the below west `forall` command instead of the west init command to
reset the west workspace. Warning: all local changes will be lost after
running this command.
```bash
user@ubuntu:~/Desktop/git/connectedhomeip$ cd third_party/nxp/k32w0_sdk/repo
user@ubuntu:~/Desktop/git/connectedhomeip/third_party/nxp/k32w0_sdk/repo$west forall -c "git reset --hard && git clean -xdf" -a
```
Build the application
Prior to building, the user can specify a custom `SDK` path by setting
`NXP_K32W0_SDK_ROOT`:
```
user@ubuntu:~/Desktop/git/connectedhomeip$ export NXP_K32W0_SDK_ROOT=$(pwd)/third_party/nxp/k32w0_sdk/repo/core
```
If the environment variable `NXP_K32W0_SDK_ROOT` is not set, it will default
to the `SDK` found in `third_party/nxp/k32w0_sdk/repo/core`.
```
user@ubuntu:~/Desktop/git/connectedhomeip$ cd examples/contact-sensor-app/nxp/k32w/k32w0
user@ubuntu:~/Desktop/git/connectedhomeip/examples/contact-sensor-app/nxp/k32w/k32w0$ gn gen out/debug --args="k32w0_sdk_root=\"${NXP_K32W0_SDK_ROOT}\" chip_with_OM15082=1 chip_with_ot_cli=0 is_debug=false chip_crypto=\"platform\" chip_with_se05x=0 chip_pw_tokenizer_logging=true"
user@ubuntu:~/Desktop/git/connectedhomeip/examples/contact-sensor-app/nxp/k32w/k32w0$ gn gen out/debug --args="chip_with_OM15082=1 chip_with_ot_cli=0 is_debug=false chip_crypto=\"platform\" chip_with_se05x=0 chip_pw_tokenizer_logging=true"
user@ubuntu:~/Desktop/git/connectedhomeip/examples/contact-sensor-app/nxp/k32w/k32w0$ ninja -C out/debug
```
Expand All @@ -202,8 +227,7 @@ Secure Element. These can be changed if building without Secure Element
- K32W041AM flavor
Exactly the same steps as above but set argument build_for_k32w041am=1 in
the gn command and use
[K32W041AMDK6 SDK 2.6.11](https://cache.nxp.com/lgfiles/bsps/SDK_2_6_11_K32W041AMDK6.zip).
the gn command.
Also, in case the OM15082 Expansion Board is not attached to the DK6 board, the
build argument (chip_with_OM15082) inside the gn build instruction should be set
Expand Down Expand Up @@ -232,6 +256,23 @@ pycryptodome 3.9.8
The resulting output file can be found in out/debug/chip-k32w0x-contact-example.
### Overwrite board config files
The example uses template/reference board configuration files.
To overwrite the board configuration files, set `override_is_DK6=false` in the
`k32w0_sdk` target from the app `BUILD.gn`:
```
k32w0_sdk("sdk") {
override_is_DK6 = false
...
}
```
This variable will be used by `k32w0_sdk.gni` to overwrite `chip_with_DK6`
option, thus the reference board configuration files will no longer be used.
### Known issues building
- When using Secure element and cross-compiling on Linux, log messages from
Expand Down Expand Up @@ -274,7 +315,7 @@ CHIPProjectConfig.h.
Regarding factory data provider, there are two options:
- use the default factory data provider: `K32W0FactoryDataProvider` by setting
- use the default factory data provider: `FactoryDataProviderImpl` by setting
`chip_with_factory_data=1` in the gn build command.
- use a custom factory data provider: please see
[Guide for implementing a custom factory data provider](../../../../platform/nxp/k32w/k32w0/common/README.md).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@
// Use hard-coded test certificates already embedded in generic chip code => set it to 0
// Use real/development certificates => set it to 1 + file the provisioning section from
// the internal flash
#ifndef CONFIG_CHIP_K32W0_REAL_FACTORY_DATA
#define CONFIG_CHIP_K32W0_REAL_FACTORY_DATA 0
#ifndef CONFIG_CHIP_LOAD_REAL_FACTORY_DATA
#define CONFIG_CHIP_LOAD_REAL_FACTORY_DATA 0
#endif

#if CONFIG_CHIP_K32W0_REAL_FACTORY_DATA
#if CONFIG_CHIP_LOAD_REAL_FACTORY_DATA

// Enable usage of custom factory data provider
#ifndef CHIP_DEVICE_CONFIG_USE_CUSTOM_PROVIDER
Expand Down Expand Up @@ -222,6 +222,18 @@

#define CHIP_DEVICE_CONFIG_ENABLE_EXTENDED_DISCOVERY 1

/**
* CHIP_DEVICE_CONFIG_BLE_SET_PHY_2M_REQ
*
* This define enables/disables the Gap_LeSetPhy request to switch to 2M.
* It is disabled here for interoperability reasons just to be extra cautious.
* Both devices may send a Link Layer control procedure in parallel resulting in a
* LPM Error Transaction Collision.
* If the peer device doesn't accept our reject command, this can result in a BLE
* connection timeout.
*/
#define CHIP_DEVICE_CONFIG_BLE_SET_PHY_2M_REQ 0

/**
* CHIP_DEVICE_CONFIG_INIT_OTA_DELAY
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@

#define configUSE_PREEMPTION 1

#if defined(cPWR_UsePowerDownMode) && (cPWR_UsePowerDownMode)
#if defined(chip_with_low_power) && (chip_with_low_power == 1)
#define configUSE_TICKLESS_IDLE 1
#else
#define configUSE_TICKLESS_IDLE 0
Expand All @@ -51,7 +51,7 @@
#define configTICK_RATE_HZ ((TickType_t) 100)
#define configMAX_PRIORITIES (8)

#if defined(cPWR_UsePowerDownMode) && (cPWR_UsePowerDownMode)
#if defined(configUSE_TICKLESS_IDLE) && (configUSE_TICKLESS_IDLE == 1)
#define configMINIMAL_STACK_SIZE ((unsigned short) 610)
#else
#define configMINIMAL_STACK_SIZE ((unsigned short) 450)
Expand Down
50 changes: 27 additions & 23 deletions examples/contact-sensor-app/nxp/k32w/k32w0/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ TimerHandle_t sFunctionTimer; // FreeRTOS app sw timer.

static QueueHandle_t sAppEventQueue;

#if !cPWR_UsePowerDownMode
#if !defined(chip_with_low_power) || (chip_with_low_power == 0)
static LEDWidget sStatusLED;
static LEDWidget sContactSensorLED;
#endif
Expand All @@ -85,6 +85,9 @@ using namespace chip;
using namespace chip::app;

AppTask AppTask::sAppTask;
#if CONFIG_CHIP_LOAD_REAL_FACTORY_DATA
static AppTask::FactoryDataProvider sFactoryDataProvider;
#endif

static Identify gIdentify = { chip::EndpointId{ 1 }, AppTask::OnIdentifyStart, AppTask::OnIdentifyStop,
Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator };
Expand All @@ -99,7 +102,7 @@ static BDXDownloader gDownloader;
constexpr uint16_t requestedOtaBlockSize = 1024;
#endif

#if CONFIG_CHIP_K32W0_REAL_FACTORY_DATA
#if CONFIG_CHIP_LOAD_REAL_FACTORY_DATA && CONFIG_CHIP_K32W0_OTA_FACTORY_DATA_PROCESSOR
CHIP_ERROR CustomFactoryDataRestoreMechanism(void)
{
K32W_LOG("This is a custom factory data restore mechanism.");
Expand Down Expand Up @@ -134,7 +137,7 @@ static void CheckOtaEntry()
if (ota_entries.ota_state == otaApplied)
{
K32W_LOG("OTA successfully applied");
#if CONFIG_CHIP_K32W0_OTA_FACTORY_DATA_PROCESSOR
#if CONFIG_CHIP_LOAD_REAL_FACTORY_DATA && CONFIG_CHIP_K32W0_OTA_FACTORY_DATA_PROCESSOR
// If this point is reached, it means OTA_CommitCustomEntries was successfully called.
// Delete the factory data backup to stop doing a restore when the factory data provider
// is initialized. This ensures that both the factory data and app were updated, otherwise
Expand Down Expand Up @@ -177,26 +180,27 @@ CHIP_ERROR AppTask::Init()
#endif

// Initialize device attestation config
#if CONFIG_CHIP_K32W0_REAL_FACTORY_DATA
// Initialize factory data provider
ReturnErrorOnFailure(AppTask::FactoryDataProvider::GetDefaultInstance().Init());
AppTask::FactoryDataProvider::GetDefaultInstance().RegisterRestoreMechanism(CustomFactoryDataRestoreMechanism);
SetDeviceInstanceInfoProvider(&AppTask::FactoryDataProvider::GetDefaultInstance());
SetDeviceAttestationCredentialsProvider(&AppTask::FactoryDataProvider::GetDefaultInstance());
SetCommissionableDataProvider(&AppTask::FactoryDataProvider::GetDefaultInstance());
#if CONFIG_CHIP_LOAD_REAL_FACTORY_DATA
#if CONFIG_CHIP_K32W0_OTA_FACTORY_DATA_PROCESSOR
sFactoryDataProvider.RegisterRestoreMechanism(CustomFactoryDataRestoreMechanism);
#endif
ReturnErrorOnFailure(sFactoryDataProvider.Init());
SetDeviceInstanceInfoProvider(&sFactoryDataProvider);
SetDeviceAttestationCredentialsProvider(&sFactoryDataProvider);
SetCommissionableDataProvider(&sFactoryDataProvider);
#else
#ifdef ENABLE_HSM_DEVICE_ATTESTATION
SetDeviceAttestationCredentialsProvider(Examples::GetExampleSe05xDACProvider());
#else
SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider());
#endif
#endif // CONFIG_CHIP_K32W0_REAL_FACTORY_DATA
#endif // CONFIG_CHIP_LOAD_REAL_FACTORY_DATA

// QR code will be used with CHIP Tool
AppTask::PrintOnboardingInfo();

/* HW init leds */
#if !cPWR_UsePowerDownMode
#if !defined(chip_with_low_power) || (chip_with_low_power == 0)
LED_Init();

/* start with all LEDS turnedd off */
Expand Down Expand Up @@ -323,7 +327,7 @@ void AppTask::AppTaskMain(void * pvParameter)
{
TickType_t xTicksToWait = pdMS_TO_TICKS(10);

#if defined(cPWR_UsePowerDownMode) && (cPWR_UsePowerDownMode)
#if defined(chip_with_low_power) && (chip_with_low_power == 1)
xTicksToWait = portMAX_DELAY;
#endif

Expand Down Expand Up @@ -361,7 +365,7 @@ void AppTask::AppTaskMain(void * pvParameter)
//
// Otherwise, blink the LED ON for a very short time.

#if !cPWR_UsePowerDownMode
#if !defined(chip_with_low_power) || (chip_with_low_power == 0)
if (sAppTask.mFunction != Function::kFactoryReset && sAppTask.mFunction != Function::kIdentify)
{
if (sIsThreadProvisioned)
Expand Down Expand Up @@ -513,7 +517,7 @@ void AppTask::ResetActionEventHandler(void * aGenericEvent)
sAppTask.CancelTimer();
sAppTask.mFunction = Function::kNoneSelected;

#if !cPWR_UsePowerDownMode
#if !defined(chip_with_low_power) || (chip_with_low_power == 0)
/* restore initial state for the LED indicating contact state */
if (!ContactSensorMgr().IsContactClosed())
{
Expand Down Expand Up @@ -541,7 +545,7 @@ void AppTask::ResetActionEventHandler(void * aGenericEvent)
sAppTask.mFunction = Function::kFactoryReset;

/* LEDs will start blinking to signal that a Factory Reset was scheduled */
#if !cPWR_UsePowerDownMode
#if !defined(chip_with_low_power) || (chip_with_low_power == 0)
sStatusLED.Set(false);
sContactSensorLED.Set(false);

Expand Down Expand Up @@ -639,7 +643,7 @@ void AppTask::BleStartAdvertising(intptr_t arg)
if (ConnectivityMgr().IsBLEAdvertisingEnabled())
{
ConnectivityMgr().SetBLEAdvertisingEnabled(false);
#if !cPWR_UsePowerDownMode
#if !defined(chip_with_low_power) || (chip_with_low_power == 0)
sStatusLED.Set(false);
#endif
K32W_LOG("Stopped BLE Advertising!");
Expand All @@ -650,7 +654,7 @@ void AppTask::BleStartAdvertising(intptr_t arg)

if (chip::Server::GetInstance().GetCommissioningWindowManager().OpenBasicCommissioningWindow() == CHIP_NO_ERROR)
{
#if !cPWR_UsePowerDownMode
#if !defined(chip_with_low_power) || (chip_with_low_power == 0)
sStatusLED.Set(true);
#endif
K32W_LOG("Started BLE Advertising!");
Expand Down Expand Up @@ -750,14 +754,14 @@ void AppTask::OnStateChanged(ContactSensorManager::State aState)
if (ContactSensorManager::State::kContactClosed == aState)
{
K32W_LOG("Contact state changed to closed.")
#if !cPWR_UsePowerDownMode
#if !defined(chip_with_low_power) || (chip_with_low_power == 0)
sContactSensorLED.Set(true);
#endif
}
else if (ContactSensorManager::State::kContactOpened == aState)
{
K32W_LOG("Contact state changed to opened.")
#if !cPWR_UsePowerDownMode
#if !defined(chip_with_low_power) || (chip_with_low_power == 0)
sContactSensorLED.Set(false);
#endif
}
Expand All @@ -781,7 +785,7 @@ void AppTask::OnIdentifyStart(Identify * identify)
}
K32W_LOG("Identify process has started. Status LED should blink every 0.5 seconds.");
sAppTask.mFunction = Function::kIdentify;
#if !cPWR_UsePowerDownMode
#if !defined(chip_with_low_power) || (chip_with_low_power == 0)
sStatusLED.Set(false);
sStatusLED.Blink(500);
#endif
Expand Down Expand Up @@ -831,7 +835,7 @@ void AppTask::PostEvent(const AppEvent * aEvent)

void AppTask::DispatchEvent(AppEvent * aEvent)
{
#if defined(cPWR_UsePowerDownMode) && (cPWR_UsePowerDownMode)
#if defined(chip_with_low_power) && (chip_with_low_power == 1)
/* specific processing for events sent from App_PostCallbackMessage (see main.cpp) */
if (aEvent->Type == AppEvent::kEventType_Lp)
{
Expand Down Expand Up @@ -879,7 +883,7 @@ void AppTask::UpdateDeviceStateInternal(intptr_t arg)

/* get onoff attribute value */
(void) app::Clusters::BooleanState::Attributes::StateValue::Get(1, &stateValueAttrValue);
#if !cPWR_UsePowerDownMode
#if !defined(chip_with_low_power) || (chip_with_low_power == 0)
/* set the device state */
sContactSensorLED.Set(stateValueAttrValue);
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ struct AppEvent
kTimer,
kContact,
kInstall,
#if defined(cPWR_UsePowerDownMode) && (cPWR_UsePowerDownMode)
#if defined(chip_with_low_power) && (chip_with_low_power == 1)
kEventType_Lp,
#endif
kOTAResume,
Expand All @@ -56,7 +56,7 @@ struct AppEvent

EventHandler Handler;

#if defined(cPWR_UsePowerDownMode) && (cPWR_UsePowerDownMode)
#if defined(chip_with_low_power) && (chip_with_low_power == 1)
void * param;
#endif
};
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@

#include "CHIPProjectConfig.h"

#if CONFIG_CHIP_K32W0_REAL_FACTORY_DATA
#include "K32W0FactoryDataProvider.h"
#if CONFIG_CHIP_LOAD_REAL_FACTORY_DATA
#include <platform/nxp/k32w/k32w0/FactoryDataProviderImpl.h>
#if CHIP_DEVICE_CONFIG_USE_CUSTOM_PROVIDER
#include "CustomFactoryDataProvider.h"
#endif
Expand All @@ -50,11 +50,11 @@
class AppTask
{
public:
#if CONFIG_CHIP_K32W0_REAL_FACTORY_DATA
#if CONFIG_CHIP_LOAD_REAL_FACTORY_DATA
#if CHIP_DEVICE_CONFIG_USE_CUSTOM_PROVIDER
using FactoryDataProvider = chip::DeviceLayer::CustomFactoryDataProvider;
#else
using FactoryDataProvider = chip::DeviceLayer::K32W0FactoryDataProvider;
using FactoryDataProvider = chip::DeviceLayer::FactoryDataProviderImpl;
#endif
#endif

Expand Down
Loading

0 comments on commit 0ecb4e1

Please sign in to comment.