XBee driver¶
High-level driver for the XBee S1 802.15.4 modem.
-
XBEE_ADDR_FLAGS_LONG
¶ Use long addresses if not otherwise defined when set, use short addresses when unset.
1
(0x80)
-
enum
xbee_rx_state_t
¶ - XBEE_INT_STATE_IDLE
- waiting for the beginning of a new frame
- XBEE_INT_STATE_SIZE1
- waiting for the first byte (MSB) of the frame size field
- XBEE_INT_STATE_SIZE2
- waiting for the second byte (LSB) of the frame size field
- XBEE_INT_STATE_TYPE
- waiting for the frame type field
- XBEE_INT_STATE_RESP
- handling incoming data for AT command responses
- XBEE_INT_STATE_RX
- handling incoming data when receiving radio packets
-
const
netdev.h::netdev_driver_t
xbee_driver
¶ Reference to the XBee driver interface.
-
void
xbee_setup
(xbee_t * dev, const xbee_params_t * params)¶ Prepare the given Xbee device.
Parameters
dev: Xbee device to initialize params: parameters for device initialization Return values
- 0 on success
- -ENODEV on invalid device descriptor
- -ENXIO on invalid UART or GPIO pins
-
int
xbee_build_hdr
(xbee_t * dev, uint8_t * xhdr,msp430_types.h::size_t
payload_len, void * dst_addr,msp430_types.h::size_t
addr_len)¶ Put together the internal proprietary XBee header.
Parameters
dev: Xbee device to initialize xhdr: buffer to write the header into, MUST be at least of length XBEE_MAX_TXHDR_LENGTH payload_len: actual payload length (without the XBee header) dst_addr: link layer (L2) destination address addr_len: length of dst_addr
in byte (MUST be 2 or 8)Return values
- the length of the created header in byte
- -EOVERFLOW if
payload_len
is greater than XBEE_MAX_PAYLOAD_LENGTH - -ENOMSG if the given destination address has an invalid length
-
int
xbee_parse_hdr
(xbee_t * dev, const uint8_t * xhdr, xbee_l2hdr_t * l2hdr)¶ Extract IEEE802.15.4 L2 header information from the XBee header.
Parameters
dev: Xbee device to initialize xhdr: XBee header, starting with the API identifier l2hdr: the L2 header information is written here Return values
- the length of the XBee header
- -ENOMST if the given XBee header is invalid
-
XBEE_MAX_PAYLOAD_LENGTH
¶ Maximum payload length that can be send.
1
(100U)
-
XBEE_MAX_PKT_LENGTH
¶ Maximum packet length, including XBee API frame overhead.
1
(115U)
-
XBEE_MAX_RESP_LENGTH
¶ Maximum length of a command response.
1
(16U)
-
XBEE_MAX_TXHDR_LENGTH
¶ Maximal possible size of a TX header.
1
(14U)
-
XBEE_DEFAULT_PROTOCOL
¶ Default protocol for data that is coming in.
1
(GNRC_NETTYPE_SIXLOWPAN)
-
XBEE_DEFAULT_PANID
¶ Default PAN ID used after initialization.
1
(IEEE802154_DEFAULT_PANID)
-
XBEE_DEFAULT_CHANNEL
¶ Default channel used after initialization.
1
(IEEE802154_DEFAULT_CHANNEL)
-
struct
xbee_params_t
¶ Configuration parameters for XBee devices.
-
uart.h::uart_t
uart
¶ UART interfaced the device is connected to.
-
uint32_t
br
¶ baudrate to use
-
gpio.h::gpio_t
pin_sleep
¶ GPIO pin that is connected to the SLEEP pin set to GPIO_UNDEF if not used.
-
gpio.h::gpio_t
pin_reset
¶ GPIO pin that is connected to the STATUS pin set to GPIO_UNDEF if not used.
-
-
struct
xbee_t
¶ XBee device descriptor.
-
const struct netdev_driver *
driver
¶ ptr to that driver’s interface.
-
netdev.h::netdev_event_cb_t
event_callback
¶ callback for device events
-
void *
context
¶ ptr to network stack context
-
xbee_params_t
p
¶ configuration parameters
-
uint8_t
options
¶ options field
-
uint8_t
addr_flags
¶ address flags as defined above
-
uint8_t
addr_short
()¶ onw 802.15.4 short address
-
xbee.h::xbee_rx_state_t
int_state
¶ current state if the UART RX FSM
-
uint16_t
int_size
¶ temporary space for parsing the frame size
-
uint8_t
cmd_buf
()¶ command data buffer
-
uint8_t
tx_fid
¶ TX frame ID.
-
uint8_t
resp_buf
()¶ AT response data buffer.
-
uint16_t
resp_count
¶ counter for ongoing transmission
-
uint16_t
resp_limit
¶ size RESP frame in transferred
-
uint8_t
rx_buf
()¶ receiving data buffer
-
uint16_t
rx_count
¶ counter for ongoing transmission
-
uint16_t
rx_limit
¶ size RX frame transferred
-
const struct netdev_driver *