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

Fork of xbee_lib by Tristan Hughes

Committer:
tristanjph
Date:
Wed Aug 29 10:39:42 2012 +0000
Revision:
1:c3d9bdcb0b03
Parent:
0:2656fb225c5d
Child:
2:cb627ea9b817
Added receive data and documentation

Who changed what in which revision?

UserRevisionLine numberNew contents of line
tristanjph 0:2656fb225c5d 1 #include "mbed.h"
tristanjph 0:2656fb225c5d 2
tristanjph 1:c3d9bdcb0b03 3 /** Xbee interface class for configuring, sending and recieving data using an Xbee */
tristanjph 0:2656fb225c5d 4 class xbee {
tristanjph 0:2656fb225c5d 5 private:
tristanjph 0:2656fb225c5d 6 PinName _tx;
tristanjph 0:2656fb225c5d 7 PinName _rx;
tristanjph 0:2656fb225c5d 8 public:
tristanjph 1:c3d9bdcb0b03 9 /** Configure serial data pin
tristanjph 1:c3d9bdcb0b03 10 * @param tx The serial tx pin the xbee is conected to
tristanjph 1:c3d9bdcb0b03 11 * @param rx The serial rx pin the xbee is conected to
tristanjph 1:c3d9bdcb0b03 12 */
tristanjph 1:c3d9bdcb0b03 13 xbee(PinName tx, PinName rx);
tristanjph 0:2656fb225c5d 14 ~xbee();
tristanjph 1:c3d9bdcb0b03 15 /** Puts the Xbee into config mode
tristanjph 1:c3d9bdcb0b03 16 * @return Returns 1 on success
tristanjph 1:c3d9bdcb0b03 17 */
tristanjph 0:2656fb225c5d 18 int ConfigMode();
tristanjph 1:c3d9bdcb0b03 19 /** Gets the serial number of the Xbee
tristanjph 1:c3d9bdcb0b03 20 * @return Returns 1 on success
tristanjph 1:c3d9bdcb0b03 21 */
tristanjph 0:2656fb225c5d 22 int GetSerial();
tristanjph 1:c3d9bdcb0b03 23 /** Sets the encryption key for the Xbee
tristanjph 1:c3d9bdcb0b03 24 * @return Returns 1 on success
tristanjph 1:c3d9bdcb0b03 25 */
tristanjph 0:2656fb225c5d 26 int SetKey();
tristanjph 1:c3d9bdcb0b03 27 /** Writes the settings to the Non volatile memory on the Xbee
tristanjph 1:c3d9bdcb0b03 28 * @return Returns 1 on success
tristanjph 1:c3d9bdcb0b03 29 */
tristanjph 0:2656fb225c5d 30 int WriteSettings();
tristanjph 1:c3d9bdcb0b03 31 /** Exits config mode
tristanjph 1:c3d9bdcb0b03 32 * @return Returns 1 on success
tristanjph 1:c3d9bdcb0b03 33 */
tristanjph 0:2656fb225c5d 34 int ExitConfigMode();
tristanjph 1:c3d9bdcb0b03 35 /** Sends data in the sendData buffer
tristanjph 1:c3d9bdcb0b03 36 * @return Returns 1 on success
tristanjph 1:c3d9bdcb0b03 37 */
tristanjph 0:2656fb225c5d 38 int SendData();
tristanjph 1:c3d9bdcb0b03 39 /** Recieves data and puts it into the recieveData buffer. Will over write anything already in the buffer
tristanjph 1:c3d9bdcb0b03 40 * @param numchar Number of characters to read
tristanjph 1:c3d9bdcb0b03 41 */
tristanjph 1:c3d9bdcb0b03 42 void RecieveData(int numchar);
tristanjph 0:2656fb225c5d 43
tristanjph 0:2656fb225c5d 44 int serial_no[8];
tristanjph 0:2656fb225c5d 45 int security_key[16];
tristanjph 0:2656fb225c5d 46 char sendData[202];
tristanjph 1:c3d9bdcb0b03 47 char readData[202];
tristanjph 0:2656fb225c5d 48 };