Abstraction for the glider class

Dependents:   DropTest

Committer:
chasefarmer2808
Date:
Sat Apr 29 18:49:55 2017 +0000
Revision:
12:ca3e1c6203f7
Parent:
11:5e83ff964f5f
Child:
13:d95070aa9140
init hmc

Who changed what in which revision?

UserRevisionLine numberNew contents of line
chasefarmer2808 0:4e6b53a7bd38 1 #ifndef Glider_H
chasefarmer2808 0:4e6b53a7bd38 2 #define Glider_H
chasefarmer2808 0:4e6b53a7bd38 3
chasefarmer2808 0:4e6b53a7bd38 4 #include "mbed.h"
chasefarmer2808 0:4e6b53a7bd38 5 #include <string>
chasefarmer2808 9:8e34e713e6ef 6 #include "math.h"
chasefarmer2808 0:4e6b53a7bd38 7 #include "HMC5883L.h"
chasefarmer2808 0:4e6b53a7bd38 8 #include "BMP180.h"
chasefarmer2808 11:5e83ff964f5f 9 #include "beep.h"
chasefarmer2808 0:4e6b53a7bd38 10
chasefarmer2808 6:bb82dd1618c2 11 #define SAVE_DATA_FORMAT "%d %d %d"
chasefarmer2808 6:bb82dd1618c2 12 #define CMD_BUZZER 'b'
chasefarmer2808 10:4c4f0ea887a4 13 #define CMD_RESET 'z'
chasefarmer2808 6:bb82dd1618c2 14
chasefarmer2808 4:ff59603d9fb6 15 #define FREQ 1.0
chasefarmer2808 6:bb82dd1618c2 16 #define CRUZE 0
chasefarmer2808 6:bb82dd1618c2 17 #define LAND 1
chasefarmer2808 3:d8932a3036a8 18
chasefarmer2808 9:8e34e713e6ef 19 #define PITO_V_DIVIDER 0.6666
chasefarmer2808 9:8e34e713e6ef 20 #define PITO_ADC_RATIO 3.3 / 0xffff
chasefarmer2808 9:8e34e713e6ef 21
chasefarmer2808 9:8e34e713e6ef 22 #define AIR_DENSITY 1.225 //kg per m3
chasefarmer2808 9:8e34e713e6ef 23
chasefarmer2808 11:5e83ff964f5f 24 #define BUZZER_FREQ 700.0
chasefarmer2808 11:5e83ff964f5f 25
chasefarmer2808 0:4e6b53a7bd38 26 class Glider {
chasefarmer2808 0:4e6b53a7bd38 27 public:
chasefarmer2808 0:4e6b53a7bd38 28 Serial* dev;
chasefarmer2808 1:7039ae86fe70 29 Serial* xbee;
chasefarmer2808 0:4e6b53a7bd38 30 double heading;
chasefarmer2808 0:4e6b53a7bd38 31 float pressure;
chasefarmer2808 0:4e6b53a7bd38 32 float temp;
chasefarmer2808 0:4e6b53a7bd38 33 float alt;
chasefarmer2808 9:8e34e713e6ef 34 float speed;
chasefarmer2808 6:bb82dd1618c2 35 bool cmdFlag;
chasefarmer2808 4:ff59603d9fb6 36 bool transmitFlag;
chasefarmer2808 7:dc93fe573846 37 time_t startTime; //saved data
chasefarmer2808 7:dc93fe573846 38 time_t missionTime;
chasefarmer2808 7:dc93fe573846 39 uint8_t packetCount; //saved data
chasefarmer2808 6:bb82dd1618c2 40 uint8_t state; //saved data
chasefarmer2808 0:4e6b53a7bd38 41 HMC5883L* hmc;
chasefarmer2808 0:4e6b53a7bd38 42 BMP180* bmp;
chasefarmer2808 1:7039ae86fe70 43 Glider(Serial* device, PinName sda, PinName scl, PinName tx, PinName rx);
chasefarmer2808 2:cc07e65227ff 44 InterruptIn xbeeRxInt;
chasefarmer2808 9:8e34e713e6ef 45 AnalogIn pitot;
chasefarmer2808 11:5e83ff964f5f 46 Beep buzzer;
chasefarmer2808 0:4e6b53a7bd38 47 void setHeading();
chasefarmer2808 8:7fc2caa10bbb 48 void setTempPressAlt();
chasefarmer2808 9:8e34e713e6ef 49 void setAirSpeed();
chasefarmer2808 1:7039ae86fe70 50 void setMissionTime();
chasefarmer2808 4:ff59603d9fb6 51 void setTransmitFlag();
chasefarmer2808 12:ca3e1c6203f7 52 void updateTelem();
chasefarmer2808 5:460412fc4a17 53 void initSaveData();
chasefarmer2808 0:4e6b53a7bd38 54 void saveTelem();
chasefarmer2808 2:cc07e65227ff 55 void saveData();
chasefarmer2808 1:7039ae86fe70 56 void transmitPacket();
chasefarmer2808 3:d8932a3036a8 57 void setCommandFlag();
chasefarmer2808 2:cc07e65227ff 58 void processCommand();
chasefarmer2808 11:5e83ff964f5f 59 void soundBuzzer(float freq, float dur, bool infinate);
chasefarmer2808 0:4e6b53a7bd38 60 };
chasefarmer2808 0:4e6b53a7bd38 61
chasefarmer2808 1:7039ae86fe70 62 #endif