this version has all of Jim's fixes for reading the GPS and IMU data synchronously

Dependencies:   MODSERIAL SDFileSystem mbed SDShell CRC CommHandler FP LinkedList LogUtil

Revision:
16:2aea22130ba1
Parent:
15:f3b92958cf5a
Child:
17:71900da6ced6
diff -r f3b92958cf5a -r 2aea22130ba1 main.cpp
--- a/main.cpp	Tue May 07 13:49:28 2013 +0000
+++ b/main.cpp	Wed May 08 06:22:57 2013 +0000
@@ -6,7 +6,6 @@
 
 #include "MODSERIAL.h"
 #include "SDFileSystem.h"      //imported using the import utility    
-#include "SDShell.h"
 
 //general digital I/O specifications for this application
 //SDFileSystem(PinName mosi, PinName miso, PinName sclk, PinName cs, const char* name);
@@ -44,19 +43,6 @@
 
 volatile int PPSTimeOffset = 0;
 
-// stuff to send the SD file to the PC
-void transferFile()
-{
-    SDShell emulate;
-    emulate.init();
-    // just indicate that we're in here
-    trig1led = ppsled = rxMsg = txMsg = 1;
-    
-    toPC.printf("Entering Shell Emulator...\n");
-    wait(0.1f);
-    emulate.shell(toPC, sd, "/sd");
-}
-
 //////////////////////////////////////////////////////////////////////
 // the below should become classes
 //////////////////////////////////////////////////////////////////////
@@ -64,6 +50,24 @@
 #include "ADIS16488.h"      //ADIS16488 activities
 #include "PCMessaging.h"    //PC messaging activities
 
+
+// stuff to send the SD file to the PC
+#include "SDShell.h"
+void transferFile()
+{
+    SDShell emulate;    // create the object
+    emulate.init();     // init the params inside
+    GPS_Reset = 0;      // low power PCB mode
+    ADIS_RST = 0;       // same here
+    wait(0.01f);        // just make sure that the hardware has time to stop
+    trig1led = ppsled = rxMsg = txMsg = 1;  // just indicate that we're in here
+    toPC.attach(NULL);  // incase the PC serial was using an interrupt handler for RX
+    fflush(stdout);     // and clear any TX reminants
+    toPC.printf("Entering Shell Emulator...\n");    // just for fluf
+    wait(0.1f);         // no reason for this either
+    emulate.shell(toPC, sd, "/sd"); // now the SDShell object will serve SD files via UNIX commands
+}
+
 //ISR for detection of the GPS 1PPS
 void detect1PPSISR(void)
 {
@@ -399,6 +403,14 @@
     }
       
     if (fpNav != NULL) fclose(fpNav);  //insurance
+    transferFile();
+    // to exit this function the HOST (ie: computer or PC app) must send "exit" otherwise the mbed will act
+    // like a terminal and serve SD file data forever
+    
+    
+    
+    
+    
     toPC.printf(" normal termination \n");
     
     /*