root / branches / wireless / code / lib / include / libwireless / wl_defs.h @ 1935
History | View | Annotate | Download (4.15 KB)
1 | 242 | bcoltin | /**
|
---|---|---|---|
2 | 1617 | dsschult | * Copyright (c) 2009 Colony Project
|
3 | 242 | bcoltin | *
|
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 | 1617 | dsschult | * Contains definitions for wireless, debugging information, etc.
|
31 | 242 | bcoltin | *
|
32 | 1617 | dsschult | * @author Colony Project, CMU Robotics Club
|
33 | 242 | bcoltin | **/
|
34 | |||
35 | 191 | bcoltin | #ifndef WL_DEFS_H
|
36 | #define WL_DEFS_H
|
||
37 | |||
38 | 1617 | 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 | // 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 | 1683 | bwasserm | #define ROBOT
|
57 | 18 | bcoltin | |
58 | //uncomment this line for debug information
|
||
59 | 1935 | bwasserm | //#define WL_DEBUG
|
60 | 18 | bcoltin | |
61 | 1617 | dsschult | /**@addtogroup wireless
|
62 | * @{ **/
|
||
63 | |||
64 | /**@defgroup wl_error Error Codes
|
||
65 | * @{ **/
|
||
66 | |||
67 | /** @brief Success **/
|
||
68 | #define WL_SUCCESS INT8_C(0) |
||
69 | |||
70 | 1560 | dsschult | /** @brief Error code for init failure **/
|
71 | 1617 | dsschult | #define WL_ERROR_INIT_FAILED INT8_C(-1) |
72 | |||
73 | 1560 | dsschult | /** @brief Error code for duplicate init calls **/
|
74 | 1617 | dsschult | #define WL_ERROR_INIT_ALREADY_INITD INT8_C(-2) |
75 | |||
76 | 1560 | dsschult | /** @brief Error code for not calling init **/
|
77 | 1617 | dsschult | #define WL_ERROR_LIBRARY_NOT_INITD INT8_C(-3) |
78 | 1560 | dsschult | |
79 | 1617 | dsschult | /** @brief Error code for failed termination **/
|
80 | #define WL_ERROR_TERMINATION_FAILED INT8_C(-4) |
||
81 | 18 | bcoltin | |
82 | 1617 | dsschult | /** @brief Error code for failed packet group registration **/
|
83 | #define WL_ERROR_FAILED_REGISTRATION INT8_C(-5) |
||
84 | 18 | bcoltin | |
85 | 1617 | dsschult | /** @brief Error code for failed packet group registration **/
|
86 | #define WL_ERROR_FAILED_UNREGISTRATION INT8_C(-6) |
||
87 | 18 | bcoltin | |
88 | 1617 | dsschult | /** @brief Error in arguments **/
|
89 | #define WL_ERROR_ARGUMENT INT8_C(-7) |
||
90 | 18 | bcoltin | |
91 | 1617 | dsschult | /** @brief Error code for send failure **/
|
92 | #define WL_ERROR_SEND INT8_C(-10) |
||
93 | 18 | bcoltin | |
94 | 1617 | dsschult | /** @brief Error code for a bad group number **/
|
95 | #define WL_ERROR_BAD_GROUP INT8_C(-11) |
||
96 | 166 | bcoltin | |
97 | 1617 | dsschult | /** @brief Error code for a bad scope **/
|
98 | #define WL_ERROR_SCOPE INT8_C(-12) |
||
99 | 18 | bcoltin | |
100 | 1617 | dsschult | /** @brief Error code for a bad robot address **/
|
101 | #define WL_ERROR_ADDRESS INT8_C(-13) |
||
102 | |||
103 | /** @brief Error code for a bad mode **/
|
||
104 | #define WL_ERROR_MODE INT8_C(-14) |
||
105 | |||
106 | /** @brief Error code for received paacket destination too small for received packet **/
|
||
107 | #define WL_ERROR_TOO_SMALL INT8_C(-15) |
||
108 | |||
109 | /** @brief Error code for sending buffer full (the packet was sent, but no retries will be made). **/
|
||
110 | #define WL_ERROR_SENDING_BUFFER_FULL INT8_C(-16) |
||
111 | |||
112 | /** @brief Error code for failed xbee command **/
|
||
113 | #define WL_ERROR_XBEE_COMMAND INT8_C(-17) |
||
114 | |||
115 | /** @brief Error code for failed 16bit xbee command **/
|
||
116 | #define WL_ERROR_XBEE_COMMAND_16BIT 0xFEFE |
||
117 | |||
118 | /** @brief Error code for bad baud rate **/
|
||
119 | #define WL_ERROR_BAUD INT8_C(-18) |
||
120 | |||
121 | /**@} */ // end error group |
||
122 | |||
123 | // TODO: is this a good size?
|
||
124 | /*Buffer sizes*/
|
||
125 | 1935 | bwasserm | #define PACKET_BUFFER_SIZE 250 |
126 | 1617 | dsschult | |
127 | /**@} */ // end wireless group |
||
128 | |||
129 | 18 | bcoltin | #ifdef WL_DEBUG
|
130 | |||
131 | #include <serial.h> |
||
132 | #define WL_DEBUG_PRINT( s ) usb_puts( s )
|
||
133 | 1683 | bwasserm | #define WL_DEBUG_PRINT_P( s ) usb_puts_P( PSTR ( s ) )
|
134 | 1617 | dsschult | #define WL_DEBUG_PRINT_CHAR( c ) usb_putc( c )
|
135 | #define WL_DEBUG_PRINT_INT( i ) usb_puti(i)
|
||
136 | 1683 | bwasserm | #define WL_DEBUG_PRINT_HEX( i ) usb_puth8(i)
|
137 | 18 | bcoltin | |
138 | #else
|
||
139 | |||
140 | #define WL_DEBUG_PRINT( s )
|
||
141 | 1683 | bwasserm | #define WL_DEBUG_PRINT_P( s )
|
142 | 1617 | dsschult | #define WL_DEBUG_PRINT_CHAR( c )
|
143 | 18 | bcoltin | #define WL_DEBUG_PRINT_INT( i )
|
144 | 1683 | bwasserm | #define WL_DEBUG_PRINT_HEX( i )
|
145 | 18 | bcoltin | |
146 | #endif
|
||
147 | |||
148 | 1935 | bwasserm | #endif |