Theo Le Paih / Mbed 2 deprecated Lib_Pixy2

Dependencies:   mbed

Revision:
5:28e47187bb5c
Parent:
4:eed638064b42
Child:
6:e9e3aa6f1a55
--- a/pixy2.h	Mon Mar 11 15:21:33 2019 +0000
+++ b/pixy2.h	Mon Mar 11 17:18:25 2019 +0000
@@ -66,12 +66,28 @@
 #define PIXY2_SET_REVERSE   62
 #define PIXY2_ASK_VIDEO     112
 
+/**************** UTILS ****************/
+
+/**
+ *  \enum error_code
+ *  \brief List of possible error code
+ *  \param PIXY2_OK :               No error
+ *  \param PIXY2_MISC_ERROR :       Unknown error
+ *  \param PIXY2_BUSY :             Pixy hasn't finish yet
+ *  \param PIXY2_BAD_CHECKSUM :     Checksum is wrong
+ *  \param PIXY2_TYPE_ERROR :       unexpected type message
+ */
+
+#define PIXY2_OK            0
+#define PIXY2_MISC_ERROR    -1
+#define PIXY2_BUSY          -2
+#define PIXY2_BAD_CHECKSUM  -3
+#define PIXY2_TYPE_ERROR    -7
 
 /**************** STATE MACHINE ****************/
 
 typedef enum {idle, messageSent, receivingHeader, headerReceived, receivingData, dataReceived} T_Pixy2State;
 
-
 /**************** UTILS ****************/
 
 /**
@@ -199,11 +215,11 @@
  *  \struct T_Pixy2Resolution
  *  \brief  Structured type that match pixy2 resolution frame (type = 12/13) message payload
  *  \param  pixFrameWidth   (Word) : 16 bits width (in pixel) of an image
- *  \param  pixFrameHeigth  (Word) : 16 bits height (in pixel) of an image
+ *  \param  pixFrameHeight  (Word) : 16 bits height (in pixel) of an image
  */
 typedef struct {
     Word                pixFrameWidth;
-    Word                pixFrameHeigth;
+    Word                pixFrameHeight;
 }T_Pixy2Resolution;
 
 /**
@@ -357,26 +373,31 @@
 // Fonctions publiques
 
 /**
- * Gives information about Pixy2 version and Firmware
- * @note according to documentation : https://docs.pixycam.com/wiki/doku.php?id=wiki:v2:porting_guide
- * @param version (T_Pixy2Version - passed by reference) : pointer to the version data
- * @return  0 if OK
- * @return -2 if Busy
- * @return -3 if Checksum error
- * @return -7 if Type Error
+ * Queries and receives the firmware and hardware version of Pixy2, which is put in the version member variable.
+ * @note Frame Documentation : https://docs.pixycam.com/wiki/doku.php?id=wiki:v2:porting_guide
+ * @note Function Documentation : https://docs.pixycam.com/wiki/doku.php?id=wiki:v2:general_api
+ * @param version (T_Pixy2Version - passed by reference) : pointer to the version data structure
+ * @return int : error code.
  */
 int pixy2_getVersion (T_Pixy2Version *version);
 
 /**
- * Gives information about Pixy2 Resolution
- * @note according to documentation : https://docs.pixycam.com/wiki/doku.php?id=wiki:v2:porting_guide
- * @param version (T_Pixy2Resolution - passed by reference) : pointer to the resolution data
- * @return  0 if OK
- * @return -2 if Busy
- * @return -3 if Checksum error
- * @return -7 if Type Error
+ * Gets the width and height of the frames used by the current program.
+ * @note After calling this function, the width and height can be found in the frameWidth and frameHeight member variables.
+ * @note Frame Documentation : https://docs.pixycam.com/wiki/doku.php?id=wiki:v2:porting_guide
+ * @note Function Documentation : https://docs.pixycam.com/wiki/doku.php?id=wiki:v2:general_api
+ * @param resolution (T_Pixy2Resolution - passed by reference) : pointer to the resolution data structure
+ * @return int : error code.
  */
 int pixy2_getResolution (T_Pixy2Resolution *resolution);
+
+/**
+ * Sets the relative exposure level of Pixy2's image sensor. Higher values result in a brighter (more exposed) image. 
+ * @note Frame Documentation : https://docs.pixycam.com/wiki/doku.php?id=wiki:v2:porting_guide
+ * @note Function Documentation : https://docs.pixycam.com/wiki/doku.php?id=wiki:v2:general_api
+ * @param brightness (Byte - passed by value) : brightness level 
+ * @return int : error code.
+ */
 int pixy2_setCameraBrightness (Byte brightness);
 int pixy2_setServos (Word s0, Word s1); 
 int pixy2_setLED (Byte red, Byte green, Byte blue);