#include <Xbee.h>
|
| Xbee (SPIBusInterface &bus, GpioType cs, GpioType attn, GpioType rst, long long txTimeout=DEFAULT_TX_TIMEOUT) |
| Constructs a new instance of the Xbee driver.
|
|
| Xbee (SPIBusInterface &bus, SPIBusConfig config, GpioType cs, GpioType attn, GpioType rst, long long txTimeout=DEFAULT_TX_TIMEOUT) |
| Constructs a new instance of the Xbee driver.
|
|
| ~Xbee () |
|
bool | send (uint8_t *pkt, size_t packetLength) override |
| Sends a packet. The function blocks until the packet is sent to the peripheral, but does not wait for an ACK or send confirmation from the Xbee. Thus, it always returns true.
|
|
ssize_t | receive (uint8_t *buf, size_t bufferMaxSize) override |
| Waits until a new packet is received.
|
|
void | reset () |
| Hardware resets the Xbee.
|
|
void | handleATTNInterrupt () |
| Signals the receive() function that there is new data available. Call this from the ATTN pin interrupt service routine, and nowhere else please.
|
|
void | wakeReceiver (bool forceReturn=false) |
| Wakes the receive function without needing an interrupt.
|
|
void | sendATCommand (const char *cmd, uint8_t *params=nullptr, size_t paramsLength=0) |
| Sends an AT Command to the Xbee (see datasheet) without waiting for a response.
|
|
bool | sendATCommand (const char *cmd, ATCommandResponseFrame *response, uint8_t *params=nullptr, size_t paramsLength=0, unsigned int timeout=1000) |
| Sends an AT Command to the Xbee and wait for a response (see datasheet)
|
|
void | setOnFrameReceivedListener (OnFrameReceivedListener listener) |
| Set the frame received listener, called each time a new APIFrame is received from the device.
|
|
XbeeStatus | getStatus () |
|
| Transceiver () |
|
virtual | ~Transceiver () |
|
Definition at line 58 of file Xbee.h.
◆ OnFrameReceivedListener
◆ Xbee() [1/2]
Constructs a new instance of the Xbee driver.
- Parameters
-
bus | The SPI bus where the xbee is connected |
cs | Xbee SPI Chip Select Pin |
attn | Xbee ATTN Pin |
rst | Xbee RST PIN |
txTimeout | How long to wait to for a TX Status |
Definition at line 43 of file Xbee.cpp.
◆ Xbee() [2/2]
Constructs a new instance of the Xbee driver.
- Parameters
-
bus | The SPI bus where the xbee is connected |
config | Custom SPI bus configuration |
cs | Xbee SPI Chip Select Pin |
attn | Xbee ATTN Pin |
rst | Xbee RST PIN |
txTimeout | How long to wait to for a TX Status |
Definition at line 50 of file Xbee.cpp.
◆ ~Xbee()
Boardcore::Xbee::Xbee::~Xbee |
( |
| ) |
|
◆ getStatus()
◆ handleATTNInterrupt()
void Boardcore::Xbee::Xbee::handleATTNInterrupt |
( |
| ) |
|
Signals the receive() function that there is new data available. Call this from the ATTN pin interrupt service routine, and nowhere else please.
Definition at line 220 of file Xbee.cpp.
◆ receive()
ssize_t Boardcore::Xbee::Xbee::receive |
( |
uint8_t * | buf, |
|
|
size_t | bufferMaxSize ) |
|
overridevirtual |
Waits until a new packet is received.
- Parameters
-
buf | Buffer to store the received packet into. |
bufferMaxSize | Maximum length of the received data. |
- Returns
- Size of the data received or -1 if failure
Implements Boardcore::Transceiver.
Definition at line 116 of file Xbee.cpp.
◆ reset()
void Boardcore::Xbee::Xbee::reset |
( |
| ) |
|
◆ send()
bool Boardcore::Xbee::Xbee::send |
( |
uint8_t * | pkt, |
|
|
size_t | packetLength ) |
|
overridevirtual |
Sends a packet. The function blocks until the packet is sent to the peripheral, but does not wait for an ACK or send confirmation from the Xbee. Thus, it always returns true.
- Parameters
-
pkt | Pointer to the packet (needs to be at least packetLength bytes). |
packetLength | Length of the packet to be sent. |
- Returns
- Always true
Implements Boardcore::Transceiver.
Definition at line 59 of file Xbee.cpp.
◆ sendATCommand() [1/2]
bool Boardcore::Xbee::Xbee::sendATCommand |
( |
const char * | cmd, |
|
|
ATCommandResponseFrame * | response, |
|
|
uint8_t * | params = nullptr, |
|
|
size_t | paramsLength = 0, |
|
|
unsigned int | timeout = 1000 ) |
Sends an AT Command to the Xbee and wait for a response (see datasheet)
- Parameters
-
cmd | Two character string with the name of the command (eg "DB") |
params | Optional command parameters |
paramsLength | Length in bytes of the params array |
response | Where to store the response |
timeout | Maximum time to wait for the response |
- Returns
- true if response received before the timeout, false otherwise
Definition at line 377 of file Xbee.cpp.
◆ sendATCommand() [2/2]
void Boardcore::Xbee::Xbee::sendATCommand |
( |
const char * | cmd, |
|
|
uint8_t * | params = nullptr, |
|
|
size_t | paramsLength = 0 ) |
Sends an AT Command to the Xbee (see datasheet) without waiting for a response.
- Parameters
-
cmd | Two character string with the name of the command (eg "DB") |
params | Optional command parameters |
paramsLength | Length in bytes of the params array |
Definition at line 370 of file Xbee.cpp.
◆ setOnFrameReceivedListener()
Set the frame received listener, called each time a new APIFrame is received from the device.
- Parameters
-
Definition at line 508 of file Xbee.cpp.
◆ wakeReceiver()
void Boardcore::Xbee::Xbee::wakeReceiver |
( |
bool | forceReturn = false | ) |
|
Wakes the receive function without needing an interrupt.
- Parameters
-
forceReturn | Wether receive(..) should return even if it has not received any data |
Definition at line 208 of file Xbee.cpp.
The documentation for this class was generated from the following files: