Abstraction for the glider class

Dependents:   DropTest

Glider.h

Committer:
chasefarmer2808
Date:
2017-04-29
Revision:
12:ca3e1c6203f7
Parent:
11:5e83ff964f5f
Child:
13:d95070aa9140

File content as of revision 12:ca3e1c6203f7:

#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 CMD_BUZZER 'b'
#define CMD_RESET 'z'

#define FREQ 1.0
#define CRUZE 0
#define LAND 1

#define PITO_V_DIVIDER 0.6666
#define PITO_ADC_RATIO 3.3 / 0xffff

#define AIR_DENSITY 1.225 //kg per m3

#define BUZZER_FREQ 700.0

class Glider {
public:
    Serial* dev;
    Serial* xbee;
    double heading;
    float pressure;
    float temp;
    float alt;
    float speed;
    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;
    Beep buzzer;
    void setHeading();
    void setTempPressAlt();
    void setAirSpeed();
    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);
};

#endif