forked from Nazrax/DreamMaskV4
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ringbuffer.h
30 lines (24 loc) · 807 Bytes
/
ringbuffer.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#ifndef _RING_BUFFER_H_
#define _RING_BUFFER_H_
#include <stdint.h>
typedef struct {
uint8_t size;
uint8_t count;
uint8_t head;
uint16_t *data;
} ringbuffer_uint16_t;
typedef struct {
uint8_t size;
uint8_t count;
uint8_t head;
double *data;
} ringbuffer_double_t;
ringbuffer_uint16_t* ringbuffer_new_uint16(int size);
void ringbuffer_clear_uint16(ringbuffer_uint16_t *ringbuffer);
void ringbuffer_append_uint16(ringbuffer_uint16_t *ringbuffer, uint16_t data);
void ringbuffer_dump_uint16(ringbuffer_uint16_t *ringbuffer);
ringbuffer_double_t* ringbuffer_new_double(int size);
void ringbuffer_clear_double(ringbuffer_double_t *ringbuffer);
void ringbuffer_append_double(ringbuffer_double_t *ringbuffer, double data);
void ringbuffer_dump_double(ringbuffer_double_t *ringbuffer);
#endif