Atmel Software Framework

 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages



 xQueueHandle xQueueCreate(
                              unsigned portBASE_TYPE uxQueueLength,
                              unsigned portBASE_TYPE uxItemSize

Creates a new queue instance. This allocates the storage required by the new queue and returns a handle for the queue.

uxQueueLengthThe maximum number of items that the queue can contain.
uxItemSizeThe number of bytes each item in the queue will require. Items are queued by copy, not by reference, so this is the number of bytes that will be copied for each posted item. Each item on the queue must be the same size.
If the queue is successfully create then a handle to the newly created queue is returned. If the queue cannot be created then 0 is returned.

Example usage:

 struct AMessage
    char ucMessageID;
    char ucData[ 20 ];
 void vATask( void *pvParameters )
 xQueueHandle xQueue1, xQueue2;
Create a queue capable of containing 10 unsigned long values.
    xQueue1 = xQueueCreate( 10, sizeof( unsigned long ) );
    if( xQueue1 == 0 )
Queue was not created and must not be used.
Create a queue capable of containing 10 pointers to AMessage structures.
These should be passed by pointer as they contain a lot of data.
    xQueue2 = xQueueCreate( 10, sizeof( struct AMessage * ) );
    if( xQueue2 == 0 )
Queue was not created and must not be used.
... Rest of task code.