Adam Piekarski / XBEE

Fork of XBEE by GDP 4

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers XBEE.h Source File

XBEE.h

00001 #include "mbed.h"
00002 #include "CBuffer.h"
00003 #define STARTBYTE0 'Y'
00004 #define STARTBYTE1 'A'
00005 #define STARTBYTE2 'R'
00006 
00007 class XBEE{
00008     public:
00009 XBEE(Serial* SerialAddress); // XBEE comms constructor
00010 void sendCommand(char command, int sizeOfPayload,char payload[]); // Send a command and payload of chars
00011 void sendCommand(char command); // Send a single command byte only
00012 void sendCommand(const char* info); // Send a string to the status box on the laptop
00013 void sendCommand(int info); // Send an int to the status box
00014 void sendCommand(float info); // Send a float to the status box
00015 void sendCommand(double info); // Send a double to the status box
00016 void checkForCommand(); // Reads through the Serial buffer executing any pending commands. call this function regularly to avoid buffer overflow 
00017 void test(); // Test function to test low level comms. This will send "Receiving the following data:" and then mirror back everything currently in the serial buffer
00018              // Note this function does not use the comms protocol so won't appear on the status text box, you will have to use putty
00019 
00020 
00021 Serial* xbeeSerial; // Pointer to serial class
00022 CBuffer* cBuffer; // Pointer to circular buffer storing inbound serial data
00023 
00024    private:
00025 bool scanForStartBytes(); // Synchronise comms
00026 void switchCase(char command); // Process inbound commands
00027 
00028 
00029 char startBytes[3]; // Temp variables to store inbound start bytes for comms synchronisation
00030 
00031 
00032 
00033 };