Subversion Repositories Code-Repo

Rev

Rev 114 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
113 Kevin 1
#ifndef __circular_buffer_h
2
#define __circular_buffer_h
3
 
114 Kevin 4
#include "maindefs.h"
5
#include "xbee.h"
6
 
113 Kevin 7
#define BUFFER_OK       0
8
#define BUFFER_ERROR    -1
114 Kevin 9
 
10
#ifdef _BASE_STATION
115 Kevin 11
#define BUFFER_SIZE     30
114 Kevin 12
#else
115 Kevin 13
#define BUFFER_SIZE     30 //(max is 125 for some reason)
114 Kevin 14
#endif
113 Kevin 15
 
16
typedef struct __BUFFER_DATA {
17
    unsigned int index_read;
18
    unsigned int index_write;
19
    unsigned int stored_length;
20
    unsigned char *buffer;
21
} BUFFER_DATA; // 7 bytes overhead
22
 
23
void buffer_init(BUFFER_DATA *);
24
char buffer_insert_one(unsigned char);
25
char buffer_insert(unsigned char length, unsigned char *msg);
26
char buffer_read(unsigned char length, unsigned char *dest);
27
unsigned int buffer_free_space(void);
28
 
29
#endif