-
Notifications
You must be signed in to change notification settings - Fork 19
/
dnckatsw001.patch
586 lines (534 loc) · 20.9 KB
/
dnckatsw001.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
Components/hal/target/CC2530EB/hal_board_cfg.h | 12 +-
Components/hal/target/CC2530EB/hal_key.c | 267 +++++++--------------
.../SampleLight/CC2530DB/SampleLight.ewp | 4 +-
.../SampleLight/Source/zcl_samplelight.c | 33 ++-
.../SampleLight/Source/zcl_samplelight.h | 2 +-
.../SampleLight/Source/zcl_samplelight_data.c | 6 +-
Projects/zstack/Tools/CC2530DB/f8wConfig.cfg | 4 +-
7 files changed, 132 insertions(+), 196 deletions(-)
diff --git a/Components/hal/target/CC2530EB/hal_board_cfg.h b/Components/hal/target/CC2530EB/hal_board_cfg.h
index 67112c8..dd32ed3 100644
--- a/Components/hal/target/CC2530EB/hal_board_cfg.h
+++ b/Components/hal/target/CC2530EB/hal_board_cfg.h
@@ -144,8 +144,8 @@
#define ACTIVE_HIGH !! /* double negation forces result to be '1' */
/* S1 */
-#define PUSH1_BV BV(1)
-#define PUSH1_SBIT P0_1
+#define PUSH1_BV BV(0)
+#define PUSH1_SBIT P0_0
#if defined (HAL_BOARD_CC2530EB_REV17)
#define PUSH1_POLARITY ACTIVE_HIGH
@@ -156,8 +156,8 @@
#endif
/* Joystick Center Press */
-#define PUSH2_BV BV(0)
-#define PUSH2_SBIT P2_0
+#define PUSH2_BV BV(1)
+#define PUSH2_SBIT P0_1
#define PUSH2_POLARITY ACTIVE_HIGH
/* ------------------------------------------------------------------------------------------------
@@ -291,7 +291,7 @@ extern void MAC_RfFrontendSetup(void);
\
/* Turn on cache prefetch mode */ \
PREFETCH_ENABLE(); \
- \
+ /* set direction for GPIO outputs */ \ \
LED1_DDR |= LED1_BV; \
\
/* Set PA/LNA HGM control P0_7 */ \
@@ -506,7 +506,7 @@ st( \
/* Set to TRUE enable LCD usage, FALSE disable it */
#ifndef HAL_LCD
-#define HAL_LCD TRUE
+#define HAL_LCD FALSE
#endif
/* Set to TRUE enable LED usage, FALSE disable it */
diff --git a/Components/hal/target/CC2530EB/hal_key.c b/Components/hal/target/CC2530EB/hal_key.c
index c3724b9..f24de6d 100644
--- a/Components/hal/target/CC2530EB/hal_key.c
+++ b/Components/hal/target/CC2530EB/hal_key.c
@@ -22,7 +22,7 @@
its documentation for any purpose.
YOU FURTHER ACKNOWLEDGE AND AGREE THAT THE SOFTWARE AND DOCUMENTATION ARE
- PROVIDED “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED,
+ PROVIDED “AS IS?WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED,
INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE,
NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL
TEXAS INSTRUMENTS OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER CONTRACT,
@@ -105,44 +105,43 @@
/* CPU port interrupt */
#define HAL_KEY_CPU_PORT_0_IF P0IF
-#define HAL_KEY_CPU_PORT_2_IF P2IF
-/* SW_6 is at P0.1 */
-#define HAL_KEY_SW_6_PORT P0
-#define HAL_KEY_SW_6_BIT BV(1)
-#define HAL_KEY_SW_6_SEL P0SEL
-#define HAL_KEY_SW_6_DIR P0DIR
+/* SW_1 is at P0.0 */
+#define HAL_KEY_SW_1_PORT P0
+#define HAL_KEY_SW_1_BIT BV(0)
+#define HAL_KEY_SW_1_SEL P0SEL
+#define HAL_KEY_SW_1_DIR P0DIR
/* edge interrupt */
-#define HAL_KEY_SW_6_EDGEBIT BV(0)
-#define HAL_KEY_SW_6_EDGE HAL_KEY_FALLING_EDGE
+#define HAL_KEY_SW_1_EDGEBIT BV(0)
+#define HAL_KEY_SW_1_EDGE HAL_KEY_FALLING_EDGE
-/* SW_6 interrupts */
-#define HAL_KEY_SW_6_IEN IEN1 /* CPU interrupt mask register */
-#define HAL_KEY_SW_6_IENBIT BV(5) /* Mask bit for all of Port_0 */
-#define HAL_KEY_SW_6_ICTL P0IEN /* Port Interrupt Control register */
-#define HAL_KEY_SW_6_ICTLBIT BV(1) /* P0IEN - P0.1 enable/disable bit */
-#define HAL_KEY_SW_6_PXIFG P0IFG /* Interrupt flag at source */
+/* SW_1 interrupts */
+#define HAL_KEY_SW_1_IEN IEN1 /* CPU interrupt mask register */
+#define HAL_KEY_SW_1_IENBIT BV(5) /* Mask bit for all of Port_0 */
+#define HAL_KEY_SW_1_ICTL P0IEN /* Port Interrupt Control register */
+#define HAL_KEY_SW_1_ICTLBIT BV(0) /* P0IEN - P0.0 enable/disable bit */
+#define HAL_KEY_SW_1_PXIFG P0IFG /* Interrupt flag at source */
-/* Joy stick move at P2.0 */
-#define HAL_KEY_JOY_MOVE_PORT P2
-#define HAL_KEY_JOY_MOVE_BIT BV(0)
-#define HAL_KEY_JOY_MOVE_SEL P2SEL
-#define HAL_KEY_JOY_MOVE_DIR P2DIR
+
+/* SW_2 is at P0.1 */
+#define HAL_KEY_SW_2_PORT P0
+#define HAL_KEY_SW_2_BIT BV(1)
+#define HAL_KEY_SW_2_SEL P0SEL
+#define HAL_KEY_SW_2_DIR P0DIR
/* edge interrupt */
-#define HAL_KEY_JOY_MOVE_EDGEBIT BV(3)
-#define HAL_KEY_JOY_MOVE_EDGE HAL_KEY_FALLING_EDGE
+#define HAL_KEY_SW_2_EDGEBIT BV(0)
+#define HAL_KEY_SW_2_EDGE HAL_KEY_FALLING_EDGE
-/* Joy move interrupts */
-#define HAL_KEY_JOY_MOVE_IEN IEN2 /* CPU interrupt mask register */
-#define HAL_KEY_JOY_MOVE_IENBIT BV(1) /* Mask bit for all of Port_2 */
-#define HAL_KEY_JOY_MOVE_ICTL P2IEN /* Port Interrupt Control register */
-#define HAL_KEY_JOY_MOVE_ICTLBIT BV(0) /* P2IENL - P2.0<->P2.3 enable/disable bit */
-#define HAL_KEY_JOY_MOVE_PXIFG P2IFG /* Interrupt flag at source */
-#define HAL_KEY_JOY_CHN HAL_ADC_CHANNEL_6
+/* SW_2 interrupts */
+#define HAL_KEY_SW_2_IEN IEN1 /* CPU interrupt mask register */
+#define HAL_KEY_SW_2_IENBIT BV(5) /* Mask bit for all of Port_0 */
+#define HAL_KEY_SW_2_ICTL P0IEN /* Port Interrupt Control register */
+#define HAL_KEY_SW_2_ICTLBIT BV(1) /* P0IEN - P0.1 enable/disable bit */
+#define HAL_KEY_SW_2_PXIFG P0IFG /* Interrupt flag at source */
/**************************************************************************************************
@@ -162,8 +161,6 @@ bool Hal_KeyIntEnable; /* interrupt enable/disable flag */
* FUNCTIONS - Local
**************************************************************************************************/
void halProcessKeyInterrupt(void);
-uint8 halGetJoyKeyInput(void);
-
/**************************************************************************************************
@@ -185,11 +182,11 @@ void HalKeyInit( void )
/* Initialize previous key to 0 */
halKeySavedKeys = 0;
- HAL_KEY_SW_6_SEL &= ~(HAL_KEY_SW_6_BIT); /* Set pin function to GPIO */
- HAL_KEY_SW_6_DIR &= ~(HAL_KEY_SW_6_BIT); /* Set pin direction to Input */
-
- HAL_KEY_JOY_MOVE_SEL &= ~(HAL_KEY_JOY_MOVE_BIT); /* Set pin function to GPIO */
- HAL_KEY_JOY_MOVE_DIR &= ~(HAL_KEY_JOY_MOVE_BIT); /* Set pin direction to Input */
+ HAL_KEY_SW_1_SEL &= ~(HAL_KEY_SW_1_BIT); /* Set pin function to GPIO */
+ HAL_KEY_SW_1_DIR &= ~(HAL_KEY_SW_1_BIT); /* Set pin direction to Input */
+
+ HAL_KEY_SW_2_SEL &= ~(HAL_KEY_SW_2_BIT); /* Set pin function to GPIO */
+ HAL_KEY_SW_2_DIR &= ~(HAL_KEY_SW_2_BIT); /* Set pin direction to Input */
/* Initialize callback function */
@@ -221,45 +218,17 @@ void HalKeyConfig (bool interruptEnable, halKeyCBack_t cback)
/* Determine if interrupt is enable or not */
if (Hal_KeyIntEnable)
{
- /* Rising/Falling edge configuratinn */
-
- PICTL &= ~(HAL_KEY_SW_6_EDGEBIT); /* Clear the edge bit */
- /* For falling edge, the bit must be set. */
- #if (HAL_KEY_SW_6_EDGE == HAL_KEY_FALLING_EDGE)
- PICTL |= HAL_KEY_SW_6_EDGEBIT;
- #endif
-
-
- /* Interrupt configuration:
- * - Enable interrupt generation at the port
- * - Enable CPU interrupt
- * - Clear any pending interrupt
- */
- HAL_KEY_SW_6_ICTL |= HAL_KEY_SW_6_ICTLBIT;
- HAL_KEY_SW_6_IEN |= HAL_KEY_SW_6_IENBIT;
- HAL_KEY_SW_6_PXIFG = ~(HAL_KEY_SW_6_BIT);
-
-
-
- /* Rising/Falling edge configuratinn */
-
- HAL_KEY_JOY_MOVE_ICTL &= ~(HAL_KEY_JOY_MOVE_EDGEBIT); /* Clear the edge bit */
- /* For falling edge, the bit must be set. */
- #if (HAL_KEY_JOY_MOVE_EDGE == HAL_KEY_FALLING_EDGE)
- HAL_KEY_JOY_MOVE_ICTL |= HAL_KEY_JOY_MOVE_EDGEBIT;
- #endif
-
-
- /* Interrupt configuration:
- * - Enable interrupt generation at the port
- * - Enable CPU interrupt
- * - Clear any pending interrupt
- */
- HAL_KEY_JOY_MOVE_ICTL |= HAL_KEY_JOY_MOVE_ICTLBIT;
- HAL_KEY_JOY_MOVE_IEN |= HAL_KEY_JOY_MOVE_IENBIT;
- HAL_KEY_JOY_MOVE_PXIFG = ~(HAL_KEY_JOY_MOVE_BIT);
+ PICTL |= HAL_KEY_SW_1_EDGEBIT;
+ HAL_KEY_SW_1_ICTL |= HAL_KEY_SW_1_ICTLBIT;
+ HAL_KEY_SW_1_IEN |= HAL_KEY_SW_1_IENBIT;
+ HAL_KEY_SW_1_PXIFG = ~(HAL_KEY_SW_1_BIT);
+
+ HAL_KEY_SW_2_ICTL |= HAL_KEY_SW_2_ICTLBIT;
+ HAL_KEY_SW_2_IEN |= HAL_KEY_SW_2_IENBIT;
+ HAL_KEY_SW_2_PXIFG = ~(HAL_KEY_SW_2_BIT);
+
/* Do this only after the hal_key is configured - to work with sleep stuff */
if (HalKeyConfigured == TRUE)
{
@@ -268,8 +237,11 @@ void HalKeyConfig (bool interruptEnable, halKeyCBack_t cback)
}
else /* Interrupts NOT enabled */
{
- HAL_KEY_SW_6_ICTL &= ~(HAL_KEY_SW_6_ICTLBIT); /* don't generate interrupt */
- HAL_KEY_SW_6_IEN &= ~(HAL_KEY_SW_6_IENBIT); /* Clear interrupt enable bit */
+ HAL_KEY_SW_1_ICTL &= ~(HAL_KEY_SW_1_ICTLBIT); /* don't generate interrupt */
+ HAL_KEY_SW_1_IEN &= ~(HAL_KEY_SW_1_IENBIT); /* Clear interrupt enable bit */
+
+ HAL_KEY_SW_2_ICTL &= ~(HAL_KEY_SW_2_ICTLBIT); /* don't generate interrupt */
+ HAL_KEY_SW_2_IEN &= ~(HAL_KEY_SW_2_IENBIT); /* Clear interrupt enable bit */
osal_set_event(Hal_TaskID, HAL_KEY_EVENT);
}
@@ -292,14 +264,22 @@ uint8 HalKeyRead ( void )
{
uint8 keys = 0;
- if (HAL_PUSH_BUTTON1())
+// if (HAL_PUSH_BUTTON1())
+// {
+// keys |= HAL_KEY_SW_1;
+// }
+//
+// if (HAL_PUSH_BUTTON2())
+// {
+// keys |= HAL_KEY_SW_2;
+// }
+ if (!(HAL_KEY_SW_1_PORT & HAL_KEY_SW_1_BIT)) /* Key is active low */
{
- keys |= HAL_KEY_SW_6;
+ keys |= HAL_KEY_SW_1;
}
-
- if ((HAL_KEY_JOY_MOVE_PORT & HAL_KEY_JOY_MOVE_BIT)) /* Key is active low */
+ if (!(HAL_KEY_SW_2_PORT & HAL_KEY_SW_2_BIT)) /* Key is active low */
{
- keys |= halGetJoyKeyInput();
+ keys |= HAL_KEY_SW_2;
}
return keys;
@@ -318,12 +298,17 @@ uint8 HalKeyRead ( void )
void HalKeyPoll (void)
{
uint8 keys = 0;
+ uint8 notify = 0;
- if ((HAL_KEY_JOY_MOVE_PORT & HAL_KEY_JOY_MOVE_BIT)) /* Key is active HIGH */
+ if (!(HAL_KEY_SW_1_PORT & HAL_KEY_SW_1_BIT)) /* Key is active low */
{
- keys = halGetJoyKeyInput();
+ keys |= HAL_KEY_SW_1;
}
-
+ if (!(HAL_KEY_SW_2_PORT & HAL_KEY_SW_2_BIT)) /* Key is active low */
+ {
+ keys |= HAL_KEY_SW_2;
+ }
+
/* If interrupts are not enabled, previous key status and current key status
* are compared to find out if a key has changed status.
*/
@@ -334,80 +319,32 @@ void HalKeyPoll (void)
/* Exit - since no keys have changed */
return;
}
- /* Store the current keys for comparation next time */
- halKeySavedKeys = keys;
+ else
+ {
+ notify = 1;
+ }
}
else
{
/* Key interrupt handled here */
+ if (keys)
+ {
+ notify = 1;
+ }
}
- if (HAL_PUSH_BUTTON1())
- {
- keys |= HAL_KEY_SW_6;
- }
+ /* Store the current keys for comparation next time */
+ halKeySavedKeys = keys;
/* Invoke Callback if new keys were depressed */
- if (keys && (pHalKeyProcessFunction))
+ if (notify && (pHalKeyProcessFunction))
{
(pHalKeyProcessFunction) (keys, HAL_KEY_STATE_NORMAL);
- }
-}
-
-/**************************************************************************************************
- * @fn halGetJoyKeyInput
- *
- * @brief Map the ADC value to its corresponding key.
- *
- * @param None
- *
- * @return keys - current joy key status
- **************************************************************************************************/
-uint8 halGetJoyKeyInput(void)
-{
- /* The joystick control is encoded as an analog voltage.
- * Read the JOY_LEVEL analog value and map it to joy movement.
- */
- uint8 adc;
- uint8 ksave0 = 0;
- uint8 ksave1;
-
- /* Keep on reading the ADC until two consecutive key decisions are the same. */
- do
- {
- ksave1 = ksave0; /* save previouse key reading */
-
- adc = HalAdcRead (HAL_KEY_JOY_CHN, HAL_ADC_RESOLUTION_8);
- if ((adc >= 2) && (adc <= 38))
- {
- ksave0 |= HAL_KEY_UP;
- }
- else if ((adc >= 74) && (adc <= 88))
- {
- ksave0 |= HAL_KEY_RIGHT;
- }
- else if ((adc >= 60) && (adc <= 73))
- {
- ksave0 |= HAL_KEY_LEFT;
- }
- else if ((adc >= 39) && (adc <= 59))
- {
- ksave0 |= HAL_KEY_DOWN;
- }
- else if ((adc >= 89) && (adc <= 100))
- {
- ksave0 |= HAL_KEY_CENTER;
- }
- } while (ksave0 != ksave1);
-
- return ksave0;
+ }
}
-
-
-
/**************************************************************************************************
* @fn halProcessKeyInterrupt
*
@@ -422,15 +359,15 @@ void halProcessKeyInterrupt (void)
{
bool valid=FALSE;
- if (HAL_KEY_SW_6_PXIFG & HAL_KEY_SW_6_BIT) /* Interrupt Flag has been set */
+ if( HAL_KEY_SW_1_PXIFG & HAL_KEY_SW_1_BIT) /* Interrupt Flag has been set by SW1 */
{
- HAL_KEY_SW_6_PXIFG = ~(HAL_KEY_SW_6_BIT); /* Clear Interrupt Flag */
+ HAL_KEY_SW_1_PXIFG = ~(HAL_KEY_SW_1_BIT); /* Clear Interrupt Flag */
valid = TRUE;
}
- if (HAL_KEY_JOY_MOVE_PXIFG & HAL_KEY_JOY_MOVE_BIT) /* Interrupt Flag has been set */
+ if (HAL_KEY_SW_2_PXIFG & HAL_KEY_SW_2_BIT) /* Interrupt Flag has been set by SW2 */
{
- HAL_KEY_JOY_MOVE_PXIFG = ~(HAL_KEY_JOY_MOVE_BIT); /* Clear Interrupt Flag */
+ HAL_KEY_SW_2_PXIFG = ~(HAL_KEY_SW_2_BIT); /* Clear Interrupt Flag */
valid = TRUE;
}
@@ -485,7 +422,7 @@ HAL_ISR_FUNCTION( halKeyPort0Isr, P0INT_VECTOR )
{
HAL_ENTER_ISR();
- if (HAL_KEY_SW_6_PXIFG & HAL_KEY_SW_6_BIT)
+ if ((HAL_KEY_SW_1_PXIFG & HAL_KEY_SW_1_BIT) || (HAL_KEY_SW_2_PXIFG & HAL_KEY_SW_2_BIT))
{
halProcessKeyInterrupt();
}
@@ -494,44 +431,14 @@ HAL_ISR_FUNCTION( halKeyPort0Isr, P0INT_VECTOR )
Clear the CPU interrupt flag for Port_0
PxIFG has to be cleared before PxIF
*/
- HAL_KEY_SW_6_PXIFG = 0;
+ HAL_KEY_SW_1_PXIFG = 0;
+ HAL_KEY_SW_2_PXIFG = 0;
HAL_KEY_CPU_PORT_0_IF = 0;
CLEAR_SLEEP_MODE();
HAL_EXIT_ISR();
}
-
-/**************************************************************************************************
- * @fn halKeyPort2Isr
- *
- * @brief Port2 ISR
- *
- * @param
- *
- * @return
- **************************************************************************************************/
-HAL_ISR_FUNCTION( halKeyPort2Isr, P2INT_VECTOR )
-{
- HAL_ENTER_ISR();
-
- if (HAL_KEY_JOY_MOVE_PXIFG & HAL_KEY_JOY_MOVE_BIT)
- {
- halProcessKeyInterrupt();
- }
-
- /*
- Clear the CPU interrupt flag for Port_2
- PxIFG has to be cleared before PxIF
- Notes: P2_1 and P2_2 are debug lines.
- */
- HAL_KEY_JOY_MOVE_PXIFG = 0;
- HAL_KEY_CPU_PORT_2_IF = 0;
-
- CLEAR_SLEEP_MODE();
- HAL_EXIT_ISR();
-}
-
#else
diff --git a/Projects/zstack/HomeAutomation/SampleLight/CC2530DB/SampleLight.ewp b/Projects/zstack/HomeAutomation/SampleLight/CC2530DB/SampleLight.ewp
index 54df9de..3c336c1 100644
--- a/Projects/zstack/HomeAutomation/SampleLight/CC2530DB/SampleLight.ewp
+++ b/Projects/zstack/HomeAutomation/SampleLight/CC2530DB/SampleLight.ewp
@@ -301,7 +301,7 @@
<state>SECURE=1</state>
<state>TC_LINKKEY_JOIN</state>
<state>NV_INIT</state>
- <state>xNV_RESTORE</state>
+ <state>NV_RESTORE</state>
<state>xHOLD_AUTO_START</state>
<state>ZTOOL_P1</state>
<state>MT_TASK</state>
@@ -313,7 +313,7 @@
<state>ZCL_READ</state>
<state>ZCL_WRITE</state>
<state>ZCL_REPORT</state>
- <state>ZCL_EZMODE</state>
+ <state>xZCL_EZMODE</state>
<state>ZCL_BASIC</state>
<state>ZCL_IDENTIFY</state>
<state>ZCL_ON_OFF</state>
diff --git a/Projects/zstack/HomeAutomation/SampleLight/Source/zcl_samplelight.c b/Projects/zstack/HomeAutomation/SampleLight/Source/zcl_samplelight.c
index b721113..c1a8bbf 100644
--- a/Projects/zstack/HomeAutomation/SampleLight/Source/zcl_samplelight.c
+++ b/Projects/zstack/HomeAutomation/SampleLight/Source/zcl_samplelight.c
@@ -131,6 +131,7 @@
*/
byte zclSampleLight_TaskID;
uint8 zclSampleLightSeqNum;
+uint8 zclSampleLightSeqNumState;
/*********************************************************************
@@ -389,6 +390,20 @@ void zclSampleLight_Init( byte task_id )
#ifdef ZGP_AUTO_TT
zgpTranslationTable_RegisterEP ( &zclSampleLight_SimpleDesc );
#endif
+
+ //report state
+ zclSampleLightSeqNumState = 0; //seqnum init
+ zclReportCmd_t rptcmd;
+ rptcmd.numAttr = 1;
+ rptcmd.attrList[0].attrID = ATTRID_ON_OFF;
+ rptcmd.attrList[0].dataType = ZCL_DATATYPE_BOOLEAN;
+ rptcmd.attrList[0].attrData = (void *)(&zclSampleLight_OnOff);
+
+ // Set destination address to indirect
+ zclSampleLight_DstAddr.addrMode = (afAddrMode_t)Addr16Bit;
+ zclSampleLight_DstAddr.addr.shortAddr = 0;
+ zclSampleLight_DstAddr.endPoint=1;
+ //zcl_SendReportCmd(SAMPLELIGHT_ENDPOINT,&zclSampleLight_DstAddr, ZCL_CLUSTER_ID_GEN_ON_OFF, &rptcmd, ZCL_FRAME_SERVER_CLIENT_DIR, true, zclSampleLightSeqNumState );
}
/*********************************************************************
@@ -674,6 +689,21 @@ void zclSampleLight_LcdDisplayUpdate( void )
#endif
zclSampleLight_DisplayLight();
+
+ //report state
+ zclSampleLightSeqNumState++;
+ zclReportCmd_t rptcmd;
+ rptcmd.numAttr = 1;
+ rptcmd.attrList[0].attrID = ATTRID_ON_OFF;
+ rptcmd.attrList[0].dataType = ZCL_DATATYPE_BOOLEAN;
+ rptcmd.attrList[0].attrData = (void *)(&zclSampleLight_OnOff);
+
+ // Set destination address to indirect
+ zclSampleLight_DstAddr.addrMode = (afAddrMode_t)Addr16Bit;
+ zclSampleLight_DstAddr.addr.shortAddr = 0;
+ zclSampleLight_DstAddr.endPoint=1;
+ //zcl_SendReportCmd(SAMPLELIGHT_ENDPOINT,&zclSampleLight_DstAddr, ZCL_CLUSTER_ID_GEN_ON_OFF, &rptcmd, ZCL_FRAME_SERVER_CLIENT_DIR, true, zclSampleLightSeqNumState );
+
}
#if (defined HAL_BOARD_ZLIGHT) || (defined HAL_PWM)
@@ -928,8 +958,7 @@ static void zclSampleLight_OnOffCB( uint8 cmd )
afIncomingMSGPacket_t *pPtr = zcl_getRawAFMsg();
zclSampleLight_DstAddr.addr.shortAddr = pPtr->srcAddr.addr.shortAddr;
-
-
+ zclSampleLightSeqNumState = pPtr->nwkSeqNum;
// Turn on the light
if ( cmd == COMMAND_ON )
{
diff --git a/Projects/zstack/HomeAutomation/SampleLight/Source/zcl_samplelight.h b/Projects/zstack/HomeAutomation/SampleLight/Source/zcl_samplelight.h
index abaea7c..22dcb8b 100644
--- a/Projects/zstack/HomeAutomation/SampleLight/Source/zcl_samplelight.h
+++ b/Projects/zstack/HomeAutomation/SampleLight/Source/zcl_samplelight.h
@@ -54,7 +54,7 @@ extern "C"
/*********************************************************************
* CONSTANTS
*/
-#define SAMPLELIGHT_ENDPOINT 8
+#define SAMPLELIGHT_ENDPOINT 1
#define LIGHT_OFF 0x00
#define LIGHT_ON 0x01
diff --git a/Projects/zstack/HomeAutomation/SampleLight/Source/zcl_samplelight_data.c b/Projects/zstack/HomeAutomation/SampleLight/Source/zcl_samplelight_data.c
index dd59969..ec5b420 100644
--- a/Projects/zstack/HomeAutomation/SampleLight/Source/zcl_samplelight_data.c
+++ b/Projects/zstack/HomeAutomation/SampleLight/Source/zcl_samplelight_data.c
@@ -88,9 +88,9 @@
// Basic Cluster
const uint8 zclSampleLight_HWRevision = SAMPLELIGHT_HWVERSION;
const uint8 zclSampleLight_ZCLVersion = SAMPLELIGHT_ZCLVERSION;
-const uint8 zclSampleLight_ManufacturerName[] = { 16, 'T','e','x','a','s','I','n','s','t','r','u','m','e','n','t','s' };
-const uint8 zclSampleLight_ModelId[] = { 16, 'T','I','0','0','0','1',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ' };
-const uint8 zclSampleLight_DateCode[] = { 16, '2','0','0','6','0','8','3','1',' ',' ',' ',' ',' ',' ',' ',' ' };
+const uint8 zclSampleLight_ManufacturerName[] = { 6, 'D','N','C','K','A','T' };
+const uint8 zclSampleLight_ModelId[] = { 11, 'D','N','C','K','A','T','_','S','0','0','1' };
+const uint8 zclSampleLight_DateCode[] = { 16, '2','0','1','8','0','6','2','3',' ',' ',' ',' ',' ',' ',' ',' ' };
const uint8 zclSampleLight_PowerSource = POWER_SOURCE_MAINS_1_PHASE;
uint8 zclSampleLight_LocationDescription[17] = { 16, ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ' };
diff --git a/Projects/zstack/Tools/CC2530DB/f8wConfig.cfg b/Projects/zstack/Tools/CC2530DB/f8wConfig.cfg
index c20cb83..fcab38b 100644
--- a/Projects/zstack/Tools/CC2530DB/f8wConfig.cfg
+++ b/Projects/zstack/Tools/CC2530DB/f8wConfig.cfg
@@ -44,11 +44,11 @@
//-DDEFAULT_CHANLIST=0x00040000 // 18 - 0x12
//-DDEFAULT_CHANLIST=0x00020000 // 17 - 0x11
//-DDEFAULT_CHANLIST=0x00010000 // 16 - 0x10
-//-DDEFAULT_CHANLIST=0x00008000 // 15 - 0x0F
+-DDEFAULT_CHANLIST=0x00008000 // 15 - 0x0F
//-DDEFAULT_CHANLIST=0x00004000 // 14 - 0x0E
//-DDEFAULT_CHANLIST=0x00002000 // 13 - 0x0D
//-DDEFAULT_CHANLIST=0x00001000 // 12 - 0x0C
--DDEFAULT_CHANLIST=0x00000800 // 11 - 0x0B
+//-DDEFAULT_CHANLIST=0x00000800 // 11 - 0x0B
/* Define the default PAN ID.
*