root / branches / wireless / code / projects / libwireless / wl_defs.h @ 1791
History | View | Annotate | Download (4.21 KB)
1 | 1576 | dsschult | /**
|
---|---|---|---|
2 | * Copyright (c) 2009 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, debugging information, etc.
|
||
31 | *
|
||
32 | * @author Colony Project, CMU Robotics Club
|
||
33 | **/
|
||
34 | |||
35 | #ifndef WL_DEFS_H
|
||
36 | #define WL_DEFS_H
|
||
37 | |||
38 | 1581 | dsschult | // create main wireless page documentation
|
39 | |||
40 | /** @mainpage The Wireless Library
|
||
41 | *
|
||
42 | * This is the documentation for the Colony wireless library.\n\n
|
||
43 | * Xbee documentation can be found under @ref xbee \n
|
||
44 | * Higher level wireless documentation can be found under @ref wireless \n
|
||
45 | **/
|
||
46 | |||
47 | |||
48 | 1576 | dsschult | // need this for C99 int types
|
49 | #ifndef STDINT_H
|
||
50 | #define STDINT_H
|
||
51 | #include <stdint.h> |
||
52 | #endif
|
||
53 | |||
54 | // ***** TODO: these next two defines should be moved to makefile options
|
||
55 | |||
56 | //comment out this line if using a computer hooked up to an xbee
|
||
57 | 1624 | dsschult | #define ROBOT
|
58 | 1576 | dsschult | |
59 | //uncomment this line for debug information
|
||
60 | 1624 | dsschult | #define WL_DEBUG
|
61 | 1576 | dsschult | |
62 | 1581 | dsschult | /**@addtogroup wireless
|
63 | * @{ **/
|
||
64 | |||
65 | /**@defgroup wl_error Error Codes
|
||
66 | * @{ **/
|
||
67 | |||
68 | /** @brief Success **/
|
||
69 | #define WL_SUCCESS INT8_C(0) |
||
70 | 1577 | dsschult | |
71 | 1576 | dsschult | /** @brief Error code for init failure **/
|
72 | 1577 | dsschult | #define WL_ERROR_INIT_FAILED INT8_C(-1) |
73 | 1581 | dsschult | |
74 | 1576 | dsschult | /** @brief Error code for duplicate init calls **/
|
75 | 1577 | dsschult | #define WL_ERROR_INIT_ALREADY_INITD INT8_C(-2) |
76 | 1581 | dsschult | |
77 | 1576 | dsschult | /** @brief Error code for not calling init **/
|
78 | 1577 | dsschult | #define WL_ERROR_LIBRARY_NOT_INITD INT8_C(-3) |
79 | 1576 | dsschult | |
80 | 1581 | dsschult | /** @brief Error code for failed termination **/
|
81 | #define WL_ERROR_TERMINATION_FAILED INT8_C(-4) |
||
82 | 1576 | dsschult | |
83 | 1581 | dsschult | /** @brief Error code for failed packet group registration **/
|
84 | #define WL_ERROR_FAILED_REGISTRATION INT8_C(-5) |
||
85 | |||
86 | 1598 | cmar | /** @brief Error code for failed packet group registration **/
|
87 | #define WL_ERROR_FAILED_UNREGISTRATION INT8_C(-6) |
||
88 | |||
89 | 1581 | dsschult | /** @brief Error in arguments **/
|
90 | 1598 | cmar | #define WL_ERROR_ARGUMENT INT8_C(-7) |
91 | 1581 | dsschult | |
92 | /** @brief Error code for send failure **/
|
||
93 | #define WL_ERROR_SEND INT8_C(-10) |
||
94 | |||
95 | /** @brief Error code for a bad group number **/
|
||
96 | #define WL_ERROR_BAD_GROUP INT8_C(-11) |
||
97 | |||
98 | /** @brief Error code for a bad scope **/
|
||
99 | 1587 | dsschult | #define WL_ERROR_SCOPE INT8_C(-12) |
100 | 1581 | dsschult | |
101 | /** @brief Error code for a bad robot address **/
|
||
102 | 1587 | dsschult | #define WL_ERROR_ADDRESS INT8_C(-13) |
103 | 1581 | dsschult | |
104 | /** @brief Error code for a bad mode **/
|
||
105 | 1587 | dsschult | #define WL_ERROR_MODE INT8_C(-14) |
106 | 1581 | dsschult | |
107 | 1589 | alevkoy | /** @brief Error code for received paacket destination too small for received packet **/
|
108 | #define WL_ERROR_TOO_SMALL INT8_C(-15) |
||
109 | 1581 | dsschult | |
110 | 1600 | dsschult | /** @brief Error code for sending buffer full (the packet was sent, but no retries will be made). **/
|
111 | #define WL_ERROR_SENDING_BUFFER_FULL INT8_C(-16) |
||
112 | 1589 | alevkoy | |
113 | 1600 | dsschult | /** @brief Error code for failed xbee command **/
|
114 | #define WL_ERROR_XBEE_COMMAND INT8_C(-17) |
||
115 | |||
116 | /** @brief Error code for failed 16bit xbee command **/
|
||
117 | #define WL_ERROR_XBEE_COMMAND_16BIT 0xFEFE |
||
118 | |||
119 | 1601 | dsschult | /** @brief Error code for bad baud rate **/
|
120 | #define WL_ERROR_BAUD INT8_C(-18) |
||
121 | |||
122 | 1581 | dsschult | /**@} */ // end error group |
123 | |||
124 | 1604 | dsschult | // TODO: is this a good size?
|
125 | /*Buffer sizes*/
|
||
126 | 1689 | dsschult | #define PACKET_BUFFER_SIZE 250 |
127 | 1604 | dsschult | |
128 | 1581 | dsschult | /**@} */ // end wireless group |
129 | |||
130 | 1576 | dsschult | #ifdef WL_DEBUG
|
131 | |||
132 | #include <serial.h> |
||
133 | #define WL_DEBUG_PRINT( s ) usb_puts( s )
|
||
134 | 1657 | dsschult | #define WL_DEBUG_PRINT_P( s ) usb_puts_P( PSTR ( s ) )
|
135 | 1576 | dsschult | #define WL_DEBUG_PRINT_CHAR( c ) usb_putc( c )
|
136 | #define WL_DEBUG_PRINT_INT( i ) usb_puti(i)
|
||
137 | 1624 | dsschult | #define WL_DEBUG_PRINT_HEX( i ) usb_puth8(i)
|
138 | 1576 | dsschult | |
139 | #else
|
||
140 | |||
141 | #define WL_DEBUG_PRINT( s )
|
||
142 | 1657 | dsschult | #define WL_DEBUG_PRINT_P( s )
|
143 | 1576 | dsschult | #define WL_DEBUG_PRINT_CHAR( c )
|
144 | #define WL_DEBUG_PRINT_INT( i )
|
||
145 | 1624 | dsschult | #define WL_DEBUG_PRINT_HEX( i )
|
146 | 1576 | dsschult | |
147 | #endif
|
||
148 | 1658 | dsschult | |
149 | #endif |