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. |
struct AMessage { portCHAR ucMessageID; portCHAR ucData[ 20 ]; };
void vATask( void *pvParameters ) { xQueueHandle xQueue1, xQueue2;
// Create a queue capable of containing 10 unsigned long values. xQueue1 = xQueueCreate( 10, sizeof( unsigned portLONG ) ); 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. }
Copyright (C) 2003 - 2008 Richard Barry
Any and all data, files, source code, html content and documentation included in the FreeRTOS distribution or available on this site are the exclusive property of Richard Barry. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Richard Barry.