Abstraction for the glider class
Glider.h
- Committer:
- chasefarmer2808
- Date:
- 2017-05-15
- Revision:
- 16:7e1a1cd9f9fb
- Parent:
- 14:a226bedae730
- Child:
- 17:aa62b351af43
File content as of revision 16:7e1a1cd9f9fb:
#ifndef Glider_H #define Glider_H #include "mbed.h" #include <string> #include "math.h" #include "HMC5883L.h" #include "BMP180.h" #include "beep.h" #define SAVE_DATA_FORMAT "%d %d %d" #define PACKET_FORMAT "3387, GLIDER, %d, %u, %.2f, %.2f, %.2f, %.2f, %.2f, %.2f, %d\r\n" #define CMD_BUZZER 'b' #define CMD_RESET 'z' #define CMD_NEXT_STATE 'n' #define CMD_PREV_STATE 'p' #define FREQ 1.0 #define CRUZE 0 #define LAND 1 #define PITO_V_DIVIDER 0.6666 #define SOLAR_V_DIVIDER 0.5 #define PITO_ADC_RATIO 3.3 / 0xffff #define AIR_DENSITY 1.225 //kg per m3 #define BUZZER_FREQ 700.0 #define ALT_THRESH 100.0 //meters #define EMERGENCY_TIMEOUT 60.0 class Glider { public: Serial* dev; Serial* xbee; double heading; float pressure; float temp; float alt; float speed; float solarVoltage; bool cmdFlag; bool transmitFlag; time_t startTime; //saved data time_t missionTime; uint8_t packetCount; //saved data uint8_t state; //saved data HMC5883L* hmc; BMP180* bmp; Glider(Serial* device, PinName sda, PinName scl, PinName tx, PinName rx); InterruptIn xbeeRxInt; AnalogIn pitot; AnalogIn solVoltIn; Beep buzzer; void setHeading(); void setTempPressAlt(); void setAirSpeed(); void setSolarVoltage(); void setMissionTime(); void setTransmitFlag(); void updateTelem(); void initSaveData(); void saveTelem(); void saveData(); void transmitPacket(); void setCommandFlag(); void processCommand(); void soundBuzzer(float freq, float dur, bool infinate); void checkForLand(); void endMission(); }; #endif