A lightweight implementation of a Circular Buffer (Ring Buffer) written in C. This data structure provides a fixed-size, First-In-First-Out (FIFO) queue designed specifically for memory-constrained microcontrollers (like the ATmega328P or STM32). It eliminates the need for dynamic memory allocation (malloc), preventing memory fragmentation and ensuring deterministic runtime performance.
Key Features & Use Cases This implementation is optimized for UART Interrupt Service Routines (ISRs) and high-speed sensor data logging.
O(1) Complexity: Constant time execution for adding (push) and removing (pop) elements.
Interrupt Safe: Designed to safely handle data transfer between hardware interrupts and the main application loop.
Memory Efficient: Uses a static array to wrap data around automatically, enabling continuous data streaming with minimal RAM usage.