-

Dependents:   GPSXbee_1_1 GPSXbee_1_0

Committer:
Deurklink
Date:
Fri Jul 04 09:51:12 2014 +0000
Revision:
0:8b33ba38cc3a
Child:
1:d4cbfcb2be46
-

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Deurklink 0:8b33ba38cc3a 1 #include "mbed.h"
Deurklink 0:8b33ba38cc3a 2 #include <string>
Deurklink 0:8b33ba38cc3a 3 #include "GPS.h"
Deurklink 0:8b33ba38cc3a 4 #include "EthernetPowerControl.h"
Deurklink 0:8b33ba38cc3a 5 #include "MODSERIAL.h"
Deurklink 0:8b33ba38cc3a 6
Deurklink 0:8b33ba38cc3a 7 #define XBEETIMEOUT 5
Deurklink 0:8b33ba38cc3a 8
Deurklink 0:8b33ba38cc3a 9 class Beacon
Deurklink 0:8b33ba38cc3a 10 {
Deurklink 0:8b33ba38cc3a 11 public:
Deurklink 0:8b33ba38cc3a 12 Beacon(PinName gpsTx, PinName gpsRx, PinName xbTx, PinName xbRx, int freq, int len);
Deurklink 0:8b33ba38cc3a 13 GPS gps;
Deurklink 0:8b33ba38cc3a 14 bool init();
Deurklink 0:8b33ba38cc3a 15 void parseXbee();
Deurklink 0:8b33ba38cc3a 16 void parseGpsData();
Deurklink 0:8b33ba38cc3a 17 bool gpsReadable();
Deurklink 0:8b33ba38cc3a 18 bool xbeeReadable();
Deurklink 0:8b33ba38cc3a 19
Deurklink 0:8b33ba38cc3a 20 DigitalOut L1;
Deurklink 0:8b33ba38cc3a 21 DigitalOut L2;
Deurklink 0:8b33ba38cc3a 22 DigitalOut L3;
Deurklink 0:8b33ba38cc3a 23 DigitalOut L4;
Deurklink 0:8b33ba38cc3a 24
Deurklink 0:8b33ba38cc3a 25 private:
Deurklink 0:8b33ba38cc3a 26 MODSERIAL XBee;
Deurklink 0:8b33ba38cc3a 27 InterruptIn PPS;
Deurklink 0:8b33ba38cc3a 28 char RxBuffer[256];
Deurklink 0:8b33ba38cc3a 29
Deurklink 0:8b33ba38cc3a 30 bool PWMon;
Deurklink 0:8b33ba38cc3a 31 bool RxTO;
Deurklink 0:8b33ba38cc3a 32
Deurklink 0:8b33ba38cc3a 33 int TimingOffset;
Deurklink 0:8b33ba38cc3a 34 int BeaconNumber;
Deurklink 0:8b33ba38cc3a 35
Deurklink 0:8b33ba38cc3a 36 void ppsSync();
Deurklink 0:8b33ba38cc3a 37 void readDipSwitch();
Deurklink 0:8b33ba38cc3a 38 void initDipSwitch();
Deurklink 0:8b33ba38cc3a 39
Deurklink 0:8b33ba38cc3a 40 // Pins are all bound to a mbed pin in the constructor
Deurklink 0:8b33ba38cc3a 41 // Digital pins for setting the Timing offset
Deurklink 0:8b33ba38cc3a 42 DigitalIn T1;
Deurklink 0:8b33ba38cc3a 43 DigitalIn T2;
Deurklink 0:8b33ba38cc3a 44 DigitalIn T3;
Deurklink 0:8b33ba38cc3a 45 DigitalIn T4;
Deurklink 0:8b33ba38cc3a 46 DigitalIn T5;
Deurklink 0:8b33ba38cc3a 47 DigitalIn T6;
Deurklink 0:8b33ba38cc3a 48 DigitalIn T7;
Deurklink 0:8b33ba38cc3a 49 DigitalIn T8;
Deurklink 0:8b33ba38cc3a 50
Deurklink 0:8b33ba38cc3a 51 // Digital pins for setting the beacon number
Deurklink 0:8b33ba38cc3a 52 DigitalIn B1;
Deurklink 0:8b33ba38cc3a 53 DigitalIn B2;
Deurklink 0:8b33ba38cc3a 54 DigitalIn B3;
Deurklink 0:8b33ba38cc3a 55 DigitalIn B4;
Deurklink 0:8b33ba38cc3a 56
Deurklink 0:8b33ba38cc3a 57 int PulseFrequency; //Hz
Deurklink 0:8b33ba38cc3a 58 int Pulselength; //usec
Deurklink 0:8b33ba38cc3a 59 int PWMclock;
Deurklink 0:8b33ba38cc3a 60 int Period;
Deurklink 0:8b33ba38cc3a 61
Deurklink 0:8b33ba38cc3a 62
Deurklink 0:8b33ba38cc3a 63 Timeout _RxTimeOut;
Deurklink 0:8b33ba38cc3a 64 void rxTimeOut();
Deurklink 0:8b33ba38cc3a 65
Deurklink 0:8b33ba38cc3a 66 void startPWM();
Deurklink 0:8b33ba38cc3a 67 void stopPWM();
Deurklink 0:8b33ba38cc3a 68 void resetPWM(int _PulseFrequency, int _Pulselength);
Deurklink 0:8b33ba38cc3a 69 void printStatus();
Deurklink 0:8b33ba38cc3a 70 void getXbeeData();
Deurklink 0:8b33ba38cc3a 71 };