-

Dependents:   GPSXbee_1_1 GPSXbee_1_0

Revision:
0:8b33ba38cc3a
Child:
1:d4cbfcb2be46
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Beacon.h	Fri Jul 04 09:51:12 2014 +0000
@@ -0,0 +1,71 @@
+#include "mbed.h"
+#include <string>
+#include "GPS.h"
+#include "EthernetPowerControl.h"
+#include "MODSERIAL.h"
+
+#define XBEETIMEOUT 5
+
+class Beacon
+{
+public:
+    Beacon(PinName gpsTx, PinName gpsRx, PinName xbTx, PinName xbRx, int freq, int len);
+    GPS gps;
+    bool init();
+    void parseXbee();
+    void parseGpsData();
+    bool gpsReadable();
+    bool xbeeReadable();
+
+    DigitalOut L1;
+    DigitalOut L2;
+    DigitalOut L3;
+    DigitalOut L4;  
+    
+private:
+    MODSERIAL XBee;
+    InterruptIn PPS;    
+    char RxBuffer[256];
+    
+    bool PWMon;
+    bool RxTO;
+       
+    int TimingOffset;
+    int BeaconNumber;
+   
+    void ppsSync();
+    void readDipSwitch();
+    void initDipSwitch();
+   
+    // Pins are all bound to a mbed pin in the constructor
+    // Digital pins for setting the Timing offset
+    DigitalIn T1;
+    DigitalIn T2;
+    DigitalIn T3;
+    DigitalIn T4;
+    DigitalIn T5;
+    DigitalIn T6;
+    DigitalIn T7;
+    DigitalIn T8;
+
+    // Digital pins for setting the beacon number
+    DigitalIn B1;
+    DigitalIn B2;
+    DigitalIn B3;
+    DigitalIn B4;
+    
+    int PulseFrequency;   //Hz
+    int Pulselength; //usec
+    int PWMclock; 
+    int Period;
+    
+
+    Timeout _RxTimeOut;
+    void rxTimeOut();
+    
+    void startPWM();
+    void stopPWM();
+    void resetPWM(int _PulseFrequency, int _Pulselength);
+    void printStatus();
+    void getXbeeData();  
+};