Revision 1581
editing wireless branch, added error codes and constants
xbee.c | ||
---|---|---|
58 | 58 |
#include <stdlib.h> |
59 | 59 |
#include <string.h> |
60 | 60 |
|
61 |
/** |
|
62 |
* The port to use the XBee from on the computer. |
|
63 |
* Also, a backup port if the other is used. |
|
64 |
**/ |
|
61 |
|
|
62 |
/**@addtogroup xbee |
|
63 |
* @{ **/ |
|
64 |
|
|
65 |
/**@defgroup xbee_const xbee constants |
|
66 |
* @{ **/ |
|
67 |
|
|
68 |
// TODO: move constants to xbee.h so they can be used publicly |
|
69 |
|
|
70 |
/**@brief The port to use the XBee from on the computer. **/ |
|
65 | 71 |
#ifndef ROBOT |
66 | 72 |
#define XBEE_PORT_DEFAULT "/dev/ttyUSB1" |
67 | 73 |
#endif |
68 |
|
|
69 |
/* start definitions of xbee constants */ |
|
70 |
|
|
74 |
|
|
75 |
/**@name xbee options |
|
76 |
* @{ **/ |
|
77 |
|
|
71 | 78 |
/**@brief Unset PAN, uses XBee default **/ |
72 | 79 |
#define XBEE_PAN_DEFAULT 0xFFFF |
73 | 80 |
/**@brief Unset channel, uses XBee default **/ |
... | ... | |
85 | 92 |
/**@brief A packet received from another XBee **/ |
86 | 93 |
#define XBEE_RX 0x81 |
87 | 94 |
|
95 |
/**@} |
|
96 |
* @name xbee frame types |
|
97 |
* @{ **/ |
|
98 |
|
|
88 | 99 |
// TODO: add comments for all of these definitions |
89 | 100 |
#define XBEE_FRAME_START 0x7E |
90 | 101 |
#define XBEE_GET_PACKET_TIMEOUT 1000 |
... | ... | |
99 | 110 |
#define XBEE_FRAME_RX_64 0x80 |
100 | 111 |
#define XBEE_FRAME_RX_16 XBEE_RX |
101 | 112 |
|
113 |
/** @} **/ |
|
114 |
|
|
115 |
|
|
116 |
// TODO: is this a good size? |
|
117 |
/*Buffer sizes*/ |
|
118 |
#define XBEE_BUFFER_SIZE 128 |
|
119 |
#define PACKET_BUFFER_SIZE 108 |
|
120 |
|
|
121 |
/**@} **/ // end const group |
|
122 |
|
|
102 | 123 |
/*Internal Function Prototypes*/ |
103 | 124 |
|
104 | 125 |
// TODO: convert all int references to int16_t syntax (see stdint.h) |
... | ... | |
142 | 163 |
|
143 | 164 |
// TODO: clarify buffers, what they're used for, etc |
144 | 165 |
|
145 |
// TODO: is this a good size? |
|
146 |
#define XBEE_BUFFER_SIZE 128 |
|
147 |
#define PACKET_BUFFER_SIZE 108 |
|
148 | 166 |
// a buffer for data received from the XBee |
149 | 167 |
char arrival_buf[XBEE_BUFFER_SIZE]; |
150 | 168 |
// location of last unread byte in buffer |
... | ... | |
1184 | 1202 |
xbee_com_port = port; |
1185 | 1203 |
} |
1186 | 1204 |
#endif |
1205 |
|
|
1206 |
/**@} **/ // end xbee group |
|
1207 |
|
Also available in: Unified diff