diff --git a/sys/include/ringbuffer.h b/sys/include/ringbuffer.h index ad463c478a851f61d3cfd9d27ce325a7d7575f41..5819f2a15f294e8df2ae4a16c45f032a2b3a9173 100644 --- a/sys/include/ringbuffer.h +++ b/sys/include/ringbuffer.h @@ -30,6 +30,15 @@ typedef struct ringbuffer { unsigned int avail; /**< Number of elements available for reading. */ } ringbuffer_t; +/** + * @def RINGBUFFER_INIT(BUF) + * @brief Initialize a ringbuffer. + * @details This macro is meant for static ringbuffers. + * @param[in] BUF Buffer to use for the ringbuffer. The size is deduced through `sizeof (BUF)`. + * @returns The static initializer. + */ +#define RINGBUFFER_INIT(BUF) { (BUF), sizeof (BUF), 0, 0 } + /** * @brief Initialize a ringbuffer. * @param[out] rb Datum to initialize.