SPI read Pixi Cam V1

Revision:
5:d109b094d4bb
Parent:
4:478d4d9193a1
--- a/main.cpp	Mon Aug 23 11:26:37 2021 +0000
+++ b/main.cpp	Sat Aug 28 13:03:58 2021 +0000
@@ -1,17 +1,36 @@
 #include "mbed.h"
-#include "pixySPI.h"
+#include "pixyUART.h"
 //SPI spi(PC_12, PC_11, PC_10);
-pixySPI pixy(PC_12, PC_11, PC_10,10);
+BufferedSerial uart(PA_9,PA_10,115200);
+pixyUART pixy(&uart);
+uint8_t buffer[200];
 static BufferedSerial serial_port(USBTX, USBRX,115200);
 int main(void)
     {
         printf("Start\r\n");
+        uart.set_blocking(false);
+        uart.set_format(
+        /* bits */ 8,
+        /* parity */ BufferedSerial::None,
+        /* stop bit */ 1);
+        Timer ti;
+        ti.reset();
+        ti.start();
+        uint8_t kk=0;
         while(1)
             {
-            ThisThread::sleep_for(200);
+            ThisThread::sleep_for(20);
             pixy.capture();
-            ThisThread::sleep_for(200);
-            printf("NumBlocks: %d\r\n",pixy.getNumBlocks());
+            if(ti.read() > .25 && pixy.captured_blocks>0)
+                {
+                ti.reset();
+                printf("captBl: %d\r\n",pixy.captured_blocks);
+                for(int k=0;k<pixy.captured_blocks;k++)
+                    {   
+                    printf("sig: %d x: %d y: %d \r\n",pixy.blocks[k].signature,pixy.blocks[k].x,pixy.blocks[k].y);
+                    }
+                printf("\r\n- - - - - - - - - \r\n");
+                }
             }
         //pixy.blocks[0].printBlock();
     }
\ No newline at end of file