A multifunctional and modular Firmware for Multitech's mDot based on ARM mBed provides a widerange of functionality for several Sensors such as MAX44009, BME280, MPU9250, SI1143 and uBlox. It allows you to quickly build a Sensornode that measures specific data with its sensors and sends it via LoRaWAN.

Dependencies:   mDot_LoRa_Sensornode_Flowmeter_impl mbed-rtos mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers TaskGPS.cpp Source File

TaskGPS.cpp

00001 /*
00002  * TaskGPS.cpp
00003  *
00004  *  Created on: May 30, 2016
00005  *      Author: Adrian
00006  */
00007 
00008 #include "TaskGPS.h "
00009 
00010 TaskGPS::TaskGPS(uBlox* uBlox,Mutex* mutexUART, Queue<UBloxGPSMessage,GPS_QUEUE_LENGHT>* queue){
00011     this->mUBlox = uBlox;
00012     setMutex(mutexUART);
00013     setQueue(queue);
00014 }
00015 
00016 TaskGPS::TaskGPS(uBlox* uBlox,rtos::Mutex* mutexUART,
00017         rtos::Queue<UBloxGPSMessage,GPS_QUEUE_LENGHT>* queue,
00018         osPriority priority, uint32_t stackSize, unsigned char *stackPointer){
00019     this->mUBlox = uBlox;
00020     setMutex(mutexUART);
00021     setQueue(queue);
00022     setPriority(priority);
00023     setStackSize(stackSize);
00024     setStackPointer(stackPointer);
00025     setState(SLEEPING);
00026 }
00027 
00028 TaskGPS::~TaskGPS() {
00029     // TODO Auto-generated destructor stub
00030 }
00031 
00032 void TaskGPS::measure(){
00033     UBloxGPSMessage uBloxGPSMessage;
00034 
00035     while(true){
00036         mutexInterface->lock(osWaitForever);
00037         uBloxGPSMessage.setLongitude(mUBlox->getLongitude());
00038         uBloxGPSMessage.setLatitude(mUBlox->getLatitude());
00039         mutexInterface->unlock();
00040 
00041         queue->put(&uBloxGPSMessage,osWaitForever);
00042         osDelay(GPS_TASK_DELAY_MS);
00043     }
00044 
00045 
00046 }
00047 
00048 void TaskGPS::setQueue(Queue<UBloxGPSMessage,GPS_QUEUE_LENGHT>* queue){
00049     this->queue = queue;
00050 }