root / branches / wireless / code / behaviors / Wireless_Speed_test / wl_defs.h @ 1560
History | View | Annotate | Download (2.55 KB)
1 | 1560 | dsschult | /**
|
---|---|---|---|
2 | * Copyright (c) 2007 Colony Project
|
||
3 | *
|
||
4 | * Permission is hereby granted, free of charge, to any person
|
||
5 | * obtaining a copy of this software and associated documentation
|
||
6 | * files (the "Software"), to deal in the Software without
|
||
7 | * restriction, including without limitation the rights to use,
|
||
8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||
9 | * copies of the Software, and to permit persons to whom the
|
||
10 | * Software is furnished to do so, subject to the following
|
||
11 | * conditions:
|
||
12 | *
|
||
13 | * The above copyright notice and this permission notice shall be
|
||
14 | * included in all copies or substantial portions of the Software.
|
||
15 | *
|
||
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||
17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||
18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||
19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||
20 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||
21 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||
22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||
23 | * OTHER DEALINGS IN THE SOFTWARE.
|
||
24 | **/
|
||
25 | |||
26 | /**
|
||
27 | * @file wl_defs.h
|
||
28 | * @brief Definitions for Wireless
|
||
29 | *
|
||
30 | * Contains definitions for wireless packet groups, packet types,
|
||
31 | * debugging information, etc.
|
||
32 | *
|
||
33 | * @author Brian Coltin, Colony Project, CMU Robotics Club
|
||
34 | **/
|
||
35 | |||
36 | #ifndef WL_DEFS_H
|
||
37 | #define WL_DEFS_H
|
||
38 | |||
39 | //comment out this line if using a computer hooked up to an xbee
|
||
40 | #define ROBOT
|
||
41 | |||
42 | //uncomment this line for debug information
|
||
43 | #define WL_DEBUG
|
||
44 | |||
45 | //return value definitions
|
||
46 | /** @brief Error code for init failure **/
|
||
47 | #define WL_ERROR_INIT_FAILED 1 |
||
48 | /** @brief Error code for duplicate init calls **/
|
||
49 | #define WL_ERROR_INIT_ALREADY_INITD 2 |
||
50 | /** @brief Error code for not calling init **/
|
||
51 | #define WL_ERROR_LIBRARY_NOT_INITD 3 |
||
52 | |||
53 | // Packet Groups and Types
|
||
54 | |||
55 | // Error group
|
||
56 | #define WL_ERROR_GROUP 1 |
||
57 | |||
58 | #define WL_ERROR_STRING_TYPE 1 |
||
59 | |||
60 | // Token Ring group
|
||
61 | #define WL_TOKEN_RING_GROUP 2 |
||
62 | |||
63 | #define WL_TOKEN_PASS 1 |
||
64 | #define WL_TOKEN_SENSOR_MATRIX 2 |
||
65 | #define WL_TOKEN_BOM_ON 3 |
||
66 | #define WL_TOKEN_JOIN 4 |
||
67 | #define WL_TOKEN_JOIN_ACCEPT 5 |
||
68 | |||
69 | // timing constants
|
||
70 | #ifndef FIREFLY
|
||
71 | #define BOM_DELAY 100 |
||
72 | #else
|
||
73 | #define BOM_DELAY 200 |
||
74 | #endif
|
||
75 | |||
76 | #define DEATH_DELAY 4 |
||
77 | #define JOIN_DELAY 8 |
||
78 | |||
79 | #ifdef WL_DEBUG
|
||
80 | |||
81 | #ifdef ROBOT
|
||
82 | #include <serial.h> |
||
83 | #endif
|
||
84 | |||
85 | #ifdef ROBOT
|
||
86 | #define WL_DEBUG_PRINT( s ) usb_puts( s )
|
||
87 | #else
|
||
88 | #define WL_DEBUG_PRINT( s ) printf( s )
|
||
89 | #endif
|
||
90 | |||
91 | #ifdef ROBOT
|
||
92 | #define WL_DEBUG_PRINT_INT( i ) usb_puti(i)
|
||
93 | #else
|
||
94 | #define WL_DEBUG_PRINT_INT( i ) printf("%i", i) |
||
95 | #endif
|
||
96 | |||
97 | #else
|
||
98 | |||
99 | #define WL_DEBUG_PRINT( s )
|
||
100 | #define WL_DEBUG_PRINT_INT( i )
|
||
101 | |||
102 | #endif
|
||
103 | |||
104 | #endif
|