Homologation Cachan

Fork of TPixy-Interface by Stephen Wilkins

Revision:
3:66df7d295245
Parent:
2:fa582d9d91b5
Child:
4:ee635fc62b6e
diff -r fa582d9d91b5 -r 66df7d295245 TPixy.h
--- a/TPixy.h	Mon Mar 14 17:50:40 2016 +0000
+++ b/TPixy.h	Mon Mar 14 18:53:43 2016 +0000
@@ -48,8 +48,15 @@
     CC_BLOCK
 };
 
+/** A structure for containing Block data
+  * signature the signature of the block
+  * x the x position of the block on the screen
+  * y the y position of the block on the screen
+  * width the width of the block on the screen
+  * height the height of the block on the screen
+  * angle the angle of the block
+  */
 struct Block {
-    // print block structure!
     uint16_t signature;
     uint16_t x;
     uint16_t y;
@@ -67,30 +74,52 @@
     Serial* serial;
     Block *blocks;
     
-    /** Constructor for the TPixy object
-      * Creates a TPixy object with a given connection handler
-      * @param TPixyInterface* type the pointer to the interface connection handler
-      * @param Serial* serialOut the optional serial output pointer to print out Pixy camera data
-      * @param int arg an optional integer argument used for custom implementations of the Pixy library
+    /** Creates a TPixy object with a given connection handler
+      * @param type the pointer to the interface connection handler
+      * @param serialOut the optional serial output pointer to print out Pixy camera data
+      * @param arg an optional integer argument used for custom implementations of the Pixy library
       */
     TPixy(TPixyInterface* type, Serial* serialOut = NULL, uint16_t arg = PIXY_DEFAULT_ARGVAL);
     ~TPixy();
 
-    /** Printer for TPixy to print block information
-      * Prints the block out to the given serial port
-      * Block &ref the block to print
+    /** Prints the given Block out to the given serial port
+      * @param &block the Block to print
+      */
+    void printBlock(Block &block);
+    /** Returns the number of Blocks found in the current view and updates all Blocks' info
+      * @param maxBlocks the maximum number of Blocks to search for
+      * @return the number of Blocks found
+      */
+    uint16_t getBlocks(uint16_t maxBlocks = 1000);
+    /** Sets the PWM value of the Pixy servos
+      * @param s0 the value of the left servo
+      * @param s1 the value of the right servo
+      * @return the interface return value for sending the servo command
       */
-    void printBlock(Block &);
-    uint16_t getBlocks(uint16_t maxBlocks = 1000);
     int8_t setServos(uint16_t s0, uint16_t s1);
+    /** Sets the brightness of the Pixy RGB LED
+      * @param brightness the brightness of the LED
+      * @return the interface return value for sending the brightness command
+      */
     int8_t setBrightness(uint8_t brightness);
+    /** Sets the color of the Pixy RGB LED
+      * @param r the red color value
+      * @param g the green color value
+      * @param b the blue color value
+      */
     int8_t setLED(uint8_t r, uint8_t g, uint8_t b);
+    /** Initializes the Pixy
+      */
     void init();
 
 private:
     TPixyInterface* link;
     BlockType blockType;
+    /** Returns if the Pixy is ready to receive/send a message
+      */
     bool getStart();
+    /** Resizes the block array to add an additional block
+      */
     void resize();
     bool skipStart;
     uint16_t blockCount;
@@ -112,8 +141,6 @@
     link->setArg(arg);
 }
 
-
-
 template <class TPixyInterface> void TPixy<TPixyInterface>::printBlock(Block &block)
 {
     int i, j;
@@ -158,7 +185,7 @@
         } else if (w == PIXY_START_WORD_CC && lastw == PIXY_START_WORD) {
             blockType = CC_BLOCK;
             return true;
-        } else if (w==PIXY_START_WORDX) {
+        } else if (w == PIXY_START_WORDX) {
             if (serial != NULL) {
                 serial->printf("reorder");
             }