[TI] ICD support for TI CC13x4 (#32823)
* ICD support for TI CC13x4
* spelling fix
* Restyled by whitespace
* Restyled by clang-format
* Restyled by gn
* Restyled by prettier-markdown
* replaced SED define with ICD server defines + other code cleanup
* Restyled by whitespace
* Restyled by clang-format
---------
Co-authored-by: Restyled.io <commits@restyled.io>
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 0000000..7e10ceb
--- /dev/null
+++ b/docs/guides/ti/enabling_icd_on_ti_devices.md
@@ -0,0 +1,59 @@
+# 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 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
+#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/<example-name>/<example-name>-common`) for
+the example being configured as an ICD. Add the ICD Management Cluster for
+Endpoint 0.
+
+Open up the .matter file (in `examples/<example-name>/<example-name>-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 eb11837..a20b07b 100644
--- a/examples/all-clusters-app/cc13x4_26x4/BUILD.gn
+++ b/examples/all-clusters-app/cc13x4_26x4/BUILD.gn
@@ -67,9 +67,7 @@
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),
]
}
@@ -117,8 +115,14 @@
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 += [ "TI_ICD_ENABLE_SERVER" ]
}
include_dirs = [
diff --git a/examples/all-clusters-app/cc13x4_26x4/args.gni b/examples/all-clusters-app/cc13x4_26x4/args.gni
index 35d9666..f6d5851 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_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/main/AppTask.cpp b/examples/all-clusters-app/cc13x4_26x4/main/AppTask.cpp
index f824363..6df3ff3 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::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,11 +196,12 @@
#if CHIP_DEVICE_CONFIG_THREAD_FTD
ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_Router);
-#elif CONFIG_OPENTHREAD_MTD_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");
@@ -312,46 +291,6 @@
}
}
-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)
{
switch (aEvent->Type)
@@ -405,3 +344,85 @@
break;
}
}
+
+#if (BUTTON_ENABLE == 1)
+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)
+{
+#if (LED_ENABLE == 1)
+
+ 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
+
+#if (BUTTON_ENABLE == 1)
+ 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/all-clusters-app/cc13x4_26x4/main/include/AppTask.h b/examples/all-clusters-app/cc13x4_26x4/main/include/AppTask.h
index 6ab8ca4..55297d7 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 @@
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 5a7f6a6..8162d89 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 @@
// ================================================================================
// 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 02d9b0b..6434af6 100644
--- a/examples/lighting-app/cc13x4_26x4/BUILD.gn
+++ b/examples/lighting-app/cc13x4_26x4/BUILD.gn
@@ -67,9 +67,7 @@
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),
]
}
@@ -99,8 +97,14 @@
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 += [ "TI_ICD_ENABLE_SERVER" ]
}
include_dirs = [
diff --git a/examples/lighting-app/cc13x4_26x4/args.gni b/examples/lighting-app/cc13x4_26x4/args.gni
index c9f4b71..640bf6e 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 @@
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_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/src/AppTask.cpp b/examples/lighting-app/cc13x4_26x4/src/AppTask.cpp
index 94674a1..bad302b 100644
--- a/examples/lighting-app/cc13x4_26x4/src/AppTask.cpp
+++ b/examples/lighting-app/cc13x4_26x4/src/AppTask.cpp
@@ -67,6 +67,13 @@
#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,11 @@
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 +141,26 @@
return ret;
}
-// Action initiated callback
-void uiTurnOn(void)
+// Identify take action
+void identify_TakeAction(void)
{
- PLAT_LOG("Light On initiated");
- LED_setOn(sAppRedHandle, LED_BRIGHTNESS_MAX);
- LED_startBlinking(sAppRedHandle, 110 /* ms */, LED_BLINK_FOREVER);
+#if (LED_ENABLE == 1)
+ LED_setOn(sAppGreenHandle, LED_BRIGHTNESS_MAX);
+ LED_startBlinking(sAppGreenHandle, 1000, LED_BLINK_FOREVER);
+#endif // LED_ENABLE
}
-// Action completed callback
-void uiTurnedOn(void)
+// Identify stop action
+void identify_StopAction(void)
{
- PLAT_LOG("Light On completed");
- LED_stopBlinking(sAppRedHandle);
- LED_setOn(sAppRedHandle, LED_BRIGHTNESS_MAX);
-}
-
-// Action initiated callback
-void uiTurnOff(void)
-{
- PLAT_LOG("Light Off initiated");
- LED_setOn(sAppRedHandle, LED_BRIGHTNESS_MAX);
- LED_startBlinking(sAppRedHandle, 110 /* ms */, LED_BLINK_FOREVER);
-}
-
-// Action completed callback
-void uiTurnedOff(void)
-{
- PLAT_LOG("Light Off completed");
- LED_stopBlinking(sAppRedHandle);
- LED_setOff(sAppRedHandle);
+#if (LED_ENABLE == 1)
+ 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 +183,12 @@
}
#if CHIP_DEVICE_CONFIG_THREAD_FTD
ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_Router);
+#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");
@@ -238,33 +236,7 @@
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 +254,7 @@
#if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR
InitializeOTARequestor();
#endif
+
// QR code will be used with CHIP Tool
PrintOnboardingCodes(RendezvousInformationFlags(RendezvousInformationFlag::kBLE));
@@ -304,46 +277,6 @@
}
}
-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 +391,13 @@
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 +406,7 @@
break;
case AppEvent::kEventType_IdentifyStop:
- LED_stopBlinking(sAppGreenHandle);
- LED_setOff(sAppGreenHandle);
+ identify_StopAction();
PLAT_LOG("Identify stopped");
break;
@@ -544,3 +473,125 @@
PLAT_LOG("No identifier effect");
}
}
+
+// Action initiated callback
+void uiTurnOn(void)
+{
+ PLAT_LOG("Light On initiated");
+#if (LED_ENABLE == 1)
+ 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");
+#if (LED_ENABLE == 1)
+ LED_stopBlinking(sAppRedHandle);
+ LED_setOn(sAppRedHandle, LED_BRIGHTNESS_MAX);
+#endif // LED_ENABLE
+}
+
+// Action initiated callback
+void uiTurnOff(void)
+{
+ PLAT_LOG("Light Off initiated");
+#if (LED_ENABLE == 1)
+ 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");
+#if (LED_ENABLE == 1)
+ LED_stopBlinking(sAppRedHandle);
+ LED_setOff(sAppRedHandle);
+#endif // LED_ENABLE
+}
+
+#if (BUTTON_ENABLE == 1)
+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)
+{
+#if (LED_ENABLE == 1)
+
+ 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
+
+#if (BUTTON_ENABLE == 1)
+ 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 c82a122..653d436 100644
--- a/examples/lighting-app/cc13x4_26x4/src/AppTask.h
+++ b/examples/lighting-app/cc13x4_26x4/src/AppTask.h
@@ -69,6 +69,7 @@
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 6cf27cf..d2635ed 100644
--- a/examples/lighting-app/cc13x4_26x4/src/main.cpp
+++ b/examples/lighting-app/cc13x4_26x4/src/main.cpp
@@ -48,14 +48,6 @@
// ================================================================================
// 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 aed45f8..ab32881 100644
--- a/examples/lock-app/cc13x4_26x4/BUILD.gn
+++ b/examples/lock-app/cc13x4_26x4/BUILD.gn
@@ -63,10 +63,16 @@
cflags = [
"-Wno-comment",
- "@" + rebase_path("${target_gen_dir}/sysconfig/ti_ble_app_config.opt",
+ "@" + rebase_path("${target_gen_dir}/sysconfig/ti_utils_build_compiler.opt",
root_build_dir),
- "@" + rebase_path("${target_gen_dir}/sysconfig/ti_build_config.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/",
]
}
@@ -95,10 +101,15 @@
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 += [ "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 d7508aa..1e92a24 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 @@
# 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/src/AppTask.cpp b/examples/lock-app/cc13x4_26x4/src/AppTask.cpp
index c42d06c..1b65334 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 sAppGreenHandle;
static Button_Handle sAppLeftHandle;
static Button_Handle sAppRightHandle;
+
static DeviceInfoProviderImpl sExampleDeviceInfoProvider;
AppTask AppTask::sAppTask;
@@ -120,47 +128,31 @@
return ret;
}
-void uiLocking(void)
+void uiLocking(void);
+void uiLocked(void);
+void uiUnlocking(void);
+void uiUnlocked(void);
+
+// Identify take action
+void identify_TakeAction(void)
{
- PLAT_LOG("Lock initiated");
+#if (LED_ENABLE == 1)
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 uiLocked(void)
+// Identify stop action
+void identify_StopAction(void)
{
- PLAT_LOG("Lock completed");
+#if (LED_ENABLE == 1)
LED_stopBlinking(sAppGreenHandle);
LED_setOff(sAppGreenHandle);
- LED_stopBlinking(sAppRedHandle);
- LED_setOn(sAppRedHandle, LED_BRIGHTNESS_MAX);
-}
-
-void uiUnlocking(void)
-{
- 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);
-}
-
-void uiUnlocked(void)
-{
- PLAT_LOG("Unlock completed");
- 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
@@ -183,9 +175,12 @@
}
#if CHIP_DEVICE_CONFIG_THREAD_FTD
ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_Router);
+#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");
@@ -233,33 +228,7 @@
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 +325,6 @@
}
}
-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 +427,12 @@
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 +491,129 @@
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
+}
+
+#if (BUTTON_ENABLE == 1)
+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)
+{
+#if (LED_ENABLE == 1)
+
+ 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
+
+#if (BUTTON_ENABLE == 1)
+ 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 7778fd5..8f14269 100644
--- a/examples/lock-app/cc13x4_26x4/src/AppTask.h
+++ b/examples/lock-app/cc13x4_26x4/src/AppTask.h
@@ -69,7 +69,7 @@
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 6cf27cf..35588f6 100644
--- a/examples/lock-app/cc13x4_26x4/src/main.cpp
+++ b/examples/lock-app/cc13x4_26x4/src/main.cpp
@@ -48,13 +48,6 @@
// ================================================================================
// 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 8c68ba7..d20d2d8 100644
--- a/examples/pump-app/cc13x4_26x4/BUILD.gn
+++ b/examples/pump-app/cc13x4_26x4/BUILD.gn
@@ -66,9 +66,7 @@
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),
]
}
@@ -99,8 +97,14 @@
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 += [ "TI_ICD_ENABLE_SERVER" ]
}
include_dirs = [
diff --git a/examples/pump-app/cc13x4_26x4/args.gni b/examples/pump-app/cc13x4_26x4/args.gni
index 05c67f2..94b3913 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_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/main/AppTask.cpp b/examples/pump-app/cc13x4_26x4/main/AppTask.cpp
index ea094e9..402339b 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::Init()
{
- LED_Params ledParams;
- Button_Params buttonParams;
-
cc13xx_26xxLogInit();
// Init Chip memory management before the stack
@@ -159,11 +163,12 @@
#if CHIP_DEVICE_CONFIG_THREAD_FTD
ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_Router);
-#elif CONFIG_OPENTHREAD_MTD_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");
@@ -179,33 +184,7 @@
;
}
- // 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 +259,6 @@
}
}
-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 +273,12 @@
PLAT_LOG("Stop initiated");
; // TODO
}
-
+#if (LED_ENABLE == 1)
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 +289,24 @@
if (aAction == PumpManager::START_ACTION)
{
PLAT_LOG("Pump start completed");
+#if (LED_ENABLE == 1)
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");
+#if (LED_ENABLE == 1)
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 +369,16 @@
break;
case AppEvent::kEventType_IdentifyStart:
+#if (LED_ENABLE == 1)
LED_setOn(sAppGreenHandle, LED_BRIGHTNESS_MAX);
LED_startBlinking(sAppGreenHandle, sIdentifyBlinkRateMs, LED_BLINK_FOREVER);
+#endif
PLAT_LOG("Identify started");
break;
case AppEvent::kEventType_IdentifyStop:
+#if (LED_ENABLE == 1)
LED_stopBlinking(sAppGreenHandle);
-
if (!PumpMgr().IsStopped())
{
LED_setOn(sAppGreenHandle, LED_BRIGHTNESS_MAX);
@@ -437,6 +387,7 @@
{
LED_setOff(sAppGreenHandle);
}
+#endif
PLAT_LOG("Identify stopped");
break;
@@ -680,3 +631,85 @@
PLAT_LOG("No identifier effect");
}
}
+
+#if (BUTTON_ENABLE == 1)
+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)
+{
+#if (LED_ENABLE == 1)
+
+ 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
+
+#if (BUTTON_ENABLE == 1)
+ 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/include/AppTask.h b/examples/pump-app/cc13x4_26x4/main/include/AppTask.h
index 47b4fd5..ceba04b 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 @@
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 ba98379..84b66b7 100644
--- a/examples/pump-app/cc13x4_26x4/main/main.cpp
+++ b/examples/pump-app/cc13x4_26x4/main/main.cpp
@@ -48,14 +48,6 @@
// ================================================================================
// 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 289b10d..61aa833 100644
--- a/examples/pump-controller-app/cc13x4_26x4/BUILD.gn
+++ b/examples/pump-controller-app/cc13x4_26x4/BUILD.gn
@@ -67,9 +67,7 @@
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),
]
}
@@ -98,8 +96,14 @@
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 += [ "TI_ICD_ENABLE_SERVER" ]
}
include_dirs = [
diff --git a/examples/pump-controller-app/cc13x4_26x4/args.gni b/examples/pump-controller-app/cc13x4_26x4/args.gni
index e2beed5..0aecbe2 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_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-controller-app/cc13x4_26x4/chip.syscfg b/examples/pump-controller-app/cc13x4_26x4/chip.syscfg
index e4ae2b6..d0cdc69 100644
--- a/examples/pump-controller-app/cc13x4_26x4/chip.syscfg
+++ b/examples/pump-controller-app/cc13x4_26x4/chip.syscfg
@@ -175,6 +175,7 @@
LED2.gpioPin.$name = "CONFIG_GPIO_GLED";
LED2.gpioPin.mode = "Output";
+
/* Debug UART */
UART2.$hardware = system.deviceData.board.components.XDS110UART;
UART2.$name = "CONFIG_UART2_DEBUG";
diff --git a/examples/pump-controller-app/cc13x4_26x4/main/AppTask.cpp b/examples/pump-controller-app/cc13x4_26x4/main/AppTask.cpp
index a8a61bd..2a499a9 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 @@
return ret;
}
+// Identify take action
+void identify_TakeAction(void)
+{
+#if (LED_ENABLE == 1)
+ LED_setOn(sAppGreenHandle, LED_BRIGHTNESS_MAX);
+ LED_startBlinking(sAppGreenHandle, 1000, LED_BLINK_FOREVER);
+#endif // LED_ENABLE
+}
+
+// Identify stop action
+void identify_StopAction(void)
+{
+#if (LED_ENABLE == 1)
+ 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
@@ -147,7 +169,7 @@
#if CHIP_DEVICE_CONFIG_THREAD_FTD
ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_Router);
-#elif CONFIG_OPENTHREAD_MTD_SED
+#elif CHIP_CONFIG_ENABLE_ICD_SERVER
ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_SleepyEndDevice);
#else
ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_MinimalEndDevice);
@@ -195,33 +217,7 @@
(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 +261,6 @@
}
}
-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 +275,12 @@
PLAT_LOG("Stop initiated");
; // TODO
}
-
+#if (LED_ENABLE == 1)
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 +291,22 @@
if (aAction == PumpManager::START_ACTION)
{
PLAT_LOG("Pump start completed");
+#if (LED_ENABLE == 1)
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");
+#if (LED_ENABLE == 1)
LED_stopBlinking(sAppGreenHandle);
LED_setOff(sAppGreenHandle);
LED_stopBlinking(sAppRedHandle);
LED_setOff(sAppRedHandle);
+#endif
}
if (aActor == AppEvent::kEventType_ButtonLeft)
{
@@ -397,12 +362,12 @@
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:
+#if (LED_ENABLE == 1)
LED_stopBlinking(sAppGreenHandle);
if (!PumpMgr().IsStopped())
@@ -413,6 +378,7 @@
{
LED_setOff(sAppGreenHandle);
}
+#endif
PLAT_LOG("Identify stopped");
break;
@@ -473,3 +439,85 @@
PLAT_LOG("No identifier effect");
}
}
+
+#if (BUTTON_ENABLE == 1)
+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)
+{
+#if (LED_ENABLE == 1)
+
+ 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
+
+#if (BUTTON_ENABLE == 1)
+ 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/include/AppTask.h b/examples/pump-controller-app/cc13x4_26x4/main/include/AppTask.h
index bb81558..b53663a 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 @@
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 ba98379..84b66b7 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 @@
// ================================================================================
// 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 2480f08..9a2e3f2 100644
--- a/examples/shell/cc13x4_26x4/BUILD.gn
+++ b/examples/shell/cc13x4_26x4/BUILD.gn
@@ -63,9 +63,7 @@
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),
]
}
@@ -98,8 +96,14 @@
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 += [ "TI_ICD_ENABLE_SERVER" ]
}
include_dirs = [
diff --git a/examples/shell/cc13x4_26x4/args.gni b/examples/shell/cc13x4_26x4/args.gni
index 6726b73..21f7524 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_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/main/AppTask.cpp b/examples/shell/cc13x4_26x4/main/AppTask.cpp
index 2c6aada..83684b0 100644
--- a/examples/shell/cc13x4_26x4/main/AppTask.cpp
+++ b/examples/shell/cc13x4_26x4/main/AppTask.cpp
@@ -122,7 +122,7 @@
;
}
-#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);
diff --git a/examples/shell/cc13x4_26x4/main/main.cpp b/examples/shell/cc13x4_26x4/main/main.cpp
index 93b5f91..5f1e200 100644
--- a/examples/shell/cc13x4_26x4/main/main.cpp
+++ b/examples/shell/cc13x4_26x4/main/main.cpp
@@ -48,14 +48,6 @@
// ================================================================================
// 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 5d5d9d3..4d0c009 100644
--- a/src/platform/cc13xx_26xx/BLEManagerImpl.cpp
+++ b/src/platform/cc13xx_26xx/BLEManagerImpl.cpp
@@ -395,7 +395,7 @@
.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 @@
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 34c517e..b4cf4e2 100644
--- a/src/platform/cc13xx_26xx/cc13x4_26x4/BLEManagerImpl.h
+++ b/src/platform/cc13xx_26xx/cc13x4_26x4/BLEManagerImpl.h
@@ -279,7 +279,7 @@
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 70d524a..60226ab 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
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 d5579bf..91ef114 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 @@
.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 b506dc3..e768b08 100644
--- a/src/platform/cc13xx_26xx/chipOBleProfile.c
+++ b/src/platform/cc13xx_26xx/chipOBleProfile.c
@@ -169,7 +169,8 @@
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 79f2e20..e7040b1 100644
--- a/third_party/ti_simplelink_sdk/BUILD.gn
+++ b/third_party/ti_simplelink_sdk/BUILD.gn
@@ -99,13 +99,13 @@
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 @@
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 93adb54..374a26a 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 fbdf81b..44284f7 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 e1828c9..146e3db 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 @@
# 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 @@
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 @@
} 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 1da4bbb..e0a848a 100644
--- a/third_party/ti_simplelink_sdk/ti_simplelink_executable.gni
+++ b/third_party/ti_simplelink_sdk/ti_simplelink_executable.gni
@@ -280,31 +280,14 @@
"-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") {
@@ -428,15 +411,18 @@
]
}
- # 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 98a6acb..326d2b7 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 @@
"-fno-exceptions",
"-fno-unwind-tables",
]
+
+ cflags = [ "-Wno-sign-compare" ]
defines = [ "DeviceFamily_CC26X2X7" ]
}
@@ -82,6 +85,7 @@
"-fno-exceptions",
"-fno-unwind-tables",
]
+ cflags = [ "-Wno-sign-compare" ]
if (ti_simplelink_device == "") {
defines = [ "DeviceFamily_CC13X4" ]
} else {
@@ -91,6 +95,7 @@
config("cc32xx_${target_name}_config") {
ldflags = [ "-nostartfiles" ]
+ cflags = [ "-Wno-sign-compare" ]
defines = [ "CC32XXWARE" ]
}
@@ -176,21 +181,30 @@
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
}
@@ -198,26 +212,17 @@
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",
- "${ti_simplelink_sdk_root}/source/ti/devices/cc13x2_cc26x2/driverlib/bin/gcc/driverlib.lib",
- ]
+ 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_${ti_simplelink_soc_family}.a",
- "${ti_simplelink_sdk_root}/source/ti/devices/cc13x2x7_cc26x2x7/driverlib/bin/gcc/driverlib.lib",
- ]
+ 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",
- "${ti_simplelink_sdk_root}/source/ti/devices/cc13x4_cc26x4/driverlib/bin/gcc/driverlib.lib",
- ]
+ 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" ]
@@ -248,13 +253,20 @@
]
}
- 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 +280,6 @@
include_dirs += invoker.include_dirs
}
- forward_variables_from(invoker, [ "defines" ])
-
configs = [ ":${ti_simplelink_device_family}_sdk_config" ]
}
@@ -358,7 +368,10 @@
"${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,7 +779,6 @@
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" ||
@@ -774,11 +786,60 @@
public_deps += [
":${sdk_target_name}_dmm",
":${sdk_target_name}_nvocmp",
+ ":build_external_library",
]
}
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" ]
+ }
+}