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: IOT_sensor_nfc Xbee_Hello_world Xbee_Hello_world_A Xbee_Hello_World_B ... more
xbee.h
- Committer:
- tristanjph
- Date:
- 2012-08-29
- Revision:
- 3:682615a0717e
- Parent:
- 2:cb627ea9b817
- Child:
- 4:ede20c047d8b
File content as of revision 3:682615a0717e:
#include "mbed.h" /** Xbee interface class for configuring, sending and recieving data using an Xbee */ class xbee { private: PinName _tx; PinName _rx; PinName _reset; 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. * @param reset The pin connected to the Xbee reset pin. */ xbee(PinName tx, PinName rx, PinName reset); ~xbee(); /** Puts the Xbee into config mode. * @return Returns 1 on success. */ int ConfigMode(); /** Gets the serial number/mac address of the Xbee and places it into serial_no. * @param serial_no array to store the serial of Xbee (must be 8 long). * @return Returns 1 on success. */ int GetSerial(int*); /** Sets the encryption key to the one stored in security_key. * @param key Pointer to the network key to set. * @return Returns 1 on success. */ int SetKey(int*); /** Sets the id of the PAN network for the Xbee to use * @param pan_id The id of the PAN for the Xbee to use. * @return Returns 1 on success. */ int SetPanId(int); /** Writes the settings to the Non volatile memory on the Xbee * @param key Pointer to the network key to set. * @return Returns 1 on success. */ int WriteSettings(); /** Exits config mode * @return Returns 1 on success. */ int ExitConfigMode(); /** Sends data in the send_Data buffer. * @param data_buf Pointer to the buffer of data to send. * @returns 1 on success. */ int SendData(char*); /** Recieves data sent to the xbee. * @param data_buf Pointer to the buffer to put recieved data into. * @param numchar Number of characters to read. If 0, will use the size of data_buf. */ void RecieveData(char*, int); /** Resets the Xbee. */ void Reset(); };