pixy2 smart camera library www.pixycam.com
Pixy2 Library project (using UART interface)
pixy2.h@8:c93e1d706c0e, 2019-03-12 (annotated)
- Committer:
- haarkon
- Date:
- Tue Mar 12 09:50:51 2019 +0000
- Revision:
- 8:c93e1d706c0e
- Parent:
- 7:1163b9c3274b
- Child:
- 9:764075b514bf
update of documentation
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
haarkon | 0:dde1b9d6c9d6 | 1 | /** |
haarkon | 0:dde1b9d6c9d6 | 2 | * @author Hugues Angelis |
haarkon | 0:dde1b9d6c9d6 | 3 | * |
haarkon | 0:dde1b9d6c9d6 | 4 | * @section LICENSE |
haarkon | 0:dde1b9d6c9d6 | 5 | * |
haarkon | 0:dde1b9d6c9d6 | 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
haarkon | 0:dde1b9d6c9d6 | 7 | * of this software and associated documentation files (the "Software"), to deal |
haarkon | 0:dde1b9d6c9d6 | 8 | * in the Software without restriction, including without limitation the rights |
haarkon | 0:dde1b9d6c9d6 | 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
haarkon | 0:dde1b9d6c9d6 | 10 | * copies of the Software, and to permit persons to whom the Software is |
haarkon | 0:dde1b9d6c9d6 | 11 | * furnished to do so, subject to the following conditions: |
haarkon | 0:dde1b9d6c9d6 | 12 | * |
haarkon | 0:dde1b9d6c9d6 | 13 | * The above copyright notice and this permission notice shall be included in |
haarkon | 0:dde1b9d6c9d6 | 14 | * all copies or substantial portions of the Software. |
haarkon | 0:dde1b9d6c9d6 | 15 | * |
haarkon | 0:dde1b9d6c9d6 | 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
haarkon | 0:dde1b9d6c9d6 | 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
haarkon | 0:dde1b9d6c9d6 | 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
haarkon | 0:dde1b9d6c9d6 | 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
haarkon | 0:dde1b9d6c9d6 | 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
haarkon | 0:dde1b9d6c9d6 | 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
haarkon | 0:dde1b9d6c9d6 | 22 | * THE SOFTWARE. |
haarkon | 0:dde1b9d6c9d6 | 23 | * |
haarkon | 0:dde1b9d6c9d6 | 24 | * @section DESCRIPTION |
haarkon | 0:dde1b9d6c9d6 | 25 | * |
haarkon | 0:dde1b9d6c9d6 | 26 | * CMUCAM 5 - Pixy2 |
haarkon | 0:dde1b9d6c9d6 | 27 | * |
haarkon | 0:dde1b9d6c9d6 | 28 | * Datasheet, FAQ and PC drivers : |
haarkon | 0:dde1b9d6c9d6 | 29 | * |
haarkon | 0:dde1b9d6c9d6 | 30 | * http://www.pixycam.com/ |
haarkon | 0:dde1b9d6c9d6 | 31 | */ |
haarkon | 0:dde1b9d6c9d6 | 32 | |
haarkon | 0:dde1b9d6c9d6 | 33 | #ifndef _PIXY2_ |
haarkon | 0:dde1b9d6c9d6 | 34 | #define _PIXY2_ |
haarkon | 0:dde1b9d6c9d6 | 35 | |
haarkon | 0:dde1b9d6c9d6 | 36 | /** |
haarkon | 0:dde1b9d6c9d6 | 37 | * Include : Mbed Library |
haarkon | 0:dde1b9d6c9d6 | 38 | */ |
haarkon | 0:dde1b9d6c9d6 | 39 | #include "mbed.h" |
haarkon | 0:dde1b9d6c9d6 | 40 | |
haarkon | 0:dde1b9d6c9d6 | 41 | /** |
haarkon | 0:dde1b9d6c9d6 | 42 | * Defines |
haarkon | 0:dde1b9d6c9d6 | 43 | */ |
haarkon | 0:dde1b9d6c9d6 | 44 | #define PIXY2_NCSHEADERSIZE 4 |
haarkon | 0:dde1b9d6c9d6 | 45 | #define PIXY2_CSHEADERSIZE 4 |
haarkon | 0:dde1b9d6c9d6 | 46 | #define PIXY2_SYNC 0xC1AE |
haarkon | 0:dde1b9d6c9d6 | 47 | #define PIXY2_CSSYNC 0xC1AF |
haarkon | 0:dde1b9d6c9d6 | 48 | #define PIXY2_ACK 1 |
haarkon | 0:dde1b9d6c9d6 | 49 | #define PIXY2_ASK_RESOL 12 |
haarkon | 0:dde1b9d6c9d6 | 50 | #define PIXY2_REP_RESOL 13 |
haarkon | 0:dde1b9d6c9d6 | 51 | #define PIXY2_ASK_VERS 14 |
haarkon | 0:dde1b9d6c9d6 | 52 | #define PIXY2_REP_VERS 15 |
haarkon | 0:dde1b9d6c9d6 | 53 | #define PIXY2_SET_BRIGHT 16 |
haarkon | 0:dde1b9d6c9d6 | 54 | #define PIXY2_SET_SERVOS 18 |
haarkon | 0:dde1b9d6c9d6 | 55 | #define PIXY2_SET_LED 20 |
haarkon | 0:dde1b9d6c9d6 | 56 | #define PIXY2_SET_LAMP 22 |
haarkon | 0:dde1b9d6c9d6 | 57 | #define PIXY2_ASK_FPS 24 |
haarkon | 0:dde1b9d6c9d6 | 58 | #define PIXY2_ASK_BLOC 32 |
haarkon | 0:dde1b9d6c9d6 | 59 | #define PIXY2_REP_BLOC 33 |
haarkon | 0:dde1b9d6c9d6 | 60 | #define PIXY2_ASK_LINE 48 |
haarkon | 0:dde1b9d6c9d6 | 61 | #define PIXY2_REP_LINE 49 |
haarkon | 0:dde1b9d6c9d6 | 62 | #define PIXY2_SET_MODE 54 |
haarkon | 0:dde1b9d6c9d6 | 63 | #define PIXY2_SET_TURN 58 |
haarkon | 0:dde1b9d6c9d6 | 64 | #define PIXY2_SET_VECTOR 56 |
haarkon | 0:dde1b9d6c9d6 | 65 | #define PIXY2_SET_DEFTURN 60 |
haarkon | 0:dde1b9d6c9d6 | 66 | #define PIXY2_SET_REVERSE 62 |
haarkon | 0:dde1b9d6c9d6 | 67 | #define PIXY2_ASK_VIDEO 112 |
haarkon | 1:dd81f4065b6b | 68 | |
haarkon | 6:e9e3aa6f1a55 | 69 | /**************** ERRORS ****************/ |
haarkon | 5:28e47187bb5c | 70 | |
haarkon | 5:28e47187bb5c | 71 | /** |
haarkon | 6:e9e3aa6f1a55 | 72 | * \struct Pixy2ErrorCode |
haarkon | 6:e9e3aa6f1a55 | 73 | * \brief Explicit error code list : |
haarkon | 5:28e47187bb5c | 74 | * \param PIXY2_OK : No error |
haarkon | 5:28e47187bb5c | 75 | * \param PIXY2_MISC_ERROR : Unknown error |
haarkon | 5:28e47187bb5c | 76 | * \param PIXY2_BUSY : Pixy hasn't finish yet |
haarkon | 5:28e47187bb5c | 77 | * \param PIXY2_BAD_CHECKSUM : Checksum is wrong |
haarkon | 8:c93e1d706c0e | 78 | * \param PIXY2_TYPE_ERROR : Unexpected message type |
haarkon | 7:1163b9c3274b | 79 | * @note More documentation : https://docs.pixycam.com/wiki/doku.php?id=wiki:v2:general_api#error-codes |
haarkon | 5:28e47187bb5c | 80 | */ |
haarkon | 6:e9e3aa6f1a55 | 81 | typedef int Pixy2ErrorCode; |
haarkon | 5:28e47187bb5c | 82 | |
haarkon | 8:c93e1d706c0e | 83 | #define PIXY2_OK 0 |
haarkon | 5:28e47187bb5c | 84 | #define PIXY2_MISC_ERROR -1 |
haarkon | 5:28e47187bb5c | 85 | #define PIXY2_BUSY -2 |
haarkon | 5:28e47187bb5c | 86 | #define PIXY2_BAD_CHECKSUM -3 |
haarkon | 5:28e47187bb5c | 87 | #define PIXY2_TYPE_ERROR -7 |
haarkon | 1:dd81f4065b6b | 88 | |
haarkon | 1:dd81f4065b6b | 89 | /**************** STATE MACHINE ****************/ |
haarkon | 1:dd81f4065b6b | 90 | |
haarkon | 1:dd81f4065b6b | 91 | typedef enum {idle, messageSent, receivingHeader, headerReceived, receivingData, dataReceived} T_Pixy2State; |
haarkon | 1:dd81f4065b6b | 92 | |
haarkon | 1:dd81f4065b6b | 93 | /**************** UTILS ****************/ |
haarkon | 1:dd81f4065b6b | 94 | |
haarkon | 6:e9e3aa6f1a55 | 95 | |
haarkon | 0:dde1b9d6c9d6 | 96 | /** |
haarkon | 0:dde1b9d6c9d6 | 97 | * \struct Byte -> Short hand for unsigned char |
haarkon | 2:5281a6289e8b | 98 | * \struct sByte -> Short hand for char |
haarkon | 0:dde1b9d6c9d6 | 99 | * \struct Word -> Short hand for unsigned short |
haarkon | 2:5281a6289e8b | 100 | * \struct sWord -> Short hand for short |
haarkon | 0:dde1b9d6c9d6 | 101 | * \struct lWord -> Short hand for unsigned long |
haarkon | 2:5281a6289e8b | 102 | * \struct slWord -> Short hand for long |
haarkon | 0:dde1b9d6c9d6 | 103 | */ |
haarkon | 0:dde1b9d6c9d6 | 104 | typedef unsigned char Byte; |
haarkon | 2:5281a6289e8b | 105 | typedef char sByte; |
haarkon | 0:dde1b9d6c9d6 | 106 | typedef unsigned short Word; |
haarkon | 2:5281a6289e8b | 107 | typedef short sWord; |
haarkon | 0:dde1b9d6c9d6 | 108 | typedef unsigned long lWord; |
haarkon | 2:5281a6289e8b | 109 | typedef long slWord; |
haarkon | 0:dde1b9d6c9d6 | 110 | |
haarkon | 1:dd81f4065b6b | 111 | /** |
haarkon | 1:dd81f4065b6b | 112 | * \union T_Word |
haarkon | 1:dd81f4065b6b | 113 | * \brief Structured type to switch from word to bytes |
haarkon | 1:dd81f4065b6b | 114 | * \param mot (Word) : 16 bits word |
haarkon | 1:dd81f4065b6b | 115 | * \param octet (Byte) : 2 bytes that overlap mot (byte access) |
haarkon | 1:dd81f4065b6b | 116 | */ |
haarkon | 0:dde1b9d6c9d6 | 117 | typedef union { |
haarkon | 0:dde1b9d6c9d6 | 118 | Word mot; |
haarkon | 0:dde1b9d6c9d6 | 119 | Byte octet[2]; |
haarkon | 0:dde1b9d6c9d6 | 120 | }T_Word; |
haarkon | 0:dde1b9d6c9d6 | 121 | |
haarkon | 1:dd81f4065b6b | 122 | /** |
haarkon | 1:dd81f4065b6b | 123 | * \union T_lWord |
haarkon | 1:dd81f4065b6b | 124 | * \brief Structured type to switch from lword to word or bytes |
haarkon | 1:dd81f4065b6b | 125 | * \param motLong (lWord) : 32 bits word |
haarkon | 1:dd81f4065b6b | 126 | * \param mot (Word) : 2 x 16 bits words that overlap motLong (word access) |
haarkon | 1:dd81f4065b6b | 127 | * \param octet (Byte) : 4 bytes that overlap motLong (byte access) |
haarkon | 1:dd81f4065b6b | 128 | */ |
haarkon | 0:dde1b9d6c9d6 | 129 | typedef union { |
haarkon | 0:dde1b9d6c9d6 | 130 | lWord motLong; |
haarkon | 0:dde1b9d6c9d6 | 131 | Word mot[2]; |
haarkon | 0:dde1b9d6c9d6 | 132 | Byte octet[4]; |
haarkon | 0:dde1b9d6c9d6 | 133 | }T_lWord; |
haarkon | 0:dde1b9d6c9d6 | 134 | |
haarkon | 1:dd81f4065b6b | 135 | |
haarkon | 1:dd81f4065b6b | 136 | /**************** HEADERS ****************/ |
haarkon | 1:dd81f4065b6b | 137 | |
haarkon | 1:dd81f4065b6b | 138 | /** |
haarkon | 1:dd81f4065b6b | 139 | * \struct T_pixy2Header |
haarkon | 1:dd81f4065b6b | 140 | * \brief Structured type that match pixy2 header without checksum (send message) |
haarkon | 1:dd81f4065b6b | 141 | * \param pixSync (Word) : 16 bits synchro word - could be 0xc1ae (PIXY2_SYNC) or 0xc1af (PIXY2_CSSYNC) |
haarkon | 1:dd81f4065b6b | 142 | * \param pixType (Byte) : 8 bits message type identifier |
haarkon | 1:dd81f4065b6b | 143 | * \param pixLength (Byte) : 8 bits message payload length (payload doesn't include checksum) |
haarkon | 1:dd81f4065b6b | 144 | */ |
haarkon | 0:dde1b9d6c9d6 | 145 | typedef struct { |
haarkon | 0:dde1b9d6c9d6 | 146 | Word pixSync; |
haarkon | 0:dde1b9d6c9d6 | 147 | Byte pixType; |
haarkon | 0:dde1b9d6c9d6 | 148 | Byte pixLength; |
haarkon | 0:dde1b9d6c9d6 | 149 | }T_pixy2Header; |
haarkon | 0:dde1b9d6c9d6 | 150 | |
haarkon | 1:dd81f4065b6b | 151 | /** |
haarkon | 1:dd81f4065b6b | 152 | * \struct T_pixy2sendFrame |
haarkon | 1:dd81f4065b6b | 153 | * \brief Structured type that match frame definition for all kind of message to send to a pixy2 |
haarkon | 1:dd81f4065b6b | 154 | * \param header (T_pixy2Header) : 4 bytes classical header starting with PIXY2_SYNC |
haarkon | 1:dd81f4065b6b | 155 | * \param data (Byte) : 5 bytes payload (to match all usage, not all byte must be used) |
haarkon | 1:dd81f4065b6b | 156 | */ |
haarkon | 0:dde1b9d6c9d6 | 157 | typedef struct { |
haarkon | 0:dde1b9d6c9d6 | 158 | T_pixy2Header header; |
haarkon | 0:dde1b9d6c9d6 | 159 | Byte data[5]; |
haarkon | 0:dde1b9d6c9d6 | 160 | }T_pixy2sendFrame; |
haarkon | 0:dde1b9d6c9d6 | 161 | |
haarkon | 1:dd81f4065b6b | 162 | /** |
haarkon | 1:dd81f4065b6b | 163 | * \union T_pixy2sendBuffer |
haarkon | 1:dd81f4065b6b | 164 | * \brief Structured type to switch between structured type T_pixy2sendFrame and bytes |
haarkon | 1:dd81f4065b6b | 165 | * \param frame (T_pixy2sendFrame) : classical frame (header + payload) starting with PIXY2_SYNC |
haarkon | 1:dd81f4065b6b | 166 | * \param data (Byte) : 9 bytes that overlap frame (byte access) |
haarkon | 1:dd81f4065b6b | 167 | */ |
haarkon | 0:dde1b9d6c9d6 | 168 | typedef union { |
haarkon | 0:dde1b9d6c9d6 | 169 | T_pixy2sendFrame frame; |
haarkon | 0:dde1b9d6c9d6 | 170 | Byte data[9]; |
haarkon | 0:dde1b9d6c9d6 | 171 | }T_pixy2sendBuffer; |
haarkon | 0:dde1b9d6c9d6 | 172 | |
haarkon | 1:dd81f4065b6b | 173 | /** |
haarkon | 1:dd81f4065b6b | 174 | * \struct T_pixy2RcvHeader |
haarkon | 1:dd81f4065b6b | 175 | * \brief Structured type that match pixy2 header with checksum (received message) |
haarkon | 1:dd81f4065b6b | 176 | * \param pixSync (Word) : 16 bits synchro word - could be 0xc1ae (PIXY2_SYNC) or 0xc1af (PIXY2_CSSYNC) |
haarkon | 1:dd81f4065b6b | 177 | * \param pixType (Byte) : 8 bits message type identifier |
haarkon | 1:dd81f4065b6b | 178 | * \param pixLength (Byte) : 8 bits message payload length (payload doesn't include checksum) |
haarkon | 1:dd81f4065b6b | 179 | * \param pixSync (Word) : 16 bits checksum (sum of all bytes of the payload) |
haarkon | 1:dd81f4065b6b | 180 | */ |
haarkon | 0:dde1b9d6c9d6 | 181 | typedef struct { |
haarkon | 0:dde1b9d6c9d6 | 182 | Word pixSync; |
haarkon | 0:dde1b9d6c9d6 | 183 | Byte pixType; |
haarkon | 0:dde1b9d6c9d6 | 184 | Byte pixLength; |
haarkon | 0:dde1b9d6c9d6 | 185 | Word pixChecksum; |
haarkon | 0:dde1b9d6c9d6 | 186 | }T_pixy2RcvHeader; |
haarkon | 0:dde1b9d6c9d6 | 187 | |
haarkon | 1:dd81f4065b6b | 188 | |
haarkon | 1:dd81f4065b6b | 189 | /**************** PAYLOADS ****************/ |
haarkon | 1:dd81f4065b6b | 190 | |
haarkon | 1:dd81f4065b6b | 191 | /** |
haarkon | 1:dd81f4065b6b | 192 | * \struct T_pixy2returnCode |
haarkon | 1:dd81f4065b6b | 193 | * \brief Structured type that match pixy2 error/acknowledge/reply frame (type = 1 or 3) message payload |
haarkon | 1:dd81f4065b6b | 194 | * \param pixReturn (lWord) : 32 bits returned value |
haarkon | 1:dd81f4065b6b | 195 | */ |
haarkon | 0:dde1b9d6c9d6 | 196 | typedef struct { |
haarkon | 1:dd81f4065b6b | 197 | lWord pixReturn; |
haarkon | 1:dd81f4065b6b | 198 | }T_pixy2returnCode; |
haarkon | 0:dde1b9d6c9d6 | 199 | |
haarkon | 1:dd81f4065b6b | 200 | /** |
haarkon | 1:dd81f4065b6b | 201 | * \struct T_Pixy2Version |
haarkon | 1:dd81f4065b6b | 202 | * \brief Structured type that match pixy2 version frame (type = 14/15) message payload |
haarkon | 1:dd81f4065b6b | 203 | * \param pixHWVersion (Word) : 16 bits hardWare Version of pixy2 |
haarkon | 1:dd81f4065b6b | 204 | * \param pixFWVersionMaj (Byte) : 8 bits upper part of firmware (before the dot) |
haarkon | 1:dd81f4065b6b | 205 | * \param pixFWVersionMin (Byte) : 8 bits lower part of firmware (after the dot) |
haarkon | 1:dd81f4065b6b | 206 | * \param pixFWBuild (Word) : 16 bits firmware build information |
haarkon | 1:dd81f4065b6b | 207 | * \param pixHFString (String) : 10 bytes user friendly pixy2 firmware type |
haarkon | 1:dd81f4065b6b | 208 | */ |
haarkon | 0:dde1b9d6c9d6 | 209 | typedef struct { |
haarkon | 0:dde1b9d6c9d6 | 210 | Word pixHWVersion; |
haarkon | 0:dde1b9d6c9d6 | 211 | Byte pixFWVersionMaj; |
haarkon | 0:dde1b9d6c9d6 | 212 | Byte pixFWVersionMin; |
haarkon | 0:dde1b9d6c9d6 | 213 | Word pixFWBuild; |
haarkon | 0:dde1b9d6c9d6 | 214 | char pixHFString[10]; |
haarkon | 0:dde1b9d6c9d6 | 215 | }T_Pixy2Version; |
haarkon | 0:dde1b9d6c9d6 | 216 | |
haarkon | 1:dd81f4065b6b | 217 | /** |
haarkon | 1:dd81f4065b6b | 218 | * \struct T_Pixy2Resolution |
haarkon | 1:dd81f4065b6b | 219 | * \brief Structured type that match pixy2 resolution frame (type = 12/13) message payload |
haarkon | 1:dd81f4065b6b | 220 | * \param pixFrameWidth (Word) : 16 bits width (in pixel) of an image |
haarkon | 5:28e47187bb5c | 221 | * \param pixFrameHeight (Word) : 16 bits height (in pixel) of an image |
haarkon | 1:dd81f4065b6b | 222 | */ |
haarkon | 0:dde1b9d6c9d6 | 223 | typedef struct { |
haarkon | 0:dde1b9d6c9d6 | 224 | Word pixFrameWidth; |
haarkon | 5:28e47187bb5c | 225 | Word pixFrameHeight; |
haarkon | 0:dde1b9d6c9d6 | 226 | }T_Pixy2Resolution; |
haarkon | 0:dde1b9d6c9d6 | 227 | |
haarkon | 1:dd81f4065b6b | 228 | /** |
haarkon | 1:dd81f4065b6b | 229 | * \struct T_pixy2Bloc |
haarkon | 1:dd81f4065b6b | 230 | * \brief Structured type that match pixy2 blocks frame (type = 32/33) message payload |
haarkon | 1:dd81f4065b6b | 231 | * \param pixSignature (Word) : 16 bits signature or color code of the color bloc (signature are between 1 and 7, color code are composed of signature of 2, up to 5, tags so over 10) |
haarkon | 1:dd81f4065b6b | 232 | * \param pixX (Word) : 16 bits X (horizontal axis) position of color bloc center, relative to the left of the image (in pixels, between 0 and 315) |
haarkon | 1:dd81f4065b6b | 233 | * \param pixY (Word) : 16 bits Y (vertical axis) position of color bloc center, relative to the top of the image (in pixels, between 0 and 207) |
haarkon | 1:dd81f4065b6b | 234 | * \param pixWidth (Word) : 16 bits width (in pixels, between 0 and 316) of color bloc |
haarkon | 1:dd81f4065b6b | 235 | * \param pixHeight (Word) : 16 bits height (in pixels, between 0 and 208) of color bloc |
haarkon | 2:5281a6289e8b | 236 | * \param pixAngle (sWord) : 16 bits angle (in degree, between -180.0 and +180.0) of a color code bloc |
haarkon | 1:dd81f4065b6b | 237 | * \param pixIndex (Byte) : 8 bits tracking identification of the color code bloc (set by pixy2 to ease a bloc position following program) |
haarkon | 1:dd81f4065b6b | 238 | * \param pixAge (Byte) : 8 bits age (in number of frame) of a bloc (doesn't wrap around). |
haarkon | 1:dd81f4065b6b | 239 | * @note More info can be found here : https://docs.pixycam.com/wiki/doku.php?id=wiki:v2:ccc_api |
haarkon | 1:dd81f4065b6b | 240 | * @note or here : https://docs.pixycam.com/wiki/doku.php?id=wiki:v2:color_connected_components |
haarkon | 1:dd81f4065b6b | 241 | */ |
haarkon | 0:dde1b9d6c9d6 | 242 | typedef struct { |
haarkon | 0:dde1b9d6c9d6 | 243 | Word pixSignature; |
haarkon | 0:dde1b9d6c9d6 | 244 | Word pixX; |
haarkon | 0:dde1b9d6c9d6 | 245 | Word pixY; |
haarkon | 0:dde1b9d6c9d6 | 246 | Word pixWidth; |
haarkon | 0:dde1b9d6c9d6 | 247 | Word pixHeight; |
haarkon | 2:5281a6289e8b | 248 | sWord pixAngle; |
haarkon | 0:dde1b9d6c9d6 | 249 | Byte pixIndex; |
haarkon | 0:dde1b9d6c9d6 | 250 | Byte pixAge; |
haarkon | 0:dde1b9d6c9d6 | 251 | }T_pixy2Bloc; |
haarkon | 0:dde1b9d6c9d6 | 252 | |
haarkon | 1:dd81f4065b6b | 253 | /** |
haarkon | 1:dd81f4065b6b | 254 | * \struct T_Pixy2Vector |
haarkon | 1:dd81f4065b6b | 255 | * \brief Structured type that match pixy2 vector definition - used in Line frame (type 48/49) - message payload |
haarkon | 2:5281a6289e8b | 256 | * \param pixX0 (Byte) : 8 bits X (horizontal, relative to the left of image) position of the tail of the vector (number between 0 and 78) |
haarkon | 2:5281a6289e8b | 257 | * \param pixY0 (Byte) : 8 bits Y (vertical, relative to the top of image) position of the tail of the vector (number between 0 and 51) |
haarkon | 2:5281a6289e8b | 258 | * \param pixX1 (Byte) : 8 bits X (horizontal, relative to the left of image) position of the head of the vector (number between 0 and 78) |
haarkon | 2:5281a6289e8b | 259 | * \param pixY1 (Byte) : 8 bits Y (vertical, relative to the top of image) position of the head of the vector (number between 0 and 51) |
haarkon | 2:5281a6289e8b | 260 | * \param pixIndex (Byte) : 8 bits tracking identification of the vector (set by pixy2 to ease a vector identification in case of multiple vector in a line following program) |
haarkon | 2:5281a6289e8b | 261 | * \param pixFlags (Byte) : 8 bits flag containing possible usefull informations (see notes) |
haarkon | 4:eed638064b42 | 262 | * @note This structure is a feature of Line API, packed as a feature in a Line Frame, documented here : https://docs.pixycam.com/wiki/doku.php?id=wiki:v2:protocol_reference |
haarkon | 2:5281a6289e8b | 263 | * @note More info can be found here : https://docs.pixycam.com/wiki/doku.php?id=wiki:v2:line_api |
haarkon | 2:5281a6289e8b | 264 | * @note or here : https://docs.pixycam.com/wiki/doku.php?id=wiki:v2:line_tracking |
haarkon | 1:dd81f4065b6b | 265 | */ |
haarkon | 0:dde1b9d6c9d6 | 266 | typedef struct { |
haarkon | 0:dde1b9d6c9d6 | 267 | Byte pixX0; |
haarkon | 0:dde1b9d6c9d6 | 268 | Byte pixY0; |
haarkon | 0:dde1b9d6c9d6 | 269 | Byte pixX1; |
haarkon | 0:dde1b9d6c9d6 | 270 | Byte pixY1; |
haarkon | 0:dde1b9d6c9d6 | 271 | Byte pixIndex; |
haarkon | 0:dde1b9d6c9d6 | 272 | Byte pixFlags; |
haarkon | 0:dde1b9d6c9d6 | 273 | }T_Pixy2Vector; |
haarkon | 0:dde1b9d6c9d6 | 274 | |
haarkon | 2:5281a6289e8b | 275 | /** |
haarkon | 2:5281a6289e8b | 276 | * \struct T_Pixy2InterLine |
haarkon | 2:5281a6289e8b | 277 | * \brief Structured type that match pixy2 intersection line definition - used in Line frame (type 48/49) - message payload |
haarkon | 2:5281a6289e8b | 278 | * \param pixIndex (Byte) : 8 bits tracking identification of the intersection line (set by pixy2 to ease a line following program) |
haarkon | 2:5281a6289e8b | 279 | * \param pixReserved (Byte) : Not documented by manufacturer |
haarkon | 2:5281a6289e8b | 280 | * \param pixAngle (sWord) : 16 bits angle (in degree, between -180.0 and +180.0) of the intersection line |
haarkon | 4:eed638064b42 | 281 | * @note This structure is a sub feature of Line API, packed as a sub feature of intersection feature in a Line Frame, documented here : https://docs.pixycam.com/wiki/doku.php?id=wiki:v2:protocol_reference |
haarkon | 2:5281a6289e8b | 282 | * @note More info can be found here : https://docs.pixycam.com/wiki/doku.php?id=wiki:v2:line_api |
haarkon | 2:5281a6289e8b | 283 | * @note or here : https://docs.pixycam.com/wiki/doku.php?id=wiki:v2:line_tracking |
haarkon | 2:5281a6289e8b | 284 | */ |
haarkon | 0:dde1b9d6c9d6 | 285 | typedef struct { |
haarkon | 0:dde1b9d6c9d6 | 286 | Byte pixIndex; |
haarkon | 0:dde1b9d6c9d6 | 287 | Byte pixReserved; |
haarkon | 2:5281a6289e8b | 288 | sWord pixAngle; |
haarkon | 0:dde1b9d6c9d6 | 289 | }T_Pixy2InterLine; |
haarkon | 0:dde1b9d6c9d6 | 290 | |
haarkon | 3:6ba43af28440 | 291 | /** |
haarkon | 3:6ba43af28440 | 292 | * \struct T_pixy2Intersection |
haarkon | 3:6ba43af28440 | 293 | * \brief Structured type that match pixy2 intersection definition - used in Line frame (type 48/49) - message payload |
haarkon | 3:6ba43af28440 | 294 | * \param pixX (Byte) : X axis coordinate of the intersection (in pixel, between 0 and 78) |
haarkon | 3:6ba43af28440 | 295 | * \param pixY (Byte) : Y axis coordinate of the intersection (in pixel, between 0 and 51) |
haarkon | 3:6ba43af28440 | 296 | * \param pixN (Byte) : Number of lines connected to the intersection (between 3 and 5) |
haarkon | 3:6ba43af28440 | 297 | * \param pixReserved (Byte) : Not documented by manufacturer |
haarkon | 4:eed638064b42 | 298 | * @note This structure is a feature of Line API, packed as a feature in a Line Frame, documented here : https://docs.pixycam.com/wiki/doku.php?id=wiki:v2:protocol_reference |
haarkon | 3:6ba43af28440 | 299 | * @note More info can be found here : https://docs.pixycam.com/wiki/doku.php?id=wiki:v2:line_api |
haarkon | 3:6ba43af28440 | 300 | * @note or here : https://docs.pixycam.com/wiki/doku.php?id=wiki:v2:line_tracking |
haarkon | 3:6ba43af28440 | 301 | */ |
haarkon | 0:dde1b9d6c9d6 | 302 | typedef struct { |
haarkon | 0:dde1b9d6c9d6 | 303 | Byte pixX; |
haarkon | 0:dde1b9d6c9d6 | 304 | Byte pixY; |
haarkon | 0:dde1b9d6c9d6 | 305 | Byte pixN; |
haarkon | 0:dde1b9d6c9d6 | 306 | Byte pixReserved; |
haarkon | 0:dde1b9d6c9d6 | 307 | }T_pixy2Intersection; |
haarkon | 0:dde1b9d6c9d6 | 308 | |
haarkon | 3:6ba43af28440 | 309 | /** |
haarkon | 3:6ba43af28440 | 310 | * \struct T_pixy2BarCode |
haarkon | 3:6ba43af28440 | 311 | * \brief Structured type that match pixy2 barcode definition - used in Line frame (type 48/49) - message payload |
haarkon | 3:6ba43af28440 | 312 | * \param pixX (Byte) : X axis coordinate of the barcode (in pixel, between 0 and 78) |
haarkon | 3:6ba43af28440 | 313 | * \param pixY (Byte) : Y axis coordinate of the barcode (in pixel, between 0 and 51) |
haarkon | 3:6ba43af28440 | 314 | * \param pixFlag (Byte) : Flag to indicate if barcode met filtering constraint |
haarkon | 3:6ba43af28440 | 315 | * \param pixCode (Byte) : Indicate the numeric value associated with the barcode (between 0 and 15) |
haarkon | 4:eed638064b42 | 316 | * @note This structure is a feature of Line API, packed as a feature in a Line Frame, documented here : https://docs.pixycam.com/wiki/doku.php?id=wiki:v2:protocol_reference |
haarkon | 3:6ba43af28440 | 317 | * @note More info can be found here : https://docs.pixycam.com/wiki/doku.php?id=wiki:v2:line_api |
haarkon | 3:6ba43af28440 | 318 | * @note or here : https://docs.pixycam.com/wiki/doku.php?id=wiki:v2:line_tracking |
haarkon | 3:6ba43af28440 | 319 | */ |
haarkon | 0:dde1b9d6c9d6 | 320 | typedef struct { |
haarkon | 0:dde1b9d6c9d6 | 321 | Byte pixX; |
haarkon | 0:dde1b9d6c9d6 | 322 | Byte pixY; |
haarkon | 0:dde1b9d6c9d6 | 323 | Byte pixFlag; |
haarkon | 0:dde1b9d6c9d6 | 324 | Byte pixCode; |
haarkon | 0:dde1b9d6c9d6 | 325 | }T_pixy2BarCode; |
haarkon | 0:dde1b9d6c9d6 | 326 | |
haarkon | 4:eed638064b42 | 327 | /** |
haarkon | 4:eed638064b42 | 328 | * \struct T_pixy2LineFeature |
haarkon | 4:eed638064b42 | 329 | * \brief Structured type that match pixy2 feature header for Line API - used in Line frame (type 48/49) - message payload |
haarkon | 4:eed638064b42 | 330 | * \param pixType (Byte) : Type of the feature (can be 1 -> Vector, 2 -> Intersection or 4 -> Barcode) |
haarkon | 4:eed638064b42 | 331 | * \param pixLength (Byte) : Number of Bytes for this feature |
haarkon | 4:eed638064b42 | 332 | * @note This structure is the header of features of Line API in Line Frames. Ther can be up to 4 features in a frame. Documented here : https://docs.pixycam.com/wiki/doku.php?id=wiki:v2:protocol_reference |
haarkon | 4:eed638064b42 | 333 | * @note More info can be found here : https://docs.pixycam.com/wiki/doku.php?id=wiki:v2:line_api |
haarkon | 4:eed638064b42 | 334 | * @note or here : https://docs.pixycam.com/wiki/doku.php?id=wiki:v2:line_tracking |
haarkon | 4:eed638064b42 | 335 | */ |
haarkon | 0:dde1b9d6c9d6 | 336 | typedef struct { |
haarkon | 0:dde1b9d6c9d6 | 337 | Byte pixType; |
haarkon | 0:dde1b9d6c9d6 | 338 | Byte pixLength; |
haarkon | 0:dde1b9d6c9d6 | 339 | }T_pixy2LineFeature; |
haarkon | 0:dde1b9d6c9d6 | 340 | |
haarkon | 4:eed638064b42 | 341 | /** |
haarkon | 4:eed638064b42 | 342 | * \struct T_pixy2Pixel |
haarkon | 4:eed638064b42 | 343 | * \brief Structured type that match pixy2 video API - used in Video frame (type 112/1) - message payload |
haarkon | 4:eed638064b42 | 344 | * \param pixBlue (Byte) : Blue RGB value of the average blue component of the 5x5 pixels square centered on X param passes to the function (value between 0 and 255) |
haarkon | 4:eed638064b42 | 345 | * \param pixGreen (Byte) : Green RGB value of the average blue component of the 5x5 pixels square centered on X param passes to the function (value between 0 and 255) |
haarkon | 4:eed638064b42 | 346 | * \param pixRed (Byte) : Red RGB value of the average blue component of the 5x5 pixels square centered on X param passes to the function (value between 0 and 255) |
haarkon | 4:eed638064b42 | 347 | * @note More info can be found here : https://docs.pixycam.com/wiki/doku.php?id=wiki:v2:video_api |
haarkon | 4:eed638064b42 | 348 | * @note or here : https://docs.pixycam.com/wiki/doku.php?id=wiki:v2:video |
haarkon | 4:eed638064b42 | 349 | */ |
haarkon | 0:dde1b9d6c9d6 | 350 | typedef struct { |
haarkon | 0:dde1b9d6c9d6 | 351 | Byte pixBlue; |
haarkon | 0:dde1b9d6c9d6 | 352 | Byte pixGreen; |
haarkon | 0:dde1b9d6c9d6 | 353 | Byte pixRed; |
haarkon | 0:dde1b9d6c9d6 | 354 | }T_pixy2Pixel; |
haarkon | 0:dde1b9d6c9d6 | 355 | |
haarkon | 0:dde1b9d6c9d6 | 356 | /** |
haarkon | 0:dde1b9d6c9d6 | 357 | * Pixy2 : CMU CAM 5 - Smart camera |
haarkon | 0:dde1b9d6c9d6 | 358 | * More informations at http://www.pixycam.com/ |
haarkon | 0:dde1b9d6c9d6 | 359 | */ |
haarkon | 0:dde1b9d6c9d6 | 360 | class PIXY2 { |
haarkon | 0:dde1b9d6c9d6 | 361 | |
haarkon | 0:dde1b9d6c9d6 | 362 | protected : |
haarkon | 0:dde1b9d6c9d6 | 363 | |
haarkon | 0:dde1b9d6c9d6 | 364 | Serial* _Pixy2; |
haarkon | 0:dde1b9d6c9d6 | 365 | |
haarkon | 0:dde1b9d6c9d6 | 366 | public : |
haarkon | 0:dde1b9d6c9d6 | 367 | /** |
haarkon | 0:dde1b9d6c9d6 | 368 | * Constructor of pixy2 object. |
haarkon | 0:dde1b9d6c9d6 | 369 | * |
haarkon | 0:dde1b9d6c9d6 | 370 | * @param tx : the Mbed pin used as TX |
haarkon | 0:dde1b9d6c9d6 | 371 | * @param rx : the Mbed pin used as RX |
haarkon | 0:dde1b9d6c9d6 | 372 | * @param debit : the bitrate of the serial (max value is 230400 b/s) |
haarkon | 0:dde1b9d6c9d6 | 373 | */ |
haarkon | 0:dde1b9d6c9d6 | 374 | PIXY2(PinName tx, PinName rx, int debit = 230400); |
haarkon | 0:dde1b9d6c9d6 | 375 | |
haarkon | 0:dde1b9d6c9d6 | 376 | // Fonctions publiques |
haarkon | 3:6ba43af28440 | 377 | |
haarkon | 3:6ba43af28440 | 378 | /** |
haarkon | 5:28e47187bb5c | 379 | * Queries and receives the firmware and hardware version of Pixy2, which is put in the version member variable. |
haarkon | 5:28e47187bb5c | 380 | * @note Frame Documentation : https://docs.pixycam.com/wiki/doku.php?id=wiki:v2:porting_guide |
haarkon | 5:28e47187bb5c | 381 | * @note Function Documentation : https://docs.pixycam.com/wiki/doku.php?id=wiki:v2:general_api |
haarkon | 5:28e47187bb5c | 382 | * @param version (T_Pixy2Version - passed by reference) : pointer to the version data structure |
haarkon | 6:e9e3aa6f1a55 | 383 | * @return Pixy2ErrorCode : error code. |
haarkon | 3:6ba43af28440 | 384 | */ |
haarkon | 6:e9e3aa6f1a55 | 385 | Pixy2ErrorCode pixy2_getVersion (T_Pixy2Version *version); |
haarkon | 4:eed638064b42 | 386 | |
haarkon | 4:eed638064b42 | 387 | /** |
haarkon | 5:28e47187bb5c | 388 | * Gets the width and height of the frames used by the current program. |
haarkon | 5:28e47187bb5c | 389 | * @note After calling this function, the width and height can be found in the frameWidth and frameHeight member variables. |
haarkon | 5:28e47187bb5c | 390 | * @note Frame Documentation : https://docs.pixycam.com/wiki/doku.php?id=wiki:v2:porting_guide |
haarkon | 5:28e47187bb5c | 391 | * @note Function Documentation : https://docs.pixycam.com/wiki/doku.php?id=wiki:v2:general_api |
haarkon | 5:28e47187bb5c | 392 | * @param resolution (T_Pixy2Resolution - passed by reference) : pointer to the resolution data structure |
haarkon | 6:e9e3aa6f1a55 | 393 | * @return Pixy2ErrorCode : error code. |
haarkon | 4:eed638064b42 | 394 | */ |
haarkon | 6:e9e3aa6f1a55 | 395 | Pixy2ErrorCode pixy2_getResolution (T_Pixy2Resolution *resolution); |
haarkon | 5:28e47187bb5c | 396 | |
haarkon | 5:28e47187bb5c | 397 | /** |
haarkon | 5:28e47187bb5c | 398 | * Sets the relative exposure level of Pixy2's image sensor. Higher values result in a brighter (more exposed) image. |
haarkon | 5:28e47187bb5c | 399 | * @note Frame Documentation : https://docs.pixycam.com/wiki/doku.php?id=wiki:v2:porting_guide |
haarkon | 5:28e47187bb5c | 400 | * @note Function Documentation : https://docs.pixycam.com/wiki/doku.php?id=wiki:v2:general_api |
haarkon | 5:28e47187bb5c | 401 | * @param brightness (Byte - passed by value) : brightness level |
haarkon | 6:e9e3aa6f1a55 | 402 | * @return Pixy2ErrorCode : error code. |
haarkon | 6:e9e3aa6f1a55 | 403 | */ |
haarkon | 6:e9e3aa6f1a55 | 404 | Pixy2ErrorCode pixy2_setCameraBrightness (Byte brightness); |
haarkon | 6:e9e3aa6f1a55 | 405 | |
haarkon | 6:e9e3aa6f1a55 | 406 | /** |
haarkon | 8:c93e1d706c0e | 407 | * Sets the servo positions of servos plugged into Pixy2's two RC servo connectors. |
haarkon | 6:e9e3aa6f1a55 | 408 | * @note Frame Documentation : https://docs.pixycam.com/wiki/doku.php?id=wiki:v2:porting_guide |
haarkon | 6:e9e3aa6f1a55 | 409 | * @note Function Documentation : https://docs.pixycam.com/wiki/doku.php?id=wiki:v2:general_api |
haarkon | 7:1163b9c3274b | 410 | * @param s0 (Word - passed by value) : value between 0 and 511 |
haarkon | 7:1163b9c3274b | 411 | * @param s1 (Word - passed by value) : value between 0 and 511 |
haarkon | 6:e9e3aa6f1a55 | 412 | * @return Pixy2ErrorCode : error code. |
haarkon | 5:28e47187bb5c | 413 | */ |
haarkon | 6:e9e3aa6f1a55 | 414 | Pixy2ErrorCode pixy2_setServos (Word s0, Word s1); |
haarkon | 8:c93e1d706c0e | 415 | |
haarkon | 8:c93e1d706c0e | 416 | /** |
haarkon | 8:c93e1d706c0e | 417 | * Sets Pixy2's RGB LED value. The three arguments sets the brightness of the red, green and blue sections of the LED. |
haarkon | 8:c93e1d706c0e | 418 | * @note It will override Pixy2's own setting of the RGB LED. |
haarkon | 8:c93e1d706c0e | 419 | * @note Frame Documentation : https://docs.pixycam.com/wiki/doku.php?id=wiki:v2:porting_guide |
haarkon | 8:c93e1d706c0e | 420 | * @note Function Documentation : https://docs.pixycam.com/wiki/doku.php?id=wiki:v2:general_api |
haarkon | 8:c93e1d706c0e | 421 | * @param red (Byte - passed by value) : Red component value (between 0 and 255) |
haarkon | 8:c93e1d706c0e | 422 | * @param green (Byte - passed by value) : Green component value (between 0 and 255) |
haarkon | 8:c93e1d706c0e | 423 | * @param blue (Byte - passed by value) : Blue component value (between 0 and 255) |
haarkon | 8:c93e1d706c0e | 424 | * @return Pixy2ErrorCode : error code. |
haarkon | 8:c93e1d706c0e | 425 | */ |
haarkon | 6:e9e3aa6f1a55 | 426 | Pixy2ErrorCode pixy2_setLED (Byte red, Byte green, Byte blue); |
haarkon | 8:c93e1d706c0e | 427 | |
haarkon | 8:c93e1d706c0e | 428 | /** |
haarkon | 8:c93e1d706c0e | 429 | * Turns on/off Pixy2's integrated light source. |
haarkon | 8:c93e1d706c0e | 430 | * @note The upper argument controls the two white LEDs along the top edge of Pixy2's PCB. The lower argument sets the RGB LED, causing it to turn on all three color channels at full brightness, resulting in white light. |
haarkon | 8:c93e1d706c0e | 431 | * @note It will override Pixy2's own setting of the RGB LED. |
haarkon | 8:c93e1d706c0e | 432 | * @note Frame Documentation : https://docs.pixycam.com/wiki/doku.php?id=wiki:v2:porting_guide |
haarkon | 8:c93e1d706c0e | 433 | * @note Function Documentation : https://docs.pixycam.com/wiki/doku.php?id=wiki:v2:general_api |
haarkon | 8:c93e1d706c0e | 434 | * @param upper (Byte - passed by value) : binary, zero or non-zero |
haarkon | 8:c93e1d706c0e | 435 | * @param lower (Byte - passed by value) : binary, zero or non-zero |
haarkon | 8:c93e1d706c0e | 436 | * @return Pixy2ErrorCode : error code. |
haarkon | 8:c93e1d706c0e | 437 | */ |
haarkon | 6:e9e3aa6f1a55 | 438 | Pixy2ErrorCode pixy2_setLamp (Byte upper, Byte lower); |
haarkon | 8:c93e1d706c0e | 439 | |
haarkon | 8:c93e1d706c0e | 440 | /** |
haarkon | 8:c93e1d706c0e | 441 | * Gets Pixy2's framerate. |
haarkon | 8:c93e1d706c0e | 442 | * The framerate can range between 2 and 62 frames per second depending on the amount of light in the environment and the min frames per second setting in the Camera configuration tab. |
haarkon | 8:c93e1d706c0e | 443 | * @note 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 |
haarkon | 8:c93e1d706c0e | 444 | * @note Frame Documentation : https://docs.pixycam.com/wiki/doku.php?id=wiki:v2:porting_guide |
haarkon | 8:c93e1d706c0e | 445 | * @note Function Documentation : https://docs.pixycam.com/wiki/doku.php?id=wiki:v2:general_api |
haarkon | 8:c93e1d706c0e | 446 | * @param framerate (T_pixy2returnCode - passed by reference) : acknoledge |
haarkon | 8:c93e1d706c0e | 447 | * @return Pixy2ErrorCode : error code. |
haarkon | 8:c93e1d706c0e | 448 | */ |
haarkon | 6:e9e3aa6f1a55 | 449 | Pixy2ErrorCode pixy2_getFPS (T_pixy2returnCode *framerate); |
haarkon | 6:e9e3aa6f1a55 | 450 | Pixy2ErrorCode pixy2_getBlocks (Byte sigmap, Byte maxBloc); |
haarkon | 6:e9e3aa6f1a55 | 451 | Pixy2ErrorCode pixy2_getMainFeature (Byte type, Byte features); |
haarkon | 6:e9e3aa6f1a55 | 452 | Pixy2ErrorCode pixy2_getAllFeature (Byte features); |
haarkon | 6:e9e3aa6f1a55 | 453 | Pixy2ErrorCode pixy2_setMode (Byte mode); |
haarkon | 6:e9e3aa6f1a55 | 454 | Pixy2ErrorCode pixy2_setNexTurn (Word angle); |
haarkon | 6:e9e3aa6f1a55 | 455 | Pixy2ErrorCode pixy2_setDefaultTurn (Word angle); |
haarkon | 6:e9e3aa6f1a55 | 456 | Pixy2ErrorCode pixy2_setVector (Byte vectorIndex); |
haarkon | 6:e9e3aa6f1a55 | 457 | Pixy2ErrorCode pixy2_ReverseVector (void); |
haarkon | 6:e9e3aa6f1a55 | 458 | Pixy2ErrorCode pixy2_getRGB (Word x, Word y, Byte saturate, T_pixy2Pixel *pixel); |
haarkon | 0:dde1b9d6c9d6 | 459 | |
haarkon | 0:dde1b9d6c9d6 | 460 | // Variables globales Publiques |
haarkon | 0:dde1b9d6c9d6 | 461 | Byte Pixy2_numBlocks; |
haarkon | 0:dde1b9d6c9d6 | 462 | T_pixy2Bloc Pixy2_blocks[]; |
haarkon | 0:dde1b9d6c9d6 | 463 | Byte Pixy2_numVectors; |
haarkon | 0:dde1b9d6c9d6 | 464 | T_Pixy2Vector Pixy2_vectors[]; |
haarkon | 0:dde1b9d6c9d6 | 465 | Byte Pixy2_numIntersections; |
haarkon | 0:dde1b9d6c9d6 | 466 | T_pixy2Intersection Pixy2_intersections[]; |
haarkon | 0:dde1b9d6c9d6 | 467 | T_Pixy2InterLine Pixy2_intLines[]; |
haarkon | 0:dde1b9d6c9d6 | 468 | Byte Pixy2_numBarcodes; |
haarkon | 0:dde1b9d6c9d6 | 469 | T_pixy2BarCode Pixy2_barcodes[]; |
haarkon | 0:dde1b9d6c9d6 | 470 | |
haarkon | 0:dde1b9d6c9d6 | 471 | private : |
haarkon | 0:dde1b9d6c9d6 | 472 | // Variables globales Privées |
haarkon | 0:dde1b9d6c9d6 | 473 | T_Pixy2State etat; |
haarkon | 0:dde1b9d6c9d6 | 474 | Byte* Pixy2_buffer; |
haarkon | 0:dde1b9d6c9d6 | 475 | Byte wPointer, rPointer, dataSize; |
haarkon | 0:dde1b9d6c9d6 | 476 | Byte frameContainChecksum; |
haarkon | 0:dde1b9d6c9d6 | 477 | |
haarkon | 0:dde1b9d6c9d6 | 478 | // Fonctions privées |
haarkon | 6:e9e3aa6f1a55 | 479 | Pixy2ErrorCode pixy2_sndGetVersion (void); |
haarkon | 6:e9e3aa6f1a55 | 480 | Pixy2ErrorCode pixy2_sndGetResolution (void); |
haarkon | 6:e9e3aa6f1a55 | 481 | Pixy2ErrorCode pixy2_sndSetCameraBrightness (Byte brightness); |
haarkon | 6:e9e3aa6f1a55 | 482 | Pixy2ErrorCode pixy2_sndSetServo (Word s0, Word s1); |
haarkon | 6:e9e3aa6f1a55 | 483 | Pixy2ErrorCode pixy2_sndSetLED (Byte red, Byte green, Byte blue); |
haarkon | 6:e9e3aa6f1a55 | 484 | Pixy2ErrorCode pixy2_sndSetLamp (Byte upper, Byte lower); |
haarkon | 6:e9e3aa6f1a55 | 485 | Pixy2ErrorCode pixy2_sndGetFPS (void); |
haarkon | 6:e9e3aa6f1a55 | 486 | Pixy2ErrorCode pixy2_sndGetBlocks (Byte sigmap, Byte maxBloc); |
haarkon | 6:e9e3aa6f1a55 | 487 | Pixy2ErrorCode pixy2_sndGetMainFeature (Byte type, Byte feature); |
haarkon | 6:e9e3aa6f1a55 | 488 | Pixy2ErrorCode pixy2_sndSetMode (Byte mode); |
haarkon | 6:e9e3aa6f1a55 | 489 | Pixy2ErrorCode pixy2_sndSetNexTurn (Word angle); |
haarkon | 6:e9e3aa6f1a55 | 490 | Pixy2ErrorCode pixy2_sndSetDefaultTurn (Word angle); |
haarkon | 6:e9e3aa6f1a55 | 491 | Pixy2ErrorCode pixy2_sndSetVector (Byte vectorIndex); |
haarkon | 6:e9e3aa6f1a55 | 492 | Pixy2ErrorCode pixy2_sndReverseVector (void); |
haarkon | 6:e9e3aa6f1a55 | 493 | Pixy2ErrorCode pixy2_sndGetRGB (Word x, Word y, Byte saturate); |
haarkon | 0:dde1b9d6c9d6 | 494 | |
haarkon | 0:dde1b9d6c9d6 | 495 | void pixy2_getByte (); |
haarkon | 6:e9e3aa6f1a55 | 496 | Pixy2ErrorCode pixy2_validateChecksum (Byte* tab); |
haarkon | 0:dde1b9d6c9d6 | 497 | }; |
haarkon | 0:dde1b9d6c9d6 | 498 | |
haarkon | 0:dde1b9d6c9d6 | 499 | #endif |