Skip to content

Commit 8e3de1a

Browse files
committed
Added light-switch to CI and restyled changes
1 parent 8238272 commit 8e3de1a

File tree

7 files changed

+76
-52
lines changed

7 files changed

+76
-52
lines changed

.github/workflows/examples-cc13xx_26xx.yaml

+15-1
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ jobs:
7070
--target ti-cc13x4_26x4-pump-ftd \
7171
--target ti-cc13x4_26x4-pump-controller-mtd \
7272
--target ti-cc13x4_26x4-pump-controller-ftd \
73+
--target ti-cc13x4_26x4-light-switch-mtd \
74+
--target ti-cc13x4_26x4-light-switch-ftd \
7375
build \
7476
--copy-artifacts-to out/artifacts \
7577
"
@@ -101,7 +103,19 @@ jobs:
101103
run: |
102104
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
103105
cc13x4_26x4 LP_EM_CC1354P10_6 lighting-app \
104-
out/artifacts/ti-cc13x4_26x4-lighting-mtd/chip-LP_EM_CC1354P10_6-lighting-example.out \
106+
out/artifacts/ti-cc13x4_26x4-lighting-ftd/chip-LP_EM_CC1354P10_6-lighting-example.out \
107+
/tmp/bloat_reports/
108+
- name: Get Light Switch FTD size stats
109+
run: |
110+
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
111+
cc13x4_26x4 LP_EM_CC1354P10_6 light-switch-app \
112+
out/artifacts/ti-cc13x4_26x4-light-switch-ftd/chip-LP_EM_CC1354P10_6-light-switch-example.out \
113+
/tmp/bloat_reports/
114+
- name: Get Light Switch MTD size stats
115+
run: |
116+
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
117+
cc13x4_26x4 LP_EM_CC1354P10_6 light-switch-app \
118+
out/artifacts/ti-cc13x4_26x4-light-switch-mtd/chip-LP_EM_CC1354P10_6-light-switch-example.out \
105119
/tmp/bloat_reports/
106120
- name: Uploading Size Reports
107121
uses: ./.github/actions/upload-size-reports

examples/light-switch-app/cc13x4_26x4/README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ Ninja to build the executable.
106106
107107
```
108108
gn gen out/debug --args="ti_sysconfig_root=\"$HOME/ti/sysconfig_1.18.1\" target_defines=[\"CC13X4_26X4_ATTESTATION_CREDENTIALS=1\"] chip_generate_link_map_file=true"
109-
109+
110110
```
111111
112112
## Programming
@@ -282,8 +282,8 @@ Now you can press the Right BTN on the light-switch device and it will turn ON
282282
the RED LED on the lighting device. Press the Left BTN on the light-switch
283283
device to turn OFF the RED LED on the lighting device. If the devices aren't
284284
bound properly the light-switch will display on UART that the Switch On/Off
285-
operation has been completed but the lighting device's LEDs will not turn
286-
on/off accordingly.
285+
operation has been completed but the lighting device's LEDs will not turn on/off
286+
accordingly.
287287
288288
## TI Support
289289

examples/light-switch-app/cc13x4_26x4/src/AppTask.cpp

+48-45
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ TimerHandle_t sOTAInitTimer = 0;
141141

142142
// The OTA Init Timer is only started upon the first Thread State Change
143143
// detected if the device is already on a Thread Network, or during the AppTask
144-
// Init sequence if the device is not yet on a Thread Network. Once the timer
144+
// Init sequence if the device is not yet on a Thread Network. Once the timer
145145
// has been started once, it does not need to be started again so the flag will
146146
// be set to false.
147147
bool isAppStarting = true;
@@ -172,7 +172,6 @@ int AppTask::StartAppTask()
172172
return ret;
173173
}
174174

175-
176175
// Identify take action
177176
void identify_TakeAction(void)
178177
{
@@ -210,21 +209,24 @@ void DeviceEventCallback(const ChipDeviceEvent * event, intptr_t arg)
210209
PLAT_LOG("Thread State Change");
211210
bool isThreadAttached = ThreadStackMgrImpl().IsThreadAttached();
212211

213-
if(isThreadAttached){
212+
if (isThreadAttached)
213+
{
214214
PLAT_LOG("Device is on the Thread Network");
215215
#if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR
216-
if(isAppStarting){
216+
if (isAppStarting)
217+
{
217218
StartTimer(OTAREQUESTOR_INIT_TIMER_DELAY_MS);
218219
isAppStarting = false;
219-
}
220+
}
220221
#endif
221222
}
222223
break;
223224
}
224225
}
225226

226227
#if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR
227-
void OTAInitTimerEventHandler(TimerHandle_t xTimer){
228+
void OTAInitTimerEventHandler(TimerHandle_t xTimer)
229+
{
228230
InitializeOTARequestor();
229231
}
230232
#endif
@@ -248,17 +250,17 @@ int AppTask::Init()
248250
}
249251
#if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR
250252
// Create FreeRTOS sw timer for OTA timer.
251-
sOTAInitTimer = xTimerCreate("OTAInitTmr", // Just a text name, not used by the RTOS kernel
252-
OTAREQUESTOR_INIT_TIMER_DELAY_MS, // timer period (mS)
253-
false, // no timer reload (==one-shot)
254-
(void *) this, // init timer id = light obj context
255-
OTAInitTimerEventHandler // timer callback handler
253+
sOTAInitTimer = xTimerCreate("OTAInitTmr", // Just a text name, not used by the RTOS kernel
254+
OTAREQUESTOR_INIT_TIMER_DELAY_MS, // timer period (mS)
255+
false, // no timer reload (==one-shot)
256+
(void *) this, // init timer id = light obj context
257+
OTAInitTimerEventHandler // timer callback handler
256258
);
257259

258260
if (sOTAInitTimer == NULL)
259261
{
260262
PLAT_LOG("sOTAInitTimer timer create failed");
261-
}
263+
}
262264
else
263265
{
264266
PLAT_LOG("sOTAInitTimer timer created successfully ");
@@ -352,11 +354,12 @@ int AppTask::Init()
352354
ConfigurationMgr().LogDeviceConfig();
353355

354356
bool isThreadEnabled = ThreadStackMgrImpl().IsThreadEnabled();
355-
if(!isThreadEnabled && isAppStarting){
357+
if (!isThreadEnabled && isAppStarting)
358+
{
356359
#if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR
357-
PLAT_LOG("Thread is Disabled, enable OTA Requestor");
358-
StartTimer(OTAREQUESTOR_INIT_TIMER_DELAY_MS);
359-
isAppStarting = false;
360+
PLAT_LOG("Thread is Disabled, enable OTA Requestor");
361+
StartTimer(OTAREQUESTOR_INIT_TIMER_DELAY_MS);
362+
isAppStarting = false;
360363
#endif
361364
}
362365

@@ -385,20 +388,20 @@ void AppTask::AppTaskMain(void * pvParameter)
385388
#if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR
386389
void StartTimer(uint32_t aTimeoutMs)
387390
{
388-
PLAT_LOG("Start OTA Init Timer")
389-
if (xTimerIsTimerActive(sOTAInitTimer))
390-
{
391-
PLAT_LOG("app timer already started!");
392-
CancelTimer();
393-
}
391+
PLAT_LOG("Start OTA Init Timer")
392+
if (xTimerIsTimerActive(sOTAInitTimer))
393+
{
394+
PLAT_LOG("app timer already started!");
395+
CancelTimer();
396+
}
394397

395-
// timer is not active, change its period to required value (== restart).
396-
// FreeRTOS- Block for a maximum of 100 ticks if the change period command
397-
// cannot immediately be sent to the timer command queue.
398-
if (xTimerChangePeriod(sOTAInitTimer, pdMS_TO_TICKS(aTimeoutMs), 100) != pdPASS)
399-
{
400-
PLAT_LOG("sOTAInitTimer timer start() failed");
401-
}
398+
// timer is not active, change its period to required value (== restart).
399+
// FreeRTOS- Block for a maximum of 100 ticks if the change period command
400+
// cannot immediately be sent to the timer command queue.
401+
if (xTimerChangePeriod(sOTAInitTimer, pdMS_TO_TICKS(aTimeoutMs), 100) != pdPASS)
402+
{
403+
PLAT_LOG("sOTAInitTimer timer start() failed");
404+
}
402405
}
403406

404407
void CancelTimer(void)
@@ -517,27 +520,27 @@ void AppTask::DispatchEvent(AppEvent * aEvent)
517520
case AppEvent::kEventType_IdentifyStart:
518521
switch (identify_trigger_effect)
519522
{
520-
case IDENTIFY_TRIGGER_EFFECT_BLINK:
521-
identify_TakeAction();
522-
break;
523-
case IDENTIFY_TRIGGER_EFFECT_BREATHE:
524-
identify_TakeAction();
525-
break;
526-
case IDENTIFY_TRIGGER_EFFECT_OKAY:
527-
identify_TakeAction();
528-
break;
529-
default:
530-
break;
523+
case IDENTIFY_TRIGGER_EFFECT_BLINK:
524+
identify_TakeAction();
525+
break;
526+
case IDENTIFY_TRIGGER_EFFECT_BREATHE:
527+
identify_TakeAction();
528+
break;
529+
case IDENTIFY_TRIGGER_EFFECT_OKAY:
530+
identify_TakeAction();
531+
break;
532+
default:
533+
break;
531534
}
532535
PLAT_LOG("Identify started");
533536
break;
534-
535-
case AppEvent::kEventType_Identify:
536-
// blink LED
537+
538+
case AppEvent::kEventType_Identify:
539+
// blink LED
537540
PLAT_LOG("Identify cmd received, will blink green led three times now");
538541
#if (LED_ENABLE == 1)
539-
LED_startBlinking(sAppGreenHandle, 250, 3);
540-
#endif
542+
LED_startBlinking(sAppGreenHandle, 250, 3);
543+
#endif
541544
break;
542545

543546
case AppEvent::kEventType_IdentifyStop:

examples/light-switch-app/cc13x4_26x4/src/LightSwitchManager.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,6 @@ void LightSwitchManager::ActuatorMovementTimerEventHandler(AppEvent * aEvent)
188188
void LightSwitchManager::IdentifyEventHandler()
189189
{
190190
AppEvent event;
191-
event.Type = AppEvent::kEventType_Identify;
191+
event.Type = AppEvent::kEventType_Identify;
192192
AppTask::GetAppTask().PostEvent(&event);
193193
}

scripts/build/build/targets.py

+1
Original file line numberDiff line numberDiff line change
@@ -548,6 +548,7 @@ def BuildCC13x4Target():
548548
TargetPart('pump', app=TIApp.PUMP, openthread_ftd=False),
549549
TargetPart('pump-controller', app=TIApp.PUMP_CONTROLLER,
550550
openthread_ftd=False),
551+
TargetPart('light-switch', app=TIApp.LIGHT_SWITCH),
551552
])
552553

553554
target.AppendModifier(name="mtd", openthread_ftd=False)

scripts/build/builders/ti.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ class TIApp(Enum):
2828
ALL_CLUSTERS_MINIMAL = auto()
2929
LIGHTING = auto()
3030
SHELL = auto()
31+
LIGHT_SWITCH = auto()
3132

3233
def ExampleName(self):
3334
if self == TIApp.LOCK:
@@ -44,6 +45,8 @@ def ExampleName(self):
4445
return 'lighting-app'
4546
elif self == TIApp.SHELL:
4647
return 'shell'
48+
elif self == TIApp.LIGHT_SWITCH:
49+
return 'light-switch-app'
4750
else:
4851
raise Exception('Unknown app type: %r' % self)
4952

@@ -62,6 +65,8 @@ def AppNamePrefix(self, board):
6265
return f'chip-{board.BoardName()}-lighting-example'
6366
elif self == TIApp.SHELL:
6467
return f'chip-{board.BoardName()}-shell-example'
68+
elif self == TIApp.LIGHT_SWITCH:
69+
return f'chip-{board.BoardName()}-light-switch-example'
6570
else:
6671
raise Exception('Unknown app type: %r' % self)
6772

@@ -123,7 +128,8 @@ def build_outputs(self):
123128
if self.app in [TIApp.LOCK,
124129
TIApp.LIGHTING,
125130
TIApp.PUMP,
126-
TIApp.PUMP_CONTROLLER]:
131+
TIApp.PUMP_CONTROLLER,
132+
TIApp.LIGHT_SWITCH]:
127133
suffixes = [".out", "-mcuboot.hex"]
128134
else:
129135
suffixes = [".out"]

scripts/build/testdata/all_targets_linux_x64.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ asr-{asr582x,asr595x,asr550x}-{all-clusters,all-clusters-minimal,lighting,light-
33
android-{arm,arm64,x86,x64,androidstudio-arm,androidstudio-arm64,androidstudio-x86,androidstudio-x64}-{chip-tool,chip-test,tv-server,tv-casting-app,java-matter-controller,kotlin-matter-controller,virtual-device-app}[-no-debug]
44
bouffalolab-{bl602-iot-matter-v1,bl602-night-light,xt-zb6-devkit,bl706-night-light,bl706dk,bl704ldk}-light[-shell][-115200][-rpc][-cdc][-resetcnt][-rotating_device_id][-mfd][-mfdtest][-ethernet][-wifi][-thread][-fp][-memmonitor][-mot]
55
cc32xx-{lock,air-purifier}
6-
ti-cc13x4_26x4-{all-clusters,lighting,lock,pump,pump-controller}[-mtd][-ftd]
6+
ti-cc13x4_26x4-{all-clusters,lighting,light-switch,lock,pump,pump-controller}[-mtd][-ftd]
77
cyw30739-{cyw30739b2_p5_evk_01,cyw30739b2_p5_evk_02,cyw30739b2_p5_evk_03,cyw930739m2evb_01,cyw930739m2evb_02}-{light,light-switch,lock,thermostat}
88
efr32-{brd2704b,brd4316a,brd4317a,brd4318a,brd4319a,brd4186a,brd4187a,brd2601b,brd4187c,brd4186c,brd2703a,brd4338a}-{window-covering,switch,unit-test,light,lock,thermostat,pump}[-rpc][-with-ota-requestor][-icd][-low-power][-shell][-no-logging][-openthread-mtd][-heap-monitoring][-no-openthread-cli][-show-qr-code][-wifi][-rs9116][-wf200][-siwx917][-ipv4][-additional-data-advertising][-use-ot-lib][-use-ot-coap-lib][-no-version][-skip-rps-generation]
99
esp32-{m5stack,c3devkit,devkitc,qemu}-{all-clusters,all-clusters-minimal,energy-management,ota-provider,ota-requestor,shell,light,lock,bridge,temperature-measurement,ota-requestor,tests}[-rpc][-ipv6only][-tracing]

0 commit comments

Comments
 (0)