MSP430™CapTIvateSoftwareLibraryAPIGuide  1_83_00_05
Data Structures | Enumerations | Functions
CAPT_ByteQueue

Serial communication queue (ring buffer) management module. More...

Data Structures

struct  tByteQueue
 typedef tByteQueue More...
 

Enumerations

enum  tByteQueueError { eByteQueue_Success = 0, eByteQueue_QueueEmpty = -1, eByteQueue_QueueOverrun = -2 }
 tByteQueueError enumerates possible Byte Queue function errors. More...
 

Functions

bool CAPT_initByteQueue (tByteQueue *pQueue, uint8_t *pBufferArray, uint16_t ui16BufferArraySize)
 
int8_t CAPT_pushOntoByteQueue (tByteQueue *pQueue, uint8_t ui8DataToAdd)
 
int8_t CAPT_pullFromByteQueue (tByteQueue *pQueue, uint8_t *pDestination)
 
uint16_t CAPT_getByteQueueSize (tByteQueue *pQueue)
 
bool CAPT_isByteQueueFull (tByteQueue *pQueue)
 
bool CAPT_isByteQueueEmpty (tByteQueue *pQueue)
 

Detailed Description

Serial communication queue (ring buffer) management module.

FIFO Array Based, data type is uint8_t, 8-bit unsigned integer Buffering is ring-based, i.e wrap-around is allowed to always allow maximum use of the buffer space.

Version
VERSION Released on RELEASE_DATE

Enumeration Type Documentation

§ tByteQueueError

tByteQueueError enumerates possible Byte Queue function errors.

Enumerator
eByteQueue_Success 

eByteQueue_Success when returned indicates that the function completed successfully.

eByteQueue_QueueEmpty 

eByteQueue_QueueEmpty when returned indicates that the function attempted to retrieve a byte but there was no data in the queue.

eByteQueue_QueueOverrun 

eByteQueue_QueueOverrun indicates that the queue is full, and the oldest byte was dropped to make space for the newest byte.

Function Documentation

§ CAPT_initByteQueue()

bool CAPT_initByteQueue ( tByteQueue pQueue,
uint8_t *  pBufferArray,
uint16_t  ui16BufferArraySize 
)

This is the basic "constructor" function for a queue. Call this once before a queue is used, or again to clear the queue and reset it. Function is public

Parameters
*pQueueis a pointer to the queue to initialize
*pBufferArrayis a pointer to buffer space that can be used for this queue.
ui16BufferArraySizeis an integer specifying the length of the memory (in bytes) pointed to by pBufferArray that can be used for the queue
Returns
true if parameters were valid, else false.

§ CAPT_pushOntoByteQueue()

int8_t CAPT_pushOntoByteQueue ( tByteQueue pQueue,
uint8_t  ui8DataToAdd 
)

Push a new item onto the end of the queue Function is public

Parameters
*pQueueis a pointer to the queue of interest
ui8DataToAddis the byte to add to the queue
Returns
eByteQueue_QueueOverrun if queue was full and the oldest byte was dropped; else eByteQueue_Success.

§ CAPT_pullFromByteQueue()

int8_t CAPT_pullFromByteQueue ( tByteQueue pQueue,
uint8_t *  pDestination 
)

Remove the next item from the front of the queue Function is public

Parameters
*pQueueis a pointer to the queue of interest
*pDestinationis a pointer to the destination
Returns
eByteQueue_QueueEmpty if queue was empty (no bytes to pull), else eByteQueue_Success.

§ CAPT_getByteQueueSize()

uint16_t CAPT_getByteQueueSize ( tByteQueue pQueue)

Get the active size of the queue. Function is public. This is a helpful function for finding out how many items are currently in the queue.

Parameters
*pQueueis a pointer to the queue of interest
Returns
number of items in the queue if not empty, else 0.

§ CAPT_isByteQueueFull()

bool CAPT_isByteQueueFull ( tByteQueue pQueue)

Check whether queue is full. Function is public. This is a helpful function for internal (private) use.

Parameters
*pQueueis a pointer to the queue of interest
Returns
true if full, else false

§ CAPT_isByteQueueEmpty()

bool CAPT_isByteQueueEmpty ( tByteQueue pQueue)

Check whether queue is empty. Function is public. This is a helpful function for internal (private) use.

Parameters
*pQueueis a pointer to the queue of interest
Returns
true if empty, else false
© Copyright 1995-2020, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale