Project

General

Profile

Revision 203

Added the com_port functions to trunk

View differences:

xbee.c
67 67
/*Global Variables*/
68 68

  
69 69
#ifndef ROBOT
70
char* xbee_com_port;
70 71
int xbee_stream;
71 72
pthread_t* xbee_listen_thread;
72 73
#endif
......
144 145
	#endif
145 146
	sei();
146 147
	#else
147
	xbee_stream = open(XBEE_PORT, O_RDWR);
148
	xbee_stream = open(xbee_com_port, O_RDWR);
148 149
	if (xbee_stream == -1 || lockf(xbee_stream, F_TEST, 0) != 0)
149 150
		xbee_stream = open(XBEE_PORT2, O_RDWR);
150 151
	if (xbee_stream == -1 || lockf(xbee_stream, F_TEST, 0) != 0)
151 152
	{
152
		printf("Failed to open connection to XBee.\r\n");
153
		printf("Failed to open connection to XBee on port %s\r\n",xbee_com_port);
153 154
		exit(0);
154 155
	}
155 156
	lockf(xbee_stream, F_LOCK, 0);
......
748 749
	return xbee_address;
749 750
}
750 751

  
752
#ifndef ROBOT
753
void xbee_set_com_port(char* port){
754
  //printf("Port being passed is %s\n",port);
755
  xbee_com_port = malloc(strlen(port));
756
  strcpy(xbee_com_port,port); 
757
}
758
#endif
759

  

Also available in: Unified diff