Skip to content

Commit e2d518f

Browse files
Update README.md
1 parent c1d3e59 commit e2d518f

File tree

1 file changed

+127
-0
lines changed

1 file changed

+127
-0
lines changed

README.md

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,129 @@
11
# CoOp-Core
22
Co-Op (Co-Operative) Multitasking Algorithm library for c/c++ application's
3+
4+
### Version : 1.0.0
5+
6+
- #### Type : Software/Embedded Software
7+
8+
- #### Support :
9+
```diff
10+
+ Any c/c++ software's
11+
```
12+
13+
- #### Program Language : C/C++
14+
15+
- #### Properties :
16+
17+
- #### Changes :
18+
19+
- #### Required Library/Driver :
20+
21+
22+
### Initialization and de-initialization functions:
23+
24+
### CoOp Core operation functions:
25+
```c++
26+
uint8_t Task_RegisterNew(cTask_TypeDef *uTask, cTaskFunc_TypeDef uFunc);
27+
uint8_t Task_GetStepParam(uint8_t *paramIn);
28+
void Task_SetNextStepParam(uint8_t nexStep);
29+
void Task_IncTick(void);
30+
void Task_Delay(uint16_t tim, uint8_t step);
31+
void Task_Resume(cTask_TypeDef *uTask);
32+
void Task_ResumeAll(void);
33+
void Task_Suspend(cTask_TypeDef *uTask);
34+
void Task_SuspendAll(void);
35+
void Task_Delete(cTask_TypeDef *uTask);
36+
void Task_DeleteAll(void);
37+
void Task_RunCoOpSystem(void);
38+
```
39+
40+
### Macros:
41+
```c++
42+
#define _COOP_NMB_OF_TASK
43+
```
44+
45+
## How to use this library
46+
47+
### The CoOp Core library can be used as follows:
48+
1. Add coop_core.h header
49+
50+
2. Set the max number of tasks in coop_core_conf.h header, for example:
51+
52+
```c++
53+
/* -------- Configuration -------- */
54+
#define _COOP_NMB_OF_TASK 3
55+
```
56+
57+
3. Add Task_IncTick() in the 1ms timer ISR:
58+
59+
```c++
60+
Timer_ISR()
61+
{
62+
Task_IncTick();
63+
}
64+
```
65+
66+
4. Create the Tasks and her functions:
67+
68+
```c++
69+
cTask_TypeDef Task1;
70+
cTask_TypeDef Task2;
71+
cTask_TypeDef Task3;
72+
73+
void Task1Func(uint8_t *argument)
74+
{
75+
LED1_Toggle();
76+
Task_Delay(500, 0);
77+
}
78+
79+
void Task2Func(uint8_t *argument)
80+
{
81+
LED2_Toggle();
82+
Task_Delay(500, 0);
83+
}
84+
85+
void Task3Func(uint8_t *argument)
86+
{
87+
switch(*argument)
88+
{
89+
case 0: // Step 0 is default
90+
{
91+
LED3_On();
92+
Task_Delay(250, 1); // Wait 250ms and goto step 1 (case 1)
93+
}
94+
break;
95+
case 1: // Step 1
96+
{
97+
LED3_Off();
98+
Task_Delay(250, 0); // Wait 250ms and goto step 0 (case 0)
99+
}
100+
break;
101+
102+
default:
103+
break;
104+
}
105+
106+
}
107+
```
108+
109+
5. Register Tasks and run CoOp System, for example:
110+
111+
```c++
112+
/* Register User Tasks */
113+
Task_RegisterNew(&Task1, Task1Func);
114+
Task_RegisterNew(&Task2, Task2Func);
115+
Task_RegisterNew(&Task3, Task3Func);
116+
117+
/* Run CoOp System */
118+
Task_RunCoOpSystem();
119+
```
120+
121+
##### Example 1 (AVR): [Download](https://github.com/Majid-Derhambakhsh/CoOp-Core/tree/main/Example%20Source%20Code/AVR%20Example)
122+
##### Example 2 (STM32): [Download](https://github.com/Majid-Derhambakhsh/CoOp-Core/tree/main/Example%20Source%20Code/ARM%20Example)
123+
124+
## Tests performed:
125+
- [X] Run on AVR
126+
- [x] Run on STM32 Fx cores
127+
128+
#### Developer: Majid Derhambakhsh
129+

0 commit comments

Comments
 (0)