Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed 4DGL-uLCD-SE mbed-rtos nRF24L01P
Diff: CircularBuf.h
- Revision:
- 14:4637a9f02919
- Child:
- 16:d0d3bb2fc3ce
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/CircularBuf.h Fri Apr 20 15:15:59 2018 +0000 @@ -0,0 +1,33 @@ +template <T> +class CircularBuff { +public: + CircularBuff(unsigned int size); + ~CircularBuff(); + + // Pushes data onto the buffer + // Arguement: + // data, The array of data to push + // size, The amount of data in the array + void push(T* data, unsigned int size); + + + // Pops data from the buffer + // Arguement: + // data, The array of data popped + // size, The amount of data to pop + // Return: + // Amount of data actually popped + unsigned int pop(T* data, unsigned int size); + + // Amount of data in the buffer + unsigned int size(); + + // Clears the buffer completely + void clear(); + +private: + T* _data; + unsigned int _size; + unsigned int _start; + unsigned int _end; +}; \ No newline at end of file