root / trunk / code / projects / libwireless / lib / xbee.h @ 171
History | View | Annotate | Download (2.09 KB)
1 | 17 | bcoltin | /**
|
---|---|---|---|
2 | * @file xbee.h
|
||
3 | * @brief Contains definitions for using the XBee
|
||
4 | *
|
||
5 | * Contains definitions for interfacing with the
|
||
6 | * XBee module, from either a robot or a computer.
|
||
7 | * To use a robot, define ROBOT in wl_defs.h, and
|
||
8 | * to use a computer, don't define ROBOT.
|
||
9 | *
|
||
10 | * @author Brian Coltin, Colony Project, CMU Robotics Club
|
||
11 | **/
|
||
12 | |||
13 | 159 | jknichel | #ifndef XBEE_H
|
14 | #define XBEE_H
|
||
15 | |||
16 | 17 | bcoltin | /**
|
17 | 113 | bcoltin | * The port to use the XBee from on the computer.
|
18 | * Also, a backup port if the other is used.
|
||
19 | **/
|
||
20 | #ifndef ROBOT
|
||
21 | #ifndef XBEE_PORT
|
||
22 | 171 | gtress | #define XBEE_PORT "/dev/ttyUSB2" |
23 | 113 | bcoltin | #endif
|
24 | 171 | gtress | #define XBEE_PORT2 "/dev/ttyUSB0" |
25 | 113 | bcoltin | #endif
|
26 | |||
27 | /**
|
||
28 | 17 | bcoltin | * @defgroup xbee XBee
|
29 | * @brief Interface with the XBee module
|
||
30 | *
|
||
31 | * Interface with the XBee module.
|
||
32 | *
|
||
33 | * @{
|
||
34 | **/
|
||
35 | |||
36 | /*Definitions*/
|
||
37 | 60 | bcoltin | /**@brief Unset PAN, uses XBee default **/
|
38 | 17 | bcoltin | #define XBEE_PAN_DEFAULT 0xFFFF |
39 | 60 | bcoltin | /**@brief Unset channel, uses XBee default **/
|
40 | #define XBEE_CHANNEL_DEFAULT 0 |
||
41 | 17 | bcoltin | /**@brief Broadcast to all robots in the PAN **/
|
42 | #define XBEE_BROADCAST 0xFFFF |
||
43 | /**@brief No special options **/
|
||
44 | #define XBEE_OPTIONS_NONE 0x00 |
||
45 | /**@brief Do not receive a TX_STATUS message from this packet **/
|
||
46 | #define XBEE_OPTIONS_DISABLE_RESPONSE 0x01 |
||
47 | /**@brief Send the packet to all PANS **/
|
||
48 | #define XBEE_OPTIONS_BROADCAST_ALL_PANS 0x04 |
||
49 | /**@brief A transmit status packet **/
|
||
50 | #define XBEE_TX_STATUS 0x89 |
||
51 | /**@brief A packet received from another XBee **/
|
||
52 | #define XBEE_RX 0x81 |
||
53 | |||
54 | /**@brief Initialize the XBee library **/
|
||
55 | 60 | bcoltin | void xbee_lib_init(void); |
56 | 17 | bcoltin | /**@brief Uninitialize the XBee library **/
|
57 | void xbee_terminate(void); |
||
58 | /**@brief Get a packet from the XBee **/
|
||
59 | int xbee_get_packet(unsigned char* packet); |
||
60 | /**@brief Send a packet to the XBee **/
|
||
61 | void xbee_send_packet(char* packet, int len, int dest, |
||
62 | char options, char frame); |
||
63 | /**@brief Set the PAN ID for the XBee **/
|
||
64 | void xbee_set_pan_id(int id); |
||
65 | /**@brief Get the XBee's PAN ID **/
|
||
66 | unsigned int xbee_get_pan_id(void); |
||
67 | 60 | bcoltin | /**@brief Set the channel the XBee is currently using **/
|
68 | void xbee_set_channel(int channel); |
||
69 | /**@brief Get the channel the XBee is currently using **/
|
||
70 | int xbee_get_channel(void); |
||
71 | 17 | bcoltin | /**@brief Get the XBee's 16-bit address **/
|
72 | unsigned int xbee_get_address(void); |
||
73 | |||
74 | /**@}**/ //end defgroup |
||
75 | |||
76 | 159 | jknichel | #endif |