Project

General

Profile

Revision 717

Added by Jason knichel about 16 years ago

added a bunch of TODO comments that will improve the style, efficiency, and possibly memory usage of the wireless library

View differences:

wireless.c
60 60
/*Data Members*/
61 61

  
62 62
//used to store incoming and outgoing packets
63
//TODO: does this need to be 128?  can it be smaller to save memory?
64
//TODO: this shouldn't be hardcoded as 128.  it should be a define.
63 65
static unsigned char wl_buf[128];
64 66
//1 if we have timed out since we last checked, 0 otherwise.
65 67
static int wl_timeout = 0;
......
102 104
int wl_init()
103 105
{
104 106
	int i;
107
  //TODO: using memset here instead of this loop, *might* be less instructions and *might* reduce code size but not sure
105 108
	for (i = 0; i < WL_MAX_PACKET_GROUPS; i++)
106 109
		wl_packet_groups[i] = NULL;
107 110

  
......
170 173
 *
171 174
 * @see wl_get_pan
172 175
 **/
176
//TODO: this function is so simple, it *may* be beneficial to inline this function.  testing of if
177
// it reduces code size or not should be done to be sure.
173 178
int wl_set_pan(int pan)
174 179
{
175 180
	return xbee_set_pan_id(pan);
......
182 187
 *
183 188
 * @see wl_set_pan
184 189
 **/
190
//TODO: this function is so simple, it *may* be beneficial to inline this function.  testing of if
191
// it reduces code size or not should be done to be sure.
185 192
int wl_get_pan(void)
186 193
{
187 194
	return xbee_get_pan_id();
......
194 201
 *
195 202
 * @see wl_get_channel
196 203
 **/
204
//TODO: this function is so simple, it *may* be beneficial to inline this function.  testing of if
205
// it reduces code size or not should be done to be sure.
197 206
int wl_set_channel(int channel)
198 207
{
199 208
	return xbee_set_channel(channel);
......
206 215
 *
207 216
 * @see wl_set_channel
208 217
 **/
218
//TODO: this function is so simple, it *may* be beneficial to inline this function.  testing of if
219
// it reduces code size or not should be done to be sure.
209 220
int wl_get_channel(void)
210 221
{
211 222
	return xbee_get_channel();
......
216 227
 *
217 228
 * @return the 16-bit address of the XBee module.
218 229
 **/
230
//TODO: this function is so simple, it *may* be beneficial to inline this function.  testing of if
231
// it reduces code size or not should be done to be sure.
219 232
int wl_get_xbee_id()
220 233
{
221 234
	return xbee_get_address();
......
231 244
 * @param dest the 16-bit address of the XBee to send the packet to
232 245
 * @param frame the frame number to see with a TX_STATUS response
233 246
 **/
247
//TODO: this function is so simple, it *may* be beneficial to inline this function.  testing of if
248
// it reduces code size or not should be done to be sure.
234 249
int wl_send_robot_to_robot_global_packet(char group, char type, char* data, int len, int dest, char frame)
235 250
{
236 251
	return wl_send_packet(group, type, data, len, dest, XBEE_OPTIONS_BROADCAST_ALL_PANS, frame);
......
246 261
 * @param dest the 16-bit address of the XBee to send the packet to
247 262
 * @param frame the frame number to see with a TX_STATUS response
248 263
 **/
264
//TODO: this function is so simple, it *may* be beneficial to inline this function.  testing of if
265
// it reduces code size or not should be done to be sure.
249 266
int wl_send_robot_to_robot_packet(char group, char type, char* data, int len, int dest, char frame)
250 267
{
251 268
	return wl_send_packet(group, type, data, len, dest, XBEE_OPTIONS_NONE, frame);
......
260 277
 * @param len the packet length in bytes
261 278
 * @param frame the frame number to see with a TX_STATUS response
262 279
 **/
280
//TODO: this function is so simple, it *may* be beneficial to inline this function.  testing of if
281
// it reduces code size or not should be done to be sure.
263 282
int wl_send_global_packet(char group, char type, char* data, int len, char frame)
264 283
{
265 284
	return wl_send_packet(group, type, data, len, XBEE_BROADCAST, XBEE_OPTIONS_BROADCAST_ALL_PANS, frame);
......
274 293
 * @param len the packet length in bytes
275 294
 * @param frame the frame number to see with a TX_STATUS response
276 295
 **/
296
//TODO: this function is so simple, it *may* be beneficial to inline this function.  testing of if
297
// it reduces code size or not should be done to be sure.
277 298
void wl_send_pan_packet(char group, char type, char* data, int len, char frame)
278 299
{
279 300
	wl_send_packet(group, type, data, len, XBEE_BROADCAST,
......
293 314
 **/
294 315
int wl_send_packet(char group, char type, char* data, int len, int dest, char options, char frame)
295 316
{
317
  //TODO: does this need to be 128?  can it be smaller to save memory?
318
  //TODO: this shouldn't be hardcoded as 128.  it should be a define.
296 319
	char buf[128];
297 320
	int i;
298 321
	if (frame != 0)
......
407 430
	}
408 431
	else if (wl_buf[0] == XBEE_RX)
409 432
	{
433
    //TODO: what does this 7 represent?  It shouldn't be hardcoded.  It should be set as a define
410 434
		if (len < 7)
411 435
		{
412 436
			WL_DEBUG_PRINT("Packet is too small.\r\n");
......
422 446
		int options = wl_buf[4];
423 447
		*/
424 448

  
449
    //TODO: these indices, etc should be defined, not hardcoded
425 450
		int group = wl_buf[5];
426 451
		int type = wl_buf[6];
427 452
		int packetLen = len - 7;
......
438 463

  
439 464

  
440 465
#ifndef ROBOT
466
//TODO: this function is so simple, it *may* be beneficial to inline this function.  testing of if
467
// it reduces code size or not should be done to be sure.
441 468
void wl_set_com_port(char* port)
442 469
{
443 470
	xbee_set_com_port(port);

Also available in: Unified diff