Eyebot 7: eyebot/include/types.h Source File

Eyebot 7 7.16 A Hardware API to control various hardware

- Main Page
- Functions
- Types
- Files

- File List
- Globals

types.h
Go to the documentation of this file.
1
7 #ifndef TYPES_H_
8 #define TYPES_H_
9
14 #include <X11/Xlib.h>
15 #include <stdio.h>
16 #include <signal.h>
17 #include <stdlib.h>
18 #include <stddef.h>
19 #include <stdint.h>
20 #include <stdbool.h>
21 #include <stdlib.h>
22 #include <string.h>
23 #include <math.h>
24 #include <time.h>
25 #include <errno.h>
26 #include <unistd.h>
27 #include <sys/time.h>
28
29 #include <wiringPi.h>
30 #include <pthread.h>
31 #include <semaphore.h>
32
33 #define DEBUG 1
34
35 #define NUMBER_TRY 10
36 #define HDT_MAX_NAMECHAR 80
37 #define LCD_MENU_STRLENGTH 32 /* for storage declaration */
38 #define LCD_LIST_STRLENGTH 64 /* for storage declaration */
39 #define MENU_HEIGHT 38
40 #define KEYTM_MAX_REGIONS 32
41 #define VERSION "1.0"
42 #define MACHINE_SPEED 700000000
43 #define MACHINE_TYPE VEHICLE
44 #define MACHINE_NAME "EyeBot"
45 #define LIBM6OS_VERSION "1.0"
46 #define MACHINE_ID 1
47
48 typedef unsigned long KEYCODE;
49 typedef unsigned char KEYMODE;
50 typedef unsigned short LCDMODE;
51
52 #define HDT_MAX_PATHCHAR 256
53 #define HDT_MAX_FILECHAR 40
54 #define HDT_MAX_READBUFF 128
55
56 typedef char* DeviceSemantics;
57
61 typedef struct
62 {
63 pthread_t thread;
64 int identifier;
65 } TASK;
66
67 typedef sem_t SEMA;
68
69 int IPInitialised;
70
71 int CAMSIZE;
72 int CAMPIXELS;
73 int CAMWIDTH;
74 int CAMHEIGHT;
75 int CAMMODE;
76 int CAM_INITIAL;
77
78 int IP_WIDTH, IP_HEIGHT, IP_PIXELS, IP_SIZE;
79
80 int LCD_INITIAL;
81 int IM_TYPE;
82 int IM_LEFT;
83 int IM_TOP;
84 int IM_WIDTH;
85 int IM_LENGTH;
86
88 #define CAM_SUCCESS 1
89
90 #define CAM_FAILURE 0
91
92 //the font name length
93 #define FONTNAMELEN 200
94
95
101 #define IOBOARD 1
102
103 #define VEHICLE 1
104 #define PLATFORM 2
105 #define WALKER 3
106
107 #define HDT_FILE "/home/pi/eyebot/bin/hdt.txt"
108
109 typedef int COLOR;
110 typedef char BYTE;
111
112 typedef int TIMER;
113
117 #define QQVGA 0
119 #define QVGA 1
120 #define VGA 2
121 #define CAM1MP 3
122 #define CAMHD 4
123 #define CAM5MP 5
124 #define CUSTOM 10
125
130 #define QQVGA_X 160
132 #define QQVGA_Y 120
133 #define QQVGA_SIZE (QQVGA_X*QQVGA_Y*3)
134 #define QQVGA_PIXELS (QQVGA_X*QQVGA_Y)
135
136 typedef BYTE QQVGAcol[120][160][3];
137 typedef BYTE QQVGAgray[120][160];
139
143 #define QVGA_X 320
145 #define QVGA_Y 240
146 #define QVGA_SIZE (QVGA_X*QVGA_Y*3)
147 #define QVGA_PIXELS (QVGA_X*QVGA_Y)
148
149 typedef BYTE QVGAcol[240][320][3];
150 typedef BYTE QVGAgray[240][320];
152
156 #define VGA_X 640
158 #define VGA_Y 480
159 #define VGA_SIZE (VGA_X*VGA_Y*3)
160 #define VGA_PIXELS (VGA_X*VGA_Y)
161
162 typedef BYTE VGAcol[480][640][3];
163 typedef BYTE VGAgray[480][640];
165
169 #define CAM1MP_X 1296
171 #define CAM1MP_Y 730
172 #define CAM1MP_SIZE (CAM1MP_X*CAM1MP_Y*3)
173 #define CAM1MP_PIXELS (CAM1MP_X*CAM1MP_Y)
174
175 typedef BYTE CAM1MPcol[730][1296][3];
176 typedef BYTE CAM1MPgray[730][1296];
178
182 #define CAMHD_X 1920
184 #define CAMHD_Y 1080
185 #define CAMHD_SIZE (CAMHD_X*CAMHD_Y*3)
186 #define CAMHD_PIXELS (CAMHD_X*CAMHD_Y)
187
188 typedef BYTE CAMHDcol[1080][1920][3];
189 typedef BYTE CAMHDgray[1080][1920];
191
195 #define CAM5MP_X 2592
197 #define CAM5MP_Y 1944
198 #define CAM5MP_SIZE (CAM5MP_X*CAM5MP_Y*3)
199 #define CAM5MP_PIXELS (CAM5MP_X*CAM5MP_Y)
200
201 typedef BYTE CAM5MPcol[1944][2592][3];
202 typedef BYTE CAM5MPgray[1944][2592];
204
208 #define RED 0xFF00000
210 #define GREEN 0x00FF00
211 #define BLUE 0x0000FF
212 #define WHITE 0xFFFFFF
213 #define GRAY 0x808080
214 #define BLACK 0x000000
215 #define SILVER 0xC0C0C0
216 #define LIGHTGRAY 0xD3D3D3
217 #define DARKGRAY 0xA9A9A9
218 #define NAVY 0x000080
219 #define CYAN 0x00EEEE
220 #define TEAL 0x008080
221 #define MAGENTA 0xFF00FF
222 #define PURPLE 0x800080
223 #define MAROON 0x800000
224 #define YELLOW 0xFFFF00
225 #define OLIVE 0x9ACD32
226 #define ORANGE 0xFFA500
227
232 #define ANYKEY 0xFFFFFFFF
234 #define NOKEY 0x00000000
235 #define KEY1 0x00000001
236 #define KEY2 0x00000002
237 #define KEY3 0x00000004
238 #define KEY4 0x00000008
239
240 #define KEY_ESCAPE 0x80000000
241 #define KEY_LISTTL 0x40000000
242 #define KEY_LISTUP 0x20000000
243 #define KEY_LISTDN 0x10000000
244
245 #define KEY_LIST1 0x00000010
246 #define KEY_LIST2 0x00000020
247 #define KEY_LIST3 0x00000040
248 #define KEY_LIST4 0x00000080
249 #define KEY_LIST5 0x00000100
250 #define KEY_LIST6 0x00000200
251 #define KEY_LIST7 0x00000400
252 #define KEY_LIST8 0x00000800
253
254 #define KEY_GOIDLE 1
255 #define KEY_NOIDLE 0
256 #define KEY_STATE -1
257
258 #define KEY_GOIDLE 1
259 #define KEY_NOIDLE 0
260 #define KEY_STATE -1
261
262 #define KEYTM_UNKNOWN 0x00
263 #define KEYTM_CLASSIC 0x01
264 #define KEYTM_STANDARD 0x02
265 #define KEYTM_REGIONS 0x03
266 #define KEYTM_LISTMENU 0x04
267
268 #define KEY_INVALID 0xFFFFFFFF
269
274 // Define name char config file name
276 #define IR_KEY_1 '1' //KEY_1
277 #define IR_KEY_2 '2' //KEY_2
278 #define IR_KEY_3 '3' //KEY_3
279 #define IR_KEY_4 '4' //KEY_4
280 #define IR_KEY_5 '5' //KEY_5
281 #define IR_KEY_6 '6' //KEY_6
282 #define IR_KEY_7 '7' //KEY_7
283 #define IR_KEY_8 '8' //KEY_8
284 #define IR_KEY_9 '9' //KEY_9
285 #define IR_KEY_0 '0' //KEY_0
286 #define IR_KEY_RED 'R' //KEY_RED
287 #define IR_KEY_GREEN 'G' //KEY_GREEN
288 #define IR_KEY_YELLOW 'Y' //KEY_YELLOW
289 #define IR_KEY_BLUE 'B' //KEY_BLUE
290 #define IR_KEY_LEFT 'L' //KEY_LEFT
291 #define IR_KEY_RIGHT '>' //KEY_RIGHT
292 #define IR_KEY_UP 'U' //KEY_UP
293 #define IR_KEY_DOWN 'D' //KEY_DOWN
294 #define IR_KEY_OK 'O' //KEY_OK
295 #define IR_KEY_POWER 'P' //KEY_POWER
296
301 #define HELVETICA 0
303 #define TIMES 1
304 #define COURIER 2
305
310 #define NORMAL 0
312 #define BOLD 1
313 #define ITALICS 2
314
324 typedef struct
325 {
326 unsigned long flags;
327 unsigned long functions;
328 unsigned long decorations;
329 long inputMode;
330 unsigned long status;
331 } HINTS;
332
336 typedef struct
337 {
338 int xres, yres;
339 int bpp;
340 } SCREEN;
341
345 typedef struct
346 {
347 int x, y;
348 int xmax, ymax;
349 } CURSOR;
350
354 typedef struct
355 {
356 SCREEN screen;
357 CURSOR cursor; /* x & y holds font width & height! */
358 } FBINFO;
359
363 typedef struct
364 {
365 char name[50];
366 char mhz[50];
367 char arch[50];
368 char bogomips[50];
369 } INFO_CPU;
370
374 typedef struct
375 {
376 char procnum[20];
377 char total[40];
378 char free[40];
379 } INFO_MEM;
380
384 typedef struct
385 {
386 char num[20];
387 } INFO_PROC;
388
392 typedef struct
393 {
394 char uptime[20];
395 char vbatt[20];
396 int vbatt_8;
397 } INFO_MISC;
398
402 typedef struct
403 {
404 int x, y;
405 } COORD_PAIR;
406
410 typedef struct
411 {
412 int active;
413 COORD_PAIR tl; //top left
414 COORD_PAIR br; //bottom right
415 } BOX;
416
420 typedef struct
421 {
422 KEYMODE mode;
423 BOX rect[KEYTM_MAX_REGIONS];
424 } TOUCH_MAP;
425
429 typedef struct
430 {
431 COORD_PAIR point, value;
432 int sync, status;
433 } TOUCH_EVENT;
434
438 typedef struct
439 {
440 char label[LCD_MENU_STRLENGTH];
441 XColor fgcol, bgcol;
442 void *plink; /* link to user data/function! */
443 } MENU_ITEM;
444
448 typedef struct
449 {
450 char title[LCD_LIST_STRLENGTH];
451 XColor fgcol, bgcol;
452 int size, start, width, left, scroll; /* configure these! */
453 int index/*, count*/; /* the library will set & manage these! */
454 MENU_ITEM *pitems; /* pointer to array of 'size' menuitems */
455 int no_empty;
456 } LIST_MENU;
457
461 typedef struct
462 {
463 int lcdNum;
464 Display* d;
465 int s;
466 Window w;
467 Colormap colormap;
468 GC gc;
469 XFontStruct* fontstruct;
470 int fontType;
471 int fontVariation;
472 int fontSize;
473 int fontHeight;
474 int fontWidth;
475 int height;
476 int width;
477 int startCurPosX;
478 int startCurPosY;
479 XColor fgTextColor;
480 XColor bgTextColor;
481 char colorflag;
482 int mode;
483 MENU_ITEM menuItems[4];
484 LIST_MENU* listMenu;
485 int fd;
486 bool X11Error;
487 Screen *scr;
488 } LCD_HANDLE;
489
493 typedef struct
494 {
495 int x, y;
496 int height, width;
497 } RECT;
498
502 typedef struct HDT_ENTRY
503 {
504 int length;
505 char *buffer;
506 }
507 HDT_ENTRY;
508
512 typedef struct HDT_TABLE
513 {
514 struct HDT_TABLE *pnext;
515 char name[HDT_MAX_NAMECHAR];
516 int size;
517 int *data;
518 }
519 HDT_TABLE;
520
524 typedef struct HDT_DEVICE
525 {
526 struct HDT_DEVICE *pnext;
527 char name[HDT_MAX_NAMECHAR];
528 char tabname[HDT_MAX_NAMECHAR];
529 HDT_TABLE *ptable; /* pointer to a table */
530 }
531 HDT_DEVICE;
532
536 typedef struct HDT_CAM
537 {
538 struct HDT_CAM *pnext;
539 char name[HDT_MAX_NAMECHAR];
540 int regaddr, ucb1400io, width, height;
541 }
542 HDT_CAM;
543
547 typedef struct HDT_MOTOR
548 {
549 struct HDT_MOTOR *pnext;
550 char name[HDT_MAX_NAMECHAR];
551 char tabname[HDT_MAX_NAMECHAR];
552 HDT_TABLE *ptable; /* pointer to a table */
553 int regaddr;
554 }
555 HDT_MOTOR;
556
560 typedef struct HDT_ENCODER
561 {
562 struct HDT_ENCODER *pnext;
563 char name[HDT_MAX_NAMECHAR];
564 char motorname[HDT_MAX_NAMECHAR];
565 HDT_MOTOR *pmotor;
566 int regaddr, clickspm;
567 int maxspeed;
568 }
569 HDT_ENCODER;
570
574 typedef struct HDT_SERVO
575 {
576 struct HDT_SERVO *pnext;
577 char name[HDT_MAX_NAMECHAR];
578 char tabname[HDT_MAX_NAMECHAR];
579 HDT_TABLE *ptable; /* pointer to a table */
580 int regaddr, freq;
581 int mintime, maxtime;
582 int low, high;
583 }
584 HDT_SERVO;
585
589 typedef struct HDT_PSD
590 {
591 struct HDT_PSD *pnext;
592 char name[HDT_MAX_NAMECHAR];
593 char tabname[HDT_MAX_NAMECHAR];
594 HDT_TABLE *ptable; /* pointer to a table */
595 int regaddr;
596 }
597 HDT_PSD;
598
602 typedef struct HDT_DRIVE
603 {
604 struct HDT_DRIVE *pnext;
605 char name[HDT_MAX_NAMECHAR];
606 char encname1[HDT_MAX_NAMECHAR],encname2[HDT_MAX_NAMECHAR];
607 char encname3[HDT_MAX_NAMECHAR],encname4[HDT_MAX_NAMECHAR];
608 HDT_ENCODER *penc1, *penc2, *penc3, *penc4;
609 int drivetype;
610 int wheeldist1, axesdist, wheeldist2;
611 }
612 HDT_DRIVE;
613
617 typedef struct HDT_IRTV
618 {
619 struct HDT_IRTV *pnext;
620 char name[HDT_MAX_NAMECHAR];
621 int type, length, togmask, invmask, mode, buffsize, delay;
622 }
623 HDT_IRTV;
624
628 typedef struct HDT_ADC
629 {
630 struct HDT_ADC *pnext;
631 char name[HDT_MAX_NAMECHAR];
632 char procname[HDT_MAX_NAMECHAR];
633 int denom;
634 }
635 HDT_ADC;
636
640 typedef struct HDT_COM
641 {
642 struct HDT_COM *pnext;
643 char name[HDT_MAX_NAMECHAR];
644 char devname[HDT_MAX_NAMECHAR];
645 }
646 HDT_COM;
647
651 typedef struct
652 {
653 XColor fontColour;
654 char fontName[FONTNAMELEN];
655 } EYEFONT;
656
661 #endif /* TYPES_H_ */
CAM1MPcol
BYTE CAM1MPcol[730][1296][3]
Definition: types.h:175
CAM1MPgray
BYTE CAM1MPgray[730][1296]
Definition: types.h:176
QQVGAcol
BYTE QQVGAcol[120][160][3]
Definition: types.h:136
COLOR
int COLOR
Definition: types.h:109
CAM5MPcol
BYTE CAM5MPcol[1944][2592][3]
Definition: types.h:201
VGAcol
BYTE VGAcol[480][640][3]
Definition: types.h:162
CAMHDgray
BYTE CAMHDgray[1080][1920]
Definition: types.h:189
QVGAgray
BYTE QVGAgray[240][320]
Definition: types.h:150
TIMER
int TIMER
Definition: types.h:112
CAM5MPgray
BYTE CAM5MPgray[1944][2592]
Definition: types.h:202
VGAgray
BYTE VGAgray[480][640]
Definition: types.h:163
CAMHDcol
BYTE CAMHDcol[1080][1920][3]
Definition: types.h:188
QQVGAgray
BYTE QQVGAgray[120][160]
Definition: types.h:137
BYTE
char BYTE
Definition: types.h:110
QVGAcol
BYTE QVGAcol[240][320][3]
Definition: types.h:149