Project

General

Profile

Statistics
| Revision:

root / branches / wireless / code / projects / libwireless / xbee.h @ 1576

History | View | Annotate | Download (2.64 KB)

1
/**
2
 * Copyright (c) 2009 Colony Project
3
 * 
4
 * Permission is hereby granted, free of charge, to any person
5
 * obtaining a copy of this software and associated documentation
6
 * files (the "Software"), to deal in the Software without
7
 * restriction, including without limitation the rights to use,
8
 * copy, modify, merge, publish, distribute, sublicense, and/or sell
9
 * copies of the Software, and to permit persons to whom the
10
 * Software is furnished to do so, subject to the following
11
 * conditions:
12
 * 
13
 * The above copyright notice and this permission notice shall be
14
 * included in all copies or substantial portions of the Software.
15
 * 
16
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
18
 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20
 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21
 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23
 * OTHER DEALINGS IN THE SOFTWARE.
24
 **/
25

    
26
/**
27
 * @file xbee.h
28
 * @brief Contains definitions for using the XBee
29
 *
30
 * Contains definitions for interfacing with the 
31
 * XBee module, from either a robot or a computer.
32
 * To use a robot, define ROBOT in wl_defs.h, and
33
 * to use a computer, don't define ROBOT.
34
 *
35
 * @author Colony Project, CMU Robotics Club
36
 **/
37

    
38
#ifndef XBEE_H
39
#define XBEE_H
40

    
41
// need this for C99 int types
42
#ifndef STDINT_H
43
#define STDINT_H
44
#include <stdint.h>
45
#endif
46

    
47

    
48
/**
49
 * @defgroup xbee XBee
50
 * @brief Interface with the XBee module
51
 *
52
 * Interface with the XBee module.
53
 *
54
 * @{
55
 **/
56
 
57
 
58
// TODO: convert all int references to int16_t syntax (see stdint.h)
59

    
60
/**@brief Initialize the XBee library **/
61
int xbee_lib_init(void);
62
/**@brief Uninitialize the XBee library **/
63
void xbee_terminate(void);
64
/**@brief Get a packet from the XBee **/
65
int xbee_get_packet(unsigned char* packet);
66
/**@brief Send a packet to the XBee **/
67
int xbee_send_packet(char* packet, int len, int dest, char options, char frame);
68
/**@brief Set the PAN ID for the XBee **/
69
int xbee_set_pan_id(int id);
70
/**@brief Get the XBee's PAN ID **/
71
unsigned int xbee_get_pan_id(void);
72
/**@brief Set the channel the XBee is currently using **/
73
int xbee_set_channel(int channel);
74
/**@brief Get the channel the XBee is currently using **/
75
int xbee_get_channel(void);
76
/**@brief Get the XBee's 16-bit address **/
77
unsigned int xbee_get_address(void);
78
/**@brief Set the com port on a computer, undefined on the robot**/
79
void xbee_set_com_port(char* port);
80
/**@brief Reset XBee **/
81
int xbee_reset(void);
82

    
83
/**@}**/ //end defgroup
84

    
85
#endif