Component: Circular Buffer (16 bit) (Storage)

From Flowcode Help
Revision as of 09:11, 12 October 2020 by BenR (talk | contribs) (XML import)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search


Author Matrix Ltd
Version 1.5 (Release)
Category Storage


Image Circular Buffer (16_bit) component

Circular buffer component allowing easy and efficient first in first out (FIFO) style data storage. Also features macros to allow you to check for specific 16-bit values.

Examples

No additional examples


Downloadable macro reference

WaitForValues

Waits for an array of values to appear in the circular buffer.

Returns 0 to indicate a timeout.

Returns 1 to indicate the data has been found.

Parameters

UINT Values
BYTE NumValues
Number of values to try and look for
BYTE RemoveContent
0=Leave the buffer contents untouched, 1=Remove values as you go
UINT Timeout
Max amount of time to wait in milliseconds before returning 0=WaitForever


Return value

BYTE


GetNumberValues

Returns the number of valid 16-bit data values currently stored inside the buffer.

Parameters

This macro has no parameters


Return value

UINT


PeekData

Reads the next available 16-bit data value from the circular buffer without advancing the current index,


Returns the default value if the buffer is empty.

Parameters

This macro has no parameters


Return value

UINT


PutData

Add a 16-bit value to the next free location inside the circular buffer.

If the data goes into the buffer correctly then return 1.

Otherwise the buffer is full and the return value will equal 0.

Parameters

UINT Data


Return value

BYTE


LookForValues

Scans the buffer for an array of specific values.

Returns 0 if the value is not found.

Returns 1 if the value is found.

Parameters

UINT Values
BYTE NumValues
The number of values you wish to try and match
BYTE RemoveContent
0=Leave data alone, 1=Remove data from buffer
BYTE ResetFind
0=Continue the find from the last operation, 1=Start again


Return value

BYTE


GetData

Reads the next available 16-bit value from the circular buffer,

Returns the default value if the buffer is empty.

Parameters

This macro has no parameters


Return value

UINT


FlushBuffer

Clears the contents of the buffer and re-initialises the index locations.

Parameters

This macro has no parameters


Return value

This call does not return a value


GetIndexedValue

Gets the value of a single 16-bit value at a known location in the buffer.

Leaves the buffer contents and pointers untouched.

Parameters

UINT address


Return value

UINT


Simulation macro reference

This component does not contain any simulation macros


Property reference

Buffer Size

This property is of type Unsigned integer and can be referenced with the variable name BufferSize.

Sets the number of byte elements inside the circular buffer.

The maximum number of bytes that can be stored at any one time is this number minus 1.

Storage Type

This property is of type Fixed list of ints and can be referenced with the variable name StorageType.

When buffer is full this property decides what to do.

Store first x values - Will retain the information inside the buffer, new data will be discarded.

Store last x values - Will discard the oldest location in the buffer and overwrite with new data.

Memory Type

This property is of type Fixed list of ints and can be referenced with the variable name MemType.

No additional information


Default Return Data

This property is of type Unsigned integer and can be referenced with the variable name RETURN.

Specifies the value returned by the receive function when there is no data held in the buffer