Skip to content

Lightweight Generic Circular/Ring Buffer Library for Embedded Systems in C

License

Notifications You must be signed in to change notification settings

serbayozkan/GenericCircularBuffer_C

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Generic Circular/Ring Buffer Data Structure Library for Embedded Devices

Library

Library Folder Definition
Static Uses only static memory allocation by using object/memory pool for Circular Buffer objects
Dynamic Uses dynamic memory but only in initilization for allocation of Circular Buffer objects

Examples

STM32F4_DISCOVERY

Data taken from ISR (UART Receive Completed Callback) is pushed to circular buffer. In superloop, produced data is comsumed by popping data from circular buffer and printing out to console directly.

APIs

API Name Definition
circular_buffer_init Creates and inits new circular buffer object
circular_buffer_destroy Deletes the circular buffer object and frees the allocated space
circular_buffer_push Pushes new data to buffer and moves tail to next position
circular_buffer_pop Poppes data from buffer and moves head to next position
circular_buffer_empty Checks whether the circular buffer empty (true) or not (false)
circular_buffer_full Checks whether the circular buffer full (true) or not (false)
circular_buffer_free_space Gets the free available space in circular buffer
circular_buffer_capacity Gets the capacity of circular buffer

Make

Command Definition
make Runs the circular buffer test with both static and dynamic memory allocation schemes
make static Runs the circular buffer test with static memory allocation scheme
make dynamic Runs the circular buffer test with dynamic memory allocation scheme
make clean Cleans the builded files

Licencing

Licenced the under the MIT open source licence

Contact

serbay_ozkan@hotmail.com

https://www.linkedin.com/in/serbayozkan/