an SPI interface the cmu pixy camera

Dependents:   robotic_fish_ver_4_9_pixy UMO

Revision:
5:f54759b26096
Parent:
4:440e747935db
Child:
6:4bf8d39fc5ce
--- a/pixy.h	Tue Jun 03 15:29:26 2014 +0000
+++ b/pixy.h	Thu Jun 05 00:12:48 2014 +0000
@@ -4,6 +4,7 @@
 #define INVALID_BLOCK 20
 #define CENTER_X 320
 #define CENTER_Y 200
+#define NUM_BLOCKS 10
 //a class to aid in SPI communication with the pixy camera
 
 //this details the object block format of returned data as described in
@@ -22,19 +23,22 @@
 class pixySPI
 {
 private:
-    SPI* spi;
-    Serial* debug;
+    SPI spi;
     //SPI spi(p5, p6, p7); // mosi, miso, sclk
     short sync; //the block signature. 16 bits
     short readTwoBytesLSB();
     void readNBytes(char* buf, int num);
-    Block* blocks; //where the blocks are stored
+    Block blocks[NUM_BLOCKS]; //where the blocks are stored
     int numBlocks; //amt
+    int bestX;
+    int bestY;
 public:
-    pixySPI(PinName mosi,PinName miso,PinName sclk, int nBlocks, Serial* ser);
+    pixySPI(PinName mosi,PinName miso,PinName sclk, int nBlocks);
     ~pixySPI();
     void capture(); //fills in the blocks pointer
     char getRawData();
     Block* getBlocks();
     int getNumBlocks();
+    int getBestX();
+    int getBestY();
 };
\ No newline at end of file