Project

General

Profile

Statistics
| Revision:

root / branches / autonomous_recharging / code / projects / autonomous_recharging / charging_station / xbee.h @ 166

History | View | Annotate | Download (2.05 KB)

1
/**
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
/**
14
 * The port to use the XBee from on the computer.
15
 * Also, a backup port if the other is used.
16
 **/
17
#ifndef ROBOT
18
#ifndef XBEE_PORT
19
#define XBEE_PORT "/dev/ttyUSB0"
20
#endif
21
#define XBEE_PORT2 "/dev/tty/USB1"
22
#endif
23

    
24
/**
25
 * @defgroup xbee XBee
26
 * @brief Interface with the XBee module
27
 *
28
 * Interface with the XBee module.
29
 *
30
 * @{
31
 **/
32

    
33
/*Definitions*/
34
/**@brief Unset PAN, uses XBee default **/
35
#define XBEE_PAN_DEFAULT 0xFFFF
36
/**@brief Unset channel, uses XBee default **/
37
#define XBEE_CHANNEL_DEFAULT 0
38
/**@brief Broadcast to all robots in the PAN **/
39
#define XBEE_BROADCAST 0xFFFF
40
/**@brief No special options **/
41
#define XBEE_OPTIONS_NONE 0x00
42
/**@brief Do not receive a TX_STATUS message from this packet **/
43
#define XBEE_OPTIONS_DISABLE_RESPONSE 0x01
44
/**@brief Send the packet to all PANS **/
45
#define XBEE_OPTIONS_BROADCAST_ALL_PANS 0x04
46
/**@brief A transmit status packet **/
47
#define XBEE_TX_STATUS 0x89
48
/**@brief A packet received from another XBee **/
49
#define XBEE_RX 0x81
50

    
51
/**@brief Initialize the XBee library **/
52
void xbee_lib_init(void);
53
/**@brief Uninitialize the XBee library **/
54
void xbee_terminate(void);
55
/**@brief Get a packet from the XBee **/
56
int xbee_get_packet(unsigned char* packet);
57
/**@brief Send a packet to the XBee **/
58
void xbee_send_packet(char* packet, int len, int dest,
59
        char options, char frame);
60
/**@brief Set the PAN ID for the XBee **/
61
void xbee_set_pan_id(int id);
62
/**@brief Get the XBee's PAN ID **/
63
unsigned int xbee_get_pan_id(void);
64
/**@brief Set the channel the XBee is currently using **/
65
void xbee_set_channel(int channel);
66
/**@brief Get the channel the XBee is currently using **/
67
int xbee_get_channel(void);
68
/**@brief Get the XBee's 16-bit address **/
69
unsigned int xbee_get_address(void);
70

    
71
/**@}**/ //end defgroup
72