binary Clock
ring_buffer.h
Go to the documentation of this file.
1 #ifndef RING_BUFFER_H__
2 #define RING_BUFFER_H__
3 
4 #include <stdint.h>
5 #include "global_defines.h"
6 
12 typedef struct {
14  uint8_t *head;
15  uint8_t *tail;
16  uint8_t *start;
17  uint8_t *end;
18  uint8_t buff_size;
19  uint8_t error;
20  uint8_t unread_items;
22 
23 
24 void ring_buff_init(ring_buffer_t *rb_ptr, uint8_t *buffer_array_ptr, uint8_t buffer_len);
25 retval_t ring_buff_pop(ring_buffer_t *rb_ptr, uint8_t *return_item_ptr);
26 retval_t ring_buff_peak(ring_buffer_t *rb_ptr, uint8_t *return_item_ptr);
27 retval_t ring_buff_push(ring_buffer_t *rb_ptr, uint8_t new_val);
29 void ring_buff_reset(ring_buffer_t *rb_ptr);
30 uint8_t ring_buff_unread_items(ring_buffer_t *rb_ptr);
31 
32 #endif /* RING_BUFFER_H__ */
uint8_t * tail
pointer to the tail of the buffer
Definition: ring_buffer.h:15
void ring_buff_reset(ring_buffer_t *rb_ptr)
Definition: ring_buffer.c:137
uint8_t unread_items
number of unread items in the ring buffer
Definition: ring_buffer.h:20
retval_t ring_buff_push(ring_buffer_t *rb_ptr, uint8_t new_val)
Definition: ring_buffer.c:85
uint8_t ring_buff_unread_items(ring_buffer_t *rb_ptr)
Definition: ring_buffer.c:126
uint8_t * end
pointer to the end address of the buffer space
Definition: ring_buffer.h:17
uint8_t * head
pointer to the head of the buffer
Definition: ring_buffer.h:14
void ring_buff_init(ring_buffer_t *rb_ptr, uint8_t *buffer_array_ptr, uint8_t buffer_len)
Definition: ring_buffer.c:17
uint8_t * start
pointer to the start address of the buffer space
Definition: ring_buffer.h:16
uint8_t buff_size
size of the buffer space
Definition: ring_buffer.h:18
data structure to keep track of important ring buffer variables
Definition: ring_buffer.h:13
bool_t ring_buff_has_data(ring_buffer_t *rb_ptr)
Definition: ring_buffer.c:110
uint8_t error
error flag (not currently used)
Definition: ring_buffer.h:19
Definitions and types used in all files. Should be included in all project files. ...
retval_t
definition of the types of return values possible
Definition: global_defines.h:10
retval_t ring_buff_pop(ring_buffer_t *rb_ptr, uint8_t *return_item_ptr)
Definition: ring_buffer.c:36
bool_t
command to change states
Definition: global_defines.h:59
retval_t ring_buff_peak(ring_buffer_t *rb_ptr, uint8_t *return_item_ptr)
Definition: ring_buffer.c:64