Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mDot_LoRa_Sensornode_Flowmeter_impl mbed-rtos mbed
TaskProximity.cpp
00001 /* 00002 * TaskProximity.cpp 00003 * 00004 * Created on: Jun 3, 2016 00005 * Author: Adrian 00006 */ 00007 00008 #include "TaskProximity.h " 00009 00010 TaskProximity::TaskProximity(SI1143* si1143,Mutex* mutexI2C, Queue<SI1143ProximityMessage,PROXIMITY_QUEUE_LENGHT>* queue){ 00011 this->si1143 = si1143; 00012 setMutex(mutexI2C); 00013 setQueue(queue); 00014 } 00015 00016 TaskProximity::TaskProximity(SI1143* si1143,rtos::Mutex* mutexI2C, 00017 rtos::Queue<SI1143ProximityMessage,PROXIMITY_QUEUE_LENGHT>* queue, 00018 osPriority priority, uint32_t stackSize, unsigned char *stackPointer){ 00019 this->si1143 = si1143; 00020 setMutex(mutexI2C); 00021 setQueue(queue); 00022 setPriority(priority); 00023 setStackSize(stackSize); 00024 setStackPointer(stackPointer); 00025 setState(SLEEPING); 00026 } 00027 00028 TaskProximity::~TaskProximity() { 00029 // TODO Auto-generated destructor stub 00030 } 00031 00032 void TaskProximity::measure(){ 00033 SI1143ProximityMessage si1143ProximityMessage; 00034 00035 while(true){ 00036 mutexInterface->lock(osWaitForever); 00037 si1143ProximityMessage.setProximity(si1143->getProximity(1)); 00038 mutexInterface->unlock(); 00039 00040 queue->put(&si1143ProximityMessage,osWaitForever); 00041 osDelay(PROXIMITY_TASK_DELAY_MS); 00042 } 00043 } 00044 00045 void TaskProximity::setQueue(Queue<SI1143ProximityMessage,PROXIMITY_QUEUE_LENGHT>* queue){ 00046 this->queue = queue; 00047 }
Generated on Tue Jul 12 2022 21:35:27 by
1.7.2