Max's Initial code

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
FatCookies
Date:
Mon Oct 10 10:59:55 2016 +0000
Parent:
0:27cd9d448187
Commit message:
cleaned up code, hopefully improved performance.; untested on real hardware

Changed in this revision

KL25Z_camera_tester.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/KL25Z_camera_tester.cpp	Sun Oct 09 12:17:17 2016 +0000
+++ b/KL25Z_camera_tester.cpp	Mon Oct 10 10:59:55 2016 +0000
@@ -10,6 +10,10 @@
     
     uint32_t i,t = 0;
     uint32_t width = 0;
+    char curr_line[129];
+    
+    /* Ensure string is null terminated */
+    curr_line[128] = 0; 
 
     
     printf("Starting camera test program\n");
@@ -37,31 +41,16 @@
                        //If the pixel value exceeds our threshold, print a 1
                        if (TFC_LineScanImage0[i] > CAM_THRESHOLD) 
                        {
-                           printf("1");
+                           curr_line[i] = '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]);
+                          curr_line[i] = '0';  
                        }
                    }
+                   printf("%s\n",curr_line);
                     
                     printf("Width: %d\n", width);
                     width = 0;