40 #ifndef __RINGBUFINDEX_H__ 41 #define __RINGBUFINDEX_H__ 48 uint8_t put_ptr, get_ptr;
void ringbufindex_init(struct ringbufindex *r, uint8_t size)
Initialize a ring buffer.
int ringbufindex_full(const struct ringbufindex *r)
Is the ring buffer full?
int ringbufindex_peek_get(const struct ringbufindex *r)
Return the index of the first element which will be removed if calling ringbufindex_get.
int ringbufindex_empty(const struct ringbufindex *r)
Is the ring buffer empty?
int ringbufindex_elements(const struct ringbufindex *r)
Return the number of elements currently in the ring buffer.
int ringbufindex_peek_put(const struct ringbufindex *r)
Check if there is space to put an element.
int ringbufindex_put(struct ringbufindex *r)
Put one element to the ring buffer.
int ringbufindex_get(struct ringbufindex *r)
Remove the first element and return its index.
int ringbufindex_size(const struct ringbufindex *r)
Return the ring buffer size.