The following codes show example to create a periodic event that is triggered every 5 seconds for CC253x in Z-Stack and you can do it accordingly for CC254x in BLE Stack.
1. Add "#define PERIODIC_EVT 0x0001"in your code. Please note that event define has to be an unused bit mask of uint16.
2. Put the following line at where you want to start PERIODIC_EVT
osal_start_timerEx( zcl_XXX_TaskID, PERIODIC_EVT, 10 );
2. Create PERIODIC_EVT processing in zcl_XXX_event_loop
if( events & PERIODIC_EVT )
{
//Do things that need periodic processing here!
...
osal_start_timerEx( zcl_XXX_TaskID, PERIODIC_EVT, 5000 );
return (events ^ PERIODIC_EVT);
}
I tried this with the BLE stack but the program only enters the first time and that's it
ReplyDeleteYou can also refer to SBP_START_DEVICE_EVT implementation in simpleBLEPeripheral example of BLE Stack v1.4.2.
DeleteThis comment has been removed by the author.
ReplyDelete