Library to easily communicate with XBee modules.

Dependencies:   DigiLogger

Dependents:   WaterLogger XbeeGateway XBee_Cooker ProjetReceiver ... more

Configuring the library

XBeeLib is configured through config.h file, which should be placed in your application. This file allows changing some behavior in the library:

Logging

Enables Logging on the configured logging serial port.
See Debugging the library chapter for more info.

#define ENABLE_LOGGING

Assertions

Enables Assertions to check at run-time that certain conditions succeed.
See Debugging the library chapter for more info.

#define ENABLE_ASSERTIONS

Frame Buffer Size

Configures the internal circular Frame Buffer Size.
See Frame Receive Process chapter for more info.

#define FRAME_BUFFER_SIZE   4

Warning

Increasing this will considerably increase the amount of memory used by the library.

Frame Payload Length

Configures the maximum payload length of the received frames.
See Frame Receive Process chapter for more info.

#define MAX_FRAME_PAYLOAD_LEN  128

Synchronous Operations Timeout

Configures the default timeout for synchronous operations.
See Synchronous Operations Timeout chapter

#define SYNC_OPS_TIMEOUT_MS       2000

Configuring the examples

All examples provided by Digi International Inc., expect some pins to be defined accordingly to the selected platform and the user's specific setup. These configurations are done in config.h. It also includes extra checks that throw errors when the macros are not defined.

Radio Pins

The following macros define the pins used to connect the radio:

  • RADIO_TX: this macro defines the mbed micro-controller's Serial TX pin that will be connected to the module's DIN pin (pin 3 on THT modules, pin 4 on SMT ones).
  • RADIO_RX: this macro defines the mbed micro-controller's Serial RX pin that will be connected to the module's DOUT pin (pin 2 on THT modules, pin 3 on SMT ones).
  • RADIO_RTS (optional): this macro defines to which mbed micro-controller GPIO the module's RTS/DIO6 line is connected (pin 16 in THT modules, pin 29 in SMT ones). Bear in mind that if provided, the module's D6 parameter must have been configured to support this functionality. See Serial hardware flow control for more information.
  • RADIO_CTS (optional): this macro defines to which mbed micro-controller GPIO the module's CTS/DIO7 line is connected (pin 12 in THT modules, pin 25 in SMT ones). Bear in mind that if provided, the module's D7 parameter must have been configured to support this functionality. See Serial hardware flow control for more information.
  • RADIO_RESET (optional): this macro defines to which mbed micro-controller GPIO the module's RESET line is connected (pin 5 in THT modules, pin 6 in SMT ones).
  • RADIO_SLEEP_REQ (Pin-Sleep Power Management examples only): this macro defines to which mbed micro-controller GPIO the module's D8 pin (pin 9 on THT modules, pin 10 on SMT ones) is connected.
  • RADIO_ON_SLEEP (Pin-Sleep Power Management examples only): this macro defines to which mbed micro-controller GPIO the module's D9 pin (pin 13 on THT modules, pin 26 on SMT ones) is connected.

DigiLoggerMbedSerial pins

The following pins will be used to build a new DigiLoggerMbedSerial (see DigiLogger) object to log the library (only if ENABLE_LOGGING is defined):

  • DEBUG_TX: this macro defines the mbed micro-controller's Serial TX pin that will be used for logging.
  • DEBUG_RX (optional): this macro defines the mbed micro-controller's Serial RX pin that will be used for logging.