Simple ring buffer
nine_ring/nine_ring.h
- Committer:
- jont
- Date:
- 2015-07-13
- Revision:
- 0:c050eb7b0c10
File content as of revision 0:c050eb7b0c10:
#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