Simple buffer.
Diff: buffer.h
- Revision:
- 0:f45f33d1febb
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buffer.h Tue Jun 04 01:39:13 2013 +0000 @@ -0,0 +1,30 @@ +#ifndef BUFFER_H +#define BUFFER_H + +#include "mbed.h" + +template<class T> +class Buffer +{ +public: + Buffer(int buf_size); + void put(T val); + T get(); + bool isEmpty(); + bool isFull(); + //void printData(); + ~Buffer(); + +private: + int size; + T* p_start; + T* p_end; + T* p_tail; + T* p_head; + T* data; + int index; + bool full; + bool empty; +}; + +#endif // BUFFER_H