These are the public xbee functions. More...
Functions | |
int8_t | xbee_init (void) |
Initialize the XBee library. | |
int8_t | xbee_terminate (void) |
Uninitialize the XBee library. | |
int8_t | xbee_send (uint8_t *buf, uint16_t size) |
Send an array of bytes to the xbee in API mode. | |
int8_t | xbee_sendc (uint8_t byte) |
Send byte to the xbee in API mode. | |
int8_t | xbee_checksum_add (uint8_t *buf, uint8_t len, uint8_t *sum) |
Add a buffer to the checksum value. | |
int8_t | xbee_send_header (uint16_t len) |
Send a frame header to the xbee. | |
int8_t | xbee_send_packet (uint8_t *packet, uint8_t len, uint16_t dest, uint8_t options, uint8_t frame) |
Send a packet to the XBee. | |
int8_t | xbee_set_pan (uint16_t id) |
Set the PAN ID for the XBee. | |
uint16_t | xbee_get_pan (void) |
Get the XBee's PAN ID. | |
int8_t | xbee_set_channel (uint8_t channel) |
Set the channel the XBee is currently using. | |
int8_t | xbee_get_channel (void) |
Get the channel the XBee is currently using. | |
uint16_t | xbee_get_address (void) |
Get the XBee's 16-bit address. | |
int8_t | xbee_reset (void) |
Reset XBee. |
These are the public xbee functions.
int8_t xbee_checksum_add | ( | uint8_t * | buf, | |
uint8_t | len, | |||
uint8_t * | sum | |||
) |
Add a buffer to the checksum value.
Adds buf to the previous checksum total
buf | a byte buffer to add to the checksum | |
len | the length of the buffer | |
sum | the previous sum |
References WL_ERROR_ARGUMENT, and WL_SUCCESS.
Referenced by wl_send().
uint16_t xbee_get_address | ( | void | ) |
Get the XBee's 16-bit address.
Get the 16-bit address of the XBee. This is used to specify who to send messages to and who messages are from.
References getStatus(), WL_ERROR_XBEE_COMMAND_16BIT, and xbee_send_read_at_command().
Referenced by xbee_init().
int8_t xbee_get_channel | ( | void | ) |
Get the channel the XBee is currently using.
Returns the channel which the XBee is currently using.
References getStatus(), WL_ERROR_XBEE_COMMAND, and xbee_send_read_at_command().
uint16_t xbee_get_pan | ( | void | ) |
Get the XBee's PAN ID.
Get the PAN ID for the XBee.
References getStatus(), WL_ERROR_XBEE_COMMAND_16BIT, and xbee_send_read_at_command().
int8_t xbee_init | ( | void | ) |
Initialize the XBee library.
Initializes the XBee library so that other functions may be used.
References getStatus(), WL_ERROR_BAUD, WL_ERROR_INIT_ALREADY_INITD, WL_ERROR_XBEE_COMMAND_16BIT, WL_SUCCESS, xbee_basic_buf, xbee_get_address(), and xbee_set_pan().
Referenced by wl_init().
int8_t xbee_send | ( | uint8_t * | buf, | |
uint16_t | size | |||
) |
Send an array of bytes to the xbee in API mode.
Send a buffer buf of size bytes to the XBee in API mode
buf | the buffer of data to send | |
size | the number of bytes to send |
References WL_ERROR_SEND, WL_SUCCESS, and xbee_sendc().
Referenced by wl_send(), and xbee_send_packet().
int8_t xbee_send_header | ( | uint16_t | len | ) |
Send a frame header to the xbee.
Sends header information. Header information includes XBEE_FRAME_START and the packet length, as two bytes.
type | the packet type | |
len | the size in bytes of the packet data |
References WL_ERROR_SEND, WL_SUCCESS, xbee_putc(), and xbee_sendc().
Referenced by wl_send().
int8_t xbee_send_packet | ( | uint8_t * | packet, | |
uint8_t | len, | |||
uint16_t | dest, | |||
uint8_t | options, | |||
uint8_t | frame | |||
) |
Send a packet to the XBee.
Send the specified packet.
packet | the packet data to send | |
len | the number of bytes in the packet | |
dest | the ID of the XBee to send the packet to, or XBEE_BROADCAST to send the message to all robots in the PAN. | |
options | a combination of the flags XBEE_OPTIONS_NONE, XBEE_OPTIONS_DISABLE_RESPONSE and XBEE_OPTIONS_BROADCAST_ALL_PANS | |
frame | the frame number to associate this packet with. This will be used to identify the response when the XBee alerts us as to whether or not our message was received. |
References WL_ERROR_ARGUMENT, WL_ERROR_SEND, WL_SUCCESS, xbee_putc(), xbee_send(), and xbee_sendc().
int8_t xbee_sendc | ( | uint8_t | byte | ) |
Send byte to the xbee in API mode.
Send byte to the xbee in API mode.
byte | the byte to be sent |
References getStatus(), and WL_SUCCESS.
Referenced by wl_send(), xbee_send(), xbee_send_header(), and xbee_send_packet().
int8_t xbee_set_channel | ( | uint8_t | channel | ) |
Set the channel the XBee is currently using.
Set the channel the XBee is using.
channel | the channel the XBee will not use, between 0x0B and 0x1A |
References getStatus(), WL_ERROR_ARGUMENT, WL_ERROR_XBEE_COMMAND, and WL_SUCCESS.
int8_t xbee_set_pan | ( | uint16_t | id | ) |
Set the PAN ID for the XBee.
Sets the personal area network id.
id | the new personal area network (PAN) id |
References getStatus(), WL_ERROR_XBEE_COMMAND, and WL_SUCCESS.
Referenced by xbee_init().
int8_t xbee_terminate | ( | void | ) |
Uninitialize the XBee library.
Call when finished using the XBee library.
References WL_ERROR_TERMINATION_FAILED, and WL_SUCCESS.
Referenced by wl_terminate().