Abstraction for the glider class
Glider.h@9:8e34e713e6ef, 2017-04-20 (annotated)
- Committer:
- chasefarmer2808
- Date:
- Thu Apr 20 16:39:12 2017 +0000
- Revision:
- 9:8e34e713e6ef
- Parent:
- 8:7fc2caa10bbb
- Child:
- 10:4c4f0ea887a4
air speed;
Who changed what in which revision?
User | Revision | Line number | New 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 | 0:4e6b53a7bd38 | 9 | |
chasefarmer2808 | 6:bb82dd1618c2 | 10 | #define SAVE_DATA_FORMAT "%d %d %d" |
chasefarmer2808 | 6:bb82dd1618c2 | 11 | #define CMD_BUZZER 'b' |
chasefarmer2808 | 6:bb82dd1618c2 | 12 | #define CMD_RESET 'r' |
chasefarmer2808 | 6:bb82dd1618c2 | 13 | |
chasefarmer2808 | 4:ff59603d9fb6 | 14 | #define FREQ 1.0 |
chasefarmer2808 | 6:bb82dd1618c2 | 15 | #define CRUZE 0 |
chasefarmer2808 | 6:bb82dd1618c2 | 16 | #define LAND 1 |
chasefarmer2808 | 3:d8932a3036a8 | 17 | |
chasefarmer2808 | 9:8e34e713e6ef | 18 | #define PITO_V_DIVIDER 0.6666 |
chasefarmer2808 | 9:8e34e713e6ef | 19 | #define PITO_ADC_RATIO 3.3 / 0xffff |
chasefarmer2808 | 9:8e34e713e6ef | 20 | |
chasefarmer2808 | 9:8e34e713e6ef | 21 | #define AIR_DENSITY 1.225 //kg per m3 |
chasefarmer2808 | 9:8e34e713e6ef | 22 | |
chasefarmer2808 | 9:8e34e713e6ef | 23 | //AnalogIn pitot(p15); |
chasefarmer2808 | 9:8e34e713e6ef | 24 | |
chasefarmer2808 | 0:4e6b53a7bd38 | 25 | class Glider { |
chasefarmer2808 | 0:4e6b53a7bd38 | 26 | public: |
chasefarmer2808 | 0:4e6b53a7bd38 | 27 | Serial* dev; |
chasefarmer2808 | 1:7039ae86fe70 | 28 | Serial* xbee; |
chasefarmer2808 | 0:4e6b53a7bd38 | 29 | double heading; |
chasefarmer2808 | 0:4e6b53a7bd38 | 30 | float pressure; |
chasefarmer2808 | 0:4e6b53a7bd38 | 31 | float temp; |
chasefarmer2808 | 0:4e6b53a7bd38 | 32 | float alt; |
chasefarmer2808 | 9:8e34e713e6ef | 33 | float speed; |
chasefarmer2808 | 6:bb82dd1618c2 | 34 | bool cmdFlag; |
chasefarmer2808 | 4:ff59603d9fb6 | 35 | bool transmitFlag; |
chasefarmer2808 | 7:dc93fe573846 | 36 | time_t startTime; //saved data |
chasefarmer2808 | 7:dc93fe573846 | 37 | time_t missionTime; |
chasefarmer2808 | 7:dc93fe573846 | 38 | uint8_t packetCount; //saved data |
chasefarmer2808 | 6:bb82dd1618c2 | 39 | uint8_t state; //saved data |
chasefarmer2808 | 0:4e6b53a7bd38 | 40 | HMC5883L* hmc; |
chasefarmer2808 | 0:4e6b53a7bd38 | 41 | BMP180* bmp; |
chasefarmer2808 | 1:7039ae86fe70 | 42 | Glider(Serial* device, PinName sda, PinName scl, PinName tx, PinName rx); |
chasefarmer2808 | 2:cc07e65227ff | 43 | InterruptIn xbeeRxInt; |
chasefarmer2808 | 9:8e34e713e6ef | 44 | AnalogIn pitot; |
chasefarmer2808 | 0:4e6b53a7bd38 | 45 | void setHeading(); |
chasefarmer2808 | 8:7fc2caa10bbb | 46 | void setTempPressAlt(); |
chasefarmer2808 | 9:8e34e713e6ef | 47 | void setAirSpeed(); |
chasefarmer2808 | 1:7039ae86fe70 | 48 | void setMissionTime(); |
chasefarmer2808 | 4:ff59603d9fb6 | 49 | void setTransmitFlag(); |
chasefarmer2808 | 5:460412fc4a17 | 50 | void initSaveData(); |
chasefarmer2808 | 0:4e6b53a7bd38 | 51 | void saveTelem(); |
chasefarmer2808 | 2:cc07e65227ff | 52 | void saveData(); |
chasefarmer2808 | 1:7039ae86fe70 | 53 | void transmitPacket(); |
chasefarmer2808 | 3:d8932a3036a8 | 54 | void setCommandFlag(); |
chasefarmer2808 | 2:cc07e65227ff | 55 | void processCommand(); |
chasefarmer2808 | 0:4e6b53a7bd38 | 56 | }; |
chasefarmer2808 | 0:4e6b53a7bd38 | 57 | |
chasefarmer2808 | 1:7039ae86fe70 | 58 | #endif |