15 #ifndef _PULSE_BUFFER_H_ 16 #define _PULSE_BUFFER_H_ 73 return (uint16_t)
size;
81 uint16_t t = pb->
tail;
82 uint16_t h = pb->
head;
83 return (t + 1 == h) || (t == pb->
size && h == 0);
101 uint16_t t = pb->
tail;
102 pb->
buf[t] = element;
103 pb->
tail = (t == pb->
size) ? 0 : t + 1;
111 uint16_t h = pb->
head;
113 pb->
head = (h == pb->
size) ? 0 : h + 1;
static Pulse pb_remove(volatile pulse_buffer *pb)
Remove and return the first item from a ring buffer.
static int pb_is_empty(volatile pulse_buffer *pb)
Returns true if and only if the ring buffer is empty.
static uint16_t pb_full_count(volatile pulse_buffer *pb)
Return the number of elements stored in the ring buffer.
static void pb_init(volatile pulse_buffer *pb, uint16_t size, Pulse *buf)
static int pb_is_full(volatile pulse_buffer *pb)
Returns true if and only if the ring buffer is full.
static int pb_safe_insert(volatile pulse_buffer *pb, Pulse element)
Attempt to insert an element into a ring buffer.
static void pb_insert(volatile pulse_buffer *pb, Pulse element)
struct Pulse_buffer pulse_buffer
static void pb_reset(volatile pulse_buffer *pb)
Discard all items from a ring buffer.