SPI read Pixi Cam V1

Revision:
1:6587541f3aa8
Parent:
0:ef0e3c67dc5b
Child:
2:fa582d9d91b5
--- a/Pixy.h	Mon Mar 14 00:35:23 2016 +0000
+++ b/Pixy.h	Mon Mar 14 17:42:33 2016 +0000
@@ -7,6 +7,19 @@
 #define X_CENTER        ((PIXY_MAX_X-PIXY_MIN_X)/2)
 #define Y_CENTER        ((PIXY_MAX_Y-PIXY_MIN_Y)/2)
 
+/** The SPI interface for the Pixy camera
+  * Used for instantiating a Pixy object that interfaces via an SPI connection
+  * @param spi the pointer to the SPI connection
+  * @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
+  * @code
+  * #include "Pixy.h"
+  * Serial serial(USBTX, USBRX);
+  * SPI spi(p5, p6, p7);
+  * PixySPI pixy(&spi, &serial);
+  * @endcode
+  */
+  
 class PixySPI : public TPixy<PixyInterfaceSPI>
 {
 public:
@@ -28,7 +41,16 @@
 class ServoLoop
 {
 public:
+    /** Constructor for a ServoLoop object
+      * Creates a ServoLoop object for easy control of the Pixy servos
+      * @param pgain the proportional gain for the control
+      * @param dgain the derivative gain for the control
+      */
     ServoLoop(int32_t pgain, int32_t dgain);
+    /** Update method for a ServoLoop object
+      * Updates the m_pos variable for setting a Pixy servo
+      * @param error the error between the center of the camera and the position of the tracking color
+      */
     void update(int32_t error);
 
     int32_t m_pos;
@@ -37,7 +59,12 @@
     int32_t m_dgain;
 };
 
-template <class TPixyInterface> void runPanTiltDemo(TPixy<TPixyInterface>* pixy, Serial* serial)
+/** Basic Pan/Tilt Demo code
+  * Runs the Pan/Tilt demo code
+  * @param pixy the pointer to the pixy object to run the demo on
+  * @param serial the optional serial pointer to display output to
+  */
+template <class TPixyInterface> void runPanTiltDemo(TPixy<TPixyInterface>* pixy, Serial* serial = NULL)
 {
     ServoLoop panLoop(-150, -300);
     ServoLoop tiltLoop(200, 250);