Simple ring buffer
Diff: nine_ring/nine_ring.h
- Revision:
- 0:c050eb7b0c10
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nine_ring/nine_ring.h Mon Jul 13 07:54:11 2015 +0000 @@ -0,0 +1,31 @@ +#ifndef NL_RING +#define NL_RING + +/** + +Simple Ring Buffer +J.J.Trinder, based on original code for midi projects 199X +updateded sometime to the MBED + +Yeh its atad klunky, it works and is useful to explain things to people... +*/ +#define buff_size 120 +class NRing { +public: + NRing(); + + void ring_init(); + int ring_count(); + long get_next(); + int RingWriteToBuffer(long); /* put byte in buffer */ + + protected: + volatile int inIndex; /* where to put next byte */ + volatile int inCount; /* how full is the buffer */ + volatile int outIndex; /* for output to sio */ + + + long opBuffer[buff_size]; /* our Ring out buffer */ +}; + +#endif \ No newline at end of file