3.2 Task Handlers

In an RTOS environment, the user’s applications and the Zigbee stack function as two separate tasks. The FreeRTOS scheduler controls the allocation of execution time, assigning priorities to the Zigbee stack and application tasks. The zigbee_task serves as the stack task. The stack implements an internal mechanism to schedule layer-specific tasks across the stack layers. The task scheduler determines the execution order for tasks that different stack components raise, prioritizing based on the layers' importance. A call to the corresponding task handler, a layer-specific function, processes tasks that a particular layer posts.

The user’s application must implement the application task handler, defined as _APP_Tasks(). During the execution of _APP_Tasks(), the handler manages various stack requests and indications, UART events and other activities.