Colin Stearns / Mbed 2 deprecated qcControl

Dependencies:   mbed

Fork of dgps by Colin Stearns

Revision:
16:4f5d20b87dc3
Parent:
15:e3e03a9df89e
Child:
18:e72ee7aed088
--- a/packet.h	Thu Apr 10 05:38:45 2014 +0000
+++ b/packet.h	Sat Apr 19 14:39:19 2014 +0000
@@ -36,7 +36,10 @@
         #else
         USB::getSerial()
         #endif
-    ),next(NULL){}
+    ),next(NULL){
+        //outputDevice.attach(this,&PacketSender::handleUpdate,Serial::RxIrq);
+        lastValid=NULL;
+    }
     Serial& outputDevice;
     void sendPacket(PacketStruct& output){
         for(int a=0;a<sizeof(PacketStruct);a++){
@@ -74,6 +77,13 @@
             sendPacket(output);
         }
     }
+    PacketStruct* lastValid;
+    bool found;
+    void handleUpdate(){
+        USB::getSerial().printf("Interupt\n");
+        PacketStruct* next = getNextPacket();
+        if(next!=NULL){lastValid=next;}
+    }
     
     // Number of consecutive zeros
     unsigned int numZeros;
@@ -106,7 +116,7 @@
             if(nextValid==sizeof(PacketStruct))break;
             // Read in next char
             char input=outputDevice.getc();
-            //USB::getSerial().printf("Read ByteC %X %X\n",nextValid,input);
+            USB::getSerial().printf("Read ByteC %X %X\n",nextValid,input);
             // Check for valid char
             if(resetCheck(input)){resetPacket=true;break;}
             // Set char