Skip to content

Commit 0a20376

Browse files
committedApr 3, 2024·
replaced SED define with ICD server defines + other code cleanup
1 parent 74f076d commit 0a20376

File tree

12 files changed

+73
-82
lines changed

12 files changed

+73
-82
lines changed
 

‎examples/all-clusters-app/cc13x4_26x4/BUILD.gn

+4-5
Original file line numberDiff line numberDiff line change
@@ -115,15 +115,14 @@ ti_simplelink_executable("all-clusters-app") {
115115
deps += [ "${chip_root}/third_party/openthread/repo:libopenthread-mtd" ]
116116
}
117117

118+
defines = []
119+
118120
if (custom_factory_data) {
119-
defines = [ "CC13XX_26XX_FACTORY_DATA" ]
121+
defines += [ "CC13XX_26XX_FACTORY_DATA" ]
120122
}
121123

122124
if (chip_enable_icd_server) {
123-
defines += [
124-
"CHIP_DEVICE_CONFIG_ENABLE_SED",
125-
"TI_ICD_ENABLE_SERVER",
126-
]
125+
defines += [ "TI_ICD_ENABLE_SERVER" ]
127126
}
128127

129128
include_dirs = [

‎examples/all-clusters-app/cc13x4_26x4/main/AppTask.cpp

+5-4
Original file line numberDiff line numberDiff line change
@@ -196,11 +196,12 @@ int AppTask::Init()
196196

197197
#if CHIP_DEVICE_CONFIG_THREAD_FTD
198198
ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_Router);
199-
#elif CHIP_DEVICE_CONFIG_ENABLE_SED
199+
#elif CHIP_CONFIG_ENABLE_ICD_SERVER
200200
ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_SleepyEndDevice);
201201
#else
202202
ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_MinimalEndDevice);
203203
#endif
204+
204205
if (ret != CHIP_NO_ERROR)
205206
{
206207
PLAT_LOG("ConnectivityMgr().SetThreadDeviceType() failed");
@@ -344,7 +345,7 @@ void AppTask::DispatchEvent(AppEvent * aEvent)
344345
}
345346
}
346347

347-
#ifdef BUTTON_ENABLE
348+
#if(BUTTON_ENABLE == 1)
348349
void AppTask::ButtonLeftEventHandler(Button_Handle handle, Button_EventMask events)
349350
{
350351
AppEvent event;
@@ -388,7 +389,7 @@ void AppTask::ButtonRightEventHandler(Button_Handle handle, Button_EventMask eve
388389

389390
void AppTask::uiInit(void)
390391
{
391-
#ifdef LED_ENABLE
392+
#if(LED_ENABLE == 1)
392393

393394
LED_Params ledParams;
394395

@@ -405,7 +406,7 @@ void AppTask::uiInit(void)
405406
LED_setOff(sAppGreenHandle);
406407
#endif // LED ENABLE
407408

408-
#ifdef BUTTON_ENABLE
409+
#if(BUTTON_ENABLE == 1)
409410
Button_Params buttonParams;
410411

411412
// Initialize buttons

‎examples/lighting-app/cc13x4_26x4/BUILD.gn

+4-5
Original file line numberDiff line numberDiff line change
@@ -97,15 +97,14 @@ ti_simplelink_executable("lighting_app") {
9797
deps += [ "${chip_root}/third_party/openthread/repo:libopenthread-mtd" ]
9898
}
9999

100+
defines = []
101+
100102
if (custom_factory_data) {
101-
defines = [ "CC13XX_26XX_FACTORY_DATA" ]
103+
defines += [ "CC13XX_26XX_FACTORY_DATA" ]
102104
}
103105

104106
if (chip_enable_icd_server) {
105-
defines += [
106-
"CHIP_DEVICE_CONFIG_ENABLE_SED",
107-
"TI_ICD_ENABLE_SERVER",
108-
]
107+
defines += [ "TI_ICD_ENABLE_SERVER" ]
109108
}
110109

111110
include_dirs = [

‎examples/lighting-app/cc13x4_26x4/src/AppTask.cpp

+12-13
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ int AppTask::StartAppTask()
144144
// Identify take action
145145
void identify_TakeAction(void)
146146
{
147-
#ifdef LED_ENABLE
147+
#if(LED_ENABLE == 1)
148148
LED_setOn(sAppGreenHandle, LED_BRIGHTNESS_MAX);
149149
LED_startBlinking(sAppGreenHandle, 1000, LED_BLINK_FOREVER);
150150
#endif // LED_ENABLE
@@ -153,7 +153,7 @@ void identify_TakeAction(void)
153153
// Identify stop action
154154
void identify_StopAction(void)
155155
{
156-
#ifdef LED_ENABLE
156+
#if(LED_ENABLE == 1)
157157
LED_stopBlinking(sAppGreenHandle);
158158
LED_setOff(sAppGreenHandle);
159159
#endif // LED_ENABLE
@@ -183,13 +183,12 @@ int AppTask::Init()
183183
}
184184
#if CHIP_DEVICE_CONFIG_THREAD_FTD
185185
ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_Router);
186-
#else
187-
#if CHIP_DEVICE_CONFIG_ENABLE_SED
186+
#elif CHIP_CONFIG_ENABLE_ICD_SERVER
188187
ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_SleepyEndDevice);
189188
#else
190189
ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_MinimalEndDevice);
191-
#endif // CHIP_DEVICE_CONFIG_ENABLE_SED
192-
#endif // CHIP_DEVICE_CONFIG_THREAD_FTD
190+
#endif
191+
193192
if (ret != CHIP_NO_ERROR)
194193
{
195194
PLAT_LOG("ConnectivityMgr().SetThreadDeviceType() failed");
@@ -479,7 +478,7 @@ void AppTask::TriggerIdentifyEffectHandler(::Identify * identify)
479478
void uiTurnOn(void)
480479
{
481480
PLAT_LOG("Light On initiated");
482-
#ifdef LED_ENABLE
481+
#if(LED_ENABLE == 1)
483482
LED_setOn(sAppRedHandle, LED_BRIGHTNESS_MAX);
484483
LED_startBlinking(sAppRedHandle, 110 /* ms */, LED_BLINK_FOREVER);
485484
#endif // LED_ENABLE
@@ -489,7 +488,7 @@ void uiTurnOn(void)
489488
void uiTurnedOn(void)
490489
{
491490
PLAT_LOG("Light On completed");
492-
#ifdef LED_ENABLE
491+
#if(LED_ENABLE == 1)
493492
LED_stopBlinking(sAppRedHandle);
494493
LED_setOn(sAppRedHandle, LED_BRIGHTNESS_MAX);
495494
#endif // LED_ENABLE
@@ -499,7 +498,7 @@ void uiTurnedOn(void)
499498
void uiTurnOff(void)
500499
{
501500
PLAT_LOG("Light Off initiated");
502-
#ifdef LED_ENABLE
501+
#if(LED_ENABLE == 1)
503502
LED_setOn(sAppRedHandle, LED_BRIGHTNESS_MAX);
504503
LED_startBlinking(sAppRedHandle, 110 /* ms */, LED_BLINK_FOREVER);
505504
#endif // LED_ENABLE
@@ -509,13 +508,13 @@ void uiTurnOff(void)
509508
void uiTurnedOff(void)
510509
{
511510
PLAT_LOG("Light Off completed");
512-
#ifdef LED_ENABLE
511+
#if(LED_ENABLE == 1)
513512
LED_stopBlinking(sAppRedHandle);
514513
LED_setOff(sAppRedHandle);
515514
#endif // LED_ENABLE
516515
}
517516

518-
#ifdef BUTTON_ENABLE
517+
#if(BUTTON_ENABLE == 1)
519518
void AppTask::ButtonLeftEventHandler(Button_Handle handle, Button_EventMask events)
520519
{
521520
AppEvent event;
@@ -559,7 +558,7 @@ void AppTask::ButtonRightEventHandler(Button_Handle handle, Button_EventMask eve
559558

560559
void AppTask::uiInit(void)
561560
{
562-
#ifdef LED_ENABLE
561+
#if(LED_ENABLE == 1)
563562

564563
LED_Params ledParams;
565564

@@ -576,7 +575,7 @@ void AppTask::uiInit(void)
576575
LED_setOff(sAppGreenHandle);
577576
#endif // LED ENABLE
578577

579-
#ifdef BUTTON_ENABLE
578+
#if(BUTTON_ENABLE == 1)
580579
Button_Params buttonParams;
581580

582581
// Initialize buttons

‎examples/lock-app/cc13x4_26x4/BUILD.gn

+4-5
Original file line numberDiff line numberDiff line change
@@ -101,15 +101,14 @@ ti_simplelink_executable("lock_app") {
101101
deps += [ "${chip_root}/third_party/openthread/repo:libopenthread-mtd" ]
102102
}
103103

104+
defines = []
105+
104106
if (custom_factory_data) {
105-
defines = [ "CC13XX_26XX_FACTORY_DATA" ]
107+
defines += [ "CC13XX_26XX_FACTORY_DATA" ]
106108
}
107109

108110
if (chip_enable_icd_server) {
109-
defines += [
110-
"CHIP_DEVICE_CONFIG_ENABLE_SED",
111-
"TI_ICD_ENABLE_SERVER",
112-
]
111+
defines += [ "TI_ICD_ENABLE_SERVER" ]
113112
}
114113
include_dirs = [
115114
"${project_dir}",

‎examples/lock-app/cc13x4_26x4/src/AppTask.cpp

+8-9
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ void uiUnlocked(void);
136136
// Identify take action
137137
void identify_TakeAction(void)
138138
{
139-
#ifdef LED_ENABLE
139+
#if(LED_ENABLE == 1)
140140
LED_setOn(sAppGreenHandle, LED_BRIGHTNESS_MAX);
141141
LED_startBlinking(sAppGreenHandle, 1000, LED_BLINK_FOREVER);
142142
#endif // LED_ENABLE
@@ -145,7 +145,7 @@ void identify_TakeAction(void)
145145
// Identify stop action
146146
void identify_StopAction(void)
147147
{
148-
#ifdef LED_ENABLE
148+
#if(LED_ENABLE == 1)
149149
LED_stopBlinking(sAppGreenHandle);
150150
LED_setOff(sAppGreenHandle);
151151
#endif // LED_ENABLE
@@ -175,12 +175,11 @@ int AppTask::Init()
175175
}
176176
#if CHIP_DEVICE_CONFIG_THREAD_FTD
177177
ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_Router);
178-
#else
179-
#if CHIP_DEVICE_CONFIG_ENABLE_SED
178+
#elif CHIP_CONFIG_ENABLE_ICD_SERVER
180179
ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_SleepyEndDevice);
180+
#else
181181
ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_MinimalEndDevice);
182-
#endif // CHIP_DEVICE_CONFIG_ENABLE_SED
183-
#endif // CHIP_DEVICE_CONFIG_THREAD_FTD
182+
#endif
184183

185184
if (ret != CHIP_NO_ERROR)
186185
{
@@ -537,7 +536,7 @@ void uiUnlocked(void)
537536
#endif
538537
}
539538

540-
#ifdef BUTTON_ENABLE
539+
#if(BUTTON_ENABLE == 1)
541540
void AppTask::ButtonLeftEventHandler(Button_Handle handle, Button_EventMask events)
542541
{
543542
AppEvent event;
@@ -581,7 +580,7 @@ void AppTask::ButtonRightEventHandler(Button_Handle handle, Button_EventMask eve
581580

582581
void AppTask::uiInit(void)
583582
{
584-
#ifdef LED_ENABLE
583+
#if(LED_ENABLE == 1)
585584

586585
LED_Params ledParams;
587586

@@ -598,7 +597,7 @@ void AppTask::uiInit(void)
598597
LED_setOff(sAppGreenHandle);
599598
#endif // LED ENABLE
600599

601-
#ifdef BUTTON_ENABLE
600+
#if(BUTTON_ENABLE == 1)
602601
Button_Params buttonParams;
603602

604603
// Initialize buttons

‎examples/pump-app/cc13x4_26x4/BUILD.gn

+4-5
Original file line numberDiff line numberDiff line change
@@ -97,15 +97,14 @@ ti_simplelink_executable("pump_app") {
9797
deps += [ "${chip_root}/third_party/openthread/repo:libopenthread-mtd" ]
9898
}
9999

100+
defines = []
101+
100102
if (custom_factory_data) {
101-
defines = [ "CC13XX_26XX_FACTORY_DATA" ]
103+
defines += [ "CC13XX_26XX_FACTORY_DATA" ]
102104
}
103105

104106
if (chip_enable_icd_server) {
105-
defines += [
106-
"CHIP_DEVICE_CONFIG_ENABLE_SED",
107-
"TI_ICD_ENABLE_SERVER",
108-
]
107+
defines += [ "TI_ICD_ENABLE_SERVER" ]
109108
}
110109

111110
include_dirs = [

‎examples/pump-app/cc13x4_26x4/main/AppTask.cpp

+11-12
Original file line numberDiff line numberDiff line change
@@ -163,13 +163,12 @@ int AppTask::Init()
163163

164164
#if CHIP_DEVICE_CONFIG_THREAD_FTD
165165
ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_Router);
166-
#else
167-
#if CHIP_DEVICE_CONFIG_ENABLE_SED
166+
#elif CHIP_CONFIG_ENABLE_ICD_SERVER
168167
ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_SleepyEndDevice);
169168
#else
170169
ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_MinimalEndDevice);
171-
#endif // CHIP_DEVICE_CONFIG_ENABLE_SED
172-
#endif // CHIP_DEVICE_CONFIG_THREAD_FTD
170+
#endif
171+
173172
if (ret != CHIP_NO_ERROR)
174173
{
175174
PLAT_LOG("ConnectivityMgr().SetThreadDeviceType() failed");
@@ -274,7 +273,7 @@ void AppTask::ActionInitiated(PumpManager::Action_t aAction, int32_t aActor)
274273
PLAT_LOG("Stop initiated");
275274
; // TODO
276275
}
277-
#ifdef LED_ENABLE
276+
#if(LED_ENABLE == 1)
278277
LED_setOn(sAppGreenHandle, LED_BRIGHTNESS_MAX);
279278
LED_startBlinking(sAppGreenHandle, 50 /* ms */, LED_BLINK_FOREVER);
280279
LED_setOn(sAppRedHandle, LED_BRIGHTNESS_MAX);
@@ -290,7 +289,7 @@ void AppTask::ActionCompleted(PumpManager::Action_t aAction, int32_t aActor)
290289
if (aAction == PumpManager::START_ACTION)
291290
{
292291
PLAT_LOG("Pump start completed");
293-
#ifdef LED_ENABLE
292+
#if(LED_ENABLE == 1)
294293
LED_stopBlinking(sAppGreenHandle);
295294
LED_setOn(sAppGreenHandle, LED_BRIGHTNESS_MAX);
296295
LED_stopBlinking(sAppRedHandle);
@@ -302,7 +301,7 @@ void AppTask::ActionCompleted(PumpManager::Action_t aAction, int32_t aActor)
302301
else if (aAction == PumpManager::STOP_ACTION)
303302
{
304303
PLAT_LOG("Pump stop completed");
305-
#ifdef LED_ENABLE
304+
#if(LED_ENABLE == 1)
306305
LED_stopBlinking(sAppGreenHandle);
307306
LED_setOff(sAppGreenHandle);
308307
LED_stopBlinking(sAppRedHandle);
@@ -370,15 +369,15 @@ void AppTask::DispatchEvent(AppEvent * aEvent)
370369
break;
371370

372371
case AppEvent::kEventType_IdentifyStart:
373-
#ifdef LED_ENABLE
372+
#if(LED_ENABLE == 1)
374373
LED_setOn(sAppGreenHandle, LED_BRIGHTNESS_MAX);
375374
LED_startBlinking(sAppGreenHandle, sIdentifyBlinkRateMs, LED_BLINK_FOREVER);
376375
#endif
377376
PLAT_LOG("Identify started");
378377
break;
379378

380379
case AppEvent::kEventType_IdentifyStop:
381-
#ifdef LED_ENABLE
380+
#if(LED_ENABLE == 1)
382381
LED_stopBlinking(sAppGreenHandle);
383382
if (!PumpMgr().IsStopped())
384383
{
@@ -633,7 +632,7 @@ void AppTask::TriggerIdentifyEffectHandler(::Identify * identify)
633632
}
634633
}
635634

636-
#ifdef BUTTON_ENABLE
635+
#if(BUTTON_ENABLE == 1)
637636
void AppTask::ButtonLeftEventHandler(Button_Handle handle, Button_EventMask events)
638637
{
639638
AppEvent event;
@@ -677,7 +676,7 @@ void AppTask::ButtonRightEventHandler(Button_Handle handle, Button_EventMask eve
677676

678677
void AppTask::uiInit(void)
679678
{
680-
#ifdef LED_ENABLE
679+
#if(LED_ENABLE == 1)
681680

682681
LED_Params ledParams;
683682

@@ -694,7 +693,7 @@ void AppTask::uiInit(void)
694693
LED_setOff(sAppGreenHandle);
695694
#endif // LED ENABLE
696695

697-
#ifdef BUTTON_ENABLE
696+
#if(BUTTON_ENABLE == 1)
698697
Button_Params buttonParams;
699698

700699
// Initialize buttons

‎examples/pump-controller-app/cc13x4_26x4/BUILD.gn

+5-5
Original file line numberDiff line numberDiff line change
@@ -96,16 +96,16 @@ ti_simplelink_executable("pump_controller_app") {
9696
deps += [ "${chip_root}/third_party/openthread/repo:libopenthread-mtd" ]
9797
}
9898

99+
defines = []
100+
99101
if (custom_factory_data) {
100-
defines = [ "CC13XX_26XX_FACTORY_DATA" ]
102+
defines += [ "CC13XX_26XX_FACTORY_DATA" ]
101103
}
102104

103105
if (chip_enable_icd_server) {
104-
defines += [
105-
"CHIP_DEVICE_CONFIG_ENABLE_SED",
106-
"TI_ICD_ENABLE_SERVER",
107-
]
106+
defines += [ "TI_ICD_ENABLE_SERVER" ]
108107
}
108+
109109
include_dirs = [
110110
"${project_dir}",
111111
"${project_dir}/main",

0 commit comments

Comments
 (0)
Please sign in to comment.