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

Files at this revision

API Documentation at this revision

Comitter:
jekain314
Date:
Wed May 08 06:22:57 2013 +0000
Parent:
15:f3b92958cf5a
Child:
17:71900da6ced6
Commit message:
incorporated SDShell and verified basic functionality with mbed_test - working, sg-

Changed in this revision

PCMessaging.h Show annotated file Show diff for this revision Revisions of this file
SDShell.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/PCMessaging.h	Tue May 07 13:49:28 2013 +0000
+++ b/PCMessaging.h	Wed May 08 06:22:57 2013 +0000
@@ -9,7 +9,7 @@
 const unsigned char  STOPSTREAM_MSG     =6;
 const unsigned char  STARTLOGINFO_MSG   =7;
 const unsigned char  STOPLOGINFO_MSG    =8;
-const unsigned char  GETFILE_MSG        =9;
+const unsigned char  GETFILE_MSG        =9; // added to get a file from the SD card
 
 const double  DEGREES_TO_RADIANS = acos(-1.0)/180.0;
 const double eccen          = 0.0818191908426;  //WGS84 earth eccentricity
@@ -29,10 +29,10 @@
 bool sendLogMsgInfo =false;
 bool recordData     =false;
 bool fireTrigger    =false;
-bool get_file_msg   =false;
+bool get_file_msg   =false; // added for GETFILE command
 
 
-const unsigned char numMessages = 10;    //number of potential messages
+const unsigned char numMessages = 10;    //number of potential messages (updated to 10 sg-)
 char msgList[numMessages][32];          //text array storing the command messages from the PC
 char minMessageSize = 11;               //minimum size of a text message
 unsigned char CR = 0x0d;                //ASCII Carriage Return
@@ -53,7 +53,7 @@
     sprintf(msgList[STARTLOGINFO_MSG],  "WMsg LOGINFO Y");
     sprintf(msgList[STOPLOGINFO_MSG],   "WMsg LOGINFO N");
     sprintf(msgList[FIRE_TRIGGER_MSG],  "WMsg TRIGGER");
-    sprintf(msgList[GETFILE_MSG],       "WMsg GETFILE");
+    sprintf(msgList[GETFILE_MSG],       "WMsg GETFILE");    // added to get the file off of sd cards
     //message length is from 10 to 16 chars
     
  //   toPC.printf(" finished setting up messages \n");
@@ -164,7 +164,7 @@
                         break;
                     
                     case GETFILE_MSG:
-                        get_file_msg = true;
+                        get_file_msg = true;    // signal to main that we can unload the file that was written
                         break;
                     
                 }  //end Switch statement
--- a/SDShell.lib	Tue May 07 13:49:28 2013 +0000
+++ b/SDShell.lib	Wed May 08 06:22:57 2013 +0000
@@ -1,1 +1,1 @@
-https://mbed.org/users/sam_grove/code/SDShell/#743600852c66
+https://mbed.org/users/sam_grove/code/SDShell/#30aa615d4508
--- 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");
     
     /*