High-level driver for the XBee S1 802.15.4 modem.
More...
High-level driver for the XBee S1 802.15.4 modem.
|
file | xbee.h |
| High-level driver for the XBee S1 802.15.4 modem.
|
|
file | xbee_params.h |
| Default configuration for XBee devices.
|
|
|
#define | XBEE_ADDR_FLAGS_LONG (0x80) |
| Use long addresses if not otherwise defined when set, use short addresses when unset.
|
|
◆ xbee_rx_state_t
States of the internal FSM for handling incoming UART frames.
Incoming data frames on the UART interfaces are handled using a finite state machine (FSM) in the UARTs RX interrupt handler. The FSM is needed to extract frame specific data as the frame size, frame type, and checksums.
Enumerator |
---|
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
|
Definition at line 101 of file xbee.h.
◆ xbee_build_hdr()
int xbee_build_hdr |
( |
xbee_t * |
dev, |
|
|
uint8_t * |
xhdr, |
|
|
size_t |
payload_len, |
|
|
void * |
dst_addr, |
|
|
size_t |
addr_len |
|
) |
| |
Put together the internal proprietary XBee header.
- Parameters
-
[in] | dev | Xbee device to initialize |
[out] | xhdr | buffer to write the header into, MUST be at least of length XBEE_MAX_TXHDR_LENGTH |
[in] | payload_len | actual payload length (without the XBee header) |
[in] | dst_addr | link layer (L2) destination address |
[in] | addr_len | length of dst_addr in byte (MUST be 2 or 8) |
- Returns
- 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
◆ xbee_parse_hdr()
Extract IEEE802.15.4 L2 header information from the XBee header.
- Parameters
-
[in] | dev | Xbee device to initialize |
[in] | xhdr | XBee header, starting with the API identifier |
[out] | l2hdr | the L2 header information is written here |
- Returns
- the length of the XBee header
-
-ENOMST if the given XBee header is invalid
◆ xbee_setup()
Prepare the given Xbee device.
- Parameters
-
[out] | dev | Xbee device to initialize |
[in] | params | parameters for device initialization |
- Returns
- 0 on success
-
-ENODEV on invalid device descriptor
-
-ENXIO on invalid UART or GPIO pins