ACS ACR89U-A1 User Manual Page 59

  • Download
  • Add to my manuals
  • Print
  • Page
    / 78
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 58
ACR89U-A1 Application Programming Interface info@acs.com.hk
Version 1.01
www.acs.com.hk
Page 59 of 78
must be provided. The number of bytes copied into the buffer was defined when the queue was
created. Successfully received items remain on the queue so will be returned again by the next call, or
a call to xQueueReceive().
[queue.h]
portBASE_TYPE xQueuePeek(
xQueueHandle xQueue,
void *pvBuffer,
portTickType xTicksToWait
);
Parameters:
xQueue [in] The handle to the queue from which the item is to be received.
pvBuffer [out] Pointer to the buffer into which the received item will be copied. This must be at
least large enough to hold the size of the queue item defined when the queue was
created.
xTicksToWait [in] The maximum amount of time the task should block waiting for an item to receive
should the queue be empty at the time of the call. The time is defined in tick periods
so the constant portTICK_RATE_MS should be used to convert to real time if this is
required. Specifying the block time as portMAX_DELAY will cause the task to block
indefinitely (without a timeout).
Returns:
portBASE_TYPE pdTRUE if an item was successfully received (peeked) from the queue, otherwise
pdFALSE.
Example:
struct AMessage
{
portCHAR ucMessageID;
portCHAR ucData[ 20 ];
} xMessage;
xQueueHandle xQueue;
// Task to create a queue and post a value.
void vATask( void *pvParameters )
{
struct AMessage *pxMessage;
// Create a queue capable of containing 10 pointers to AMessage
structures.
// These should be passed by pointer as they contain a lot of data.
xQueue = xQueueCreate( 10, sizeof( struct AMessage * ) );
if( xQueue == 0 )
{
// Failed to create the queue.
}
// ...
// Send a pointer to a struct AMessage object. Don't block if the
// queue is already full.
pxMessage = & xMessage;
Page view 58
1 2 ... 54 55 56 57 58 59 60 61 62 63 64 ... 77 78

Comments to this Manuals

No comments