root / trunk / code / projects / colonet / lib / colonet_defs.h @ 150
History | View | Annotate | Download (3.7 KB)
1 | 11 | emarinel | /* Eugene Marinelli, Fan
|
---|---|---|---|
2 | * 10/27/06
|
||
3 | *
|
||
4 | * Colonet Definitions - common definitions and structs used in all colonet
|
||
5 | * applications
|
||
6 | */
|
||
7 | |||
8 | #ifndef COLONET_DEFS_H_
|
||
9 | #define COLONET_DEFS_H_
|
||
10 | |||
11 | 125 | emarinel | // PacketGroup id for wireless library.
|
12 | #define COLONET_PACKET_GROUP_ID 8 |
||
13 | 149 | emarinel | #define COLONET_RESPONSE_PACKET_FRAME_ID COLONET_PACKET_GROUP_ID
|
14 | 11 | emarinel | |
15 | 125 | emarinel | // Message types
|
16 | 150 | gtress | typedef enum {COLONET_COMMAND = 13, COLONET_REQUEST = 14, |
17 | COLONET_RESPONSE = 15} ColonetMessageType;
|
||
18 | 125 | emarinel | |
19 | 11 | emarinel | //Packet properties
|
20 | #define PACKET_DATA_LEN 7 |
||
21 | |||
22 | #define WL_DEFAULT_PAN 3332 |
||
23 | |||
24 | #define SERIAL_PORT "/dev/ttyS0" |
||
25 | #define USB_PORT "/dev/ttyUSB0" |
||
26 | |||
27 | // Message dests
|
||
28 | #define GLOBAL_DEST 200 |
||
29 | 149 | emarinel | //#define MAX_NUM_ROBOTS 7
|
30 | 11 | emarinel | #define COLONET_SERVER_RESPONSE_ADDR 201 |
31 | |||
32 | #define USER_DEFINED_MSG_ID_START 0xF0 |
||
33 | #define USER_DEFINED_MSG_ID_END 0xFF |
||
34 | #define USER_DEFINED_MSG_TOTAL 0x0F |
||
35 | |||
36 | 125 | emarinel | /* This is the packet structure of the data buffer sent from the colonet
|
37 | 149 | emarinel | * wireless library to the robots and from the robots to the colonet wireless
|
38 | * library. */
|
||
39 | 125 | emarinel | typedef struct { |
40 | int client_id; // ID number of the client sending the packet. |
||
41 | unsigned char msg_code; // Specific instruction for the robot -- see below. |
||
42 | unsigned char data[PACKET_DATA_LEN]; |
||
43 | } ColonetRobotServerPacket; |
||
44 | 68 | jknichel | |
45 | 125 | emarinel | /* Message codes */
|
46 | 11 | emarinel | //BUZZER
|
47 | #define BUZZER_INIT 0x00 |
||
48 | #define BUZZER_SET_VAL 0x01 |
||
49 | #define BUZZER_SET_FREQ 0x02 |
||
50 | #define BUZZER_CHIRP 0x03 |
||
51 | #define BUZZER_OFF 0x04 |
||
52 | |||
53 | //LCD
|
||
54 | #define LCD_INIT 0x05 |
||
55 | #define LCD_CLEAR_SCREEN 0x06 |
||
56 | #define LCD_PUTBYTE 0x07 |
||
57 | #define LCD_PUTCHAR 0x08 |
||
58 | #define LCD_PUTSTR 0x09 |
||
59 | #define LCD_GOTOXY 0x0A |
||
60 | #define LCD_PUTINT 0x0B |
||
61 | |||
62 | //ORB
|
||
63 | #define ORB_INIT 0x0C |
||
64 | #define ORB_SET 0x0D |
||
65 | #define ORB_SET_COLOR 0x0E |
||
66 | #define ORB_DISABLE 0x0F |
||
67 | #define ORB_ENABLE 0x10 |
||
68 | #define ORB_SET_DIO 0x11 |
||
69 | #define LED_INIT 0x12 |
||
70 | #define LED_USER 0x13 |
||
71 | #define ORB_SET_NUM_NS 0x14 |
||
72 | #define ORB_SET_NUM 0x15 |
||
73 | #define ORB_SEND 0x16 |
||
74 | |||
75 | //MOTORS
|
||
76 | #define MOTORS_INIT 0x17 |
||
77 | #define MOTOR1_SET 0x18 |
||
78 | #define MOTOR2_SET 0x19 |
||
79 | #define MOTORS_OFF 0x1A |
||
80 | #define MOVE 0x1B |
||
81 | #define MOVE_AVOID 0x1C |
||
82 | |||
83 | //SHARP
|
||
84 | #define READ_DISTANCE 0x24 |
||
85 | #define LINEARIZE_DISTANCE 0x25 |
||
86 | #define LOG_DISTANCE 0x26 |
||
87 | #define ENABLE_IR 0x27 |
||
88 | #define DISABLE_IR 0x28 |
||
89 | |||
90 | //SERIAL
|
||
91 | #define XBEE_INIT 0x29 |
||
92 | #define XBEE_PUTC 0x2A |
||
93 | #define XBEE_GETC 0x2B |
||
94 | |||
95 | #define USB_INIT 0x2D |
||
96 | #define USB_PUTC 0x2E |
||
97 | #define USB_GETC 0x2F |
||
98 | |||
99 | |||
100 | |||
101 | //DELAY_MS
|
||
102 | #define DELAY_MS 0x31 |
||
103 | |||
104 | //ANALOG
|
||
105 | #define ANALOG_INIT 0x32 |
||
106 | #define SET_ADC_MUX 0x33 |
||
107 | #define ENABLE_ANALOG 0x34 |
||
108 | #define CALL_ANALOG8 0x35 |
||
109 | #define CALL_ANALOG10 0x36 |
||
110 | #define WHEEL 0x37 |
||
111 | #define BATTERY 0x38 |
||
112 | |||
113 | //BOM
|
||
114 | #define GETMAXBOM 0x39 |
||
115 | #define BOM_ON 0x3A |
||
116 | #define BOM_OFF 0x3B |
||
117 | #define OUTPUT_HIGH 0x3C |
||
118 | #define OUTPUT_LOW 0x3D |
||
119 | |||
120 | //DIO
|
||
121 | #define DIGITAL_INPUT 0x3E |
||
122 | #define DIGITAL_OUTPUT 0x3F |
||
123 | #define BUTTON1_READ 0x41 |
||
124 | #define BUTTON1_WAIT 0x42 |
||
125 | #define BUTTON1_WAIT_LED 0x43 |
||
126 | #define BUTTON2_READ 0x44 |
||
127 | #define BUTTON2_WAIT 0x45 |
||
128 | #define BUTTON2_WAIT_LED 0x46 |
||
129 | |||
130 | //WL
|
||
131 | #define WL_INIT 0x47 |
||
132 | #define PARSE_BUFFER 0x48 |
||
133 | #define WL_SEND 0x49 |
||
134 | |||
135 | //BUMPER
|
||
136 | #define DETECT_BUMP 0x50 |
||
137 | |||
138 | //Other
|
||
139 | #define PRINTF 0x51 |
||
140 | #define KILL_ROBOT 0x52 |
||
141 | |||
142 | 123 | jknichel | /* End low-level robot commands */
|
143 | |||
144 | |||
145 | ///////////////////////////
|
||
146 | 68 | jknichel | //Colonet specific commands
|
147 | 123 | jknichel | //////////////////////////
|
148 | |||
149 | 75 | jknichel | #define REQUEST_BOM_MATRIX 0x90 |
150 | //request: REQUEST_FROM_SERVER REQUEST_BOM_MATRIX
|
||
151 | //response: RESPONSE_TO_CLIENT_REQUEST REQUEST_BOM_MATRIX <numRobots> <row by row, values separated by spaces>
|
||
152 | // if you don't know a value in the matrix, put -1 in there
|
||
153 | 11 | emarinel | |
154 | 123 | jknichel | #define REQUEST_XBEE_IDS 0x91 |
155 | //request: REQUEST_FROM_SERVER REQUEST_XBEE_IDS
|
||
156 | //response: RESPONSE_TO_CLIENT_REQUEST REQUEST_XBEE_IDS <numRobots> <id0> <id1> ... <idNumRobots>
|
||
157 | 11 | emarinel | |
158 | |||
159 | |||
160 | //Colonet Client commands
|
||
161 | 75 | jknichel | //TODO: renamed these to end in LENGTH
|
162 | 11 | emarinel | #define MAX_COMMAND_LEN 128 |
163 | 75 | jknichel | #define MAX_RESPONSE_LEN 1024 |
164 | 11 | emarinel | |
165 | #define SEND_TO_ROBOT 0x00 |
||
166 | 68 | jknichel | #define REQUEST_FROM_SERVER 0x01 |
167 | 11 | emarinel | #define RESPONSE_TO_CLIENT_REQUEST 0x02 |
168 | |||
169 | 68 | jknichel | |
170 | 11 | emarinel | #endif |