This is the device firmware for the imagingBoard on the DIY 3D Printable Raspberry Pi Raman Spectrometer. For more details please visit: http://hackaday.io/project/1279

Dependencies:   mbed

Revision:
4:4eedf8292719
Parent:
3:83cb6eb61adf
Child:
5:cbf08f942178
--- a/main.cpp	Mon Aug 18 04:26:00 2014 +0000
+++ b/main.cpp	Mon Aug 18 07:15:05 2014 +0000
@@ -37,7 +37,7 @@
 int leadingDummyElements    = 16;
 int leadShieldedElements    = 13;
 int headerElements          = 3;
-const int signalElements    = 3648;
+const int signalElements    = 550; //3648;
 int trailingDummyElements   = 14;
 int pixelCount;
 int readOutTrigger;
@@ -75,7 +75,7 @@
         case readOut_Begin:
             readOutTrigger = 1;
             state = readOut_ACTIVE;
-//            ICG = 1;
+            raspi.printf("+++\r\n");
             LED = 1;
             break;
         case readOut_ACTIVE:
@@ -106,8 +106,9 @@
         case readOut_signalElements:
             pixelCount++;
 //            pixelValue[pixelCount] = imageIn.read();
+//            raspi.printf("Pixel# %i\r\n", pixelCount);
 //            imageData = ((imageIn.read_u16() * 5.0) / 4096.0);
-//            raspi.printf("%4.12f \r\n", (imageIn.read_u16() * 5.0) / 4096.0);
+            raspi.printf("%i,%4.12f\r\n", pixelCount,(imageIn.read_u16() * 5.0) / 4096.0);
             LED = !LED;
             if (pixelCount == signalElements) {
                 pixelCount = 0;
@@ -135,8 +136,8 @@
             break;
         case readOut_IDLE:
             if (ICG == 1) {
-                ICG = 0;
-                state = readOut_Begin;
+//                ICG = 0;
+//                state = readOut_Begin;
             }
             break;
         default:
@@ -165,6 +166,14 @@
 
     raspi.baud(921600);
     while(1) {
-        wait(1);
+        char c = raspi.getc();
+        switch (c){
+            case 'r':
+                ICG = 0;
+                state = readOut_Begin;
+                break;
+            default:
+                break;
+        }
     }
 }