pixy2 smart camera library www.pixycam.com
Pixy2 Library project (using UART interface)
Diff: pixy2.h
- Revision:
- 12:7493191dd1dc
- Parent:
- 11:68ef9f85e40e
- Child:
- 13:478380d73e80
--- a/pixy2.h Tue Mar 12 14:16:53 2019 +0000 +++ b/pixy2.h Tue Mar 12 16:51:31 2019 +0000 @@ -150,7 +150,7 @@ }T_pixy2Header; /** - * \struct T_pixy2sendFrame + * \struct T_pixy2SendFrame * \brief Structured type that match frame definition for all kind of message to send to a pixy2 * \param header (T_pixy2Header) : 4 bytes classical header starting with PIXY2_SYNC * \param data (Byte) : 5 bytes payload (to match all usage, not all byte must be used) @@ -161,9 +161,9 @@ }T_pixy2SendFrame; /** - * \union T_pixy2sendBuffer + * \union T_pixy2SendBuffer * \brief Structured type to switch between structured type T_pixy2sendFrame and bytes - * \param frame (T_pixy2sendFrame) : classical frame (header + payload) starting with PIXY2_SYNC + * \param frame (T_pixy2SendFrame) : classical frame (header + payload) starting with PIXY2_SYNC * \param data (Byte) : 9 bytes that overlap frame (byte access) */ typedef union { @@ -190,7 +190,7 @@ /**************** PAYLOADS ****************/ /** - * \struct T_pixy2returnCode + * \struct T_pixy2ReturnCode * \brief Structured type that match pixy2 error/acknowledge/reply frame (type = 1 or 3) message payload * \param pixReturn (lWord) : 32 bits returned value */ @@ -380,8 +380,8 @@ * 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 Pixy2ErrorCode : error code. + * @param version (T_pixy2Version - passed by reference) : pointer to the version data structure + * @return T_pixy2ErrorCode : error code. */ T_pixy2ErrorCode pixy2_getVersion (T_pixy2Version *version); @@ -390,8 +390,8 @@ * 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 Pixy2ErrorCode : error code. + * @param resolution (T_pixy2Resolution - passed by reference) : pointer to the resolution data structure + * @return T_pixy2ErrorCode : error code. */ T_pixy2ErrorCode pixy2_getResolution (T_pixy2Resolution *resolution); @@ -401,7 +401,7 @@ * @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 Pixy2ErrorCode : error code. + * @return T_pixy2ErrorCode : error code. */ T_pixy2ErrorCode pixy2_setCameraBrightness (Byte brightness); @@ -411,7 +411,7 @@ * @note Function Documentation : https://docs.pixycam.com/wiki/doku.php?id=wiki:v2:general_api * @param s0 (Word - passed by value) : value between 0 and 511 * @param s1 (Word - passed by value) : value between 0 and 511 - * @return Pixy2ErrorCode : error code. + * @return T_pixy2ErrorCode : error code. */ T_pixy2ErrorCode pixy2_setServos (Word s0, Word s1); @@ -423,7 +423,7 @@ * @param red (Byte - passed by value) : Red component value (between 0 and 255) * @param green (Byte - passed by value) : Green component value (between 0 and 255) * @param blue (Byte - passed by value) : Blue component value (between 0 and 255) - * @return Pixy2ErrorCode : error code. + * @return T_pixy2ErrorCode : error code. */ T_pixy2ErrorCode pixy2_setLED (Byte red, Byte green, Byte blue); @@ -435,7 +435,7 @@ * @note Function Documentation : https://docs.pixycam.com/wiki/doku.php?id=wiki:v2:general_api * @param upper (Byte - passed by value) : binary, zero or non-zero * @param lower (Byte - passed by value) : binary, zero or non-zero - * @return Pixy2ErrorCode : error code. + * @return T_pixy2ErrorCode : error code. */ T_pixy2ErrorCode pixy2_setLamp (Byte upper, Byte lower); @@ -445,8 +445,8 @@ * This function can also serve as a simple indicator of the amount of light in the environment. That is, low framerates necessarily imply lower lighting levels * @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 framerate (T_pixy2returnCode - passed by reference) : acknoledge - * @return Pixy2ErrorCode : error code. + * @param framerate (T_pixy2ReturnCode - passed by reference) : number of frame per second (between 2 and 62) + * @return T_pixy2ErrorCode : error code. */ T_pixy2ErrorCode pixy2_getFPS (T_pixy2ReturnCode *framerate); @@ -458,7 +458,7 @@ * @note Function Documentation : https://docs.pixycam.com/wiki/doku.php?id=wiki:v2:pixy2_full_api#plugin_include__wiki__v2__ccc_api * @param sigmap (Byte - passed by value) : signature filtering * @param maxBloc (Byte - passed by value) : maximum number of blocks to return - * @return Pixy2ErrorCode : error code. + * @return T_pixy2ErrorCode : error code. * @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). @@ -474,7 +474,7 @@ * @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. + * @return T_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). @@ -488,13 +488,26 @@ * @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). + * @return T_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. */ T_pixy2ErrorCode pixy2_getAllFeature (Byte features); + +/** + * This function sets various modes in the line tracking algorithm. + * @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 mode (Byte - passed by value) : feature filtering + * @return T_pixy2ErrorCode : error code. + * @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. + */ T_pixy2ErrorCode pixy2_setMode (Byte mode); T_pixy2ErrorCode pixy2_setNexTurn (Word angle); T_pixy2ErrorCode pixy2_setDefaultTurn (Word angle);