blob: 15b3b63f2f136980f392e09ecd56301fe43d444a (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
#ifndef CIRCBUF_H_
#define CIRCBUF_H_
#include "../bang.h"
// A 256-byte circular buffer.
typedef struct {
u8 mem[256];
u8 front; // start of buffer, read from here up to back
u8 back; // end of buffer, write past here up to front
} CircBuf;
// Methods.
u8 circbuf_read(CircBuf *buf);
void circbuf_write(CircBuf *buf, u8 byte);
void circbuf_clear(CircBuf *buf);
#endif
|