A library allowing basic functions of the XBEE pro to be used. Currently supported are: Enter/exit config mode, reading device serial number, setting encryption key, writing settings to non volatile memory and sending data strings.

Dependents:   Seeed_XBee_Shield Seeed_XBee_Shield-2

Fork of xbee_lib by Tristan Hughes

xbee.h

Committer:
tristanjph
Date:
2012-08-29
Revision:
1:c3d9bdcb0b03
Parent:
0:2656fb225c5d
Child:
2:cb627ea9b817

File content as of revision 1:c3d9bdcb0b03:

#include "mbed.h"

/** Xbee interface class for configuring, sending and recieving data using an Xbee */
class xbee {
private:
    PinName _tx;
    PinName _rx;
public:
    /** Configure serial data pin
      * @param tx The serial tx pin the xbee is conected to
      * @param rx The serial rx pin the xbee is conected to
      */
    xbee(PinName tx, PinName rx);
    ~xbee();
    /** Puts the Xbee into config mode
      * @return Returns 1 on success
      */
    int ConfigMode();
    /** Gets the serial number of the Xbee
      * @return Returns 1 on success
      */
    int GetSerial();
    /** Sets the encryption key for the Xbee
      * @return Returns 1 on success
      */
    int SetKey();
    /** Writes the settings to the Non volatile memory on the Xbee 
      * @return Returns 1 on success
      */
    int WriteSettings();
    /** Exits config mode
      * @return Returns 1 on success
      */
    int ExitConfigMode();
    /** Sends data in the sendData buffer
      * @return Returns 1 on success
      */
    int SendData();
    /** Recieves data and puts it into the recieveData buffer. Will over write anything already in the buffer
      * @param numchar Number of characters to read
      */
    void RecieveData(int numchar);
    
    int serial_no[8];
    int security_key[16]; 
    char sendData[202];
    char readData[202];
};