Welcome to the EyeBot  Version 7 - RPi1
A Controller For Various Hardware IO
types.h
Go to the documentation of this file.
1 
7 #ifndef TYPES_H_
8 #define TYPES_H_
9 
10 #include <X11/Xlib.h>
11 #include <stddef.h>
12 #include <stdint.h>
13 #include <stdbool.h>
14 #include <math.h>
15 
16 #define VEHICLE 1
17 #define PLATFORM 2
18 #define WALKER 3
19 
20 #define DEBUG 1
21 //#define MIN(a,b) (((a)<(b))?(a):(b))
22 //#define MAX(a,b) (((a)>(b))?(a):(b))
23 
24 #define NUMBER_TRY 10
25 #define HDT_MAX_NAMECHAR 80
26 #define LCD_MENU_STRLENGTH 32 /* for storage declaration */
27 #define LCD_LIST_STRLENGTH 64 /* for storage declaration */
28 #define MENU_HEIGHT 38
29 #define KEYTM_MAX_REGIONS 32
30 #define VERSION "1.0"
31 #define MACHINE_SPEED 700000000
32 #define MACHINE_TYPE VEHICLE
33 #define MACHINE_NAME "EyeBot"
34 #define ID 1
35 #define LIBM6OS_VERSION "1.0"
36 
37 #define HDT_FILE "/home/pi/eyebot/bin/hdt.txt"
38 
39 #define HDT_MAX_PATHCHAR 256
40 #define HDT_MAX_FILECHAR 40
41 #define HDT_MAX_READBUFF 128
42 
43 #define IOBOARD 1
44 
45 typedef char* DeviceSemantics;
46 
47 //may need to change to int
48 typedef unsigned short HWORD;
49 typedef unsigned long KEYCODE;
50 typedef unsigned char KEYMODE;
51 typedef unsigned short LCDMODE;
52 
53 typedef int COLOR;
54 typedef char BYTE;
55 
56 int CAMWIDTH;
57 int CAMHEIGHT;
58 int CAMMODE;
59 
60 //defining the image dimensions
61 #define QQVGA_X 160
62 #define QQVGA_Y 120
63 #define QQVGA_SIZE (QQVGA_X*QQVGA_Y*3)
64 #define QVGA_X 240
65 #define QVGA_Y 320
66 #define QVGA_SIZE (QVGA_X*QVGA_Y*3)
67 #define VGA_X 640
68 #define VGA_Y 480
69 #define VGA_SIZE (VGA_X*VGA_Y*3)
70 
71 #define CAM1MP_X 1296
72 #define CAM1MP_Y 730
73 #define CAM1MP_SIZE (CAM1MP_X*CAM1MP_Y*3)
74 #define CAMHD_X 1920
75 #define CAMHD_Y 1080
76 #define CAMHD_SIZE (CAMHD_X*CAMHD_Y*3)
77 #define CAM5MP_X 2592
78 #define CAM5MP_Y 1944
79 #define CAM5MP_SIZE (CAM5MP_X*CAM5MP_Y*3)
80 
81 //defining the image types
82 #define QQVGA 0
83 #define QVGA 1
84 #define VGA 2
85 #define CAM1MP 3
86 #define CAMHD 4
87 #define CAM5MP 5
88 
89 //the font name length
90 #define FONTNAMELEN 50
91 
92 typedef BYTE VGAcol[480][640][3];
93 typedef BYTE VGAgray[480][640] ;
94 typedef BYTE QVGAcol[240][320][3] ;
95 typedef BYTE QVGAgray[240][320];
96 typedef BYTE QQVGAcol[120][160][3];
97 typedef BYTE QQVGAgray[120][160];
98 typedef BYTE CAM1MPcol[730][1296][3];
99 typedef BYTE CAM1MPgray[730][1296];
100 typedef BYTE CAMHDcol[1080][1920][3];
101 typedef BYTE CAMHDgray[1080][1920];
102 typedef BYTE CAM5MPcol[1944][2592][3];
103 typedef BYTE CAM5MPgray[1944][2592];
104 
108 typedef struct
109 {
110  unsigned long flags;
111  unsigned long functions;
112  unsigned long decorations;
113  long inputMode;
114  unsigned long status;
115 } HINTS;
116 
120 typedef struct
121 {
122  int xres, yres;
123  int bpp;
124 } SCREEN;
125 
129 typedef struct
130 {
131  int x, y;
132  int xmax, ymax;
133 } CURSOR;
134 
138 typedef struct
139 {
140  SCREEN screen;
141  CURSOR cursor; /* x & y holds font width & height! */
142 } FBINFO;
143 
147 typedef struct
148 {
149  char name[40];
150  char mhz[20];
151  char arch[20];
152  char bogomips[20];
153 } INFO_CPU;
154 
158 typedef struct
159 {
160  char procnum[20];
161  char total[40];
162  char free[40];
163 } INFO_MEM;
164 
168 typedef struct
169 {
170  char num[20];
171 } INFO_PROC;
172 
176 typedef struct
177 {
178  char uptime[20];
179  char vbatt[20];
180  int vbatt_8;
181 } INFO_MISC;
182 
186 typedef struct
187 {
188  int x, y;
189 } COORD_PAIR;
190 
194 typedef struct
195 {
196  int active;
197  COORD_PAIR tl; //top left
198  COORD_PAIR br; //bottom right
199 } BOX;
200 
204 typedef struct
205 {
206  KEYMODE mode;
207  BOX rect[KEYTM_MAX_REGIONS];
208 } TOUCH_MAP;
209 
213 typedef struct
214 {
215  COORD_PAIR point, value;
216  int sync, status;
217 } TOUCH_EVENT;
218 
222 typedef struct
223 {
224  char label[LCD_MENU_STRLENGTH];
225  XColor fgcol, bgcol;
226  void *plink; /* link to user data/function! */
227 } MENU_ITEM;
228 
232 typedef struct
233 {
234  char title[LCD_LIST_STRLENGTH];
235  XColor fgcol, bgcol;
236  int size, start, width, left, scroll; /* configure these! */
237  int index/*, count*/; /* the library will set & manage these! */
238  MENU_ITEM *pitems; /* pointer to array of 'size' menuitems */
239  int no_empty;
240 } LIST_MENU;
241 
245 typedef struct
246 {
247  int lcdNum;
248  Display* d;
249  int s;
250  Window w;
251  Colormap colormap;
252  GC gc;
253  XFontStruct* fontstruct;
254  int fontType;
255  int fontVariation;
256  int fontSize;
257  int fontHeight;
258  int fontWidth;
259  int height;
260  int width;
261  int startCurPosX;
262  int startCurPosY;
263  XColor fgTextColor;
264  XColor bgTextColor;
265  char colorflag;
266  HWORD mode;
267  MENU_ITEM menuItems[4];
268  LIST_MENU* listMenu;
269  int fd;
270  bool X11Error;
271  Screen *scr;
272 } LCD_HANDLE;
273 
277 typedef struct
278 {
279  int x, y;
280  int height, width;
281 } RECT;
282 
286 typedef struct HDT_ENTRY
287 {
288  int length;
289  char *buffer;
290 }
291 HDT_ENTRY;
292 
296 typedef struct HDT_TABLE
297 {
298  struct HDT_TABLE *pnext;
299  char name[HDT_MAX_NAMECHAR];
300  int size;
301  int *data;
302 }
303 HDT_TABLE;
304 
308 typedef struct HDT_DEVICE
309 {
310  struct HDT_DEVICE *pnext;
311  char name[HDT_MAX_NAMECHAR];
312  char tabname[HDT_MAX_NAMECHAR];
313  HDT_TABLE *ptable; /* pointer to a table */
314 }
315 HDT_DEVICE;
316 
320 typedef struct HDT_CAM
321 {
322  struct HDT_CAM *pnext;
323  char name[HDT_MAX_NAMECHAR];
324  int regaddr, ucb1400io, width, height;
325 }
326 HDT_CAM;
327 
331 typedef struct HDT_MOTOR
332 {
333  struct HDT_MOTOR *pnext;
334  char name[HDT_MAX_NAMECHAR];
335  char tabname[HDT_MAX_NAMECHAR];
336  HDT_TABLE *ptable; /* pointer to a table */
337  int regaddr;
338 }
339 HDT_MOTOR;
340 
344 typedef struct HDT_ENCODER
345 {
346  struct HDT_ENCODER *pnext;
347  char name[HDT_MAX_NAMECHAR];
348  char motorname[HDT_MAX_NAMECHAR];
349  HDT_MOTOR *pmotor;
350  int regaddr, clickspm;
351  int maxspeed;
352 }
354 
358 typedef struct HDT_SERVO
359 {
360  struct HDT_SERVO *pnext;
361  char name[HDT_MAX_NAMECHAR];
362  char tabname[HDT_MAX_NAMECHAR];
363  HDT_TABLE *ptable; /* pointer to a table */
364  int regaddr, freq;
365  int mintime, maxtime;
366  int low, high;
367 }
368 HDT_SERVO;
369 
373 typedef struct HDT_PSD
374 {
375  struct HDT_PSD *pnext;
376  char name[HDT_MAX_NAMECHAR];
377  char tabname[HDT_MAX_NAMECHAR];
378  HDT_TABLE *ptable; /* pointer to a table */
379  int regaddr;
380 }
381 HDT_PSD;
382 
386 typedef struct HDT_DRIVE
387 {
388  struct HDT_DRIVE *pnext;
389  char name[HDT_MAX_NAMECHAR];
390  char encname1[HDT_MAX_NAMECHAR],encname2[HDT_MAX_NAMECHAR];
391  char encname3[HDT_MAX_NAMECHAR],encname4[HDT_MAX_NAMECHAR];
392  HDT_ENCODER *penc1, *penc2, *penc3, *penc4;
393  int drivetype;
394  int wheeldist1, axesdist, wheeldist2;
395 }
396 HDT_DRIVE;
397 
401 typedef struct HDT_IRTV
402 {
403  struct HDT_IRTV *pnext;
404  char name[HDT_MAX_NAMECHAR];
405  int type, length, togmask, invmask, mode, buffsize, delay;
406 }
407 HDT_IRTV;
408 
412 typedef struct HDT_ADC
413 {
414  struct HDT_ADC *pnext;
415  char name[HDT_MAX_NAMECHAR];
416  char procname[HDT_MAX_NAMECHAR];
417  int denom;
418 }
419 HDT_ADC;
420 
424 typedef struct HDT_COM
425 {
426  struct HDT_COM *pnext;
427  char name[HDT_MAX_NAMECHAR];
428  char devname[HDT_MAX_NAMECHAR];
429 }
430 HDT_COM;
431 
435 typedef struct
436 {
437  XColor fontColour;
438  char fontName[FONTNAMELEN];
439 } EYEFONT;
440 #endif /* TYPES_H_ */
Structure defining a HDT drive.
Definition: types.h:386
struct HDT_TABLE HDT_TABLE
Structure defining a HDT Table.
struct HDT_ENTRY HDT_ENTRY
Structure defining a HDT entry.
Structure defining battery info.
Definition: types.h:176
Structure defining a HDT Device.
Definition: types.h:308
struct HDT_ENCODER HDT_ENCODER
Structure defining a HDT encoder.
struct HDT_ADC HDT_ADC
Structure defining a HDT ADC.
Structure defining the Framebuffer info for the LCD.
Definition: types.h:138
Structure defining a HDT Motor.
Definition: types.h:331
Structure defining a menu item.
Definition: types.h:222
Structure defining boxes for touchscreen use.
Definition: types.h:204
Structure defining a menu.
Definition: types.h:232
struct HDT_DEVICE HDT_DEVICE
Structure defining a HDT Device.
struct HDT_IRTV HDT_IRTV
Structure defining a HDT IRTV.
Structure defining the CPU info.
Definition: types.h:147
Structure defining a LCD fontcolour/name.
Definition: types.h:435
Structure defining a rectangular box on the LCD.
Definition: types.h:194
struct HDT_MOTOR HDT_MOTOR
Structure defining a HDT Motor.
struct HDT_SERVO HDT_SERVO
Structure defining a HDT servo.
Structure defining a HDT psd.
Definition: types.h:373
Structure defining a HDT ADC.
Definition: types.h:412
struct HDT_COM HDT_COM
Structure defining a HDT COM.
Structure representing the coordinates of a point.
Definition: types.h:186
Structure defining a HDT encoder.
Definition: types.h:344
Structure defining touchscreen presses.
Definition: types.h:213
Structure defining a HDT Table.
Definition: types.h:296
Structure defining a HDT servo.
Definition: types.h:358
Structure defining the cursor for the LCD.
Definition: types.h:129
Structure defining a Hints for the LCD.
Definition: types.h:108
Structure defining the processor info.
Definition: types.h:168
struct HDT_CAM HDT_CAM
Structure defining a HDT Camera.
Structure defining a HDT entry.
Definition: types.h:286
Structure defining a Screen for the LCD.
Definition: types.h:120
Structure defining a HDT COM.
Definition: types.h:424
Structure representing a rectangle.
Definition: types.h:277
Structure defining the memory info.
Definition: types.h:158
Structure defining a HDT Camera.
Definition: types.h:320
struct HDT_PSD HDT_PSD
Structure defining a HDT psd.
struct HDT_DRIVE HDT_DRIVE
Structure defining a HDT drive.
Structure defining an LCD.
Definition: types.h:245
Structure defining a HDT IRTV.
Definition: types.h:401