Skip to content

rose53/RingBuffer

Repository files navigation

RingBuffer

Implementation of a Ring buffer (Circular buffer) for the Adafruit I2C FRAM breakout.

The implementation uses the Adafruit I2C FRAM Driver fo the I2C communication with the FRAM.

Available functions

To work with the ring buffer, it has to be formatted with a page size. The page size defines the number of bytes one page has in the buffer.

begin

Initializes the the buffer and the driver to the FRAM

format

Formats the ring buffer. After formating, the buffer is empty and the page size is set.

write

Writes one page to the buffer. If the successful, true will be returned, otherwise false.

read

Reads one page from the buffer. If the successful, true will be returned, otherwise false.

getPageSize

Gets the page size.

getHead

Returns the address in the memory next used for page writing.

getTail

Returns the address in the memory next used for page reading.

isInitialized

Returns true, if the ring buffer is initialized (formatted).

isFull

Returns true, if the ring buffer is full. A call to write will also return false.

containsData

Returns true, if there is some data in the ring buffer. A call to resd will be successful.

dump

Dumps the complete memory.

About

RingBuffer using the Adafruit I2C FRAM Breakout

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages