pixy2 smart camera library www.pixycam.com

Pixy2 Library project (using UART interface)

Revision:
10:ea759846c2d5
Parent:
9:764075b514bf
Child:
11:68ef9f85e40e
--- a/pixy2.h	Tue Mar 12 10:49:53 2019 +0000
+++ b/pixy2.h	Tue Mar 12 14:06:53 2019 +0000
@@ -46,6 +46,7 @@
 #define PIXY2_SYNC          0xC1AE
 #define PIXY2_CSSYNC        0xC1AF
 #define PIXY2_ACK           1
+#define PIXY2_ERROR         3
 #define PIXY2_ASK_RESOL     12
 #define PIXY2_REP_RESOL     13
 #define PIXY2_ASK_VERS      14
@@ -157,7 +158,7 @@
 typedef struct {
     T_pixy2Header       header;
     Byte                data[5];
-}T_pixy2sendFrame;
+}T_pixy2SendFrame;
 
 /**
  *  \union  T_pixy2sendBuffer
@@ -166,9 +167,9 @@
  *  \param  data  (Byte)             : 9 bytes that overlap frame (byte access)
  */
 typedef union {
-    T_pixy2sendFrame    frame;
+    T_pixy2SendFrame    frame;
     Byte                data[9];
-}T_pixy2sendBuffer;
+}T_pixy2SendBuffer;
 
 /**
  *  \struct T_pixy2RcvHeader
@@ -195,7 +196,7 @@
  */
 typedef struct {
     lWord               pixReturn;
-}T_pixy2returnCode;
+}T_pixy2ReturnCode;
 
 /**
  *  \struct T_Pixy2Version
@@ -447,7 +448,7 @@
  * @param framerate (T_pixy2returnCode - passed by reference) : acknoledge 
  * @return Pixy2ErrorCode : error code.
  */
-Pixy2ErrorCode pixy2_getFPS (T_pixy2returnCode *framerate);
+Pixy2ErrorCode pixy2_getFPS (T_pixy2ReturnCode *framerate);
 
 /**
  * Gets all detected blocks in the most recent frame.
@@ -458,10 +459,41 @@
  * @param sigmap (Byte - passed by value) : signature filtering 
  * @param maxBloc (Byte - passed by value) : maximum number of blocks to return 
  * @return Pixy2ErrorCode : error code.
- * @note There is 7 possible signatures definition. Filtering is based on ORing codes : 1 for signature 1 (sig1), 2 for sig2, 4 for sig3, etc. and 7 for color code. 255 = no filtering, 0 = filter all. For example filtering to get only sig1 and sig 4 means using 9 (8 + 1) as sigmap.
+ * @note There are 7 different signatures definition (sig1 to sig7). Color codes are made of a combination of signature and can be filtered as well. 
+ * @note Filtering is based on ORing codes : 1 for sig1, 2 for sig2, 4 for sig3, 8 for sig4, 16 for sig5, 32 for sig6, 64 sor sig7 and 128 for color code.
+ * @note So sigmap = 255 means accept all and sigmap = 0 means reject all. For example filtering to get only sig1 and sig5 means using sigmap = 17 (16 + 1).
  */
 Pixy2ErrorCode pixy2_getBlocks (Byte sigmap, Byte maxBloc);
-Pixy2ErrorCode pixy2_getMainFeature (Byte type, Byte features);
+
+/**
+ * This function gets the latest main features of Line tracking (including the Vector, any intersection that connects to the Vector, and barcodes).
+ * The results are returned in the variables vectors, intersections, and barcodes, respectively.
+ * The main feature is the feature that is the most likely to be the most relevant for line traking.
+ * In case of multiple vector (for example 2 lines unconnected), the function will return only the vector of the line you are the most likely to follow.
+ * @note General description : https://docs.pixycam.com/wiki/doku.php?id=wiki:v2:line_tracking
+ * @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:pixy2_full_api#plugin_include__wiki__v2__line_api
+ * @param feature (Byte - passed by value) : feature filtering 
+ * @return Pixy2ErrorCode : error code.
+ * @note There are 3 possible features (vectors, intersections and barcodes).
+ * @note Filtering is based on ORing codes : 1 for vectors, 2 for intersections, 4 for barcodes.
+ * @note So 7 = accept all, 0 = reject all. For example filtering to get only vectors and barcode means using feature = 5 (1 + 4).
+ */
+Pixy2ErrorCode pixy2_getMainFeature (Byte features);
+
+/**
+ * This function gets all the latest features of Line tracking (including the Vector, any intersection that connects to the Vector, and barcodes).
+ * The results are returned in the variables vectors, intersections, and barcodes, respectively.
+ * @note General description : https://docs.pixycam.com/wiki/doku.php?id=wiki:v2:line_tracking
+ * @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:pixy2_full_api#plugin_include__wiki__v2__line_api
+ * @param feature (Byte - passed by value) : feature filtering 
+ * @return Pixy2ErrorCode : error code (if negative) or ORing of feature detected (if positive).
+ * @note There are 3 possible features (vectors, intersections and barcodes).
+ * @note Filtering or the feature detected are based on ORing codes : 1 for vectors, 2 for intersections, 4 for barcodes.
+ * @note So for filtering : 7 = accept all, 0 = reject all. For example filtering to get only vectors and barcode means using feature = 5 (1 + 4).
+ * @note So for return value : 1 means only vector(s) detected, 2 means only intersection(s) detected, 3 vector(s) and intersection(s) detected and so on.
+ */
 Pixy2ErrorCode pixy2_getAllFeature (Byte features);
 Pixy2ErrorCode pixy2_setMode (Byte mode);
 Pixy2ErrorCode pixy2_setNexTurn (Word angle);