ECE 4180 - Final Project Team / Mbed 2 deprecated WalkieTalkie

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

Revision:
32:c40d581f50af
Parent:
31:39d04aedc3e5
--- a/CircularBuf.cpp	Mon Apr 23 15:29:18 2018 +0000
+++ b/CircularBuf.cpp	Mon Apr 23 16:05:32 2018 +0000
@@ -2,7 +2,7 @@
 #include "stdio.h"
 
 template <typename T>
-CircularBuf<T>::CircularBuf(unsigned int size) : _size(size), _head(size), _tail(size) {
+CircularBuf<T>::CircularBuf(unsigned int size) : _size(size), _head(0), _tail(0) {
     _data = (T*)malloc(sizeof(T) * size);
 }
 
@@ -21,7 +21,7 @@
         if (next >= _size)
             next = 0;
             
-        if (next == _tail)
+        if (next ==  _tail)
             return cnt;
             
         _data[next] = data[cnt];
@@ -43,7 +43,7 @@
             next = 0;
         }
         
-        if (next > _head)
+        if (_tail == _head)
             return cnt;
             
         data[cnt] = _data[next];