implementação do sgam_mdw baseado na placa NUCLEO FZ429ZI para ser testada

Dependencies:   MPU6050 Grove_temperature

Dependents:   sgam_mdw_test

Committer:
AndersonIctus
Date:
Sat Jul 20 14:02:50 2019 -0300
Revision:
17:8789ab4067a6
- Inclusao do GPS FAKE

Who changed what in which revision?

UserRevisionLine numberNew contents of line
AndersonIctus 17:8789ab4067a6 1 #include "sgam_mdw.h"
AndersonIctus 17:8789ab4067a6 2 #include "mbed.h"
AndersonIctus 17:8789ab4067a6 3
AndersonIctus 17:8789ab4067a6 4 #include "GPS.h"
AndersonIctus 17:8789ab4067a6 5 #include <stdlib.h>
AndersonIctus 17:8789ab4067a6 6
AndersonIctus 17:8789ab4067a6 7 // FAKE DATA !!
AndersonIctus 17:8789ab4067a6 8 static float LATITUDE[] = { -3.729082, -3.729681, -3.737186, -3.749637, -3.744262, -3.727500, -3.734366, -3.716379, -3.708595, -3.716506 };
AndersonIctus 17:8789ab4067a6 9 static float LONGITUDE[] = { -38.527864, -38.522864, -38.506823, -38.518743, -38.493957, -38.485239, -38.502019, -38.593300, -38.557838, -38.565691 };
AndersonIctus 17:8789ab4067a6 10 static float METERS[] = { 0, 10, 20, 30, 40, 50, 60, 70, 80, 90 };
AndersonIctus 17:8789ab4067a6 11
AndersonIctus 17:8789ab4067a6 12 GPS::GPS() {
AndersonIctus 17:8789ab4067a6 13 D_LOG("GPS Initialized !!\r\n");
AndersonIctus 17:8789ab4067a6 14 value = new GPSData();
AndersonIctus 17:8789ab4067a6 15 }
AndersonIctus 17:8789ab4067a6 16
AndersonIctus 17:8789ab4067a6 17 GPS::~GPS() {
AndersonIctus 17:8789ab4067a6 18 value->~GPSData();
AndersonIctus 17:8789ab4067a6 19 }
AndersonIctus 17:8789ab4067a6 20
AndersonIctus 17:8789ab4067a6 21 int GPS::initialize() { D_LOG("INITIALIZE %s! \r\n", this->getName() ); return 1; }
AndersonIctus 17:8789ab4067a6 22 int GPS::finalize() { D_LOG("FINALIZE %s! \r\n", this->getName() ); return 1; }
AndersonIctus 17:8789ab4067a6 23
AndersonIctus 17:8789ab4067a6 24 // Pega valorews FAKE para latitude, longitude e metros !!
AndersonIctus 17:8789ab4067a6 25 void GPS::getLocation(GPSData* data) {
AndersonIctus 17:8789ab4067a6 26 int pos = rand() % 10; // pega um valor randomico !!
AndersonIctus 17:8789ab4067a6 27 data->latitude = LATITUDE[pos];
AndersonIctus 17:8789ab4067a6 28 data->longitude = LONGITUDE[pos];
AndersonIctus 17:8789ab4067a6 29 data->meters = METERS[pos];
AndersonIctus 17:8789ab4067a6 30 }
AndersonIctus 17:8789ab4067a6 31
AndersonIctus 17:8789ab4067a6 32 GPSData* GPS::getValue() {
AndersonIctus 17:8789ab4067a6 33 getLocation(value);
AndersonIctus 17:8789ab4067a6 34 return value;
AndersonIctus 17:8789ab4067a6 35 }
AndersonIctus 17:8789ab4067a6 36
AndersonIctus 17:8789ab4067a6 37 const char* GPS::getName() {
AndersonIctus 17:8789ab4067a6 38 return "GPS";
AndersonIctus 17:8789ab4067a6 39 }