From 4090399579eea5e86696dda57cf1b09ade58a70b Mon Sep 17 00:00:00 2001 From: Todd Chou Date: Thu, 27 Jan 2022 13:06:00 +0800 Subject: [PATCH] Infineon CYW30739 - lock-app support. (#14012) --- .github/workflows/examples-cyw30739.yaml | 6 + examples/lock-app/cyw30739/.gn | 28 +++ examples/lock-app/cyw30739/BUILD.gn | 68 +++++ examples/lock-app/cyw30739/README.md | 104 ++++++++ examples/lock-app/cyw30739/args.gni | 18 ++ examples/lock-app/cyw30739/build_overrides | 1 + .../cyw30739/include/AppShellCommands.h | 22 ++ .../cyw30739/include/BoltLockManager.h | 86 +++++++ .../lock-app/cyw30739/include/ButtonHandler.h | 28 +++ .../cyw30739/include/CHIPProjectConfig.h | 61 +++++ .../lock-app/cyw30739/include/chip_lock.h | 28 +++ .../cyw30739/src/AppShellCommands.cpp | 103 ++++++++ .../lock-app/cyw30739/src/BoltLockManager.cpp | 219 ++++++++++++++++ .../lock-app/cyw30739/src/ButtonHandler.cpp | 90 +++++++ .../lock-app/cyw30739/src/ZclCallbacks.cpp | 63 +++++ examples/lock-app/cyw30739/src/main.cpp | 236 ++++++++++++++++++ examples/lock-app/cyw30739/static_config.txt | 21 ++ .../cyw30739/third_party/connectedhomeip | 1 + scripts/build/build/targets.py | 1 + scripts/build/builders/cyw30739.py | 5 + .../testdata/all_targets_except_host.txt | 1 + .../build/testdata/build_all_except_host.txt | 6 + .../glob_star_targets_except_host.txt | 1 + 23 files changed, 1197 insertions(+) create mode 100644 examples/lock-app/cyw30739/.gn create mode 100644 examples/lock-app/cyw30739/BUILD.gn create mode 100644 examples/lock-app/cyw30739/README.md create mode 100644 examples/lock-app/cyw30739/args.gni create mode 120000 examples/lock-app/cyw30739/build_overrides create mode 100644 examples/lock-app/cyw30739/include/AppShellCommands.h create mode 100644 examples/lock-app/cyw30739/include/BoltLockManager.h create mode 100644 examples/lock-app/cyw30739/include/ButtonHandler.h create mode 100644 examples/lock-app/cyw30739/include/CHIPProjectConfig.h create mode 100644 examples/lock-app/cyw30739/include/chip_lock.h create mode 100644 examples/lock-app/cyw30739/src/AppShellCommands.cpp create mode 100644 examples/lock-app/cyw30739/src/BoltLockManager.cpp create mode 100644 examples/lock-app/cyw30739/src/ButtonHandler.cpp create mode 100644 examples/lock-app/cyw30739/src/ZclCallbacks.cpp create mode 100644 examples/lock-app/cyw30739/src/main.cpp create mode 100644 examples/lock-app/cyw30739/static_config.txt create mode 120000 examples/lock-app/cyw30739/third_party/connectedhomeip diff --git a/.github/workflows/examples-cyw30739.yaml b/.github/workflows/examples-cyw30739.yaml index b9cc62b511f71a..54e39272456a28 100644 --- a/.github/workflows/examples-cyw30739.yaml +++ b/.github/workflows/examples-cyw30739.yaml @@ -73,6 +73,12 @@ jobs: cyw30739 cyw930739m2evb_01 light \ out/artifacts/cyw30739-cyw930739m2evb_01-light/chip-cyw30739-lighting-example.elf \ /tmp/bloat_reports/ + - name: Build example CYW30739 Lock App + timeout-minutes: 10 + run: | + scripts/examples/gn_build_example.sh examples/lock-app/cyw30739 out/lock_app + .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py cyw30739 CYW30739 lock-app \ + out/lock_app/chip-cyw30739-lock-example.elf /tmp/bloat_reports/ - name: Uploading Size Reports uses: actions/upload-artifact@v2 if: ${{ !env.ACT }} diff --git a/examples/lock-app/cyw30739/.gn b/examples/lock-app/cyw30739/.gn new file mode 100644 index 00000000000000..90115e4209947e --- /dev/null +++ b/examples/lock-app/cyw30739/.gn @@ -0,0 +1,28 @@ +# Copyright (c) 2020 Project CHIP Authors +# +# 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. + +import("//build_overrides/build.gni") + +# The location of the build configuration file. +buildconfig = "${build_root}/config/BUILDCONFIG.gn" + +# CHIP uses angle bracket includes. +check_system_includes = true + +default_args = { + target_cpu = "arm" + target_os = "cyw30739" + + import("//args.gni") +} diff --git a/examples/lock-app/cyw30739/BUILD.gn b/examples/lock-app/cyw30739/BUILD.gn new file mode 100644 index 00000000000000..06250c388a0fe5 --- /dev/null +++ b/examples/lock-app/cyw30739/BUILD.gn @@ -0,0 +1,68 @@ +# Copyright (c) 2020 Project CHIP Authors +# +# 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. + +import("//build_overrides/build.gni") +import("//build_overrides/chip.gni") +import("//build_overrides/cyw30739_sdk.gni") + +import("${cyw30739_sdk_build_root}/cyw30739_executable.gni") +import("${cyw30739_sdk_build_root}/cyw30739_sdk.gni") + +cyw30739_project_dir = "${chip_root}/examples/lock-app/cyw30739" + +declare_args() { + setupPinCode = 0 + setupDiscriminator = 0 +} + +cyw30739_sdk("sdk") { + sources = [ "${cyw30739_project_dir}/include/CHIPProjectConfig.h" ] + + include_dirs = [ "${cyw30739_project_dir}/include" ] + + defines = [ + "CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE=${setupPinCode}", + "CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR=${setupDiscriminator}", + ] +} + +cyw30739_executable("lock_app") { + output_name = "chip-cyw30739-lock-example.elf" + + sources = [ + "src/AppShellCommands.cpp", + "src/BoltLockManager.cpp", + "src/ButtonHandler.cpp", + "src/ZclCallbacks.cpp", + "src/main.cpp", + ] + + deps = [ + ":sdk", + "${chip_root}/examples/lock-app/lock-common", + "${chip_root}/examples/shell/shell_common:shell_common", + "${chip_root}/src/lib", + "${chip_root}/third_party/openthread/repo:libopenthread-ftd", + ] + + include_dirs = [ "include" ] +} + +group("cyw30739") { + deps = [ ":lock_app" ] +} + +group("default") { + deps = [ ":cyw30739" ] +} diff --git a/examples/lock-app/cyw30739/README.md b/examples/lock-app/cyw30739/README.md new file mode 100644 index 00000000000000..1c24ae8c57b067 --- /dev/null +++ b/examples/lock-app/cyw30739/README.md @@ -0,0 +1,104 @@ +# Matter CYW30739 Lock Example + +An example showing the use of Matter on the Infineon CYW30739 platform. + +--- + +## Table of Contents + +- [CHIP CYW30739 Lock Example](#matter-cyw30739-lock-example) + - [Introduction](#introduction) + - [Building](#building) + - [Flashing the Application](#flashing-the-application) + - [Running the Complete Example](#running-the-complete-example) + +--- + +## Introduction + +The CYW30739 lock example provides a baseline demonstration of a Light control +device, built using Matter and the Infineon Modustoolbox SDK. It can be +controlled by a Matter controller over Openthread network. + +The CYW30739 device can be commissioned over Bluetooth Low Energy where the +device and the Matter controller will exchange security information with the +Rendez-vous procedure. Thread Network credentials are then provided to the +CYW30739 device which will then join the network. + +## Building + +- Build the example application: + + ```bash + $ cd ~/connectedhomeip + $ git submodule update --init + $ ./scripts/examples/gn_build_example.sh examples/lock-app/cyw30739 out/lock-app + ``` + +- To delete generated executable, libraries and object files use: + + ```bash + $ cd ~/connectedhomeip + $ rm -rf ./out/ + ``` + +- OR use GN/Ninja directly + + ```bash + $ cd ~/connectedhomeip/examples/lock-app/cyw30739 + $ git submodule update --init + $ source third_party/connectedhomeip/scripts/activate.sh + $ gn gen out/debug + $ ninja -C out/debug + ``` + +- To delete generated executable, libraries and object files use: + + ```bash + $ cd ~/connectedhomeip/examples/lock-app/cyw30739 + $ rm -rf out/ + ``` + +## Flashing the Application + +### Enter Recovery Mode + +Put the CYW30739 in to the recovery mode before running the flash script. + +1. Press and hold the `RECOVERY` button on the board. +2. Press and hold the `RESET` button on the board. +3. Release the `RESET` button. +4. After one second, release the `RECOVERY` button. + +### Run Flash Script + +- On the command line: + + ```bash + $ cd ~/connectedhomeip/examples/lock-app/cyw30739 + $ python3 out/debug/chip-cyw30739-lock-example.flash.py + ``` + +## Running the Complete Example + +- It is assumed here that you already have an OpenThread border router + configured and running. If not see the following guide + [Openthread_border_router](https://github.com/project-chip/connectedhomeip/blob/master/docs/guides/openthread_border_router_pi.md) + for more information on how to setup a border router on a raspberryPi. + +- You can provision and control the Chip device using the python controller, + Chip tool standalone, Android or iOS app + + [Python Controller](https://github.com/project-chip/connectedhomeip/blob/master/src/controller/python/README.md) + + Here is an example with the Python controller: + + ```bash + $ chip-device-ctrl + chip-device-ctrl > connect -ble 3840 20202021 1234 + chip-device-ctrl > zcl NetworkCommissioning AddThreadNetwork 1234 0 0 operationalDataset=hex:0e080000000000000000000300000b35060004001fffe00208dead00beef00cafe0708fddead00beef000005108e11d8ea8ffaa875713699f59e8807e0030a4f70656e5468726561640102c2980410edc641eb63b100b87e90a9980959befc0c0402a0fff8 breadcrumb=0 timeoutMs=1000 + chip-device-ctrl > zcl NetworkCommissioning EnableNetwork 1234 0 0 networkID=hex:dead00beef00cafe breadcrumb=0 timeoutMs=1000 + chip-device-ctrl > close-ble + chip-device-ctrl > resolve 1234 + chip-device-ctrl > zcl OnOff Toggle 1234 1 0 + ``` diff --git a/examples/lock-app/cyw30739/args.gni b/examples/lock-app/cyw30739/args.gni new file mode 100644 index 00000000000000..149f7d42b18b5f --- /dev/null +++ b/examples/lock-app/cyw30739/args.gni @@ -0,0 +1,18 @@ +# Copyright (c) 2020 Project CHIP Authors +# +# 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. + +import("//build_overrides/chip.gni") +import("${chip_root}/src/platform/CYW30739/args.gni") + +cyw30739_sdk_target = get_label_info(":sdk", "label_no_toolchain") diff --git a/examples/lock-app/cyw30739/build_overrides b/examples/lock-app/cyw30739/build_overrides new file mode 120000 index 00000000000000..e578e73312ebd1 --- /dev/null +++ b/examples/lock-app/cyw30739/build_overrides @@ -0,0 +1 @@ +../../build_overrides \ No newline at end of file diff --git a/examples/lock-app/cyw30739/include/AppShellCommands.h b/examples/lock-app/cyw30739/include/AppShellCommands.h new file mode 100644 index 00000000000000..575d6c24a3e2d0 --- /dev/null +++ b/examples/lock-app/cyw30739/include/AppShellCommands.h @@ -0,0 +1,22 @@ +/* + * + * Copyright (c) 2021 Project CHIP Authors + * Copyright (c) 2019 Google LLC. + * 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 + +void RegisterAppShellCommands(); diff --git a/examples/lock-app/cyw30739/include/BoltLockManager.h b/examples/lock-app/cyw30739/include/BoltLockManager.h new file mode 100644 index 00000000000000..08cf1ccf0488a1 --- /dev/null +++ b/examples/lock-app/cyw30739/include/BoltLockManager.h @@ -0,0 +1,86 @@ +/* + * + * Copyright (c) 2019 Google LLC. + * 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 +#include +#include + +class BoltLockManager +{ +public: + enum Action_t + { + LOCK_ACTION = 0, + UNLOCK_ACTION, + + INVALID_ACTION + } Action; + + enum State_t + { + kState_LockingInitiated = 0, + kState_LockingCompleted, + kState_UnlockingInitiated, + kState_UnlockingCompleted, + } State; + + enum Actor_t + { + ACTOR_ZCL_CMD = 0, + ACTOR_APP_CMD, + ACTOR_BUTTON, + } Actor; + + CHIP_ERROR Init(); + bool IsUnlocked(); + void EnableAutoRelock(bool aOn); + void SetAutoLockDuration(uint32_t aDurationInSecs); + bool IsActionInProgress(); + bool InitiateAction(int32_t aActor, Action_t aAction); + + typedef void (*Callback_fn_initiated)(Action_t, int32_t aActor); + typedef void (*Callback_fn_completed)(Action_t); + void SetCallbacks(Callback_fn_initiated aActionInitiated_CB, Callback_fn_completed aActionCompleted_CB); + +private: + friend BoltLockManager & BoltLockMgr(void); + State_t mState; + + Callback_fn_initiated mActionInitiated_CB; + Callback_fn_completed mActionCompleted_CB; + + bool mAutoRelock; + uint32_t mAutoLockDuration; + bool mAutoLockTimerArmed; + + void CancelTimer(void); + void StartTimer(uint32_t aTimeoutMs); + + static void TimerEventHandler(WICED_TIMER_PARAM_TYPE cb_params); + static int AutoReLockTimerEventHandler(void * aEvent); + static int ActuatorMovementTimerEventHandler(void * aEvent); + + static BoltLockManager sLock; +}; + +inline BoltLockManager & BoltLockMgr(void) +{ + return BoltLockManager::sLock; +} diff --git a/examples/lock-app/cyw30739/include/ButtonHandler.h b/examples/lock-app/cyw30739/include/ButtonHandler.h new file mode 100644 index 00000000000000..8fbe5ab214c68f --- /dev/null +++ b/examples/lock-app/cyw30739/include/ButtonHandler.h @@ -0,0 +1,28 @@ +/* + * + * Copyright (c) 2021 Project CHIP Authors + * Copyright (c) 2019 Google LLC. + * 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 "wiced.h" + +typedef enum +{ + ON_OFF_BUTTON, + APP_MAX_BUTTON, +} application_button_t; +#define APP_MAX_BUTTON_DEF 1 // define for preprocessor + +wiced_result_t app_button_init(void); diff --git a/examples/lock-app/cyw30739/include/CHIPProjectConfig.h b/examples/lock-app/cyw30739/include/CHIPProjectConfig.h new file mode 100644 index 00000000000000..f01b8017d2919e --- /dev/null +++ b/examples/lock-app/cyw30739/include/CHIPProjectConfig.h @@ -0,0 +1,61 @@ +/* + * + * Copyright (c) 2020 Project CHIP Authors + * Copyright (c) 2019 Google LLC. + * 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 + * Example project configuration file for CHIP. + * + * This is a place to put application or project-specific overrides + * to the default configuration values for general CHIP features. + * + */ + +#pragma once + +// -------------------- Device Identification Configuration -------------------- + +/* The VendorName attribute of the Basic cluster. */ +#define CHIP_DEVICE_CONFIG_DEVICE_VENDOR_NAME "Infineon" + +/* The VendorID attribute of the Basic cluster. */ +#define CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID 0x0009 + +/* The ProductName attribute of the Basic cluster. */ +#define CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_NAME "CYW30739 Lock App" + +/* The ProductID attribute of the Basic cluster. */ +#define CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID 0x154c + +/* The HardwareVersionString attribute of the Basic cluster. */ +#define CHIP_DEVICE_CONFIG_DEFAULT_DEVICE_HARDWARE_VERSION_STRING "30739" + +/* The HardwareVersion attribute of the Basic cluster. */ +#define CHIP_DEVICE_CONFIG_DEFAULT_DEVICE_HARDWARE_VERSION 30739 + +/* The SoftwareVersionString attribute of the Basic cluster. */ +#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING "TE7.5" + +/* The SoftwareVersion attribute of the Basic cluster. */ +#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION 0x0705 + +/* The SerialNumber attribute of the Basic cluster. */ +#define CHIP_DEVICE_CONFIG_TEST_SERIAL_NUMBER "TEST_SN" + +// -------------------- Test Configuration -------------------- +#define CHIP_DEVICE_CONFIG_ENABLE_TEST_DEVICE_IDENTITY 1 diff --git a/examples/lock-app/cyw30739/include/chip_lock.h b/examples/lock-app/cyw30739/include/chip_lock.h new file mode 100644 index 00000000000000..b752e02e2fe067 --- /dev/null +++ b/examples/lock-app/cyw30739/include/chip_lock.h @@ -0,0 +1,28 @@ +/* + * + * Copyright (c) 2021 Project CHIP Authors + * Copyright (c) 2019 Google LLC. + * 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 + +// Application-defined error codes in the CHIP_ERROR space +#define APP_ERROR_INIT_TIMER_FAILED CHIP_ERROR_NO_MEMORY // should use CHIP_APPLICATION_ERROR when it's ready + +// Application configurations +#define ACTUATOR_MOVEMENT_PERIOS_MS 1000 diff --git a/examples/lock-app/cyw30739/src/AppShellCommands.cpp b/examples/lock-app/cyw30739/src/AppShellCommands.cpp new file mode 100644 index 00000000000000..e086f0189637b7 --- /dev/null +++ b/examples/lock-app/cyw30739/src/AppShellCommands.cpp @@ -0,0 +1,103 @@ +/* + * + * Copyright (c) 2021 Project CHIP Authors + * Copyright (c) 2019 Google LLC. + * 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 +#include +#include + +using namespace chip::Shell; + +static CHIP_ERROR AppCommandHelpHandler(int argc, char * argv[]); +static CHIP_ERROR AppCommandLockHandler(int argc, char * argv[]); +static CHIP_ERROR AppCommandDispatch(int argc, char * argv[]); + +static chip::Shell::Engine sAppSubcommands; + +void RegisterAppShellCommands(void) +{ + static const shell_command_t sAppSubCommands[] = { + { + .cmd_func = AppCommandHelpHandler, + .cmd_name = "help", + .cmd_help = "Usage: app ", + }, + { + .cmd_func = AppCommandLockHandler, + .cmd_name = "lock", + .cmd_help = "Usage: app lock [on|off|toggle]", + }, + }; + + static const shell_command_t sAppCommand = { + .cmd_func = AppCommandDispatch, + .cmd_name = "app", + .cmd_help = "App commands", + }; + + sAppSubcommands.RegisterCommands(sAppSubCommands, ArraySize(sAppSubCommands)); + + Engine::Root().RegisterCommands(&sAppCommand, 1); +} + +CHIP_ERROR AppCommandHelpHandler(int argc, char * argv[]) +{ + sAppSubcommands.ForEachCommand(PrintCommandHelp, nullptr); + return CHIP_NO_ERROR; +} + +CHIP_ERROR AppCommandLockHandler(int argc, char * argv[]) +{ + if (argc == 0) + { + streamer_printf(streamer_get(), "The lock is %s\n", BoltLockMgr().IsUnlocked() ? "unlocked" : "locked"); + } + else if (strcmp(argv[0], "on") == 0) + { + streamer_printf(streamer_get(), "Lock ...\n"); + BoltLockMgr().InitiateAction(BoltLockManager::ACTOR_APP_CMD, BoltLockManager::LOCK_ACTION); + } + else if (strcmp(argv[0], "off") == 0) + { + streamer_printf(streamer_get(), "Unlock ...\n"); + BoltLockMgr().InitiateAction(BoltLockManager::ACTOR_BUTTON, BoltLockManager::UNLOCK_ACTION); + } + else if (strcmp(argv[0], "toggle") == 0) + { + streamer_printf(streamer_get(), "Toggling the lock ...\n"); + if (BoltLockMgr().IsUnlocked()) + BoltLockMgr().InitiateAction(BoltLockManager::ACTOR_APP_CMD, BoltLockManager::LOCK_ACTION); + else + BoltLockMgr().InitiateAction(BoltLockManager::ACTOR_BUTTON, BoltLockManager::UNLOCK_ACTION); + } + else + { + return CHIP_ERROR_INVALID_ARGUMENT; + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR AppCommandDispatch(int argc, char * argv[]) +{ + if (argc == 0) + { + AppCommandHelpHandler(argc, argv); + return CHIP_NO_ERROR; + } + return sAppSubcommands.ExecCommand(argc, argv); +} diff --git a/examples/lock-app/cyw30739/src/BoltLockManager.cpp b/examples/lock-app/cyw30739/src/BoltLockManager.cpp new file mode 100644 index 00000000000000..7796fe64696166 --- /dev/null +++ b/examples/lock-app/cyw30739/src/BoltLockManager.cpp @@ -0,0 +1,219 @@ +/* + * + * Copyright (c) 2020 Project CHIP Authors + * Copyright (c) 2019 Google LLC. + * 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 "BoltLockManager.h" +#include "wiced_bt_event.h" + +BoltLockManager BoltLockManager::sLock; + +wiced_timer_t sLockTimer; + +CHIP_ERROR BoltLockManager::Init() +{ + wiced_result_t result; + + // Create wiced timer for lock timer. + result = wiced_init_timer(&sLockTimer, TimerEventHandler, (WICED_TIMER_PARAM_TYPE) this, WICED_MILLI_SECONDS_TIMER); + if (result != WICED_BT_SUCCESS) + { + printf("sLockTimer timer create failed"); + return APP_ERROR_INIT_TIMER_FAILED; + } + + mState = kState_UnlockingCompleted; + mAutoLockTimerArmed = false; + mAutoRelock = false; + mAutoLockDuration = 0; + + return CHIP_NO_ERROR; +} + +void BoltLockManager::SetCallbacks(Callback_fn_initiated aActionInitiated_CB, Callback_fn_completed aActionCompleted_CB) +{ + mActionInitiated_CB = aActionInitiated_CB; + mActionCompleted_CB = aActionCompleted_CB; +} + +bool BoltLockManager::IsActionInProgress() +{ + return (mState == kState_LockingInitiated || mState == kState_UnlockingInitiated); +} + +bool BoltLockManager::IsUnlocked() +{ + return (mState == kState_UnlockingCompleted); +} + +void BoltLockManager::EnableAutoRelock(bool aOn) +{ + mAutoRelock = aOn; +} + +void BoltLockManager::SetAutoLockDuration(uint32_t aDurationInSecs) +{ + mAutoLockDuration = aDurationInSecs; +} + +bool BoltLockManager::InitiateAction(int32_t aActor, Action_t aAction) +{ + bool action_initiated = false; + State_t new_state; + + // Initiate Lock/Unlock Action only when the previous one is complete. + if (mState == kState_LockingCompleted && aAction == UNLOCK_ACTION) + { + action_initiated = true; + + new_state = kState_UnlockingInitiated; + } + else if (mState == kState_UnlockingCompleted && aAction == LOCK_ACTION) + { + action_initiated = true; + + new_state = kState_LockingInitiated; + } + + if (action_initiated) + { + if (mAutoLockTimerArmed && new_state == kState_LockingInitiated) + { + // If auto lock timer has been armed and someone initiates locking, + // cancel the timer and continue as normal. + mAutoLockTimerArmed = false; + + CancelTimer(); + } + + StartTimer(ACTUATOR_MOVEMENT_PERIOS_MS); + + // Since the timer started successfully, update the state and trigger callback + mState = new_state; + + if (mActionInitiated_CB) + { + mActionInitiated_CB(aAction, aActor); + } + } + + return action_initiated; +} + +void BoltLockManager::StartTimer(uint32_t aTimeoutMs) +{ + if (wiced_is_timer_in_use(&sLockTimer)) + { + printf("app timer already started!\n"); + CancelTimer(); + } + + if (wiced_start_timer(&sLockTimer, aTimeoutMs) != WICED_BT_SUCCESS) + { + printf("sLockTimer timer start() failed\n"); + return; + } +} + +void BoltLockManager::CancelTimer(void) +{ + if (wiced_stop_timer(&sLockTimer) != WICED_BT_SUCCESS) + { + printf("Lock timer timer stop() failed\n"); + return; + } +} + +void BoltLockManager::TimerEventHandler(WICED_TIMER_PARAM_TYPE cb_params) +{ + BoltLockManager * lock = reinterpret_cast(cb_params); + int (*fn)(void *); + + // The timer event handler will be called in the context of the timer task + // once sLockTimer expires. Post an event to apptask queue with the actual handler + // so that the event can be handled in the context of the apptask. + if (lock->mAutoLockTimerArmed) + { + fn = AutoReLockTimerEventHandler; + } + else + { + fn = ActuatorMovementTimerEventHandler; + } + + if (wiced_app_event_serialize(fn, (void *) lock) != WICED_TRUE) + { + printf("wiced_app_event_serialize failed\n"); + } +} + +int BoltLockManager::AutoReLockTimerEventHandler(void * data) +{ + BoltLockManager * lock = reinterpret_cast(data); + int32_t actor = 0; + + // Make sure auto lock timer is still armed. + if (!lock->mAutoLockTimerArmed) + { + return 0; + } + + lock->mAutoLockTimerArmed = false; + + printf("Auto Re-Lock has been triggered!\n"); + + lock->InitiateAction(actor, LOCK_ACTION); + + return 0; +} + +int BoltLockManager::ActuatorMovementTimerEventHandler(void * data) +{ + BoltLockManager * lock = reinterpret_cast(data); + Action_t actionCompleted = INVALID_ACTION; + + if (lock->mState == kState_LockingInitiated) + { + lock->mState = kState_LockingCompleted; + actionCompleted = LOCK_ACTION; + } + else if (lock->mState == kState_UnlockingInitiated) + { + lock->mState = kState_UnlockingCompleted; + actionCompleted = UNLOCK_ACTION; + } + + if (actionCompleted != INVALID_ACTION) + { + if (lock->mActionCompleted_CB) + { + lock->mActionCompleted_CB(actionCompleted); + } + + if (lock->mAutoRelock && actionCompleted == UNLOCK_ACTION) + { + // Start the timer for auto relock + lock->StartTimer(lock->mAutoLockDuration * 1000); + + lock->mAutoLockTimerArmed = true; + + printf("Auto Re-lock enabled. Will be triggered in %lu seconds\n", lock->mAutoLockDuration); + } + } + + return 0; +} diff --git a/examples/lock-app/cyw30739/src/ButtonHandler.cpp b/examples/lock-app/cyw30739/src/ButtonHandler.cpp new file mode 100644 index 00000000000000..47c37a7c2c65db --- /dev/null +++ b/examples/lock-app/cyw30739/src/ButtonHandler.cpp @@ -0,0 +1,90 @@ +/* + * + * Copyright (c) 2021 Project CHIP Authors + * Copyright (c) 2019 Google LLC. + * Copyright 2021, Cypress Semiconductor Corporation (an Infineon company) + * 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 +#include +#include +#include +#include +#include + +/****************************************************** + * Macros + ******************************************************/ +void app_button_event_handler(const button_manager_button_t * button, button_manager_event_t event, + button_manager_button_state_t state); + +static wiced_button_manager_configuration_t app_button_manager_configuration = { + .short_hold_duration = 500, /*msec*/ + .medium_hold_duration = 700, + .long_hold_duration = 1500, + .very_long_hold_duration = 2500, + .debounce_duration = 150, /* typically a click takes around ~150-200 ms */ + .double_click_interval = 250, + .continuous_hold_detect = WICED_TRUE, + .event_handler = app_button_event_handler, +}; + +/* Static button configuration */ +static wiced_button_configuration_t app_button_configurations[APP_MAX_BUTTON_DEF]; +/* Button objects for the button manager */ +static button_manager_button_t app_buttons[APP_MAX_BUTTON_DEF]; +static button_manager_t app_button_manager; + +wiced_result_t app_button_init(void) +{ + wiced_result_t result = WICED_ERROR; + + memset(app_button_configurations, 0, (sizeof(wiced_button_configuration_t) * APP_MAX_BUTTON_DEF)); + memset(app_buttons, 0, (sizeof(button_manager_button_t) * APP_MAX_BUTTON_DEF)); + + app_button_configurations[ON_OFF_BUTTON].button = PLATFORM_BUTTON_1; + app_button_configurations[ON_OFF_BUTTON].button_event_mask = BUTTON_CLICK_EVENT; + app_buttons[ON_OFF_BUTTON].configuration = &app_button_configurations[ON_OFF_BUTTON]; + + result = wiced_button_manager_init(&app_button_manager, &app_button_manager_configuration, app_buttons, 1); + + if (result != WICED_SUCCESS) + { + printf("button_manager_init failed (%d)\n", result); + } + return result; +} + +void app_button_event_handler(const button_manager_button_t * button_mgr, button_manager_event_t event, + button_manager_button_state_t state) +{ + // printf("app_button_event_handler. button=%d, event=%d, state=%d\n", button_mgr[ON_OFF_BUTTON].configuration->button, event, + // state); + + if (button_mgr[0].configuration->button == PLATFORM_BUTTON_1 && event == BUTTON_CLICK_EVENT && state == BUTTON_STATE_RELEASED) + { + if (BoltLockMgr().IsUnlocked()) + { + printf("Button Toggle:Lock\n"); + BoltLockMgr().InitiateAction(BoltLockManager::ACTOR_BUTTON, BoltLockManager::LOCK_ACTION); + } + else + { + printf("Button Toggle:Unlock\n"); + BoltLockMgr().InitiateAction(BoltLockManager::ACTOR_BUTTON, BoltLockManager::UNLOCK_ACTION); + } + } +} diff --git a/examples/lock-app/cyw30739/src/ZclCallbacks.cpp b/examples/lock-app/cyw30739/src/ZclCallbacks.cpp new file mode 100644 index 00000000000000..f258cfb718fd2e --- /dev/null +++ b/examples/lock-app/cyw30739/src/ZclCallbacks.cpp @@ -0,0 +1,63 @@ +/* + * + * Copyright (c) 2021 Project CHIP Authors + * Copyright (c) 2019 Google LLC. + * 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 +#include +#include + +using namespace chip; +using namespace chip::app::Clusters; +using namespace chip::DeviceLayer; + +void emberAfBasicClusterInitCallback(EndpointId endpoint) +{ + uint16_t year; + uint8_t month; + uint8_t dayOfMonth; + char cString[16] = "00000000"; + + if (ConfigurationMgr().GetManufacturingDate(year, month, dayOfMonth) == CHIP_NO_ERROR) + { + snprintf(cString, sizeof(cString), "%04u%02u%02u", year, month, dayOfMonth); + } + Basic::Attributes::ManufacturingDate::Set(endpoint, CharSpan(cString)); +} + +void MatterPostAttributeChangeCallback(const app::ConcreteAttributePath & attributePath, uint8_t mask, uint8_t type, uint16_t size, + uint8_t * value) + +{ + switch (attributePath.mClusterId) + { + case OnOff::Id: + if (attributePath.mAttributeId == OnOff::Attributes::OnOff::Id) + { + printf("ZCL OnOff -> %u\n", *value); + BoltLockMgr().InitiateAction(BoltLockManager::ACTOR_ZCL_CMD, + (*value) ? BoltLockManager::LOCK_ACTION : BoltLockManager::UNLOCK_ACTION); + return; + } + break; + default: + printf("Unhandled cluster ID: 0x%04lx\n", attributePath.mClusterId); + return; + } + + printf("ERROR clusterId: 0x%04lx, unknown attribute ID: 0x%04lx\n", attributePath.mClusterId, attributePath.mAttributeId); +} diff --git a/examples/lock-app/cyw30739/src/main.cpp b/examples/lock-app/cyw30739/src/main.cpp new file mode 100644 index 00000000000000..ccd12f86dfb329 --- /dev/null +++ b/examples/lock-app/cyw30739/src/main.cpp @@ -0,0 +1,236 @@ +/* + * + * Copyright (c) 2021 Project CHIP Authors + * Copyright (c) 2019 Google LLC. + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace ::chip::Credentials; +using namespace ::chip::DeviceLayer; +using namespace ::chip::Shell; + +wiced_bool_t syncClusterToButtonAction = false; + +static void EventHandler(const ChipDeviceEvent * event, intptr_t arg); +static void HandleThreadStateChangeEvent(const ChipDeviceEvent * event); +static void ActionInitiated(BoltLockManager::Action_t aAction, int32_t aActor); +static void ActionCompleted(BoltLockManager::Action_t aAction); +static void WriteClusterState(uint8_t value); + +#ifndef _countof +#define _countof(a) (sizeof(a) / sizeof(a[0])) +#endif + +static wiced_led_config_t chip_lighting_led_config[2] = { + { + .led = PLATFORM_LED_1, + .bright = 50, + }, + { + .led = PLATFORM_LED_2, + .bright = 50, + }, +}; + +APPLICATION_START() +{ + CHIP_ERROR err; + wiced_result_t result; + uint32_t i; + + printf("\nChipLock App starting\n"); + + mbedtls_platform_set_calloc_free(CHIPPlatformMemoryCalloc, CHIPPlatformMemoryFree); + + err = chip::Platform::MemoryInit(); + if (err != CHIP_NO_ERROR) + { + printf("ERROR MemoryInit %ld\n", err.AsInteger()); + } + + result = app_button_init(); + if (result != WICED_SUCCESS) + { + printf("ERROR app_button_init %d\n", result); + } + + /* Init. LED Manager. */ + for (i = 0; i < _countof(chip_lighting_led_config); i++) + { + result = wiced_led_manager_init(&chip_lighting_led_config[i]); + if (result != WICED_SUCCESS) + printf("wiced_led_manager_init fail i=%ld, (%d)\n", i, result); + } + + printf("Initializing CHIP\n"); + err = PlatformMgr().InitChipStack(); + if (err != CHIP_NO_ERROR) + { + printf("ERROR InitChipStack %ld\n", err.AsInteger()); + } + +#if CHIP_DEVICE_CONFIG_ENABLE_THREAD + printf("Initializing OpenThread stack\n"); + err = ThreadStackMgr().InitThreadStack(); + if (err != CHIP_NO_ERROR) + { + printf("ERROR InitThreadStack %ld\n", err.AsInteger()); + } +#endif + + err = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_Router); + if (err != CHIP_NO_ERROR) + { + printf("ERROR SetThreadDeviceType %ld\n", err.AsInteger()); + } + + printf("Starting event loop task\n"); + err = PlatformMgr().StartEventLoopTask(); + if (err != CHIP_NO_ERROR) + { + printf("ERROR StartEventLoopTask %ld\n", err.AsInteger()); + } + +#if CHIP_DEVICE_CONFIG_ENABLE_THREAD + printf("Starting thread task\n"); + err = ThreadStackMgr().StartThreadTask(); + if (err != CHIP_NO_ERROR) + { + printf("ERROR StartThreadTask %ld\n", err.AsInteger()); + } +#endif + + PlatformMgrImpl().AddEventHandler(EventHandler, 0); + + /* Start CHIP datamodel server */ + chip::Server::GetInstance().Init(); + + SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider()); + + err = BoltLockMgr().Init(); + if (err != CHIP_NO_ERROR) + { + printf("BoltLockMgr().Init() failed\n"); + } + + BoltLockMgr().SetCallbacks(ActionInitiated, ActionCompleted); + + ConfigurationMgr().LogDeviceConfig(); + + const int ret = streamer_init(streamer_get()); + if (!chip::ChipError::IsSuccess(ret)) + { + printf("ERROR streamer_init %d\n", ret); + } + cmd_ping_init(); + RegisterAppShellCommands(); + Engine::Root().RunMainLoop(); + + assert(!wiced_rtos_check_for_stack_overflow()); +} + +void EventHandler(const ChipDeviceEvent * event, intptr_t arg) +{ + switch (event->Type) + { + case DeviceEventType::kThreadStateChange: + HandleThreadStateChangeEvent(event); + break; + default: + break; + } +} + +void HandleThreadStateChangeEvent(const ChipDeviceEvent * event) +{ +#if CHIP_BYPASS_RENDEZVOUS + if (event->ThreadStateChange.NetDataChanged && !ConnectivityMgr().IsThreadProvisioned()) + { + ThreadStackMgr().JoinerStart(); + } +#endif /* CHIP_BYPASS_RENDEZVOUS */ +} + +void ActionInitiated(BoltLockManager::Action_t aAction, int32_t aActor) +{ + // If the action has been initiated by the lock, update the bolt lock trait + // and start flashing the LEDs rapidly to indicate action initiation. + if (aAction == BoltLockManager::LOCK_ACTION) + { + printf("Lock Action has been initiated\n"); + } + else if (aAction == BoltLockManager::UNLOCK_ACTION) + { + printf("Unlock Action has been initiated\n"); + } + + if (aActor == BoltLockManager::ACTOR_BUTTON) + { + syncClusterToButtonAction = true; + } + + wiced_led_manager_enable_led(PLATFORM_LED_2); +} + +void ActionCompleted(BoltLockManager::Action_t aAction) +{ + // if the action has been completed by the lock, update the bolt lock trait. + // Turn on the lock LED if in a LOCKED state OR + // Turn off the lock LED if in an UNLOCKED state. + if (aAction == BoltLockManager::LOCK_ACTION) + { + printf("Lock Action has been completed\n"); + wiced_led_manager_enable_led(PLATFORM_LED_1); + } + else if (aAction == BoltLockManager::UNLOCK_ACTION) + { + printf("Unlock Action has been completed\n"); + wiced_led_manager_disable_led(PLATFORM_LED_1); + } + + if (syncClusterToButtonAction) + { + WriteClusterState(!BoltLockMgr().IsUnlocked()); + syncClusterToButtonAction = false; + } + + wiced_led_manager_disable_led(PLATFORM_LED_2); +} + +void WriteClusterState(uint8_t value) +{ + const EmberAfStatus status = chip::app::Clusters::OnOff::Attributes::OnOff::Set(1, value); + if (status != EMBER_ZCL_STATUS_SUCCESS) + { + printf("Error WriteServerAttribute 0x%02x\n", status); + } +} diff --git a/examples/lock-app/cyw30739/static_config.txt b/examples/lock-app/cyw30739/static_config.txt new file mode 100644 index 00000000000000..f256ac94aa5abf --- /dev/null +++ b/examples/lock-app/cyw30739/static_config.txt @@ -0,0 +1,21 @@ +# The post-building script uses this file to generate specified static configurations. +# All '#' prefixed lines are ignored by the script. +# Each line defines a static configuration by 3 fields separated by commas. +# +# The 1st field is a 16-bit ID from 0x2000 to 0x3ffff. +# All IDs in this file have to be different. +# +# The 2nd field is a type to which the script interprets the value according. +# +# The 3rd field is a value of the static configuration. The value format depends on what the value type is: +# - hex: Multiple hexadecimal values separated by commas. +# - uint32/uint16/uint8/int16/int8: A integer. +# - eui64: random or btext. If the value is btext, the configuration will be generated from the BT address. +# +# ID, type, value +# EUI64 +0x2000, eui64, random +# Setup Pin Code +0x2105, uint32, 20202021 +# Setup Discriminator +0x2107, uint32, 3840 diff --git a/examples/lock-app/cyw30739/third_party/connectedhomeip b/examples/lock-app/cyw30739/third_party/connectedhomeip new file mode 120000 index 00000000000000..c866b86874994d --- /dev/null +++ b/examples/lock-app/cyw30739/third_party/connectedhomeip @@ -0,0 +1 @@ +../../../.. \ No newline at end of file diff --git a/scripts/build/build/targets.py b/scripts/build/build/targets.py index 8c5f849ceb3b1e..6cbea9b3764a79 100644 --- a/scripts/build/build/targets.py +++ b/scripts/build/build/targets.py @@ -366,6 +366,7 @@ def K32WTargets(): def Cyw30739Targets(): yield Target('cyw30739-cyw930739m2evb_01-light', Cyw30739Builder, board=Cyw30739Board.CYW930739M2EVB_01, app=Cyw30739App.LIGHT) + yield Target('cyw30739-cyw930739m2evb_01-lock', Cyw30739Builder, board=Cyw30739Board.CYW930739M2EVB_01, app=Cyw30739App.LOCK) ALL = [] diff --git a/scripts/build/builders/cyw30739.py b/scripts/build/builders/cyw30739.py index 9ba608e1e2ad00..9716540453de93 100644 --- a/scripts/build/builders/cyw30739.py +++ b/scripts/build/builders/cyw30739.py @@ -20,16 +20,21 @@ class Cyw30739App(Enum): LIGHT = auto() + LOCK = auto() def ExampleName(self): if self == Cyw30739App.LIGHT: return "lighting-app" + elif self == Cyw30739App.LOCK: + return "lock-app" else: raise Exception("Unknown app type: %r" % self) def AppNamePrefix(self): if self == Cyw30739App.LIGHT: return "chip-cyw30739-lighting-example" + elif self == Cyw30739App.LOCK: + return "chip-cyw30739-lock-example" else: raise Exception("Unknown app type: %r" % self) diff --git a/scripts/build/testdata/all_targets_except_host.txt b/scripts/build/testdata/all_targets_except_host.txt index 5b7771dce16202..00567e44bb7e1a 100644 --- a/scripts/build/testdata/all_targets_except_host.txt +++ b/scripts/build/testdata/all_targets_except_host.txt @@ -15,6 +15,7 @@ android-arm64-chip-tvserver android-x64-chip-tool android-x86-chip-tool cyw30739-cyw930739m2evb_01-light +cyw30739-cyw930739m2evb_01-lock efr32-brd4161a-light efr32-brd4161a-light-rpc efr32-brd4161a-lock diff --git a/scripts/build/testdata/build_all_except_host.txt b/scripts/build/testdata/build_all_except_host.txt index f716cb000a32da..3b6e7cd0091e8c 100644 --- a/scripts/build/testdata/build_all_except_host.txt +++ b/scripts/build/testdata/build_all_except_host.txt @@ -169,6 +169,9 @@ bash -c 'yes | TEST_ANDROID_HOME/tools/bin/sdkmanager --licenses >/dev/null' # Generating cyw30739-cyw930739m2evb_01-light gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lighting-app/cyw30739 {out}/cyw30739-cyw930739m2evb_01-light +# Generating cyw30739-cyw930739m2evb_01-lock +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lock-app/cyw30739 {out}/cyw30739-cyw930739m2evb_01-lock + # Generating efr32-brd4161a-light gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lighting-app/efr32 '--args=efr32_board="BRD4161A"' {out}/efr32-brd4161a-light @@ -874,6 +877,9 @@ cp {out}/android-x86-chip-tool/lib/src/platform/android/AndroidPlatform.jar {roo # Building cyw30739-cyw930739m2evb_01-light ninja -C {out}/cyw30739-cyw930739m2evb_01-light +# Building cyw30739-cyw930739m2evb_01-lock +ninja -C {out}/cyw30739-cyw930739m2evb_01-lock + # Building efr32-brd4161a-light ninja -C {out}/efr32-brd4161a-light diff --git a/scripts/build/testdata/glob_star_targets_except_host.txt b/scripts/build/testdata/glob_star_targets_except_host.txt index ae829e6fd84b51..24d45175162476 100644 --- a/scripts/build/testdata/glob_star_targets_except_host.txt +++ b/scripts/build/testdata/glob_star_targets_except_host.txt @@ -15,6 +15,7 @@ android-arm64-chip-tvserver android-x64-chip-tool android-x86-chip-tool cyw30739-cyw930739m2evb_01-light +cyw30739-cyw930739m2evb_01-lock efr32-brd4161a-light efr32-brd4161a-light-rpc efr32-brd4161a-lock