SWRU271I October 2010 – January 2020 CC2540 , CC2540T , CC2541 , CC2541-Q1 , CC2640R2F
The application contains an OSAL event called SBP_PERIODIC_EVT. An OSAL timer sets SBP_PERIODIC_EVT to occur periodically. After the SBP_START_DEVICE_EVT processing has completed, the timer is set with a time-out value of PERIODIC_EVT_PERIOD (the default value is 5000 milliseconds). Every 5 seconds the periodic event occurs and the function performPeriodicTask() is called.
The performPeriodicTask() function retrieves the value of the third characteristic in the simpleGATTProfile and copies that value into the fourth characteristic. This periodic event processing is an example for demonstration only but highlights how a custom operation can be performed in a periodic task. Before processing the periodic event, a new OSAL timer is started, which sets up the next periodic task.