implementação do sgam_mdw baseado na placa NUCLEO FZ429ZI para ser testada
Dependencies: MPU6050 Grove_temperature
Diff: sensor/gps/GPS.cpp
- Revision:
- 17:8789ab4067a6
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sensor/gps/GPS.cpp Sat Jul 20 14:02:50 2019 -0300 @@ -0,0 +1,39 @@ +#include "sgam_mdw.h" +#include "mbed.h" + +#include "GPS.h" +#include <stdlib.h> + +// FAKE DATA !! +static float LATITUDE[] = { -3.729082, -3.729681, -3.737186, -3.749637, -3.744262, -3.727500, -3.734366, -3.716379, -3.708595, -3.716506 }; +static float LONGITUDE[] = { -38.527864, -38.522864, -38.506823, -38.518743, -38.493957, -38.485239, -38.502019, -38.593300, -38.557838, -38.565691 }; +static float METERS[] = { 0, 10, 20, 30, 40, 50, 60, 70, 80, 90 }; + +GPS::GPS() { + D_LOG("GPS Initialized !!\r\n"); + value = new GPSData(); +} + +GPS::~GPS() { + value->~GPSData(); +} + +int GPS::initialize() { D_LOG("INITIALIZE %s! \r\n", this->getName() ); return 1; } +int GPS::finalize() { D_LOG("FINALIZE %s! \r\n", this->getName() ); return 1; } + +// Pega valorews FAKE para latitude, longitude e metros !! +void GPS::getLocation(GPSData* data) { + int pos = rand() % 10; // pega um valor randomico !! + data->latitude = LATITUDE[pos]; + data->longitude = LONGITUDE[pos]; + data->meters = METERS[pos]; +} + +GPSData* GPS::getValue() { + getLocation(value); + return value; +} + +const char* GPS::getName() { + return "GPS"; +}