Project

General

Profile

Statistics
| Revision:

root / branches / slam / code / projects / libwireless / lib / xbee.h @ 110

History | View | Annotate | Download (1.88 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
#define XBEE_PORT "/dev/cu.usbserial-A4001hAN"
41

    
42

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

    
63
/**@}**/ //end defgroup
64