uc-sdk
|
queue. h
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.
uxQueueLength | The maximum number of items that the queue can contain. |
uxItemSize | The 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. |
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. }