-

Dependents:   GPSXbee_1_1 GPSXbee_1_0

Committer:
Deurklink
Date:
Tue Dec 16 13:00:07 2014 +0000
Revision:
1:d4cbfcb2be46
Parent:
0:8b33ba38cc3a
Version 1.1

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