GDP 4 / Mbed 2 deprecated KL25Z_camera_tester

Dependencies:   mbed

Revision:
0:27cd9d448187
Child:
1:b6aff788273c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/KL25Z_camera_tester.cpp	Sun Oct 09 12:17:17 2016 +0000
@@ -0,0 +1,71 @@
+#include "mbed.h"
+#include "TFC.h"
+#define CAM_THRESHOLD 3000
+
+
+DigitalOut myled(LED1);
+
+int main() {
+    TFC_Init();
+    
+    uint32_t i,t = 0;
+    uint32_t width = 0;
+
+    
+    printf("Starting camera test program\n");
+    
+    while(1) {
+        //If we have an image ready
+        if(TFC_LineScanImageReady>0)
+            {
+                //Reset image ready flag
+                TFC_LineScanImageReady=0;
+                printf("\r\n");
+                //printf("L:");
+                
+                //Strange thing that cycles the battery indicator
+                //Leaving in as this is a good indicator that the camera test program is running
+                if(t==4)
+                    t=0;
+                else
+                    t++;  
+                TFC_SetBatteryLED_Level(t);
+                   
+                   //Loop through camera pixels
+                   for(i=0;i<128;i++)
+                   {
+                       //If the pixel value exceeds our threshold, print a 1
+                       if (TFC_LineScanImage0[i] > CAM_THRESHOLD) 
+                       {
+                           printf("1");
+                           width++; //Increment the width value
+                       }
+                       //Else, print a 0
+                       else
+                       {
+                          printf("0");    
+                       }
+                       //printf("%d,",TFC_LineScanImage0[i]);
+                   
+                       if(i==127) //If we're at the end of array
+                       {
+                           if (TFC_LineScanImage0[i] > CAM_THRESHOLD)
+                           {
+                               printf("1\n");
+                               width++;
+                           }
+                           else
+                           {
+                              printf("0\n");    
+                           }
+                           
+                           //printf("%d\r\n",TFC_LineScanImage0[i]);
+                       }
+                   }
+                    
+                    printf("Width: %d\n", width);
+                    width = 0;
+                   
+               }
+    }
+}