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
Task.h
00001 /* 00002 * Task.h 00003 * 00004 * Created on: Sep 9, 2016 00005 * Author: Adrian 00006 */ 00007 #include "main.h" 00008 00009 #ifndef TASK_H_ 00010 #define TASK_H_ 00011 00012 class Task { 00013 public: 00014 Task(); 00015 virtual ~Task(); 00016 00017 /** 00018 * Starts the task by building and its measurement 00019 * @return 00020 */ 00021 osStatus start(); 00022 00023 /** 00024 * Stops the task. Should only be used after start() was used 00025 * @return 00026 */ 00027 osStatus stop(); 00028 00029 00030 /** 00031 * Gets the actual state of the Task either RUNNING or SLEEPING 00032 * @return 00033 */ 00034 TASK_STATE getState(); 00035 00036 protected: 00037 rtos::Thread* thread; 00038 rtos::Mutex* mutexInterface ; 00039 osPriority priority; 00040 uint32_t stack_size; 00041 unsigned char *stack_pointer; 00042 00043 TASK_STATE state; 00044 00045 /** 00046 * @brief A Callback function thats called by the mbed::Thread of this TaskClass 00047 * @param 00048 */ 00049 static void callBack(void const *); 00050 00051 /** 00052 * @brief Attaches the idle_hook for this task 00053 * @param 00054 */ 00055 void attachIdleHook(void (*fptr) (void)); 00056 00057 /** 00058 * @brief A thread safe method that measures the acceleration. After measuring the acceleration 00059 * of each axis it stores the value inside a MPU9250AccelerationMessage 00060 */ 00061 virtual void measure() = 0; 00062 00063 00064 /** 00065 * @brief Sets the mutex thats used for a thread safe measurement 00066 * @param mutexI2C the I2C mutex 00067 */ 00068 void setMutex(Mutex* mutexI2C); 00069 00070 /** 00071 * @brief Sets the priority of the Task 00072 * @param priority priority of the Task 00073 */ 00074 void setPriority(osPriority priority); 00075 00076 /** 00077 * @brief Sets the size of the Task 00078 * @param stackSize the stack size in Bytes 00079 */ 00080 void setStackSize(uint32_t stackSize); 00081 00082 /** 00083 * @brief Sets the stack pointer of for the task stack 00084 * @param stackPointer 00085 */ 00086 void setStackPointer(unsigned char* stackPointer); 00087 00088 00089 /** 00090 * @brief Sets the actual state of the Task 00091 * @param taskState either RUNNING or SLEEPING 00092 */ 00093 void setState(TASK_STATE taskState); 00094 }; 00095 00096 #endif /* TASK_H_ */
Generated on Tue Jul 12 2022 21:35:27 by
1.7.2