Project

General

Profile

Statistics
| Revision:

root / trunk / code / lib / include / libwireless / xbee.h @ 60

History | View | Annotate | Download (1.84 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
 * @defgroup xbee XBee
15
 * @brief Interface with the XBee module
16
 *
17
 * Interface with the XBee module.
18
 *
19
 * @{
20
 **/
21

    
22
/*Definitions*/
23
/**@brief Unset PAN, uses XBee default **/
24
#define XBEE_PAN_DEFAULT 0xFFFF
25
/**@brief Unset channel, uses XBee default **/
26
#define XBEE_CHANNEL_DEFAULT 0
27
/**@brief Broadcast to all robots in the PAN **/
28
#define XBEE_BROADCAST 0xFFFF
29
/**@brief No special options **/
30
#define XBEE_OPTIONS_NONE 0x00
31
/**@brief Do not receive a TX_STATUS message from this packet **/
32
#define XBEE_OPTIONS_DISABLE_RESPONSE 0x01
33
/**@brief Send the packet to all PANS **/
34
#define XBEE_OPTIONS_BROADCAST_ALL_PANS 0x04
35
/**@brief A transmit status packet **/
36
#define XBEE_TX_STATUS 0x89
37
/**@brief A packet received from another XBee **/
38
#define XBEE_RX 0x81
39

    
40
/**@brief Initialize the XBee library **/
41
void xbee_lib_init(void);
42
/**@brief Uninitialize the XBee library **/
43
void xbee_terminate(void);
44
/**@brief Get a packet from the XBee **/
45
int xbee_get_packet(unsigned char* packet);
46
/**@brief Send a packet to the XBee **/
47
void xbee_send_packet(char* packet, int len, int dest,
48
        char options, char frame);
49
/**@brief Set the PAN ID for the XBee **/
50
void xbee_set_pan_id(int id);
51
/**@brief Get the XBee's PAN ID **/
52
unsigned int xbee_get_pan_id(void);
53
/**@brief Set the channel the XBee is currently using **/
54
void xbee_set_channel(int channel);
55
/**@brief Get the channel the XBee is currently using **/
56
int xbee_get_channel(void);
57
/**@brief Get the XBee's 16-bit address **/
58
unsigned int xbee_get_address(void);
59

    
60
/**@}**/ //end defgroup
61