Abstraction for the glider class

Dependents:   DropTest

Committer:
chasefarmer2808
Date:
Sun Apr 09 05:05:52 2017 +0000
Revision:
0:4e6b53a7bd38
Child:
1:7039ae86fe70
testg;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
chasefarmer2808 0:4e6b53a7bd38 1 #include "Glider.h"
chasefarmer2808 0:4e6b53a7bd38 2
chasefarmer2808 0:4e6b53a7bd38 3 Glider::Glider(Serial* device, PinName sda, PinName scl) {
chasefarmer2808 0:4e6b53a7bd38 4 dev = device;
chasefarmer2808 0:4e6b53a7bd38 5 dev->printf("constructing glider...");
chasefarmer2808 0:4e6b53a7bd38 6 heading = 0;
chasefarmer2808 0:4e6b53a7bd38 7 telemetry = "hello";
chasefarmer2808 0:4e6b53a7bd38 8 hmc = new HMC5883L(sda, scl);
chasefarmer2808 0:4e6b53a7bd38 9 bmp = new BMP180(sda, scl);
chasefarmer2808 0:4e6b53a7bd38 10 bmp->Initialize(1013.25, BMP180_OSS_ULTRA_LOW_POWER);
chasefarmer2808 0:4e6b53a7bd38 11 }
chasefarmer2808 0:4e6b53a7bd38 12
chasefarmer2808 0:4e6b53a7bd38 13 void Glider::setHeading() {
chasefarmer2808 0:4e6b53a7bd38 14 this->heading = this->hmc->getHeadingXYDeg();
chasefarmer2808 0:4e6b53a7bd38 15 }
chasefarmer2808 0:4e6b53a7bd38 16
chasefarmer2808 0:4e6b53a7bd38 17 void Glider::setTempPress() {
chasefarmer2808 0:4e6b53a7bd38 18 bmp->ReadData(&this->temp, &this->pressure, &this->alt);
chasefarmer2808 0:4e6b53a7bd38 19 }
chasefarmer2808 0:4e6b53a7bd38 20
chasefarmer2808 0:4e6b53a7bd38 21 void Glider::saveTelem() {
chasefarmer2808 0:4e6b53a7bd38 22 FILE *fp = fopen("/telem/telem.txt", "w");
chasefarmer2808 0:4e6b53a7bd38 23 fprintf(fp, "hello,");
chasefarmer2808 0:4e6b53a7bd38 24 fclose(fp);
chasefarmer2808 0:4e6b53a7bd38 25 }