From 315cef526fee8b616064001ad44955d9802b8480 Mon Sep 17 00:00:00 2001 From: abiradarti Date: Tue, 2 Apr 2024 18:52:14 -0500 Subject: [PATCH 1/9] ICD support for TI CC13x4 --- docs/guides/ti/enabling_icd_on_ti_devices.md | 43 +++ .../all-clusters-app/cc13x4_26x4/BUILD.gn | 8 +- .../all-clusters-app/cc13x4_26x4/args.gni | 8 + .../all-clusters-app/cc13x4_26x4/chip.syscfg | 2 - .../cc13x4_26x4/main/AppTask.cpp | 160 ++++++----- .../cc13x4_26x4/main/include/AppTask.h | 1 + .../cc13x4_26x4/main/main.cpp | 8 - examples/lighting-app/cc13x4_26x4/BUILD.gn | 11 +- examples/lighting-app/cc13x4_26x4/args.gni | 17 +- examples/lighting-app/cc13x4_26x4/chip.syscfg | 2 - .../lighting-app/cc13x4_26x4/src/AppTask.cpp | 264 +++++++++++------- .../lighting-app/cc13x4_26x4/src/AppTask.h | 1 + .../lighting-app/cc13x4_26x4/src/main.cpp | 8 - examples/lock-app/cc13x4_26x4/BUILD.gn | 15 +- examples/lock-app/cc13x4_26x4/args.gni | 8 + examples/lock-app/cc13x4_26x4/chip.syscfg | 2 - examples/lock-app/cc13x4_26x4/src/AppTask.cpp | 257 ++++++++++------- examples/lock-app/cc13x4_26x4/src/AppTask.h | 2 +- examples/lock-app/cc13x4_26x4/src/main.cpp | 7 - examples/pump-app/cc13x4_26x4/BUILD.gn | 8 +- examples/pump-app/cc13x4_26x4/args.gni | 8 + examples/pump-app/cc13x4_26x4/chip.syscfg | 2 - .../pump-app/cc13x4_26x4/main/AppTask.cpp | 174 +++++++----- .../cc13x4_26x4/main/include/AppTask.h | 1 + examples/pump-app/cc13x4_26x4/main/main.cpp | 8 - .../pump-controller-app/cc13x4_26x4/BUILD.gn | 7 +- .../pump-controller-app/cc13x4_26x4/args.gni | 8 + .../cc13x4_26x4/chip.syscfg | 4 +- .../cc13x4_26x4/main/AppTask.cpp | 193 ++++++++----- .../cc13x4_26x4/main/include/AppTask.h | 1 + .../cc13x4_26x4/main/main.cpp | 8 - examples/shell/cc13x4_26x4/BUILD.gn | 8 +- examples/shell/cc13x4_26x4/args.gni | 8 + examples/shell/cc13x4_26x4/chip.syscfg | 2 - examples/shell/cc13x4_26x4/main/main.cpp | 8 - src/platform/cc13xx_26xx/BLEManagerImpl.cpp | 4 +- .../cc13xx_26xx/cc13x4_26x4/BLEManagerImpl.h | 2 +- .../cc13x4_26x4/CHIPPlatformConfig.h | 11 +- .../cc13xx_26xx/cc13x4_26x4/ble_user_config.c | 2 +- src/platform/cc13xx_26xx/chipOBleProfile.c | 2 +- third_party/ti_simplelink_sdk/BUILD.gn | 12 +- .../ti_simplelink_sdk/repo_cc13xx_cc26xx | 2 +- .../ti_simplelink_sdk/run_sdk_drivers_gen.py | 16 +- .../ti_simplelink_sdk/ti_simplelink_board.gni | 5 + .../ti_simplelink_executable.gni | 47 ++-- .../ti_simplelink_sdk/ti_simplelink_sdk.gni | 126 +++++++-- 46 files changed, 923 insertions(+), 578 deletions(-) create mode 100644 docs/guides/ti/enabling_icd_on_ti_devices.md diff --git a/docs/guides/ti/enabling_icd_on_ti_devices.md b/docs/guides/ti/enabling_icd_on_ti_devices.md new file mode 100644 index 00000000000000..c09f57435f1482 --- /dev/null +++ b/docs/guides/ti/enabling_icd_on_ti_devices.md @@ -0,0 +1,43 @@ +# Configuring Intermittently Connected Devices on TI CC13x4 Platforms + +## Overview + +Intermittently Connected Devices are devices in a network that do not always need to be active. Matter has defined a cluster that helps capture this behavior; this configuration is ideal for devices that need to operate with low power consumption or do not have a need to always be on the network. Matter examples on the TI CC13x4 platform can be configured to act as ICDs. + +## Platform Code Changes +To configure a TI example as an ICD, open up the `args.gni` file of the example and set the following parameter to true: + +``` +chip_enable_icd_server = true +``` + +TI examples have only been tested with the ICD Server configuration. To enable the client configuration, set `chip_enable_icd_client` to true. + +Persistent subscriptions allow devices to attempt resuming existing subscriptions following a device reset. To enable persistent subscriptions, set the following parameter to true: + +``` +chip_persist_subscriptions = true +``` + +Subscription timeout resumption allows devices to attempt re-establishing subscriptions that may have expired. This feature is disabled out of box. + +In addition, various ICD parameters such as idle/active mode durations, active mode threshold, and polling intervals can be configured in `src/platform/cc13xx_26xx/cc13x4_26x4/CHIPPlatformConfig.h` + +``` +#define CHIP_CONFIG_ICD_ACTIVE_MODE_DURATION_MS 1000 +#define CHIP_CONFIG_ICD_ACTIVE_MODE_THRESHOLD_MS 500 +#define CHIP_CONFIG_ICD_IDLE_MODE_DURATION_SEC 300 +#define CHIP_DEVICE_CONFIG_ICD_SLOW_POLL_INTERVAL chip::System::Clock::Milliseconds32(5000) +#define CHIP_DEVICE_CONFIG_ICD_FAST_POLL_INTERVAL chip::System::Clock::Milliseconds32(100) +``` + +## ZAP File Changes + +Open up the ZAP file (in `examples//-common`) for the example being configured as an ICD. Add the ICD Management Cluster for Endpoint 0. + +Open up the .matter file (in `examples//-common`) corresponding to the example and add in the ICDManagement cluster. + +In addition, each endpoint has a list of clusters that it supports. Add the ICDManagement cluster to this list. + +The lock-app example's .matter file can be used as a reference. These additions allow the ICDManagement cluster's callbacks to be accessed. + diff --git a/examples/all-clusters-app/cc13x4_26x4/BUILD.gn b/examples/all-clusters-app/cc13x4_26x4/BUILD.gn index eb118372b7bd33..c68d1a70e0daa0 100644 --- a/examples/all-clusters-app/cc13x4_26x4/BUILD.gn +++ b/examples/all-clusters-app/cc13x4_26x4/BUILD.gn @@ -67,9 +67,7 @@ ti_sysconfig("sysconfig") { cflags = [ "-Wno-comment", - "@" + rebase_path("${target_gen_dir}/sysconfig/ti_ble_app_config.opt", - root_build_dir), - "@" + rebase_path("${target_gen_dir}/sysconfig/ti_build_config.opt", + "@" + rebase_path("${target_gen_dir}/sysconfig/ti_utils_build_compiler.opt", root_build_dir), ] } @@ -121,6 +119,10 @@ ti_simplelink_executable("all-clusters-app") { defines = [ "CC13XX_26XX_FACTORY_DATA" ] } + if(chip_enable_icd_server){ + defines += ["CHIP_DEVICE_CONFIG_ENABLE_SED", "TI_ICD_ENABLE_SERVER"] + } + include_dirs = [ "${project_dir}", "${project_dir}/main", diff --git a/examples/all-clusters-app/cc13x4_26x4/args.gni b/examples/all-clusters-app/cc13x4_26x4/args.gni index 35d9666f3ed07c..f6d58510052473 100644 --- a/examples/all-clusters-app/cc13x4_26x4/args.gni +++ b/examples/all-clusters-app/cc13x4_26x4/args.gni @@ -13,6 +13,7 @@ # limitations under the License. import("//build_overrides/chip.gni") +import("//build_overrides/freertos.gni") import("${chip_root}/config/standalone/args.gni") import("${chip_root}/examples/platform/cc13x4_26x4/args.gni") @@ -52,3 +53,10 @@ matter_software_ver = "0x0001" matter_software_ver_str = "1.0.1+1" custom_factory_data = true + +# ICD Default configurations +chip_enable_icd_server = false +chip_persist_subscriptions = false +chip_subscription_timeout_resumption = false + +freertos_root = "//third_party/connectedhomeip/third_party/ti_simplelink_sdk/repo_cc13xx_cc26xx/source/third_party/freertos" diff --git a/examples/all-clusters-app/cc13x4_26x4/chip.syscfg b/examples/all-clusters-app/cc13x4_26x4/chip.syscfg index 0257d3ed152e5e..e4ae2b6acfbbd2 100644 --- a/examples/all-clusters-app/cc13x4_26x4/chip.syscfg +++ b/examples/all-clusters-app/cc13x4_26x4/chip.syscfg @@ -168,14 +168,12 @@ LED1.$name = "CONFIG_LED_RED"; LED1.$hardware = system.deviceData.board.components.LED_RED; LED1.gpioPin.$name = "CONFIG_GPIO_RLED"; LED1.gpioPin.mode = "Output"; -LED1.gpioPin.callbackFunction = ""; /* Green LED */ LED2.$name = "CONFIG_LED_GREEN"; LED2.$hardware = system.deviceData.board.components.LED_GREEN; LED2.gpioPin.$name = "CONFIG_GPIO_GLED"; LED2.gpioPin.mode = "Output"; -LED2.gpioPin.callbackFunction = ""; /* Debug UART */ UART2.$hardware = system.deviceData.board.components.XDS110UART; diff --git a/examples/all-clusters-app/cc13x4_26x4/main/AppTask.cpp b/examples/all-clusters-app/cc13x4_26x4/main/AppTask.cpp index f82436346fc241..56bbf68c86ec12 100644 --- a/examples/all-clusters-app/cc13x4_26x4/main/AppTask.cpp +++ b/examples/all-clusters-app/cc13x4_26x4/main/AppTask.cpp @@ -55,6 +55,13 @@ #define APP_TASK_PRIORITY 4 #define APP_EVENT_QUEUE_SIZE 10 +#if (CHIP_CONFIG_ENABLE_ICD_SERVER == 1) +#define LED_ENABLE 0 +#else +#define LED_ENABLE 1 +#endif +#define BUTTON_ENABLE 1 + using namespace ::chip; using namespace ::chip::Credentials; using namespace ::chip::DeviceLayer; @@ -164,38 +171,9 @@ int AppTask::StartAppTask() int AppTask::Init() { - LED_Params ledParams; - Button_Params buttonParams; - cc13xx_26xxLogInit(); - // Initialize LEDs - PLAT_LOG("Initialize LEDs"); - LED_init(); - - LED_Params_init(&ledParams); // default PWM LED - sAppRedHandle = LED_open(CONFIG_LED_RED, &ledParams); - LED_setOff(sAppRedHandle); - - LED_Params_init(&ledParams); // default PWM LED - sAppGreenHandle = LED_open(CONFIG_LED_GREEN, &ledParams); - LED_setOff(sAppGreenHandle); - - // Initialize buttons - PLAT_LOG("Initialize buttons"); - Button_init(); - - Button_Params_init(&buttonParams); - buttonParams.buttonEventMask = Button_EV_CLICKED | Button_EV_LONGCLICKED; - buttonParams.longPressDuration = 1000U; // ms - sAppLeftHandle = Button_open(CONFIG_BTN_LEFT, &buttonParams); - Button_setCallback(sAppLeftHandle, ButtonLeftEventHandler); - - Button_Params_init(&buttonParams); - buttonParams.buttonEventMask = Button_EV_CLICKED | Button_EV_LONGCLICKED; - buttonParams.longPressDuration = 1000U; // ms - sAppRightHandle = Button_open(CONFIG_BTN_RIGHT, &buttonParams); - Button_setCallback(sAppRightHandle, ButtonRightEventHandler); + uiInit(); // Init Chip memory management before the stack Platform::MemoryInit(); @@ -218,7 +196,7 @@ int AppTask::Init() #if CHIP_DEVICE_CONFIG_THREAD_FTD ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_Router); -#elif CONFIG_OPENTHREAD_MTD_SED +#elif CHIP_DEVICE_CONFIG_ENABLE_SED ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_SleepyEndDevice); #else ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_MinimalEndDevice); @@ -312,45 +290,7 @@ void AppTask::PostEvent(const AppEvent * aEvent) } } -void AppTask::ButtonLeftEventHandler(Button_Handle handle, Button_EventMask events) -{ - AppEvent event; - event.Type = AppEvent::kEventType_ButtonLeft; - if (events & Button_EV_CLICKED) - { - event.ButtonEvent.Type = AppEvent::kAppEventButtonType_Clicked; - } - else if (events & Button_EV_LONGCLICKED) - { - event.ButtonEvent.Type = AppEvent::kAppEventButtonType_LongClicked; - } - // button callbacks are in ISR context - if (xQueueSendFromISR(sAppEventQueue, &event, NULL) != pdPASS) - { - /* Failed to post the message */ - } -} - -void AppTask::ButtonRightEventHandler(Button_Handle handle, Button_EventMask events) -{ - AppEvent event; - event.Type = AppEvent::kEventType_ButtonRight; - - if (events & Button_EV_CLICKED) - { - event.ButtonEvent.Type = AppEvent::kAppEventButtonType_Clicked; - } - else if (events & Button_EV_LONGCLICKED) - { - event.ButtonEvent.Type = AppEvent::kAppEventButtonType_LongClicked; - } - // button callbacks are in ISR context - if (xQueueSendFromISR(sAppEventQueue, &event, NULL) != pdPASS) - { - /* Failed to post the message */ - } -} void AppTask::DispatchEvent(AppEvent * aEvent) { @@ -405,3 +345,85 @@ void AppTask::DispatchEvent(AppEvent * aEvent) break; } } + +#ifdef BUTTON_ENABLE +void AppTask::ButtonLeftEventHandler(Button_Handle handle, Button_EventMask events) +{ + AppEvent event; + event.Type = AppEvent::kEventType_ButtonLeft; + + if (events & Button_EV_CLICKED) + { + event.ButtonEvent.Type = AppEvent::kAppEventButtonType_Clicked; + } + else if (events & Button_EV_LONGCLICKED) + { + event.ButtonEvent.Type = AppEvent::kAppEventButtonType_LongClicked; + } + // button callbacks are in ISR context + if (xQueueSendFromISR(sAppEventQueue, &event, NULL) != pdPASS) + { + /* Failed to post the message */ + } +} + +void AppTask::ButtonRightEventHandler(Button_Handle handle, Button_EventMask events) +{ + AppEvent event; + event.Type = AppEvent::kEventType_ButtonRight; + + if (events & Button_EV_CLICKED) + { + event.ButtonEvent.Type = AppEvent::kAppEventButtonType_Clicked; + } + else if (events & Button_EV_LONGCLICKED) + { + event.ButtonEvent.Type = AppEvent::kAppEventButtonType_LongClicked; + } + // button callbacks are in ISR context + if (xQueueSendFromISR(sAppEventQueue, &event, NULL) != pdPASS) + { + /* Failed to post the message */ + } +} +#endif // BUTTON_ENABLE + +void AppTask::uiInit(void) +{ + #ifdef LED_ENABLE + + LED_Params ledParams; + + // Initialize LEDs + PLAT_LOG("Initialize LEDs"); + LED_init(); + + LED_Params_init(&ledParams); // default PWM LED + sAppRedHandle = LED_open(CONFIG_LED_RED, &ledParams); + LED_setOff(sAppRedHandle); + + LED_Params_init(&ledParams); // default PWM LED + sAppGreenHandle = LED_open(CONFIG_LED_GREEN, &ledParams); + LED_setOff(sAppGreenHandle); +#endif //LED ENABLE + +#ifdef BUTTON_ENABLE + Button_Params buttonParams; + + // Initialize buttons + PLAT_LOG("Initialize buttons"); + Button_init(); + + Button_Params_init(&buttonParams); + buttonParams.buttonEventMask = Button_EV_CLICKED | Button_EV_LONGCLICKED; + buttonParams.longPressDuration = 1000U; // ms + sAppLeftHandle = Button_open(CONFIG_BTN_LEFT, &buttonParams); + Button_setCallback(sAppLeftHandle, ButtonLeftEventHandler); + + Button_Params_init(&buttonParams); + buttonParams.buttonEventMask = Button_EV_CLICKED | Button_EV_LONGCLICKED; + buttonParams.longPressDuration = 1000U; // ms + sAppRightHandle = Button_open(CONFIG_BTN_RIGHT, &buttonParams); + Button_setCallback(sAppRightHandle, ButtonRightEventHandler); +#endif //BUTTON ENABLE +} \ No newline at end of file diff --git a/examples/all-clusters-app/cc13x4_26x4/main/include/AppTask.h b/examples/all-clusters-app/cc13x4_26x4/main/include/AppTask.h index 6ab8ca425ddbdf..55297d715d95ca 100644 --- a/examples/all-clusters-app/cc13x4_26x4/main/include/AppTask.h +++ b/examples/all-clusters-app/cc13x4_26x4/main/include/AppTask.h @@ -48,6 +48,7 @@ class AppTask int Init(); void DispatchEvent(AppEvent * event); + void uiInit(); static void ButtonLeftEventHandler(Button_Handle handle, Button_EventMask events); static void ButtonRightEventHandler(Button_Handle handle, Button_EventMask events); diff --git a/examples/all-clusters-app/cc13x4_26x4/main/main.cpp b/examples/all-clusters-app/cc13x4_26x4/main/main.cpp index 5a7f6a6b8df072..8162d893d5c198 100644 --- a/examples/all-clusters-app/cc13x4_26x4/main/main.cpp +++ b/examples/all-clusters-app/cc13x4_26x4/main/main.cpp @@ -48,14 +48,6 @@ uint32_t heapSize = TOTAL_ICALL_HEAP_SIZE; // ================================================================================ // FreeRTOS Callbacks // ================================================================================ -extern "C" void vApplicationStackOverflowHook(void) -{ - while (1) - { - ; - } -} - /* Wrapper functions for using the queue registry regardless of whether it is enabled or disabled */ extern "C" void vQueueAddToRegistryWrapper(QueueHandle_t xQueue, const char * pcQueueName) { diff --git a/examples/lighting-app/cc13x4_26x4/BUILD.gn b/examples/lighting-app/cc13x4_26x4/BUILD.gn index 02d9b0b8763ee7..b07b8c43aaa51d 100644 --- a/examples/lighting-app/cc13x4_26x4/BUILD.gn +++ b/examples/lighting-app/cc13x4_26x4/BUILD.gn @@ -67,10 +67,8 @@ ti_sysconfig("sysconfig") { cflags = [ "-Wno-comment", - "@" + rebase_path("${target_gen_dir}/sysconfig/ti_ble_app_config.opt", - root_build_dir), - "@" + rebase_path("${target_gen_dir}/sysconfig/ti_build_config.opt", - root_build_dir), + "@" + rebase_path("${target_gen_dir}/sysconfig/ti_utils_build_compiler.opt", + root_build_dir), ] } @@ -103,6 +101,11 @@ ti_simplelink_executable("lighting_app") { defines = [ "CC13XX_26XX_FACTORY_DATA" ] } + if(chip_enable_icd_server){ + defines += ["CHIP_DEVICE_CONFIG_ENABLE_SED", + "TI_ICD_ENABLE_SERVER"] + } + include_dirs = [ "${project_dir}", "${chip_root}/examples/providers/", diff --git a/examples/lighting-app/cc13x4_26x4/args.gni b/examples/lighting-app/cc13x4_26x4/args.gni index c9f4b718ec9aca..640bf6ee57003e 100644 --- a/examples/lighting-app/cc13x4_26x4/args.gni +++ b/examples/lighting-app/cc13x4_26x4/args.gni @@ -13,6 +13,7 @@ # limitations under the License. import("//build_overrides/chip.gni") +import("//build_overrides/freertos.gni") import("${chip_root}/config/standalone/args.gni") import("${chip_root}/examples/platform/cc13x4_26x4/args.gni") @@ -29,13 +30,13 @@ lwip_debug = false chip_enable_ota_requestor = true -chip_openthread_ftd = true +chip_openthread_ftd = false openthread_external_platform = "${chip_root}/third_party/openthread/platforms/cc13x4_26x4:libopenthread-cc13x4_cc26x4" # Disable CHIP Logging -#chip_progress_logging = false -#chip_detail_logging = false -#chip_automation_logging = false +chip_progress_logging = true +chip_detail_logging = true +chip_automation_logging = true # BLE options chip_config_network_layer_ble = true @@ -50,3 +51,11 @@ matter_software_ver = "0x0001" matter_software_ver_str = "1.0.1+1" custom_factory_data = true + +# ICD Default configurations +# when enabled the device will be configured as a sleepy end device +chip_enable_icd_server = false +chip_persist_subscriptions = false +chip_subscription_timeout_resumption = false + +freertos_root = "//third_party/connectedhomeip/third_party/ti_simplelink_sdk/repo_cc13xx_cc26xx/source/third_party/freertos" diff --git a/examples/lighting-app/cc13x4_26x4/chip.syscfg b/examples/lighting-app/cc13x4_26x4/chip.syscfg index 0257d3ed152e5e..e4ae2b6acfbbd2 100644 --- a/examples/lighting-app/cc13x4_26x4/chip.syscfg +++ b/examples/lighting-app/cc13x4_26x4/chip.syscfg @@ -168,14 +168,12 @@ LED1.$name = "CONFIG_LED_RED"; LED1.$hardware = system.deviceData.board.components.LED_RED; LED1.gpioPin.$name = "CONFIG_GPIO_RLED"; LED1.gpioPin.mode = "Output"; -LED1.gpioPin.callbackFunction = ""; /* Green LED */ LED2.$name = "CONFIG_LED_GREEN"; LED2.$hardware = system.deviceData.board.components.LED_GREEN; LED2.gpioPin.$name = "CONFIG_GPIO_GLED"; LED2.gpioPin.mode = "Output"; -LED2.gpioPin.callbackFunction = ""; /* Debug UART */ UART2.$hardware = system.deviceData.board.components.XDS110UART; diff --git a/examples/lighting-app/cc13x4_26x4/src/AppTask.cpp b/examples/lighting-app/cc13x4_26x4/src/AppTask.cpp index 94674a1a787a95..1d2bcea24a097d 100644 --- a/examples/lighting-app/cc13x4_26x4/src/AppTask.cpp +++ b/examples/lighting-app/cc13x4_26x4/src/AppTask.cpp @@ -67,6 +67,13 @@ static uint32_t identify_trigger_effect = IDENTIFY_TRIGGER_EFFECT_FINISH_STOP; #define LIGHTING_APPLICATION_IDENTIFY_ENDPOINT 1 +#if (CHIP_CONFIG_ENABLE_ICD_SERVER == 1) +#define LED_ENABLE 0 +#else +#define LED_ENABLE 1 +#endif +#define BUTTON_ENABLE 1 + using namespace ::chip; using namespace ::chip::app; using namespace ::chip::Credentials; @@ -83,6 +90,12 @@ static DeviceInfoProviderImpl sExampleDeviceInfoProvider; AppTask AppTask::sAppTask; +void uiTurnOn(void); +void uiTurnedOn(void); +void uiTurnOff(void); +void uiTurnedOff(void); + + #if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR static DefaultOTARequestor sRequestorCore; static DefaultOTARequestorStorage sRequestorStorage; @@ -129,43 +142,26 @@ int AppTask::StartAppTask() return ret; } -// Action initiated callback -void uiTurnOn(void) -{ - PLAT_LOG("Light On initiated"); - LED_setOn(sAppRedHandle, LED_BRIGHTNESS_MAX); - LED_startBlinking(sAppRedHandle, 110 /* ms */, LED_BLINK_FOREVER); -} - -// Action completed callback -void uiTurnedOn(void) -{ - PLAT_LOG("Light On completed"); - LED_stopBlinking(sAppRedHandle); - LED_setOn(sAppRedHandle, LED_BRIGHTNESS_MAX); -} - -// Action initiated callback -void uiTurnOff(void) +// Identify take action +void identify_TakeAction(void) { - PLAT_LOG("Light Off initiated"); - LED_setOn(sAppRedHandle, LED_BRIGHTNESS_MAX); - LED_startBlinking(sAppRedHandle, 110 /* ms */, LED_BLINK_FOREVER); +#ifdef LED_ENABLE + LED_setOn(sAppGreenHandle, LED_BRIGHTNESS_MAX); + LED_startBlinking(sAppGreenHandle, 1000, LED_BLINK_FOREVER); +#endif //LED_ENABLE } -// Action completed callback -void uiTurnedOff(void) +// Identify stop action +void identify_StopAction(void) { - PLAT_LOG("Light Off completed"); - LED_stopBlinking(sAppRedHandle); - LED_setOff(sAppRedHandle); +#ifdef LED_ENABLE + LED_stopBlinking(sAppGreenHandle); + LED_setOff(sAppGreenHandle); +#endif //LED_ENABLE } int AppTask::Init() { - LED_Params ledParams; - Button_Params buttonParams; - cc13xx_26xxLogInit(); // Init Chip memory management before the stack @@ -188,9 +184,13 @@ int AppTask::Init() } #if CHIP_DEVICE_CONFIG_THREAD_FTD ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_Router); +#else +#if CHIP_DEVICE_CONFIG_ENABLE_SED + ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_SleepyEndDevice); #else ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_MinimalEndDevice); -#endif +#endif //CHIP_DEVICE_CONFIG_ENABLE_SED +#endif //CHIP_DEVICE_CONFIG_THREAD_FTD if (ret != CHIP_NO_ERROR) { PLAT_LOG("ConnectivityMgr().SetThreadDeviceType() failed"); @@ -238,33 +238,7 @@ int AppTask::Init() Server::GetInstance().Init(initParams); - // Initialize LEDs - PLAT_LOG("Initialize LEDs"); - LED_init(); - - LED_Params_init(&ledParams); // default PWM LED - sAppRedHandle = LED_open(CONFIG_LED_RED, &ledParams); - LED_setOff(sAppRedHandle); - - LED_Params_init(&ledParams); // default PWM LED - sAppGreenHandle = LED_open(CONFIG_LED_GREEN, &ledParams); - LED_setOff(sAppGreenHandle); - - // Initialize buttons - PLAT_LOG("Initialize buttons"); - Button_init(); - - Button_Params_init(&buttonParams); - buttonParams.buttonEventMask = Button_EV_CLICKED | Button_EV_LONGCLICKED; - buttonParams.longPressDuration = 1000U; // ms - sAppLeftHandle = Button_open(CONFIG_BTN_LEFT, &buttonParams); - Button_setCallback(sAppLeftHandle, ButtonLeftEventHandler); - - Button_Params_init(&buttonParams); - buttonParams.buttonEventMask = Button_EV_CLICKED | Button_EV_LONGCLICKED; - buttonParams.longPressDuration = 1000U; // ms - sAppRightHandle = Button_open(CONFIG_BTN_RIGHT, &buttonParams); - Button_setCallback(sAppRightHandle, ButtonRightEventHandler); + uiInit(); ret = LightMgr().Init(); @@ -282,6 +256,7 @@ int AppTask::Init() #if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR InitializeOTARequestor(); #endif + // QR code will be used with CHIP Tool PrintOnboardingCodes(RendezvousInformationFlags(RendezvousInformationFlag::kBLE)); @@ -304,46 +279,6 @@ void AppTask::AppTaskMain(void * pvParameter) } } -void AppTask::ButtonLeftEventHandler(Button_Handle handle, Button_EventMask events) -{ - AppEvent event; - event.Type = AppEvent::kEventType_ButtonLeft; - - if (events & Button_EV_CLICKED) - { - event.ButtonEvent.Type = AppEvent::kAppEventButtonType_Clicked; - } - else if (events & Button_EV_LONGCLICKED) - { - event.ButtonEvent.Type = AppEvent::kAppEventButtonType_LongClicked; - } - // button callbacks are in ISR context - if (xQueueSendFromISR(sAppEventQueue, &event, NULL) != pdPASS) - { - /* Failed to post the message */ - } -} - -void AppTask::ButtonRightEventHandler(Button_Handle handle, Button_EventMask events) -{ - AppEvent event; - event.Type = AppEvent::kEventType_ButtonRight; - - if (events & Button_EV_CLICKED) - { - event.ButtonEvent.Type = AppEvent::kAppEventButtonType_Clicked; - } - else if (events & Button_EV_LONGCLICKED) - { - event.ButtonEvent.Type = AppEvent::kAppEventButtonType_LongClicked; - } - // button callbacks are in ISR context - if (xQueueSendFromISR(sAppEventQueue, &event, NULL) != pdPASS) - { - /* Failed to post the message */ - } -} - void AppTask::ActionInitiated(LightingManager::Action_t aAction, int32_t aActor) { if (aAction == LightingManager::ON_ACTION) @@ -458,16 +393,13 @@ void AppTask::DispatchEvent(AppEvent * aEvent) switch (identify_trigger_effect) { case IDENTIFY_TRIGGER_EFFECT_BLINK: - LED_setOn(sAppGreenHandle, LED_BRIGHTNESS_MAX); - LED_startBlinking(sAppGreenHandle, 1000, LED_BLINK_FOREVER); + identify_TakeAction(); break; case IDENTIFY_TRIGGER_EFFECT_BREATHE: - LED_setOn(sAppGreenHandle, LED_BRIGHTNESS_MAX); - LED_startBlinking(sAppGreenHandle, 100, LED_BLINK_FOREVER); + identify_TakeAction(); break; case IDENTIFY_TRIGGER_EFFECT_OKAY: - LED_setOn(sAppGreenHandle, LED_BRIGHTNESS_MAX); - LED_startBlinking(sAppGreenHandle, 500, LED_BLINK_FOREVER); + identify_TakeAction(); break; default: break; @@ -476,8 +408,7 @@ void AppTask::DispatchEvent(AppEvent * aEvent) break; case AppEvent::kEventType_IdentifyStop: - LED_stopBlinking(sAppGreenHandle); - LED_setOff(sAppGreenHandle); + identify_StopAction(); PLAT_LOG("Identify stopped"); break; @@ -544,3 +475,126 @@ void AppTask::TriggerIdentifyEffectHandler(::Identify * identify) PLAT_LOG("No identifier effect"); } } + +// Action initiated callback +void uiTurnOn(void) +{ + PLAT_LOG("Light On initiated"); +#ifdef LED_ENABLE + LED_setOn(sAppRedHandle, LED_BRIGHTNESS_MAX); + LED_startBlinking(sAppRedHandle, 110 /* ms */, LED_BLINK_FOREVER); +#endif //LED_ENABLE +} + +// Action completed callback +void uiTurnedOn(void) +{ + PLAT_LOG("Light On completed"); +#ifdef LED_ENABLE + LED_stopBlinking(sAppRedHandle); + LED_setOn(sAppRedHandle, LED_BRIGHTNESS_MAX); +#endif //LED_ENABLE +} + +// Action initiated callback +void uiTurnOff(void) +{ + PLAT_LOG("Light Off initiated"); +#ifdef LED_ENABLE + LED_setOn(sAppRedHandle, LED_BRIGHTNESS_MAX); + LED_startBlinking(sAppRedHandle, 110 /* ms */, LED_BLINK_FOREVER); +#endif //LED_ENABLE +} + +// Action completed callback +void uiTurnedOff(void) +{ + PLAT_LOG("Light Off completed"); +#ifdef LED_ENABLE + LED_stopBlinking(sAppRedHandle); + LED_setOff(sAppRedHandle); +#endif //LED_ENABLE +} + + +#ifdef BUTTON_ENABLE +void AppTask::ButtonLeftEventHandler(Button_Handle handle, Button_EventMask events) +{ + AppEvent event; + event.Type = AppEvent::kEventType_ButtonLeft; + + if (events & Button_EV_CLICKED) + { + event.ButtonEvent.Type = AppEvent::kAppEventButtonType_Clicked; + } + else if (events & Button_EV_LONGCLICKED) + { + event.ButtonEvent.Type = AppEvent::kAppEventButtonType_LongClicked; + } + // button callbacks are in ISR context + if (xQueueSendFromISR(sAppEventQueue, &event, NULL) != pdPASS) + { + /* Failed to post the message */ + } +} + +void AppTask::ButtonRightEventHandler(Button_Handle handle, Button_EventMask events) +{ + AppEvent event; + event.Type = AppEvent::kEventType_ButtonRight; + + if (events & Button_EV_CLICKED) + { + event.ButtonEvent.Type = AppEvent::kAppEventButtonType_Clicked; + } + else if (events & Button_EV_LONGCLICKED) + { + event.ButtonEvent.Type = AppEvent::kAppEventButtonType_LongClicked; + } + // button callbacks are in ISR context + if (xQueueSendFromISR(sAppEventQueue, &event, NULL) != pdPASS) + { + /* Failed to post the message */ + } +} +#endif //BUTTON_ENABLE + +void AppTask::uiInit(void) +{ + #ifdef LED_ENABLE + + LED_Params ledParams; + + // Initialize LEDs + PLAT_LOG("Initialize LEDs"); + LED_init(); + + LED_Params_init(&ledParams); // default PWM LED + sAppRedHandle = LED_open(CONFIG_LED_RED, &ledParams); + LED_setOff(sAppRedHandle); + + LED_Params_init(&ledParams); // default PWM LED + sAppGreenHandle = LED_open(CONFIG_LED_GREEN, &ledParams); + LED_setOff(sAppGreenHandle); +#endif //LED ENABLE + +#ifdef BUTTON_ENABLE + Button_Params buttonParams; + + // Initialize buttons + PLAT_LOG("Initialize buttons"); + Button_init(); + + Button_Params_init(&buttonParams); + buttonParams.buttonEventMask = Button_EV_CLICKED | Button_EV_LONGCLICKED; + buttonParams.longPressDuration = 1000U; // ms + sAppLeftHandle = Button_open(CONFIG_BTN_LEFT, &buttonParams); + Button_setCallback(sAppLeftHandle, ButtonLeftEventHandler); + + Button_Params_init(&buttonParams); + buttonParams.buttonEventMask = Button_EV_CLICKED | Button_EV_LONGCLICKED; + buttonParams.longPressDuration = 1000U; // ms + sAppRightHandle = Button_open(CONFIG_BTN_RIGHT, &buttonParams); + Button_setCallback(sAppRightHandle, ButtonRightEventHandler); +#endif //BUTTON ENABLE +} diff --git a/examples/lighting-app/cc13x4_26x4/src/AppTask.h b/examples/lighting-app/cc13x4_26x4/src/AppTask.h index c82a122fef4ea8..653d43607a417b 100644 --- a/examples/lighting-app/cc13x4_26x4/src/AppTask.h +++ b/examples/lighting-app/cc13x4_26x4/src/AppTask.h @@ -69,6 +69,7 @@ class AppTask static void ActionCompleted(LightingManager::Action_t aAction); void DispatchEvent(AppEvent * event); + void uiInit(void); static void UpdateClusterState(intptr_t context); static void SingleButtonEventHandler(AppEvent * aEvent); static void ButtonTimerEventHandler(AppEvent * aEvent); diff --git a/examples/lighting-app/cc13x4_26x4/src/main.cpp b/examples/lighting-app/cc13x4_26x4/src/main.cpp index 6cf27cf79a35fb..d2635ed96e2e28 100644 --- a/examples/lighting-app/cc13x4_26x4/src/main.cpp +++ b/examples/lighting-app/cc13x4_26x4/src/main.cpp @@ -48,14 +48,6 @@ uint32_t heapSize = TOTAL_ICALL_HEAP_SIZE; // ================================================================================ // FreeRTOS Callbacks // ================================================================================ -extern "C" void vApplicationStackOverflowHook(void) -{ - while (1) - { - ; - } -} - /* Wrapper functions for using the queue registry regardless of whether it is enabled or disabled */ extern "C" void vQueueAddToRegistryWrapper(QueueHandle_t xQueue, const char * pcQueueName) { diff --git a/examples/lock-app/cc13x4_26x4/BUILD.gn b/examples/lock-app/cc13x4_26x4/BUILD.gn index aed45f85bce94b..1688d1c9739cb1 100644 --- a/examples/lock-app/cc13x4_26x4/BUILD.gn +++ b/examples/lock-app/cc13x4_26x4/BUILD.gn @@ -63,11 +63,17 @@ ti_sysconfig("sysconfig") { cflags = [ "-Wno-comment", - "@" + rebase_path("${target_gen_dir}/sysconfig/ti_ble_app_config.opt", - root_build_dir), - "@" + rebase_path("${target_gen_dir}/sysconfig/ti_build_config.opt", + "@" + rebase_path("${target_gen_dir}/sysconfig/ti_utils_build_compiler.opt", root_build_dir), ] + + include_dirs = [ + "${ti_simplelink_sdk_root}/source/ti/posix/freertos/", + "${ti_simplelink_sdk_root}/kernel/freertos/", + "${freertos_root}", + "${freertos_root}/include", + "${freertos_root}/portable/GCC/ARM_CM33_NTZ/non_secure/", + ] } ti_simplelink_executable("lock_app") { @@ -99,6 +105,9 @@ ti_simplelink_executable("lock_app") { defines = [ "CC13XX_26XX_FACTORY_DATA" ] } + if(chip_enable_icd_server){ + defines += ["CHIP_DEVICE_CONFIG_ENABLE_SED", "TI_ICD_ENABLE_SERVER"] + } include_dirs = [ "${project_dir}", "${chip_root}/examples/providers/", diff --git a/examples/lock-app/cc13x4_26x4/args.gni b/examples/lock-app/cc13x4_26x4/args.gni index d7508aaa640661..1e92a24dab0c3f 100644 --- a/examples/lock-app/cc13x4_26x4/args.gni +++ b/examples/lock-app/cc13x4_26x4/args.gni @@ -13,6 +13,7 @@ # limitations under the License. import("//build_overrides/chip.gni") +import("//build_overrides/freertos.gni") import("${chip_root}/config/standalone/args.gni") import("${chip_root}/examples/platform/cc13x4_26x4/args.gni") @@ -52,3 +53,10 @@ matter_software_ver_str = "1.0.1+1" # should be maj.min.rev+build with later parts optional for MCUBoot custom_factory_data = true + +# ICD Default configurations +chip_enable_icd_server = false +chip_persist_subscriptions = false +chip_subscription_timeout_resumption = false + +freertos_root = "//third_party/connectedhomeip/third_party/ti_simplelink_sdk/repo_cc13xx_cc26xx/source/third_party/freertos" diff --git a/examples/lock-app/cc13x4_26x4/chip.syscfg b/examples/lock-app/cc13x4_26x4/chip.syscfg index 0257d3ed152e5e..e4ae2b6acfbbd2 100644 --- a/examples/lock-app/cc13x4_26x4/chip.syscfg +++ b/examples/lock-app/cc13x4_26x4/chip.syscfg @@ -168,14 +168,12 @@ LED1.$name = "CONFIG_LED_RED"; LED1.$hardware = system.deviceData.board.components.LED_RED; LED1.gpioPin.$name = "CONFIG_GPIO_RLED"; LED1.gpioPin.mode = "Output"; -LED1.gpioPin.callbackFunction = ""; /* Green LED */ LED2.$name = "CONFIG_LED_GREEN"; LED2.$hardware = system.deviceData.board.components.LED_GREEN; LED2.gpioPin.$name = "CONFIG_GPIO_GLED"; LED2.gpioPin.mode = "Output"; -LED2.gpioPin.callbackFunction = ""; /* Debug UART */ UART2.$hardware = system.deviceData.board.components.XDS110UART; diff --git a/examples/lock-app/cc13x4_26x4/src/AppTask.cpp b/examples/lock-app/cc13x4_26x4/src/AppTask.cpp index c42d06c705d846..aef4d52d755983 100644 --- a/examples/lock-app/cc13x4_26x4/src/AppTask.cpp +++ b/examples/lock-app/cc13x4_26x4/src/AppTask.cpp @@ -57,6 +57,13 @@ #define APP_TASK_PRIORITY 4 #define APP_EVENT_QUEUE_SIZE 10 +#if (CHIP_CONFIG_ENABLE_ICD_SERVER == 1) +#define LED_ENABLE 0 +#else +#define LED_ENABLE 1 +#endif +#define BUTTON_ENABLE 1 + using namespace ::chip; using namespace ::chip::app; using namespace ::chip::Credentials; @@ -70,6 +77,7 @@ static LED_Handle sAppRedHandle; static LED_Handle sAppGreenHandle; static Button_Handle sAppLeftHandle; static Button_Handle sAppRightHandle; + static DeviceInfoProviderImpl sExampleDeviceInfoProvider; AppTask AppTask::sAppTask; @@ -120,47 +128,31 @@ int AppTask::StartAppTask() return ret; } -void uiLocking(void) -{ - PLAT_LOG("Lock initiated"); - LED_setOn(sAppGreenHandle, LED_BRIGHTNESS_MAX); - LED_startBlinking(sAppGreenHandle, 50 /* ms */, LED_BLINK_FOREVER); - LED_setOn(sAppRedHandle, LED_BRIGHTNESS_MAX); - LED_startBlinking(sAppRedHandle, 110 /* ms */, LED_BLINK_FOREVER); -} - -void uiLocked(void) -{ - PLAT_LOG("Lock completed"); - LED_stopBlinking(sAppGreenHandle); - LED_setOff(sAppGreenHandle); - LED_stopBlinking(sAppRedHandle); - LED_setOn(sAppRedHandle, LED_BRIGHTNESS_MAX); -} +void uiLocking(void); +void uiLocked(void); +void uiUnlocking(void); +void uiUnlocked(void); -void uiUnlocking(void) +// Identify take action +void identify_TakeAction(void) { - PLAT_LOG("Unlock initiated"); +#ifdef LED_ENABLE LED_setOn(sAppGreenHandle, LED_BRIGHTNESS_MAX); - LED_startBlinking(sAppGreenHandle, 50 /* ms */, LED_BLINK_FOREVER); - LED_setOn(sAppRedHandle, LED_BRIGHTNESS_MAX); - LED_startBlinking(sAppRedHandle, 110 /* ms */, LED_BLINK_FOREVER); + LED_startBlinking(sAppGreenHandle, 1000, LED_BLINK_FOREVER); +#endif //LED_ENABLE } -void uiUnlocked(void) +// Identify stop action +void identify_StopAction(void) { - PLAT_LOG("Unlock completed"); +#ifdef LED_ENABLE LED_stopBlinking(sAppGreenHandle); LED_setOff(sAppGreenHandle); - LED_stopBlinking(sAppRedHandle); - LED_setOff(sAppRedHandle); +#endif //LED_ENABLE } int AppTask::Init() { - LED_Params ledParams; - Button_Params buttonParams; - cc13xx_26xxLogInit(); // Init Chip memory management before the stack @@ -184,8 +176,12 @@ int AppTask::Init() #if CHIP_DEVICE_CONFIG_THREAD_FTD ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_Router); #else +#if CHIP_DEVICE_CONFIG_ENABLE_SED + ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_SleepyEndDevice); ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_MinimalEndDevice); -#endif +#endif //CHIP_DEVICE_CONFIG_ENABLE_SED +#endif //CHIP_DEVICE_CONFIG_THREAD_FTD + if (ret != CHIP_NO_ERROR) { PLAT_LOG("ConnectivityMgr().SetThreadDeviceType() failed"); @@ -233,33 +229,7 @@ int AppTask::Init() Server::GetInstance().Init(initParams); - // Initialize LEDs - PLAT_LOG("Initialize LEDs"); - LED_init(); - - LED_Params_init(&ledParams); // default PWM LED - sAppRedHandle = LED_open(CONFIG_LED_RED, &ledParams); - LED_setOff(sAppRedHandle); - - LED_Params_init(&ledParams); // default PWM LED - sAppGreenHandle = LED_open(CONFIG_LED_GREEN, &ledParams); - LED_setOff(sAppGreenHandle); - - // Initialize buttons - PLAT_LOG("Initialize buttons"); - Button_init(); - - Button_Params_init(&buttonParams); - buttonParams.buttonEventMask = Button_EV_CLICKED | Button_EV_LONGCLICKED; - buttonParams.longPressDuration = 1000U; // ms - sAppLeftHandle = Button_open(CONFIG_BTN_LEFT, &buttonParams); - Button_setCallback(sAppLeftHandle, ButtonLeftEventHandler); - - Button_Params_init(&buttonParams); - buttonParams.buttonEventMask = Button_EV_CLICKED | Button_EV_LONGCLICKED; - buttonParams.longPressDuration = 1000U; // ms - sAppRightHandle = Button_open(CONFIG_BTN_RIGHT, &buttonParams); - Button_setCallback(sAppRightHandle, ButtonRightEventHandler); + uiInit(); PlatformMgr().LockChipStack(); { @@ -356,46 +326,6 @@ void AppTask::AppTaskMain(void * pvParameter) } } -void AppTask::ButtonLeftEventHandler(Button_Handle handle, Button_EventMask events) -{ - AppEvent event; - event.Type = AppEvent::kEventType_ButtonLeft; - - if (events & Button_EV_CLICKED) - { - event.ButtonEvent.Type = AppEvent::kAppEventButtonType_Clicked; - } - else if (events & Button_EV_LONGCLICKED) - { - event.ButtonEvent.Type = AppEvent::kAppEventButtonType_LongClicked; - } - // button callbacks are in ISR context - if (xQueueSendFromISR(sAppEventQueue, &event, NULL) != pdPASS) - { - /* Failed to post the message */ - } -} - -void AppTask::ButtonRightEventHandler(Button_Handle handle, Button_EventMask events) -{ - AppEvent event; - event.Type = AppEvent::kEventType_ButtonRight; - - if (events & Button_EV_CLICKED) - { - event.ButtonEvent.Type = AppEvent::kAppEventButtonType_Clicked; - } - else if (events & Button_EV_LONGCLICKED) - { - event.ButtonEvent.Type = AppEvent::kAppEventButtonType_LongClicked; - } - // button callbacks are in ISR context - if (xQueueSendFromISR(sAppEventQueue, &event, NULL) != pdPASS) - { - /* Failed to post the message */ - } -} - void AppTask::ActionInitiated(LockManager::Action_t aAction) { if (aAction == LockManager::LOCK_ACTION) @@ -498,15 +428,12 @@ void AppTask::DispatchEvent(AppEvent * aEvent) break; case AppEvent::kEventType_IdentifyStart: - LED_setOn(sAppGreenHandle, LED_BRIGHTNESS_MAX); - LED_startBlinking(sAppGreenHandle, 500, LED_BLINK_FOREVER); + identify_TakeAction(); PLAT_LOG("Identify started"); break; case AppEvent::kEventType_IdentifyStop: - LED_stopBlinking(sAppGreenHandle); - - LED_setOff(sAppGreenHandle); + identify_StopAction(); PLAT_LOG("Identify stopped"); break; @@ -565,3 +492,129 @@ void AppTask::TriggerIdentifyEffectHandler(::Identify * identify) PLAT_LOG("No identifier effect"); } } + +void uiLocking(void) +{ +#if LED_ENABLE + PLAT_LOG("Lock initiated"); + LED_setOn(sAppGreenHandle, LED_BRIGHTNESS_MAX); + LED_startBlinking(sAppGreenHandle, 50 /* ms */, LED_BLINK_FOREVER); + LED_setOn(sAppRedHandle, LED_BRIGHTNESS_MAX); + LED_startBlinking(sAppRedHandle, 110 /* ms */, LED_BLINK_FOREVER); +#endif +} + +void uiLocked(void) +{ +#if LED_ENABLE + PLAT_LOG("Lock completed"); + LED_stopBlinking(sAppGreenHandle); + LED_setOff(sAppGreenHandle); + LED_stopBlinking(sAppRedHandle); + LED_setOn(sAppRedHandle, LED_BRIGHTNESS_MAX); +#endif +} + +void uiUnlocking(void) +{ +#if LED_ENABLE + PLAT_LOG("Unlock initiated"); + LED_setOn(sAppGreenHandle, LED_BRIGHTNESS_MAX); + LED_startBlinking(sAppGreenHandle, 50 /* ms */, LED_BLINK_FOREVER); + LED_setOn(sAppRedHandle, LED_BRIGHTNESS_MAX); + LED_startBlinking(sAppRedHandle, 110 /* ms */, LED_BLINK_FOREVER); +#endif +} + +void uiUnlocked(void) +{ +#if LED_ENABLE + PLAT_LOG("Unlock completed"); + LED_stopBlinking(sAppGreenHandle); + LED_setOff(sAppGreenHandle); + LED_stopBlinking(sAppRedHandle); + LED_setOff(sAppRedHandle); +#endif +} + +#ifdef BUTTON_ENABLE +void AppTask::ButtonLeftEventHandler(Button_Handle handle, Button_EventMask events) +{ + AppEvent event; + event.Type = AppEvent::kEventType_ButtonLeft; + + if (events & Button_EV_CLICKED) + { + event.ButtonEvent.Type = AppEvent::kAppEventButtonType_Clicked; + } + else if (events & Button_EV_LONGCLICKED) + { + event.ButtonEvent.Type = AppEvent::kAppEventButtonType_LongClicked; + } + // button callbacks are in ISR context + if (xQueueSendFromISR(sAppEventQueue, &event, NULL) != pdPASS) + { + /* Failed to post the message */ + } +} + +void AppTask::ButtonRightEventHandler(Button_Handle handle, Button_EventMask events) +{ + AppEvent event; + event.Type = AppEvent::kEventType_ButtonRight; + + if (events & Button_EV_CLICKED) + { + event.ButtonEvent.Type = AppEvent::kAppEventButtonType_Clicked; + } + else if (events & Button_EV_LONGCLICKED) + { + event.ButtonEvent.Type = AppEvent::kAppEventButtonType_LongClicked; + } + // button callbacks are in ISR context + if (xQueueSendFromISR(sAppEventQueue, &event, NULL) != pdPASS) + { + /* Failed to post the message */ + } +} +#endif //BUTTON_ENABLE + +void AppTask::uiInit(void) +{ +#ifdef LED_ENABLE + + LED_Params ledParams; + + // Initialize LEDs + PLAT_LOG("Initialize LEDs"); + LED_init(); + + LED_Params_init(&ledParams); // default PWM LED + sAppRedHandle = LED_open(CONFIG_LED_RED, &ledParams); + LED_setOff(sAppRedHandle); + + LED_Params_init(&ledParams); // default PWM LED + sAppGreenHandle = LED_open(CONFIG_LED_GREEN, &ledParams); + LED_setOff(sAppGreenHandle); +#endif //LED ENABLE + +#ifdef BUTTON_ENABLE + Button_Params buttonParams; + + // Initialize buttons + PLAT_LOG("Initialize buttons"); + Button_init(); + + Button_Params_init(&buttonParams); + buttonParams.buttonEventMask = Button_EV_CLICKED | Button_EV_LONGCLICKED; + buttonParams.longPressDuration = 1000U; // ms + sAppLeftHandle = Button_open(CONFIG_BTN_LEFT, &buttonParams); + Button_setCallback(sAppLeftHandle, ButtonLeftEventHandler); + + Button_Params_init(&buttonParams); + buttonParams.buttonEventMask = Button_EV_CLICKED | Button_EV_LONGCLICKED; + buttonParams.longPressDuration = 1000U; // ms + sAppRightHandle = Button_open(CONFIG_BTN_RIGHT, &buttonParams); + Button_setCallback(sAppRightHandle, ButtonRightEventHandler); +#endif //BUTTON ENABLE +} diff --git a/examples/lock-app/cc13x4_26x4/src/AppTask.h b/examples/lock-app/cc13x4_26x4/src/AppTask.h index 7778fd5f2a5e1f..8f1426933cc725 100644 --- a/examples/lock-app/cc13x4_26x4/src/AppTask.h +++ b/examples/lock-app/cc13x4_26x4/src/AppTask.h @@ -69,7 +69,7 @@ class AppTask static void ActionCompleted(LockManager::Action_t aAction); void DispatchEvent(AppEvent * event); - + void uiInit(void); static void ButtonLeftEventHandler(Button_Handle handle, Button_EventMask events); static void ButtonRightEventHandler(Button_Handle handle, Button_EventMask events); static void TimerEventHandler(void * p_context); diff --git a/examples/lock-app/cc13x4_26x4/src/main.cpp b/examples/lock-app/cc13x4_26x4/src/main.cpp index 6cf27cf79a35fb..35588f6552e484 100644 --- a/examples/lock-app/cc13x4_26x4/src/main.cpp +++ b/examples/lock-app/cc13x4_26x4/src/main.cpp @@ -48,13 +48,6 @@ uint32_t heapSize = TOTAL_ICALL_HEAP_SIZE; // ================================================================================ // FreeRTOS Callbacks // ================================================================================ -extern "C" void vApplicationStackOverflowHook(void) -{ - while (1) - { - ; - } -} /* Wrapper functions for using the queue registry regardless of whether it is enabled or disabled */ extern "C" void vQueueAddToRegistryWrapper(QueueHandle_t xQueue, const char * pcQueueName) diff --git a/examples/pump-app/cc13x4_26x4/BUILD.gn b/examples/pump-app/cc13x4_26x4/BUILD.gn index 8c68ba70066315..08b35c44855a21 100644 --- a/examples/pump-app/cc13x4_26x4/BUILD.gn +++ b/examples/pump-app/cc13x4_26x4/BUILD.gn @@ -66,9 +66,7 @@ ti_sysconfig("sysconfig") { cflags = [ "-Wno-comment", - "@" + rebase_path("${target_gen_dir}/sysconfig/ti_ble_app_config.opt", - root_build_dir), - "@" + rebase_path("${target_gen_dir}/sysconfig/ti_build_config.opt", + "@" + rebase_path("${target_gen_dir}/sysconfig/ti_utils_build_compiler.opt", root_build_dir), ] } @@ -103,6 +101,10 @@ ti_simplelink_executable("pump_app") { defines = [ "CC13XX_26XX_FACTORY_DATA" ] } + if(chip_enable_icd_server){ + defines += ["CHIP_DEVICE_CONFIG_ENABLE_SED", "TI_ICD_ENABLE_SERVER"] + } + include_dirs = [ "${project_dir}", "${project_dir}/main", diff --git a/examples/pump-app/cc13x4_26x4/args.gni b/examples/pump-app/cc13x4_26x4/args.gni index 05c67f203ca2a9..94b3913ed26045 100644 --- a/examples/pump-app/cc13x4_26x4/args.gni +++ b/examples/pump-app/cc13x4_26x4/args.gni @@ -13,6 +13,7 @@ # limitations under the License. import("//build_overrides/chip.gni") +import("//build_overrides/freertos.gni") import("${chip_root}/config/standalone/args.gni") import("${chip_root}/examples/platform/cc13x4_26x4/args.gni") @@ -50,3 +51,10 @@ matter_software_ver = "0x0001" matter_software_ver_str = "1.0.1+1" custom_factory_data = true + +# ICD Default configurations +chip_enable_icd_server = false +chip_persist_subscriptions = false +chip_subscription_timeout_resumption = false + +freertos_root = "//third_party/connectedhomeip/third_party/ti_simplelink_sdk/repo_cc13xx_cc26xx/source/third_party/freertos" diff --git a/examples/pump-app/cc13x4_26x4/chip.syscfg b/examples/pump-app/cc13x4_26x4/chip.syscfg index 0257d3ed152e5e..e4ae2b6acfbbd2 100644 --- a/examples/pump-app/cc13x4_26x4/chip.syscfg +++ b/examples/pump-app/cc13x4_26x4/chip.syscfg @@ -168,14 +168,12 @@ LED1.$name = "CONFIG_LED_RED"; LED1.$hardware = system.deviceData.board.components.LED_RED; LED1.gpioPin.$name = "CONFIG_GPIO_RLED"; LED1.gpioPin.mode = "Output"; -LED1.gpioPin.callbackFunction = ""; /* Green LED */ LED2.$name = "CONFIG_LED_GREEN"; LED2.$hardware = system.deviceData.board.components.LED_GREEN; LED2.gpioPin.$name = "CONFIG_GPIO_GLED"; LED2.gpioPin.mode = "Output"; -LED2.gpioPin.callbackFunction = ""; /* Debug UART */ UART2.$hardware = system.deviceData.board.components.XDS110UART; diff --git a/examples/pump-app/cc13x4_26x4/main/AppTask.cpp b/examples/pump-app/cc13x4_26x4/main/AppTask.cpp index ea094e96767665..689c300d8665f5 100644 --- a/examples/pump-app/cc13x4_26x4/main/AppTask.cpp +++ b/examples/pump-app/cc13x4_26x4/main/AppTask.cpp @@ -63,6 +63,13 @@ #define ONOFF_CLUSTER_ENDPOINT 1 #define EXTENDED_DISCOVERY_TIMEOUT_SEC 20 +#if (CHIP_CONFIG_ENABLE_ICD_SERVER == 1) +#define LED_ENABLE 0 +#else +#define LED_ENABLE 1 +#endif +#define BUTTON_ENABLE 1 + using namespace chip; using namespace chip::app; using namespace chip::Credentials; @@ -133,9 +140,6 @@ int AppTask::StartAppTask() int AppTask::Init() { - LED_Params ledParams; - Button_Params buttonParams; - cc13xx_26xxLogInit(); // Init Chip memory management before the stack @@ -159,11 +163,13 @@ int AppTask::Init() #if CHIP_DEVICE_CONFIG_THREAD_FTD ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_Router); -#elif CONFIG_OPENTHREAD_MTD_SED +#else +#if CHIP_DEVICE_CONFIG_ENABLE_SED ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_SleepyEndDevice); #else ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_MinimalEndDevice); -#endif +#endif //CHIP_DEVICE_CONFIG_ENABLE_SED +#endif //CHIP_DEVICE_CONFIG_THREAD_FTD if (ret != CHIP_NO_ERROR) { PLAT_LOG("ConnectivityMgr().SetThreadDeviceType() failed"); @@ -179,33 +185,7 @@ int AppTask::Init() ; } - // Initialize LEDs - PLAT_LOG("Initialize LEDs"); - LED_init(); - - LED_Params_init(&ledParams); // default PWM LED - sAppRedHandle = LED_open(CONFIG_LED_RED, &ledParams); - LED_setOff(sAppRedHandle); - - LED_Params_init(&ledParams); // default PWM LED - sAppGreenHandle = LED_open(CONFIG_LED_GREEN, &ledParams); - LED_setOff(sAppGreenHandle); - - // Initialize buttons - PLAT_LOG("Initialize buttons"); - Button_init(); - - Button_Params_init(&buttonParams); - buttonParams.buttonEventMask = Button_EV_CLICKED | Button_EV_LONGPRESSED; - buttonParams.longPressDuration = 5000U; // ms - sAppLeftHandle = Button_open(CONFIG_BTN_LEFT, &buttonParams); - Button_setCallback(sAppLeftHandle, ButtonLeftEventHandler); - - Button_Params_init(&buttonParams); - buttonParams.buttonEventMask = Button_EV_CLICKED; - buttonParams.longPressDuration = 1000U; // ms - sAppRightHandle = Button_open(CONFIG_BTN_RIGHT, &buttonParams); - Button_setCallback(sAppRightHandle, ButtonRightEventHandler); + uiInit(); // Initialize device attestation config #ifdef CC13X4_26X4_ATTESTATION_CREDENTIALS @@ -280,42 +260,6 @@ void AppTask::PostEvent(const AppEvent * aEvent) } } -void AppTask::ButtonLeftEventHandler(Button_Handle handle, Button_EventMask events) -{ - AppEvent event; - event.Type = AppEvent::kEventType_ButtonLeft; - - if (events & Button_EV_CLICKED) - { - event.ButtonEvent.Type = AppEvent::kAppEventButtonType_Clicked; - } - else if (events & Button_EV_LONGPRESSED) - { - event.ButtonEvent.Type = AppEvent::kAppEventButtonType_LongPressed; - } - // button callbacks are in ISR context - if (xQueueSendFromISR(sAppEventQueue, &event, NULL) != pdPASS) - { - /* Failed to post the message */ - } -} - -void AppTask::ButtonRightEventHandler(Button_Handle handle, Button_EventMask events) -{ - AppEvent event; - event.Type = AppEvent::kEventType_ButtonRight; - - if (events & Button_EV_CLICKED) - { - event.ButtonEvent.Type = AppEvent::kAppEventButtonType_Clicked; - } - // button callbacks are in ISR context - if (xQueueSendFromISR(sAppEventQueue, &event, NULL) != pdPASS) - { - /* Failed to post the message */ - } -} - void AppTask::ActionInitiated(PumpManager::Action_t aAction, int32_t aActor) { // If the action has been initiated by the pump, update the pump trait @@ -330,11 +274,12 @@ void AppTask::ActionInitiated(PumpManager::Action_t aAction, int32_t aActor) PLAT_LOG("Stop initiated"); ; // TODO } - +#ifdef LED_ENABLE LED_setOn(sAppGreenHandle, LED_BRIGHTNESS_MAX); LED_startBlinking(sAppGreenHandle, 50 /* ms */, LED_BLINK_FOREVER); LED_setOn(sAppRedHandle, LED_BRIGHTNESS_MAX); LED_startBlinking(sAppRedHandle, 110 /* ms */, LED_BLINK_FOREVER); +#endif } void AppTask::ActionCompleted(PumpManager::Action_t aAction, int32_t aActor) @@ -345,20 +290,24 @@ void AppTask::ActionCompleted(PumpManager::Action_t aAction, int32_t aActor) if (aAction == PumpManager::START_ACTION) { PLAT_LOG("Pump start completed"); +#ifdef LED_ENABLE LED_stopBlinking(sAppGreenHandle); LED_setOn(sAppGreenHandle, LED_BRIGHTNESS_MAX); LED_stopBlinking(sAppRedHandle); LED_setOn(sAppRedHandle, LED_BRIGHTNESS_MAX); +#endif // Signal to the PCC cluster, that the pump is running sAppTask.UpdateClusterState(); } else if (aAction == PumpManager::STOP_ACTION) { PLAT_LOG("Pump stop completed"); +#ifdef LED_ENABLE LED_stopBlinking(sAppGreenHandle); LED_setOff(sAppGreenHandle); LED_stopBlinking(sAppRedHandle); LED_setOff(sAppRedHandle); +#endif // Signal to the PCC cluster, that the pump is NOT running sAppTask.UpdateClusterState(); } @@ -421,14 +370,16 @@ void AppTask::DispatchEvent(AppEvent * aEvent) break; case AppEvent::kEventType_IdentifyStart: +#ifdef LED_ENABLE LED_setOn(sAppGreenHandle, LED_BRIGHTNESS_MAX); LED_startBlinking(sAppGreenHandle, sIdentifyBlinkRateMs, LED_BLINK_FOREVER); +#endif PLAT_LOG("Identify started"); break; case AppEvent::kEventType_IdentifyStop: +#ifdef LED_ENABLE LED_stopBlinking(sAppGreenHandle); - if (!PumpMgr().IsStopped()) { LED_setOn(sAppGreenHandle, LED_BRIGHTNESS_MAX); @@ -437,6 +388,7 @@ void AppTask::DispatchEvent(AppEvent * aEvent) { LED_setOff(sAppGreenHandle); } +#endif PLAT_LOG("Identify stopped"); break; @@ -680,3 +632,85 @@ void AppTask::TriggerIdentifyEffectHandler(::Identify * identify) PLAT_LOG("No identifier effect"); } } + +#ifdef BUTTON_ENABLE +void AppTask::ButtonLeftEventHandler(Button_Handle handle, Button_EventMask events) +{ + AppEvent event; + event.Type = AppEvent::kEventType_ButtonLeft; + + if (events & Button_EV_CLICKED) + { + event.ButtonEvent.Type = AppEvent::kAppEventButtonType_Clicked; + } + else if (events & Button_EV_LONGCLICKED) + { + event.ButtonEvent.Type = AppEvent::kAppEventButtonType_LongClicked; + } + // button callbacks are in ISR context + if (xQueueSendFromISR(sAppEventQueue, &event, NULL) != pdPASS) + { + /* Failed to post the message */ + } +} + +void AppTask::ButtonRightEventHandler(Button_Handle handle, Button_EventMask events) +{ + AppEvent event; + event.Type = AppEvent::kEventType_ButtonRight; + + if (events & Button_EV_CLICKED) + { + event.ButtonEvent.Type = AppEvent::kAppEventButtonType_Clicked; + } + else if (events & Button_EV_LONGCLICKED) + { + event.ButtonEvent.Type = AppEvent::kAppEventButtonType_LongClicked; + } + // button callbacks are in ISR context + if (xQueueSendFromISR(sAppEventQueue, &event, NULL) != pdPASS) + { + /* Failed to post the message */ + } +} +#endif //BUTTON_ENABLE + +void AppTask::uiInit(void) +{ + #ifdef LED_ENABLE + + LED_Params ledParams; + + // Initialize LEDs + PLAT_LOG("Initialize LEDs"); + LED_init(); + + LED_Params_init(&ledParams); // default PWM LED + sAppRedHandle = LED_open(CONFIG_LED_RED, &ledParams); + LED_setOff(sAppRedHandle); + + LED_Params_init(&ledParams); // default PWM LED + sAppGreenHandle = LED_open(CONFIG_LED_GREEN, &ledParams); + LED_setOff(sAppGreenHandle); +#endif //LED ENABLE + +#ifdef BUTTON_ENABLE + Button_Params buttonParams; + + // Initialize buttons + PLAT_LOG("Initialize buttons"); + Button_init(); + + Button_Params_init(&buttonParams); + buttonParams.buttonEventMask = Button_EV_CLICKED | Button_EV_LONGCLICKED; + buttonParams.longPressDuration = 1000U; // ms + sAppLeftHandle = Button_open(CONFIG_BTN_LEFT, &buttonParams); + Button_setCallback(sAppLeftHandle, ButtonLeftEventHandler); + + Button_Params_init(&buttonParams); + buttonParams.buttonEventMask = Button_EV_CLICKED | Button_EV_LONGCLICKED; + buttonParams.longPressDuration = 1000U; // ms + sAppRightHandle = Button_open(CONFIG_BTN_RIGHT, &buttonParams); + Button_setCallback(sAppRightHandle, ButtonRightEventHandler); +#endif //BUTTON ENABLE +} \ No newline at end of file diff --git a/examples/pump-app/cc13x4_26x4/main/include/AppTask.h b/examples/pump-app/cc13x4_26x4/main/include/AppTask.h index 47b4fd56f2d671..ceba04b3c88cb5 100644 --- a/examples/pump-app/cc13x4_26x4/main/include/AppTask.h +++ b/examples/pump-app/cc13x4_26x4/main/include/AppTask.h @@ -64,6 +64,7 @@ class AppTask static void UpdateCluster(intptr_t context); void DispatchEvent(AppEvent * event); + void uiInit(void); static void ButtonLeftEventHandler(Button_Handle handle, Button_EventMask events); static void ButtonRightEventHandler(Button_Handle handle, Button_EventMask events); diff --git a/examples/pump-app/cc13x4_26x4/main/main.cpp b/examples/pump-app/cc13x4_26x4/main/main.cpp index ba98379ecc741a..84b66b755d1850 100644 --- a/examples/pump-app/cc13x4_26x4/main/main.cpp +++ b/examples/pump-app/cc13x4_26x4/main/main.cpp @@ -48,14 +48,6 @@ uint32_t heapSize = TOTAL_ICALL_HEAP_SIZE; // ================================================================================ // FreeRTOS Callbacks // ================================================================================ -extern "C" void vApplicationStackOverflowHook(void) -{ - while (true) - { - ; - } -} - /* Wrapper functions for using the queue registry regardless of whether it is enabled or disabled */ extern "C" void vQueueAddToRegistryWrapper(QueueHandle_t xQueue, const char * pcQueueName) { diff --git a/examples/pump-controller-app/cc13x4_26x4/BUILD.gn b/examples/pump-controller-app/cc13x4_26x4/BUILD.gn index 289b10de001294..f91bed97ada9d1 100644 --- a/examples/pump-controller-app/cc13x4_26x4/BUILD.gn +++ b/examples/pump-controller-app/cc13x4_26x4/BUILD.gn @@ -67,9 +67,7 @@ ti_sysconfig("sysconfig") { cflags = [ "-Wno-comment", - "@" + rebase_path("${target_gen_dir}/sysconfig/ti_ble_app_config.opt", - root_build_dir), - "@" + rebase_path("${target_gen_dir}/sysconfig/ti_build_config.opt", + "@" + rebase_path("${target_gen_dir}/sysconfig/ti_utils_build_compiler.opt", root_build_dir), ] } @@ -102,6 +100,9 @@ ti_simplelink_executable("pump_controller_app") { defines = [ "CC13XX_26XX_FACTORY_DATA" ] } + if (chip_enable_icd_server){ + defines += ["CHIP_DEVICE_CONFIG_ENABLE_SED", "TI_ICD_ENABLE_SERVER"] + } include_dirs = [ "${project_dir}", "${project_dir}/main", diff --git a/examples/pump-controller-app/cc13x4_26x4/args.gni b/examples/pump-controller-app/cc13x4_26x4/args.gni index e2beed52434bcf..9d21df04690e64 100644 --- a/examples/pump-controller-app/cc13x4_26x4/args.gni +++ b/examples/pump-controller-app/cc13x4_26x4/args.gni @@ -13,6 +13,7 @@ # limitations under the License. import("//build_overrides/chip.gni") +import("//build_overrides/freertos.gni") import("${chip_root}/config/standalone/args.gni") import("${chip_root}/examples/platform/cc13x4_26x4/args.gni") @@ -50,3 +51,10 @@ matter_software_ver = "0x0001" matter_software_ver_str = "1.0.1+1" custom_factory_data = true + +# ICD Default configurations +chip_enable_icd_server = false +chip_persist_subscriptions = false +chip_subscription_timeout_resumption = false + +freertos_root = "//third_party/connectedhomeip/third_party/ti_simplelink_sdk/repo_cc13xx_cc26xx/source/third_party/freertos" \ No newline at end of file diff --git a/examples/pump-controller-app/cc13x4_26x4/chip.syscfg b/examples/pump-controller-app/cc13x4_26x4/chip.syscfg index 0257d3ed152e5e..b618663622c8bc 100644 --- a/examples/pump-controller-app/cc13x4_26x4/chip.syscfg +++ b/examples/pump-controller-app/cc13x4_26x4/chip.syscfg @@ -168,14 +168,14 @@ LED1.$name = "CONFIG_LED_RED"; LED1.$hardware = system.deviceData.board.components.LED_RED; LED1.gpioPin.$name = "CONFIG_GPIO_RLED"; LED1.gpioPin.mode = "Output"; -LED1.gpioPin.callbackFunction = ""; + /* Green LED */ LED2.$name = "CONFIG_LED_GREEN"; LED2.$hardware = system.deviceData.board.components.LED_GREEN; LED2.gpioPin.$name = "CONFIG_GPIO_GLED"; LED2.gpioPin.mode = "Output"; -LED2.gpioPin.callbackFunction = ""; + /* Debug UART */ UART2.$hardware = system.deviceData.board.components.XDS110UART; diff --git a/examples/pump-controller-app/cc13x4_26x4/main/AppTask.cpp b/examples/pump-controller-app/cc13x4_26x4/main/AppTask.cpp index a8a61bda096d22..b9bc0f0b15b78a 100644 --- a/examples/pump-controller-app/cc13x4_26x4/main/AppTask.cpp +++ b/examples/pump-controller-app/cc13x4_26x4/main/AppTask.cpp @@ -55,6 +55,13 @@ #define APP_TASK_PRIORITY 4 #define APP_EVENT_QUEUE_SIZE 10 +#if (CHIP_CONFIG_ENABLE_ICD_SERVER == 1) +#define LED_ENABLE 0 +#else +#define LED_ENABLE 1 +#endif +#define BUTTON_ENABLE 1 + using namespace ::chip; using namespace ::chip::app; using namespace ::chip::Credentials; @@ -119,11 +126,26 @@ int AppTask::StartAppTask() return ret; } -int AppTask::Init() +// Identify take action +void identify_TakeAction(void) { - LED_Params ledParams; - Button_Params buttonParams; +#ifdef LED_ENABLE + LED_setOn(sAppGreenHandle, LED_BRIGHTNESS_MAX); + LED_startBlinking(sAppGreenHandle, 1000, LED_BLINK_FOREVER); +#endif //LED_ENABLE +} +// Identify stop action +void identify_StopAction(void) +{ +#ifdef LED_ENABLE + LED_stopBlinking(sAppGreenHandle); + LED_setOff(sAppGreenHandle); +#endif //LED_ENABLE +} + +int AppTask::Init() +{ cc13xx_26xxLogInit(); // Init Chip memory management before the stack @@ -147,11 +169,13 @@ int AppTask::Init() #if CHIP_DEVICE_CONFIG_THREAD_FTD ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_Router); -#elif CONFIG_OPENTHREAD_MTD_SED +#else +#if CHIP_DEVICE_CONFIG_ENABLE_SED ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_SleepyEndDevice); #else ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_MinimalEndDevice); -#endif +#endif //CHIP_DEVICE_CONFIG_ENABLE_SED +#endif //CHIP_DEVICE_CONFIG_THREAD_FTD if (ret != CHIP_NO_ERROR) { @@ -195,33 +219,7 @@ int AppTask::Init() (void) initParams.InitializeStaticResourcesBeforeServerInit(); chip::Server::GetInstance().Init(initParams); - // Initialize LEDs - PLAT_LOG("Initialize LEDs"); - LED_init(); - - LED_Params_init(&ledParams); // default PWM LED - sAppRedHandle = LED_open(CONFIG_LED_RED, &ledParams); - LED_setOff(sAppRedHandle); - - LED_Params_init(&ledParams); // default PWM LED - sAppGreenHandle = LED_open(CONFIG_LED_GREEN, &ledParams); - LED_setOff(sAppGreenHandle); - - // Initialize buttons - PLAT_LOG("Initialize buttons"); - Button_init(); - - Button_Params_init(&buttonParams); - buttonParams.buttonEventMask = Button_EV_CLICKED | Button_EV_LONGPRESSED; - buttonParams.longPressDuration = 5000U; // ms - sAppLeftHandle = Button_open(CONFIG_BTN_LEFT, &buttonParams); - Button_setCallback(sAppLeftHandle, ButtonLeftEventHandler); - - Button_Params_init(&buttonParams); - buttonParams.buttonEventMask = Button_EV_CLICKED; - buttonParams.longPressDuration = 1000U; // ms - sAppRightHandle = Button_open(CONFIG_BTN_RIGHT, &buttonParams); - Button_setCallback(sAppRightHandle, ButtonRightEventHandler); + uiInit(); // Initialize Pump module PLAT_LOG("Initialize Pump"); @@ -265,42 +263,6 @@ void AppTask::PostEvent(const AppEvent * aEvent) } } -void AppTask::ButtonLeftEventHandler(Button_Handle handle, Button_EventMask events) -{ - AppEvent event; - event.Type = AppEvent::kEventType_ButtonLeft; - - if (events & Button_EV_CLICKED) - { - event.ButtonEvent.Type = AppEvent::kAppEventButtonType_Clicked; - } - else if (events & Button_EV_LONGPRESSED) - { - event.ButtonEvent.Type = AppEvent::kAppEventButtonType_LongPressed; - } - // button callbacks are in ISR context - if (xQueueSendFromISR(sAppEventQueue, &event, NULL) != pdPASS) - { - /* Failed to post the message */ - } -} - -void AppTask::ButtonRightEventHandler(Button_Handle handle, Button_EventMask events) -{ - AppEvent event; - event.Type = AppEvent::kEventType_ButtonRight; - - if (events & Button_EV_CLICKED) - { - event.ButtonEvent.Type = AppEvent::kAppEventButtonType_Clicked; - } - // button callbacks are in ISR context - if (xQueueSendFromISR(sAppEventQueue, &event, NULL) != pdPASS) - { - /* Failed to post the message */ - } -} - void AppTask::ActionInitiated(PumpManager::Action_t aAction, int32_t aActor) { // If the action has been initiated by the pump, update the pump trait @@ -315,11 +277,12 @@ void AppTask::ActionInitiated(PumpManager::Action_t aAction, int32_t aActor) PLAT_LOG("Stop initiated"); ; // TODO } - +#ifdef LED_ENABLE LED_setOn(sAppGreenHandle, LED_BRIGHTNESS_MAX); LED_startBlinking(sAppGreenHandle, 50 /* ms */, LED_BLINK_FOREVER); LED_setOn(sAppRedHandle, LED_BRIGHTNESS_MAX); LED_startBlinking(sAppRedHandle, 110 /* ms */, LED_BLINK_FOREVER); +#endif } void AppTask::ActionCompleted(PumpManager::Action_t aAction, int32_t aActor) @@ -330,18 +293,22 @@ void AppTask::ActionCompleted(PumpManager::Action_t aAction, int32_t aActor) if (aAction == PumpManager::START_ACTION) { PLAT_LOG("Pump start completed"); +#ifdef LED_ENABLE LED_stopBlinking(sAppGreenHandle); LED_setOn(sAppGreenHandle, LED_BRIGHTNESS_MAX); LED_stopBlinking(sAppRedHandle); LED_setOn(sAppRedHandle, LED_BRIGHTNESS_MAX); +#endif } else if (aAction == PumpManager::STOP_ACTION) { PLAT_LOG("Pump stop completed"); +#ifdef LED_ENABLE LED_stopBlinking(sAppGreenHandle); LED_setOff(sAppGreenHandle); LED_stopBlinking(sAppRedHandle); LED_setOff(sAppRedHandle); +#endif } if (aActor == AppEvent::kEventType_ButtonLeft) { @@ -397,12 +364,12 @@ void AppTask::DispatchEvent(AppEvent * aEvent) break; case AppEvent::kEventType_IdentifyStart: - LED_setOn(sAppGreenHandle, LED_BRIGHTNESS_MAX); - LED_startBlinking(sAppGreenHandle, sIdentifyBlinkRateMs, LED_BLINK_FOREVER); + identify_TakeAction(); PLAT_LOG("Identify started"); break; case AppEvent::kEventType_IdentifyStop: +#ifdef LED_ENABLE LED_stopBlinking(sAppGreenHandle); if (!PumpMgr().IsStopped()) @@ -413,6 +380,7 @@ void AppTask::DispatchEvent(AppEvent * aEvent) { LED_setOff(sAppGreenHandle); } +#endif PLAT_LOG("Identify stopped"); break; @@ -473,3 +441,86 @@ void AppTask::TriggerIdentifyEffectHandler(::Identify * identify) PLAT_LOG("No identifier effect"); } } + + +#ifdef BUTTON_ENABLE +void AppTask::ButtonLeftEventHandler(Button_Handle handle, Button_EventMask events) +{ + AppEvent event; + event.Type = AppEvent::kEventType_ButtonLeft; + + if (events & Button_EV_CLICKED) + { + event.ButtonEvent.Type = AppEvent::kAppEventButtonType_Clicked; + } + else if (events & Button_EV_LONGCLICKED) + { + event.ButtonEvent.Type = AppEvent::kAppEventButtonType_LongClicked; + } + // button callbacks are in ISR context + if (xQueueSendFromISR(sAppEventQueue, &event, NULL) != pdPASS) + { + /* Failed to post the message */ + } +} + +void AppTask::ButtonRightEventHandler(Button_Handle handle, Button_EventMask events) +{ + AppEvent event; + event.Type = AppEvent::kEventType_ButtonRight; + + if (events & Button_EV_CLICKED) + { + event.ButtonEvent.Type = AppEvent::kAppEventButtonType_Clicked; + } + else if (events & Button_EV_LONGCLICKED) + { + event.ButtonEvent.Type = AppEvent::kAppEventButtonType_LongClicked; + } + // button callbacks are in ISR context + if (xQueueSendFromISR(sAppEventQueue, &event, NULL) != pdPASS) + { + /* Failed to post the message */ + } +} +#endif //BUTTON_ENABLE + +void AppTask::uiInit(void) +{ + #ifdef LED_ENABLE + + LED_Params ledParams; + + // Initialize LEDs + PLAT_LOG("Initialize LEDs"); + LED_init(); + + LED_Params_init(&ledParams); // default PWM LED + sAppRedHandle = LED_open(CONFIG_LED_RED, &ledParams); + LED_setOff(sAppRedHandle); + + LED_Params_init(&ledParams); // default PWM LED + sAppGreenHandle = LED_open(CONFIG_LED_GREEN, &ledParams); + LED_setOff(sAppGreenHandle); +#endif //LED ENABLE + +#ifdef BUTTON_ENABLE + Button_Params buttonParams; + + // Initialize buttons + PLAT_LOG("Initialize buttons"); + Button_init(); + + Button_Params_init(&buttonParams); + buttonParams.buttonEventMask = Button_EV_CLICKED | Button_EV_LONGCLICKED; + buttonParams.longPressDuration = 1000U; // ms + sAppLeftHandle = Button_open(CONFIG_BTN_LEFT, &buttonParams); + Button_setCallback(sAppLeftHandle, ButtonLeftEventHandler); + + Button_Params_init(&buttonParams); + buttonParams.buttonEventMask = Button_EV_CLICKED | Button_EV_LONGCLICKED; + buttonParams.longPressDuration = 1000U; // ms + sAppRightHandle = Button_open(CONFIG_BTN_RIGHT, &buttonParams); + Button_setCallback(sAppRightHandle, ButtonRightEventHandler); +#endif //BUTTON ENABLE +} \ No newline at end of file diff --git a/examples/pump-controller-app/cc13x4_26x4/main/include/AppTask.h b/examples/pump-controller-app/cc13x4_26x4/main/include/AppTask.h index bb815585471add..b53663a19684c5 100644 --- a/examples/pump-controller-app/cc13x4_26x4/main/include/AppTask.h +++ b/examples/pump-controller-app/cc13x4_26x4/main/include/AppTask.h @@ -60,6 +60,7 @@ class AppTask static void ActionCompleted(PumpManager::Action_t aAction, int32_t aActor); void DispatchEvent(AppEvent * event); + void uiInit(void); static void ButtonLeftEventHandler(Button_Handle handle, Button_EventMask events); static void ButtonRightEventHandler(Button_Handle handle, Button_EventMask events); diff --git a/examples/pump-controller-app/cc13x4_26x4/main/main.cpp b/examples/pump-controller-app/cc13x4_26x4/main/main.cpp index ba98379ecc741a..84b66b755d1850 100644 --- a/examples/pump-controller-app/cc13x4_26x4/main/main.cpp +++ b/examples/pump-controller-app/cc13x4_26x4/main/main.cpp @@ -48,14 +48,6 @@ uint32_t heapSize = TOTAL_ICALL_HEAP_SIZE; // ================================================================================ // FreeRTOS Callbacks // ================================================================================ -extern "C" void vApplicationStackOverflowHook(void) -{ - while (true) - { - ; - } -} - /* Wrapper functions for using the queue registry regardless of whether it is enabled or disabled */ extern "C" void vQueueAddToRegistryWrapper(QueueHandle_t xQueue, const char * pcQueueName) { diff --git a/examples/shell/cc13x4_26x4/BUILD.gn b/examples/shell/cc13x4_26x4/BUILD.gn index 2480f085783384..16f69243061a26 100644 --- a/examples/shell/cc13x4_26x4/BUILD.gn +++ b/examples/shell/cc13x4_26x4/BUILD.gn @@ -63,9 +63,7 @@ ti_sysconfig("sysconfig") { cflags = [ "-Wno-comment", - "@" + rebase_path("${target_gen_dir}/sysconfig/ti_ble_app_config.opt", - root_build_dir), - "@" + rebase_path("${target_gen_dir}/sysconfig/ti_build_config.opt", + "@" + rebase_path("${target_gen_dir}/sysconfig/ti_utils_build_compiler.opt", root_build_dir), ] } @@ -102,6 +100,10 @@ ti_simplelink_executable("shell_app") { defines = [ "CC13XX_26XX_FACTORY_DATA" ] } + if (chip_enable_icd_server){ + defines += ["CHIP_DEVICE_CONFIG_ENABLE_SED", "TI_ICD_ENABLE_SERVER"] + } + include_dirs = [ "include", "main", diff --git a/examples/shell/cc13x4_26x4/args.gni b/examples/shell/cc13x4_26x4/args.gni index 6726b735b8e43a..21f752427ef41a 100644 --- a/examples/shell/cc13x4_26x4/args.gni +++ b/examples/shell/cc13x4_26x4/args.gni @@ -13,6 +13,7 @@ # limitations under the License. import("//build_overrides/chip.gni") +import("//build_overrides/freertos.gni") import("${chip_root}/examples/platform/cc13x4_26x4/args.gni") ti_simplelink_sdk_target = get_label_info(":sdk", "label_no_toolchain") @@ -51,3 +52,10 @@ matter_software_ver = "0x0001" matter_software_ver_str = "1.0.1+1" custom_factory_data = true + +# ICD Default configurations +chip_enable_icd_server = false +chip_persist_subscriptions = false +chip_subscription_timeout_resumption = false + +freertos_root = "//third_party/connectedhomeip/third_party/ti_simplelink_sdk/repo_cc13xx_cc26xx/source/third_party/freertos" diff --git a/examples/shell/cc13x4_26x4/chip.syscfg b/examples/shell/cc13x4_26x4/chip.syscfg index aca6b1dfcc5136..725bac1377a875 100644 --- a/examples/shell/cc13x4_26x4/chip.syscfg +++ b/examples/shell/cc13x4_26x4/chip.syscfg @@ -168,14 +168,12 @@ LED1.$name = "CONFIG_LED_RED"; LED1.$hardware = system.deviceData.board.components.LED_RED; LED1.gpioPin.$name = "CONFIG_GPIO_RLED"; LED1.gpioPin.mode = "Output"; -LED1.gpioPin.callbackFunction = ""; /* Green LED */ LED2.$name = "CONFIG_LED_GREEN"; LED2.$hardware = system.deviceData.board.components.LED_GREEN; LED2.gpioPin.$name = "CONFIG_GPIO_GLED"; LED2.gpioPin.mode = "Output"; -LED2.gpioPin.callbackFunction = ""; /* Debug UART */ UART2.$hardware = system.deviceData.board.components.XDS110UART; diff --git a/examples/shell/cc13x4_26x4/main/main.cpp b/examples/shell/cc13x4_26x4/main/main.cpp index 93b5f9115428be..5f1e200546a5c3 100644 --- a/examples/shell/cc13x4_26x4/main/main.cpp +++ b/examples/shell/cc13x4_26x4/main/main.cpp @@ -48,14 +48,6 @@ uint32_t heapSize = TOTAL_ICALL_HEAP_SIZE; // ================================================================================ // FreeRTOS Callbacks // ================================================================================ -extern "C" void vApplicationStackOverflowHook(void) -{ - while (true) - { - ; - } -} - /* Wrapper functions for using the queue registry regardless of whether it is enabled or disabled */ extern "C" void vQueueAddToRegistryWrapper(QueueHandle_t xQueue, const char * pcQueueName) { diff --git a/src/platform/cc13xx_26xx/BLEManagerImpl.cpp b/src/platform/cc13xx_26xx/BLEManagerImpl.cpp index 5d5d9d3d9dc8ba..4d0c009eef1f39 100644 --- a/src/platform/cc13xx_26xx/BLEManagerImpl.cpp +++ b/src/platform/cc13xx_26xx/BLEManagerImpl.cpp @@ -395,7 +395,7 @@ void BLEManagerImpl::ConfigureAdvertisements(void) .primChanMap = GAP_ADV_CHAN_ALL, .peerAddrType = PEER_ADDRTYPE_PUBLIC_OR_PUBLIC_ID, .peerAddr = { 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa }, - .filterPolicy = GAP_ADV_WL_POLICY_ANY_REQ, + .filterPolicy = GAP_ADV_AL_POLICY_ANY_REQ, .txPower = GAP_ADV_TX_POWER_NO_PREFERENCE, .primPhy = GAP_ADV_PRIM_PHY_1_MBPS, .secPhy = GAP_ADV_SEC_PHY_1_MBPS, @@ -1309,7 +1309,7 @@ CHIP_ERROR BLEManagerImpl::ProcessParamUpdate(uint16_t connHandle) BLEMGR_LOG("BLEMGR: ProcessParamUpdate"); req.connectionHandle = connHandle; - req.connLatency = DEFAULT_DESIRED_SLAVE_LATENCY; + req.connLatency = DEFAULT_DESIRED_PERIPHERAL_LATENCY; req.connTimeout = DEFAULT_DESIRED_CONN_TIMEOUT; req.intervalMin = DEFAULT_DESIRED_MIN_CONN_INTERVAL; req.intervalMax = DEFAULT_DESIRED_MAX_CONN_INTERVAL; diff --git a/src/platform/cc13xx_26xx/cc13x4_26x4/BLEManagerImpl.h b/src/platform/cc13xx_26xx/cc13x4_26x4/BLEManagerImpl.h index 34c517ed1c166b..b4cf4e26766835 100644 --- a/src/platform/cc13xx_26xx/cc13x4_26x4/BLEManagerImpl.h +++ b/src/platform/cc13xx_26xx/cc13x4_26x4/BLEManagerImpl.h @@ -279,7 +279,7 @@ class BLEManagerImpl final : public BLEManager, private BleLayer, private BlePla CHIPoBLEServiceMode mServiceMode; char mDeviceName[GAP_DEVICE_NAME_LEN]; - ConnRec_t connList[MAX_NUM_BLE_CONNS]; + ConnRec_t connList[LL_MAX_NUM_BLE_CONNS]; // List to store connection handles for queued param updates List_List paramUpdateList; diff --git a/src/platform/cc13xx_26xx/cc13x4_26x4/CHIPPlatformConfig.h b/src/platform/cc13xx_26xx/cc13x4_26x4/CHIPPlatformConfig.h index 70d524af217635..6b5bdf4dc5d011 100644 --- a/src/platform/cc13xx_26xx/cc13x4_26x4/CHIPPlatformConfig.h +++ b/src/platform/cc13xx_26xx/cc13x4_26x4/CHIPPlatformConfig.h @@ -18,7 +18,7 @@ /** * @file * Platform-specific configuration overrides for CHIP on - * the Texas Instruments CC1352 platform. + * the Texas Instruments CC1354 platform. * * NOTE: currently a bare-bones implementation to allow for building. */ @@ -67,3 +67,12 @@ #ifndef CHIP_CONFIG_MAX_FABRICS #define CHIP_CONFIG_MAX_FABRICS 5 #endif + +#ifdef TI_ICD_ENABLE_SERVER +// If ICD server is enabled the device is configured as a sleepy device +#define CHIP_CONFIG_ICD_ACTIVE_MODE_DURATION_MS 3000 +#define CHIP_CONFIG_ICD_ACTIVE_MODE_THRESHOLD_MS 500 +#define CHIP_CONFIG_ICD_IDLE_MODE_DURATION_SEC 360 +#define CHIP_DEVICE_CONFIG_ICD_SLOW_POLL_INTERVAL chip::System::Clock::Milliseconds32(5000) +#define CHIP_DEVICE_CONFIG_ICD_FAST_POLL_INTERVAL chip::System::Clock::Milliseconds32(500) +#endif //TI_ICD_ENABLE_SERVER \ No newline at end of file diff --git a/src/platform/cc13xx_26xx/cc13x4_26x4/ble_user_config.c b/src/platform/cc13xx_26xx/cc13x4_26x4/ble_user_config.c index d5579bff75cb66..44cb9fa286e686 100644 --- a/src/platform/cc13xx_26xx/cc13x4_26x4/ble_user_config.c +++ b/src/platform/cc13xx_26xx/cc13x4_26x4/ble_user_config.c @@ -312,7 +312,7 @@ const stackSpecific_t bleStackConfig = { .maxNumConns = MAX_NUM_BLE_CONNS .maxPduSize = 0, .maxNumPSM = L2CAP_NUM_PSM, .maxNumCoChannels = L2CAP_NUM_CO_CHANNELS, - .maxWhiteListElems = MAX_NUM_WL_ENTRIES, + .maxAcceptListElems = MAX_NUM_AL_ENTRIES, .maxResolvListElems = CFG_MAX_NUM_RL_ENTRIES, .pfnBMAlloc = &pfnBMAlloc, .pfnBMFree = &pfnBMFree, diff --git a/src/platform/cc13xx_26xx/chipOBleProfile.c b/src/platform/cc13xx_26xx/chipOBleProfile.c index b506dc3715cd50..38b5e7dddf1824 100644 --- a/src/platform/cc13xx_26xx/chipOBleProfile.c +++ b/src/platform/cc13xx_26xx/chipOBleProfile.c @@ -169,7 +169,7 @@ bStatus_t CHIPoBLEProfile_AddService(uint32 services) uint8 status; // Allocate Client Characteristic Configuration tables - chipOBleProfileTxStateDataConfig = (gattCharCfg_t *) ICall_malloc((uint_least16_t) (sizeof(gattCharCfg_t) * MAX_NUM_BLE_CONNS)); + chipOBleProfileTxStateDataConfig = (gattCharCfg_t *) ICall_malloc((uint_least16_t) (sizeof(gattCharCfg_t) * LL_MAX_NUM_BLE_CONNS)); if (chipOBleProfileTxStateDataConfig == NULL) { return bleMemAllocError; diff --git a/third_party/ti_simplelink_sdk/BUILD.gn b/third_party/ti_simplelink_sdk/BUILD.gn index 79f2e205b069ac..e7040b16c4667b 100644 --- a/third_party/ti_simplelink_sdk/BUILD.gn +++ b/third_party/ti_simplelink_sdk/BUILD.gn @@ -99,13 +99,13 @@ config("ti_simplelink_freertos_config") { include_dirs = [ "${chip_root}/src/platform/cc13xx_26xx", "${chip_root}/src/platform/cc13xx_26xx/cc13x2_26x2", - "${freertos_root}/repo/portable/GCC/ARM_CM4F", + "${freertos_root}/portable/GCC/ARM_CM4F", ] } else if (ti_simplelink_device_family == "cc13x4_26x4") { include_dirs = [ "${chip_root}/src/platform/cc13xx_26xx/cc13x4_26x4", - "${freertos_root}/repo/portable/GCC/ARM_CM33_NTZ", - "${freertos_root}/repo/portable/GCC/ARM_CM33_NTZ/non_secure", + "${freertos_root}/portable/GCC/ARM_CM33_NTZ", + "${freertos_root}/portable/GCC/ARM_CM33_NTZ/non_secure", "${chip_root}/src/platform/cc13xx_26xx", ] } else if (ti_simplelink_device_family == "cc32xx") { @@ -129,12 +129,12 @@ config("ti_simplelink_posix_config") { freertos_target("freertos") { if (ti_simplelink_device_family == "cc13x2_26x2" || ti_simplelink_device_family == "cc13x2x7_26x2x7") { - sources = [ "${freertos_root}/repo/portable/GCC/ARM_CM4F/port.c" ] + sources = [ "${freertos_root}/portable/GCC/ARM_CM4F/port.c" ] } else if (ti_simplelink_device_family == "cc13x4_26x4" || ti_simplelink_device_family == "cc13x4_26x4") { sources = [ - "${freertos_root}/repo/portable/GCC/ARM_CM33_NTZ/non_secure/port.c", - "${freertos_root}/repo/portable/GCC/ARM_CM33_NTZ/non_secure/portasm.c", + "${freertos_root}/portable/GCC/ARM_CM33_NTZ/non_secure/port.c", + "${freertos_root}/portable/GCC/ARM_CM33_NTZ/non_secure/portasm.c", ] } else if (ti_simplelink_device_family == "cc32xx") { sources = [ diff --git a/third_party/ti_simplelink_sdk/repo_cc13xx_cc26xx b/third_party/ti_simplelink_sdk/repo_cc13xx_cc26xx index 93adb547344293..374a26a45a5b05 160000 --- a/third_party/ti_simplelink_sdk/repo_cc13xx_cc26xx +++ b/third_party/ti_simplelink_sdk/repo_cc13xx_cc26xx @@ -1 +1 @@ -Subproject commit 93adb5473442932cdd056e20770ce1326bd8afb7 +Subproject commit 374a26a45a5b05cd87c62d9a5da04d9e6d0ed319 diff --git a/third_party/ti_simplelink_sdk/run_sdk_drivers_gen.py b/third_party/ti_simplelink_sdk/run_sdk_drivers_gen.py index fbdf81b0dfd8fa..44284f794cad74 100644 --- a/third_party/ti_simplelink_sdk/run_sdk_drivers_gen.py +++ b/third_party/ti_simplelink_sdk/run_sdk_drivers_gen.py @@ -16,7 +16,8 @@ parser = argparse.ArgumentParser() parser.add_argument('--sdk', help="TI SDK root") parser.add_argument('--chip-root', help="CHIP Root") -parser.add_argument('--src-path', help="the path where the built drivers exist") +parser.add_argument('--src-path-drivers', help="the path where the built drivers exist") +parser.add_argument('--src-path-driverlib', help="the path where the built driverlib exist") parser.add_argument('--dest-path', help="path where drivers will be copied to") args = parser.parse_args() @@ -34,21 +35,26 @@ print("Compiler Path is invalid: " + GCC_ARMCOMPILER_PATH) sys.exit(2) -source_file = args.sdk + args.src_path +source_file_drivers = args.sdk + args.src_path_drivers +source_file_driverlib = args.sdk + args.src_path_driverlib dest_path = args.dest_path make_command = ["make", "-C", args.sdk, "CMAKE=cmake", "GCC_ARMCOMPILER=" + GCC_ARMCOMPILER_PATH, "IAR_ARMCOMPILER=", "TICLANG_ARMCOMPILER=", "GENERATOR=Ninja"] - pid = os.fork() if pid: status = os.wait() - if os.path.exists(source_file): - shutil.copy(source_file, dest_path) + if os.path.exists(source_file_drivers): + shutil.copy(source_file_drivers, dest_path) else: print("Driver does not exist or path is incorrect.") sys.exit(2) + if os.path.exists(source_file_driverlib): + shutil.copy(source_file_driverlib, dest_path) + else: + print("Driverlib does not exist or path is incorrect.") + sys.exit(2) else: make_command = ["make", "-C", args.sdk, "CMAKE=cmake", "GCC_ARMCOMPILER=" + GCC_ARMCOMPILER_PATH, "IAR_ARMCOMPILER=", "TICLANG_ARMCOMPILER=", "GENERATOR=Ninja"] diff --git a/third_party/ti_simplelink_sdk/ti_simplelink_board.gni b/third_party/ti_simplelink_sdk/ti_simplelink_board.gni index e1828c9f88f302..146e3dbfb07257 100644 --- a/third_party/ti_simplelink_sdk/ti_simplelink_board.gni +++ b/third_party/ti_simplelink_sdk/ti_simplelink_board.gni @@ -40,6 +40,7 @@ assert(ti_simplelink_board != "", "ti_simplelink_board must be specified") # XXX: Can we do an array with a case statement? if (ti_simplelink_board == "CC1352R1_LAUNCHXL") { ti_simplelink_device_family = "cc13x2_26x2" + ti_simplelink_device_family_driverlib = "cc13x2_cc26x2" ti_simplelink_soc_family = "cc13x2" ti_simplelink_isa = "m4f" @@ -48,6 +49,7 @@ if (ti_simplelink_board == "CC1352R1_LAUNCHXL") { ti_simplelink_bim_name = "cc1352r1lp" } else if (ti_simplelink_board == "CC2652R1_LAUNCHXL") { ti_simplelink_device_family = "cc13x2_26x2" + ti_simplelink_device_family_driverlib = "cc13x2_cc26x2" ti_simplelink_soc_family = "cc26x2" ti_simplelink_isa = "m4f" @@ -57,16 +59,19 @@ if (ti_simplelink_board == "CC1352R1_LAUNCHXL") { } else if (ti_simplelink_board == "LP_EM_CC1354P10_6" || ti_simplelink_board == "LP_EM_CC1354P10_1") { ti_simplelink_device_family = "cc13x4_26x4" + ti_simplelink_device_family_driverlib = "cc13x4_cc26x4" ti_simplelink_soc_family = "cc13x4" ti_simplelink_isa = "m33f" ti_simplelink_soc = "cc1354p10" ti_simplelink_bim_name = "cc1354p10" } else if (ti_simplelink_board == "CC2674") { ti_simplelink_device_family = "cc13x4_26x4" #driverlib paths + ti_simplelink_device_family_driverlib = "cc13x4_cc26x4" ti_simplelink_soc_family = "cc13x4" #ble path ti_simplelink_isa = "m33f" } else if (ti_simplelink_board == "LP_CC2652R7") { ti_simplelink_device_family = "cc13x2x7_26x2x7" + ti_simplelink_device_family_driverlib = "cc13x2x7_cc26x2x7" ti_simplelink_soc_family = "cc26x2x7" ti_simplelink_isa = "m4f" diff --git a/third_party/ti_simplelink_sdk/ti_simplelink_executable.gni b/third_party/ti_simplelink_sdk/ti_simplelink_executable.gni index 1da4bbb0e76763..c887e31e3d79d7 100644 --- a/third_party/ti_simplelink_sdk/ti_simplelink_executable.gni +++ b/third_party/ti_simplelink_sdk/ti_simplelink_executable.gni @@ -280,32 +280,16 @@ template("ti_simplelink_executable") { "-da", matter_ota_digest, ] - + } else { args += [ - "-v", - matter_device_vid, - "-p", - matter_device_pid, - "-vn", - matter_software_ver, - "-vs", - matter_software_ver_str, + "-da", + "sha256", ] - if (defined(invoker.ota_digest)) { - args += [ - "-da", - matter_ota_digest, - ] - } else { - args += [ - "-da", - "sha256", - ] - } - if (defined(invoker.ota_args)) { - args += invoker.ota_args - } } + if (defined(invoker.ota_args)) { + args += invoker.ota_args + } + } } else if (ti_simplelink_device_family == "cc13x4_26x4") { if (custom_factory_data) { @@ -428,15 +412,20 @@ template("ti_simplelink_executable") { ] } - # build MCUBoot bootloader - config("${simplelink_target_name}_mcubootloader_config") { - libs = [ "${ti_simplelink_sdk_root}/source/ti/devices/cc13x4_cc26x4/driverlib/bin/gcc/driverlib.lib" ] - } + #build MCUBoot bootloader + # config("${simplelink_target_name}_mcubootloader_config") { + # # libs = [ "${ti_simplelink_sdk_root}/source/ti/devices/cc13x4_cc26x4/driverlib/bin/gcc/driverlib.lib" ] + # } flashable_executable("${simplelink_target_name}_mcubootloader") { output_name = "${output_base_name}.mcubootloader.out" output_dir = root_out_dir - deps = [ ":${simplelink_target_name}_mcuboot.syscfg" ] - public_configs = [ ":${simplelink_target_name}_mcubootloader_config" ] + deps = [ + ":${simplelink_target_name}_mcuboot.syscfg", + ":build_external_library", + ] + public_configs = [ + ":external_library_config", + ] ldscript = "${ti_simplelink_sdk_build_root}/mcuboot/mcuboot_cc13x4_cc26x4.lds" objcopy_image_name = "${output_base_name}.mcubootloader.hex" diff --git a/third_party/ti_simplelink_sdk/ti_simplelink_sdk.gni b/third_party/ti_simplelink_sdk/ti_simplelink_sdk.gni index 98a6acb916d30e..d3a09d5e63b71f 100644 --- a/third_party/ti_simplelink_sdk/ti_simplelink_sdk.gni +++ b/third_party/ti_simplelink_sdk/ti_simplelink_sdk.gni @@ -14,18 +14,19 @@ import("//build_overrides/build.gni") import("//build_overrides/chip.gni") + import("//build_overrides/freertos.gni") import("//build_overrides/mbedtls.gni") import("//build_overrides/openthread.gni") import("//build_overrides/pigweed.gni") import("//build_overrides/ti_simplelink_sdk.gni") +import("${chip_root}/src/app/icd/icd.gni") import("${chip_root}/src/platform/device.gni") import("${dir_pw_build}/python.gni") -import("${freertos_root}/freertos.gni") + import("${mbedtls_root}/mbedtls.gni") import("ti_simplelink_board.gni") - declare_args() { # Location of the TI SimpleLink SDK. @@ -73,6 +74,8 @@ template("ti_sysconfig") { "-fno-exceptions", "-fno-unwind-tables", ] + + cflags = [ "-Wno-sign-compare" ] defines = [ "DeviceFamily_CC26X2X7" ] } @@ -82,6 +85,7 @@ template("ti_sysconfig") { "-fno-exceptions", "-fno-unwind-tables", ] + cflags = [ "-Wno-sign-compare" ] if (ti_simplelink_device == "") { defines = [ "DeviceFamily_CC13X4" ] } else { @@ -91,6 +95,7 @@ template("ti_sysconfig") { config("cc32xx_${target_name}_config") { ldflags = [ "-nostartfiles" ] + cflags = [ "-Wno-sign-compare" ] defines = [ "CC32XXWARE" ] } @@ -176,21 +181,27 @@ template("ti_simplelink_sdk") { assert(ti_simplelink_sdk_root != "", "ti_simplelink_sdk_root must be specified") - action("build_external_library") { - script = "${ti_simplelink_sdk_build_root}/run_sdk_drivers_gen.py" - outputs = [ "${target_gen_dir}/drivers_${ti_simplelink_soc_family}.a" ] - args = [ - "--sdk", - rebase_path(ti_simplelink_sdk_root), - "--chip-root", - rebase_path(chip_root), - "--src-path", - "/source/ti/drivers/lib/gcc/${ti_simplelink_isa}/drivers_${ti_simplelink_soc_family}.a", - "--dest-path", - rebase_path(target_gen_dir), - ] + if (ti_simplelink_device_family == "cc13x2_26x2" || + ti_simplelink_device_family == "cc13x2x7_26x2x7" || + ti_simplelink_device_family == "cc13x4_26x4") { + action("build_external_library") { + script = "${ti_simplelink_sdk_build_root}/run_sdk_drivers_gen.py" + outputs = [ "${target_gen_dir}/drivers_${ti_simplelink_soc_family}.a" , "${target_gen_dir}/driverlib.lib"] + args = [ + "--sdk", + rebase_path(ti_simplelink_sdk_root), + "--chip-root", + rebase_path(chip_root), + "--src-path-drivers", + "/source/ti/drivers/lib/gcc/${ti_simplelink_isa}/drivers_${ti_simplelink_soc_family}.a", + "--src-path-driverlib", + "/source/ti/devices/${ti_simplelink_device_family_driverlib}/driverlib/bin/gcc/driverlib.lib", + + "--dest-path", + rebase_path(target_gen_dir), + ] + } } - if (defined(invoker.ti_simplelink_sdk_root)) { ti_simplelink_sdk_root = invoker.ti_simplelink_sdk_root } @@ -200,15 +211,13 @@ template("ti_simplelink_sdk") { config("cc13x2_26x2_sdk_config") { libs = [ "${ti_simplelink_sdk_root}/source/ti/drivers/rf/lib/gcc/${ti_simplelink_isa}/rf_multiMode_${ti_simplelink_soc_family}.a", - "${ti_simplelink_sdk_root}/source/ti/devices/cc13x2_cc26x2/driverlib/bin/gcc/driverlib.lib", ] defines = [ "DeviceFamily_CC13X2_CC26X2" ] } config("cc13x2x7_26x2x7_sdk_config") { libs = [ - "${ti_simplelink_sdk_root}/source/ti/drivers/rf/lib/gcc/${ti_simplelink_isa}/rf_multiMode_${ti_simplelink_soc_family}.a", - "${ti_simplelink_sdk_root}/source/ti/devices/cc13x2x7_cc26x2x7/driverlib/bin/gcc/driverlib.lib", + "${ti_simplelink_sdk_root}/source/ti/drivers/rf/lib/gcc/${ti_simplelink_isa}/rf_multiMode_cc26x2.a", ] defines = [ "DeviceFamily_CC13X2X7_CC26X2X7" ] } @@ -216,7 +225,6 @@ template("ti_simplelink_sdk") { config("cc13x4_26x4_sdk_config") { libs = [ "${ti_simplelink_sdk_root}/source/ti/drivers/rf/lib/gcc/${ti_simplelink_isa}/rf_multiMode_${ti_simplelink_soc_family}.a", - "${ti_simplelink_sdk_root}/source/ti/devices/cc13x4_cc26x4/driverlib/bin/gcc/driverlib.lib", ] defines = [ "FLASH_ONLY_BUILD" ] if (ti_simplelink_device == "") { @@ -248,13 +256,18 @@ template("ti_simplelink_sdk") { ] } - config("external_library_config") { - libs = [ "${target_gen_dir}/drivers_cc13x4.a" ] - } + + if (ti_simplelink_device_family == "cc13x2_26x2" || + ti_simplelink_device_family == "cc13x2x7_26x2x7" || + ti_simplelink_device_family == "cc13x4_26x4") { + config("external_library_config") { + libs = [ "${target_gen_dir}/drivers_${ti_simplelink_soc_family}.a", "${target_gen_dir}/driverlib.lib" ] + } - group("external_library") { - public_configs = [ ":external_library_config" ] - deps = [ ":build_external_library" ] + group("external_library") { + public_configs = [ ":external_library_config" ] + deps = [ ":build_external_library" ] + } } config("${sdk_target_name}_config") { @@ -268,8 +281,6 @@ template("ti_simplelink_sdk") { include_dirs += invoker.include_dirs } - forward_variables_from(invoker, [ "defines" ]) - configs = [ ":${ti_simplelink_device_family}_sdk_config" ] } @@ -358,7 +369,10 @@ template("ti_simplelink_sdk") { "${ti_simplelink_sdk_root}/source/ti/posix/freertos/timer.c", ] - public_deps = [ ":${sdk_target_name}_dpl" ] + public_deps = [ + ":${sdk_target_name}_dpl", + "${chip_root}/third_party/ti_simplelink_sdk:ti_simplelink_sysconfig", + ] public_configs = [ ":${sdk_target_name}_config" ] } @@ -766,19 +780,69 @@ template("ti_simplelink_sdk") { public_deps = [ ":${sdk_target_name}_dpl", ":${sdk_target_name}_freertos", - ":build_external_library", ] if (ti_simplelink_device_family == "cc13x2_26x2" || ti_simplelink_device_family == "cc13x2x7_26x2x7" || ti_simplelink_device_family == "cc13x4_26x4") { public_deps += [ + ":build_external_library", ":${sdk_target_name}_dmm", ":${sdk_target_name}_nvocmp", ] } if (defined(invoker.public_configs)) { public_configs = invoker.public_configs - public_configs += [ ":external_library_config" ] + if (ti_simplelink_device_family == "cc13x2_26x2" || + ti_simplelink_device_family == "cc13x2x7_26x2x7" || + ti_simplelink_device_family == "cc13x4_26x4") { + public_configs += [ ":external_library_config" ] + } } } } + +template("freertos_target") { + freertos_target_name = target_name + + if (ti_simplelink_device_family == "cc13x2_26x2" || + ti_simplelink_device_family == "cc13x2x7_26x2x7" || + ti_simplelink_device_family == "cc13x4_26x4") { + _freertos_root = "${freertos_root}" + } + else{ + _freertos_root = "${freertos_root}/repo" + } + + config("${freertos_target_name}_config") { + include_dirs = [ "${_freertos_root}/include" ] + } + + source_set(freertos_target_name) { + forward_variables_from(invoker, "*") + + if (!defined(sources)) { + sources = [] + } + + sources += [ + "${_freertos_root}/croutine.c", + "${_freertos_root}/event_groups.c", + "${_freertos_root}/list.c", + "${_freertos_root}/queue.c", + "${_freertos_root}/stream_buffer.c", + "${_freertos_root}/tasks.c", + "${_freertos_root}/timers.c", + ] + + if (!defined(configs)) { + configs = [] + } + + if (!defined(public_configs)) { + public_configs = [] + } + + public_configs += [ ":${freertos_target_name}_config" ] + } +} + From 8f60e3173fd4e757c6d62c2973a6ed48ddae9251 Mon Sep 17 00:00:00 2001 From: abiradarti Date: Tue, 2 Apr 2024 18:55:25 -0500 Subject: [PATCH 2/9] spelling fix --- docs/guides/ti/enabling_icd_on_ti_devices.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/guides/ti/enabling_icd_on_ti_devices.md b/docs/guides/ti/enabling_icd_on_ti_devices.md index c09f57435f1482..44cd6e74494c5a 100644 --- a/docs/guides/ti/enabling_icd_on_ti_devices.md +++ b/docs/guides/ti/enabling_icd_on_ti_devices.md @@ -21,7 +21,7 @@ chip_persist_subscriptions = true Subscription timeout resumption allows devices to attempt re-establishing subscriptions that may have expired. This feature is disabled out of box. -In addition, various ICD parameters such as idle/active mode durations, active mode threshold, and polling intervals can be configured in `src/platform/cc13xx_26xx/cc13x4_26x4/CHIPPlatformConfig.h` +In addition, various ICD parameters such as idle/active mode duration, active mode threshold, and polling intervals can be configured in `src/platform/cc13xx_26xx/cc13x4_26x4/CHIPPlatformConfig.h` ``` #define CHIP_CONFIG_ICD_ACTIVE_MODE_DURATION_MS 1000 From af5ece84e89880dd503aab714902b7ba5d3d5c04 Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Tue, 2 Apr 2024 23:53:47 +0000 Subject: [PATCH 3/9] Restyled by whitespace --- examples/all-clusters-app/cc13x4_26x4/main/AppTask.cpp | 2 +- examples/pump-app/cc13x4_26x4/main/AppTask.cpp | 2 +- examples/pump-controller-app/cc13x4_26x4/main/AppTask.cpp | 6 +++--- src/platform/cc13xx_26xx/cc13x4_26x4/CHIPPlatformConfig.h | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/all-clusters-app/cc13x4_26x4/main/AppTask.cpp b/examples/all-clusters-app/cc13x4_26x4/main/AppTask.cpp index 56bbf68c86ec12..309fce1efab5d6 100644 --- a/examples/all-clusters-app/cc13x4_26x4/main/AppTask.cpp +++ b/examples/all-clusters-app/cc13x4_26x4/main/AppTask.cpp @@ -426,4 +426,4 @@ void AppTask::uiInit(void) sAppRightHandle = Button_open(CONFIG_BTN_RIGHT, &buttonParams); Button_setCallback(sAppRightHandle, ButtonRightEventHandler); #endif //BUTTON ENABLE -} \ No newline at end of file +} diff --git a/examples/pump-app/cc13x4_26x4/main/AppTask.cpp b/examples/pump-app/cc13x4_26x4/main/AppTask.cpp index 689c300d8665f5..225ea73f8339c0 100644 --- a/examples/pump-app/cc13x4_26x4/main/AppTask.cpp +++ b/examples/pump-app/cc13x4_26x4/main/AppTask.cpp @@ -713,4 +713,4 @@ void AppTask::uiInit(void) sAppRightHandle = Button_open(CONFIG_BTN_RIGHT, &buttonParams); Button_setCallback(sAppRightHandle, ButtonRightEventHandler); #endif //BUTTON ENABLE -} \ No newline at end of file +} diff --git a/examples/pump-controller-app/cc13x4_26x4/main/AppTask.cpp b/examples/pump-controller-app/cc13x4_26x4/main/AppTask.cpp index b9bc0f0b15b78a..ec22fcbabfd4f1 100644 --- a/examples/pump-controller-app/cc13x4_26x4/main/AppTask.cpp +++ b/examples/pump-controller-app/cc13x4_26x4/main/AppTask.cpp @@ -298,7 +298,7 @@ void AppTask::ActionCompleted(PumpManager::Action_t aAction, int32_t aActor) LED_setOn(sAppGreenHandle, LED_BRIGHTNESS_MAX); LED_stopBlinking(sAppRedHandle); LED_setOn(sAppRedHandle, LED_BRIGHTNESS_MAX); -#endif +#endif } else if (aAction == PumpManager::STOP_ACTION) { @@ -308,7 +308,7 @@ void AppTask::ActionCompleted(PumpManager::Action_t aAction, int32_t aActor) LED_setOff(sAppGreenHandle); LED_stopBlinking(sAppRedHandle); LED_setOff(sAppRedHandle); -#endif +#endif } if (aActor == AppEvent::kEventType_ButtonLeft) { @@ -523,4 +523,4 @@ void AppTask::uiInit(void) sAppRightHandle = Button_open(CONFIG_BTN_RIGHT, &buttonParams); Button_setCallback(sAppRightHandle, ButtonRightEventHandler); #endif //BUTTON ENABLE -} \ No newline at end of file +} diff --git a/src/platform/cc13xx_26xx/cc13x4_26x4/CHIPPlatformConfig.h b/src/platform/cc13xx_26xx/cc13x4_26x4/CHIPPlatformConfig.h index 6b5bdf4dc5d011..67480a65ed5fd6 100644 --- a/src/platform/cc13xx_26xx/cc13x4_26x4/CHIPPlatformConfig.h +++ b/src/platform/cc13xx_26xx/cc13x4_26x4/CHIPPlatformConfig.h @@ -75,4 +75,4 @@ #define CHIP_CONFIG_ICD_IDLE_MODE_DURATION_SEC 360 #define CHIP_DEVICE_CONFIG_ICD_SLOW_POLL_INTERVAL chip::System::Clock::Milliseconds32(5000) #define CHIP_DEVICE_CONFIG_ICD_FAST_POLL_INTERVAL chip::System::Clock::Milliseconds32(500) -#endif //TI_ICD_ENABLE_SERVER \ No newline at end of file +#endif //TI_ICD_ENABLE_SERVER From 9fcff722c4d5aad4b25d4080129137faa1e88128 Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Tue, 2 Apr 2024 23:53:48 +0000 Subject: [PATCH 4/9] Restyled by clang-format --- .../cc13x4_26x4/main/AppTask.cpp | 62 +++++++------- .../lighting-app/cc13x4_26x4/src/AppTask.cpp | 80 +++++++++---------- examples/lock-app/cc13x4_26x4/src/AppTask.cpp | 68 ++++++++-------- .../pump-app/cc13x4_26x4/main/AppTask.cpp | 68 ++++++++-------- .../cc13x4_26x4/main/AppTask.cpp | 71 ++++++++-------- .../cc13x4_26x4/CHIPPlatformConfig.h | 2 +- .../cc13xx_26xx/cc13x4_26x4/ble_user_config.c | 2 +- src/platform/cc13xx_26xx/chipOBleProfile.c | 3 +- 8 files changed, 176 insertions(+), 180 deletions(-) diff --git a/examples/all-clusters-app/cc13x4_26x4/main/AppTask.cpp b/examples/all-clusters-app/cc13x4_26x4/main/AppTask.cpp index 309fce1efab5d6..f25acf1957a4af 100644 --- a/examples/all-clusters-app/cc13x4_26x4/main/AppTask.cpp +++ b/examples/all-clusters-app/cc13x4_26x4/main/AppTask.cpp @@ -290,8 +290,6 @@ void AppTask::PostEvent(const AppEvent * aEvent) } } - - void AppTask::DispatchEvent(AppEvent * aEvent) { switch (aEvent->Type) @@ -390,40 +388,40 @@ void AppTask::ButtonRightEventHandler(Button_Handle handle, Button_EventMask eve void AppTask::uiInit(void) { - #ifdef LED_ENABLE +#ifdef LED_ENABLE - LED_Params ledParams; + LED_Params ledParams; - // Initialize LEDs - PLAT_LOG("Initialize LEDs"); - LED_init(); + // Initialize LEDs + PLAT_LOG("Initialize LEDs"); + LED_init(); - LED_Params_init(&ledParams); // default PWM LED - sAppRedHandle = LED_open(CONFIG_LED_RED, &ledParams); - LED_setOff(sAppRedHandle); + LED_Params_init(&ledParams); // default PWM LED + sAppRedHandle = LED_open(CONFIG_LED_RED, &ledParams); + LED_setOff(sAppRedHandle); - LED_Params_init(&ledParams); // default PWM LED - sAppGreenHandle = LED_open(CONFIG_LED_GREEN, &ledParams); - LED_setOff(sAppGreenHandle); -#endif //LED ENABLE + LED_Params_init(&ledParams); // default PWM LED + sAppGreenHandle = LED_open(CONFIG_LED_GREEN, &ledParams); + LED_setOff(sAppGreenHandle); +#endif // LED ENABLE #ifdef BUTTON_ENABLE - Button_Params buttonParams; - - // Initialize buttons - PLAT_LOG("Initialize buttons"); - Button_init(); - - Button_Params_init(&buttonParams); - buttonParams.buttonEventMask = Button_EV_CLICKED | Button_EV_LONGCLICKED; - buttonParams.longPressDuration = 1000U; // ms - sAppLeftHandle = Button_open(CONFIG_BTN_LEFT, &buttonParams); - Button_setCallback(sAppLeftHandle, ButtonLeftEventHandler); - - Button_Params_init(&buttonParams); - buttonParams.buttonEventMask = Button_EV_CLICKED | Button_EV_LONGCLICKED; - buttonParams.longPressDuration = 1000U; // ms - sAppRightHandle = Button_open(CONFIG_BTN_RIGHT, &buttonParams); - Button_setCallback(sAppRightHandle, ButtonRightEventHandler); -#endif //BUTTON ENABLE + Button_Params buttonParams; + + // Initialize buttons + PLAT_LOG("Initialize buttons"); + Button_init(); + + Button_Params_init(&buttonParams); + buttonParams.buttonEventMask = Button_EV_CLICKED | Button_EV_LONGCLICKED; + buttonParams.longPressDuration = 1000U; // ms + sAppLeftHandle = Button_open(CONFIG_BTN_LEFT, &buttonParams); + Button_setCallback(sAppLeftHandle, ButtonLeftEventHandler); + + Button_Params_init(&buttonParams); + buttonParams.buttonEventMask = Button_EV_CLICKED | Button_EV_LONGCLICKED; + buttonParams.longPressDuration = 1000U; // ms + sAppRightHandle = Button_open(CONFIG_BTN_RIGHT, &buttonParams); + Button_setCallback(sAppRightHandle, ButtonRightEventHandler); +#endif // BUTTON ENABLE } diff --git a/examples/lighting-app/cc13x4_26x4/src/AppTask.cpp b/examples/lighting-app/cc13x4_26x4/src/AppTask.cpp index 1d2bcea24a097d..c6b6f3184d0d05 100644 --- a/examples/lighting-app/cc13x4_26x4/src/AppTask.cpp +++ b/examples/lighting-app/cc13x4_26x4/src/AppTask.cpp @@ -95,7 +95,6 @@ void uiTurnedOn(void); void uiTurnOff(void); void uiTurnedOff(void); - #if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR static DefaultOTARequestor sRequestorCore; static DefaultOTARequestorStorage sRequestorStorage; @@ -148,7 +147,7 @@ void identify_TakeAction(void) #ifdef LED_ENABLE LED_setOn(sAppGreenHandle, LED_BRIGHTNESS_MAX); LED_startBlinking(sAppGreenHandle, 1000, LED_BLINK_FOREVER); -#endif //LED_ENABLE +#endif // LED_ENABLE } // Identify stop action @@ -157,7 +156,7 @@ void identify_StopAction(void) #ifdef LED_ENABLE LED_stopBlinking(sAppGreenHandle); LED_setOff(sAppGreenHandle); -#endif //LED_ENABLE +#endif // LED_ENABLE } int AppTask::Init() @@ -189,8 +188,8 @@ int AppTask::Init() ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_SleepyEndDevice); #else ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_MinimalEndDevice); -#endif //CHIP_DEVICE_CONFIG_ENABLE_SED -#endif //CHIP_DEVICE_CONFIG_THREAD_FTD +#endif // CHIP_DEVICE_CONFIG_ENABLE_SED +#endif // CHIP_DEVICE_CONFIG_THREAD_FTD if (ret != CHIP_NO_ERROR) { PLAT_LOG("ConnectivityMgr().SetThreadDeviceType() failed"); @@ -483,7 +482,7 @@ void uiTurnOn(void) #ifdef LED_ENABLE LED_setOn(sAppRedHandle, LED_BRIGHTNESS_MAX); LED_startBlinking(sAppRedHandle, 110 /* ms */, LED_BLINK_FOREVER); -#endif //LED_ENABLE +#endif // LED_ENABLE } // Action completed callback @@ -493,7 +492,7 @@ void uiTurnedOn(void) #ifdef LED_ENABLE LED_stopBlinking(sAppRedHandle); LED_setOn(sAppRedHandle, LED_BRIGHTNESS_MAX); -#endif //LED_ENABLE +#endif // LED_ENABLE } // Action initiated callback @@ -503,7 +502,7 @@ void uiTurnOff(void) #ifdef LED_ENABLE LED_setOn(sAppRedHandle, LED_BRIGHTNESS_MAX); LED_startBlinking(sAppRedHandle, 110 /* ms */, LED_BLINK_FOREVER); -#endif //LED_ENABLE +#endif // LED_ENABLE } // Action completed callback @@ -513,10 +512,9 @@ void uiTurnedOff(void) #ifdef LED_ENABLE LED_stopBlinking(sAppRedHandle); LED_setOff(sAppRedHandle); -#endif //LED_ENABLE +#endif // LED_ENABLE } - #ifdef BUTTON_ENABLE void AppTask::ButtonLeftEventHandler(Button_Handle handle, Button_EventMask events) { @@ -557,44 +555,44 @@ void AppTask::ButtonRightEventHandler(Button_Handle handle, Button_EventMask eve /* Failed to post the message */ } } -#endif //BUTTON_ENABLE +#endif // BUTTON_ENABLE void AppTask::uiInit(void) { - #ifdef LED_ENABLE +#ifdef LED_ENABLE - LED_Params ledParams; + LED_Params ledParams; - // Initialize LEDs - PLAT_LOG("Initialize LEDs"); - LED_init(); + // Initialize LEDs + PLAT_LOG("Initialize LEDs"); + LED_init(); - LED_Params_init(&ledParams); // default PWM LED - sAppRedHandle = LED_open(CONFIG_LED_RED, &ledParams); - LED_setOff(sAppRedHandle); + LED_Params_init(&ledParams); // default PWM LED + sAppRedHandle = LED_open(CONFIG_LED_RED, &ledParams); + LED_setOff(sAppRedHandle); - LED_Params_init(&ledParams); // default PWM LED - sAppGreenHandle = LED_open(CONFIG_LED_GREEN, &ledParams); - LED_setOff(sAppGreenHandle); -#endif //LED ENABLE + LED_Params_init(&ledParams); // default PWM LED + sAppGreenHandle = LED_open(CONFIG_LED_GREEN, &ledParams); + LED_setOff(sAppGreenHandle); +#endif // LED ENABLE #ifdef BUTTON_ENABLE - Button_Params buttonParams; - - // Initialize buttons - PLAT_LOG("Initialize buttons"); - Button_init(); - - Button_Params_init(&buttonParams); - buttonParams.buttonEventMask = Button_EV_CLICKED | Button_EV_LONGCLICKED; - buttonParams.longPressDuration = 1000U; // ms - sAppLeftHandle = Button_open(CONFIG_BTN_LEFT, &buttonParams); - Button_setCallback(sAppLeftHandle, ButtonLeftEventHandler); - - Button_Params_init(&buttonParams); - buttonParams.buttonEventMask = Button_EV_CLICKED | Button_EV_LONGCLICKED; - buttonParams.longPressDuration = 1000U; // ms - sAppRightHandle = Button_open(CONFIG_BTN_RIGHT, &buttonParams); - Button_setCallback(sAppRightHandle, ButtonRightEventHandler); -#endif //BUTTON ENABLE + Button_Params buttonParams; + + // Initialize buttons + PLAT_LOG("Initialize buttons"); + Button_init(); + + Button_Params_init(&buttonParams); + buttonParams.buttonEventMask = Button_EV_CLICKED | Button_EV_LONGCLICKED; + buttonParams.longPressDuration = 1000U; // ms + sAppLeftHandle = Button_open(CONFIG_BTN_LEFT, &buttonParams); + Button_setCallback(sAppLeftHandle, ButtonLeftEventHandler); + + Button_Params_init(&buttonParams); + buttonParams.buttonEventMask = Button_EV_CLICKED | Button_EV_LONGCLICKED; + buttonParams.longPressDuration = 1000U; // ms + sAppRightHandle = Button_open(CONFIG_BTN_RIGHT, &buttonParams); + Button_setCallback(sAppRightHandle, ButtonRightEventHandler); +#endif // BUTTON ENABLE } diff --git a/examples/lock-app/cc13x4_26x4/src/AppTask.cpp b/examples/lock-app/cc13x4_26x4/src/AppTask.cpp index aef4d52d755983..b15665b716509a 100644 --- a/examples/lock-app/cc13x4_26x4/src/AppTask.cpp +++ b/examples/lock-app/cc13x4_26x4/src/AppTask.cpp @@ -139,7 +139,7 @@ void identify_TakeAction(void) #ifdef LED_ENABLE LED_setOn(sAppGreenHandle, LED_BRIGHTNESS_MAX); LED_startBlinking(sAppGreenHandle, 1000, LED_BLINK_FOREVER); -#endif //LED_ENABLE +#endif // LED_ENABLE } // Identify stop action @@ -148,7 +148,7 @@ void identify_StopAction(void) #ifdef LED_ENABLE LED_stopBlinking(sAppGreenHandle); LED_setOff(sAppGreenHandle); -#endif //LED_ENABLE +#endif // LED_ENABLE } int AppTask::Init() @@ -179,8 +179,8 @@ int AppTask::Init() #if CHIP_DEVICE_CONFIG_ENABLE_SED ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_SleepyEndDevice); ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_MinimalEndDevice); -#endif //CHIP_DEVICE_CONFIG_ENABLE_SED -#endif //CHIP_DEVICE_CONFIG_THREAD_FTD +#endif // CHIP_DEVICE_CONFIG_ENABLE_SED +#endif // CHIP_DEVICE_CONFIG_THREAD_FTD if (ret != CHIP_NO_ERROR) { @@ -577,44 +577,44 @@ void AppTask::ButtonRightEventHandler(Button_Handle handle, Button_EventMask eve /* Failed to post the message */ } } -#endif //BUTTON_ENABLE +#endif // BUTTON_ENABLE void AppTask::uiInit(void) { #ifdef LED_ENABLE - LED_Params ledParams; + LED_Params ledParams; - // Initialize LEDs - PLAT_LOG("Initialize LEDs"); - LED_init(); + // Initialize LEDs + PLAT_LOG("Initialize LEDs"); + LED_init(); - LED_Params_init(&ledParams); // default PWM LED - sAppRedHandle = LED_open(CONFIG_LED_RED, &ledParams); - LED_setOff(sAppRedHandle); + LED_Params_init(&ledParams); // default PWM LED + sAppRedHandle = LED_open(CONFIG_LED_RED, &ledParams); + LED_setOff(sAppRedHandle); - LED_Params_init(&ledParams); // default PWM LED - sAppGreenHandle = LED_open(CONFIG_LED_GREEN, &ledParams); - LED_setOff(sAppGreenHandle); -#endif //LED ENABLE + LED_Params_init(&ledParams); // default PWM LED + sAppGreenHandle = LED_open(CONFIG_LED_GREEN, &ledParams); + LED_setOff(sAppGreenHandle); +#endif // LED ENABLE #ifdef BUTTON_ENABLE - Button_Params buttonParams; - - // Initialize buttons - PLAT_LOG("Initialize buttons"); - Button_init(); - - Button_Params_init(&buttonParams); - buttonParams.buttonEventMask = Button_EV_CLICKED | Button_EV_LONGCLICKED; - buttonParams.longPressDuration = 1000U; // ms - sAppLeftHandle = Button_open(CONFIG_BTN_LEFT, &buttonParams); - Button_setCallback(sAppLeftHandle, ButtonLeftEventHandler); - - Button_Params_init(&buttonParams); - buttonParams.buttonEventMask = Button_EV_CLICKED | Button_EV_LONGCLICKED; - buttonParams.longPressDuration = 1000U; // ms - sAppRightHandle = Button_open(CONFIG_BTN_RIGHT, &buttonParams); - Button_setCallback(sAppRightHandle, ButtonRightEventHandler); -#endif //BUTTON ENABLE + Button_Params buttonParams; + + // Initialize buttons + PLAT_LOG("Initialize buttons"); + Button_init(); + + Button_Params_init(&buttonParams); + buttonParams.buttonEventMask = Button_EV_CLICKED | Button_EV_LONGCLICKED; + buttonParams.longPressDuration = 1000U; // ms + sAppLeftHandle = Button_open(CONFIG_BTN_LEFT, &buttonParams); + Button_setCallback(sAppLeftHandle, ButtonLeftEventHandler); + + Button_Params_init(&buttonParams); + buttonParams.buttonEventMask = Button_EV_CLICKED | Button_EV_LONGCLICKED; + buttonParams.longPressDuration = 1000U; // ms + sAppRightHandle = Button_open(CONFIG_BTN_RIGHT, &buttonParams); + Button_setCallback(sAppRightHandle, ButtonRightEventHandler); +#endif // BUTTON ENABLE } diff --git a/examples/pump-app/cc13x4_26x4/main/AppTask.cpp b/examples/pump-app/cc13x4_26x4/main/AppTask.cpp index 225ea73f8339c0..44f7154cabb8d0 100644 --- a/examples/pump-app/cc13x4_26x4/main/AppTask.cpp +++ b/examples/pump-app/cc13x4_26x4/main/AppTask.cpp @@ -168,8 +168,8 @@ int AppTask::Init() ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_SleepyEndDevice); #else ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_MinimalEndDevice); -#endif //CHIP_DEVICE_CONFIG_ENABLE_SED -#endif //CHIP_DEVICE_CONFIG_THREAD_FTD +#endif // CHIP_DEVICE_CONFIG_ENABLE_SED +#endif // CHIP_DEVICE_CONFIG_THREAD_FTD if (ret != CHIP_NO_ERROR) { PLAT_LOG("ConnectivityMgr().SetThreadDeviceType() failed"); @@ -185,7 +185,7 @@ int AppTask::Init() ; } - uiInit(); + uiInit(); // Initialize device attestation config #ifdef CC13X4_26X4_ATTESTATION_CREDENTIALS @@ -673,44 +673,44 @@ void AppTask::ButtonRightEventHandler(Button_Handle handle, Button_EventMask eve /* Failed to post the message */ } } -#endif //BUTTON_ENABLE +#endif // BUTTON_ENABLE void AppTask::uiInit(void) { - #ifdef LED_ENABLE +#ifdef LED_ENABLE - LED_Params ledParams; + LED_Params ledParams; - // Initialize LEDs - PLAT_LOG("Initialize LEDs"); - LED_init(); + // Initialize LEDs + PLAT_LOG("Initialize LEDs"); + LED_init(); - LED_Params_init(&ledParams); // default PWM LED - sAppRedHandle = LED_open(CONFIG_LED_RED, &ledParams); - LED_setOff(sAppRedHandle); + LED_Params_init(&ledParams); // default PWM LED + sAppRedHandle = LED_open(CONFIG_LED_RED, &ledParams); + LED_setOff(sAppRedHandle); - LED_Params_init(&ledParams); // default PWM LED - sAppGreenHandle = LED_open(CONFIG_LED_GREEN, &ledParams); - LED_setOff(sAppGreenHandle); -#endif //LED ENABLE + LED_Params_init(&ledParams); // default PWM LED + sAppGreenHandle = LED_open(CONFIG_LED_GREEN, &ledParams); + LED_setOff(sAppGreenHandle); +#endif // LED ENABLE #ifdef BUTTON_ENABLE - Button_Params buttonParams; - - // Initialize buttons - PLAT_LOG("Initialize buttons"); - Button_init(); - - Button_Params_init(&buttonParams); - buttonParams.buttonEventMask = Button_EV_CLICKED | Button_EV_LONGCLICKED; - buttonParams.longPressDuration = 1000U; // ms - sAppLeftHandle = Button_open(CONFIG_BTN_LEFT, &buttonParams); - Button_setCallback(sAppLeftHandle, ButtonLeftEventHandler); - - Button_Params_init(&buttonParams); - buttonParams.buttonEventMask = Button_EV_CLICKED | Button_EV_LONGCLICKED; - buttonParams.longPressDuration = 1000U; // ms - sAppRightHandle = Button_open(CONFIG_BTN_RIGHT, &buttonParams); - Button_setCallback(sAppRightHandle, ButtonRightEventHandler); -#endif //BUTTON ENABLE + Button_Params buttonParams; + + // Initialize buttons + PLAT_LOG("Initialize buttons"); + Button_init(); + + Button_Params_init(&buttonParams); + buttonParams.buttonEventMask = Button_EV_CLICKED | Button_EV_LONGCLICKED; + buttonParams.longPressDuration = 1000U; // ms + sAppLeftHandle = Button_open(CONFIG_BTN_LEFT, &buttonParams); + Button_setCallback(sAppLeftHandle, ButtonLeftEventHandler); + + Button_Params_init(&buttonParams); + buttonParams.buttonEventMask = Button_EV_CLICKED | Button_EV_LONGCLICKED; + buttonParams.longPressDuration = 1000U; // ms + sAppRightHandle = Button_open(CONFIG_BTN_RIGHT, &buttonParams); + Button_setCallback(sAppRightHandle, ButtonRightEventHandler); +#endif // BUTTON ENABLE } diff --git a/examples/pump-controller-app/cc13x4_26x4/main/AppTask.cpp b/examples/pump-controller-app/cc13x4_26x4/main/AppTask.cpp index ec22fcbabfd4f1..da37ae6e2db91a 100644 --- a/examples/pump-controller-app/cc13x4_26x4/main/AppTask.cpp +++ b/examples/pump-controller-app/cc13x4_26x4/main/AppTask.cpp @@ -132,7 +132,7 @@ void identify_TakeAction(void) #ifdef LED_ENABLE LED_setOn(sAppGreenHandle, LED_BRIGHTNESS_MAX); LED_startBlinking(sAppGreenHandle, 1000, LED_BLINK_FOREVER); -#endif //LED_ENABLE +#endif // LED_ENABLE } // Identify stop action @@ -141,7 +141,7 @@ void identify_StopAction(void) #ifdef LED_ENABLE LED_stopBlinking(sAppGreenHandle); LED_setOff(sAppGreenHandle); -#endif //LED_ENABLE +#endif // LED_ENABLE } int AppTask::Init() @@ -174,8 +174,8 @@ int AppTask::Init() ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_SleepyEndDevice); #else ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_MinimalEndDevice); -#endif //CHIP_DEVICE_CONFIG_ENABLE_SED -#endif //CHIP_DEVICE_CONFIG_THREAD_FTD +#endif // CHIP_DEVICE_CONFIG_ENABLE_SED +#endif // CHIP_DEVICE_CONFIG_THREAD_FTD if (ret != CHIP_NO_ERROR) { @@ -442,7 +442,6 @@ void AppTask::TriggerIdentifyEffectHandler(::Identify * identify) } } - #ifdef BUTTON_ENABLE void AppTask::ButtonLeftEventHandler(Button_Handle handle, Button_EventMask events) { @@ -483,44 +482,44 @@ void AppTask::ButtonRightEventHandler(Button_Handle handle, Button_EventMask eve /* Failed to post the message */ } } -#endif //BUTTON_ENABLE +#endif // BUTTON_ENABLE void AppTask::uiInit(void) { - #ifdef LED_ENABLE +#ifdef LED_ENABLE - LED_Params ledParams; + LED_Params ledParams; - // Initialize LEDs - PLAT_LOG("Initialize LEDs"); - LED_init(); + // Initialize LEDs + PLAT_LOG("Initialize LEDs"); + LED_init(); - LED_Params_init(&ledParams); // default PWM LED - sAppRedHandle = LED_open(CONFIG_LED_RED, &ledParams); - LED_setOff(sAppRedHandle); + LED_Params_init(&ledParams); // default PWM LED + sAppRedHandle = LED_open(CONFIG_LED_RED, &ledParams); + LED_setOff(sAppRedHandle); - LED_Params_init(&ledParams); // default PWM LED - sAppGreenHandle = LED_open(CONFIG_LED_GREEN, &ledParams); - LED_setOff(sAppGreenHandle); -#endif //LED ENABLE + LED_Params_init(&ledParams); // default PWM LED + sAppGreenHandle = LED_open(CONFIG_LED_GREEN, &ledParams); + LED_setOff(sAppGreenHandle); +#endif // LED ENABLE #ifdef BUTTON_ENABLE - Button_Params buttonParams; - - // Initialize buttons - PLAT_LOG("Initialize buttons"); - Button_init(); - - Button_Params_init(&buttonParams); - buttonParams.buttonEventMask = Button_EV_CLICKED | Button_EV_LONGCLICKED; - buttonParams.longPressDuration = 1000U; // ms - sAppLeftHandle = Button_open(CONFIG_BTN_LEFT, &buttonParams); - Button_setCallback(sAppLeftHandle, ButtonLeftEventHandler); - - Button_Params_init(&buttonParams); - buttonParams.buttonEventMask = Button_EV_CLICKED | Button_EV_LONGCLICKED; - buttonParams.longPressDuration = 1000U; // ms - sAppRightHandle = Button_open(CONFIG_BTN_RIGHT, &buttonParams); - Button_setCallback(sAppRightHandle, ButtonRightEventHandler); -#endif //BUTTON ENABLE + Button_Params buttonParams; + + // Initialize buttons + PLAT_LOG("Initialize buttons"); + Button_init(); + + Button_Params_init(&buttonParams); + buttonParams.buttonEventMask = Button_EV_CLICKED | Button_EV_LONGCLICKED; + buttonParams.longPressDuration = 1000U; // ms + sAppLeftHandle = Button_open(CONFIG_BTN_LEFT, &buttonParams); + Button_setCallback(sAppLeftHandle, ButtonLeftEventHandler); + + Button_Params_init(&buttonParams); + buttonParams.buttonEventMask = Button_EV_CLICKED | Button_EV_LONGCLICKED; + buttonParams.longPressDuration = 1000U; // ms + sAppRightHandle = Button_open(CONFIG_BTN_RIGHT, &buttonParams); + Button_setCallback(sAppRightHandle, ButtonRightEventHandler); +#endif // BUTTON ENABLE } diff --git a/src/platform/cc13xx_26xx/cc13x4_26x4/CHIPPlatformConfig.h b/src/platform/cc13xx_26xx/cc13x4_26x4/CHIPPlatformConfig.h index 67480a65ed5fd6..60226ab76b2723 100644 --- a/src/platform/cc13xx_26xx/cc13x4_26x4/CHIPPlatformConfig.h +++ b/src/platform/cc13xx_26xx/cc13x4_26x4/CHIPPlatformConfig.h @@ -75,4 +75,4 @@ #define CHIP_CONFIG_ICD_IDLE_MODE_DURATION_SEC 360 #define CHIP_DEVICE_CONFIG_ICD_SLOW_POLL_INTERVAL chip::System::Clock::Milliseconds32(5000) #define CHIP_DEVICE_CONFIG_ICD_FAST_POLL_INTERVAL chip::System::Clock::Milliseconds32(500) -#endif //TI_ICD_ENABLE_SERVER +#endif // TI_ICD_ENABLE_SERVER diff --git a/src/platform/cc13xx_26xx/cc13x4_26x4/ble_user_config.c b/src/platform/cc13xx_26xx/cc13x4_26x4/ble_user_config.c index 44cb9fa286e686..91ef114b51fe81 100644 --- a/src/platform/cc13xx_26xx/cc13x4_26x4/ble_user_config.c +++ b/src/platform/cc13xx_26xx/cc13x4_26x4/ble_user_config.c @@ -312,7 +312,7 @@ const stackSpecific_t bleStackConfig = { .maxNumConns = MAX_NUM_BLE_CONNS .maxPduSize = 0, .maxNumPSM = L2CAP_NUM_PSM, .maxNumCoChannels = L2CAP_NUM_CO_CHANNELS, - .maxAcceptListElems = MAX_NUM_AL_ENTRIES, + .maxAcceptListElems = MAX_NUM_AL_ENTRIES, .maxResolvListElems = CFG_MAX_NUM_RL_ENTRIES, .pfnBMAlloc = &pfnBMAlloc, .pfnBMFree = &pfnBMFree, diff --git a/src/platform/cc13xx_26xx/chipOBleProfile.c b/src/platform/cc13xx_26xx/chipOBleProfile.c index 38b5e7dddf1824..e768b080dbda6b 100644 --- a/src/platform/cc13xx_26xx/chipOBleProfile.c +++ b/src/platform/cc13xx_26xx/chipOBleProfile.c @@ -169,7 +169,8 @@ bStatus_t CHIPoBLEProfile_AddService(uint32 services) uint8 status; // Allocate Client Characteristic Configuration tables - chipOBleProfileTxStateDataConfig = (gattCharCfg_t *) ICall_malloc((uint_least16_t) (sizeof(gattCharCfg_t) * LL_MAX_NUM_BLE_CONNS)); + chipOBleProfileTxStateDataConfig = + (gattCharCfg_t *) ICall_malloc((uint_least16_t) (sizeof(gattCharCfg_t) * LL_MAX_NUM_BLE_CONNS)); if (chipOBleProfileTxStateDataConfig == NULL) { return bleMemAllocError; From 4082fd7e973052b69d3e5ce88efeed0ffc046b94 Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Tue, 2 Apr 2024 23:53:49 +0000 Subject: [PATCH 5/9] Restyled by gn --- .../all-clusters-app/cc13x4_26x4/BUILD.gn | 7 ++- examples/lighting-app/cc13x4_26x4/BUILD.gn | 10 ++-- examples/lock-app/cc13x4_26x4/BUILD.gn | 7 ++- examples/pump-app/cc13x4_26x4/BUILD.gn | 7 ++- .../pump-controller-app/cc13x4_26x4/BUILD.gn | 7 ++- .../pump-controller-app/cc13x4_26x4/args.gni | 2 +- examples/shell/cc13x4_26x4/BUILD.gn | 7 ++- .../ti_simplelink_executable.gni | 11 ++-- .../ti_simplelink_sdk/ti_simplelink_sdk.gni | 51 +++++++++---------- 9 files changed, 60 insertions(+), 49 deletions(-) diff --git a/examples/all-clusters-app/cc13x4_26x4/BUILD.gn b/examples/all-clusters-app/cc13x4_26x4/BUILD.gn index c68d1a70e0daa0..cec516a4a43cc5 100644 --- a/examples/all-clusters-app/cc13x4_26x4/BUILD.gn +++ b/examples/all-clusters-app/cc13x4_26x4/BUILD.gn @@ -119,8 +119,11 @@ ti_simplelink_executable("all-clusters-app") { defines = [ "CC13XX_26XX_FACTORY_DATA" ] } - if(chip_enable_icd_server){ - defines += ["CHIP_DEVICE_CONFIG_ENABLE_SED", "TI_ICD_ENABLE_SERVER"] + if (chip_enable_icd_server) { + defines += [ + "CHIP_DEVICE_CONFIG_ENABLE_SED", + "TI_ICD_ENABLE_SERVER", + ] } include_dirs = [ diff --git a/examples/lighting-app/cc13x4_26x4/BUILD.gn b/examples/lighting-app/cc13x4_26x4/BUILD.gn index b07b8c43aaa51d..c60c783deeb1a4 100644 --- a/examples/lighting-app/cc13x4_26x4/BUILD.gn +++ b/examples/lighting-app/cc13x4_26x4/BUILD.gn @@ -68,7 +68,7 @@ ti_sysconfig("sysconfig") { cflags = [ "-Wno-comment", "@" + rebase_path("${target_gen_dir}/sysconfig/ti_utils_build_compiler.opt", - root_build_dir), + root_build_dir), ] } @@ -101,9 +101,11 @@ ti_simplelink_executable("lighting_app") { defines = [ "CC13XX_26XX_FACTORY_DATA" ] } - if(chip_enable_icd_server){ - defines += ["CHIP_DEVICE_CONFIG_ENABLE_SED", - "TI_ICD_ENABLE_SERVER"] + if (chip_enable_icd_server) { + defines += [ + "CHIP_DEVICE_CONFIG_ENABLE_SED", + "TI_ICD_ENABLE_SERVER", + ] } include_dirs = [ diff --git a/examples/lock-app/cc13x4_26x4/BUILD.gn b/examples/lock-app/cc13x4_26x4/BUILD.gn index 1688d1c9739cb1..662d22219c5cf3 100644 --- a/examples/lock-app/cc13x4_26x4/BUILD.gn +++ b/examples/lock-app/cc13x4_26x4/BUILD.gn @@ -105,8 +105,11 @@ ti_simplelink_executable("lock_app") { defines = [ "CC13XX_26XX_FACTORY_DATA" ] } - if(chip_enable_icd_server){ - defines += ["CHIP_DEVICE_CONFIG_ENABLE_SED", "TI_ICD_ENABLE_SERVER"] + if (chip_enable_icd_server) { + defines += [ + "CHIP_DEVICE_CONFIG_ENABLE_SED", + "TI_ICD_ENABLE_SERVER", + ] } include_dirs = [ "${project_dir}", diff --git a/examples/pump-app/cc13x4_26x4/BUILD.gn b/examples/pump-app/cc13x4_26x4/BUILD.gn index 08b35c44855a21..21e59f076d5f00 100644 --- a/examples/pump-app/cc13x4_26x4/BUILD.gn +++ b/examples/pump-app/cc13x4_26x4/BUILD.gn @@ -101,8 +101,11 @@ ti_simplelink_executable("pump_app") { defines = [ "CC13XX_26XX_FACTORY_DATA" ] } - if(chip_enable_icd_server){ - defines += ["CHIP_DEVICE_CONFIG_ENABLE_SED", "TI_ICD_ENABLE_SERVER"] + if (chip_enable_icd_server) { + defines += [ + "CHIP_DEVICE_CONFIG_ENABLE_SED", + "TI_ICD_ENABLE_SERVER", + ] } include_dirs = [ diff --git a/examples/pump-controller-app/cc13x4_26x4/BUILD.gn b/examples/pump-controller-app/cc13x4_26x4/BUILD.gn index f91bed97ada9d1..efe6c5e46db5e2 100644 --- a/examples/pump-controller-app/cc13x4_26x4/BUILD.gn +++ b/examples/pump-controller-app/cc13x4_26x4/BUILD.gn @@ -100,8 +100,11 @@ ti_simplelink_executable("pump_controller_app") { defines = [ "CC13XX_26XX_FACTORY_DATA" ] } - if (chip_enable_icd_server){ - defines += ["CHIP_DEVICE_CONFIG_ENABLE_SED", "TI_ICD_ENABLE_SERVER"] + if (chip_enable_icd_server) { + defines += [ + "CHIP_DEVICE_CONFIG_ENABLE_SED", + "TI_ICD_ENABLE_SERVER", + ] } include_dirs = [ "${project_dir}", diff --git a/examples/pump-controller-app/cc13x4_26x4/args.gni b/examples/pump-controller-app/cc13x4_26x4/args.gni index 9d21df04690e64..0aecbe27208f5e 100644 --- a/examples/pump-controller-app/cc13x4_26x4/args.gni +++ b/examples/pump-controller-app/cc13x4_26x4/args.gni @@ -57,4 +57,4 @@ chip_enable_icd_server = false chip_persist_subscriptions = false chip_subscription_timeout_resumption = false -freertos_root = "//third_party/connectedhomeip/third_party/ti_simplelink_sdk/repo_cc13xx_cc26xx/source/third_party/freertos" \ No newline at end of file +freertos_root = "//third_party/connectedhomeip/third_party/ti_simplelink_sdk/repo_cc13xx_cc26xx/source/third_party/freertos" diff --git a/examples/shell/cc13x4_26x4/BUILD.gn b/examples/shell/cc13x4_26x4/BUILD.gn index 16f69243061a26..fcc0b8cd2cad1f 100644 --- a/examples/shell/cc13x4_26x4/BUILD.gn +++ b/examples/shell/cc13x4_26x4/BUILD.gn @@ -100,8 +100,11 @@ ti_simplelink_executable("shell_app") { defines = [ "CC13XX_26XX_FACTORY_DATA" ] } - if (chip_enable_icd_server){ - defines += ["CHIP_DEVICE_CONFIG_ENABLE_SED", "TI_ICD_ENABLE_SERVER"] + if (chip_enable_icd_server) { + defines += [ + "CHIP_DEVICE_CONFIG_ENABLE_SED", + "TI_ICD_ENABLE_SERVER", + ] } include_dirs = [ diff --git a/third_party/ti_simplelink_sdk/ti_simplelink_executable.gni b/third_party/ti_simplelink_sdk/ti_simplelink_executable.gni index c887e31e3d79d7..e0a848a079c3f9 100644 --- a/third_party/ti_simplelink_sdk/ti_simplelink_executable.gni +++ b/third_party/ti_simplelink_sdk/ti_simplelink_executable.gni @@ -289,7 +289,6 @@ template("ti_simplelink_executable") { if (defined(invoker.ota_args)) { args += invoker.ota_args } - } } else if (ti_simplelink_device_family == "cc13x4_26x4") { if (custom_factory_data) { @@ -419,13 +418,11 @@ template("ti_simplelink_executable") { flashable_executable("${simplelink_target_name}_mcubootloader") { output_name = "${output_base_name}.mcubootloader.out" output_dir = root_out_dir - deps = [ - ":${simplelink_target_name}_mcuboot.syscfg", - ":build_external_library", - ] - public_configs = [ - ":external_library_config", + deps = [ + ":${simplelink_target_name}_mcuboot.syscfg", + ":build_external_library", ] + public_configs = [ ":external_library_config" ] ldscript = "${ti_simplelink_sdk_build_root}/mcuboot/mcuboot_cc13x4_cc26x4.lds" objcopy_image_name = "${output_base_name}.mcubootloader.hex" diff --git a/third_party/ti_simplelink_sdk/ti_simplelink_sdk.gni b/third_party/ti_simplelink_sdk/ti_simplelink_sdk.gni index d3a09d5e63b71f..326d2b7e88540f 100644 --- a/third_party/ti_simplelink_sdk/ti_simplelink_sdk.gni +++ b/third_party/ti_simplelink_sdk/ti_simplelink_sdk.gni @@ -186,7 +186,10 @@ template("ti_simplelink_sdk") { ti_simplelink_device_family == "cc13x4_26x4") { action("build_external_library") { script = "${ti_simplelink_sdk_build_root}/run_sdk_drivers_gen.py" - outputs = [ "${target_gen_dir}/drivers_${ti_simplelink_soc_family}.a" , "${target_gen_dir}/driverlib.lib"] + outputs = [ + "${target_gen_dir}/drivers_${ti_simplelink_soc_family}.a", + "${target_gen_dir}/driverlib.lib", + ] args = [ "--sdk", rebase_path(ti_simplelink_sdk_root), @@ -195,8 +198,8 @@ template("ti_simplelink_sdk") { "--src-path-drivers", "/source/ti/drivers/lib/gcc/${ti_simplelink_isa}/drivers_${ti_simplelink_soc_family}.a", "--src-path-driverlib", - "/source/ti/devices/${ti_simplelink_device_family_driverlib}/driverlib/bin/gcc/driverlib.lib", - + "/source/ti/devices/${ti_simplelink_device_family_driverlib}/driverlib/bin/gcc/driverlib.lib", + "--dest-path", rebase_path(target_gen_dir), ] @@ -209,23 +212,17 @@ template("ti_simplelink_sdk") { sdk_target_name = target_name config("cc13x2_26x2_sdk_config") { - libs = [ - "${ti_simplelink_sdk_root}/source/ti/drivers/rf/lib/gcc/${ti_simplelink_isa}/rf_multiMode_${ti_simplelink_soc_family}.a", - ] + libs = [ "${ti_simplelink_sdk_root}/source/ti/drivers/rf/lib/gcc/${ti_simplelink_isa}/rf_multiMode_${ti_simplelink_soc_family}.a" ] defines = [ "DeviceFamily_CC13X2_CC26X2" ] } config("cc13x2x7_26x2x7_sdk_config") { - libs = [ - "${ti_simplelink_sdk_root}/source/ti/drivers/rf/lib/gcc/${ti_simplelink_isa}/rf_multiMode_cc26x2.a", - ] + libs = [ "${ti_simplelink_sdk_root}/source/ti/drivers/rf/lib/gcc/${ti_simplelink_isa}/rf_multiMode_cc26x2.a" ] defines = [ "DeviceFamily_CC13X2X7_CC26X2X7" ] } config("cc13x4_26x4_sdk_config") { - libs = [ - "${ti_simplelink_sdk_root}/source/ti/drivers/rf/lib/gcc/${ti_simplelink_isa}/rf_multiMode_${ti_simplelink_soc_family}.a", - ] + libs = [ "${ti_simplelink_sdk_root}/source/ti/drivers/rf/lib/gcc/${ti_simplelink_isa}/rf_multiMode_${ti_simplelink_soc_family}.a" ] defines = [ "FLASH_ONLY_BUILD" ] if (ti_simplelink_device == "") { defines += [ "DeviceFamily_CC13X4" ] @@ -256,12 +253,14 @@ template("ti_simplelink_sdk") { ] } - if (ti_simplelink_device_family == "cc13x2_26x2" || ti_simplelink_device_family == "cc13x2x7_26x2x7" || ti_simplelink_device_family == "cc13x4_26x4") { config("external_library_config") { - libs = [ "${target_gen_dir}/drivers_${ti_simplelink_soc_family}.a", "${target_gen_dir}/driverlib.lib" ] + libs = [ + "${target_gen_dir}/drivers_${ti_simplelink_soc_family}.a", + "${target_gen_dir}/driverlib.lib", + ] } group("external_library") { @@ -785,18 +784,18 @@ template("ti_simplelink_sdk") { ti_simplelink_device_family == "cc13x2x7_26x2x7" || ti_simplelink_device_family == "cc13x4_26x4") { public_deps += [ - ":build_external_library", ":${sdk_target_name}_dmm", ":${sdk_target_name}_nvocmp", + ":build_external_library", ] } if (defined(invoker.public_configs)) { public_configs = invoker.public_configs - if (ti_simplelink_device_family == "cc13x2_26x2" || - ti_simplelink_device_family == "cc13x2x7_26x2x7" || - ti_simplelink_device_family == "cc13x4_26x4") { - public_configs += [ ":external_library_config" ] - } + if (ti_simplelink_device_family == "cc13x2_26x2" || + ti_simplelink_device_family == "cc13x2x7_26x2x7" || + ti_simplelink_device_family == "cc13x4_26x4") { + public_configs += [ ":external_library_config" ] + } } } } @@ -804,12 +803,11 @@ template("ti_simplelink_sdk") { template("freertos_target") { freertos_target_name = target_name - if (ti_simplelink_device_family == "cc13x2_26x2" || - ti_simplelink_device_family == "cc13x2x7_26x2x7" || - ti_simplelink_device_family == "cc13x4_26x4") { - _freertos_root = "${freertos_root}" - } - else{ + if (ti_simplelink_device_family == "cc13x2_26x2" || + ti_simplelink_device_family == "cc13x2x7_26x2x7" || + ti_simplelink_device_family == "cc13x4_26x4") { + _freertos_root = "${freertos_root}" + } else { _freertos_root = "${freertos_root}/repo" } @@ -845,4 +843,3 @@ template("freertos_target") { public_configs += [ ":${freertos_target_name}_config" ] } } - From fee3cc0648ac5522dc91a7411398df028ef5f28c Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Tue, 2 Apr 2024 23:58:04 +0000 Subject: [PATCH 6/9] Restyled by prettier-markdown --- docs/guides/ti/enabling_icd_on_ti_devices.md | 38 ++++++++++++++------ 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/docs/guides/ti/enabling_icd_on_ti_devices.md b/docs/guides/ti/enabling_icd_on_ti_devices.md index 44cd6e74494c5a..7e10ceb0c11ee0 100644 --- a/docs/guides/ti/enabling_icd_on_ti_devices.md +++ b/docs/guides/ti/enabling_icd_on_ti_devices.md @@ -2,26 +2,38 @@ ## Overview -Intermittently Connected Devices are devices in a network that do not always need to be active. Matter has defined a cluster that helps capture this behavior; this configuration is ideal for devices that need to operate with low power consumption or do not have a need to always be on the network. Matter examples on the TI CC13x4 platform can be configured to act as ICDs. +Intermittently Connected Devices are devices in a network that do not always +need to be active. Matter has defined a cluster that helps capture this +behavior; this configuration is ideal for devices that need to operate with low +power consumption or do not have a need to always be on the network. Matter +examples on the TI CC13x4 platform can be configured to act as ICDs. ## Platform Code Changes -To configure a TI example as an ICD, open up the `args.gni` file of the example and set the following parameter to true: + +To configure a TI example as an ICD, open up the `args.gni` file of the example +and set the following parameter to true: ``` chip_enable_icd_server = true ``` -TI examples have only been tested with the ICD Server configuration. To enable the client configuration, set `chip_enable_icd_client` to true. +TI examples have only been tested with the ICD Server configuration. To enable +the client configuration, set `chip_enable_icd_client` to true. -Persistent subscriptions allow devices to attempt resuming existing subscriptions following a device reset. To enable persistent subscriptions, set the following parameter to true: +Persistent subscriptions allow devices to attempt resuming existing +subscriptions following a device reset. To enable persistent subscriptions, set +the following parameter to true: ``` chip_persist_subscriptions = true ``` -Subscription timeout resumption allows devices to attempt re-establishing subscriptions that may have expired. This feature is disabled out of box. +Subscription timeout resumption allows devices to attempt re-establishing +subscriptions that may have expired. This feature is disabled out of box. -In addition, various ICD parameters such as idle/active mode duration, active mode threshold, and polling intervals can be configured in `src/platform/cc13xx_26xx/cc13x4_26x4/CHIPPlatformConfig.h` +In addition, various ICD parameters such as idle/active mode duration, active +mode threshold, and polling intervals can be configured in +`src/platform/cc13xx_26xx/cc13x4_26x4/CHIPPlatformConfig.h` ``` #define CHIP_CONFIG_ICD_ACTIVE_MODE_DURATION_MS 1000 @@ -33,11 +45,15 @@ In addition, various ICD parameters such as idle/active mode duration, active mo ## ZAP File Changes -Open up the ZAP file (in `examples//-common`) for the example being configured as an ICD. Add the ICD Management Cluster for Endpoint 0. - -Open up the .matter file (in `examples//-common`) corresponding to the example and add in the ICDManagement cluster. +Open up the ZAP file (in `examples//-common`) for +the example being configured as an ICD. Add the ICD Management Cluster for +Endpoint 0. -In addition, each endpoint has a list of clusters that it supports. Add the ICDManagement cluster to this list. +Open up the .matter file (in `examples//-common`) +corresponding to the example and add in the ICDManagement cluster. -The lock-app example's .matter file can be used as a reference. These additions allow the ICDManagement cluster's callbacks to be accessed. +In addition, each endpoint has a list of clusters that it supports. Add the +ICDManagement cluster to this list. +The lock-app example's .matter file can be used as a reference. These additions +allow the ICDManagement cluster's callbacks to be accessed. From 0a203764cde6984edc9c5644e6b9c69f76c56dfc Mon Sep 17 00:00:00 2001 From: abiradarti Date: Wed, 3 Apr 2024 11:42:18 -0500 Subject: [PATCH 7/9] replaced SED define with ICD server defines + other code cleanup --- .../all-clusters-app/cc13x4_26x4/BUILD.gn | 9 +++---- .../cc13x4_26x4/main/AppTask.cpp | 9 ++++--- examples/lighting-app/cc13x4_26x4/BUILD.gn | 9 +++---- .../lighting-app/cc13x4_26x4/src/AppTask.cpp | 25 +++++++++---------- examples/lock-app/cc13x4_26x4/BUILD.gn | 9 +++---- examples/lock-app/cc13x4_26x4/src/AppTask.cpp | 17 ++++++------- examples/pump-app/cc13x4_26x4/BUILD.gn | 9 +++---- .../pump-app/cc13x4_26x4/main/AppTask.cpp | 23 ++++++++--------- .../pump-controller-app/cc13x4_26x4/BUILD.gn | 10 ++++---- .../cc13x4_26x4/main/AppTask.cpp | 24 ++++++++---------- examples/shell/cc13x4_26x4/BUILD.gn | 9 +++---- examples/shell/cc13x4_26x4/main/AppTask.cpp | 2 +- 12 files changed, 73 insertions(+), 82 deletions(-) diff --git a/examples/all-clusters-app/cc13x4_26x4/BUILD.gn b/examples/all-clusters-app/cc13x4_26x4/BUILD.gn index cec516a4a43cc5..a20b07b6441f1d 100644 --- a/examples/all-clusters-app/cc13x4_26x4/BUILD.gn +++ b/examples/all-clusters-app/cc13x4_26x4/BUILD.gn @@ -115,15 +115,14 @@ ti_simplelink_executable("all-clusters-app") { deps += [ "${chip_root}/third_party/openthread/repo:libopenthread-mtd" ] } + defines = [] + if (custom_factory_data) { - defines = [ "CC13XX_26XX_FACTORY_DATA" ] + defines += [ "CC13XX_26XX_FACTORY_DATA" ] } if (chip_enable_icd_server) { - defines += [ - "CHIP_DEVICE_CONFIG_ENABLE_SED", - "TI_ICD_ENABLE_SERVER", - ] + defines += [ "TI_ICD_ENABLE_SERVER" ] } include_dirs = [ diff --git a/examples/all-clusters-app/cc13x4_26x4/main/AppTask.cpp b/examples/all-clusters-app/cc13x4_26x4/main/AppTask.cpp index f25acf1957a4af..7c7f5ef0020aa2 100644 --- a/examples/all-clusters-app/cc13x4_26x4/main/AppTask.cpp +++ b/examples/all-clusters-app/cc13x4_26x4/main/AppTask.cpp @@ -196,11 +196,12 @@ int AppTask::Init() #if CHIP_DEVICE_CONFIG_THREAD_FTD ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_Router); -#elif CHIP_DEVICE_CONFIG_ENABLE_SED +#elif CHIP_CONFIG_ENABLE_ICD_SERVER ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_SleepyEndDevice); #else ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_MinimalEndDevice); #endif + if (ret != CHIP_NO_ERROR) { PLAT_LOG("ConnectivityMgr().SetThreadDeviceType() failed"); @@ -344,7 +345,7 @@ void AppTask::DispatchEvent(AppEvent * aEvent) } } -#ifdef BUTTON_ENABLE +#if(BUTTON_ENABLE == 1) void AppTask::ButtonLeftEventHandler(Button_Handle handle, Button_EventMask events) { AppEvent event; @@ -388,7 +389,7 @@ void AppTask::ButtonRightEventHandler(Button_Handle handle, Button_EventMask eve void AppTask::uiInit(void) { -#ifdef LED_ENABLE +#if(LED_ENABLE == 1) LED_Params ledParams; @@ -405,7 +406,7 @@ void AppTask::uiInit(void) LED_setOff(sAppGreenHandle); #endif // LED ENABLE -#ifdef BUTTON_ENABLE +#if(BUTTON_ENABLE == 1) Button_Params buttonParams; // Initialize buttons diff --git a/examples/lighting-app/cc13x4_26x4/BUILD.gn b/examples/lighting-app/cc13x4_26x4/BUILD.gn index c60c783deeb1a4..6434af621259d4 100644 --- a/examples/lighting-app/cc13x4_26x4/BUILD.gn +++ b/examples/lighting-app/cc13x4_26x4/BUILD.gn @@ -97,15 +97,14 @@ ti_simplelink_executable("lighting_app") { deps += [ "${chip_root}/third_party/openthread/repo:libopenthread-mtd" ] } + defines = [] + if (custom_factory_data) { - defines = [ "CC13XX_26XX_FACTORY_DATA" ] + defines += [ "CC13XX_26XX_FACTORY_DATA" ] } if (chip_enable_icd_server) { - defines += [ - "CHIP_DEVICE_CONFIG_ENABLE_SED", - "TI_ICD_ENABLE_SERVER", - ] + defines += [ "TI_ICD_ENABLE_SERVER" ] } include_dirs = [ diff --git a/examples/lighting-app/cc13x4_26x4/src/AppTask.cpp b/examples/lighting-app/cc13x4_26x4/src/AppTask.cpp index c6b6f3184d0d05..1f29bd45682229 100644 --- a/examples/lighting-app/cc13x4_26x4/src/AppTask.cpp +++ b/examples/lighting-app/cc13x4_26x4/src/AppTask.cpp @@ -144,7 +144,7 @@ int AppTask::StartAppTask() // Identify take action void identify_TakeAction(void) { -#ifdef LED_ENABLE +#if(LED_ENABLE == 1) LED_setOn(sAppGreenHandle, LED_BRIGHTNESS_MAX); LED_startBlinking(sAppGreenHandle, 1000, LED_BLINK_FOREVER); #endif // LED_ENABLE @@ -153,7 +153,7 @@ void identify_TakeAction(void) // Identify stop action void identify_StopAction(void) { -#ifdef LED_ENABLE +#if(LED_ENABLE == 1) LED_stopBlinking(sAppGreenHandle); LED_setOff(sAppGreenHandle); #endif // LED_ENABLE @@ -183,13 +183,12 @@ int AppTask::Init() } #if CHIP_DEVICE_CONFIG_THREAD_FTD ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_Router); -#else -#if CHIP_DEVICE_CONFIG_ENABLE_SED +#elif CHIP_CONFIG_ENABLE_ICD_SERVER ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_SleepyEndDevice); #else ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_MinimalEndDevice); -#endif // CHIP_DEVICE_CONFIG_ENABLE_SED -#endif // CHIP_DEVICE_CONFIG_THREAD_FTD +#endif + if (ret != CHIP_NO_ERROR) { PLAT_LOG("ConnectivityMgr().SetThreadDeviceType() failed"); @@ -479,7 +478,7 @@ void AppTask::TriggerIdentifyEffectHandler(::Identify * identify) void uiTurnOn(void) { PLAT_LOG("Light On initiated"); -#ifdef LED_ENABLE +#if(LED_ENABLE == 1) LED_setOn(sAppRedHandle, LED_BRIGHTNESS_MAX); LED_startBlinking(sAppRedHandle, 110 /* ms */, LED_BLINK_FOREVER); #endif // LED_ENABLE @@ -489,7 +488,7 @@ void uiTurnOn(void) void uiTurnedOn(void) { PLAT_LOG("Light On completed"); -#ifdef LED_ENABLE +#if(LED_ENABLE == 1) LED_stopBlinking(sAppRedHandle); LED_setOn(sAppRedHandle, LED_BRIGHTNESS_MAX); #endif // LED_ENABLE @@ -499,7 +498,7 @@ void uiTurnedOn(void) void uiTurnOff(void) { PLAT_LOG("Light Off initiated"); -#ifdef LED_ENABLE +#if(LED_ENABLE == 1) LED_setOn(sAppRedHandle, LED_BRIGHTNESS_MAX); LED_startBlinking(sAppRedHandle, 110 /* ms */, LED_BLINK_FOREVER); #endif // LED_ENABLE @@ -509,13 +508,13 @@ void uiTurnOff(void) void uiTurnedOff(void) { PLAT_LOG("Light Off completed"); -#ifdef LED_ENABLE +#if(LED_ENABLE == 1) LED_stopBlinking(sAppRedHandle); LED_setOff(sAppRedHandle); #endif // LED_ENABLE } -#ifdef BUTTON_ENABLE +#if(BUTTON_ENABLE == 1) void AppTask::ButtonLeftEventHandler(Button_Handle handle, Button_EventMask events) { AppEvent event; @@ -559,7 +558,7 @@ void AppTask::ButtonRightEventHandler(Button_Handle handle, Button_EventMask eve void AppTask::uiInit(void) { -#ifdef LED_ENABLE +#if(LED_ENABLE == 1) LED_Params ledParams; @@ -576,7 +575,7 @@ void AppTask::uiInit(void) LED_setOff(sAppGreenHandle); #endif // LED ENABLE -#ifdef BUTTON_ENABLE +#if(BUTTON_ENABLE == 1) Button_Params buttonParams; // Initialize buttons diff --git a/examples/lock-app/cc13x4_26x4/BUILD.gn b/examples/lock-app/cc13x4_26x4/BUILD.gn index 662d22219c5cf3..ab32881a6f15eb 100644 --- a/examples/lock-app/cc13x4_26x4/BUILD.gn +++ b/examples/lock-app/cc13x4_26x4/BUILD.gn @@ -101,15 +101,14 @@ ti_simplelink_executable("lock_app") { deps += [ "${chip_root}/third_party/openthread/repo:libopenthread-mtd" ] } + defines = [] + if (custom_factory_data) { - defines = [ "CC13XX_26XX_FACTORY_DATA" ] + defines += [ "CC13XX_26XX_FACTORY_DATA" ] } if (chip_enable_icd_server) { - defines += [ - "CHIP_DEVICE_CONFIG_ENABLE_SED", - "TI_ICD_ENABLE_SERVER", - ] + defines += [ "TI_ICD_ENABLE_SERVER" ] } include_dirs = [ "${project_dir}", diff --git a/examples/lock-app/cc13x4_26x4/src/AppTask.cpp b/examples/lock-app/cc13x4_26x4/src/AppTask.cpp index b15665b716509a..ea35f22e8017c5 100644 --- a/examples/lock-app/cc13x4_26x4/src/AppTask.cpp +++ b/examples/lock-app/cc13x4_26x4/src/AppTask.cpp @@ -136,7 +136,7 @@ void uiUnlocked(void); // Identify take action void identify_TakeAction(void) { -#ifdef LED_ENABLE +#if(LED_ENABLE == 1) LED_setOn(sAppGreenHandle, LED_BRIGHTNESS_MAX); LED_startBlinking(sAppGreenHandle, 1000, LED_BLINK_FOREVER); #endif // LED_ENABLE @@ -145,7 +145,7 @@ void identify_TakeAction(void) // Identify stop action void identify_StopAction(void) { -#ifdef LED_ENABLE +#if(LED_ENABLE == 1) LED_stopBlinking(sAppGreenHandle); LED_setOff(sAppGreenHandle); #endif // LED_ENABLE @@ -175,12 +175,11 @@ int AppTask::Init() } #if CHIP_DEVICE_CONFIG_THREAD_FTD ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_Router); -#else -#if CHIP_DEVICE_CONFIG_ENABLE_SED +#elif CHIP_CONFIG_ENABLE_ICD_SERVER ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_SleepyEndDevice); +#else ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_MinimalEndDevice); -#endif // CHIP_DEVICE_CONFIG_ENABLE_SED -#endif // CHIP_DEVICE_CONFIG_THREAD_FTD +#endif if (ret != CHIP_NO_ERROR) { @@ -537,7 +536,7 @@ void uiUnlocked(void) #endif } -#ifdef BUTTON_ENABLE +#if(BUTTON_ENABLE == 1) void AppTask::ButtonLeftEventHandler(Button_Handle handle, Button_EventMask events) { AppEvent event; @@ -581,7 +580,7 @@ void AppTask::ButtonRightEventHandler(Button_Handle handle, Button_EventMask eve void AppTask::uiInit(void) { -#ifdef LED_ENABLE +#if(LED_ENABLE == 1) LED_Params ledParams; @@ -598,7 +597,7 @@ void AppTask::uiInit(void) LED_setOff(sAppGreenHandle); #endif // LED ENABLE -#ifdef BUTTON_ENABLE +#if(BUTTON_ENABLE == 1) Button_Params buttonParams; // Initialize buttons diff --git a/examples/pump-app/cc13x4_26x4/BUILD.gn b/examples/pump-app/cc13x4_26x4/BUILD.gn index 21e59f076d5f00..d20d2d8a392c64 100644 --- a/examples/pump-app/cc13x4_26x4/BUILD.gn +++ b/examples/pump-app/cc13x4_26x4/BUILD.gn @@ -97,15 +97,14 @@ ti_simplelink_executable("pump_app") { deps += [ "${chip_root}/third_party/openthread/repo:libopenthread-mtd" ] } + defines = [] + if (custom_factory_data) { - defines = [ "CC13XX_26XX_FACTORY_DATA" ] + defines += [ "CC13XX_26XX_FACTORY_DATA" ] } if (chip_enable_icd_server) { - defines += [ - "CHIP_DEVICE_CONFIG_ENABLE_SED", - "TI_ICD_ENABLE_SERVER", - ] + defines += [ "TI_ICD_ENABLE_SERVER" ] } include_dirs = [ diff --git a/examples/pump-app/cc13x4_26x4/main/AppTask.cpp b/examples/pump-app/cc13x4_26x4/main/AppTask.cpp index 44f7154cabb8d0..d1834bd9b1746f 100644 --- a/examples/pump-app/cc13x4_26x4/main/AppTask.cpp +++ b/examples/pump-app/cc13x4_26x4/main/AppTask.cpp @@ -163,13 +163,12 @@ int AppTask::Init() #if CHIP_DEVICE_CONFIG_THREAD_FTD ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_Router); -#else -#if CHIP_DEVICE_CONFIG_ENABLE_SED +#elif CHIP_CONFIG_ENABLE_ICD_SERVER ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_SleepyEndDevice); #else ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_MinimalEndDevice); -#endif // CHIP_DEVICE_CONFIG_ENABLE_SED -#endif // CHIP_DEVICE_CONFIG_THREAD_FTD +#endif + if (ret != CHIP_NO_ERROR) { PLAT_LOG("ConnectivityMgr().SetThreadDeviceType() failed"); @@ -274,7 +273,7 @@ void AppTask::ActionInitiated(PumpManager::Action_t aAction, int32_t aActor) PLAT_LOG("Stop initiated"); ; // TODO } -#ifdef LED_ENABLE +#if(LED_ENABLE == 1) LED_setOn(sAppGreenHandle, LED_BRIGHTNESS_MAX); LED_startBlinking(sAppGreenHandle, 50 /* ms */, LED_BLINK_FOREVER); LED_setOn(sAppRedHandle, LED_BRIGHTNESS_MAX); @@ -290,7 +289,7 @@ void AppTask::ActionCompleted(PumpManager::Action_t aAction, int32_t aActor) if (aAction == PumpManager::START_ACTION) { PLAT_LOG("Pump start completed"); -#ifdef LED_ENABLE +#if(LED_ENABLE == 1) LED_stopBlinking(sAppGreenHandle); LED_setOn(sAppGreenHandle, LED_BRIGHTNESS_MAX); LED_stopBlinking(sAppRedHandle); @@ -302,7 +301,7 @@ void AppTask::ActionCompleted(PumpManager::Action_t aAction, int32_t aActor) else if (aAction == PumpManager::STOP_ACTION) { PLAT_LOG("Pump stop completed"); -#ifdef LED_ENABLE +#if(LED_ENABLE == 1) LED_stopBlinking(sAppGreenHandle); LED_setOff(sAppGreenHandle); LED_stopBlinking(sAppRedHandle); @@ -370,7 +369,7 @@ void AppTask::DispatchEvent(AppEvent * aEvent) break; case AppEvent::kEventType_IdentifyStart: -#ifdef LED_ENABLE +#if(LED_ENABLE == 1) LED_setOn(sAppGreenHandle, LED_BRIGHTNESS_MAX); LED_startBlinking(sAppGreenHandle, sIdentifyBlinkRateMs, LED_BLINK_FOREVER); #endif @@ -378,7 +377,7 @@ void AppTask::DispatchEvent(AppEvent * aEvent) break; case AppEvent::kEventType_IdentifyStop: -#ifdef LED_ENABLE +#if(LED_ENABLE == 1) LED_stopBlinking(sAppGreenHandle); if (!PumpMgr().IsStopped()) { @@ -633,7 +632,7 @@ void AppTask::TriggerIdentifyEffectHandler(::Identify * identify) } } -#ifdef BUTTON_ENABLE +#if(BUTTON_ENABLE == 1) void AppTask::ButtonLeftEventHandler(Button_Handle handle, Button_EventMask events) { AppEvent event; @@ -677,7 +676,7 @@ void AppTask::ButtonRightEventHandler(Button_Handle handle, Button_EventMask eve void AppTask::uiInit(void) { -#ifdef LED_ENABLE +#if(LED_ENABLE == 1) LED_Params ledParams; @@ -694,7 +693,7 @@ void AppTask::uiInit(void) LED_setOff(sAppGreenHandle); #endif // LED ENABLE -#ifdef BUTTON_ENABLE +#if(BUTTON_ENABLE == 1) Button_Params buttonParams; // Initialize buttons diff --git a/examples/pump-controller-app/cc13x4_26x4/BUILD.gn b/examples/pump-controller-app/cc13x4_26x4/BUILD.gn index efe6c5e46db5e2..61aa833752ed47 100644 --- a/examples/pump-controller-app/cc13x4_26x4/BUILD.gn +++ b/examples/pump-controller-app/cc13x4_26x4/BUILD.gn @@ -96,16 +96,16 @@ ti_simplelink_executable("pump_controller_app") { deps += [ "${chip_root}/third_party/openthread/repo:libopenthread-mtd" ] } + defines = [] + if (custom_factory_data) { - defines = [ "CC13XX_26XX_FACTORY_DATA" ] + defines += [ "CC13XX_26XX_FACTORY_DATA" ] } if (chip_enable_icd_server) { - defines += [ - "CHIP_DEVICE_CONFIG_ENABLE_SED", - "TI_ICD_ENABLE_SERVER", - ] + defines += [ "TI_ICD_ENABLE_SERVER" ] } + include_dirs = [ "${project_dir}", "${project_dir}/main", diff --git a/examples/pump-controller-app/cc13x4_26x4/main/AppTask.cpp b/examples/pump-controller-app/cc13x4_26x4/main/AppTask.cpp index da37ae6e2db91a..5ee32070ae6965 100644 --- a/examples/pump-controller-app/cc13x4_26x4/main/AppTask.cpp +++ b/examples/pump-controller-app/cc13x4_26x4/main/AppTask.cpp @@ -129,7 +129,7 @@ int AppTask::StartAppTask() // Identify take action void identify_TakeAction(void) { -#ifdef LED_ENABLE +#if(LED_ENABLE == 1) LED_setOn(sAppGreenHandle, LED_BRIGHTNESS_MAX); LED_startBlinking(sAppGreenHandle, 1000, LED_BLINK_FOREVER); #endif // LED_ENABLE @@ -138,7 +138,7 @@ void identify_TakeAction(void) // Identify stop action void identify_StopAction(void) { -#ifdef LED_ENABLE +#if(LED_ENABLE == 1) LED_stopBlinking(sAppGreenHandle); LED_setOff(sAppGreenHandle); #endif // LED_ENABLE @@ -169,13 +169,11 @@ int AppTask::Init() #if CHIP_DEVICE_CONFIG_THREAD_FTD ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_Router); -#else -#if CHIP_DEVICE_CONFIG_ENABLE_SED +#elif CHIP_CONFIG_ENABLE_ICD_SERVER ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_SleepyEndDevice); #else ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_MinimalEndDevice); -#endif // CHIP_DEVICE_CONFIG_ENABLE_SED -#endif // CHIP_DEVICE_CONFIG_THREAD_FTD +#endif if (ret != CHIP_NO_ERROR) { @@ -277,7 +275,7 @@ void AppTask::ActionInitiated(PumpManager::Action_t aAction, int32_t aActor) PLAT_LOG("Stop initiated"); ; // TODO } -#ifdef LED_ENABLE +#if(LED_ENABLE == 1) LED_setOn(sAppGreenHandle, LED_BRIGHTNESS_MAX); LED_startBlinking(sAppGreenHandle, 50 /* ms */, LED_BLINK_FOREVER); LED_setOn(sAppRedHandle, LED_BRIGHTNESS_MAX); @@ -293,7 +291,7 @@ void AppTask::ActionCompleted(PumpManager::Action_t aAction, int32_t aActor) if (aAction == PumpManager::START_ACTION) { PLAT_LOG("Pump start completed"); -#ifdef LED_ENABLE +#if(LED_ENABLE == 1) LED_stopBlinking(sAppGreenHandle); LED_setOn(sAppGreenHandle, LED_BRIGHTNESS_MAX); LED_stopBlinking(sAppRedHandle); @@ -303,7 +301,7 @@ void AppTask::ActionCompleted(PumpManager::Action_t aAction, int32_t aActor) else if (aAction == PumpManager::STOP_ACTION) { PLAT_LOG("Pump stop completed"); -#ifdef LED_ENABLE +#if(LED_ENABLE == 1) LED_stopBlinking(sAppGreenHandle); LED_setOff(sAppGreenHandle); LED_stopBlinking(sAppRedHandle); @@ -369,7 +367,7 @@ void AppTask::DispatchEvent(AppEvent * aEvent) break; case AppEvent::kEventType_IdentifyStop: -#ifdef LED_ENABLE +#if(LED_ENABLE == 1) LED_stopBlinking(sAppGreenHandle); if (!PumpMgr().IsStopped()) @@ -442,7 +440,7 @@ void AppTask::TriggerIdentifyEffectHandler(::Identify * identify) } } -#ifdef BUTTON_ENABLE +#if(BUTTON_ENABLE == 1) void AppTask::ButtonLeftEventHandler(Button_Handle handle, Button_EventMask events) { AppEvent event; @@ -486,7 +484,7 @@ void AppTask::ButtonRightEventHandler(Button_Handle handle, Button_EventMask eve void AppTask::uiInit(void) { -#ifdef LED_ENABLE +#if(LED_ENABLE == 1) LED_Params ledParams; @@ -503,7 +501,7 @@ void AppTask::uiInit(void) LED_setOff(sAppGreenHandle); #endif // LED ENABLE -#ifdef BUTTON_ENABLE +#if(BUTTON_ENABLE == 1) Button_Params buttonParams; // Initialize buttons diff --git a/examples/shell/cc13x4_26x4/BUILD.gn b/examples/shell/cc13x4_26x4/BUILD.gn index fcc0b8cd2cad1f..9a2e3f2f3263ce 100644 --- a/examples/shell/cc13x4_26x4/BUILD.gn +++ b/examples/shell/cc13x4_26x4/BUILD.gn @@ -96,15 +96,14 @@ ti_simplelink_executable("shell_app") { deps += [ "${chip_root}/third_party/openthread/repo:libopenthread-mtd" ] } + defines = [] + if (custom_factory_data) { - defines = [ "CC13XX_26XX_FACTORY_DATA" ] + defines += [ "CC13XX_26XX_FACTORY_DATA" ] } if (chip_enable_icd_server) { - defines += [ - "CHIP_DEVICE_CONFIG_ENABLE_SED", - "TI_ICD_ENABLE_SERVER", - ] + defines += [ "TI_ICD_ENABLE_SERVER" ] } include_dirs = [ diff --git a/examples/shell/cc13x4_26x4/main/AppTask.cpp b/examples/shell/cc13x4_26x4/main/AppTask.cpp index 2c6aadaef69772..83684b0fbcd592 100644 --- a/examples/shell/cc13x4_26x4/main/AppTask.cpp +++ b/examples/shell/cc13x4_26x4/main/AppTask.cpp @@ -122,7 +122,7 @@ CHIP_ERROR AppTask::Init() ; } -#ifdef CONFIG_OPENTHREAD_MTD_SED +#ifdef CHIP_CONFIG_ENABLE_ICD_SERVER ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_SleepyEndDevice); #elif CONFIG_OPENTHREAD_MTD ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_MinimalEndDevice); From 44fdaf39037ea0955c6d5435d47bc3c121282629 Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Wed, 3 Apr 2024 16:42:45 +0000 Subject: [PATCH 8/9] Restyled by whitespace --- examples/lighting-app/cc13x4_26x4/src/AppTask.cpp | 2 +- examples/lock-app/cc13x4_26x4/src/AppTask.cpp | 2 +- examples/pump-app/cc13x4_26x4/main/AppTask.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/lighting-app/cc13x4_26x4/src/AppTask.cpp b/examples/lighting-app/cc13x4_26x4/src/AppTask.cpp index 1f29bd45682229..88c0ff4212522f 100644 --- a/examples/lighting-app/cc13x4_26x4/src/AppTask.cpp +++ b/examples/lighting-app/cc13x4_26x4/src/AppTask.cpp @@ -187,7 +187,7 @@ int AppTask::Init() ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_SleepyEndDevice); #else ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_MinimalEndDevice); -#endif +#endif if (ret != CHIP_NO_ERROR) { diff --git a/examples/lock-app/cc13x4_26x4/src/AppTask.cpp b/examples/lock-app/cc13x4_26x4/src/AppTask.cpp index ea35f22e8017c5..8f4c1c41d09cf1 100644 --- a/examples/lock-app/cc13x4_26x4/src/AppTask.cpp +++ b/examples/lock-app/cc13x4_26x4/src/AppTask.cpp @@ -179,7 +179,7 @@ int AppTask::Init() ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_SleepyEndDevice); #else ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_MinimalEndDevice); -#endif +#endif if (ret != CHIP_NO_ERROR) { diff --git a/examples/pump-app/cc13x4_26x4/main/AppTask.cpp b/examples/pump-app/cc13x4_26x4/main/AppTask.cpp index d1834bd9b1746f..19d757d1e6d896 100644 --- a/examples/pump-app/cc13x4_26x4/main/AppTask.cpp +++ b/examples/pump-app/cc13x4_26x4/main/AppTask.cpp @@ -167,7 +167,7 @@ int AppTask::Init() ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_SleepyEndDevice); #else ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_MinimalEndDevice); -#endif +#endif if (ret != CHIP_NO_ERROR) { From d1afce354160bfbabd04ac45b4d3e73127eece91 Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Wed, 3 Apr 2024 16:42:59 +0000 Subject: [PATCH 9/9] Restyled by clang-format --- .../cc13x4_26x4/main/AppTask.cpp | 6 +++--- .../lighting-app/cc13x4_26x4/src/AppTask.cpp | 18 +++++++++--------- examples/lock-app/cc13x4_26x4/src/AppTask.cpp | 10 +++++----- examples/pump-app/cc13x4_26x4/main/AppTask.cpp | 16 ++++++++-------- .../cc13x4_26x4/main/AppTask.cpp | 18 +++++++++--------- 5 files changed, 34 insertions(+), 34 deletions(-) diff --git a/examples/all-clusters-app/cc13x4_26x4/main/AppTask.cpp b/examples/all-clusters-app/cc13x4_26x4/main/AppTask.cpp index 7c7f5ef0020aa2..6df3ff32d1862b 100644 --- a/examples/all-clusters-app/cc13x4_26x4/main/AppTask.cpp +++ b/examples/all-clusters-app/cc13x4_26x4/main/AppTask.cpp @@ -345,7 +345,7 @@ void AppTask::DispatchEvent(AppEvent * aEvent) } } -#if(BUTTON_ENABLE == 1) +#if (BUTTON_ENABLE == 1) void AppTask::ButtonLeftEventHandler(Button_Handle handle, Button_EventMask events) { AppEvent event; @@ -389,7 +389,7 @@ void AppTask::ButtonRightEventHandler(Button_Handle handle, Button_EventMask eve void AppTask::uiInit(void) { -#if(LED_ENABLE == 1) +#if (LED_ENABLE == 1) LED_Params ledParams; @@ -406,7 +406,7 @@ void AppTask::uiInit(void) LED_setOff(sAppGreenHandle); #endif // LED ENABLE -#if(BUTTON_ENABLE == 1) +#if (BUTTON_ENABLE == 1) Button_Params buttonParams; // Initialize buttons diff --git a/examples/lighting-app/cc13x4_26x4/src/AppTask.cpp b/examples/lighting-app/cc13x4_26x4/src/AppTask.cpp index 88c0ff4212522f..bad302bb6b04ff 100644 --- a/examples/lighting-app/cc13x4_26x4/src/AppTask.cpp +++ b/examples/lighting-app/cc13x4_26x4/src/AppTask.cpp @@ -144,7 +144,7 @@ int AppTask::StartAppTask() // Identify take action void identify_TakeAction(void) { -#if(LED_ENABLE == 1) +#if (LED_ENABLE == 1) LED_setOn(sAppGreenHandle, LED_BRIGHTNESS_MAX); LED_startBlinking(sAppGreenHandle, 1000, LED_BLINK_FOREVER); #endif // LED_ENABLE @@ -153,7 +153,7 @@ void identify_TakeAction(void) // Identify stop action void identify_StopAction(void) { -#if(LED_ENABLE == 1) +#if (LED_ENABLE == 1) LED_stopBlinking(sAppGreenHandle); LED_setOff(sAppGreenHandle); #endif // LED_ENABLE @@ -478,7 +478,7 @@ void AppTask::TriggerIdentifyEffectHandler(::Identify * identify) void uiTurnOn(void) { PLAT_LOG("Light On initiated"); -#if(LED_ENABLE == 1) +#if (LED_ENABLE == 1) LED_setOn(sAppRedHandle, LED_BRIGHTNESS_MAX); LED_startBlinking(sAppRedHandle, 110 /* ms */, LED_BLINK_FOREVER); #endif // LED_ENABLE @@ -488,7 +488,7 @@ void uiTurnOn(void) void uiTurnedOn(void) { PLAT_LOG("Light On completed"); -#if(LED_ENABLE == 1) +#if (LED_ENABLE == 1) LED_stopBlinking(sAppRedHandle); LED_setOn(sAppRedHandle, LED_BRIGHTNESS_MAX); #endif // LED_ENABLE @@ -498,7 +498,7 @@ void uiTurnedOn(void) void uiTurnOff(void) { PLAT_LOG("Light Off initiated"); -#if(LED_ENABLE == 1) +#if (LED_ENABLE == 1) LED_setOn(sAppRedHandle, LED_BRIGHTNESS_MAX); LED_startBlinking(sAppRedHandle, 110 /* ms */, LED_BLINK_FOREVER); #endif // LED_ENABLE @@ -508,13 +508,13 @@ void uiTurnOff(void) void uiTurnedOff(void) { PLAT_LOG("Light Off completed"); -#if(LED_ENABLE == 1) +#if (LED_ENABLE == 1) LED_stopBlinking(sAppRedHandle); LED_setOff(sAppRedHandle); #endif // LED_ENABLE } -#if(BUTTON_ENABLE == 1) +#if (BUTTON_ENABLE == 1) void AppTask::ButtonLeftEventHandler(Button_Handle handle, Button_EventMask events) { AppEvent event; @@ -558,7 +558,7 @@ void AppTask::ButtonRightEventHandler(Button_Handle handle, Button_EventMask eve void AppTask::uiInit(void) { -#if(LED_ENABLE == 1) +#if (LED_ENABLE == 1) LED_Params ledParams; @@ -575,7 +575,7 @@ void AppTask::uiInit(void) LED_setOff(sAppGreenHandle); #endif // LED ENABLE -#if(BUTTON_ENABLE == 1) +#if (BUTTON_ENABLE == 1) Button_Params buttonParams; // Initialize buttons diff --git a/examples/lock-app/cc13x4_26x4/src/AppTask.cpp b/examples/lock-app/cc13x4_26x4/src/AppTask.cpp index 8f4c1c41d09cf1..1b65334c47f886 100644 --- a/examples/lock-app/cc13x4_26x4/src/AppTask.cpp +++ b/examples/lock-app/cc13x4_26x4/src/AppTask.cpp @@ -136,7 +136,7 @@ void uiUnlocked(void); // Identify take action void identify_TakeAction(void) { -#if(LED_ENABLE == 1) +#if (LED_ENABLE == 1) LED_setOn(sAppGreenHandle, LED_BRIGHTNESS_MAX); LED_startBlinking(sAppGreenHandle, 1000, LED_BLINK_FOREVER); #endif // LED_ENABLE @@ -145,7 +145,7 @@ void identify_TakeAction(void) // Identify stop action void identify_StopAction(void) { -#if(LED_ENABLE == 1) +#if (LED_ENABLE == 1) LED_stopBlinking(sAppGreenHandle); LED_setOff(sAppGreenHandle); #endif // LED_ENABLE @@ -536,7 +536,7 @@ void uiUnlocked(void) #endif } -#if(BUTTON_ENABLE == 1) +#if (BUTTON_ENABLE == 1) void AppTask::ButtonLeftEventHandler(Button_Handle handle, Button_EventMask events) { AppEvent event; @@ -580,7 +580,7 @@ void AppTask::ButtonRightEventHandler(Button_Handle handle, Button_EventMask eve void AppTask::uiInit(void) { -#if(LED_ENABLE == 1) +#if (LED_ENABLE == 1) LED_Params ledParams; @@ -597,7 +597,7 @@ void AppTask::uiInit(void) LED_setOff(sAppGreenHandle); #endif // LED ENABLE -#if(BUTTON_ENABLE == 1) +#if (BUTTON_ENABLE == 1) Button_Params buttonParams; // Initialize buttons diff --git a/examples/pump-app/cc13x4_26x4/main/AppTask.cpp b/examples/pump-app/cc13x4_26x4/main/AppTask.cpp index 19d757d1e6d896..402339bf576071 100644 --- a/examples/pump-app/cc13x4_26x4/main/AppTask.cpp +++ b/examples/pump-app/cc13x4_26x4/main/AppTask.cpp @@ -273,7 +273,7 @@ void AppTask::ActionInitiated(PumpManager::Action_t aAction, int32_t aActor) PLAT_LOG("Stop initiated"); ; // TODO } -#if(LED_ENABLE == 1) +#if (LED_ENABLE == 1) LED_setOn(sAppGreenHandle, LED_BRIGHTNESS_MAX); LED_startBlinking(sAppGreenHandle, 50 /* ms */, LED_BLINK_FOREVER); LED_setOn(sAppRedHandle, LED_BRIGHTNESS_MAX); @@ -289,7 +289,7 @@ void AppTask::ActionCompleted(PumpManager::Action_t aAction, int32_t aActor) if (aAction == PumpManager::START_ACTION) { PLAT_LOG("Pump start completed"); -#if(LED_ENABLE == 1) +#if (LED_ENABLE == 1) LED_stopBlinking(sAppGreenHandle); LED_setOn(sAppGreenHandle, LED_BRIGHTNESS_MAX); LED_stopBlinking(sAppRedHandle); @@ -301,7 +301,7 @@ void AppTask::ActionCompleted(PumpManager::Action_t aAction, int32_t aActor) else if (aAction == PumpManager::STOP_ACTION) { PLAT_LOG("Pump stop completed"); -#if(LED_ENABLE == 1) +#if (LED_ENABLE == 1) LED_stopBlinking(sAppGreenHandle); LED_setOff(sAppGreenHandle); LED_stopBlinking(sAppRedHandle); @@ -369,7 +369,7 @@ void AppTask::DispatchEvent(AppEvent * aEvent) break; case AppEvent::kEventType_IdentifyStart: -#if(LED_ENABLE == 1) +#if (LED_ENABLE == 1) LED_setOn(sAppGreenHandle, LED_BRIGHTNESS_MAX); LED_startBlinking(sAppGreenHandle, sIdentifyBlinkRateMs, LED_BLINK_FOREVER); #endif @@ -377,7 +377,7 @@ void AppTask::DispatchEvent(AppEvent * aEvent) break; case AppEvent::kEventType_IdentifyStop: -#if(LED_ENABLE == 1) +#if (LED_ENABLE == 1) LED_stopBlinking(sAppGreenHandle); if (!PumpMgr().IsStopped()) { @@ -632,7 +632,7 @@ void AppTask::TriggerIdentifyEffectHandler(::Identify * identify) } } -#if(BUTTON_ENABLE == 1) +#if (BUTTON_ENABLE == 1) void AppTask::ButtonLeftEventHandler(Button_Handle handle, Button_EventMask events) { AppEvent event; @@ -676,7 +676,7 @@ void AppTask::ButtonRightEventHandler(Button_Handle handle, Button_EventMask eve void AppTask::uiInit(void) { -#if(LED_ENABLE == 1) +#if (LED_ENABLE == 1) LED_Params ledParams; @@ -693,7 +693,7 @@ void AppTask::uiInit(void) LED_setOff(sAppGreenHandle); #endif // LED ENABLE -#if(BUTTON_ENABLE == 1) +#if (BUTTON_ENABLE == 1) Button_Params buttonParams; // Initialize buttons diff --git a/examples/pump-controller-app/cc13x4_26x4/main/AppTask.cpp b/examples/pump-controller-app/cc13x4_26x4/main/AppTask.cpp index 5ee32070ae6965..2a499a9fd89a54 100644 --- a/examples/pump-controller-app/cc13x4_26x4/main/AppTask.cpp +++ b/examples/pump-controller-app/cc13x4_26x4/main/AppTask.cpp @@ -129,7 +129,7 @@ int AppTask::StartAppTask() // Identify take action void identify_TakeAction(void) { -#if(LED_ENABLE == 1) +#if (LED_ENABLE == 1) LED_setOn(sAppGreenHandle, LED_BRIGHTNESS_MAX); LED_startBlinking(sAppGreenHandle, 1000, LED_BLINK_FOREVER); #endif // LED_ENABLE @@ -138,7 +138,7 @@ void identify_TakeAction(void) // Identify stop action void identify_StopAction(void) { -#if(LED_ENABLE == 1) +#if (LED_ENABLE == 1) LED_stopBlinking(sAppGreenHandle); LED_setOff(sAppGreenHandle); #endif // LED_ENABLE @@ -275,7 +275,7 @@ void AppTask::ActionInitiated(PumpManager::Action_t aAction, int32_t aActor) PLAT_LOG("Stop initiated"); ; // TODO } -#if(LED_ENABLE == 1) +#if (LED_ENABLE == 1) LED_setOn(sAppGreenHandle, LED_BRIGHTNESS_MAX); LED_startBlinking(sAppGreenHandle, 50 /* ms */, LED_BLINK_FOREVER); LED_setOn(sAppRedHandle, LED_BRIGHTNESS_MAX); @@ -291,7 +291,7 @@ void AppTask::ActionCompleted(PumpManager::Action_t aAction, int32_t aActor) if (aAction == PumpManager::START_ACTION) { PLAT_LOG("Pump start completed"); -#if(LED_ENABLE == 1) +#if (LED_ENABLE == 1) LED_stopBlinking(sAppGreenHandle); LED_setOn(sAppGreenHandle, LED_BRIGHTNESS_MAX); LED_stopBlinking(sAppRedHandle); @@ -301,7 +301,7 @@ void AppTask::ActionCompleted(PumpManager::Action_t aAction, int32_t aActor) else if (aAction == PumpManager::STOP_ACTION) { PLAT_LOG("Pump stop completed"); -#if(LED_ENABLE == 1) +#if (LED_ENABLE == 1) LED_stopBlinking(sAppGreenHandle); LED_setOff(sAppGreenHandle); LED_stopBlinking(sAppRedHandle); @@ -367,7 +367,7 @@ void AppTask::DispatchEvent(AppEvent * aEvent) break; case AppEvent::kEventType_IdentifyStop: -#if(LED_ENABLE == 1) +#if (LED_ENABLE == 1) LED_stopBlinking(sAppGreenHandle); if (!PumpMgr().IsStopped()) @@ -440,7 +440,7 @@ void AppTask::TriggerIdentifyEffectHandler(::Identify * identify) } } -#if(BUTTON_ENABLE == 1) +#if (BUTTON_ENABLE == 1) void AppTask::ButtonLeftEventHandler(Button_Handle handle, Button_EventMask events) { AppEvent event; @@ -484,7 +484,7 @@ void AppTask::ButtonRightEventHandler(Button_Handle handle, Button_EventMask eve void AppTask::uiInit(void) { -#if(LED_ENABLE == 1) +#if (LED_ENABLE == 1) LED_Params ledParams; @@ -501,7 +501,7 @@ void AppTask::uiInit(void) LED_setOff(sAppGreenHandle); #endif // LED ENABLE -#if(BUTTON_ENABLE == 1) +#if (BUTTON_ENABLE == 1) Button_Params buttonParams; // Initialize buttons