テスト用のあれこれ共用フォルダ
修訂 | b7e92dc5bd7780ee1dcec19aa9a4fd82661a5c20 (tree) |
---|---|
時間 | 2019-02-03 16:33:32 |
作者 | takemasa <suikan@user...> |
Commiter | takemasa |
Add task class.
@@ -0,0 +1,31 @@ | ||
1 | +/* | |
2 | + * task.cpp | |
3 | + * | |
4 | + * Created on: 2019/02/03 | |
5 | + * Author: takemasa | |
6 | + */ | |
7 | + | |
8 | +#include <task.hpp> | |
9 | + | |
10 | +// Pass through the parameters to the person class. Also, set the task body funciton pointer. | |
11 | +murasaki::Task::Task( | |
12 | + const char* task_name, | |
13 | + unsigned short stack_depth, | |
14 | + UBaseType_t task_priority, | |
15 | + const void* task_parameter, | |
16 | + void (*task_body_func)(const void*)) | |
17 | + : | |
18 | + murasaki::AbstractTask( | |
19 | + task_name, | |
20 | + stack_depth, | |
21 | + task_priority, | |
22 | + task_parameter), | |
23 | + task_body_func_(task_body_func) | |
24 | + { | |
25 | +} | |
26 | + | |
27 | +void murasaki::Task::TaskBody(const void* ptr) | |
28 | + { | |
29 | + // Call task body function | |
30 | + task_body_func_(ptr); | |
31 | +} |
@@ -0,0 +1,58 @@ | ||
1 | +/** | |
2 | + * \file task.hpp | |
3 | + * | |
4 | + * @date 2019/02/03 | |
5 | + * @author takemasa | |
6 | + */ | |
7 | + | |
8 | +#ifndef TASK_HPP_ | |
9 | +#define TASK_HPP_ | |
10 | + | |
11 | +#include <abstracttask.hpp> | |
12 | + | |
13 | +namespace murasaki { | |
14 | + | |
15 | +/** | |
16 | + * @brief An easy to use task class. | |
17 | + * @details | |
18 | + * This class is handy class to encapsulate the task creation without inheriting. | |
19 | + * A task can be created easy like : | |
20 | + * @code | |
21 | + * | |
22 | + * @endcode | |
23 | + * | |
24 | + */ | |
25 | +class Task : public murasaki::AbstractTask { | |
26 | + public: | |
27 | + /** | |
28 | + * | |
29 | + * @param task_name | |
30 | + * @param stack_depth | |
31 | + * @param task_priority | |
32 | + * @param task_parameter | |
33 | + * @param task_body_func | |
34 | + */ | |
35 | + Task( | |
36 | + const char * task_name, | |
37 | + unsigned short stack_depth, | |
38 | + UBaseType_t task_priority, | |
39 | + const void * task_parameter, | |
40 | + void (*task_body_func)(const void *)); | |
41 | + | |
42 | + protected: | |
43 | + /** | |
44 | + * | |
45 | + * @param ptr | |
46 | + */ | |
47 | + virtual void TaskBody(const void * ptr); | |
48 | + | |
49 | + private: | |
50 | + /** | |
51 | + * | |
52 | + * @param | |
53 | + */ | |
54 | + void (*task_body_func_)(const void *); | |
55 | + }; | |
56 | + | |
57 | +}; | |
58 | +#endif /* TASK_HPP_ */ |