ECE 4180 - Final Project Team / Mbed 2 deprecated WalkieTalkie

Dependencies:   mbed 4DGL-uLCD-SE mbed-rtos nRF24L01P

Committer:
Nurchu
Date:
Fri Apr 20 16:07:47 2018 +0000
Revision:
17:604f9c4bd6d3
Parent:
16:d0d3bb2fc3ce
Child:
20:e068469ffb89
Finished up CircularBuf

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Nurchu 16:d0d3bb2fc3ce 1 template <class T>
Nurchu 14:4637a9f02919 2 class CircularBuff {
Nurchu 14:4637a9f02919 3 public:
Nurchu 16:d0d3bb2fc3ce 4 // Arguement:
Nurchu 16:d0d3bb2fc3ce 5 // size, The size of the underlying array to use
Nurchu 14:4637a9f02919 6 CircularBuff(unsigned int size);
Nurchu 14:4637a9f02919 7 ~CircularBuff();
Nurchu 14:4637a9f02919 8
Nurchu 14:4637a9f02919 9 // Pushes data onto the buffer
Nurchu 14:4637a9f02919 10 // Arguement:
Nurchu 14:4637a9f02919 11 // data, The array of data to push
Nurchu 14:4637a9f02919 12 // size, The amount of data in the array
Nurchu 17:604f9c4bd6d3 13 // Return:
Nurchu 17:604f9c4bd6d3 14 // Amount of data actually written
Nurchu 17:604f9c4bd6d3 15 unsigned int push(T* data, unsigned int size);
Nurchu 14:4637a9f02919 16
Nurchu 14:4637a9f02919 17
Nurchu 14:4637a9f02919 18 // Pops data from the buffer
Nurchu 14:4637a9f02919 19 // Arguement:
Nurchu 14:4637a9f02919 20 // data, The array of data popped
Nurchu 14:4637a9f02919 21 // size, The amount of data to pop
Nurchu 14:4637a9f02919 22 // Return:
Nurchu 14:4637a9f02919 23 // Amount of data actually popped
Nurchu 14:4637a9f02919 24 unsigned int pop(T* data, unsigned int size);
Nurchu 14:4637a9f02919 25
Nurchu 14:4637a9f02919 26 // Amount of data in the buffer
Nurchu 14:4637a9f02919 27 unsigned int size();
Nurchu 14:4637a9f02919 28
Nurchu 14:4637a9f02919 29 // Clears the buffer completely
Nurchu 14:4637a9f02919 30 void clear();
Nurchu 14:4637a9f02919 31
Nurchu 14:4637a9f02919 32 private:
Nurchu 14:4637a9f02919 33 T* _data;
Nurchu 17:604f9c4bd6d3 34 // Size of the array
Nurchu 14:4637a9f02919 35 unsigned int _size;
Nurchu 17:604f9c4bd6d3 36 // Start pointer
Nurchu 17:604f9c4bd6d3 37 unsigned int _head;
Nurchu 17:604f9c4bd6d3 38 // End pointer
Nurchu 17:604f9c4bd6d3 39 unsigned int _tail;
Nurchu 14:4637a9f02919 40 };