diff --git a/examples/lighting-app/k32w/README.md b/examples/lighting-app/k32w/README.md
index fea966e6c98a4f..76632da9973174 100644
--- a/examples/lighting-app/k32w/README.md
+++ b/examples/lighting-app/k32w/README.md
@@ -109,7 +109,7 @@ states are depicted:
light bulb is on; when not lit, the light bulb is off.
**Button SW2** can be used to reset the device to a default state. Pressing and
-holding Button SW3 for 6 seconds initiates a factory reset. After an initial
+holding Button SW2 for 6 seconds initiates a factory reset. After an initial
period of 3 seconds, LED2 D2 and D3 will flash in unison to signal the pending
reset. Holding the button past 6 seconds will cause the device to reset its
persistent configuration and initiate a reboot. The reset action can be
@@ -130,6 +130,15 @@ enabling Bluetooth LE advertising for a predefined period of time. Also, pushing
this button starts the NFC emulation by writing the onboarding information in
the NTAG.
+### No expansion board
+
+In case the **OM15082** Expansion board is not attached to the DK6 board, the
+functionality of LED D2 and LED D3 is taken over by LED DS2, respectively LED
+DS3, which can be found on the DK6 board.
+
+Also, by long pressing the **USERINTERFACE** button, the factory reset action
+will be initiated.
+
## Building
@@ -150,8 +159,8 @@ distribution (the demo-application was compiled on Ubuntu 20.04).
user@ubuntu:~/Desktop/git/connectedhomeip$ export K32W061_SDK_ROOT=/home/user/Desktop/SDK_2.6.3_K32W061DK6/
user@ubuntu:~/Desktop/git/connectedhomeip$ ./third_party/k32w_sdk/sdk_fixes/patch_k32w_sdk.sh
user@ubuntu:~/Desktop/git/connectedhomeip$ source ./scripts/activate.sh
-user@ubuntu:~/Desktop/git/connectedhomeip/third_party/openthread/repo$ cd examples/lighting-app/k32w/
-user@ubuntu:~/Desktop/git/connectedhomeip/examples/lighting-app/k32w$ gn gen out/debug --args="k32w_sdk_root=\"${K32W061_SDK_ROOT}\" is_debug=true"
+user@ubuntu:~/Desktop/git/connectedhomeip$ cd examples/lighting-app/k32w/
+user@ubuntu:~/Desktop/git/connectedhomeip/examples/lighting-app/k32w$ gn gen out/debug --args="k32w_sdk_root=\"${K32W061_SDK_ROOT}\" chip_with_OM15082=1 is_debug=true"
user@ubuntu:~/Desktop/git/connectedhomeip/examples/lightin-app/k32w$ ninja -C out/debug
user@ubuntu:~/Desktop/git/connectedhomeip/examples/lighting-app/k32w$ $K32W061_SDK_ROOT/tools/imagetool/sign_images.sh out/debug/
```
@@ -159,6 +168,10 @@ user@ubuntu:~/Desktop/git/connectedhomeip/examples/lighting-app/k32w$ $K32W061_S
Note that "patch_k32w_sdk.sh" script must be run for patching the K32W061 SDK
2.6.3.
+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
+to zero. The argument chip_with_OM15082 is set to zero by default.
+
In case signing errors are encountered when running the "sign_images.sh" script
install the recommanded packages (python version > 3, pip3, pycrypto,
pycryptodome):
diff --git a/examples/lighting-app/k32w/data.bin b/examples/lighting-app/k32w/data.bin
index 678b034e074635..ec2cd54c0747ed 100644
Binary files a/examples/lighting-app/k32w/data.bin and b/examples/lighting-app/k32w/data.bin differ
diff --git a/examples/lighting-app/k32w/main/AppTask.cpp b/examples/lighting-app/k32w/main/AppTask.cpp
index 6d37c256d3a807..f48bd90c462066 100644
--- a/examples/lighting-app/k32w/main/AppTask.cpp
+++ b/examples/lighting-app/k32w/main/AppTask.cpp
@@ -241,6 +241,12 @@ void AppTask::ButtonEventHandler(uint8_t pin_no, uint8_t button_action)
else if (pin_no == BLE_BUTTON)
{
button_event.Handler = BleHandler;
+#if !(defined OM15082)
+ if (button_action == RESET_BUTTON_PUSH)
+ {
+ button_event.Handler = ResetActionEventHandler;
+ }
+#endif
}
sAppTask.PostEvent(&button_event);
@@ -271,8 +277,13 @@ void AppTask::HandleKeyboard(void)
switch (keyEvent)
{
case gKBD_EventPB1_c:
+#if (defined OM15082)
ButtonEventHandler(RESET_BUTTON, RESET_BUTTON_PUSH);
break;
+#else
+ ButtonEventHandler(BLE_BUTTON, BLE_BUTTON_PUSH);
+ break;
+#endif
case gKBD_EventPB2_c:
ButtonEventHandler(LIGHT_BUTTON, LIGHT_BUTTON_PUSH);
break;
@@ -282,6 +293,11 @@ void AppTask::HandleKeyboard(void)
case gKBD_EventPB4_c:
ButtonEventHandler(BLE_BUTTON, BLE_BUTTON_PUSH);
break;
+#if !(defined OM15082)
+ case gKBD_EventLongPB1_c:
+ ButtonEventHandler(BLE_BUTTON, RESET_BUTTON_PUSH);
+ break;
+#endif
default:
break;
}
@@ -310,7 +326,7 @@ void AppTask::FunctionTimerEventHandler(AppEvent * aEvent)
void AppTask::ResetActionEventHandler(AppEvent * aEvent)
{
- if (aEvent->ButtonEvent.PinNo != RESET_BUTTON)
+ if (aEvent->ButtonEvent.PinNo != RESET_BUTTON && aEvent->ButtonEvent.PinNo != BLE_BUTTON)
return;
if (sAppTask.mResetTimerActive)
diff --git a/examples/lock-app/k32w/README.md b/examples/lock-app/k32w/README.md
index 9f2774bb0a7c80..9876a25b766e04 100644
--- a/examples/lock-app/k32w/README.md
+++ b/examples/lock-app/k32w/README.md
@@ -112,7 +112,7 @@ unlocked). The LED will flash whenever the simulated bolt is in motion from one
position to another.
**Button SW2** can be used to reset the device to a default state. Pressing and
-holding Button SW3 for 6 seconds initiates a factory reset. After an initial
+holding Button SW2 for 6 seconds initiates a factory reset. After an initial
period of 3 seconds, LED2 D2 and D3 will flash in unison to signal the pending
reset. Holding the button past 6 seconds will cause the device to reset its
persistent configuration and initiate a reboot. The reset action can be
@@ -133,6 +133,15 @@ enabling Bluetooth LE advertising for a predefined period of time. Also, pushing
this button starts the NFC emulation by writing the onboarding information in
the NTAG.
+### No expansion board
+
+In case the **OM15082** Expansion board is not attached to the DK6 board, the
+functionality of LED D2 and LED D3 is taken over by LED DS2, respectively LED
+DS3, which can be found on the DK6 board.
+
+Also, by long pressing the **USERINTERFACE** button, the factory reset action
+will be initiated.
+
## Building
@@ -154,7 +163,7 @@ user@ubuntu:~/Desktop/git/connectedhomeip$ export K32W061_SDK_ROOT=/home/user/De
user@ubuntu:~/Desktop/git/connectedhomeip$ ./third_party/k32w_sdk/sdk_fixes/patch_k32w_sdk.sh
user@ubuntu:~/Desktop/git/connectedhomeip$ source ./scripts/activate.sh
user@ubuntu:~/Desktop/git/connectedhomeip$ cd examples/lock-app/k32w/
-user@ubuntu:~/Desktop/git/connectedhomeip/examples/lock-app/k32w$ gn gen out/debug --args="k32w_sdk_root=\"${K32W061_SDK_ROOT}\" is_debug=true"
+user@ubuntu:~/Desktop/git/connectedhomeip/examples/lock-app/k32w$ gn gen out/debug --args="k32w_sdk_root=\"${K32W061_SDK_ROOT}\" chip_with_OM15082=1 is_debug=true"
user@ubuntu:~/Desktop/git/connectedhomeip/examples/lock-app/k32w$ ninja -C out/debug
user@ubuntu:~/Desktop/git/connectedhomeip/examples/lock-app/k32w$ $K32W061_SDK_ROOT/tools/imagetool/sign_images.sh out/debug/
```
@@ -162,6 +171,10 @@ user@ubuntu:~/Desktop/git/connectedhomeip/examples/lock-app/k32w$ $K32W061_SDK_R
Note that "patch_k32w_sdk.sh" script must be run for patching the K32W061 SDK
2.6.3.
+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
+to zero. The argument chip_with_OM15082 is set to zero by default.
+
In case signing errors are encountered when running the "sign_images.sh" script
install the recommanded packages (python version > 3, pip3, pycrypto,
pycryptodome):
diff --git a/examples/lock-app/k32w/main/AppTask.cpp b/examples/lock-app/k32w/main/AppTask.cpp
index 03245de5554039..54853e1d06c7c2 100644
--- a/examples/lock-app/k32w/main/AppTask.cpp
+++ b/examples/lock-app/k32w/main/AppTask.cpp
@@ -245,8 +245,14 @@ void AppTask::ButtonEventHandler(uint8_t pin_no, uint8_t button_action)
else if (pin_no == BLE_BUTTON)
{
button_event.Handler = BleHandler;
- }
+#if !(defined OM15082)
+ if (button_action == RESET_BUTTON_PUSH)
+ {
+ button_event.Handler = ResetActionEventHandler;
+ }
+#endif
+ }
sAppTask.PostEvent(&button_event);
}
@@ -275,8 +281,13 @@ void AppTask::HandleKeyboard(void)
switch (keyEvent)
{
case gKBD_EventPB1_c:
+#if (defined OM15082)
ButtonEventHandler(RESET_BUTTON, RESET_BUTTON_PUSH);
break;
+#else
+ ButtonEventHandler(BLE_BUTTON, BLE_BUTTON_PUSH);
+ break;
+#endif
case gKBD_EventPB2_c:
ButtonEventHandler(LOCK_BUTTON, LOCK_BUTTON_PUSH);
break;
@@ -286,6 +297,11 @@ void AppTask::HandleKeyboard(void)
case gKBD_EventPB4_c:
ButtonEventHandler(BLE_BUTTON, BLE_BUTTON_PUSH);
break;
+#if !(defined OM15082)
+ case gKBD_EventLongPB1_c:
+ ButtonEventHandler(BLE_BUTTON, RESET_BUTTON_PUSH);
+ break;
+#endif
default:
break;
}
@@ -314,7 +330,7 @@ void AppTask::FunctionTimerEventHandler(AppEvent * aEvent)
void AppTask::ResetActionEventHandler(AppEvent * aEvent)
{
- if (aEvent->ButtonEvent.PinNo != RESET_BUTTON)
+ if (aEvent->ButtonEvent.PinNo != RESET_BUTTON && aEvent->ButtonEvent.PinNo != BLE_BUTTON)
return;
if (sAppTask.mResetTimerActive)
diff --git a/third_party/k32w_sdk/k32w_sdk.gni b/third_party/k32w_sdk/k32w_sdk.gni
index 9e6fe692f6ea91..7a2aa2dd847ccc 100644
--- a/third_party/k32w_sdk/k32w_sdk.gni
+++ b/third_party/k32w_sdk/k32w_sdk.gni
@@ -21,6 +21,7 @@ import("${chip_root}/src/platform/K32W/args.gni")
declare_args() {
# Location of the k32w SDK.
k32w_sdk_root = getenv("K32W_SDK_ROOT")
+ chip_with_OM15082 = 0
}
assert(k32w_sdk_root != "", "k32w_sdk_root must be specified")
@@ -128,8 +129,6 @@ template("k32w_sdk") {
"gPdmNbSegments=63",
"configFRTOS_MEMORY_SCHEME=4",
"osCustomStartup=1",
- "OM15082=1",
- "gKBD_KeysCount_c=4",
"gLEDsOnTargetBoardCnt_c=2",
"gLED_InvertedMode_d=1",
"ENABLE_RAM_VECTOR_TABLE=1",
@@ -172,6 +171,14 @@ template("k32w_sdk") {
} else {
defines += [ "gMainThreadStackSize_c=6024" ]
}
+ if (chip_with_OM15082 == 1) {
+ defines += [
+ "gKBD_KeysCount_c=4",
+ "OM15082=1",
+ ]
+ } else {
+ defines += [ "gKBD_KeysCount_c=1" ]
+ }
if (defined(invoker.defines)) {
defines += invoker.defines