UART Driver to receive asynchronous Serial Comms from a Raspberry Pi and parse the results.

Revision:
6:74b5ac7719f4
Parent:
4:85353bd571f2
Child:
7:34c5934a01f0
--- a/SerialComms.cpp	Sat Feb 20 13:26:51 2016 +0000
+++ b/SerialComms.cpp	Fri Mar 04 05:53:11 2016 +0000
@@ -1,3 +1,27 @@
+/* #####################################################################
+                             SerialComms.cpp
+                             ---------------
+                
+                          Surface Ship, Group 5
+                          ---------------------
+ 
+ Written by:        Steven Kay
+ 
+ Date:              February 2016
+ 
+ Function:          This 
+ 
+ Version:           1.0
+ 
+ Version History
+ ---------------
+ 
+ 1.1                rgdfgdfgdfggdfgdg
+ 
+ 1.0                gdgddfdddgd
+    
+ ##################################################################### */
+
 #include "mbed.h"
 #include "SerialComms.h"
 
@@ -15,34 +39,19 @@
 
 void SerialComms::incomingDataISR()
 {
-    int a = 0;
-    dataCheck = 0;
-    for(uint8_t charCount=0; charCount<(2*NUM_BYTES_RECEIVING); charCount++)
-    {
-        if((charCount%2) == 1)
-        {
-            receiverBuffer[a] = _HLC_Conn -> getc();
-            a++;                        
-        }
-        else
-        {
-            dataCheck += _HLC_Conn -> getc();
-        }
-    }
+    receiverBuffer = _HLC_Conn -> getc();
     incomingDataUpdate = TRUE;
 }
 
-int *SerialComms::returnCommData()
+uint8_t SerialComms::getCommData()
 {
-    if(SerialComms::incomingDataUpdate == TRUE && dataCheck == 15)
+    if(incomingDataUpdate == TRUE)
     {
-        SerialComms::incomingDataUpdate = FALSE;
+        incomingDataUpdate = FALSE;
         return receiverBuffer;
     }
     else
     {
-        int noNewData = -1;
-        int *noNewDataPtr = &noNewData;
-        return noNewDataPtr;
+        return 0xFF;
     }
 }