SRK Version of mDot LoRa_Sensormode_SRK
Dependencies: libmDot mbed-rtos mbed
Fork of mDot_LoRa_Sensornode by
TaskProximity.h
00001 /** 00002 * @file TaskProximity.h 00003 * 00004 * @author Adrian 00005 * @date 03.06.2016 00006 * 00007 */ 00008 #include "SI1143.h " 00009 #include "SI1143ProximityMessage.h " 00010 #include "main.h" 00011 00012 #ifndef TASKPROXIMITY_H_ 00013 #define TASKPROXIMITY_H_ 00014 00015 /** 00016 * @class TaskProximity 00017 * @brief This TaskProximity Class handles the proximity measurement using the SI1143. 00018 * Starting the task using the start() starts the measurement. 00019 * It can be used alongside with other measurement Tasks inside the mbed::rtos 00020 * environment. The Task Class basically wraps mbeds Thread functionality. 00021 */ 00022 class TaskProximity { 00023 public: 00024 TaskProximity(SI1143*,Mutex*,Queue<SI1143ProximityMessage,PROXIMITY_QUEUE_LENGHT>*); 00025 TaskProximity(SI1143*,Mutex*,Queue<SI1143ProximityMessage,PROXIMITY_QUEUE_LENGHT>*, 00026 osPriority, uint32_t, unsigned char*); 00027 virtual ~TaskProximity(); 00028 00029 00030 /** 00031 * @brief Starts the task by building it and connecting a callback function to 00032 * the mbed::Thread 00033 * @return 00034 */ 00035 osStatus start(); 00036 00037 /** 00038 * @brief Stops the task. Should only be used after start() was used 00039 * @return 00040 */ 00041 osStatus stop(); 00042 00043 00044 /** 00045 * @brief Gets the actual state of the Task either RUNNING or SLEEPING 00046 * @return 00047 */ 00048 TASK_STATE getState(); 00049 00050 private: 00051 rtos::Thread* thread; 00052 rtos::Queue<SI1143ProximityMessage,PROXIMITY_QUEUE_LENGHT>* queue; 00053 rtos::Mutex* mutexI2C ; 00054 osPriority priority; 00055 uint32_t stack_size; 00056 unsigned char *stack_pointer; 00057 00058 TASK_STATE state; 00059 00060 SI1143* si1143; 00061 00062 00063 /** 00064 * @brief A Callback function thats called by the mbed::Thread of this TaskClass 00065 * @param 00066 */ 00067 static void callBack(void const *); 00068 00069 /** 00070 * @brief A thread safe method that acquires data from the gyroscope. After acquiring data from the 00071 * it stores the data inside a MPU9250GyroscopeMessage 00072 */ 00073 void measureProximity(); 00074 00075 00076 /** 00077 * @brief Sets the message Queue of the Task where the measured values will be stored 00078 * after the measurement 00079 * @param queueProximity the queue where the SI1143ProximityMessage will be stored 00080 */ 00081 void setQueue(Queue<SI1143ProximityMessage,PROXIMITY_QUEUE_LENGHT>* queueProximity); 00082 00083 /** 00084 * @brief Sets the mutex thats used for a thread safe measurement 00085 * @param mutexI2C the I2C mutex 00086 */ 00087 void setMutex(Mutex* mutexI2C); 00088 00089 /** 00090 * @brief Sets the priority of the Task 00091 * @param priority priority of the Task 00092 */ 00093 void setPriority(osPriority priority); 00094 00095 /** 00096 * @brief Sets the size of the Task 00097 * @param stackSize the stack size in Bytes 00098 */ 00099 void setStackSize(uint32_t stackSize); 00100 00101 /** 00102 * @brief Sets the stack pointer of for the task stack 00103 * @param stackPointer 00104 */ 00105 void setStackPointer(unsigned char* stackPointer); 00106 00107 00108 /** 00109 * @brief Sets the actual state of the Task. 00110 * @param taskState either RUNNING or SLEEPING 00111 */ 00112 void setState(TASK_STATE); 00113 }; 00114 00115 #endif /* TASKPROXIMITY_H_ */
Generated on Wed Jul 13 2022 09:23:48 by 1.7.2