Serial Wombat Arduino Library
Public Member Functions | Public Attributes | List of all members
SerialWombatQueue Class Reference

A Class representing a Queue in the User Ram area on the Serial Wombat Chip. More...

#include <SerialWombatQueue.h>

Inheritance diagram for SerialWombatQueue:

Public Member Functions

 SerialWombatQueue (SerialWombatChip &serialWombat)
 Constructor for SerialWombatWS2812 class /. More...
 
int16_t begin (uint16_t index, uint16_t length, SerialWombatQueueType qtype=SerialWombatQueueType::QUEUE_TYPE_RAM_BYTE)
 Initialize a Serial Wombat Queue (RAM Bytes) in User Memory Area on Serial Wombat Chip / /. More...
 
int available ()
 Queries the Serial Wombat for number bytes available to read /. More...
 
int read ()
 Reads a byte from the Serial Wombat /. More...
 
void flush ()
 Discard all received bytes. More...
 
int peek ()
 Query the Serial Wombat for the next avaialble byte, but don't remove it from the queue /. More...
 
size_t write (uint8_t data)
 Write a byte to the Serial Wombat Queue /. More...
 
size_t write (uint16_t data)
 Write an unsigned word to the Serial Wombat Queue /. More...
 
size_t write (uint16_t buffer[], size_t size)
 Write unsigned words to the Serial Wombat Queue /. More...
 
size_t write (const uint16_t *buffer, size_t size)
 Write unsigned words to the Serial Wombat Queue /. More...
 
size_t write (const uint8_t *buffer, size_t size)
 Write bytes to the Serial Wombat Queue /. More...
 
int availableForWrite ()
 Queries the Serial Wombat for the amount of free queue space /. More...
 
size_t readBytes (char *buffer, size_t length)
 Reads a specified number of bytes from the Serial Wombat Queue /. More...
 
void setTimeout (long timeout_mS)
 
size_t readUInt16 (uint16_t *buffer, size_t length)
 Reads a specified number of unsigned 16 bit words from the Serial Wombat Queue /. More...
 

Public Attributes

uint16_t startIndex = 0xFFFF
 
uint16_t length = 0
 

Detailed Description

A Class representing a Queue in the User Ram area on the Serial Wombat Chip.

Constructor & Destructor Documentation

◆ SerialWombatQueue()

SerialWombatQueue::SerialWombatQueue ( SerialWombatChip serialWombat)
inline

Constructor for SerialWombatWS2812 class /.

/

Parameters
serialWombatSerialWombat chip on which the driver will run

Member Function Documentation

◆ available()

int SerialWombatQueue::available ( )
inline

Queries the Serial Wombat for number bytes available to read /.

/

Returns
Number of bytes available to read.

◆ availableForWrite()

int SerialWombatQueue::availableForWrite ( )
inline

Queries the Serial Wombat for the amount of free queue space /.

/

Returns
Number of bytes avaialable

◆ begin()

int16_t SerialWombatQueue::begin ( uint16_t  index,
uint16_t  length,
SerialWombatQueueType  qtype = SerialWombatQueueType::QUEUE_TYPE_RAM_BYTE 
)
inline

Initialize a Serial Wombat Queue (RAM Bytes) in User Memory Area on Serial Wombat Chip / /.

/

Parameters
indexAn index in bytes for the beginning of the Queue location in Serial Wombat User Memory Area /
lengthThe length in bytes of avaialble queue space /
Returns
A positive number indicating the number of bytes used in User Memory Area (Will be more than / length due to queue management variables) or a negative number indicating an error code.

◆ flush()

void SerialWombatQueue::flush ( )
inline

Discard all received bytes.

/

◆ peek()

int SerialWombatQueue::peek ( )
inline

Query the Serial Wombat for the next avaialble byte, but don't remove it from the queue /.

/

Returns
A byte from 0-255, or -1 if no bytes were avaialble

◆ read()

int SerialWombatQueue::read ( )
inline

Reads a byte from the Serial Wombat /.

/

Returns
A byte from 0-255, or -1 if no bytes were avaialble

◆ readBytes()

size_t SerialWombatQueue::readBytes ( char *  buffer,
size_t  length 
)
inline

Reads a specified number of bytes from the Serial Wombat Queue /.

/

Parameters
bufferAn array into which to put received bytes /
lengthThe maximum number of bytes to be received /
Returns
the number of bytes written to buffer / / This function will read bytes from the Serial Wombat Queue into buffer. / If 'length' characters are not available to read then the value returned / will be less than length.

◆ readUInt16()

size_t SerialWombatQueue::readUInt16 ( uint16_t *  buffer,
size_t  length 
)
inline

Reads a specified number of unsigned 16 bit words from the Serial Wombat Queue /.

/

Parameters
bufferAn array into which to put received words /
lengthThe maximum number of words (not bytes) to be received /
Returns
the number of words written to buffer / / This function will read bytes from the Serial Wombat Queue into buffer. / If 'length' characters are not available to read then the value returned / will be less than length.

◆ setTimeout()

void SerialWombatQueue::setTimeout ( long  timeout_mS)
inline

◆ write() [1/5]

size_t SerialWombatQueue::write ( const uint16_t *  buffer,
size_t  size 
)
inline

Write unsigned words to the Serial Wombat Queue /.

/

Parameters
bufferAn array of uint16_t words to send /
sizethe number of words (not bytes) to send /
Returns
the number of words sent / / This function queries the Serial Wombat Queue / buffer space, and sends words as buffer space is avaialble. / If avaialable buffer space is not sufficient to send the entire / array then the function will block and continue trying until the / entire message has been sent to the Serial Wombat queue.

◆ write() [2/5]

size_t SerialWombatQueue::write ( const uint8_t *  buffer,
size_t  size 
)
inline

Write bytes to the Serial Wombat Queue /.

/

Parameters
bufferAn array of uint8_t bytes to send /
sizethe number of bytes to send /
Returns
the number of bytes sent / / This function queries the Serial Wombat Queue / buffer space, and sends bytes as buffer space is avaialble. / If avaialable buffer space is not sufficient to send the entire / array then the function will block and continue trying until the / entire message has been sent to the Serial Wombat queue.

◆ write() [3/5]

size_t SerialWombatQueue::write ( uint16_t  buffer[],
size_t  size 
)
inline

Write unsigned words to the Serial Wombat Queue /.

/

Parameters
bufferAn array of uint16_t words to send /
sizethe number of words (not bytes) to send /
Returns
the number of words sent / / This function queries the Serial Wombat Queue / buffer space, and sends words as buffer space is avaialble. / If avaialable buffer space is not sufficient to send the entire / array then the function will block and continue trying until the / entire message has been sent to the Serial Wombat queue.

◆ write() [4/5]

size_t SerialWombatQueue::write ( uint16_t  data)
inline

Write an unsigned word to the Serial Wombat Queue /.

/

Parameters
dataWord to write /
Returns
Number of bytes written

◆ write() [5/5]

size_t SerialWombatQueue::write ( uint8_t  data)
inline

Write a byte to the Serial Wombat Queue /.

/

Parameters
dataByte to write /
Returns
Number of bytes written

Member Data Documentation

◆ length

uint16_t SerialWombatQueue::length = 0

◆ startIndex

uint16_t SerialWombatQueue::startIndex = 0xFFFF