discoverpixy
pixydefs.h
Go to the documentation of this file.
1 //
2 // begin license header
3 //
4 // This file is part of Pixy CMUcam5 or "Pixy" for short
5 //
6 // All Pixy source code is provided under the terms of the
7 // GNU General Public License v2 (http://www.gnu.org/licenses/gpl-2.0.html).
8 // Those wishing to use Pixy source code, software and/or
9 // technologies under different licensing terms should contact us at
10 // cmucam@cs.cmu.edu. Such licensing terms are available for
11 // all portions of the Pixy codebase presented here.
12 //
13 // end license header
14 //
15 
16 #ifndef __PIXYDEFS_H__
17 #define __PIXYDEFS_H__
18 
19 //#include "libusb.h"
20 
21 //#define PIXY_VID 0xB1AC
22 //#define PIXY_DID 0xF000
23 //#define PIXY_DFU_VID 0x1FC9
24 //#define PIXY_DFU_DID 0x000C
25 
26 //#define PIXY_ERROR_USB_IO LIBUSB_ERROR_IO
27 //#define PIXY_ERROR_USB_NOT_FOUND LIBUSB_ERROR_NOT_FOUND
28 //#define PIXY_ERROR_USB_BUSY LIBUSB_ERROR_BUSY
29 //#define PIXY_ERROR_USB_NO_DEVICE LIBUSB_ERROR_NO_DEVICE
30 #define PIXY_ERROR_INVALID_PARAMETER -150
31 #define PIXY_ERROR_CHIRP -151
32 #define PIXY_ERROR_INVALID_COMMAND -152
33 
34 #define CRP_ARRAY 0x80 // bit
35 #define CRP_FLT 0x10 // bit
36 #define CRP_NO_COPY (0x10 | 0x20)
37 #define CRP_NULLTERM_ARRAY (0x20 | CRP_ARRAY) // bits
38 #define CRP_INT8 0x01
39 #define CRP_UINT8 0x01
40 #define CRP_INT16 0x02
41 #define CRP_UINT16 0x02
42 #define CRP_INT32 0x04
43 #define CRP_UINT32 0x04
44 #define CRP_FLT32 (CRP_FLT | 0x04)
45 #define CRP_FLT64 (CRP_FLT | 0x08)
46 #define CRP_STRING (CRP_NULLTERM_ARRAY | CRP_INT8)
47 #define CRP_TYPE_HINT 0x64 // type hint identifier
48 #define CRP_INTS8 (CRP_INT8 | CRP_ARRAY)
49 #define CRP_INTS16 (CRP_INT16 | CRP_ARRAY)
50 #define CRP_INTS32 (CRP_INT32 | CRP_ARRAY)
51 #define CRP_UINTS8 CRP_INTS8
52 #define CRP_UINTS8_NO_COPY (CRP_INTS8 | CRP_NO_COPY)
53 #define CRP_UINTS16_NO_COPY (CRP_INTS16 | CRP_NO_COPY)
54 #define CRP_UINTS32_NO_COPY (CRP_INTS32 | CRP_NO_COPY)
55 #define CRP_UINTS16 CRP_INTS16
56 #define CRP_UINTS32 CRP_INTS32
57 #define CRP_FLTS32 (CRP_FLT32 | CRP_ARRAY)
58 #define CRP_FLTS64 (CRP_FLT64 | CRP_ARRAY)
59 
60 // regular call args
61 #define INT8(v) CRP_INT8, v
62 #define UINT8(v) CRP_INT8, v
63 #define INT16(v) CRP_INT16, v
64 #define UINT16(v) CRP_INT16, v
65 #define INT32(v) CRP_INT32, v
66 #define UINT32(v) CRP_INT32, v
67 #define FLT32(v) CRP_FLT32, v
68 #define FLT64(v) CRP_FLT64, v
69 #define STRING(s) CRP_STRING, s
70 #define INTS8(len, a) CRP_INTS8, len, a
71 #define UINTS8(len, a) CRP_INTS8, len, a
72 #define UINTS8_NO_COPY(len) CRP_UINTS8_NO_COPY, len
73 #define UINTS16_NO_COPY(len) CRP_UINTS16_NO_COPY, len
74 #define UINTS32_NO_COPY(len) CRP_UINTS32_NO_COPY, len
75 #define INTS16(len, a) CRP_INTS16, len, a
76 #define UINTS16(len, a) CRP_INTS16, len, a
77 #define INTS32(len, a) CRP_INTS32, len, a
78 #define UINTS32(len, a) CRP_INTS32, len, a
79 #define FLTS32(len, a) CRP_FLTS32, len, a
80 #define FLTS64(len, a) CRP_FLTS64, len, a
81 
82 #ifndef END
83 #ifdef __x86_64__
84 #define END (int64_t)0
85 #else
86 #define END 0
87 #endif
88 #endif
89 #define END_OUT_ARGS END
90 #define END_IN_ARGS END
91 
92 #endif