Revision 1604
wireless: software retransmit done. serial functions moved to xbee.c
xbee.h | ||
---|---|---|
57 | 57 |
/**@defgroup xbee_const xbee constants |
58 | 58 |
* @brief These are constants used for the xbee module. |
59 | 59 |
* @{ **/ |
60 |
|
|
61 |
// TODO: move constants to xbee.h so they can be used publicly |
|
62 |
|
|
63 |
/**@brief The port to use the XBee from on the computer. **/ |
|
64 |
#ifndef ROBOT |
|
65 |
#define XBEE_PORT_DEFAULT "/dev/ttyUSB1" |
|
60 |
|
|
61 |
#ifndef XBEE_BAUD |
|
62 |
/** @brief The XBee baud rate **/ |
|
63 |
#define XBEE_BAUD 115200 |
|
66 | 64 |
#endif |
67 | 65 |
|
68 | 66 |
/**@name xbee options |
... | ... | |
104 | 102 |
|
105 | 103 |
/** @} **/ |
106 | 104 |
|
107 |
|
|
108 |
// TODO: is this a good size? |
|
109 |
/*Buffer sizes*/ |
|
110 |
#define XBEE_BUFFER_SIZE 128 |
|
111 |
#define PACKET_BUFFER_SIZE 108 |
|
112 |
|
|
113 | 105 |
/**@} **/ // end const group |
114 | 106 |
|
115 | 107 |
/** |
... | ... | |
121 | 113 |
// TODO: convert all int references to int16_t syntax (see stdint.h) |
122 | 114 |
|
123 | 115 |
/**@brief Initialize the XBee library **/ |
124 |
int xbee_lib_init(void);
|
|
116 |
int8_t xbee_init(void);
|
|
125 | 117 |
/**@brief Uninitialize the XBee library **/ |
126 |
void xbee_terminate(void); |
|
118 |
int8_t xbee_terminate(void); |
|
119 |
/**@brief Send a byte to the xbee **/ |
|
120 |
int8_t xbee_putc(uint8_t c); |
|
121 |
/**@brief Read a byte form the xbee **/ |
|
122 |
int16_t xbee_getc(void); |
|
123 |
/**@brief Read a byte from the xbee (nonblocking) **/ |
|
124 |
int8_t xbee_getc_nb(uint8_t *c); |
|
125 |
/**@brief Send an array of bytes to the xbee **/ |
|
126 |
int8_t xbee_send(uint8_t* buf, uint16_t size); |
|
127 |
/**@brief Add a buffer to the checksum value **/ |
|
128 |
int8_t xbee_checksum_add(uint8_t *buf, uint8_t len, uint8_t* sum); |
|
129 |
/**@brief Send a frame header to the xbee **/ |
|
130 |
int8_t xbee_send_header(uint8_t type, uint16_t len); |
|
127 | 131 |
/**@brief Send a packet to the XBee **/ |
128 |
int xbee_send_packet(char* packet, int len, int dest, char options, char frame);
|
|
132 |
int8_t xbee_send_packet(uint8_t* packet, uint8_t len, uint16_t dest, uint8_t options, uint8_t frame);
|
|
129 | 133 |
/**@brief Set the PAN ID for the XBee **/ |
130 |
int xbee_set_pan_id(int id); |
|
134 |
int16_t xbee_set_pan_id(int id);
|
|
131 | 135 |
/**@brief Get the XBee's PAN ID **/ |
132 |
unsigned int xbee_get_pan_id(void);
|
|
136 |
uint16_t xbee_get_pan_id(void);
|
|
133 | 137 |
/**@brief Set the channel the XBee is currently using **/ |
134 |
int xbee_set_channel(int channel); |
|
138 |
int8_t xbee_set_channel(int channel);
|
|
135 | 139 |
/**@brief Get the channel the XBee is currently using **/ |
136 |
int xbee_get_channel(void); |
|
140 |
int8_t xbee_get_channel(void);
|
|
137 | 141 |
/**@brief Get the XBee's 16-bit address **/ |
138 |
unsigned int xbee_get_address(void); |
|
139 |
/**@brief Set the com port on a computer, undefined on the robot**/ |
|
140 |
void xbee_set_com_port(char* port); |
|
142 |
uint16_t xbee_get_address(void); |
|
141 | 143 |
/**@brief Reset XBee **/ |
142 |
int xbee_reset(void);
|
|
144 |
int8_t xbee_reset(void); // TODO: implement this function
|
|
143 | 145 |
|
144 | 146 |
/**@} **/ //end xbee_funcs group |
145 | 147 |
|
Also available in: Unified diff