Skip to content

Add STM32 ring buffer driver#79

Open
rudrashukla7 wants to merge 3 commits into
mainfrom
Ring-Buffer
Open

Add STM32 ring buffer driver#79
rudrashukla7 wants to merge 3 commits into
mainfrom
Ring-Buffer

Conversation

@rudrashukla7

Copy link
Copy Markdown

Implements a lightweight ring buffer driver for the STM32 embedded system.

Files Added

  • ring_buffer.h - struct definition and public API declarations
  • ring_buffer.c - implementation of init, read, write, and empty functions

Implementation Details
Uses a fixed-size circular byte buffer with configurable size via RING_BUF_SIZE (128 bytes default)
Empty/full distinction handled by sacrificing one slot, giving an effective capacity of size - 1 bytes
ring_buffer_full is kept as a static internal helper, not exposed in the public API
All index arithmetic uses modulo wrapping to keep indices within bounds
Read and write operations return bool to indicate success or failure (empty/full guard)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant