项目作者: rose53

项目描述 :
RingBuffer using the Adafruit I2C FRAM Breakout
高级语言: C++
项目地址: git://github.com/rose53/RingBuffer.git
创建时间: 2016-03-03T18:54:52Z
项目社区:https://github.com/rose53/RingBuffer

开源协议:MIT License

下载


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.