terry LAI / Mbed 2 deprecated ESDC2014-pwm

Dependencies:   mbed

Fork of ESDC2014 by terry LAI

Revision:
4:a377ecb9364f
Parent:
3:4306d042af6f
Child:
5:098e6a44bd94
--- a/communication.cpp	Thu Jul 03 14:52:44 2014 +0000
+++ b/communication.cpp	Fri Jul 04 13:05:15 2014 +0000
@@ -27,7 +27,7 @@
 **********************************************************/
 #include <communication.h>
 
-Communication::Communication(MySerial* _DEBUG, MySerial *_IntelToMbed, MySerial *_MbedToArduino, COMPASS* _compass)
+Communication::Communication(MySerial* _DEBUG, MySerial *_IntelToMbed, MySerial *_MbedToArduino, Compass* _compass)
 {
     this->_DEBUG = _DEBUG;
     this->_IntelToMbed = _IntelToMbed;
@@ -71,7 +71,7 @@
     if(communication_type == 0)
     {
         _x = buffer_IntelToMbed[out_IntelToMbed++];
-        if(out_IntelToMbed == BUFFER_SIZE)
+        if(out_IntelToMbed == BUFFER_SIZE-1)
         {
             out_IntelToMbed &= 0x0000;
         }
@@ -79,7 +79,7 @@
     else if(communication_type == 1)
     {
         _x = buffer_MbedToArduino[out_MbedToArduino++];
-        if(out_MbedToArduino == BUFFER_SIZE)
+        if(out_MbedToArduino == BUFFER_SIZE-1)
         {
             out_MbedToArduino &= 0x0000;
         }
@@ -123,7 +123,7 @@
     if(communication_type == 0)
     {
         buffer_IntelToMbed[in_IntelToMbed++] = _x;
-        if(in_IntelToMbed == BUFFER_SIZE)
+        if(in_IntelToMbed == BUFFER_SIZE-1)
         {
             in_IntelToMbed &= 0x0000;
         }
@@ -131,7 +131,7 @@
     else if(communication_type == 1)
     {
         buffer_MbedToArduino[in_MbedToArduino++] = _x;
-        if(in_MbedToArduino == BUFFER_SIZE)
+        if(in_MbedToArduino == BUFFER_SIZE-1)
         {
             in_MbedToArduino &= 0x0000;
         }