Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: pixy2.h
- Revision:
- 18:190e3987e274
- Parent:
- 17:4f901906d86c
- Child:
- 19:007d361c8d66
--- a/pixy2.h	Tue Mar 12 18:31:22 2019 +0000
+++ b/pixy2.h	Wed Mar 13 16:27:14 2019 +0000
@@ -45,8 +45,8 @@
 #define PIXY2_CSHEADERSIZE  4
 #define PIXY2_SYNC          0xC1AE
 #define PIXY2_CSSYNC        0xC1AF
-#define PIXY2_ACK           1
-#define PIXY2_ERROR         3
+#define PIXY2_REP_ACK       1
+#define PIXY2_REP_ERROR     3
 #define PIXY2_ASK_RESOL     12
 #define PIXY2_REP_RESOL     13
 #define PIXY2_ASK_VERS      14
@@ -56,6 +56,7 @@
 #define PIXY2_SET_LED       20
 #define PIXY2_SET_LAMP      22
 #define PIXY2_ASK_FPS       24
+#define PIXY2_REP_FPS       1
 #define PIXY2_ASK_BLOC      32
 #define PIXY2_REP_BLOC      33
 #define PIXY2_ASK_LINE      48
@@ -95,7 +96,7 @@
 
 /**************** STATE MACHINE ****************/
 
-typedef enum {idle, messageSent, receivingHeader, headerReceived, receivingData, dataReceived} T_Pixy2State;
+typedef enum {idle, messageSent, receivingHeader, receivingData, dataReceived} T_Pixy2State;
 
 /**************** UTILS ****************/
 
@@ -564,34 +565,45 @@
 T_pixy2ErrorCode pixy2_ReverseVector (void);
 
 /**
- * This function returns the average RGB components of a square of 5x5 pixel centered on the given pixel coordinate
+ * This function returns the average RGB components of a square of 5x5 pixels centered on the given pixel coordinate
  * @note General description : https://docs.pixycam.com/wiki/doku.php?id=wiki:v2:video
  * @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:video_api
- * @param x (Word - passed by value) : X coordinate of the center of de 5x5 pixel square (in pixel, between 0 and 315) 
- * @param y (Word - passed by value) : Y coordinate of the center of de 5x5 pixel square (in pixel, between 0 and 207)
- * @param saturate (Byte - passed by value) : scale the 3 component so that the highest of RGB component is set to 255 (boolean : zero or non-zero) 
+ * @param x (Word - passed by value) : X coordinate of the center of de 5x5 pixels square (in pixel, between 0 and 315) 
+ * @param y (Word - passed by value) : Y coordinate of the center of de 5x5 pixels square (in pixel, between 0 and 207)
+ * @param saturate (Byte - passed by value) : scale the 3 RGB components so that the highest one of the 3 RGB components is set to 255 (boolean : zero or non-zero) 
  * @param pixel (T_pixy2Pixel - passed by reference) : RGB pixel. 
  * @return T_pixy2ErrorCode : error code.
  */
 T_pixy2ErrorCode pixy2_getRGB (Word x, Word y, Byte saturate, T_pixy2Pixel *pixel);
 
 // Variables globales Publiques
+/**
+ * @var Pixy2_numBlocks (Byte) number of color blocks in Pixy2_blocks
+ * @var Pixy2_blocks[] (T_pixy2Bloc) color blocks detected in the last frame
+ * @var Pixy2_numVectors (Byte) number of vectors in Pixy2_vectors
+ * @var Pixy2_vectors[] (T_pixy2Vector) vectors detected in the last frame
+ * @var Pixy2_numIntersections (Byte) number of intersections in Pixy2_intersections
+ * @var Pixy2_intersections[] (T_pixy2Intersection) intersections detected in the last frame
+ * @var Pixy2_intersLine[] (T_pixy2IntLines) lines detected in the last frame
+ * @var Pixy2_numVectors (Byte) number of vectors in Pixy2_blocks
+ * @var Pixy2_vectors[] (T_pixy2Vector) vectors detected in the last frame
+ */
 Byte                Pixy2_numBlocks;
-T_pixy2Bloc         Pixy2_blocks[];
+T_pixy2Bloc         *Pixy2_blocks;
 Byte                Pixy2_numVectors;
-T_pixy2Vector       Pixy2_vectors[];
+T_pixy2Vector       *Pixy2_vectors;
 Byte                Pixy2_numIntersections;
-T_pixy2Intersection Pixy2_intersections[];
-T_pixy2InterLine    Pixy2_intLines[];
+T_pixy2Intersection *Pixy2_intersections;
+T_pixy2InterLine    *Pixy2_intLines;
 Byte                Pixy2_numBarcodes;
-T_pixy2BarCode      Pixy2_barcodes[];
+T_pixy2BarCode      *Pixy2_barcodes;
 
 private :
 // Variables globales Privées
 T_Pixy2State        etat;
 Byte*               Pixy2_buffer;
-Byte                wPointer, rPointer, dataSize;
+Byte                wPointer, hPointer, dPointer, dataSize;
 Byte                frameContainChecksum;
 
 // Fonctions privées