22 lines
395 B
C
22 lines
395 B
C
#ifndef RBUF_RBUF_H_
|
|
#define RBUF_RBUF_H_
|
|
|
|
#include <stdint.h>
|
|
#include <stddef.h>
|
|
#include <stdbool.h>
|
|
|
|
typedef struct {
|
|
uint8_t *buffer;
|
|
size_t tail;
|
|
size_t head;
|
|
size_t cap;
|
|
size_t count;
|
|
bool full;
|
|
} RBuf;
|
|
|
|
int32_t rbuf_push(RBuf *rbuf, uint8_t data);
|
|
int32_t rbuf_pop(RBuf *rbuf, uint8_t *data);
|
|
void rbuf_init(RBuf *rbuf, uint8_t *buf, size_t bufsize);
|
|
|
|
#endif // RBUF_RBUF_H_
|