1#ifndef __PX_RING_BUF_H__
2#define __PX_RING_BUF_H__
px_ring_buf_idx_t buf_size
Size of fixed-size buffer.
volatile px_ring_buf_idx_t idx_wr
Index that is next open position to write to in the buffer.
volatile px_ring_buf_idx_t idx_rd
Index to the next byte to be read from the buffer.
uint8_t * buf
Pointer to fixed-size buffer.
px_ring_buf_idx_t px_ring_buf_wr(px_ring_buf_t *px_ring_buf, const void *data, size_t nr_of_bytes)
Write (store) data in the ring buffer.
void px_ring_buf_init(px_ring_buf_t *px_ring_buf, uint8_t *buf, px_ring_buf_idx_t buf_size)
Initialize the ring buffer.
bool px_ring_buf_is_full(const px_ring_buf_t *px_ring_buf)
See if the ring buffer is full.
uint16_t px_ring_buf_idx_t
Ring buffer index size definition.
px_ring_buf_idx_t px_ring_buf_peek(px_ring_buf_t *px_ring_buf, void *data, size_t nr_of_bytes)
Peek data from the ring buffer, without advancing the read pointer.
px_ring_buf_idx_t px_ring_buf_get_count_used(px_ring_buf_t *px_ring_buf)
Get number of bytes stored in the buffer.
bool px_ring_buf_rd_u8(px_ring_buf_t *px_ring_buf, uint8_t *data)
Read (retrieve) a byte from the ring buffer.
bool px_ring_buf_wr_u8(px_ring_buf_t *px_ring_buf, const uint8_t data)
Write (store) a byte in the ring buffer.
px_ring_buf_idx_t px_ring_buf_get_count_free(px_ring_buf_t *px_ring_buf)
Get number of free bytes available in buffer.
px_ring_buf_idx_t px_ring_buf_rd(px_ring_buf_t *px_ring_buf, void *data, size_t nr_of_bytes)
Read (retrieve) data from the ring buffer.
bool px_ring_buf_is_empty(const px_ring_buf_t *px_ring_buf)
See if the ring buffer is empty.
void px_ring_buf_flush(px_ring_buf_t *px_ring_buf, size_t nr_of_bytes)
Removed data from ring buffer.
void px_ring_buf_log_report(px_ring_buf_t *px_ring_buf)
Report status of ring buffer.