GPS Device
Loading...
Searching...
No Matches
cbuf.h File Reference

Circular buffer module public API. More...

#include "err.h"
#include <stdint.h>
Include dependency graph for cbuf.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  CBUF_HANDLE_ts
 Handle representing a circular buffer instance. More...

Functions

ERR_te cbuf_read (CBUF_HANDLE_ts *cbuf_handle, uint8_t *output_buf_o)
 Reads all available data from the circular buffer into an output buffer.
ERR_te cbuf_write (CBUF_HANDLE_ts *cbuf_handle, uint8_t *input_buf, uint32_t input_len)
 Writes data from an input buffer into the circular buffer.
ERR_te cbuf_len (CBUF_HANDLE_ts const *cbuf_handle, uint8_t *len_o)
 Returns the number of bytes currently stored in the circular buffer.

Detailed Description

Circular buffer module public API.

Author
github.com/Baksi675

This module provides a lightweight circular (ring) buffer implementation for byte-oriented data, including:

  • Writing data from an input buffer
  • Reading all available data into an output buffer
  • Querying the number of bytes currently stored

The buffer size must be a power of two, as the implementation uses bitwise masking for wrap-around.

Typical usage:

Version
0.1
Date
2026-01-23

Definition in file cbuf.h.